@shipengine/connect-carrier-api 2.6.2 → 2.7.0

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.
Files changed (72) hide show
  1. package/lib/app/carrier-app-definition.d.ts +12 -2
  2. package/lib/app/carrier-app.js +10 -0
  3. package/lib/app/carrier-app.js.map +1 -1
  4. package/lib/app/constants.d.ts +3 -1
  5. package/lib/app/constants.js +2 -0
  6. package/lib/app/constants.js.map +1 -1
  7. package/lib/app/metadata/service-point-feature.d.ts +9 -0
  8. package/lib/app/metadata/service-point-feature.js +15 -0
  9. package/lib/app/metadata/service-point-feature.js.map +1 -0
  10. package/lib/models/addresses/service-point-address.d.ts +7 -0
  11. package/lib/models/addresses/service-point-address.js +9 -0
  12. package/lib/models/addresses/service-point-address.js.map +1 -0
  13. package/lib/models/service-points/hours-of-operation.d.ts +9 -0
  14. package/lib/models/service-points/hours-of-operation.js +14 -0
  15. package/lib/models/service-points/hours-of-operation.js.map +1 -0
  16. package/lib/models/service-points/index.d.ts +3 -0
  17. package/lib/models/service-points/index.js +7 -0
  18. package/lib/models/service-points/index.js.map +1 -0
  19. package/lib/models/service-points/search-radius-unit.d.ts +5 -0
  20. package/lib/models/service-points/search-radius-unit.js +10 -0
  21. package/lib/models/service-points/search-radius-unit.js.map +1 -0
  22. package/lib/models/service-points/search-radius.d.ts +12 -0
  23. package/lib/models/service-points/search-radius.js +8 -0
  24. package/lib/models/service-points/search-radius.js.map +1 -0
  25. package/lib/models/service-points/service-point-response-address.d.ts +8 -0
  26. package/lib/models/service-points/service-point-response-address.js +23 -0
  27. package/lib/models/service-points/service-point-response-address.js.map +1 -0
  28. package/lib/models/service-points/service-point.d.ts +16 -0
  29. package/lib/models/service-points/service-point.js +19 -0
  30. package/lib/models/service-points/service-point.js.map +1 -0
  31. package/lib/models/service-points/weekly-hours-of-operation.d.ts +13 -0
  32. package/lib/models/service-points/weekly-hours-of-operation.js +20 -0
  33. package/lib/models/service-points/weekly-hours-of-operation.js.map +1 -0
  34. package/lib/requests/get-service-point-request.d.ts +8 -0
  35. package/lib/requests/get-service-point-request.js +9 -0
  36. package/lib/requests/get-service-point-request.js.map +1 -0
  37. package/lib/requests/get-service-points-request.d.ts +14 -0
  38. package/lib/requests/get-service-points-request.js +9 -0
  39. package/lib/requests/get-service-points-request.js.map +1 -0
  40. package/lib/requests/index.d.ts +2 -0
  41. package/lib/requests/index.js +2 -0
  42. package/lib/requests/index.js.map +1 -1
  43. package/lib/responses/get-service-point-response.d.ts +8 -0
  44. package/lib/responses/get-service-point-response.js +13 -0
  45. package/lib/responses/get-service-point-response.js.map +1 -0
  46. package/lib/responses/get-service-points-response.d.ts +9 -0
  47. package/lib/responses/get-service-points-response.js +15 -0
  48. package/lib/responses/get-service-points-response.js.map +1 -0
  49. package/lib/responses/index.d.ts +2 -0
  50. package/lib/responses/index.js +2 -0
  51. package/lib/responses/index.js.map +1 -1
  52. package/package.json +1 -1
  53. package/spec.json +3871 -4044
  54. package/src/app/carrier-app-definition.ts +18 -0
  55. package/src/app/carrier-app.ts +14 -0
  56. package/src/app/constants.ts +2 -0
  57. package/src/app/metadata/service-point-feature.ts +13 -0
  58. package/src/models/addresses/service-point-address.ts +8 -0
  59. package/src/models/service-points/hours-of-operation.ts +14 -0
  60. package/src/models/service-points/index.ts +3 -0
  61. package/src/models/service-points/search-radius-unit.ts +5 -0
  62. package/src/models/service-points/search-radius.ts +13 -0
  63. package/src/models/service-points/service-point-response-address.ts +21 -0
  64. package/src/models/service-points/service-point.ts +29 -0
  65. package/src/models/service-points/weekly-hours-of-operation.ts +23 -0
  66. package/src/requests/get-service-point-request.ts +9 -0
  67. package/src/requests/get-service-points-request.ts +15 -0
  68. package/src/requests/index.ts +2 -0
  69. package/src/responses/get-service-point-response.ts +12 -0
  70. package/src/responses/get-service-points-response.ts +13 -0
  71. package/src/responses/index.ts +2 -0
  72. package/tsconfig.tsbuildinfo +1 -1
@@ -13,6 +13,8 @@ import {
13
13
  ValidateInboundDataRequest,
14
14
  NormalizeTrackingDataRequest,
15
15
  GetRelayPointsRequest,
16
+ GetServicePointsRequest,
17
+ GetServicePointRequest,
16
18
  } from '../requests';
17
19
 
18
20
  import {
@@ -29,6 +31,8 @@ import {
29
31
  ValidateInboundDataResponse,
30
32
  NormalizeTrackingDataResponse,
31
33
  GetRelayPointsResponse,
34
+ GetServicePointsResponse,
35
+ GetServicePointResponse,
32
36
  } from '../responses';
33
37
 
34
38
  import { CarrierAppMetadata } from './metadata/carrier-app-metadata';
@@ -126,4 +130,18 @@ export interface CarrierAppDefinition {
126
130
  GetRelayPoints?: (
127
131
  request: GetRelayPointsRequest,
128
132
  ) => GetRelayPointsResponse | Promise<GetRelayPointsResponse>;
133
+ /**
134
+ * @description This endpoint is used to get carrier service points
135
+ * @param request Data needed by the provider about the service points to be returned
136
+ */
137
+ GetServicePoints?: (
138
+ request: GetServicePointsRequest,
139
+ ) => GetServicePointsResponse | Promise<GetServicePointsResponse>;
140
+ /**
141
+ * @description This endpoint is used to get a carrier service point by id
142
+ * @param request Data needed by the provider about the service point to be returned
143
+ */
144
+ GetServicePoint?: (
145
+ request: GetServicePointRequest,
146
+ ) => GetServicePointResponse | Promise<GetServicePointResponse>;
129
147
  }
@@ -20,6 +20,8 @@ import {
20
20
  ValidateInboundDataResponseSchema,
21
21
  NormalizeTrackingDataResponseSchema,
22
22
  GetRelayPointsResponseSchema,
23
+ GetServicePointsResponseSchema,
24
+ GetServicePointResponseSchema,
23
25
  } from '../responses';
24
26
  import { Schema } from 'joi';
25
27
 
@@ -113,6 +115,18 @@ export class CarrierApp implements ConnectRuntimeApp {
113
115
  definition.GetRelayPoints,
114
116
  GetRelayPointsResponseSchema,
115
117
  ],
118
+ [
119
+ Method.POST,
120
+ ApiEndpoints.GetServicePoints,
121
+ definition.GetServicePoints,
122
+ GetServicePointsResponseSchema,
123
+ ],
124
+ [
125
+ Method.POST,
126
+ ApiEndpoints.GetServicePoint,
127
+ definition.GetServicePoint,
128
+ GetServicePointResponseSchema,
129
+ ],
116
130
  ).forEach(([method, path, implementation, schema]) => {
117
131
  if (implementation) {
118
132
  this.routes.push({
@@ -13,4 +13,6 @@ export enum ApiEndpoints {
13
13
  ValidateInboundData = '/ValidateInboundData',
14
14
  NormalizeTrackingData = '/NormalizeTrackingData',
15
15
  GetRelayPoints = '/GetRelayPoints',
16
+ GetServicePoints = '/GetServicePoints',
17
+ GetServicePoint = '/GetServicePoint',
16
18
  }
@@ -0,0 +1,13 @@
1
+ import Joi from 'joi';
2
+
3
+ export enum ServicePointFeaturesEnum {
4
+ DropOffPoint = 'DropOffPoint',
5
+ PickupPoint = 'PickupPoint',
6
+ PrintServices = 'PrintServices',
7
+ AfterHoursLocker = 'AfterHoursLocker',
8
+ AfterHoursDropbox = 'AfterHoursDropbox',
9
+ }
10
+
11
+ export const ServicePointFeaturesEnumSchema = Joi.string().valid(
12
+ ...Object.values(ServicePointFeaturesEnum),
13
+ );
@@ -0,0 +1,8 @@
1
+ import { LatLong } from '../tracking/lat-long';
2
+ import { AddressBase } from './address-base';
3
+
4
+ /** @description The basic address type related to service points */
5
+ export class ServicePointAddress extends AddressBase {
6
+ /** @description Geographical location */
7
+ geo?: LatLong;
8
+ }
@@ -0,0 +1,14 @@
1
+ import Joi from 'joi';
2
+
3
+ /** @description Indicates a specific time window that a service point is open */
4
+ export class HoursOfOperation {
5
+ /** @description The open time expressed in ISO 8601 time only format */
6
+ open?: string;
7
+ /** @description The close time expressed in ISO 8601 time only format */
8
+ close?: string;
9
+ }
10
+
11
+ export const HoursOfOperationSchema = Joi.object({
12
+ open: Joi.string().optional().empty(),
13
+ close: Joi.string().optional().empty(),
14
+ });
@@ -0,0 +1,3 @@
1
+ export * from './service-point';
2
+ export * from './weekly-hours-of-operation';
3
+ export * from './service-point-response-address';
@@ -0,0 +1,5 @@
1
+ /** @description Unit of measurement for search radius */
2
+ export enum SearchRadiusUnit {
3
+ Miles = 'miles',
4
+ Kilometers = 'kilometers',
5
+ }
@@ -0,0 +1,13 @@
1
+ import { SearchRadiusUnit } from './search-radius-unit';
2
+
3
+ /** @description Basic structure for service point search radius */
4
+ export class SearchRadius {
5
+ /** @description Search radius in miles */
6
+ radius_in_miles?: number;
7
+ /** @description Search radius in kilometers */
8
+ radius_in_kilometers?: number;
9
+ /** @description Search radius in the original unit */
10
+ source_radius?: number;
11
+ /** @description Search radius unit */
12
+ source_radius_unit!: SearchRadiusUnit;
13
+ }
@@ -0,0 +1,21 @@
1
+ import Joi from 'joi';
2
+ import { ServicePointAddress } from '../addresses/service-point-address';
3
+ import { LatLongSchema } from '../tracking/lat-long';
4
+
5
+ /** @description The address information corresponding to a specific service point */
6
+ export class ServicePointResponseAddress extends ServicePointAddress {
7
+ /** @description Description of the location */
8
+ description?: string;
9
+ }
10
+
11
+ export const ServicePointResponseAddressSchema = Joi.object({
12
+ phone_number: Joi.string().optional().empty(),
13
+ company_name: Joi.string().optional().empty(),
14
+ description: Joi.string().optional().empty(),
15
+ geo: LatLongSchema.optional(),
16
+ address_lines: Joi.array().items(Joi.string()).required(),
17
+ city_locality: Joi.string().required(),
18
+ state_province: Joi.string().required(),
19
+ postal_code: Joi.string().required(),
20
+ country_code: Joi.string().required(),
21
+ });
@@ -0,0 +1,29 @@
1
+ import Joi from 'joi';
2
+ import {
3
+ ServicePointFeaturesEnum,
4
+ ServicePointFeaturesEnumSchema,
5
+ } from '../../app/metadata/service-point-feature';
6
+ import {
7
+ ServicePointResponseAddress,
8
+ ServicePointResponseAddressSchema,
9
+ } from './service-point-response-address';
10
+ import { WeeklyHoursOfOperation, WeeklyHoursOfOperationSchema } from './weekly-hours-of-operation';
11
+
12
+ /** @description Basic structure for a service point */
13
+ export class ServicePoint {
14
+ /** @description The identifier for the carrier's service point */
15
+ service_point_id!: string;
16
+ /** @description The address where the service point is located */
17
+ address!: ServicePointResponseAddress;
18
+ /** @description Weekly hours of operation for the service point */
19
+ hours_of_operation!: WeeklyHoursOfOperation;
20
+ /** @description Features supported by the service point */
21
+ features?: ServicePointFeaturesEnum[];
22
+ }
23
+
24
+ export const ServicePointSchema = Joi.object({
25
+ service_point_id: Joi.string().required(),
26
+ address: ServicePointResponseAddressSchema.required(),
27
+ hours_of_operation: WeeklyHoursOfOperationSchema.required(),
28
+ features: Joi.array().items(ServicePointFeaturesEnumSchema).optional(),
29
+ });
@@ -0,0 +1,23 @@
1
+ import Joi from 'joi';
2
+ import { HoursOfOperation, HoursOfOperationSchema } from './hours-of-operation';
3
+
4
+ /** @description The times during the week that the relay point is open */
5
+ export class WeeklyHoursOfOperation {
6
+ monday?: HoursOfOperation[];
7
+ tuesday?: HoursOfOperation[];
8
+ wednesday?: HoursOfOperation[];
9
+ thursday?: HoursOfOperation[];
10
+ friday?: HoursOfOperation[];
11
+ saturday?: HoursOfOperation[];
12
+ sunday?: HoursOfOperation[];
13
+ }
14
+
15
+ export const WeeklyHoursOfOperationSchema = Joi.object({
16
+ monday: HoursOfOperationSchema.optional(),
17
+ tuesday: HoursOfOperationSchema.optional(),
18
+ wednesday: HoursOfOperationSchema.optional(),
19
+ thursday: HoursOfOperationSchema.optional(),
20
+ friday: HoursOfOperationSchema.optional(),
21
+ saturday: HoursOfOperationSchema.optional(),
22
+ sunday: HoursOfOperationSchema.optional(),
23
+ });
@@ -0,0 +1,9 @@
1
+ import { BaseRequest } from './base-request';
2
+
3
+ /** @description Basic structure for a request to get a single service point by id */
4
+ export class GetServicePointRequest extends BaseRequest {
5
+ /** @description The service point id to get */
6
+ service_point_id!: string;
7
+ /** @description The two character country code of the service point. The codes are specified by ISO 3166-1 alpha-2 */
8
+ country_code!: string;
9
+ }
@@ -0,0 +1,15 @@
1
+ import { ServicePointAddress } from '../models/addresses/service-point-address';
2
+ import { SearchRadius } from '../models/service-points/search-radius';
3
+ import { BaseRequest } from './base-request';
4
+
5
+ /** @description Basic structure for a request to get service points */
6
+ export class GetServicePointsRequest extends BaseRequest {
7
+ /** @description The service code uniquely identifies a shipping service */
8
+ service_code?: string;
9
+ /** @description The address input for searching nearby carrier service points */
10
+ address!: ServicePointAddress;
11
+ /** @description The desired search radius around the given address */
12
+ search_radius?: SearchRadius;
13
+ /** @description The maximum number of service points to return */
14
+ max_results?: number;
15
+ }
@@ -12,3 +12,5 @@ export * from './cancel-notification-request';
12
12
  export * from './validate-inbound-data-request';
13
13
  export * from './normalize-tracking-data-request';
14
14
  export * from './get-relay-points-request';
15
+ export * from './get-service-points-request';
16
+ export * from './get-service-point-request';
@@ -0,0 +1,12 @@
1
+ import { BaseResponse, BaseResponseSchema } from './base-response';
2
+ import { ServicePoint, ServicePointSchema } from '../models/service-points';
3
+
4
+ /** @description Basic structure for a response to get a single service point by id */
5
+ export class GetServicePointResponse extends BaseResponse {
6
+ /** @description The resulting service point */
7
+ service_point!: ServicePoint;
8
+ }
9
+
10
+ export const GetServicePointResponseSchema = BaseResponseSchema.keys({
11
+ service_point: ServicePointSchema.required(),
12
+ });
@@ -0,0 +1,13 @@
1
+ import { BaseResponse, BaseResponseSchema } from './base-response';
2
+ import Joi from 'joi';
3
+ import { ServicePoint, ServicePointSchema } from '../models/service-points';
4
+
5
+ /** @description Basic structure for a response to get service points */
6
+ export class GetServicePointsResponse extends BaseResponse {
7
+ /** @description The resulting service points */
8
+ service_points!: ServicePoint[];
9
+ }
10
+
11
+ export const GetServicePointsResponseSchema = BaseResponseSchema.keys({
12
+ service_points: Joi.array().required().items(ServicePointSchema),
13
+ });
@@ -12,3 +12,5 @@ export * from './create-notification-response';
12
12
  export * from './validate-inbound-data-response';
13
13
  export * from './normalize-tracking-data-response';
14
14
  export * from './get-relay-points-response';
15
+ export * from './get-service-points-response';
16
+ export * from './get-service-point-response';