goshippo / shippo-node-client

Shipping API Node.js library (USPS, FedEx, UPS and more)
https://goshippo.com/docs
MIT License
136 stars 54 forks source link

Property 'carrieraccount' does not exist on type 'Shippo' #77

Open ohabash opened 2 years ago

ohabash commented 2 years ago

I am having trouble reaching carrieraccount. Ive notice several situations where @types might be out-of-date?

import * as shippoClient from 'shippo';
shippoClient('**').carrieraccount;

results in the following error

Property 'carrieraccount' does not exist on type 'Shippo'.

"@types/shippo": "^1.5.1",
"shippo": "^1.7.1",
bobbyhalljr commented 2 years ago

Hi @ohabash, You are using an open source library called @types/shippo that is not owned nor maintained by Shippo. The open source library you are using is not extensive nor does it cover all types in shippo including carrieraccount. The current types supported by this open source library can be found here: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/shippo/index.d.ts

Unfortunately, Shippo does not have Typescript support for our Node.js library at this time. You can use the JavaScript examples in our API docs here - https://goshippo.com/docs/reference/js#carrier-accounts

Example usage:

const shippo = require('shippo')('<YOUR_PRIVATE_KEY>')

// EXAMPLE | Create carrier account
shippo.carrieraccount.create({
    "carrier":"fedex", 
    "account_id":"<YOUR_FEDEX_ACCOUNT_NUMBER>", 
    "parameters":{"meter":"<YOUR_FEDEX_METER_NUMBER>"},
    "test":true,
    "active":true
}, function(err, account) {
  // asynchronously called
});

// EXAMPLE | Retrieve carrier account
shippo.carrieraccount.retrieve('<OBJECT_ID_OF_CARRIER_ACCOUNT>')
peterb0yd commented 2 years ago

Unfortunately those types are missing Transaction which is imperative for creating a label ☹️ @bobbyhalljr