@samsarahq/samsara 11.10.0 → 11.10.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/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/betaApIs/client/Client.d.ts +0 -68
- package/dist/cjs/api/resources/betaApIs/client/Client.js +0 -189
- package/dist/cjs/api/resources/betaApIs/client/requests/index.d.ts +0 -2
- package/dist/cjs/api/resources/hubs/client/Client.d.ts +30 -0
- package/dist/cjs/api/resources/hubs/client/Client.js +94 -0
- package/dist/cjs/api/resources/hubs/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/plans/client/Client.d.ts +34 -0
- package/dist/cjs/api/resources/plans/client/Client.js +91 -0
- package/dist/cjs/api/resources/plans/client/requests/index.d.ts +1 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/betaApIs/client/Client.d.mts +0 -68
- package/dist/esm/api/resources/betaApIs/client/Client.mjs +0 -189
- package/dist/esm/api/resources/betaApIs/client/requests/index.d.mts +0 -2
- package/dist/esm/api/resources/hubs/client/Client.d.mts +30 -0
- package/dist/esm/api/resources/hubs/client/Client.mjs +94 -0
- package/dist/esm/api/resources/hubs/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/plans/client/Client.d.mts +34 -0
- package/dist/esm/api/resources/plans/client/Client.mjs +91 -0
- package/dist/esm/api/resources/plans/client/requests/index.d.mts +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +148 -152
- /package/dist/cjs/api/resources/{betaApIs → hubs}/client/requests/ListHubCustomPropertiesRequest.d.ts +0 -0
- /package/dist/cjs/api/resources/{betaApIs → hubs}/client/requests/ListHubCustomPropertiesRequest.js +0 -0
- /package/dist/cjs/api/resources/{betaApIs → plans}/client/requests/PlanOrdersCreatePlanOrdersRequestBody.d.ts +0 -0
- /package/dist/cjs/api/resources/{betaApIs → plans}/client/requests/PlanOrdersCreatePlanOrdersRequestBody.js +0 -0
- /package/dist/esm/api/resources/{betaApIs → hubs}/client/requests/ListHubCustomPropertiesRequest.d.mts +0 -0
- /package/dist/esm/api/resources/{betaApIs → hubs}/client/requests/ListHubCustomPropertiesRequest.mjs +0 -0
- /package/dist/esm/api/resources/{betaApIs → plans}/client/requests/PlanOrdersCreatePlanOrdersRequestBody.d.mts +0 -0
- /package/dist/esm/api/resources/{betaApIs → plans}/client/requests/PlanOrdersCreatePlanOrdersRequestBody.mjs +0 -0
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -44,8 +44,8 @@ function normalizeClientOptions(options) {
|
|
|
44
44
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
45
45
|
"X-Fern-Language": "JavaScript",
|
|
46
46
|
"X-Fern-SDK-Name": "@samsarahq/samsara",
|
|
47
|
-
"X-Fern-SDK-Version": "11.10.
|
|
48
|
-
"User-Agent": "@samsarahq/samsara/11.10.
|
|
47
|
+
"X-Fern-SDK-Version": "11.10.1",
|
|
48
|
+
"User-Agent": "@samsarahq/samsara/11.10.1",
|
|
49
49
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
50
50
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
51
51
|
"X-Samsara-Version": (_a = options === null || options === void 0 ? void 0 : options.version) !== null && _a !== void 0 ? _a : "2025-06-11",
|
|
@@ -1060,38 +1060,6 @@ export declare class BetaApIsClient {
|
|
|
1060
1060
|
*/
|
|
1061
1061
|
updateShippingDocs(request: Samsara.HosDailyLogsUpdateShippingDocsRequestBody, requestOptions?: BetaApIsClient.RequestOptions): core.HttpResponsePromise<Samsara.HosDailyLogsUpdateShippingDocsResponseBody>;
|
|
1062
1062
|
private __updateShippingDocs;
|
|
1063
|
-
/**
|
|
1064
|
-
* Retrieve custom properties for a specific hub.
|
|
1065
|
-
*
|
|
1066
|
-
* **Beta:** This endpoint is in beta and is likely to change before being broadly available. Reach out to your Samsara Representative to have RoutePlanning APIs enabled for your organization.
|
|
1067
|
-
*
|
|
1068
|
-
* <b>Rate limit:</b> 10 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
1069
|
-
*
|
|
1070
|
-
* To use this endpoint, select **Read Routes** under the Driver Workflow category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
1071
|
-
*
|
|
1072
|
-
*
|
|
1073
|
-
* **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
1074
|
-
*
|
|
1075
|
-
* @param {Samsara.ListHubCustomPropertiesRequest} request
|
|
1076
|
-
* @param {BetaApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1077
|
-
*
|
|
1078
|
-
* @throws {@link Samsara.UnauthorizedError}
|
|
1079
|
-
* @throws {@link Samsara.NotFoundError}
|
|
1080
|
-
* @throws {@link Samsara.MethodNotAllowedError}
|
|
1081
|
-
* @throws {@link Samsara.TooManyRequestsError}
|
|
1082
|
-
* @throws {@link Samsara.InternalServerError}
|
|
1083
|
-
* @throws {@link Samsara.NotImplementedError}
|
|
1084
|
-
* @throws {@link Samsara.BadGatewayError}
|
|
1085
|
-
* @throws {@link Samsara.ServiceUnavailableError}
|
|
1086
|
-
* @throws {@link Samsara.GatewayTimeoutError}
|
|
1087
|
-
*
|
|
1088
|
-
* @example
|
|
1089
|
-
* await client.betaApIs.listHubCustomProperties({
|
|
1090
|
-
* hubId: "hubId"
|
|
1091
|
-
* })
|
|
1092
|
-
*/
|
|
1093
|
-
listHubCustomProperties(request: Samsara.ListHubCustomPropertiesRequest, requestOptions?: BetaApIsClient.RequestOptions): core.HttpResponsePromise<Samsara.HubCustomPropertiesListHubCustomPropertiesResponseBody>;
|
|
1094
|
-
private __listHubCustomProperties;
|
|
1095
1063
|
/**
|
|
1096
1064
|
* Retrieve all orders for a specific plan, including both assigned and unassigned orders.
|
|
1097
1065
|
*
|
|
@@ -1124,42 +1092,6 @@ export declare class BetaApIsClient {
|
|
|
1124
1092
|
*/
|
|
1125
1093
|
listPlanOrders(request: Samsara.ListPlanOrdersRequest, requestOptions?: BetaApIsClient.RequestOptions): core.HttpResponsePromise<Samsara.PlanOrdersListPlanOrdersResponseBody>;
|
|
1126
1094
|
private __listPlanOrders;
|
|
1127
|
-
/**
|
|
1128
|
-
* Create one or more orders (bulk upsert). Pass an array of order objects; any object whose customerOrderId already exists will be updated, otherwise a new order is created. Functions can return JSON arrays in this Order POST format. Orders are initially created at the plan level but will migrate to hub-level entities, with planId becoming optional in future versions.
|
|
1129
|
-
*
|
|
1130
|
-
* **Beta:** This endpoint is in beta and is likely to change before being broadly available. Reach out to your Samsara Representative to have RoutePlanning APIs enabled for your organization.
|
|
1131
|
-
*
|
|
1132
|
-
* <b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
1133
|
-
*
|
|
1134
|
-
* To use this endpoint, select **Write Routes** under the Driver Workflow category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
1135
|
-
*
|
|
1136
|
-
*
|
|
1137
|
-
* **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
1138
|
-
*
|
|
1139
|
-
* @param {Samsara.PlanOrdersCreatePlanOrdersRequestBody} request
|
|
1140
|
-
* @param {BetaApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1141
|
-
*
|
|
1142
|
-
* @throws {@link Samsara.UnauthorizedError}
|
|
1143
|
-
* @throws {@link Samsara.NotFoundError}
|
|
1144
|
-
* @throws {@link Samsara.MethodNotAllowedError}
|
|
1145
|
-
* @throws {@link Samsara.TooManyRequestsError}
|
|
1146
|
-
* @throws {@link Samsara.InternalServerError}
|
|
1147
|
-
* @throws {@link Samsara.NotImplementedError}
|
|
1148
|
-
* @throws {@link Samsara.BadGatewayError}
|
|
1149
|
-
* @throws {@link Samsara.ServiceUnavailableError}
|
|
1150
|
-
* @throws {@link Samsara.GatewayTimeoutError}
|
|
1151
|
-
*
|
|
1152
|
-
* @example
|
|
1153
|
-
* await client.betaApIs.createPlanOrders({
|
|
1154
|
-
* data: [{
|
|
1155
|
-
* customerOrderId: "ORDER-2024-001",
|
|
1156
|
-
* hubId: "550e8400-e29b-41d4-a716-446655440000",
|
|
1157
|
-
* planId: "650e8400-e29b-41d4-a716-446655440023"
|
|
1158
|
-
* }]
|
|
1159
|
-
* })
|
|
1160
|
-
*/
|
|
1161
|
-
createPlanOrders(request: Samsara.PlanOrdersCreatePlanOrdersRequestBody, requestOptions?: BetaApIsClient.RequestOptions): core.HttpResponsePromise<Samsara.PlanOrdersCreatePlanOrdersResponseBody>;
|
|
1162
|
-
private __createPlanOrders;
|
|
1163
1095
|
/**
|
|
1164
1096
|
* Delete one or more orders from a plan. Pass either `orderIds` (a comma-separated list) or `deleteAll=true`; exactly one is required. Orders are automatically unassigned from their routes before deletion.
|
|
1165
1097
|
*
|
|
@@ -3154,102 +3154,6 @@ class BetaApIsClient {
|
|
|
3154
3154
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/hos/daily-logs/log-meta-data");
|
|
3155
3155
|
});
|
|
3156
3156
|
}
|
|
3157
|
-
/**
|
|
3158
|
-
* Retrieve custom properties for a specific hub.
|
|
3159
|
-
*
|
|
3160
|
-
* **Beta:** This endpoint is in beta and is likely to change before being broadly available. Reach out to your Samsara Representative to have RoutePlanning APIs enabled for your organization.
|
|
3161
|
-
*
|
|
3162
|
-
* <b>Rate limit:</b> 10 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
3163
|
-
*
|
|
3164
|
-
* To use this endpoint, select **Read Routes** under the Driver Workflow category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
3165
|
-
*
|
|
3166
|
-
*
|
|
3167
|
-
* **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
3168
|
-
*
|
|
3169
|
-
* @param {Samsara.ListHubCustomPropertiesRequest} request
|
|
3170
|
-
* @param {BetaApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
3171
|
-
*
|
|
3172
|
-
* @throws {@link Samsara.UnauthorizedError}
|
|
3173
|
-
* @throws {@link Samsara.NotFoundError}
|
|
3174
|
-
* @throws {@link Samsara.MethodNotAllowedError}
|
|
3175
|
-
* @throws {@link Samsara.TooManyRequestsError}
|
|
3176
|
-
* @throws {@link Samsara.InternalServerError}
|
|
3177
|
-
* @throws {@link Samsara.NotImplementedError}
|
|
3178
|
-
* @throws {@link Samsara.BadGatewayError}
|
|
3179
|
-
* @throws {@link Samsara.ServiceUnavailableError}
|
|
3180
|
-
* @throws {@link Samsara.GatewayTimeoutError}
|
|
3181
|
-
*
|
|
3182
|
-
* @example
|
|
3183
|
-
* await client.betaApIs.listHubCustomProperties({
|
|
3184
|
-
* hubId: "hubId"
|
|
3185
|
-
* })
|
|
3186
|
-
*/
|
|
3187
|
-
listHubCustomProperties(request, requestOptions) {
|
|
3188
|
-
return core.HttpResponsePromise.fromPromise(this.__listHubCustomProperties(request, requestOptions));
|
|
3189
|
-
}
|
|
3190
|
-
__listHubCustomProperties(request, requestOptions) {
|
|
3191
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3192
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
3193
|
-
const { hubId, customPropertyIds, customPropertyNames, startTime, endTime, after, limit } = request;
|
|
3194
|
-
const _queryParams = {
|
|
3195
|
-
hubId,
|
|
3196
|
-
customPropertyIds,
|
|
3197
|
-
customPropertyNames,
|
|
3198
|
-
startTime: startTime != null ? startTime : undefined,
|
|
3199
|
-
endTime: endTime != null ? endTime : undefined,
|
|
3200
|
-
after,
|
|
3201
|
-
limit,
|
|
3202
|
-
};
|
|
3203
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
3204
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "X-Samsara-Version": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.version }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3205
|
-
const _response = yield core.fetcher({
|
|
3206
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SamsaraEnvironment.ProductionApi, "hub/customProperties"),
|
|
3207
|
-
method: "GET",
|
|
3208
|
-
headers: _headers,
|
|
3209
|
-
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
3210
|
-
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
3211
|
-
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
3212
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3213
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
3214
|
-
logging: this._options.logging,
|
|
3215
|
-
});
|
|
3216
|
-
if (_response.ok) {
|
|
3217
|
-
return {
|
|
3218
|
-
data: _response.body,
|
|
3219
|
-
rawResponse: _response.rawResponse,
|
|
3220
|
-
};
|
|
3221
|
-
}
|
|
3222
|
-
if (_response.error.reason === "status-code") {
|
|
3223
|
-
switch (_response.error.statusCode) {
|
|
3224
|
-
case 401:
|
|
3225
|
-
throw new Samsara.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
3226
|
-
case 404:
|
|
3227
|
-
throw new Samsara.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3228
|
-
case 405:
|
|
3229
|
-
throw new Samsara.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
3230
|
-
case 429:
|
|
3231
|
-
throw new Samsara.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
3232
|
-
case 500:
|
|
3233
|
-
throw new Samsara.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3234
|
-
case 501:
|
|
3235
|
-
throw new Samsara.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
3236
|
-
case 502:
|
|
3237
|
-
throw new Samsara.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
3238
|
-
case 503:
|
|
3239
|
-
throw new Samsara.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
3240
|
-
case 504:
|
|
3241
|
-
throw new Samsara.GatewayTimeoutError(_response.error.body, _response.rawResponse);
|
|
3242
|
-
default:
|
|
3243
|
-
throw new errors.SamsaraError({
|
|
3244
|
-
statusCode: _response.error.statusCode,
|
|
3245
|
-
body: _response.error.body,
|
|
3246
|
-
rawResponse: _response.rawResponse,
|
|
3247
|
-
});
|
|
3248
|
-
}
|
|
3249
|
-
}
|
|
3250
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/hub/customProperties");
|
|
3251
|
-
});
|
|
3252
|
-
}
|
|
3253
3157
|
/**
|
|
3254
3158
|
* Retrieve all orders for a specific plan, including both assigned and unassigned orders.
|
|
3255
3159
|
*
|
|
@@ -3343,99 +3247,6 @@ class BetaApIsClient {
|
|
|
3343
3247
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/hub/plan/orders");
|
|
3344
3248
|
});
|
|
3345
3249
|
}
|
|
3346
|
-
/**
|
|
3347
|
-
* Create one or more orders (bulk upsert). Pass an array of order objects; any object whose customerOrderId already exists will be updated, otherwise a new order is created. Functions can return JSON arrays in this Order POST format. Orders are initially created at the plan level but will migrate to hub-level entities, with planId becoming optional in future versions.
|
|
3348
|
-
*
|
|
3349
|
-
* **Beta:** This endpoint is in beta and is likely to change before being broadly available. Reach out to your Samsara Representative to have RoutePlanning APIs enabled for your organization.
|
|
3350
|
-
*
|
|
3351
|
-
* <b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
3352
|
-
*
|
|
3353
|
-
* To use this endpoint, select **Write Routes** under the Driver Workflow category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
3354
|
-
*
|
|
3355
|
-
*
|
|
3356
|
-
* **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
3357
|
-
*
|
|
3358
|
-
* @param {Samsara.PlanOrdersCreatePlanOrdersRequestBody} request
|
|
3359
|
-
* @param {BetaApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
3360
|
-
*
|
|
3361
|
-
* @throws {@link Samsara.UnauthorizedError}
|
|
3362
|
-
* @throws {@link Samsara.NotFoundError}
|
|
3363
|
-
* @throws {@link Samsara.MethodNotAllowedError}
|
|
3364
|
-
* @throws {@link Samsara.TooManyRequestsError}
|
|
3365
|
-
* @throws {@link Samsara.InternalServerError}
|
|
3366
|
-
* @throws {@link Samsara.NotImplementedError}
|
|
3367
|
-
* @throws {@link Samsara.BadGatewayError}
|
|
3368
|
-
* @throws {@link Samsara.ServiceUnavailableError}
|
|
3369
|
-
* @throws {@link Samsara.GatewayTimeoutError}
|
|
3370
|
-
*
|
|
3371
|
-
* @example
|
|
3372
|
-
* await client.betaApIs.createPlanOrders({
|
|
3373
|
-
* data: [{
|
|
3374
|
-
* customerOrderId: "ORDER-2024-001",
|
|
3375
|
-
* hubId: "550e8400-e29b-41d4-a716-446655440000",
|
|
3376
|
-
* planId: "650e8400-e29b-41d4-a716-446655440023"
|
|
3377
|
-
* }]
|
|
3378
|
-
* })
|
|
3379
|
-
*/
|
|
3380
|
-
createPlanOrders(request, requestOptions) {
|
|
3381
|
-
return core.HttpResponsePromise.fromPromise(this.__createPlanOrders(request, requestOptions));
|
|
3382
|
-
}
|
|
3383
|
-
__createPlanOrders(request, requestOptions) {
|
|
3384
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3385
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
3386
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
3387
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "X-Samsara-Version": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.version }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
3388
|
-
const _response = yield core.fetcher({
|
|
3389
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SamsaraEnvironment.ProductionApi, "hub/plan/orders"),
|
|
3390
|
-
method: "POST",
|
|
3391
|
-
headers: _headers,
|
|
3392
|
-
contentType: "application/json",
|
|
3393
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
3394
|
-
requestType: "json",
|
|
3395
|
-
body: request,
|
|
3396
|
-
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
3397
|
-
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
3398
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
3399
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
3400
|
-
logging: this._options.logging,
|
|
3401
|
-
});
|
|
3402
|
-
if (_response.ok) {
|
|
3403
|
-
return {
|
|
3404
|
-
data: _response.body,
|
|
3405
|
-
rawResponse: _response.rawResponse,
|
|
3406
|
-
};
|
|
3407
|
-
}
|
|
3408
|
-
if (_response.error.reason === "status-code") {
|
|
3409
|
-
switch (_response.error.statusCode) {
|
|
3410
|
-
case 401:
|
|
3411
|
-
throw new Samsara.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
3412
|
-
case 404:
|
|
3413
|
-
throw new Samsara.NotFoundError(_response.error.body, _response.rawResponse);
|
|
3414
|
-
case 405:
|
|
3415
|
-
throw new Samsara.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
3416
|
-
case 429:
|
|
3417
|
-
throw new Samsara.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
3418
|
-
case 500:
|
|
3419
|
-
throw new Samsara.InternalServerError(_response.error.body, _response.rawResponse);
|
|
3420
|
-
case 501:
|
|
3421
|
-
throw new Samsara.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
3422
|
-
case 502:
|
|
3423
|
-
throw new Samsara.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
3424
|
-
case 503:
|
|
3425
|
-
throw new Samsara.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
3426
|
-
case 504:
|
|
3427
|
-
throw new Samsara.GatewayTimeoutError(_response.error.body, _response.rawResponse);
|
|
3428
|
-
default:
|
|
3429
|
-
throw new errors.SamsaraError({
|
|
3430
|
-
statusCode: _response.error.statusCode,
|
|
3431
|
-
body: _response.error.body,
|
|
3432
|
-
rawResponse: _response.rawResponse,
|
|
3433
|
-
});
|
|
3434
|
-
}
|
|
3435
|
-
}
|
|
3436
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/hub/plan/orders");
|
|
3437
|
-
});
|
|
3438
|
-
}
|
|
3439
3250
|
/**
|
|
3440
3251
|
* Delete one or more orders from a plan. Pass either `orderIds` (a comma-separated list) or `deleteAll=true`; exactly one is required. Orders are automatically unassigned from their routes before deletion.
|
|
3441
3252
|
*
|
|
@@ -43,7 +43,6 @@ export type { JobsPatchJobRequestBody } from "./JobsPatchJobRequestBody.js";
|
|
|
43
43
|
export type { ListAssetAssignmentsRequest } from "./ListAssetAssignmentsRequest.js";
|
|
44
44
|
export type { ListAssociationsRequest } from "./ListAssociationsRequest.js";
|
|
45
45
|
export type { ListDeviceRecoveryMissingAssetsRequest } from "./ListDeviceRecoveryMissingAssetsRequest.js";
|
|
46
|
-
export type { ListHubCustomPropertiesRequest } from "./ListHubCustomPropertiesRequest.js";
|
|
47
46
|
export type { ListHubRouteTemplatesRequest } from "./ListHubRouteTemplatesRequest.js";
|
|
48
47
|
export type { ListMaintenanceVendorsRequest } from "./ListMaintenanceVendorsRequest.js";
|
|
49
48
|
export type { ListPlanOrdersRequest } from "./ListPlanOrdersRequest.js";
|
|
@@ -52,7 +51,6 @@ export type { ListRidershipPassengersRequest } from "./ListRidershipPassengersRe
|
|
|
52
51
|
export type { ListRidershipRouteSetupsRequest } from "./ListRidershipRouteSetupsRequest.js";
|
|
53
52
|
export type { ListTachographLiveDataRequest } from "./ListTachographLiveDataRequest.js";
|
|
54
53
|
export type { ListVendorCategoriesRequest } from "./ListVendorCategoriesRequest.js";
|
|
55
|
-
export type { PlanOrdersCreatePlanOrdersRequestBody } from "./PlanOrdersCreatePlanOrdersRequestBody.js";
|
|
56
54
|
export type { QualificationsArchiveQualificationRecordRequestBody } from "./QualificationsArchiveQualificationRecordRequestBody.js";
|
|
57
55
|
export type { QualificationsDeleteQualificationRecordRequestBody } from "./QualificationsDeleteQualificationRecordRequestBody.js";
|
|
58
56
|
export type { QualificationsPatchQualificationRecordRequestBody } from "./QualificationsPatchQualificationRecordRequestBody.js";
|
|
@@ -40,6 +40,36 @@ export declare class HubsClient {
|
|
|
40
40
|
*/
|
|
41
41
|
listHubCapacities(request: Samsara.ListHubCapacitiesRequest, requestOptions?: HubsClient.RequestOptions): core.HttpResponsePromise<Samsara.HubCapacitiesListHubCapacitiesResponseBody>;
|
|
42
42
|
private __listHubCapacities;
|
|
43
|
+
/**
|
|
44
|
+
* Retrieve custom properties for a specific hub.
|
|
45
|
+
*
|
|
46
|
+
* <b>Rate limit:</b> 10 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
47
|
+
*
|
|
48
|
+
* To use this endpoint, select **Read Routes** under the Driver Workflow category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
49
|
+
*
|
|
50
|
+
*
|
|
51
|
+
* **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
52
|
+
*
|
|
53
|
+
* @param {Samsara.ListHubCustomPropertiesRequest} request
|
|
54
|
+
* @param {HubsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
55
|
+
*
|
|
56
|
+
* @throws {@link Samsara.UnauthorizedError}
|
|
57
|
+
* @throws {@link Samsara.NotFoundError}
|
|
58
|
+
* @throws {@link Samsara.MethodNotAllowedError}
|
|
59
|
+
* @throws {@link Samsara.TooManyRequestsError}
|
|
60
|
+
* @throws {@link Samsara.InternalServerError}
|
|
61
|
+
* @throws {@link Samsara.NotImplementedError}
|
|
62
|
+
* @throws {@link Samsara.BadGatewayError}
|
|
63
|
+
* @throws {@link Samsara.ServiceUnavailableError}
|
|
64
|
+
* @throws {@link Samsara.GatewayTimeoutError}
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* await client.hubs.listHubCustomProperties({
|
|
68
|
+
* hubId: "hubId"
|
|
69
|
+
* })
|
|
70
|
+
*/
|
|
71
|
+
listHubCustomProperties(request: Samsara.ListHubCustomPropertiesRequest, requestOptions?: HubsClient.RequestOptions): core.HttpResponsePromise<Samsara.HubCustomPropertiesListHubCustomPropertiesResponseBody>;
|
|
72
|
+
private __listHubCustomProperties;
|
|
43
73
|
/**
|
|
44
74
|
* Update existing location by ID.
|
|
45
75
|
*
|
|
@@ -160,6 +160,100 @@ class HubsClient {
|
|
|
160
160
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/hub/capacities");
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Retrieve custom properties for a specific hub.
|
|
165
|
+
*
|
|
166
|
+
* <b>Rate limit:</b> 10 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
167
|
+
*
|
|
168
|
+
* To use this endpoint, select **Read Routes** under the Driver Workflow category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
169
|
+
*
|
|
170
|
+
*
|
|
171
|
+
* **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
172
|
+
*
|
|
173
|
+
* @param {Samsara.ListHubCustomPropertiesRequest} request
|
|
174
|
+
* @param {HubsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
175
|
+
*
|
|
176
|
+
* @throws {@link Samsara.UnauthorizedError}
|
|
177
|
+
* @throws {@link Samsara.NotFoundError}
|
|
178
|
+
* @throws {@link Samsara.MethodNotAllowedError}
|
|
179
|
+
* @throws {@link Samsara.TooManyRequestsError}
|
|
180
|
+
* @throws {@link Samsara.InternalServerError}
|
|
181
|
+
* @throws {@link Samsara.NotImplementedError}
|
|
182
|
+
* @throws {@link Samsara.BadGatewayError}
|
|
183
|
+
* @throws {@link Samsara.ServiceUnavailableError}
|
|
184
|
+
* @throws {@link Samsara.GatewayTimeoutError}
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* await client.hubs.listHubCustomProperties({
|
|
188
|
+
* hubId: "hubId"
|
|
189
|
+
* })
|
|
190
|
+
*/
|
|
191
|
+
listHubCustomProperties(request, requestOptions) {
|
|
192
|
+
return core.HttpResponsePromise.fromPromise(this.__listHubCustomProperties(request, requestOptions));
|
|
193
|
+
}
|
|
194
|
+
__listHubCustomProperties(request, requestOptions) {
|
|
195
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
197
|
+
const { hubId, customPropertyIds, customPropertyNames, startTime, endTime, after, limit } = request;
|
|
198
|
+
const _queryParams = {
|
|
199
|
+
hubId,
|
|
200
|
+
customPropertyIds,
|
|
201
|
+
customPropertyNames,
|
|
202
|
+
startTime: startTime != null ? startTime : undefined,
|
|
203
|
+
endTime: endTime != null ? endTime : undefined,
|
|
204
|
+
after,
|
|
205
|
+
limit,
|
|
206
|
+
};
|
|
207
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
208
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "X-Samsara-Version": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.version }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
209
|
+
const _response = yield core.fetcher({
|
|
210
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SamsaraEnvironment.ProductionApi, "hub/customProperties"),
|
|
211
|
+
method: "GET",
|
|
212
|
+
headers: _headers,
|
|
213
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
214
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
215
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
216
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
217
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
218
|
+
logging: this._options.logging,
|
|
219
|
+
});
|
|
220
|
+
if (_response.ok) {
|
|
221
|
+
return {
|
|
222
|
+
data: _response.body,
|
|
223
|
+
rawResponse: _response.rawResponse,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
if (_response.error.reason === "status-code") {
|
|
227
|
+
switch (_response.error.statusCode) {
|
|
228
|
+
case 401:
|
|
229
|
+
throw new Samsara.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
230
|
+
case 404:
|
|
231
|
+
throw new Samsara.NotFoundError(_response.error.body, _response.rawResponse);
|
|
232
|
+
case 405:
|
|
233
|
+
throw new Samsara.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
234
|
+
case 429:
|
|
235
|
+
throw new Samsara.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
236
|
+
case 500:
|
|
237
|
+
throw new Samsara.InternalServerError(_response.error.body, _response.rawResponse);
|
|
238
|
+
case 501:
|
|
239
|
+
throw new Samsara.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
240
|
+
case 502:
|
|
241
|
+
throw new Samsara.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
242
|
+
case 503:
|
|
243
|
+
throw new Samsara.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
244
|
+
case 504:
|
|
245
|
+
throw new Samsara.GatewayTimeoutError(_response.error.body, _response.rawResponse);
|
|
246
|
+
default:
|
|
247
|
+
throw new errors.SamsaraError({
|
|
248
|
+
statusCode: _response.error.statusCode,
|
|
249
|
+
body: _response.error.body,
|
|
250
|
+
rawResponse: _response.rawResponse,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/hub/customProperties");
|
|
255
|
+
});
|
|
256
|
+
}
|
|
163
257
|
/**
|
|
164
258
|
* Update existing location by ID.
|
|
165
259
|
*
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type { HubLocationsCreateHubLocationsRequestBody } from "./HubLocationsCreateHubLocationsRequestBody.js";
|
|
2
2
|
export type { HubLocationsUpdateHubLocationRequestBody } from "./HubLocationsUpdateHubLocationRequestBody.js";
|
|
3
3
|
export type { ListHubCapacitiesRequest } from "./ListHubCapacitiesRequest.js";
|
|
4
|
+
export type { ListHubCustomPropertiesRequest } from "./ListHubCustomPropertiesRequest.js";
|
|
4
5
|
export type { ListHubLocationsRequest } from "./ListHubLocationsRequest.js";
|
|
5
6
|
export type { ListHubSkillsRequest } from "./ListHubSkillsRequest.js";
|
|
6
7
|
export type { ListHubsRequest } from "./ListHubsRequest.js";
|
|
@@ -41,6 +41,40 @@ export declare class PlansClient {
|
|
|
41
41
|
*/
|
|
42
42
|
createHubPlan(request: Samsara.HubPlansCreateHubPlanRequestBody, requestOptions?: PlansClient.RequestOptions): core.HttpResponsePromise<Samsara.HubPlansCreateHubPlanResponseBody>;
|
|
43
43
|
private __createHubPlan;
|
|
44
|
+
/**
|
|
45
|
+
* Create one or more orders (bulk upsert). Pass an array of order objects; any object whose customerOrderId already exists will be updated, otherwise a new order is created. Functions can return JSON arrays in this Order POST format. Orders are initially created at the plan level but will migrate to hub-level entities, with planId becoming optional in future versions.
|
|
46
|
+
*
|
|
47
|
+
* <b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
48
|
+
*
|
|
49
|
+
* To use this endpoint, select **Write Routes** under the Driver Workflow category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
50
|
+
*
|
|
51
|
+
*
|
|
52
|
+
* **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
53
|
+
*
|
|
54
|
+
* @param {Samsara.PlanOrdersCreatePlanOrdersRequestBody} request
|
|
55
|
+
* @param {PlansClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
56
|
+
*
|
|
57
|
+
* @throws {@link Samsara.UnauthorizedError}
|
|
58
|
+
* @throws {@link Samsara.NotFoundError}
|
|
59
|
+
* @throws {@link Samsara.MethodNotAllowedError}
|
|
60
|
+
* @throws {@link Samsara.TooManyRequestsError}
|
|
61
|
+
* @throws {@link Samsara.InternalServerError}
|
|
62
|
+
* @throws {@link Samsara.NotImplementedError}
|
|
63
|
+
* @throws {@link Samsara.BadGatewayError}
|
|
64
|
+
* @throws {@link Samsara.ServiceUnavailableError}
|
|
65
|
+
* @throws {@link Samsara.GatewayTimeoutError}
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* await client.plans.createPlanOrders({
|
|
69
|
+
* data: [{
|
|
70
|
+
* customerOrderId: "ORDER-2024-001",
|
|
71
|
+
* hubId: "550e8400-e29b-41d4-a716-446655440000",
|
|
72
|
+
* planId: "650e8400-e29b-41d4-a716-446655440023"
|
|
73
|
+
* }]
|
|
74
|
+
* })
|
|
75
|
+
*/
|
|
76
|
+
createPlanOrders(request: Samsara.PlanOrdersCreatePlanOrdersRequestBody, requestOptions?: PlansClient.RequestOptions): core.HttpResponsePromise<Samsara.PlanOrdersCreatePlanOrdersResponseBody>;
|
|
77
|
+
private __createPlanOrders;
|
|
44
78
|
/**
|
|
45
79
|
* Retrieve all plans for a specific hub.
|
|
46
80
|
*
|
|
@@ -143,6 +143,97 @@ class PlansClient {
|
|
|
143
143
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/hub/plan");
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Create one or more orders (bulk upsert). Pass an array of order objects; any object whose customerOrderId already exists will be updated, otherwise a new order is created. Functions can return JSON arrays in this Order POST format. Orders are initially created at the plan level but will migrate to hub-level entities, with planId becoming optional in future versions.
|
|
148
|
+
*
|
|
149
|
+
* <b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
150
|
+
*
|
|
151
|
+
* To use this endpoint, select **Write Routes** under the Driver Workflow category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
152
|
+
*
|
|
153
|
+
*
|
|
154
|
+
* **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
155
|
+
*
|
|
156
|
+
* @param {Samsara.PlanOrdersCreatePlanOrdersRequestBody} request
|
|
157
|
+
* @param {PlansClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
158
|
+
*
|
|
159
|
+
* @throws {@link Samsara.UnauthorizedError}
|
|
160
|
+
* @throws {@link Samsara.NotFoundError}
|
|
161
|
+
* @throws {@link Samsara.MethodNotAllowedError}
|
|
162
|
+
* @throws {@link Samsara.TooManyRequestsError}
|
|
163
|
+
* @throws {@link Samsara.InternalServerError}
|
|
164
|
+
* @throws {@link Samsara.NotImplementedError}
|
|
165
|
+
* @throws {@link Samsara.BadGatewayError}
|
|
166
|
+
* @throws {@link Samsara.ServiceUnavailableError}
|
|
167
|
+
* @throws {@link Samsara.GatewayTimeoutError}
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* await client.plans.createPlanOrders({
|
|
171
|
+
* data: [{
|
|
172
|
+
* customerOrderId: "ORDER-2024-001",
|
|
173
|
+
* hubId: "550e8400-e29b-41d4-a716-446655440000",
|
|
174
|
+
* planId: "650e8400-e29b-41d4-a716-446655440023"
|
|
175
|
+
* }]
|
|
176
|
+
* })
|
|
177
|
+
*/
|
|
178
|
+
createPlanOrders(request, requestOptions) {
|
|
179
|
+
return core.HttpResponsePromise.fromPromise(this.__createPlanOrders(request, requestOptions));
|
|
180
|
+
}
|
|
181
|
+
__createPlanOrders(request, requestOptions) {
|
|
182
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
183
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
184
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
185
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "X-Samsara-Version": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.version }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
186
|
+
const _response = yield core.fetcher({
|
|
187
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SamsaraEnvironment.ProductionApi, "hub/plan/orders"),
|
|
188
|
+
method: "POST",
|
|
189
|
+
headers: _headers,
|
|
190
|
+
contentType: "application/json",
|
|
191
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
192
|
+
requestType: "json",
|
|
193
|
+
body: request,
|
|
194
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
195
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
196
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
197
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
198
|
+
logging: this._options.logging,
|
|
199
|
+
});
|
|
200
|
+
if (_response.ok) {
|
|
201
|
+
return {
|
|
202
|
+
data: _response.body,
|
|
203
|
+
rawResponse: _response.rawResponse,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
if (_response.error.reason === "status-code") {
|
|
207
|
+
switch (_response.error.statusCode) {
|
|
208
|
+
case 401:
|
|
209
|
+
throw new Samsara.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
210
|
+
case 404:
|
|
211
|
+
throw new Samsara.NotFoundError(_response.error.body, _response.rawResponse);
|
|
212
|
+
case 405:
|
|
213
|
+
throw new Samsara.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
214
|
+
case 429:
|
|
215
|
+
throw new Samsara.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
216
|
+
case 500:
|
|
217
|
+
throw new Samsara.InternalServerError(_response.error.body, _response.rawResponse);
|
|
218
|
+
case 501:
|
|
219
|
+
throw new Samsara.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
220
|
+
case 502:
|
|
221
|
+
throw new Samsara.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
222
|
+
case 503:
|
|
223
|
+
throw new Samsara.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
224
|
+
case 504:
|
|
225
|
+
throw new Samsara.GatewayTimeoutError(_response.error.body, _response.rawResponse);
|
|
226
|
+
default:
|
|
227
|
+
throw new errors.SamsaraError({
|
|
228
|
+
statusCode: _response.error.statusCode,
|
|
229
|
+
body: _response.error.body,
|
|
230
|
+
rawResponse: _response.rawResponse,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/hub/plan/orders");
|
|
235
|
+
});
|
|
236
|
+
}
|
|
146
237
|
/**
|
|
147
238
|
* Retrieve all plans for a specific hub.
|
|
148
239
|
*
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "11.10.
|
|
1
|
+
export declare const SDK_VERSION = "11.10.1";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -7,8 +7,8 @@ export function normalizeClientOptions(options) {
|
|
|
7
7
|
const headers = mergeHeaders({
|
|
8
8
|
"X-Fern-Language": "JavaScript",
|
|
9
9
|
"X-Fern-SDK-Name": "@samsarahq/samsara",
|
|
10
|
-
"X-Fern-SDK-Version": "11.10.
|
|
11
|
-
"User-Agent": "@samsarahq/samsara/11.10.
|
|
10
|
+
"X-Fern-SDK-Version": "11.10.1",
|
|
11
|
+
"User-Agent": "@samsarahq/samsara/11.10.1",
|
|
12
12
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
13
13
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
14
14
|
"X-Samsara-Version": (_a = options === null || options === void 0 ? void 0 : options.version) !== null && _a !== void 0 ? _a : "2025-06-11",
|