@shipengine/js-api 4.4.1 → 4.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.d.ts CHANGED
@@ -22,6 +22,7 @@ import { ServicePointsAPI } from "./service-points";
22
22
  import { ShipmentsAPI } from "./shipments";
23
23
  import { ShippingRulesAPI } from "./shipping-rules";
24
24
  import { ThemesAPI } from "./themes";
25
+ import { UsersApi } from "./users";
25
26
  import { WarehousesAPI } from "./warehouses";
26
27
  import { WebhooksAPI } from "./webhooks";
27
28
  /**
@@ -252,4 +253,10 @@ export declare class ShipEngineAPI {
252
253
  * @see {@link AuctanePayAPI | The Auctane Pay API module}
253
254
  */
254
255
  get auctanePay(): AuctanePayAPI;
256
+ /**
257
+ * The `users` method provides access to Users endpoints in ShipEngine API.
258
+ *
259
+ * @see {@link UsersApi | The Users API module}
260
+ */
261
+ get users(): UsersApi;
255
262
  }
package/index.d.ts CHANGED
@@ -32,3 +32,4 @@ export * from "./webhooks";
32
32
  export * from "./weight";
33
33
  export * from "./zones";
34
34
  export * from "./sellers";
35
+ export * from "./users";
package/index.js CHANGED
@@ -1071,9 +1071,9 @@ const getEndUserIpAddress = () => __async$7(void 0, null, function* () {
1071
1071
  }
1072
1072
  });
1073
1073
 
1074
- const camelizeKeys = (obj) => {
1074
+ const camelizeKeys = (obj, parentKey) => {
1075
1075
  if (Array.isArray(obj)) {
1076
- return obj.map(camelizeKeys);
1076
+ return obj.map((item) => camelizeKeys(item, parentKey));
1077
1077
  } else if (obj !== null && typeof obj === "object") {
1078
1078
  const newObj = {};
1079
1079
  for (const key in obj) {
@@ -1093,7 +1093,11 @@ const camelizeKeys = (obj) => {
1093
1093
  newKey += char;
1094
1094
  }
1095
1095
  }
1096
- newObj[newKey] = camelizeKeys(obj[key]);
1096
+ if (parentKey === "formSchema" && ["jsonSchema", "uiSchema", "brandedContent"].includes(newKey)) {
1097
+ newObj[newKey] = obj[key];
1098
+ } else {
1099
+ newObj[newKey] = camelizeKeys(obj[key], newKey);
1100
+ }
1097
1101
  }
1098
1102
  }
1099
1103
  return newObj;
@@ -4284,6 +4288,19 @@ class ThemesAPI {
4284
4288
  }
4285
4289
  }
4286
4290
 
4291
+ class UsersApi {
4292
+ constructor(client) {
4293
+ this.client = client;
4294
+ /**
4295
+ * The `list` gets all the users of the current Seller.
4296
+ */
4297
+ this.list = (options) => {
4298
+ return this.client.get("/v1/users", { params: options });
4299
+ };
4300
+ this.client = client;
4301
+ }
4302
+ }
4303
+
4287
4304
  class WarehousesAPI {
4288
4305
  constructor(client) {
4289
4306
  this.client = client;
@@ -22005,6 +22022,14 @@ class ShipEngineAPI {
22005
22022
  get auctanePay() {
22006
22023
  return new AuctanePayAPI(this.client);
22007
22024
  }
22025
+ /**
22026
+ * The `users` method provides access to Users endpoints in ShipEngine API.
22027
+ *
22028
+ * @see {@link UsersApi | The Users API module}
22029
+ */
22030
+ get users() {
22031
+ return new UsersApi(this.client);
22032
+ }
22008
22033
  }
22009
22034
 
22010
22035
  exports.AccountBillingAPI = AccountBillingAPI;
@@ -22044,6 +22069,7 @@ exports.ShipEngineAPI = ShipEngineAPI;
22044
22069
  exports.ShipmentsAPI = ShipmentsAPI;
22045
22070
  exports.ShippingRulesAPI = ShippingRulesAPI;
22046
22071
  exports.ThemesAPI = ThemesAPI;
22072
+ exports.UsersApi = UsersApi;
22047
22073
  exports.WarehousesAPI = WarehousesAPI;
22048
22074
  exports.WebhooksAPI = WebhooksAPI;
22049
22075
  exports.camelizeKeys = camelizeKeys;
package/index.mjs CHANGED
@@ -1067,9 +1067,9 @@ const getEndUserIpAddress = () => __async$7(void 0, null, function* () {
1067
1067
  }
1068
1068
  });
1069
1069
 
1070
- const camelizeKeys = (obj) => {
1070
+ const camelizeKeys = (obj, parentKey) => {
1071
1071
  if (Array.isArray(obj)) {
1072
- return obj.map(camelizeKeys);
1072
+ return obj.map((item) => camelizeKeys(item, parentKey));
1073
1073
  } else if (obj !== null && typeof obj === "object") {
1074
1074
  const newObj = {};
1075
1075
  for (const key in obj) {
@@ -1089,7 +1089,11 @@ const camelizeKeys = (obj) => {
1089
1089
  newKey += char;
1090
1090
  }
1091
1091
  }
1092
- newObj[newKey] = camelizeKeys(obj[key]);
1092
+ if (parentKey === "formSchema" && ["jsonSchema", "uiSchema", "brandedContent"].includes(newKey)) {
1093
+ newObj[newKey] = obj[key];
1094
+ } else {
1095
+ newObj[newKey] = camelizeKeys(obj[key], newKey);
1096
+ }
1093
1097
  }
1094
1098
  }
1095
1099
  return newObj;
@@ -4280,6 +4284,19 @@ class ThemesAPI {
4280
4284
  }
4281
4285
  }
4282
4286
 
4287
+ class UsersApi {
4288
+ constructor(client) {
4289
+ this.client = client;
4290
+ /**
4291
+ * The `list` gets all the users of the current Seller.
4292
+ */
4293
+ this.list = (options) => {
4294
+ return this.client.get("/v1/users", { params: options });
4295
+ };
4296
+ this.client = client;
4297
+ }
4298
+ }
4299
+
4283
4300
  class WarehousesAPI {
4284
4301
  constructor(client) {
4285
4302
  this.client = client;
@@ -22001,6 +22018,14 @@ class ShipEngineAPI {
22001
22018
  get auctanePay() {
22002
22019
  return new AuctanePayAPI(this.client);
22003
22020
  }
22021
+ /**
22022
+ * The `users` method provides access to Users endpoints in ShipEngine API.
22023
+ *
22024
+ * @see {@link UsersApi | The Users API module}
22025
+ */
22026
+ get users() {
22027
+ return new UsersApi(this.client);
22028
+ }
22004
22029
  }
22005
22030
 
22006
- export { AccountBillingAPI, AccountBillingPlanAPI, AccountBillingPlanChangeType, AccountSettingsAPI, AddressesAPI, AuctanePayAPI, CarriersAPI, CodedError, ConfirmationType, ConnectionsAPI, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, InvoiceAddressAPI, LabelsAPI, MetadataCapability, MetadataRequirement, MetadataSatisfyingFormTypes, MovementIndicator, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, SellersAPI, ServicePointsAPI, ShipEngineAPI, ShipmentsAPI, ShippingRulesAPI, ThemesAPI, WarehousesAPI, WebhooksAPI, camelizeKeys, decamelizeKeys, getEndUserIpAddress, isCodedError, isCodedErrors, isDataCodedErrors, isInvalidTokenError, parseError };
22031
+ export { AccountBillingAPI, AccountBillingPlanAPI, AccountBillingPlanChangeType, AccountSettingsAPI, AddressesAPI, AuctanePayAPI, CarriersAPI, CodedError, ConfirmationType, ConnectionsAPI, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, InvoiceAddressAPI, LabelsAPI, MetadataCapability, MetadataRequirement, MetadataSatisfyingFormTypes, MovementIndicator, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, SellersAPI, ServicePointsAPI, ShipEngineAPI, ShipmentsAPI, ShippingRulesAPI, ThemesAPI, UsersApi, WarehousesAPI, WebhooksAPI, camelizeKeys, decamelizeKeys, getEndUserIpAddress, isCodedError, isCodedErrors, isDataCodedErrors, isInvalidTokenError, parseError };
package/labels/types.d.ts CHANGED
@@ -10,6 +10,9 @@ export type LabelFormat = "pdf" | "png" | "zpl";
10
10
  export type LabelLayout = "4x6" | "letter";
11
11
  export type LabelStatus = "processing" | "completed" | "error" | "voided";
12
12
  export type LabelTrackingStatus = "unknown" | "in_transit" | "delivered" | "error";
13
+ /**
14
+ * Columns available for label exports
15
+ */
13
16
  export type LabelColumns = "shipment_id" | "label_id" | "external_order_id" | "external_shipment_id" | "packages" | "recipient" | "shipping_service" | "created_date" | "ship_date" | "status" | "tracking_status";
14
17
  export type Label = {
15
18
  alternativeIdentifiers?: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "4.4.1",
3
+ "version": "4.5.1",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
package/types.d.ts CHANGED
@@ -31,3 +31,4 @@ export * from "./weight/types";
31
31
  export * from "./weight-band/types";
32
32
  export * from "./zones/types";
33
33
  export * from "./sellers/types";
34
+ export * from "./users/types";
package/users/api.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { AxiosInstance } from "axios";
2
+ import { UserListOptions, UserListResponse } from "./types";
3
+ /**
4
+ * # Users API module - /v1/users
5
+ * @link https://docs.shipstation.com/openapi/users
6
+ */
7
+ export declare class UsersApi {
8
+ private client;
9
+ constructor(client: AxiosInstance);
10
+ /**
11
+ * The `list` gets all the users of the current Seller.
12
+ */
13
+ list: (options?: UserListOptions) => Promise<import("axios").AxiosResponse<UserListResponse, any>>;
14
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./api";
2
+ export * from "./types";
@@ -0,0 +1,17 @@
1
+ import { CreationRangeQuery, ModificationRangeQuery, PageableQuery, PageableResult, SortableQuery } from "../resources";
2
+ export type UserStatus = "Active" | "Inactive" | "Locked_out" | "Email_lock";
3
+ export type User = {
4
+ createdAt: string;
5
+ email: string;
6
+ lastLoginAt: string;
7
+ name: string;
8
+ status: UserStatus;
9
+ userId: string;
10
+ username: string;
11
+ };
12
+ export type UserListOptions = {
13
+ status?: UserStatus;
14
+ } & PageableQuery & CreationRangeQuery & ModificationRangeQuery & SortableQuery;
15
+ export type UserListResponse = {
16
+ users: User[];
17
+ } & PageableResult;
@@ -1,2 +1,2 @@
1
- export declare const camelizeKeys: (obj: any) => any;
1
+ export declare const camelizeKeys: (obj: any, parentKey?: string) => any;
2
2
  export declare const decamelizeKeys: (obj: any, separator?: string) => any;