@easypost/api
Advanced tools
Comparing version 3.3.0 to 3.4.0
{ | ||
"name": "@easypost/api", | ||
"description": "EasyPost Node Client Library", | ||
"version": "3.3.0", | ||
"version": "3.4.0", | ||
"author": "Easypost Engineering <support@easypost.com>", | ||
@@ -6,0 +6,0 @@ "homepage": "https://easypost.com", |
@@ -6,19 +6,19 @@ import superagent from 'superagent'; | ||
import Address from './resources/address'; | ||
import ApiKey from './resources/apiKey'; | ||
import Batch from './resources/batch'; | ||
import CarrierAccount from './resources/carrierAccount'; | ||
import CarrierType from './resources/carrierType'; | ||
import CustomsInfo from './resources/customsInfo'; | ||
import CustomsItem from './resources/customsItem'; | ||
import Insurance from './resources/insurance'; | ||
import Order from './resources/order'; | ||
import Parcel from './resources/parcel'; | ||
import Pickup from './resources/pickup'; | ||
import Report from './resources/report'; | ||
import ScanForm from './resources/scan_form'; | ||
import Shipment from './resources/shipment'; | ||
import Tracker from './resources/tracker'; | ||
import User from './resources/user'; | ||
import Webhook from './resources/webhook'; | ||
import Address, { propTypes as addressPropTypes } from './resources/address'; | ||
import ApiKey, { propTypes as apiKeyPropTypes } from './resources/apiKey'; | ||
import Batch, { propTypes as batchPropTypes } from './resources/batch'; | ||
import CarrierAccount, { propTypes as carrierAccountPropTypes } from './resources/carrierAccount'; | ||
import CarrierType, { propTypes as carrierTypePropTypes } from './resources/carrierType'; | ||
import CustomsInfo, { propTypes as customsInfoPropTypes } from './resources/customsInfo'; | ||
import CustomsItem, { propTypes as customsItemPropTypes } from './resources/customsItem'; | ||
import Insurance, { propTypes as insurancePropTypes } from './resources/insurance'; | ||
import Order, { propTypes as orderPropTypes } from './resources/order'; | ||
import Parcel, { propTypes as parcelPropTypes } from './resources/parcel'; | ||
import Pickup, { propTypes as pickupPropTypes } from './resources/pickup'; | ||
import Report, { propTypes as reportPropTypes } from './resources/report'; | ||
import ScanForm, { propTypes as scanFormPropTypes } from './resources/scan_form'; | ||
import Shipment, { propTypes as shipmentPropTypes } from './resources/shipment'; | ||
import Tracker, { propTypes as trackerPropTypes } from './resources/tracker'; | ||
import User, { propTypes as userPropTypes } from './resources/user'; | ||
import Webhook, { propTypes as webhookPropTypes } from './resources/webhook'; | ||
@@ -77,2 +77,22 @@ import RequestError from './errors/request'; | ||
export const PROP_TYPES = { | ||
addressPropTypes, | ||
apiKeyPropTypes, | ||
batchPropTypes, | ||
carrierAccountPropTypes, | ||
carrierTypePropTypes, | ||
customsInfoPropTypes, | ||
customsItemPropTypes, | ||
insurancePropTypes, | ||
orderPropTypes, | ||
parcelPropTypes, | ||
pickupPropTypes, | ||
reportPropTypes, | ||
scanFormPropTypes, | ||
shipmentPropTypes, | ||
trackerPropTypes, | ||
userPropTypes, | ||
webhookPropTypes, | ||
}; | ||
export default class API { | ||
@@ -97,6 +117,12 @@ // Build request headers to be sent by default with each request, combined | ||
constructor(key, options = {}) { | ||
if (!key && !options.useCookie) { | ||
if (!key && !options.useProxy && !options.useCookie) { | ||
throw new Error('No API key supplied. Pass in an API key as the first argument.'); | ||
} | ||
if (options.useCookie) { | ||
/* eslint no-console: 0 */ | ||
console.warn('options.useCookie is deprecated and will be removed in 4.0.' + | ||
' Please use `options.useProxy`.'); | ||
} | ||
this.key = key; | ||
@@ -137,3 +163,3 @@ this.timeout = options.timeout || DEFAULT_TIMEOUT; | ||
if (!this.useCookie) { | ||
if (this.key) { | ||
req.auth(this.key); | ||
@@ -140,0 +166,0 @@ } |
import T from 'proptypes'; | ||
import base from './base'; | ||
export const propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
mode: T.string, | ||
street1: T.string, | ||
street2: T.string, | ||
city: T.string, | ||
state: T.string, | ||
zip: T.string, | ||
country: T.string, | ||
residential: T.bool, | ||
carrier_facility: T.string, | ||
name: T.string, | ||
company: T.string, | ||
phone: T.string, | ||
email: T.string, | ||
federal_tax_id: T.string, | ||
state_tax_id: T.string, | ||
verify: T.array, | ||
verify_strict: T.array, | ||
verifications: T.object, | ||
}; | ||
export default api => ( | ||
@@ -9,26 +32,4 @@ class Address extends base(api) { | ||
static key = 'address'; | ||
static propTypes = propTypes; | ||
static propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
mode: T.string, | ||
street1: T.string, | ||
street2: T.string, | ||
city: T.string, | ||
state: T.string, | ||
zip: T.string, | ||
country: T.string, | ||
residential: T.bool, | ||
carrier_facility: T.string, | ||
name: T.string, | ||
company: T.string, | ||
phone: T.string, | ||
email: T.string, | ||
federal_tax_id: T.string, | ||
state_tax_id: T.string, | ||
verify: T.array, | ||
verify_strict: T.array, | ||
verifications: T.object, | ||
} | ||
static all() { | ||
@@ -35,0 +36,0 @@ return this.notImplemented('all'); |
import T from 'proptypes'; | ||
import base from './base'; | ||
export const propTypes = { | ||
id: T.string, | ||
keys: T.array, | ||
children: T.array, | ||
}; | ||
export default api => ( | ||
class ApiKey extends base(api) { | ||
static propTypes = propTypes; | ||
static _name = 'ApiKey'; | ||
static _url = 'api_keys'; | ||
static propTypes = { | ||
id: T.string, | ||
keys: T.array, | ||
children: T.array, | ||
} | ||
static delete() { | ||
@@ -16,0 +17,0 @@ return this.notImplemented('delete'); |
@@ -6,2 +6,18 @@ import T from 'proptypes'; | ||
export const propTypes = { | ||
id: T.string, | ||
reference: T.string, | ||
object: T.string, | ||
mode: T.string, | ||
state: T.string, | ||
num_shipments: T.number, | ||
shipments: T.array, | ||
status: T.object, | ||
label_url: T.string, | ||
scan_form: T.object, | ||
pickup: T.object, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
}; | ||
export default api => ( | ||
@@ -12,19 +28,4 @@ class Batch extends base(api) { | ||
static key = 'batch'; | ||
static propTypes = propTypes; | ||
static propTypes = { | ||
id: T.string, | ||
reference: T.string, | ||
object: T.string, | ||
mode: T.string, | ||
state: T.string, | ||
num_shipments: T.number, | ||
shipments: T.array, | ||
status: T.object, | ||
label_url: T.string, | ||
scan_form: T.object, | ||
pickup: T.object, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
} | ||
static delete() { | ||
@@ -31,0 +32,0 @@ return this.notImplemented('delete'); |
import T from 'proptypes'; | ||
import base from './base'; | ||
export const propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
type: T.string, | ||
fields: T.object, | ||
clone: T.bool, | ||
description: T.string, | ||
reference: T.string, | ||
readable: T.string, | ||
credentials: T.object, | ||
test_credentials: T.object, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
}; | ||
export default api => ( | ||
@@ -9,18 +24,4 @@ class CarrierAccount extends base(api) { | ||
static key = 'carrier_account'; | ||
static propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
type: T.string, | ||
fields: T.object, | ||
clone: T.bool, | ||
description: T.string, | ||
reference: T.string, | ||
readable: T.string, | ||
credentials: T.object, | ||
test_credentials: T.object, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
} | ||
static propTypes = propTypes; | ||
} | ||
); |
import T from 'proptypes'; | ||
import base from './base'; | ||
export const propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
type: T.string, | ||
readable: T.string, | ||
logo: T.string, | ||
fields: T.object, | ||
}; | ||
export default api => ( | ||
class CarrierType extends base(api) { | ||
static propTypes = propTypes; | ||
static _name = 'CarrierType'; | ||
static _url = 'carrier_types'; | ||
static propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
type: T.string, | ||
readable: T.string, | ||
logo: T.string, | ||
fields: T.object, | ||
} | ||
static retrieve() { | ||
@@ -19,0 +20,0 @@ return super.notImplemented('retrieve'); |
import T from 'proptypes'; | ||
import base from './base'; | ||
import customsItem from './customsItem'; | ||
import { propTypes as ciPropTypes } from './customsItem'; | ||
export default (api) => { | ||
const CustomsItem = customsItem(api); | ||
export const propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
mode: T.string, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
customs_certify: T.bool, | ||
customs_signer: T.string, | ||
contents_type: T.string, | ||
contents_explanation: T.string, | ||
restriction_type: T.string, | ||
eel_pfc: T.string, | ||
customs_items: T.arrayOf(T.shape(ciPropTypes)), | ||
}; | ||
return class CustomsInfo extends base(api) { | ||
export default api => ( | ||
class CustomsInfo extends base(api) { | ||
static _name = 'CustomsInfo'; | ||
static _url = 'customs_infos'; | ||
static key = 'customs_info'; | ||
static propTypes = propTypes; | ||
static propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
mode: T.string, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
customs_certify: T.bool, | ||
customs_signer: T.string, | ||
contents_type: T.string, | ||
contents_explanation: T.string, | ||
restriction_type: T.string, | ||
eel_pfc: T.string, | ||
customs_items: T.arrayOf(T.shape(CustomsItem.propTypes)), | ||
} | ||
static all() { | ||
@@ -35,3 +34,3 @@ return super.notImplemented('all'); | ||
} | ||
}; | ||
}; | ||
} | ||
); |
import T from 'proptypes'; | ||
import base from './base'; | ||
export const propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
mode: T.string, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
description: T.string, | ||
quantity: T.number, | ||
value: T.string, // decimal, so use as a string instead of a number | ||
weight: T.number, | ||
hs_tariff_number: T.string, | ||
code: T.string, | ||
origin_country: T.string, | ||
currency: T.string, | ||
}; | ||
export default api => ( | ||
class CustomsItem extends base(api) { | ||
static propTypes = propTypes; | ||
static _name = 'CustomsItem'; | ||
@@ -10,18 +27,2 @@ static _url = 'customs_items'; | ||
static propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
mode: T.string, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
description: T.string, | ||
quantity: T.number, | ||
value: T.string, // decimal, so use as a string instead of a number | ||
weight: T.number, | ||
hs_tariff_number: T.string, | ||
code: T.string, | ||
origin_country: T.string, | ||
currency: T.string, | ||
} | ||
static all() { | ||
@@ -28,0 +29,0 @@ return this.notImplemented('all'); |
import T from 'proptypes'; | ||
import base from './base'; | ||
import address from './address'; | ||
import tracker from './tracker'; | ||
import { propTypes as addressPropTypes } from './address'; | ||
import { propTypes as trackerPropTypes } from './tracker'; | ||
export default (api) => { | ||
const Address = address(api); | ||
const Tracker = tracker(api); | ||
export const propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
reference: T.string, | ||
mode: T.string, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
amount: T.string, | ||
provider: T.string, | ||
provider_id: T.string, | ||
shipment_id: T.string, | ||
tracking_code: T.string, | ||
status: T.string, | ||
tracker: T.oneOfType([T.string, T.shape(trackerPropTypes)]), | ||
to_address: T.oneOfType([T.string, T.shape(addressPropTypes)]), | ||
from_address: T.oneOfType([T.string, T.shape(addressPropTypes)]), | ||
fee: T.object, | ||
messages: T.array, | ||
}; | ||
return class Insurance extends base(api) { | ||
export default api => ( | ||
class Insurance extends base(api) { | ||
static _name = 'Insurance'; | ||
static _url = 'insurances'; | ||
static key = 'insurance'; | ||
static propTypes = propTypes; | ||
static propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
reference: T.string, | ||
mode: T.string, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
amount: T.string, | ||
provider: T.string, | ||
provider_id: T.string, | ||
shipment_id: T.string, | ||
tracking_code: T.string, | ||
status: T.string, | ||
tracker: T.oneOfType([T.string, T.shape(Tracker.propTypes)]), | ||
to_address: T.oneOfType([T.string, T.shape(Address.propTypes)]), | ||
from_address: T.oneOfType([T.string, T.shape(Address.propTypes)]), | ||
fee: T.object, | ||
messages: T.array, | ||
} | ||
static delete() { | ||
return this.notImplemented('delete'); | ||
} | ||
}; | ||
}; | ||
} | ||
); |
import T from 'proptypes'; | ||
import address from './address'; | ||
import shipment from './shipment'; | ||
import base from './base'; | ||
import { propTypes as addressPropTypes } from './address'; | ||
import { propTypes as shipmentPropTypes } from './shipment'; | ||
export default (api) => { | ||
const Address = address(api); | ||
const Shipment = shipment(api); | ||
export const propTypes = { | ||
id: T.string, | ||
reference: T.string, | ||
object: T.string, | ||
mode: T.string, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
to_address: T.oneOfType([T.string, T.shape(addressPropTypes)]), | ||
from_address: T.oneOfType([T.string, T.shape(addressPropTypes)]), | ||
return_address: T.oneOfType([T.string, T.shape(addressPropTypes)]), | ||
buyer_address: T.oneOfType([T.string, T.shape(addressPropTypes)]), | ||
shipments: T.arrayOf(T.shape(shipmentPropTypes)), | ||
rates: T.arrayOf(T.object), | ||
messages: T.arrayOf(T.object), | ||
is_return: T.bool, | ||
carrier_accounts: T.arrayOf(T.oneOfType([T.string, T.object])), | ||
}; | ||
return class Order extends base(api) { | ||
export default api => ( | ||
class Order extends base(api) { | ||
static propTypes = propTypes; | ||
static _name = 'Order'; | ||
@@ -16,20 +32,2 @@ static _url = 'orders'; | ||
static propTypes = { | ||
id: T.string, | ||
reference: T.string, | ||
object: T.string, | ||
mode: T.string, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
to_address: T.oneOfType([T.string, T.shape(Address.propTypes)]), | ||
from_address: T.oneOfType([T.string, T.shape(Address.propTypes)]), | ||
return_address: T.oneOfType([T.string, T.shape(Address.propTypes)]), | ||
buyer_address: T.oneOfType([T.string, T.shape(Address.propTypes)]), | ||
shipments: T.arrayOf(T.shape(Shipment.propTypes)), | ||
rates: T.arrayOf(T.object), | ||
messages: T.arrayOf(T.object), | ||
is_return: T.bool, | ||
carrier_accounts: T.arrayOf(T.oneOfType([T.string, T.object])), | ||
} | ||
static jsonIdKeys = [ | ||
@@ -58,3 +56,3 @@ 'to_address', | ||
} | ||
}; | ||
}; | ||
} | ||
); |
import T from 'proptypes'; | ||
import base from './base'; | ||
export const propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
mode: T.string, | ||
length: T.number, | ||
width: T.number, | ||
height: T.number, | ||
predefined_package: T.string, | ||
weight: T.number, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
}; | ||
export default api => ( | ||
@@ -9,16 +23,4 @@ class Parcel extends base(api) { | ||
static key ='parcel'; | ||
static propTypes = propTypes; | ||
static propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
mode: T.string, | ||
length: T.number, | ||
width: T.number, | ||
height: T.number, | ||
predefined_package: T.string, | ||
weight: T.number, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
} | ||
static all() { | ||
@@ -25,0 +27,0 @@ return this.notImplemented('all'); |
import T from 'proptypes'; | ||
import base from './base'; | ||
import shipment from './shipment'; | ||
import batch from './batch'; | ||
import address from './address'; | ||
import carrierAccount from './carrierAccount'; | ||
export default (api) => { | ||
const Shipment = shipment(api); | ||
const Address = address(api); | ||
const Batch = batch(api); | ||
const CarrierAccount = carrierAccount(api); | ||
import { propTypes as shipmentPropTypes } from './shipment'; | ||
import { propTypes as batchPropTypes } from './batch'; | ||
import { propTypes as addressPropTypes } from './address'; | ||
import { propTypes as carrierAccountPropTypes } from './carrierAccount'; | ||
return class Pickup extends base(api) { | ||
export const propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
reference: T.string, | ||
mode: T.string, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
min_datetime: T.oneOfType([T.object, T.string]), | ||
max_datetime: T.oneOfType([T.object, T.string]), | ||
is_account_address: T.bool, | ||
instructions: T.string, | ||
messages: T.object, | ||
confirmation: T.string, | ||
address: T.oneOfType([T.string, T.shape(addressPropTypes)]), | ||
shipment: T.oneOfType([T.string, T.shape(shipmentPropTypes)]), | ||
batch: T.oneOfType([T.string, T.shape(batchPropTypes)]), | ||
carrier_accounts: T.arrayOf(T.oneOfType([T.string, T.shape(carrierAccountPropTypes)])), | ||
pickup_rates: T.object, | ||
}; | ||
export default api => ( | ||
class Pickup extends base(api) { | ||
static propTypes = propTypes; | ||
static _name = 'Pickup'; | ||
@@ -19,22 +36,2 @@ static _url = 'pickups'; | ||
static propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
reference: T.string, | ||
mode: T.string, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
min_datetime: T.oneOfType([T.object, T.string]), | ||
max_datetime: T.oneOfType([T.object, T.string]), | ||
is_account_address: T.bool, | ||
instructions: T.string, | ||
messages: T.object, | ||
confirmation: T.string, | ||
address: T.oneOfType([T.string, T.shape(Address.propTypes)]), | ||
shipment: T.oneOfType([T.string, T.shape(Shipment.propTypes)]), | ||
batch: T.oneOfType([T.string, T.shape(Batch.propTypes)]), | ||
carrier_accounts: T.arrayOf(T.oneOfType([T.string, T.shape(CarrierAccount.proptypes)])), | ||
pickup_rates: T.object, | ||
} | ||
static jsonIdKeys = [ | ||
@@ -70,3 +67,3 @@ 'address', | ||
} | ||
}; | ||
}; | ||
} | ||
); |
import T from 'proptypes'; | ||
import base from './base'; | ||
export const propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
type: T.string, | ||
mode: T.string, | ||
status: T.string, | ||
start_date: T.string, | ||
end_date: T.string, | ||
include_children: T.bool, | ||
url: T.string, | ||
url_expires_at: T.oneOfType([T.object, T.string]), | ||
send_email: T.bool, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
}; | ||
export default api => ( | ||
class Report extends base(api) { | ||
static _url = 'reports'; | ||
static propTypes = propTypes; | ||
static propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
type: T.string, | ||
mode: T.string, | ||
status: T.string, | ||
start_date: T.string, | ||
end_date: T.string, | ||
include_children: T.bool, | ||
url: T.string, | ||
url_expires_at: T.oneOfType([T.object, T.string]), | ||
send_email: T.bool, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
} | ||
constructor(data = {}) { | ||
@@ -25,0 +26,0 @@ super(data); |
import T from 'proptypes'; | ||
import base from './base'; | ||
import address from './address'; | ||
import { propTypes as addressPropTypes } from './address'; | ||
export default (api) => { | ||
const Address = address(api); | ||
export const propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
status: T.string, | ||
message: T.string, | ||
address: T.oneOfType([T.string, T.shape(addressPropTypes)]), | ||
tracking_codes: T.arrayOf(T.string), | ||
form_url: T.string, | ||
form_file_type: T.string, | ||
batch_id: T.string, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
}; | ||
return class ScanForm extends base(api) { | ||
export default api => ( | ||
class ScanForm extends base(api) { | ||
static propTypes = propTypes; | ||
static _name = 'ScanForm'; | ||
static _url = 'scan_forms'; | ||
static propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
status: T.string, | ||
message: T.string, | ||
address: T.oneOfType([T.string, T.shape(Address.propTypes)]), | ||
tracking_codes: T.arrayOf(T.string), | ||
form_url: T.string, | ||
form_file_type: T.string, | ||
batch_id: T.string, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
} | ||
static delete() { | ||
@@ -49,3 +48,3 @@ return this.notImplemented('delete'); | ||
} | ||
}; | ||
}; | ||
} | ||
); |
import T from 'proptypes'; | ||
import base from './base'; | ||
import address from './address'; | ||
import parcel from './parcel'; | ||
import customsInfo from './customsInfo'; | ||
import insurance from './insurance'; | ||
import tracker from './tracker'; | ||
export default (api) => { | ||
const Address = address(api); | ||
const Parcel = parcel(api); | ||
const CustomsInfo = customsInfo(api); | ||
const Insurance = insurance(api); | ||
const Tracker = tracker(api); | ||
import { propTypes as addressPropTypes } from './address'; | ||
import { propTypes as parcelPropTypes } from './parcel'; | ||
import { propTypes as customsInfoPropTypes } from './customsInfo'; | ||
import { propTypes as insurancePropTypes } from './insurance'; | ||
import { propTypes as trackerPropTypes } from './tracker'; | ||
return class Shipment extends base(api) { | ||
export const propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
reference: T.string, | ||
mode: T.string, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
to_address: T.oneOfType([T.string, T.shape(addressPropTypes)]), | ||
from_address: T.oneOfType([T.string, T.shape(addressPropTypes)]), | ||
return_address: T.oneOfType([T.string, T.shape(addressPropTypes)]), | ||
buyer_address: T.oneOfType([T.string, T.shape(addressPropTypes)]), | ||
parcel: T.oneOfType([T.string, T.shape(parcelPropTypes)]), | ||
customs_info: T.oneOfType([T.string, T.shape(customsInfoPropTypes)]), | ||
carrier_accounts: T.arrayOf(T.string), | ||
carrier_account: T.string, | ||
scan_form: T.oneOfType([T.string, T.object]), | ||
forms: T.array, | ||
insurance: T.oneOfType([T.string, T.shape(insurancePropTypes)]), | ||
rates: T.arrayOf(T.object), | ||
selected_rate: T.object, | ||
postage_label: T.object, | ||
messages: T.array, | ||
options: T.object, | ||
is_return: T.bool, | ||
tracking_code: T.string, | ||
service: T.string, | ||
services: T.arrayOf(T.string), | ||
usps_zone: T.string, | ||
status: T.string, | ||
tracker: T.oneOfType([T.string, T.shape(trackerPropTypes)]), | ||
fees: T.array, | ||
refund_status: T.string, | ||
batch_id: T.string, | ||
batch_status: T.string, | ||
batch_message: T.string, | ||
}; | ||
export default api => ( | ||
class Shipment extends base(api) { | ||
static _name = 'Shipment'; | ||
static _url = 'shipments'; | ||
static key = 'shipment'; | ||
static propTypes = propTypes; | ||
static propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
reference: T.string, | ||
mode: T.string, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
to_address: T.oneOfType([T.string, T.shape(Address.propTypes)]), | ||
from_address: T.oneOfType([T.string, T.shape(Address.propTypes)]), | ||
return_address: T.oneOfType([T.string, T.shape(Address.propTypes)]), | ||
buyer_address: T.oneOfType([T.string, T.shape(Address.propTypes)]), | ||
parcel: T.oneOfType([T.string, T.shape(Parcel.propTypes)]), | ||
customs_info: T.oneOfType([T.string, T.shape(CustomsInfo.propTypes)]), | ||
carrier_accounts: T.arrayOf(T.string), | ||
carrier_account: T.string, | ||
scan_form: T.oneOfType([T.string, T.object]), | ||
forms: T.array, | ||
insurance: T.oneOfType([T.string, T.shape(Insurance.propTypes)]), | ||
rates: T.arrayOf(T.object), | ||
selected_rate: T.object, | ||
postage_label: T.object, | ||
messages: T.array, | ||
options: T.object, | ||
is_return: T.bool, | ||
tracking_code: T.string, | ||
service: T.string, | ||
services: T.arrayOf(T.string), | ||
usps_zone: T.string, | ||
status: T.string, | ||
tracker: T.oneOfType([T.string, T.shape(Tracker.propTypes)]), | ||
fees: T.array, | ||
refund_status: T.string, | ||
batch_id: T.string, | ||
batch_status: T.string, | ||
batch_message: T.string, | ||
} | ||
static jsonIdKeys = [ | ||
@@ -164,3 +160,3 @@ 'to_address', | ||
} | ||
}; | ||
}; | ||
} | ||
); |
import T from 'proptypes'; | ||
import base from './base'; | ||
export const propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
reference: T.string, | ||
mode: T.string, | ||
tracking_code: T.string, | ||
status: T.string, | ||
signed_by: T.string, | ||
weight: T.number, | ||
est_delivery_date: T.object, | ||
shipment_id: T.string, | ||
carrier: T.string, | ||
tracking_details: T.object, | ||
carrier_detail: T.object, | ||
public_url: T.string, | ||
fees: T.array, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
}; | ||
export default api => ( | ||
class Tracker extends base(api) { | ||
static propTypes = propTypes; | ||
static _name = 'Tracker'; | ||
@@ -10,22 +31,2 @@ static _url = 'trackers'; | ||
static propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
reference: T.string, | ||
mode: T.string, | ||
tracking_code: T.string, | ||
status: T.string, | ||
signed_by: T.string, | ||
weight: T.number, | ||
est_delivery_date: T.object, | ||
shipment_id: T.string, | ||
carrier: T.string, | ||
tracking_details: T.object, | ||
carrier_detail: T.object, | ||
public_url: T.string, | ||
fees: T.array, | ||
created_at: T.oneOfType([T.object, T.string]), | ||
updated_at: T.oneOfType([T.object, T.string]), | ||
} | ||
static delete() { | ||
@@ -32,0 +33,0 @@ return this.notImplemented('delete'); |
import T from 'proptypes'; | ||
import base from './base'; | ||
export const propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
parent_id: T.string, | ||
name: T.string, | ||
email: T.string, | ||
phone_number: T.string, | ||
children: T.array, | ||
// api sends back numbers as strings, even though we want numbers | ||
balance: T.oneOfType([T.object, T.string]), | ||
price_per_shipment: T.oneOfType([T.object, T.string]), | ||
recharge_amount: T.oneOfType([T.object, T.string]), | ||
secondary_recharge_amount: T.oneOfType([T.object, T.string]), | ||
recharge_threshold: T.oneOfType([T.object, T.string]), | ||
}; | ||
export default api => ( | ||
@@ -10,19 +27,3 @@ class User extends base(api) { | ||
static propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
parent_id: T.string, | ||
name: T.string, | ||
email: T.string, | ||
phone_number: T.string, | ||
children: T.array, | ||
// api sends back numbers as strings, even though we want numbers | ||
balance: T.oneOfType([T.object, T.string]), | ||
price_per_shipment: T.oneOfType([T.object, T.string]), | ||
recharge_amount: T.oneOfType([T.object, T.string]), | ||
secondary_recharge_amount: T.oneOfType([T.object, T.string]), | ||
recharge_threshold: T.oneOfType([T.object, T.string]), | ||
} | ||
static all() { | ||
@@ -29,0 +30,0 @@ return this.notImplemented('all'); |
import T from 'proptypes'; | ||
import base from './base'; | ||
export const propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
mode: T.string, | ||
url: T.string, | ||
disabled_at: T.oneOfType([T.object, T.string]), | ||
}; | ||
export default api => ( | ||
@@ -9,11 +17,4 @@ class Webhook extends base(api) { | ||
static key = 'webhook'; | ||
static propTypes = { | ||
id: T.string, | ||
object: T.string, | ||
mode: T.string, | ||
url: T.string, | ||
disabled_at: T.oneOfType([T.object, T.string]), | ||
} | ||
static propTypes = propTypes; | ||
} | ||
); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
622385
41
3052