diff --git a/.fern/metadata.json b/.fern/metadata.json index 547a8781..ada80c35 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -6,5 +6,5 @@ "namespaceExport": "Samsara", "generateWireTests": true }, - "sdkVersion": "5.11.0" + "sdkVersion": "6.0.1" } diff --git a/package.json b/package.json index e37ca9d4..176b067c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@samsarahq/samsara", - "version": "5.11.0", + "version": "6.0.1", "private": false, "repository": { "type": "git", diff --git a/reference.md b/reference.md index 1de5c69f..92dcde46 100644 --- a/reference.md +++ b/reference.md @@ -5119,6 +5119,78 @@ await client.betaApIs.getRidershipPassenger({ + + + + +
client.betaApIs.listRidershipRouteSetups({ ...params }) -> Samsara.RidershipRouteSetupsListRidershipRouteSetupsResponseBody +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List all route setups for a ridership account. + + Rate limit: 5 requests/sec (learn more about rate limits here). + +To use this endpoint, select **Read Ridership** under the Ridership category when creating or editing an API token. Learn More. + + + **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.betaApIs.listRidershipRouteSetups({ + accountId: "accountId" +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Samsara.ListRidershipRouteSetupsRequest` + +
+
+ +
+
+ +**requestOptions:** `BetaApIsClient.RequestOptions` + +
+
+
+
+ +
@@ -5135,7 +5207,7 @@ await client.betaApIs.getRidershipPassenger({
-Create or replace the passenger assignment setup for a route. +Create the passenger assignment setup for a route. Rate limit: 100 requests/min (learn more about rate limits here). @@ -17590,7 +17662,7 @@ await client.organizationInfo.getOrganizationInfo(); ## Preview APIs -
client.previewApIs.listDeviceRecoveryAssets({ ...params }) -> Samsara.DeviceRecoveryListDeviceRecoveryAssetsResponseBody +
client.previewApIs.listDeviceRecoveryMissingAssets({ ...params }) -> Samsara.DeviceRecoveryListDeviceRecoveryMissingAssetsResponseBody
@@ -17602,7 +17674,7 @@ await client.organizationInfo.getOrganizationInfo();
-List all assets that have a device recovery state for the organization. Optionally filter by one or more statuses (UNKNOWN, MISSING, LOCATED, RECOVERED). +List all assets that are currently marked as missing for the organization. Rate limit: 5 requests/sec (learn more about rate limits here). @@ -17630,7 +17702,7 @@ Endpoints in this section are in Preview. These APIs are not functional and are
```typescript -await client.previewApIs.listDeviceRecoveryAssets(); +await client.previewApIs.listDeviceRecoveryMissingAssets(); ```
@@ -17646,7 +17718,7 @@ await client.previewApIs.listDeviceRecoveryAssets();
-**request:** `Samsara.ListDeviceRecoveryAssetsRequest` +**request:** `Samsara.ListDeviceRecoveryMissingAssetsRequest`
@@ -17821,84 +17893,6 @@ await client.previewApIs.recoverAsset({
-
-
-
- -
client.previewApIs.getAssetRecoveryState({ ...params }) -> Samsara.DeviceRecoveryGetAssetRecoveryStateResponseBody -
-
- -#### 📝 Description - -
-
- -
-
- -Get the current recovery state for a specific asset, including recovery photos and notification recipients. - - Rate limit: 5 requests/sec (learn more about rate limits here). - -To use this endpoint, select **Read Assets** under the Assets category when creating or editing an API token. Learn More. - -Endpoints in this section are in Preview. These APIs are not functional and are instead for soliciting feedback from our API users on the intended design of this API. Additionally, it is not guaranteed that we will be releasing an endpoint included in this section to production. This means that developers should **NOT** rely on these APIs to build business critical applications - -- Samsara may change the structure of a preview API's interface without versioning or any notice to API users. - -- When an endpoint becomes generally available, it will be announced in the API [changelog](https://developers.samsara.com/changelog). - - - **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team. -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```typescript -await client.previewApIs.getAssetRecoveryState({ - id: "id" -}); - -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**request:** `Samsara.GetAssetRecoveryStateRequest` - -
-
- -
-
- -**requestOptions:** `PreviewApIsClient.RequestOptions` - -
-
-
-
- -
diff --git a/src/BaseClient.ts b/src/BaseClient.ts index ad6331b7..6e8927e6 100644 --- a/src/BaseClient.ts +++ b/src/BaseClient.ts @@ -55,8 +55,8 @@ export function normalizeClientOptionsRate limit: 5 requests/sec (learn more about rate limits here). + * + * To use this endpoint, select **Read Ridership** under the Ridership category when creating or editing an API token. Learn More. + * + * + * **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team. + * + * @param {Samsara.ListRidershipRouteSetupsRequest} request + * @param {BetaApIsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Samsara.UnauthorizedError} + * @throws {@link Samsara.NotFoundError} + * @throws {@link Samsara.MethodNotAllowedError} + * @throws {@link Samsara.TooManyRequestsError} + * @throws {@link Samsara.InternalServerError} + * @throws {@link Samsara.NotImplementedError} + * @throws {@link Samsara.BadGatewayError} + * @throws {@link Samsara.ServiceUnavailableError} + * @throws {@link Samsara.GatewayTimeoutError} + * + * @example + * await client.betaApIs.listRidershipRouteSetups({ + * accountId: "accountId" + * }) + */ + public listRidershipRouteSetups( + request: Samsara.ListRidershipRouteSetupsRequest, + requestOptions?: BetaApIsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listRidershipRouteSetups(request, requestOptions)); + } + + private async __listRidershipRouteSetups( + request: Samsara.ListRidershipRouteSetupsRequest, + requestOptions?: BetaApIsClient.RequestOptions, + ): Promise> { + const { accountId, after, limit } = request; + const _queryParams: Record = { + accountId, + after, + limit, + }; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "X-Samsara-Version": requestOptions?.version }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SamsaraEnvironment.ProductionApi, + "ridership/route-setups", + ), + method: "GET", + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: _response.body as Samsara.RidershipRouteSetupsListRidershipRouteSetupsResponseBody, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Samsara.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); + case 404: + throw new Samsara.NotFoundError(_response.error.body as unknown, _response.rawResponse); + case 405: + throw new Samsara.MethodNotAllowedError(_response.error.body as unknown, _response.rawResponse); + case 429: + throw new Samsara.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); + case 500: + throw new Samsara.InternalServerError(_response.error.body as unknown, _response.rawResponse); + case 501: + throw new Samsara.NotImplementedError(_response.error.body as unknown, _response.rawResponse); + case 502: + throw new Samsara.BadGatewayError(_response.error.body as unknown, _response.rawResponse); + case 503: + throw new Samsara.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); + case 504: + throw new Samsara.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.SamsaraError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/ridership/route-setups"); + } + + /** + * Create the passenger assignment setup for a route. * * Rate limit: 100 requests/min (learn more about rate limits here). * diff --git a/src/api/resources/betaApIs/client/requests/GetDetectionsRequest.ts b/src/api/resources/betaApIs/client/requests/GetDetectionsRequest.ts index c4e66c8d..f22bad00 100644 --- a/src/api/resources/betaApIs/client/requests/GetDetectionsRequest.ts +++ b/src/api/resources/betaApIs/client/requests/GetDetectionsRequest.ts @@ -11,7 +11,7 @@ export interface GetDetectionsRequest { driverIds?: string | string[]; /** Optional string of comma separated asset IDs. If asset ID is present, events for the specified asset(s) will be returned. Max for this value is 2000 objects. (Example: 281474982859091,281471982957527) */ assetIds?: string | string[]; - /** Optional string of comma separated labels to filter behavior labels. Uses OR semantics for filtering. An empty list allows all values. Valid values: `acceleration`, `braking`, `crash`, `drowsy`, `eatingDrinking`, `edgeRailroadCrossingViolation`, `followingDistance`, `forwardCollisionWarning`, `genericDistraction`, `harshTurn`, `heavySpeeding`, `laneDeparture`, `lightSpeeding`, `maxSpeed`, `mobileUsage`, `moderateSpeeding`, `noSeatbelt`, `obstructedCamera`, `passenger`, `policyViolationMask`, `ranRedLight`, `rearCollisionWarning`, `rollingStop`, `rolloverProtection`, `severeSpeeding`, `smoking`, `speeding`, `unsafeParking`, `vehicleInBlindSpotWarning`, `vulnerableRoadUserCollisionWarning`, `yawControl`. (Example: rollingStop,obstructedCamera,noSeatbelt) */ + /** Optional string of comma separated labels to filter behavior labels. Uses OR semantics for filtering. An empty list allows all values. Valid values: `acceleration`, `braking`, `crash`, `drowsy`, `eatingDrinking`, `edgeRailroadCrossingViolation`, `followingDistance`, `forwardCollisionWarning`, `genericDistraction`, `harshTurn`, `heavySpeeding`, `laneDeparture`, `lightSpeeding`, `maxSpeed`, `mobileUsage`, `moderateSpeeding`, `noSeatbelt`, `obstructedCamera`, `passenger`, `policyViolationMask`, `ranRedLight`, `rearCollisionWarning`, `reversing`, `rollingStop`, `rolloverProtection`, `severeSpeeding`, `smoking`, `speeding`, `unsafeParking`, `vehicleInBlindSpotWarning`, `vulnerableRoadUserCollisionWarning`, `yawControl`. (Example: rollingStop,obstructedCamera,noSeatbelt) */ detectionBehaviorLabels?: string | string[]; /** Optional string of comma separated reasons to filter detections. Uses OR semantics for filtering. An empty list allows all values. Valid values: `overDailyLimit`, `overHourlyLimit`, `overTripLimit`, `belowConfidenceThreshold`, `belowSeverityThreshold`, `overEventRateLimit`, `geofenceFilter`, `belowNudgeThreshold`, `belowSpeedThreshold`, `nighttimeFilter`, `speedingFilter`, `inCabAlertOnly`, `unknown`. (Example: overDailyLimit,overHourlyLimit,belowConfidenceThreshold) */ inboxFilterReason?: string | string[]; diff --git a/src/api/resources/betaApIs/client/requests/GetReadingsHistoryRequest.ts b/src/api/resources/betaApIs/client/requests/GetReadingsHistoryRequest.ts index ef38301e..a5ae79c6 100644 --- a/src/api/resources/betaApIs/client/requests/GetReadingsHistoryRequest.ts +++ b/src/api/resources/betaApIs/client/requests/GetReadingsHistoryRequest.ts @@ -41,6 +41,7 @@ export interface GetReadingsHistoryRequest { * * `checkEngineLightJ1939Warning` (Check Engine Light (J1939) - Warning): Indicates whether the J1939 check engine light warning indicator is active or inactive. (values: off | on) * * `checkEngineLightPassenger` (Check Engine Light (Passenger)): Indicates whether the passenger check engine light indicator is active or inactive. (values: off | on) * * `coolantTemp` (Engine Coolant Temp): Represents the engine coolant temperature. (celsius) + * * `crankcasePressure` (Crankcase Pressure): The pressure inside the engine's crankcase (kilopascal) * * `defLevel` (DEF Level): Represents the DEF (Diesel Exhaust Fluid) level percentage. (percent) * * `derivedFuelConsumed` (Lifetime Fuel Consumed (Samsara)): Samsara-maintained fuel consumption since the device was firstinstalled. (liter) * * `deviceOrientation` (Device Orientation): Indicates orientation of the device. (values: invalid | unknown | topDown | bottomDown | leftDown | rightDown | backDown | frontDown) @@ -48,27 +49,41 @@ export interface GetReadingsHistoryRequest { * * `dpfLampStatus` (DPF Lamp Status): Status of the Diesel Particulate Filter warning lamp. (values: off | on | blinking) * * `dpfSootLoadPercent` (DPF Soot Load): Diesel Particulate Filter soot load percentage. (percent) * * `ecuHistoryTotalRunTime` (ECU Total Run Time): Total engine run time from ECU in seconds. (second) + * * `engineExhaustTemperature` (Engine Exhaust Temperature): Temperature of the engine exhaust (celsius) * * `engineHours` (Engine Hours (ECU)): Represents the total engine runtime in hours as reported by the ECU. (second) * * `engineHoursDigioBased` (Engine Hours (Synthetic - Aux input)): Represents the synthetic total engine runtime in hours based on auxiliary input. (millisecond) * * `engineHoursEngineStateBased` (Engine Hours (Synthetic)): Represents the synthetic total engine runtime in hours based on engine state. (millisecond) + * * `engineImmobilizer` (Engine Immobilizer): The state of the engine immobilizer. Valid values: ignition_disabled, ignition_enabled. * * `engineIntakeAirTemp` (Engine Intake Air Temperature): Represents the engine intake air temperature. (celsius) * * `engineLoadPercent` (Engine Load): Engine load percentage. (percent) + * * `engineOilTemperature` (Engine Oil Temperature): Temperature of the engine oil (celsius) * * `engineState` (Engine State): Indicates the current state of the engine, such as running, stopped. (values: off | running | idling) + * * `engineTotalIdleTime` (Engine Total Idle Time): Total idle time for the vehicle. (minute) * * `ev24VoltDcDcInverterCurrent` (EV 24V DC/DC Inverter Current): Current from the 24V DC-DC inverter in amperes. (ampere) * * `evAverageCellTemperature` (EV Average Cell Temperature): Average temperature of EV battery cells in degrees Celsius. (celsius) + * * `evChargingCurrent` (EV Charging Current): Charging current for electric and hybrid vehicles. (ampere) + * * `evChargingEnergy` (EV Charging Energy): Charging energy for electric and hybrid vehicles. (watthour) * * `evChargingErrorStatus` (EV Charging Error Status): Indicates if the EV charging system has an error. (values: noError | batteryTooHotOrCold | vehicleNotInPark | connectorLockFault | chargingSystemFault | chargingCurrentDifferential | chargingVoltageOutOfRange | chargingSystemNotCompatible | noDataUndeterminedStatus | notAvailable | unknownError) + * * `evChargingStatus` (EV Charging Status): Charging status for electric and hybrid vehicles. (values: unknown | notCharging | charging) + * * `evChargingVoltage` (EV Charging Voltage): Charging voltage for electric and hybrid vehicles. (volt) + * * `evConsumedEnergy` (EV Consumed Energy): Consumed energy (including regenerated) for electric and hybrid vehicles. (watthour) + * * `evDistanceDriven` (EV Distance Driven): Electric distance driven for electric and hybrid vehicles. (meter) * * `evHighCapacityBatteryCurrent` (EV High Capacity Battery Current): Current from the high capacity EV battery in amperes. (ampere) * * `evHighCapacityBatteryVoltage` (High Capacity EV Battery Voltage): Represents the voltage of the high capacity EV battery. (volt) * * `evMaxAllowedStateOfChargePercent` (EV Max Allowed State of Charge): Maximum allowed state of charge percentage. (percent) * * `evMaxCellTemperature` (EV Max Cell Temperature): Maximum temperature of EV battery cells in degrees Celsius. (celsius) * * `evMinAllowedStateOfChargePercent` (EV Min Allowed State of Charge): Minimum allowed state of charge percentage. (percent) * * `evMinCellTemperature` (EV Min Cell Temperature): Minimum temperature of EV battery cells in degrees Celsius. (celsius) + * * `evRegeneratedEnergy` (EV Regenerated Energy): Regenerated energy for electric and hybrid vehicles. (watthour) * * `exhaustGasPressure` (Exhaust Gas Pressure): Represents the exhaust gas pressure. (kilopascal) + * * `faultCodes` (Fault Codes): Engine fault codes for the asset * * `fuelConsumptionRate` (Fuel Consumption Rate): The rate at which an asset uses fuel (litersperhour) * * `fuelLevelPerc` (Fuel Level): Percentage of fuel remaining in the tank. (percent) * * `fuelSource` (Fuel Source): Type of fuel used by the asset. (values: gasoline | diesel) * * `geoCoordinates` (Geo Coordinates): GPS coordinates (latitude and longitude) of the asset's location. + * * `gpsDistance` (GPS Distance): The distance the vehicle has traveled since the gateway was installed based on GPS calculations. (meter) * * `gpsSpeed` (GPS Speed): Asset speed measured by the gateway's GPS receiver. (meterspersec) + * * `idlingDuration` (Cumulative Idling Duration): The cumulative idling duration. Cumulative values always increase. (millisecond) * * `ignitionStatus` (Ignitions Status): Indicates the current ignition status as a voltage (values: off | on) * * `latitude` (Latitude): Latitude coordinate of the asset's location. (decimaldegrees) * * `lifetimeFuelConsumed` (Lifetime Fuel Consumed): Represents the vehicle maintained lifetime fuel consumption as reported by the vehicle. (liter) @@ -99,6 +114,7 @@ export interface GetReadingsHistoryRequest { * * `seatbeltDriver` (Seatbelt (Driver)): Indicates whether the driver's seatbelt is buckled or unbuckled. (values: unbuckled | buckled) * * `seatbeltPassenger` (Seatbelt (Passenger)): Indicates whether the passenger's seatbelt is buckled or unbuckled. (values: unbuckled | buckled) * * `supportFindNearby` (Support Find Nearby): Indicates if the asset can support find nearby. (values: noData | notCompatible | pendingUpgrade | Ready) + * * `tellTales` (Tell Tale Status): Tell tales status as read from the vehicle. * * `tirePressuresBackLeft` (Tire pressure, back left): Represents the tire pressure for the back-left tire. (kilopascal) * * `tirePressuresBackRight` (Tire pressure, back right): Represents the tire pressure for the back-right tire. (kilopascal) * * `tirePressuresFrontLeft` (Tire pressure, front left): Represents the tire pressure for the front-left tire. (kilopascal) diff --git a/src/api/resources/betaApIs/client/requests/GetReadingsSnapshotRequest.ts b/src/api/resources/betaApIs/client/requests/GetReadingsSnapshotRequest.ts index d5dfcd66..1be29514 100644 --- a/src/api/resources/betaApIs/client/requests/GetReadingsSnapshotRequest.ts +++ b/src/api/resources/betaApIs/client/requests/GetReadingsSnapshotRequest.ts @@ -41,6 +41,7 @@ export interface GetReadingsSnapshotRequest { * * `checkEngineLightJ1939Warning` (Check Engine Light (J1939) - Warning): Indicates whether the J1939 check engine light warning indicator is active or inactive. (values: off | on) * * `checkEngineLightPassenger` (Check Engine Light (Passenger)): Indicates whether the passenger check engine light indicator is active or inactive. (values: off | on) * * `coolantTemp` (Engine Coolant Temp): Represents the engine coolant temperature. (celsius) + * * `crankcasePressure` (Crankcase Pressure): The pressure inside the engine's crankcase (kilopascal) * * `defLevel` (DEF Level): Represents the DEF (Diesel Exhaust Fluid) level percentage. (percent) * * `derivedFuelConsumed` (Lifetime Fuel Consumed (Samsara)): Samsara-maintained fuel consumption since the device was firstinstalled. (liter) * * `deviceOrientation` (Device Orientation): Indicates orientation of the device. (values: invalid | unknown | topDown | bottomDown | leftDown | rightDown | backDown | frontDown) @@ -48,27 +49,41 @@ export interface GetReadingsSnapshotRequest { * * `dpfLampStatus` (DPF Lamp Status): Status of the Diesel Particulate Filter warning lamp. (values: off | on | blinking) * * `dpfSootLoadPercent` (DPF Soot Load): Diesel Particulate Filter soot load percentage. (percent) * * `ecuHistoryTotalRunTime` (ECU Total Run Time): Total engine run time from ECU in seconds. (second) + * * `engineExhaustTemperature` (Engine Exhaust Temperature): Temperature of the engine exhaust (celsius) * * `engineHours` (Engine Hours (ECU)): Represents the total engine runtime in hours as reported by the ECU. (second) * * `engineHoursDigioBased` (Engine Hours (Synthetic - Aux input)): Represents the synthetic total engine runtime in hours based on auxiliary input. (millisecond) * * `engineHoursEngineStateBased` (Engine Hours (Synthetic)): Represents the synthetic total engine runtime in hours based on engine state. (millisecond) + * * `engineImmobilizer` (Engine Immobilizer): The state of the engine immobilizer. Valid values: ignition_disabled, ignition_enabled. * * `engineIntakeAirTemp` (Engine Intake Air Temperature): Represents the engine intake air temperature. (celsius) * * `engineLoadPercent` (Engine Load): Engine load percentage. (percent) + * * `engineOilTemperature` (Engine Oil Temperature): Temperature of the engine oil (celsius) * * `engineState` (Engine State): Indicates the current state of the engine, such as running, stopped. (values: off | running | idling) + * * `engineTotalIdleTime` (Engine Total Idle Time): Total idle time for the vehicle. (minute) * * `ev24VoltDcDcInverterCurrent` (EV 24V DC/DC Inverter Current): Current from the 24V DC-DC inverter in amperes. (ampere) * * `evAverageCellTemperature` (EV Average Cell Temperature): Average temperature of EV battery cells in degrees Celsius. (celsius) + * * `evChargingCurrent` (EV Charging Current): Charging current for electric and hybrid vehicles. (ampere) + * * `evChargingEnergy` (EV Charging Energy): Charging energy for electric and hybrid vehicles. (watthour) * * `evChargingErrorStatus` (EV Charging Error Status): Indicates if the EV charging system has an error. (values: noError | batteryTooHotOrCold | vehicleNotInPark | connectorLockFault | chargingSystemFault | chargingCurrentDifferential | chargingVoltageOutOfRange | chargingSystemNotCompatible | noDataUndeterminedStatus | notAvailable | unknownError) + * * `evChargingStatus` (EV Charging Status): Charging status for electric and hybrid vehicles. (values: unknown | notCharging | charging) + * * `evChargingVoltage` (EV Charging Voltage): Charging voltage for electric and hybrid vehicles. (volt) + * * `evConsumedEnergy` (EV Consumed Energy): Consumed energy (including regenerated) for electric and hybrid vehicles. (watthour) + * * `evDistanceDriven` (EV Distance Driven): Electric distance driven for electric and hybrid vehicles. (meter) * * `evHighCapacityBatteryCurrent` (EV High Capacity Battery Current): Current from the high capacity EV battery in amperes. (ampere) * * `evHighCapacityBatteryVoltage` (High Capacity EV Battery Voltage): Represents the voltage of the high capacity EV battery. (volt) * * `evMaxAllowedStateOfChargePercent` (EV Max Allowed State of Charge): Maximum allowed state of charge percentage. (percent) * * `evMaxCellTemperature` (EV Max Cell Temperature): Maximum temperature of EV battery cells in degrees Celsius. (celsius) * * `evMinAllowedStateOfChargePercent` (EV Min Allowed State of Charge): Minimum allowed state of charge percentage. (percent) * * `evMinCellTemperature` (EV Min Cell Temperature): Minimum temperature of EV battery cells in degrees Celsius. (celsius) + * * `evRegeneratedEnergy` (EV Regenerated Energy): Regenerated energy for electric and hybrid vehicles. (watthour) * * `exhaustGasPressure` (Exhaust Gas Pressure): Represents the exhaust gas pressure. (kilopascal) + * * `faultCodes` (Fault Codes): Engine fault codes for the asset * * `fuelConsumptionRate` (Fuel Consumption Rate): The rate at which an asset uses fuel (litersperhour) * * `fuelLevelPerc` (Fuel Level): Percentage of fuel remaining in the tank. (percent) * * `fuelSource` (Fuel Source): Type of fuel used by the asset. (values: gasoline | diesel) * * `geoCoordinates` (Geo Coordinates): GPS coordinates (latitude and longitude) of the asset's location. + * * `gpsDistance` (GPS Distance): The distance the vehicle has traveled since the gateway was installed based on GPS calculations. (meter) * * `gpsSpeed` (GPS Speed): Asset speed measured by the gateway's GPS receiver. (meterspersec) + * * `idlingDuration` (Cumulative Idling Duration): The cumulative idling duration. Cumulative values always increase. (millisecond) * * `ignitionStatus` (Ignitions Status): Indicates the current ignition status as a voltage (values: off | on) * * `latitude` (Latitude): Latitude coordinate of the asset's location. (decimaldegrees) * * `lifetimeFuelConsumed` (Lifetime Fuel Consumed): Represents the vehicle maintained lifetime fuel consumption as reported by the vehicle. (liter) @@ -99,6 +114,7 @@ export interface GetReadingsSnapshotRequest { * * `seatbeltDriver` (Seatbelt (Driver)): Indicates whether the driver's seatbelt is buckled or unbuckled. (values: unbuckled | buckled) * * `seatbeltPassenger` (Seatbelt (Passenger)): Indicates whether the passenger's seatbelt is buckled or unbuckled. (values: unbuckled | buckled) * * `supportFindNearby` (Support Find Nearby): Indicates if the asset can support find nearby. (values: noData | notCompatible | pendingUpgrade | Ready) + * * `tellTales` (Tell Tale Status): Tell tales status as read from the vehicle. * * `tirePressuresBackLeft` (Tire pressure, back left): Represents the tire pressure for the back-left tire. (kilopascal) * * `tirePressuresBackRight` (Tire pressure, back right): Represents the tire pressure for the back-right tire. (kilopascal) * * `tirePressuresFrontLeft` (Tire pressure, front left): Represents the tire pressure for the front-left tire. (kilopascal) diff --git a/src/api/resources/betaApIs/client/requests/ListRidershipRouteSetupsRequest.ts b/src/api/resources/betaApIs/client/requests/ListRidershipRouteSetupsRequest.ts new file mode 100644 index 00000000..66925db3 --- /dev/null +++ b/src/api/resources/betaApIs/client/requests/ListRidershipRouteSetupsRequest.ts @@ -0,0 +1,16 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * { + * accountId: "accountId" + * } + */ +export interface ListRidershipRouteSetupsRequest { + /** The Samsara UUID of the ridership account to list route setups for. */ + accountId: string; + /** If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results. */ + after?: string; + /** The limit for how many objects will be in the response. Default and max for this value is 512 objects. */ + limit?: number; +} diff --git a/src/api/resources/betaApIs/client/requests/index.ts b/src/api/resources/betaApIs/client/requests/index.ts index ed505280..4e17c1b3 100644 --- a/src/api/resources/betaApIs/client/requests/index.ts +++ b/src/api/resources/betaApIs/client/requests/index.ts @@ -44,6 +44,7 @@ export type { ListHubCustomPropertiesRequest } from "./ListHubCustomPropertiesRe export type { ListReadingsDefinitionsRequest } from "./ListReadingsDefinitionsRequest.js"; export type { ListRidershipAccountsRequest } from "./ListRidershipAccountsRequest.js"; export type { ListRidershipPassengersRequest } from "./ListRidershipPassengersRequest.js"; +export type { ListRidershipRouteSetupsRequest } from "./ListRidershipRouteSetupsRequest.js"; export type { PlanOrdersCreatePlanOrdersRequestBody } from "./PlanOrdersCreatePlanOrdersRequestBody.js"; export type { QualificationsArchiveQualificationRecordRequestBody } from "./QualificationsArchiveQualificationRecordRequestBody.js"; export type { QualificationsDeleteQualificationRecordRequestBody } from "./QualificationsDeleteQualificationRecordRequestBody.js"; diff --git a/src/api/resources/driverVehicleAssignments/client/requests/GetDriverVehicleAssignmentsRequest.ts b/src/api/resources/driverVehicleAssignments/client/requests/GetDriverVehicleAssignmentsRequest.ts index 678ee34e..74cc7a5f 100644 --- a/src/api/resources/driverVehicleAssignments/client/requests/GetDriverVehicleAssignmentsRequest.ts +++ b/src/api/resources/driverVehicleAssignments/client/requests/GetDriverVehicleAssignmentsRequest.ts @@ -25,6 +25,6 @@ export interface GetDriverVehicleAssignmentsRequest { vehicleTagIds?: string; /** If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results. */ after?: string; - /** Specifies which assignment type to filter by. Valid values: `HOS`, `idCard`, `static`, `faceId`, `tachograph`, `safetyManual`, `RFID`, `trailer`, `external`, `qrCode`, `driverApp` */ + /** Specifies which assignment type to filter by. Valid values: `HOS`, `idCard`, `static`, `faceId`, `tachograph`, `safetyManual`, `RFID`, `trailer`, `external`, `qrCode`, `driverApp`, `voiceSignIn` */ assignmentType?: Samsara.GetDriverVehicleAssignmentsRequestAssignmentType; } diff --git a/src/api/resources/driverVehicleAssignments/types/GetDriverVehicleAssignmentsRequestAssignmentType.ts b/src/api/resources/driverVehicleAssignments/types/GetDriverVehicleAssignmentsRequestAssignmentType.ts index 0586d00e..90908aae 100644 --- a/src/api/resources/driverVehicleAssignments/types/GetDriverVehicleAssignmentsRequestAssignmentType.ts +++ b/src/api/resources/driverVehicleAssignments/types/GetDriverVehicleAssignmentsRequestAssignmentType.ts @@ -12,6 +12,7 @@ export const GetDriverVehicleAssignmentsRequestAssignmentType = { External: "external", QrCode: "qrCode", DriverApp: "driverApp", + VoiceSignIn: "voiceSignIn", } as const; export type GetDriverVehicleAssignmentsRequestAssignmentType = (typeof GetDriverVehicleAssignmentsRequestAssignmentType)[keyof typeof GetDriverVehicleAssignmentsRequestAssignmentType]; diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index de7e1edd..d44d5b95 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -79,7 +79,6 @@ export * from "./plans/client/requests/index.js"; export * as plans from "./plans/index.js"; export * from "./previewApIs/client/requests/index.js"; export * as previewApIs from "./previewApIs/index.js"; -export * from "./previewApIs/types/index.js"; export * from "./routeEvents/client/requests/index.js"; export * as routeEvents from "./routeEvents/index.js"; export * from "./routes/client/requests/index.js"; diff --git a/src/api/resources/previewApIs/client/Client.ts b/src/api/resources/previewApIs/client/Client.ts index 40a0a2c9..06029759 100644 --- a/src/api/resources/previewApIs/client/Client.ts +++ b/src/api/resources/previewApIs/client/Client.ts @@ -23,7 +23,7 @@ export class PreviewApIsClient { } /** - * List all assets that have a device recovery state for the organization. Optionally filter by one or more statuses (UNKNOWN, MISSING, LOCATED, RECOVERED). + * List all assets that are currently marked as missing for the organization. * * Rate limit: 5 requests/sec (learn more about rate limits here). * @@ -38,7 +38,7 @@ export class PreviewApIsClient { * * **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team. * - * @param {Samsara.ListDeviceRecoveryAssetsRequest} request + * @param {Samsara.ListDeviceRecoveryMissingAssetsRequest} request * @param {PreviewApIsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Samsara.UnauthorizedError} @@ -52,22 +52,21 @@ export class PreviewApIsClient { * @throws {@link Samsara.GatewayTimeoutError} * * @example - * await client.previewApIs.listDeviceRecoveryAssets() + * await client.previewApIs.listDeviceRecoveryMissingAssets() */ - public listDeviceRecoveryAssets( - request: Samsara.ListDeviceRecoveryAssetsRequest = {}, + public listDeviceRecoveryMissingAssets( + request: Samsara.ListDeviceRecoveryMissingAssetsRequest = {}, requestOptions?: PreviewApIsClient.RequestOptions, - ): core.HttpResponsePromise { - return core.HttpResponsePromise.fromPromise(this.__listDeviceRecoveryAssets(request, requestOptions)); + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listDeviceRecoveryMissingAssets(request, requestOptions)); } - private async __listDeviceRecoveryAssets( - request: Samsara.ListDeviceRecoveryAssetsRequest = {}, + private async __listDeviceRecoveryMissingAssets( + request: Samsara.ListDeviceRecoveryMissingAssetsRequest = {}, requestOptions?: PreviewApIsClient.RequestOptions, - ): Promise> { - const { statuses, after } = request; + ): Promise> { + const { after } = request; const _queryParams: Record = { - statuses: Array.isArray(statuses) ? statuses.map((item) => item) : statuses != null ? statuses : undefined, after, }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); @@ -82,7 +81,7 @@ export class PreviewApIsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.SamsaraEnvironment.ProductionApi, - "preview/fleet/assets/device-recovery", + "preview/fleet/assets/device-recovery-missing", ), method: "GET", headers: _headers, @@ -95,7 +94,7 @@ export class PreviewApIsClient { }); if (_response.ok) { return { - data: _response.body as Samsara.DeviceRecoveryListDeviceRecoveryAssetsResponseBody, + data: _response.body as Samsara.DeviceRecoveryListDeviceRecoveryMissingAssetsResponseBody, rawResponse: _response.rawResponse, }; } @@ -133,7 +132,7 @@ export class PreviewApIsClient { _response.error, _response.rawResponse, "GET", - "/preview/fleet/assets/device-recovery", + "/preview/fleet/assets/device-recovery-missing", ); } @@ -372,119 +371,6 @@ export class PreviewApIsClient { ); } - /** - * Get the current recovery state for a specific asset, including recovery photos and notification recipients. - * - * Rate limit: 5 requests/sec (learn more about rate limits here). - * - * To use this endpoint, select **Read Assets** under the Assets category when creating or editing an API token. Learn More. - * - * Endpoints in this section are in Preview. These APIs are not functional and are instead for soliciting feedback from our API users on the intended design of this API. Additionally, it is not guaranteed that we will be releasing an endpoint included in this section to production. This means that developers should **NOT** rely on these APIs to build business critical applications - * - * - Samsara may change the structure of a preview API's interface without versioning or any notice to API users. - * - * - When an endpoint becomes generally available, it will be announced in the API [changelog](https://developers.samsara.com/changelog). - * - * - * **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team. - * - * @param {Samsara.GetAssetRecoveryStateRequest} request - * @param {PreviewApIsClient.RequestOptions} requestOptions - Request-specific configuration. - * - * @throws {@link Samsara.UnauthorizedError} - * @throws {@link Samsara.NotFoundError} - * @throws {@link Samsara.MethodNotAllowedError} - * @throws {@link Samsara.TooManyRequestsError} - * @throws {@link Samsara.InternalServerError} - * @throws {@link Samsara.NotImplementedError} - * @throws {@link Samsara.BadGatewayError} - * @throws {@link Samsara.ServiceUnavailableError} - * @throws {@link Samsara.GatewayTimeoutError} - * - * @example - * await client.previewApIs.getAssetRecoveryState({ - * id: "id" - * }) - */ - public getAssetRecoveryState( - request: Samsara.GetAssetRecoveryStateRequest, - requestOptions?: PreviewApIsClient.RequestOptions, - ): core.HttpResponsePromise { - return core.HttpResponsePromise.fromPromise(this.__getAssetRecoveryState(request, requestOptions)); - } - - private async __getAssetRecoveryState( - request: Samsara.GetAssetRecoveryStateRequest, - requestOptions?: PreviewApIsClient.RequestOptions, - ): Promise> { - const { id } = request; - const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); - const _headers: core.Fetcher.Args["headers"] = mergeHeaders( - _authRequest.headers, - this._options?.headers, - mergeOnlyDefinedHeaders({ "X-Samsara-Version": requestOptions?.version }), - requestOptions?.headers, - ); - const _response = await core.fetcher({ - url: core.url.join( - (await core.Supplier.get(this._options.baseUrl)) ?? - (await core.Supplier.get(this._options.environment)) ?? - environments.SamsaraEnvironment.ProductionApi, - `preview/fleet/assets/device-recovery/${core.url.encodePathParam(id)}/recovery-state`, - ), - method: "GET", - headers: _headers, - queryParameters: requestOptions?.queryParams, - timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, - maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, - abortSignal: requestOptions?.abortSignal, - fetchFn: this._options?.fetch, - logging: this._options.logging, - }); - if (_response.ok) { - return { - data: _response.body as Samsara.DeviceRecoveryGetAssetRecoveryStateResponseBody, - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - switch (_response.error.statusCode) { - case 401: - throw new Samsara.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); - case 404: - throw new Samsara.NotFoundError(_response.error.body as unknown, _response.rawResponse); - case 405: - throw new Samsara.MethodNotAllowedError(_response.error.body as unknown, _response.rawResponse); - case 429: - throw new Samsara.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse); - case 500: - throw new Samsara.InternalServerError(_response.error.body as unknown, _response.rawResponse); - case 501: - throw new Samsara.NotImplementedError(_response.error.body as unknown, _response.rawResponse); - case 502: - throw new Samsara.BadGatewayError(_response.error.body as unknown, _response.rawResponse); - case 503: - throw new Samsara.ServiceUnavailableError(_response.error.body as unknown, _response.rawResponse); - case 504: - throw new Samsara.GatewayTimeoutError(_response.error.body as unknown, _response.rawResponse); - default: - throw new errors.SamsaraError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - rawResponse: _response.rawResponse, - }); - } - } - - return handleNonStatusCodeError( - _response.error, - _response.rawResponse, - "GET", - "/preview/fleet/assets/device-recovery/{id}/recovery-state", - ); - } - /** * Creates a short-lived auth token for a driver. * diff --git a/src/api/resources/previewApIs/client/requests/GetAssetRecoveryStateRequest.ts b/src/api/resources/previewApIs/client/requests/GetAssetRecoveryStateRequest.ts deleted file mode 100644 index a9daff71..00000000 --- a/src/api/resources/previewApIs/client/requests/GetAssetRecoveryStateRequest.ts +++ /dev/null @@ -1,12 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -/** - * @example - * { - * id: "id" - * } - */ -export interface GetAssetRecoveryStateRequest { - /** The ID of the asset. This can be a Samsara internal ID or an external ID in the format `key:value`. */ - id: string; -} diff --git a/src/api/resources/previewApIs/client/requests/ListDeviceRecoveryAssetsRequest.ts b/src/api/resources/previewApIs/client/requests/ListDeviceRecoveryAssetsRequest.ts deleted file mode 100644 index 7401da0c..00000000 --- a/src/api/resources/previewApIs/client/requests/ListDeviceRecoveryAssetsRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -import type * as Samsara from "../../../../index.js"; - -/** - * @example - * {} - */ -export interface ListDeviceRecoveryAssetsRequest { - /** Filter by one or more recovery statuses. Only assets matching the specified statuses will be returned. Returns all statuses if not specified. */ - statuses?: - | Samsara.ListDeviceRecoveryAssetsRequestStatusesItem - | Samsara.ListDeviceRecoveryAssetsRequestStatusesItem[]; - /** If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results. */ - after?: string; -} diff --git a/src/api/resources/previewApIs/client/requests/ListDeviceRecoveryMissingAssetsRequest.ts b/src/api/resources/previewApIs/client/requests/ListDeviceRecoveryMissingAssetsRequest.ts new file mode 100644 index 00000000..fe8abc57 --- /dev/null +++ b/src/api/resources/previewApIs/client/requests/ListDeviceRecoveryMissingAssetsRequest.ts @@ -0,0 +1,10 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * {} + */ +export interface ListDeviceRecoveryMissingAssetsRequest { + /** If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results. */ + after?: string; +} diff --git a/src/api/resources/previewApIs/client/requests/index.ts b/src/api/resources/previewApIs/client/requests/index.ts index 41c3145e..c4737aa0 100644 --- a/src/api/resources/previewApIs/client/requests/index.ts +++ b/src/api/resources/previewApIs/client/requests/index.ts @@ -1,7 +1,6 @@ export type { DeviceRecoveryMarkAssetMissingRequestBody } from "./DeviceRecoveryMarkAssetMissingRequestBody.js"; export { DeviceRecoveryRecoverAssetRequestBody } from "./DeviceRecoveryRecoverAssetRequestBody.js"; export type { DriversAuthTokenCreateDriverAuthTokenRequestBody } from "./DriversAuthTokenCreateDriverAuthTokenRequestBody.js"; -export type { GetAssetRecoveryStateRequest } from "./GetAssetRecoveryStateRequest.js"; -export type { ListDeviceRecoveryAssetsRequest } from "./ListDeviceRecoveryAssetsRequest.js"; +export type { ListDeviceRecoveryMissingAssetsRequest } from "./ListDeviceRecoveryMissingAssetsRequest.js"; export type { LockVehicleRequest } from "./LockVehicleRequest.js"; export type { UnlockVehicleRequest } from "./UnlockVehicleRequest.js"; diff --git a/src/api/resources/previewApIs/index.ts b/src/api/resources/previewApIs/index.ts index d9adb1af..914b8c3c 100644 --- a/src/api/resources/previewApIs/index.ts +++ b/src/api/resources/previewApIs/index.ts @@ -1,2 +1 @@ export * from "./client/index.js"; -export * from "./types/index.js"; diff --git a/src/api/resources/previewApIs/types/ListDeviceRecoveryAssetsRequestStatusesItem.ts b/src/api/resources/previewApIs/types/ListDeviceRecoveryAssetsRequestStatusesItem.ts deleted file mode 100644 index 4d107f25..00000000 --- a/src/api/resources/previewApIs/types/ListDeviceRecoveryAssetsRequestStatusesItem.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -export const ListDeviceRecoveryAssetsRequestStatusesItem = { - Unknown: "UNKNOWN", - Missing: "MISSING", - Located: "LOCATED", - Recovered: "RECOVERED", -} as const; -export type ListDeviceRecoveryAssetsRequestStatusesItem = - (typeof ListDeviceRecoveryAssetsRequestStatusesItem)[keyof typeof ListDeviceRecoveryAssetsRequestStatusesItem]; diff --git a/src/api/resources/previewApIs/types/index.ts b/src/api/resources/previewApIs/types/index.ts deleted file mode 100644 index 75304888..00000000 --- a/src/api/resources/previewApIs/types/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./ListDeviceRecoveryAssetsRequestStatusesItem.js"; diff --git a/src/api/types/DetectionLogDetectionObjectResponseBody.ts b/src/api/types/DetectionLogDetectionObjectResponseBody.ts index 5ee236c1..cde41aba 100644 --- a/src/api/types/DetectionLogDetectionObjectResponseBody.ts +++ b/src/api/types/DetectionLogDetectionObjectResponseBody.ts @@ -16,14 +16,14 @@ export interface DetectionLogDetectionObjectResponseBody { inCabAlertPlayed: boolean; /** Details on the associated safety event generated. Always returned. */ safetyEvent: Samsara.DetectionLogSafetyEventObjectResponseBody[]; - /** The label associated with the detection. Always returned. Valid values: `acceleration`, `braking`, `crash`, `drowsy`, `eatingDrinking`, `edgeRailroadCrossingViolation`, `followingDistance`, `forwardCollisionWarning`, `genericDistraction`, `harshTurn`, `heavySpeeding`, `laneDeparture`, `lightSpeeding`, `maxSpeed`, `mobileUsage`, `moderateSpeeding`, `noSeatbelt`, `obstructedCamera`, `passenger`, `policyViolationMask`, `ranRedLight`, `rearCollisionWarning`, `rollingStop`, `rolloverProtection`, `severeSpeeding`, `smoking`, `speeding`, `unsafeParking`, `vehicleInBlindSpotWarning`, `vulnerableRoadUserCollisionWarning`, `yawControl` */ + /** The label associated with the detection. Always returned. Valid values: `acceleration`, `braking`, `crash`, `drowsy`, `eatingDrinking`, `edgeRailroadCrossingViolation`, `followingDistance`, `forwardCollisionWarning`, `genericDistraction`, `harshTurn`, `heavySpeeding`, `laneDeparture`, `lightSpeeding`, `maxSpeed`, `mobileUsage`, `moderateSpeeding`, `noSeatbelt`, `obstructedCamera`, `passenger`, `policyViolationMask`, `ranRedLight`, `rearCollisionWarning`, `reversing`, `rollingStop`, `rolloverProtection`, `severeSpeeding`, `smoking`, `speeding`, `unsafeParking`, `vehicleInBlindSpotWarning`, `vulnerableRoadUserCollisionWarning`, `yawControl` */ triggerDetectionLabel: DetectionLogDetectionObjectResponseBody.TriggerDetectionLabel; /** Time the detection was updated in Samsara in UTC. RFC 3339 format. Always returned. */ updatedAtTime: string; } export namespace DetectionLogDetectionObjectResponseBody { - /** The label associated with the detection. Always returned. Valid values: `acceleration`, `braking`, `crash`, `drowsy`, `eatingDrinking`, `edgeRailroadCrossingViolation`, `followingDistance`, `forwardCollisionWarning`, `genericDistraction`, `harshTurn`, `heavySpeeding`, `laneDeparture`, `lightSpeeding`, `maxSpeed`, `mobileUsage`, `moderateSpeeding`, `noSeatbelt`, `obstructedCamera`, `passenger`, `policyViolationMask`, `ranRedLight`, `rearCollisionWarning`, `rollingStop`, `rolloverProtection`, `severeSpeeding`, `smoking`, `speeding`, `unsafeParking`, `vehicleInBlindSpotWarning`, `vulnerableRoadUserCollisionWarning`, `yawControl` */ + /** The label associated with the detection. Always returned. Valid values: `acceleration`, `braking`, `crash`, `drowsy`, `eatingDrinking`, `edgeRailroadCrossingViolation`, `followingDistance`, `forwardCollisionWarning`, `genericDistraction`, `harshTurn`, `heavySpeeding`, `laneDeparture`, `lightSpeeding`, `maxSpeed`, `mobileUsage`, `moderateSpeeding`, `noSeatbelt`, `obstructedCamera`, `passenger`, `policyViolationMask`, `ranRedLight`, `rearCollisionWarning`, `reversing`, `rollingStop`, `rolloverProtection`, `severeSpeeding`, `smoking`, `speeding`, `unsafeParking`, `vehicleInBlindSpotWarning`, `vulnerableRoadUserCollisionWarning`, `yawControl` */ export const TriggerDetectionLabel = { Acceleration: "acceleration", Braking: "braking", @@ -47,6 +47,7 @@ export namespace DetectionLogDetectionObjectResponseBody { PolicyViolationMask: "policyViolationMask", RanRedLight: "ranRedLight", RearCollisionWarning: "rearCollisionWarning", + Reversing: "reversing", RollingStop: "rollingStop", RolloverProtection: "rolloverProtection", SevereSpeeding: "severeSpeeding", diff --git a/src/api/types/DeviceRecoveryGetAssetRecoveryStateResponseBody.ts b/src/api/types/DeviceRecoveryGetAssetRecoveryStateResponseBody.ts deleted file mode 100644 index 17fc0382..00000000 --- a/src/api/types/DeviceRecoveryGetAssetRecoveryStateResponseBody.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -import type * as Samsara from "../index.js"; - -export interface DeviceRecoveryGetAssetRecoveryStateResponseBody { - data: Samsara.DeviceRecoveryStateResponseBody; -} diff --git a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsResponseBody.ts b/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsResponseBody.ts deleted file mode 100644 index c31385a3..00000000 --- a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsResponseBody.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -import type * as Samsara from "../index.js"; - -export interface DeviceRecoveryListDeviceRecoveryAssetsResponseBody { - /** List of assets with a device recovery state. */ - data: Samsara.DeviceRecoveryStateResponseBody[]; - pagination: Samsara.GoaPaginationResponseResponseBody; -} diff --git a/src/api/types/DeviceRecoveryGetAssetRecoveryStateBadGatewayErrorResponseBody.ts b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsBadGatewayErrorResponseBody.ts similarity index 73% rename from src/api/types/DeviceRecoveryGetAssetRecoveryStateBadGatewayErrorResponseBody.ts rename to src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsBadGatewayErrorResponseBody.ts index 299960fb..af32812d 100644 --- a/src/api/types/DeviceRecoveryGetAssetRecoveryStateBadGatewayErrorResponseBody.ts +++ b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsBadGatewayErrorResponseBody.ts @@ -3,7 +3,7 @@ /** * Bad Gateway */ -export interface DeviceRecoveryGetAssetRecoveryStateBadGatewayErrorResponseBody { +export interface DeviceRecoveryListDeviceRecoveryMissingAssetsBadGatewayErrorResponseBody { /** Message of error */ message: string; /** The request ID; used when reaching out to support for issues with requests. */ diff --git a/src/api/types/DeviceRecoveryGetAssetRecoveryStateGatewayTimeoutErrorResponseBody.ts b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsGatewayTimeoutErrorResponseBody.ts similarity index 72% rename from src/api/types/DeviceRecoveryGetAssetRecoveryStateGatewayTimeoutErrorResponseBody.ts rename to src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsGatewayTimeoutErrorResponseBody.ts index 8b1e5b6a..5bcd5e01 100644 --- a/src/api/types/DeviceRecoveryGetAssetRecoveryStateGatewayTimeoutErrorResponseBody.ts +++ b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsGatewayTimeoutErrorResponseBody.ts @@ -3,7 +3,7 @@ /** * Gateway timeout */ -export interface DeviceRecoveryGetAssetRecoveryStateGatewayTimeoutErrorResponseBody { +export interface DeviceRecoveryListDeviceRecoveryMissingAssetsGatewayTimeoutErrorResponseBody { /** Message of error */ message: string; /** The request ID; used when reaching out to support for issues with requests. */ diff --git a/src/api/types/DeviceRecoveryGetAssetRecoveryStateInternalServerErrorResponseBody.ts b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsInternalServerErrorResponseBody.ts similarity index 73% rename from src/api/types/DeviceRecoveryGetAssetRecoveryStateInternalServerErrorResponseBody.ts rename to src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsInternalServerErrorResponseBody.ts index 0f6858bf..578b372a 100644 --- a/src/api/types/DeviceRecoveryGetAssetRecoveryStateInternalServerErrorResponseBody.ts +++ b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsInternalServerErrorResponseBody.ts @@ -3,7 +3,7 @@ /** * An internal server error occurred */ -export interface DeviceRecoveryGetAssetRecoveryStateInternalServerErrorResponseBody { +export interface DeviceRecoveryListDeviceRecoveryMissingAssetsInternalServerErrorResponseBody { /** Message of error */ message: string; /** The request ID; used when reaching out to support for issues with requests. */ diff --git a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsMethodNotAllowedErrorResponseBody.ts b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsMethodNotAllowedErrorResponseBody.ts similarity index 72% rename from src/api/types/DeviceRecoveryListDeviceRecoveryAssetsMethodNotAllowedErrorResponseBody.ts rename to src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsMethodNotAllowedErrorResponseBody.ts index 34a4611d..6975e39a 100644 --- a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsMethodNotAllowedErrorResponseBody.ts +++ b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsMethodNotAllowedErrorResponseBody.ts @@ -3,7 +3,7 @@ /** * Method not allowed */ -export interface DeviceRecoveryListDeviceRecoveryAssetsMethodNotAllowedErrorResponseBody { +export interface DeviceRecoveryListDeviceRecoveryMissingAssetsMethodNotAllowedErrorResponseBody { /** Message of error */ message: string; /** The request ID; used when reaching out to support for issues with requests. */ diff --git a/src/api/types/DeviceRecoveryGetAssetRecoveryStateNotFoundErrorResponseBody.ts b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsNotFoundErrorResponseBody.ts similarity index 74% rename from src/api/types/DeviceRecoveryGetAssetRecoveryStateNotFoundErrorResponseBody.ts rename to src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsNotFoundErrorResponseBody.ts index c7917a70..815ed6ee 100644 --- a/src/api/types/DeviceRecoveryGetAssetRecoveryStateNotFoundErrorResponseBody.ts +++ b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsNotFoundErrorResponseBody.ts @@ -3,7 +3,7 @@ /** * Resource not found */ -export interface DeviceRecoveryGetAssetRecoveryStateNotFoundErrorResponseBody { +export interface DeviceRecoveryListDeviceRecoveryMissingAssetsNotFoundErrorResponseBody { /** Message of error */ message: string; /** The request ID; used when reaching out to support for issues with requests. */ diff --git a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsNotImplementedErrorResponseBody.ts b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsNotImplementedErrorResponseBody.ts similarity index 74% rename from src/api/types/DeviceRecoveryListDeviceRecoveryAssetsNotImplementedErrorResponseBody.ts rename to src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsNotImplementedErrorResponseBody.ts index f50a1fb4..a8fa40fb 100644 --- a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsNotImplementedErrorResponseBody.ts +++ b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsNotImplementedErrorResponseBody.ts @@ -3,7 +3,7 @@ /** * Requested endpoint is not yet implemented */ -export interface DeviceRecoveryListDeviceRecoveryAssetsNotImplementedErrorResponseBody { +export interface DeviceRecoveryListDeviceRecoveryMissingAssetsNotImplementedErrorResponseBody { /** Message of error */ message: string; /** The request ID; used when reaching out to support for issues with requests. */ diff --git a/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsResponseBody.ts b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsResponseBody.ts new file mode 100644 index 00000000..7d35fe5e --- /dev/null +++ b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsResponseBody.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Samsara from "../index.js"; + +export interface DeviceRecoveryListDeviceRecoveryMissingAssetsResponseBody { + /** List of assets currently marked as missing. */ + data: Samsara.MissingStateResponseBody[]; + pagination: Samsara.GoaPaginationResponseResponseBody; +} diff --git a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsServiceUnavailableErrorResponseBody.ts b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsServiceUnavailableErrorResponseBody.ts similarity index 72% rename from src/api/types/DeviceRecoveryListDeviceRecoveryAssetsServiceUnavailableErrorResponseBody.ts rename to src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsServiceUnavailableErrorResponseBody.ts index ae63eb1a..09bf2a74 100644 --- a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsServiceUnavailableErrorResponseBody.ts +++ b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsServiceUnavailableErrorResponseBody.ts @@ -3,7 +3,7 @@ /** * Service unavailable */ -export interface DeviceRecoveryListDeviceRecoveryAssetsServiceUnavailableErrorResponseBody { +export interface DeviceRecoveryListDeviceRecoveryMissingAssetsServiceUnavailableErrorResponseBody { /** Message of error */ message: string; /** The request ID; used when reaching out to support for issues with requests. */ diff --git a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsTooManyRequestsErrorResponseBody.ts b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsTooManyRequestsErrorResponseBody.ts similarity index 72% rename from src/api/types/DeviceRecoveryListDeviceRecoveryAssetsTooManyRequestsErrorResponseBody.ts rename to src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsTooManyRequestsErrorResponseBody.ts index 32c2c217..6ddf37e9 100644 --- a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsTooManyRequestsErrorResponseBody.ts +++ b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsTooManyRequestsErrorResponseBody.ts @@ -3,7 +3,7 @@ /** * Too many requests */ -export interface DeviceRecoveryListDeviceRecoveryAssetsTooManyRequestsErrorResponseBody { +export interface DeviceRecoveryListDeviceRecoveryMissingAssetsTooManyRequestsErrorResponseBody { /** Message of error */ message: string; /** The request ID; used when reaching out to support for issues with requests. */ diff --git a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsUnauthorizedErrorResponseBody.ts b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsUnauthorizedErrorResponseBody.ts similarity index 72% rename from src/api/types/DeviceRecoveryListDeviceRecoveryAssetsUnauthorizedErrorResponseBody.ts rename to src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsUnauthorizedErrorResponseBody.ts index 6594c48c..7c9a1b88 100644 --- a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsUnauthorizedErrorResponseBody.ts +++ b/src/api/types/DeviceRecoveryListDeviceRecoveryMissingAssetsUnauthorizedErrorResponseBody.ts @@ -3,7 +3,7 @@ /** * Unauthorized */ -export interface DeviceRecoveryListDeviceRecoveryAssetsUnauthorizedErrorResponseBody { +export interface DeviceRecoveryListDeviceRecoveryMissingAssetsUnauthorizedErrorResponseBody { /** Message of error */ message: string; /** The request ID; used when reaching out to support for issues with requests. */ diff --git a/src/api/types/DeviceRecoveryMarkAssetMissingResponseBody.ts b/src/api/types/DeviceRecoveryMarkAssetMissingResponseBody.ts index 33fd49cb..abf11270 100644 --- a/src/api/types/DeviceRecoveryMarkAssetMissingResponseBody.ts +++ b/src/api/types/DeviceRecoveryMarkAssetMissingResponseBody.ts @@ -3,5 +3,5 @@ import type * as Samsara from "../index.js"; export interface DeviceRecoveryMarkAssetMissingResponseBody { - data: Samsara.DeviceRecoveryStateResponseBody; + data: Samsara.MissingStateResponseBody; } diff --git a/src/api/types/DeviceRecoveryRecoverAssetResponseBody.ts b/src/api/types/DeviceRecoveryRecoverAssetResponseBody.ts index b21539d8..a6222019 100644 --- a/src/api/types/DeviceRecoveryRecoverAssetResponseBody.ts +++ b/src/api/types/DeviceRecoveryRecoverAssetResponseBody.ts @@ -3,5 +3,5 @@ import type * as Samsara from "../index.js"; export interface DeviceRecoveryRecoverAssetResponseBody { - data: Samsara.DeviceRecoveryStateResponseBody; + data: Samsara.RecoveryStateResponseBody; } diff --git a/src/api/types/DeviceRecoveryStateResponseBody.ts b/src/api/types/DeviceRecoveryStateResponseBody.ts deleted file mode 100644 index f4540f95..00000000 --- a/src/api/types/DeviceRecoveryStateResponseBody.ts +++ /dev/null @@ -1,44 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -import type * as Samsara from "../index.js"; - -/** - * The full recovery state for an asset, including notification recipients and recovery photos. - */ -export interface DeviceRecoveryStateResponseBody { - /** Additional details provided during recovery. */ - additional_details?: string | undefined; - /** The unique Samsara ID of the asset. */ - id: string; - /** The reason the asset was originally marked as missing. */ - missing_reason?: string | undefined; - /** The human-readable name of the asset. */ - name: string; - /** A note associated with the recovery state. */ - note?: string | undefined; - /** Users subscribed to location update notifications for this asset. */ - notification_recipients?: Samsara.NotificationRecipientResponseBody[] | undefined; - /** Photos associated with the recovery event. URLs are temporary and expire at url_expires_at_ms. */ - recovery_photos?: Samsara.RecoveryPhotoResponseBody[] | undefined; - /** Whether the asset was physically recovered. */ - recovery_status?: string | undefined; - /** The current recovery status of the asset. Valid values: `UNKNOWN`, `MISSING`, `LOCATED`, `RECOVERED` */ - status: DeviceRecoveryStateResponseBody.Status; - /** Timestamp when the recovery state was last updated, in milliseconds since epoch. */ - updated_at_ms: number; - /** The ID of the user who last updated the recovery state. */ - updated_by_user_id?: number | undefined; - /** The unique UUID of this recovery state record. */ - uuid: string; -} - -export namespace DeviceRecoveryStateResponseBody { - /** The current recovery status of the asset. Valid values: `UNKNOWN`, `MISSING`, `LOCATED`, `RECOVERED` */ - export const Status = { - Unknown: "UNKNOWN", - Missing: "MISSING", - Located: "LOCATED", - Recovered: "RECOVERED", - } as const; - export type Status = (typeof Status)[keyof typeof Status]; -} diff --git a/src/api/types/DriverVehicleAssignmentV2ObjectResponseBody.ts b/src/api/types/DriverVehicleAssignmentV2ObjectResponseBody.ts index cc60a57b..7a6a72f3 100644 --- a/src/api/types/DriverVehicleAssignmentV2ObjectResponseBody.ts +++ b/src/api/types/DriverVehicleAssignmentV2ObjectResponseBody.ts @@ -8,7 +8,7 @@ import type * as Samsara from "../index.js"; export interface DriverVehicleAssignmentV2ObjectResponseBody { /** An assigned at time in RFC 3339 format. Millisecond precision and timezones are supported. (Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00). */ assignedAtTime?: string | undefined; - /** Name of the assigning source for the driver assignment record. Valid values: `invalid`, `unknown`, `HOS`, `idCard`, `static`, `faceId`, `tachograph`, `safetyManual`, `RFID`, `trailer`, `external`, `qrCode`, `driverApp` */ + /** Name of the assigning source for the driver assignment record. Valid values: `invalid`, `unknown`, `HOS`, `idCard`, `static`, `faceId`, `tachograph`, `safetyManual`, `RFID`, `trailer`, `external`, `qrCode`, `driverApp`, `voiceSignIn` */ assignmentType?: DriverVehicleAssignmentV2ObjectResponseBody.AssignmentType | undefined; driver: Samsara.GoaDriverTinyResponseResponseBody; /** An end time in RFC 3339 format. Omitted if not applicable. Millisecond precision and timezones are supported. (Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00). */ @@ -22,7 +22,7 @@ export interface DriverVehicleAssignmentV2ObjectResponseBody { } export namespace DriverVehicleAssignmentV2ObjectResponseBody { - /** Name of the assigning source for the driver assignment record. Valid values: `invalid`, `unknown`, `HOS`, `idCard`, `static`, `faceId`, `tachograph`, `safetyManual`, `RFID`, `trailer`, `external`, `qrCode`, `driverApp` */ + /** Name of the assigning source for the driver assignment record. Valid values: `invalid`, `unknown`, `HOS`, `idCard`, `static`, `faceId`, `tachograph`, `safetyManual`, `RFID`, `trailer`, `external`, `qrCode`, `driverApp`, `voiceSignIn` */ export const AssignmentType = { Invalid: "invalid", Unknown: "unknown", @@ -37,6 +37,7 @@ export namespace DriverVehicleAssignmentV2ObjectResponseBody { External: "external", QrCode: "qrCode", DriverApp: "driverApp", + VoiceSignIn: "voiceSignIn", } as const; export type AssignmentType = (typeof AssignmentType)[keyof typeof AssignmentType]; } diff --git a/src/api/types/MissingStateResponseBody.ts b/src/api/types/MissingStateResponseBody.ts new file mode 100644 index 00000000..bd0bc63c --- /dev/null +++ b/src/api/types/MissingStateResponseBody.ts @@ -0,0 +1,23 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Samsara from "../index.js"; + +/** + * An asset currently marked as missing, including notification recipients. + */ +export interface MissingStateResponseBody { + /** The unique Samsara ID of the asset. */ + id: string; + /** The human-readable name of the asset. */ + name: string; + /** A note associated with the missing asset. */ + note?: string | undefined; + /** Users subscribed to location update notifications for this asset. */ + notification_recipients?: Samsara.NotificationRecipientResponseBody[] | undefined; + /** Timestamp when the asset was marked as missing, in milliseconds since epoch. */ + updated_at_ms: number; + /** The ID of the user who marked the asset as missing. */ + updated_by_user_id?: number | undefined; + /** The unique UUID of this recovery state record. */ + uuid: string; +} diff --git a/src/api/types/RecoveryStateResponseBody.ts b/src/api/types/RecoveryStateResponseBody.ts new file mode 100644 index 00000000..bdc9d8ca --- /dev/null +++ b/src/api/types/RecoveryStateResponseBody.ts @@ -0,0 +1,25 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Samsara from "../index.js"; + +/** + * A recovered asset with its recovery details, including recovery photos. + */ +export interface RecoveryStateResponseBody { + /** The unique Samsara ID of the asset. */ + id: string; + /** The human-readable name of the asset. */ + name: string; + /** A note associated with the recovery. */ + note?: string | undefined; + /** Users subscribed to location update notifications for this asset. */ + notification_recipients?: Samsara.NotificationRecipientResponseBody[] | undefined; + /** Photos associated with the recovery event. URLs are temporary and expire at url_expires_at_ms. */ + recovery_photos?: Samsara.RecoveryPhotoResponseBody[] | undefined; + /** Timestamp when the recovery state was last updated, in milliseconds since epoch. */ + updated_at_ms: number; + /** The ID of the user who last updated the recovery state. */ + updated_by_user_id?: number | undefined; + /** The unique UUID of this recovery state record. */ + uuid: string; +} diff --git a/src/api/types/RidershipRouteSetupObjectResponseBody.ts b/src/api/types/RidershipRouteSetupObjectResponseBody.ts index 72ef89e4..436bbd1e 100644 --- a/src/api/types/RidershipRouteSetupObjectResponseBody.ts +++ b/src/api/types/RidershipRouteSetupObjectResponseBody.ts @@ -8,8 +8,12 @@ import type * as Samsara from "../index.js"; export interface RidershipRouteSetupObjectResponseBody { /** The Samsara UUID of the ridership account. */ accountId: string; + /** The time the route setup was created in RFC 3339 format. */ + createdAtTime: string; /** List of passenger assignments. */ passengers: Samsara.RidershipRouteSetupPassengerObjectResponseBody[]; /** The route ID. */ routeId: string; + /** The time the route setup was last updated in RFC 3339 format. */ + updatedAtTime: string; } diff --git a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsBadGatewayErrorResponseBody.ts b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsBadGatewayErrorResponseBody.ts similarity index 73% rename from src/api/types/DeviceRecoveryListDeviceRecoveryAssetsBadGatewayErrorResponseBody.ts rename to src/api/types/RidershipRouteSetupsListRidershipRouteSetupsBadGatewayErrorResponseBody.ts index 9071d514..c24cfa71 100644 --- a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsBadGatewayErrorResponseBody.ts +++ b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsBadGatewayErrorResponseBody.ts @@ -3,7 +3,7 @@ /** * Bad Gateway */ -export interface DeviceRecoveryListDeviceRecoveryAssetsBadGatewayErrorResponseBody { +export interface RidershipRouteSetupsListRidershipRouteSetupsBadGatewayErrorResponseBody { /** Message of error */ message: string; /** The request ID; used when reaching out to support for issues with requests. */ diff --git a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsGatewayTimeoutErrorResponseBody.ts b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsGatewayTimeoutErrorResponseBody.ts similarity index 72% rename from src/api/types/DeviceRecoveryListDeviceRecoveryAssetsGatewayTimeoutErrorResponseBody.ts rename to src/api/types/RidershipRouteSetupsListRidershipRouteSetupsGatewayTimeoutErrorResponseBody.ts index f91115a0..b42791b6 100644 --- a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsGatewayTimeoutErrorResponseBody.ts +++ b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsGatewayTimeoutErrorResponseBody.ts @@ -3,7 +3,7 @@ /** * Gateway timeout */ -export interface DeviceRecoveryListDeviceRecoveryAssetsGatewayTimeoutErrorResponseBody { +export interface RidershipRouteSetupsListRidershipRouteSetupsGatewayTimeoutErrorResponseBody { /** Message of error */ message: string; /** The request ID; used when reaching out to support for issues with requests. */ diff --git a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsInternalServerErrorResponseBody.ts b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsInternalServerErrorResponseBody.ts similarity index 74% rename from src/api/types/DeviceRecoveryListDeviceRecoveryAssetsInternalServerErrorResponseBody.ts rename to src/api/types/RidershipRouteSetupsListRidershipRouteSetupsInternalServerErrorResponseBody.ts index 620afa6b..4b145f65 100644 --- a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsInternalServerErrorResponseBody.ts +++ b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsInternalServerErrorResponseBody.ts @@ -3,7 +3,7 @@ /** * An internal server error occurred */ -export interface DeviceRecoveryListDeviceRecoveryAssetsInternalServerErrorResponseBody { +export interface RidershipRouteSetupsListRidershipRouteSetupsInternalServerErrorResponseBody { /** Message of error */ message: string; /** The request ID; used when reaching out to support for issues with requests. */ diff --git a/src/api/types/DeviceRecoveryGetAssetRecoveryStateMethodNotAllowedErrorResponseBody.ts b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsMethodNotAllowedErrorResponseBody.ts similarity index 72% rename from src/api/types/DeviceRecoveryGetAssetRecoveryStateMethodNotAllowedErrorResponseBody.ts rename to src/api/types/RidershipRouteSetupsListRidershipRouteSetupsMethodNotAllowedErrorResponseBody.ts index 568e7708..82265112 100644 --- a/src/api/types/DeviceRecoveryGetAssetRecoveryStateMethodNotAllowedErrorResponseBody.ts +++ b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsMethodNotAllowedErrorResponseBody.ts @@ -3,7 +3,7 @@ /** * Method not allowed */ -export interface DeviceRecoveryGetAssetRecoveryStateMethodNotAllowedErrorResponseBody { +export interface RidershipRouteSetupsListRidershipRouteSetupsMethodNotAllowedErrorResponseBody { /** Message of error */ message: string; /** The request ID; used when reaching out to support for issues with requests. */ diff --git a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsNotFoundErrorResponseBody.ts b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsNotFoundErrorResponseBody.ts similarity index 74% rename from src/api/types/DeviceRecoveryListDeviceRecoveryAssetsNotFoundErrorResponseBody.ts rename to src/api/types/RidershipRouteSetupsListRidershipRouteSetupsNotFoundErrorResponseBody.ts index 821182c6..7f03bb7f 100644 --- a/src/api/types/DeviceRecoveryListDeviceRecoveryAssetsNotFoundErrorResponseBody.ts +++ b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsNotFoundErrorResponseBody.ts @@ -3,7 +3,7 @@ /** * Resource not found */ -export interface DeviceRecoveryListDeviceRecoveryAssetsNotFoundErrorResponseBody { +export interface RidershipRouteSetupsListRidershipRouteSetupsNotFoundErrorResponseBody { /** Message of error */ message: string; /** The request ID; used when reaching out to support for issues with requests. */ diff --git a/src/api/types/DeviceRecoveryGetAssetRecoveryStateNotImplementedErrorResponseBody.ts b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsNotImplementedErrorResponseBody.ts similarity index 74% rename from src/api/types/DeviceRecoveryGetAssetRecoveryStateNotImplementedErrorResponseBody.ts rename to src/api/types/RidershipRouteSetupsListRidershipRouteSetupsNotImplementedErrorResponseBody.ts index 6d3bc679..62b7fd35 100644 --- a/src/api/types/DeviceRecoveryGetAssetRecoveryStateNotImplementedErrorResponseBody.ts +++ b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsNotImplementedErrorResponseBody.ts @@ -3,7 +3,7 @@ /** * Requested endpoint is not yet implemented */ -export interface DeviceRecoveryGetAssetRecoveryStateNotImplementedErrorResponseBody { +export interface RidershipRouteSetupsListRidershipRouteSetupsNotImplementedErrorResponseBody { /** Message of error */ message: string; /** The request ID; used when reaching out to support for issues with requests. */ diff --git a/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsResponseBody.ts b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsResponseBody.ts new file mode 100644 index 00000000..c2ff8c98 --- /dev/null +++ b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsResponseBody.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Samsara from "../index.js"; + +export interface RidershipRouteSetupsListRidershipRouteSetupsResponseBody { + /** List of ridership route setups */ + data: Samsara.RidershipRouteSetupObjectResponseBody[]; + pagination: Samsara.GoaPaginationResponseResponseBody; +} diff --git a/src/api/types/DeviceRecoveryGetAssetRecoveryStateServiceUnavailableErrorResponseBody.ts b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsServiceUnavailableErrorResponseBody.ts similarity index 72% rename from src/api/types/DeviceRecoveryGetAssetRecoveryStateServiceUnavailableErrorResponseBody.ts rename to src/api/types/RidershipRouteSetupsListRidershipRouteSetupsServiceUnavailableErrorResponseBody.ts index d535e77e..5b434fb5 100644 --- a/src/api/types/DeviceRecoveryGetAssetRecoveryStateServiceUnavailableErrorResponseBody.ts +++ b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsServiceUnavailableErrorResponseBody.ts @@ -3,7 +3,7 @@ /** * Service unavailable */ -export interface DeviceRecoveryGetAssetRecoveryStateServiceUnavailableErrorResponseBody { +export interface RidershipRouteSetupsListRidershipRouteSetupsServiceUnavailableErrorResponseBody { /** Message of error */ message: string; /** The request ID; used when reaching out to support for issues with requests. */ diff --git a/src/api/types/DeviceRecoveryGetAssetRecoveryStateTooManyRequestsErrorResponseBody.ts b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsTooManyRequestsErrorResponseBody.ts similarity index 72% rename from src/api/types/DeviceRecoveryGetAssetRecoveryStateTooManyRequestsErrorResponseBody.ts rename to src/api/types/RidershipRouteSetupsListRidershipRouteSetupsTooManyRequestsErrorResponseBody.ts index 828e6d45..0bdd9cf7 100644 --- a/src/api/types/DeviceRecoveryGetAssetRecoveryStateTooManyRequestsErrorResponseBody.ts +++ b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsTooManyRequestsErrorResponseBody.ts @@ -3,7 +3,7 @@ /** * Too many requests */ -export interface DeviceRecoveryGetAssetRecoveryStateTooManyRequestsErrorResponseBody { +export interface RidershipRouteSetupsListRidershipRouteSetupsTooManyRequestsErrorResponseBody { /** Message of error */ message: string; /** The request ID; used when reaching out to support for issues with requests. */ diff --git a/src/api/types/DeviceRecoveryGetAssetRecoveryStateUnauthorizedErrorResponseBody.ts b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsUnauthorizedErrorResponseBody.ts similarity index 72% rename from src/api/types/DeviceRecoveryGetAssetRecoveryStateUnauthorizedErrorResponseBody.ts rename to src/api/types/RidershipRouteSetupsListRidershipRouteSetupsUnauthorizedErrorResponseBody.ts index bec0dad1..373f901e 100644 --- a/src/api/types/DeviceRecoveryGetAssetRecoveryStateUnauthorizedErrorResponseBody.ts +++ b/src/api/types/RidershipRouteSetupsListRidershipRouteSetupsUnauthorizedErrorResponseBody.ts @@ -3,7 +3,7 @@ /** * Unauthorized */ -export interface DeviceRecoveryGetAssetRecoveryStateUnauthorizedErrorResponseBody { +export interface RidershipRouteSetupsListRidershipRouteSetupsUnauthorizedErrorResponseBody { /** Message of error */ message: string; /** The request ID; used when reaching out to support for issues with requests. */ diff --git a/src/api/types/index.ts b/src/api/types/index.ts index e68fd3bd..05279b4b 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -353,26 +353,16 @@ export * from "./DeviceMovementDataResponseBody.js"; export * from "./DeviceMovementStoppedDataResponseBody.js"; export * from "./DeviceMovementTriggerDetailsObjectRequestBody.js"; export * from "./DeviceMovementTriggerDetailsObjectResponseBody.js"; -export * from "./DeviceRecoveryGetAssetRecoveryStateBadGatewayErrorResponseBody.js"; -export * from "./DeviceRecoveryGetAssetRecoveryStateGatewayTimeoutErrorResponseBody.js"; -export * from "./DeviceRecoveryGetAssetRecoveryStateInternalServerErrorResponseBody.js"; -export * from "./DeviceRecoveryGetAssetRecoveryStateMethodNotAllowedErrorResponseBody.js"; -export * from "./DeviceRecoveryGetAssetRecoveryStateNotFoundErrorResponseBody.js"; -export * from "./DeviceRecoveryGetAssetRecoveryStateNotImplementedErrorResponseBody.js"; -export * from "./DeviceRecoveryGetAssetRecoveryStateResponseBody.js"; -export * from "./DeviceRecoveryGetAssetRecoveryStateServiceUnavailableErrorResponseBody.js"; -export * from "./DeviceRecoveryGetAssetRecoveryStateTooManyRequestsErrorResponseBody.js"; -export * from "./DeviceRecoveryGetAssetRecoveryStateUnauthorizedErrorResponseBody.js"; -export * from "./DeviceRecoveryListDeviceRecoveryAssetsBadGatewayErrorResponseBody.js"; -export * from "./DeviceRecoveryListDeviceRecoveryAssetsGatewayTimeoutErrorResponseBody.js"; -export * from "./DeviceRecoveryListDeviceRecoveryAssetsInternalServerErrorResponseBody.js"; -export * from "./DeviceRecoveryListDeviceRecoveryAssetsMethodNotAllowedErrorResponseBody.js"; -export * from "./DeviceRecoveryListDeviceRecoveryAssetsNotFoundErrorResponseBody.js"; -export * from "./DeviceRecoveryListDeviceRecoveryAssetsNotImplementedErrorResponseBody.js"; -export * from "./DeviceRecoveryListDeviceRecoveryAssetsResponseBody.js"; -export * from "./DeviceRecoveryListDeviceRecoveryAssetsServiceUnavailableErrorResponseBody.js"; -export * from "./DeviceRecoveryListDeviceRecoveryAssetsTooManyRequestsErrorResponseBody.js"; -export * from "./DeviceRecoveryListDeviceRecoveryAssetsUnauthorizedErrorResponseBody.js"; +export * from "./DeviceRecoveryListDeviceRecoveryMissingAssetsBadGatewayErrorResponseBody.js"; +export * from "./DeviceRecoveryListDeviceRecoveryMissingAssetsGatewayTimeoutErrorResponseBody.js"; +export * from "./DeviceRecoveryListDeviceRecoveryMissingAssetsInternalServerErrorResponseBody.js"; +export * from "./DeviceRecoveryListDeviceRecoveryMissingAssetsMethodNotAllowedErrorResponseBody.js"; +export * from "./DeviceRecoveryListDeviceRecoveryMissingAssetsNotFoundErrorResponseBody.js"; +export * from "./DeviceRecoveryListDeviceRecoveryMissingAssetsNotImplementedErrorResponseBody.js"; +export * from "./DeviceRecoveryListDeviceRecoveryMissingAssetsResponseBody.js"; +export * from "./DeviceRecoveryListDeviceRecoveryMissingAssetsServiceUnavailableErrorResponseBody.js"; +export * from "./DeviceRecoveryListDeviceRecoveryMissingAssetsTooManyRequestsErrorResponseBody.js"; +export * from "./DeviceRecoveryListDeviceRecoveryMissingAssetsUnauthorizedErrorResponseBody.js"; export * from "./DeviceRecoveryMarkAssetMissingBadGatewayErrorResponseBody.js"; export * from "./DeviceRecoveryMarkAssetMissingGatewayTimeoutErrorResponseBody.js"; export * from "./DeviceRecoveryMarkAssetMissingInternalServerErrorResponseBody.js"; @@ -393,7 +383,6 @@ export * from "./DeviceRecoveryRecoverAssetResponseBody.js"; export * from "./DeviceRecoveryRecoverAssetServiceUnavailableErrorResponseBody.js"; export * from "./DeviceRecoveryRecoverAssetTooManyRequestsErrorResponseBody.js"; export * from "./DeviceRecoveryRecoverAssetUnauthorizedErrorResponseBody.js"; -export * from "./DeviceRecoveryStateResponseBody.js"; export * from "./DeviceResponseResponseBody.js"; export * from "./DevicesGetDevicesBadGatewayErrorResponseBody.js"; export * from "./DevicesGetDevicesGatewayTimeoutErrorResponseBody.js"; @@ -1576,6 +1565,7 @@ export * from "./MinimalRouteAuditLogsResponseBody.js"; export * from "./MinimalRouteStopAuditLogsResponseBody.js"; export * from "./MinimalRouteStopResponseBody.js"; export * from "./MissingDvirPastDueResponseBody.js"; +export * from "./MissingStateResponseBody.js"; export * from "./MobileUsageDetectionAlertSettingsObjectResponseBody.js"; export * from "./MotionDetectedResponseBody.js"; export * from "./MultipleChoiceFieldTypeMetaDataObjectResponseBody.js"; @@ -1801,6 +1791,7 @@ export * from "./ReadingTriggerEnumValueObjectResponseBody.js"; export * from "./RecipientObjectRequestBody.js"; export * from "./RecipientObjectResponseBody.js"; export * from "./RecoveryPhotoResponseBody.js"; +export * from "./RecoveryStateResponseBody.js"; export * from "./ReeferTemperatureResponseBody.js"; export * from "./ReportColumnsObjectResponseBody.js"; export * from "./ReportConfigObjectResponseBody.js"; @@ -1996,6 +1987,16 @@ export * from "./RidershipRouteSetupsGetRidershipRouteSetupResponseBody.js"; export * from "./RidershipRouteSetupsGetRidershipRouteSetupServiceUnavailableErrorResponseBody.js"; export * from "./RidershipRouteSetupsGetRidershipRouteSetupTooManyRequestsErrorResponseBody.js"; export * from "./RidershipRouteSetupsGetRidershipRouteSetupUnauthorizedErrorResponseBody.js"; +export * from "./RidershipRouteSetupsListRidershipRouteSetupsBadGatewayErrorResponseBody.js"; +export * from "./RidershipRouteSetupsListRidershipRouteSetupsGatewayTimeoutErrorResponseBody.js"; +export * from "./RidershipRouteSetupsListRidershipRouteSetupsInternalServerErrorResponseBody.js"; +export * from "./RidershipRouteSetupsListRidershipRouteSetupsMethodNotAllowedErrorResponseBody.js"; +export * from "./RidershipRouteSetupsListRidershipRouteSetupsNotFoundErrorResponseBody.js"; +export * from "./RidershipRouteSetupsListRidershipRouteSetupsNotImplementedErrorResponseBody.js"; +export * from "./RidershipRouteSetupsListRidershipRouteSetupsResponseBody.js"; +export * from "./RidershipRouteSetupsListRidershipRouteSetupsServiceUnavailableErrorResponseBody.js"; +export * from "./RidershipRouteSetupsListRidershipRouteSetupsTooManyRequestsErrorResponseBody.js"; +export * from "./RidershipRouteSetupsListRidershipRouteSetupsUnauthorizedErrorResponseBody.js"; export * from "./RidershipRouteSetupsUpdateRidershipRouteSetupBadGatewayErrorResponseBody.js"; export * from "./RidershipRouteSetupsUpdateRidershipRouteSetupGatewayTimeoutErrorResponseBody.js"; export * from "./RidershipRouteSetupsUpdateRidershipRouteSetupInternalServerErrorResponseBody.js"; diff --git a/src/version.ts b/src/version.ts index df2d6978..d05d49d8 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const SDK_VERSION = "5.11.0"; +export const SDK_VERSION = "6.0.1"; diff --git a/tests/wire/betaApIs.test.ts b/tests/wire/betaApIs.test.ts index 570d0165..99c39bf5 100644 --- a/tests/wire/betaApIs.test.ts +++ b/tests/wire/betaApIs.test.ts @@ -6885,11 +6885,7 @@ describe("BetaApIsClient", () => { planId: "650e8400-e29b-41d4-a716-446655440023", priority: 1, quantities: [{ capacityId: "850e8400-e29b-41d4-a716-446655440003", quantity: 25.5 }], - skillsRequired: [ - "650e8400-e29b-41d4-a716-446655440001", - "650e8400-e29b-41d4-a716-446655440001", - "650e8400-e29b-41d4-a716-446655440001", - ], + skillsRequired: ["650e8400-e29b-41d4-a716-446655440001", "650e8400-e29b-41d4-a716-446655440001"], updatedAt: "2024-04-10T11:30:00Z", }, ], @@ -6958,11 +6954,7 @@ describe("BetaApIsClient", () => { quantity: 25.5, }, ], - skillsRequired: [ - "650e8400-e29b-41d4-a716-446655440001", - "650e8400-e29b-41d4-a716-446655440001", - "650e8400-e29b-41d4-a716-446655440001", - ], + skillsRequired: ["650e8400-e29b-41d4-a716-446655440001", "650e8400-e29b-41d4-a716-446655440001"], updatedAt: "2024-04-10T11:30:00Z", }, ], @@ -16171,6 +16163,292 @@ describe("BetaApIsClient", () => { }).rejects.toThrow(Samsara.GatewayTimeoutError); }); + test("listRidershipRouteSetups (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SamsaraClient({ + maxRetries: 0, + token: "test", + version: "2025-06-11", + environment: server.baseUrl, + }); + + const rawResponseBody = { + data: [ + { + accountId: "e4b2c3a5-7d6f-4e8b-9a0c-1b2d3e4f5a6b", + createdAtTime: "2024-11-15T10:00:00Z", + passengers: [ + { + dropOffStopId: "790", + passengerId: "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d", + pickUpStopId: "789", + }, + ], + routeId: "123456", + updatedAtTime: "2024-11-15T10:30:00Z", + }, + ], + pagination: { endCursor: "MjkY", hasNextPage: true }, + }; + server + .mockEndpoint() + .get("/ridership/route-setups") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.betaApIs.listRidershipRouteSetups({ + accountId: "accountId", + }); + expect(response).toEqual({ + data: [ + { + accountId: "e4b2c3a5-7d6f-4e8b-9a0c-1b2d3e4f5a6b", + createdAtTime: "2024-11-15T10:00:00Z", + passengers: [ + { + dropOffStopId: "790", + passengerId: "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d", + pickUpStopId: "789", + }, + ], + routeId: "123456", + updatedAtTime: "2024-11-15T10:30:00Z", + }, + ], + pagination: { + endCursor: "MjkY", + hasNextPage: true, + }, + }); + }); + + test("listRidershipRouteSetups (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SamsaraClient({ + maxRetries: 0, + token: "test", + version: "2025-06-11", + environment: server.baseUrl, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/ridership/route-setups") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.betaApIs.listRidershipRouteSetups({ + accountId: "accountId", + }); + }).rejects.toThrow(Samsara.UnauthorizedError); + }); + + test("listRidershipRouteSetups (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SamsaraClient({ + maxRetries: 0, + token: "test", + version: "2025-06-11", + environment: server.baseUrl, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/ridership/route-setups") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.betaApIs.listRidershipRouteSetups({ + accountId: "accountId", + }); + }).rejects.toThrow(Samsara.NotFoundError); + }); + + test("listRidershipRouteSetups (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SamsaraClient({ + maxRetries: 0, + token: "test", + version: "2025-06-11", + environment: server.baseUrl, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/ridership/route-setups") + .respondWith() + .statusCode(405) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.betaApIs.listRidershipRouteSetups({ + accountId: "accountId", + }); + }).rejects.toThrow(Samsara.MethodNotAllowedError); + }); + + test("listRidershipRouteSetups (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SamsaraClient({ + maxRetries: 0, + token: "test", + version: "2025-06-11", + environment: server.baseUrl, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/ridership/route-setups") + .respondWith() + .statusCode(429) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.betaApIs.listRidershipRouteSetups({ + accountId: "accountId", + }); + }).rejects.toThrow(Samsara.TooManyRequestsError); + }); + + test("listRidershipRouteSetups (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SamsaraClient({ + maxRetries: 0, + token: "test", + version: "2025-06-11", + environment: server.baseUrl, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/ridership/route-setups") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.betaApIs.listRidershipRouteSetups({ + accountId: "accountId", + }); + }).rejects.toThrow(Samsara.InternalServerError); + }); + + test("listRidershipRouteSetups (7)", async () => { + const server = mockServerPool.createServer(); + const client = new SamsaraClient({ + maxRetries: 0, + token: "test", + version: "2025-06-11", + environment: server.baseUrl, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/ridership/route-setups") + .respondWith() + .statusCode(501) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.betaApIs.listRidershipRouteSetups({ + accountId: "accountId", + }); + }).rejects.toThrow(Samsara.NotImplementedError); + }); + + test("listRidershipRouteSetups (8)", async () => { + const server = mockServerPool.createServer(); + const client = new SamsaraClient({ + maxRetries: 0, + token: "test", + version: "2025-06-11", + environment: server.baseUrl, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/ridership/route-setups") + .respondWith() + .statusCode(502) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.betaApIs.listRidershipRouteSetups({ + accountId: "accountId", + }); + }).rejects.toThrow(Samsara.BadGatewayError); + }); + + test("listRidershipRouteSetups (9)", async () => { + const server = mockServerPool.createServer(); + const client = new SamsaraClient({ + maxRetries: 0, + token: "test", + version: "2025-06-11", + environment: server.baseUrl, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/ridership/route-setups") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.betaApIs.listRidershipRouteSetups({ + accountId: "accountId", + }); + }).rejects.toThrow(Samsara.ServiceUnavailableError); + }); + + test("listRidershipRouteSetups (10)", async () => { + const server = mockServerPool.createServer(); + const client = new SamsaraClient({ + maxRetries: 0, + token: "test", + version: "2025-06-11", + environment: server.baseUrl, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/ridership/route-setups") + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.betaApIs.listRidershipRouteSetups({ + accountId: "accountId", + }); + }).rejects.toThrow(Samsara.GatewayTimeoutError); + }); + test("createRidershipRouteSetup (1)", async () => { const server = mockServerPool.createServer(); const client = new SamsaraClient({ @@ -16187,10 +16465,12 @@ describe("BetaApIsClient", () => { const rawResponseBody = { data: { accountId: "e4b2c3a5-7d6f-4e8b-9a0c-1b2d3e4f5a6b", + createdAtTime: "2024-11-15T10:00:00Z", passengers: [ { dropOffStopId: "790", passengerId: "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d", pickUpStopId: "789" }, ], routeId: "123456", + updatedAtTime: "2024-11-15T10:30:00Z", }, }; server @@ -16214,6 +16494,7 @@ describe("BetaApIsClient", () => { expect(response).toEqual({ data: { accountId: "e4b2c3a5-7d6f-4e8b-9a0c-1b2d3e4f5a6b", + createdAtTime: "2024-11-15T10:00:00Z", passengers: [ { dropOffStopId: "790", @@ -16222,6 +16503,7 @@ describe("BetaApIsClient", () => { }, ], routeId: "123456", + updatedAtTime: "2024-11-15T10:30:00Z", }, }); }); @@ -16592,10 +16874,12 @@ describe("BetaApIsClient", () => { const rawResponseBody = { data: { accountId: "e4b2c3a5-7d6f-4e8b-9a0c-1b2d3e4f5a6b", + createdAtTime: "2024-11-15T10:00:00Z", passengers: [ { dropOffStopId: "790", passengerId: "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d", pickUpStopId: "789" }, ], routeId: "123456", + updatedAtTime: "2024-11-15T10:30:00Z", }, }; server @@ -16619,6 +16903,7 @@ describe("BetaApIsClient", () => { expect(response).toEqual({ data: { accountId: "e4b2c3a5-7d6f-4e8b-9a0c-1b2d3e4f5a6b", + createdAtTime: "2024-11-15T10:00:00Z", passengers: [ { dropOffStopId: "790", @@ -16627,6 +16912,7 @@ describe("BetaApIsClient", () => { }, ], routeId: "123456", + updatedAtTime: "2024-11-15T10:30:00Z", }, }); }); @@ -17227,10 +17513,12 @@ describe("BetaApIsClient", () => { const rawResponseBody = { data: { accountId: "e4b2c3a5-7d6f-4e8b-9a0c-1b2d3e4f5a6b", + createdAtTime: "2024-11-15T10:00:00Z", passengers: [ { dropOffStopId: "790", passengerId: "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d", pickUpStopId: "789" }, ], routeId: "123456", + updatedAtTime: "2024-11-15T10:30:00Z", }, }; server @@ -17247,6 +17535,7 @@ describe("BetaApIsClient", () => { expect(response).toEqual({ data: { accountId: "e4b2c3a5-7d6f-4e8b-9a0c-1b2d3e4f5a6b", + createdAtTime: "2024-11-15T10:00:00Z", passengers: [ { dropOffStopId: "790", @@ -17255,6 +17544,7 @@ describe("BetaApIsClient", () => { }, ], routeId: "123456", + updatedAtTime: "2024-11-15T10:30:00Z", }, }); }); diff --git a/tests/wire/hubs.test.ts b/tests/wire/hubs.test.ts index de10ff57..c14a5f0c 100644 --- a/tests/wire/hubs.test.ts +++ b/tests/wire/hubs.test.ts @@ -265,7 +265,11 @@ describe("HubsClient", () => { plannerNotes: "sample note", serviceTimeSeconds: 1800, serviceWindows: [ - { daysOfWeek: ["monday", "monday", "monday"], endTime: "17:00:00", startTime: "08:00:00" }, + { + daysOfWeek: ["monday", "monday", "monday", "monday"], + endTime: "17:00:00", + startTime: "08:00:00", + }, ], skillsRequired: [{ id: "650e8400-e29b-41d4-a716-446655440001", name: "Heavy Lifting" }], updatedAt: "2024-01-15T10:30:00Z", @@ -318,7 +322,7 @@ describe("HubsClient", () => { serviceTimeSeconds: 1800, serviceWindows: [ { - daysOfWeek: ["monday", "monday", "monday"], + daysOfWeek: ["monday", "monday", "monday", "monday"], endTime: "17:00:00", startTime: "08:00:00", }, @@ -602,7 +606,11 @@ describe("HubsClient", () => { plannerNotes: "sample note", serviceTimeSeconds: 1800, serviceWindows: [ - { daysOfWeek: ["monday", "monday", "monday"], endTime: "17:00:00", startTime: "08:00:00" }, + { + daysOfWeek: ["monday", "monday", "monday", "monday"], + endTime: "17:00:00", + startTime: "08:00:00", + }, ], skillsRequired: [{ id: "650e8400-e29b-41d4-a716-446655440001", name: "Heavy Lifting" }], updatedAt: "2024-01-15T10:30:00Z", @@ -632,7 +640,7 @@ describe("HubsClient", () => { serviceTimeSeconds: 1800, serviceWindows: [ { - daysOfWeek: ["monday", "monday", "monday"], + daysOfWeek: ["monday", "monday", "monday", "monday"], endTime: "17:00:00", startTime: "08:00:00", }, @@ -872,7 +880,11 @@ describe("HubsClient", () => { plannerNotes: "sample note", serviceTimeSeconds: 1800, serviceWindows: [ - { daysOfWeek: ["monday", "monday", "monday"], endTime: "17:00:00", startTime: "08:00:00" }, + { + daysOfWeek: ["monday", "monday", "monday", "monday"], + endTime: "17:00:00", + startTime: "08:00:00", + }, ], skillsRequired: [{ id: "650e8400-e29b-41d4-a716-446655440001", name: "Heavy Lifting" }], updatedAt: "2024-01-15T10:30:00Z", @@ -929,7 +941,7 @@ describe("HubsClient", () => { serviceTimeSeconds: 1800, serviceWindows: [ { - daysOfWeek: ["monday", "monday", "monday"], + daysOfWeek: ["monday", "monday", "monday", "monday"], endTime: "17:00:00", startTime: "08:00:00", }, diff --git a/tests/wire/previewApIs.test.ts b/tests/wire/previewApIs.test.ts index 81819080..c24944af 100644 --- a/tests/wire/previewApIs.test.ts +++ b/tests/wire/previewApIs.test.ts @@ -5,7 +5,7 @@ import { SamsaraClient } from "../../src/Client"; import { mockServerPool } from "../mock-server/MockServerPool"; describe("PreviewApIsClient", () => { - test("listDeviceRecoveryAssets (1)", async () => { + test("listDeviceRecoveryMissingAssets (1)", async () => { const server = mockServerPool.createServer(); const client = new SamsaraClient({ maxRetries: 0, @@ -17,22 +17,10 @@ describe("PreviewApIsClient", () => { const rawResponseBody = { data: [ { - additional_details: "Found in warehouse B", id: "12345", - missing_reason: "MISPLACED", name: "Trailer-A1234", note: "Asset was last seen at warehouse A", notification_recipients: [{ notification_types: ["email"], user_id: 1234 }], - recovery_photos: [ - { - start_ms: 1609459200000, - status: "EXISTS", - url: "https://s3.amazonaws.com/samsara-recovery-photos/example.jpg", - url_expires_at_ms: 1609462800000, - }, - ], - recovery_status: "YES", - status: "UNKNOWN", updated_at_ms: 1609459200000, updated_by_user_id: 1234, uuid: "550e8400-e29b-41d4-a716-446655440000", @@ -42,19 +30,17 @@ describe("PreviewApIsClient", () => { }; server .mockEndpoint() - .get("/preview/fleet/assets/device-recovery") + .get("/preview/fleet/assets/device-recovery-missing") .respondWith() .statusCode(200) .jsonBody(rawResponseBody) .build(); - const response = await client.previewApIs.listDeviceRecoveryAssets(); + const response = await client.previewApIs.listDeviceRecoveryMissingAssets(); expect(response).toEqual({ data: [ { - additional_details: "Found in warehouse B", id: "12345", - missing_reason: "MISPLACED", name: "Trailer-A1234", note: "Asset was last seen at warehouse A", notification_recipients: [ @@ -63,16 +49,6 @@ describe("PreviewApIsClient", () => { user_id: 1234, }, ], - recovery_photos: [ - { - start_ms: 1609459200000, - status: "EXISTS", - url: "https://s3.amazonaws.com/samsara-recovery-photos/example.jpg", - url_expires_at_ms: 1609462800000, - }, - ], - recovery_status: "YES", - status: "UNKNOWN", updated_at_ms: 1609459200000, updated_by_user_id: 1234, uuid: "550e8400-e29b-41d4-a716-446655440000", @@ -85,7 +61,7 @@ describe("PreviewApIsClient", () => { }); }); - test("listDeviceRecoveryAssets (2)", async () => { + test("listDeviceRecoveryMissingAssets (2)", async () => { const server = mockServerPool.createServer(); const client = new SamsaraClient({ maxRetries: 0, @@ -97,18 +73,18 @@ describe("PreviewApIsClient", () => { const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/preview/fleet/assets/device-recovery") + .get("/preview/fleet/assets/device-recovery-missing") .respondWith() .statusCode(401) .jsonBody(rawResponseBody) .build(); await expect(async () => { - return await client.previewApIs.listDeviceRecoveryAssets(); + return await client.previewApIs.listDeviceRecoveryMissingAssets(); }).rejects.toThrow(Samsara.UnauthorizedError); }); - test("listDeviceRecoveryAssets (3)", async () => { + test("listDeviceRecoveryMissingAssets (3)", async () => { const server = mockServerPool.createServer(); const client = new SamsaraClient({ maxRetries: 0, @@ -120,18 +96,18 @@ describe("PreviewApIsClient", () => { const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/preview/fleet/assets/device-recovery") + .get("/preview/fleet/assets/device-recovery-missing") .respondWith() .statusCode(404) .jsonBody(rawResponseBody) .build(); await expect(async () => { - return await client.previewApIs.listDeviceRecoveryAssets(); + return await client.previewApIs.listDeviceRecoveryMissingAssets(); }).rejects.toThrow(Samsara.NotFoundError); }); - test("listDeviceRecoveryAssets (4)", async () => { + test("listDeviceRecoveryMissingAssets (4)", async () => { const server = mockServerPool.createServer(); const client = new SamsaraClient({ maxRetries: 0, @@ -143,18 +119,18 @@ describe("PreviewApIsClient", () => { const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/preview/fleet/assets/device-recovery") + .get("/preview/fleet/assets/device-recovery-missing") .respondWith() .statusCode(405) .jsonBody(rawResponseBody) .build(); await expect(async () => { - return await client.previewApIs.listDeviceRecoveryAssets(); + return await client.previewApIs.listDeviceRecoveryMissingAssets(); }).rejects.toThrow(Samsara.MethodNotAllowedError); }); - test("listDeviceRecoveryAssets (5)", async () => { + test("listDeviceRecoveryMissingAssets (5)", async () => { const server = mockServerPool.createServer(); const client = new SamsaraClient({ maxRetries: 0, @@ -166,18 +142,18 @@ describe("PreviewApIsClient", () => { const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/preview/fleet/assets/device-recovery") + .get("/preview/fleet/assets/device-recovery-missing") .respondWith() .statusCode(429) .jsonBody(rawResponseBody) .build(); await expect(async () => { - return await client.previewApIs.listDeviceRecoveryAssets(); + return await client.previewApIs.listDeviceRecoveryMissingAssets(); }).rejects.toThrow(Samsara.TooManyRequestsError); }); - test("listDeviceRecoveryAssets (6)", async () => { + test("listDeviceRecoveryMissingAssets (6)", async () => { const server = mockServerPool.createServer(); const client = new SamsaraClient({ maxRetries: 0, @@ -189,18 +165,18 @@ describe("PreviewApIsClient", () => { const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/preview/fleet/assets/device-recovery") + .get("/preview/fleet/assets/device-recovery-missing") .respondWith() .statusCode(500) .jsonBody(rawResponseBody) .build(); await expect(async () => { - return await client.previewApIs.listDeviceRecoveryAssets(); + return await client.previewApIs.listDeviceRecoveryMissingAssets(); }).rejects.toThrow(Samsara.InternalServerError); }); - test("listDeviceRecoveryAssets (7)", async () => { + test("listDeviceRecoveryMissingAssets (7)", async () => { const server = mockServerPool.createServer(); const client = new SamsaraClient({ maxRetries: 0, @@ -212,18 +188,18 @@ describe("PreviewApIsClient", () => { const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/preview/fleet/assets/device-recovery") + .get("/preview/fleet/assets/device-recovery-missing") .respondWith() .statusCode(501) .jsonBody(rawResponseBody) .build(); await expect(async () => { - return await client.previewApIs.listDeviceRecoveryAssets(); + return await client.previewApIs.listDeviceRecoveryMissingAssets(); }).rejects.toThrow(Samsara.NotImplementedError); }); - test("listDeviceRecoveryAssets (8)", async () => { + test("listDeviceRecoveryMissingAssets (8)", async () => { const server = mockServerPool.createServer(); const client = new SamsaraClient({ maxRetries: 0, @@ -235,18 +211,18 @@ describe("PreviewApIsClient", () => { const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/preview/fleet/assets/device-recovery") + .get("/preview/fleet/assets/device-recovery-missing") .respondWith() .statusCode(502) .jsonBody(rawResponseBody) .build(); await expect(async () => { - return await client.previewApIs.listDeviceRecoveryAssets(); + return await client.previewApIs.listDeviceRecoveryMissingAssets(); }).rejects.toThrow(Samsara.BadGatewayError); }); - test("listDeviceRecoveryAssets (9)", async () => { + test("listDeviceRecoveryMissingAssets (9)", async () => { const server = mockServerPool.createServer(); const client = new SamsaraClient({ maxRetries: 0, @@ -258,18 +234,18 @@ describe("PreviewApIsClient", () => { const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/preview/fleet/assets/device-recovery") + .get("/preview/fleet/assets/device-recovery-missing") .respondWith() .statusCode(503) .jsonBody(rawResponseBody) .build(); await expect(async () => { - return await client.previewApIs.listDeviceRecoveryAssets(); + return await client.previewApIs.listDeviceRecoveryMissingAssets(); }).rejects.toThrow(Samsara.ServiceUnavailableError); }); - test("listDeviceRecoveryAssets (10)", async () => { + test("listDeviceRecoveryMissingAssets (10)", async () => { const server = mockServerPool.createServer(); const client = new SamsaraClient({ maxRetries: 0, @@ -281,14 +257,14 @@ describe("PreviewApIsClient", () => { const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/preview/fleet/assets/device-recovery") + .get("/preview/fleet/assets/device-recovery-missing") .respondWith() .statusCode(504) .jsonBody(rawResponseBody) .build(); await expect(async () => { - return await client.previewApIs.listDeviceRecoveryAssets(); + return await client.previewApIs.listDeviceRecoveryMissingAssets(); }).rejects.toThrow(Samsara.GatewayTimeoutError); }); @@ -303,22 +279,10 @@ describe("PreviewApIsClient", () => { const rawRequestBody = {}; const rawResponseBody = { data: { - additional_details: "Found in warehouse B", id: "12345", - missing_reason: "MISPLACED", name: "Trailer-A1234", note: "Asset was last seen at warehouse A", notification_recipients: [{ notification_types: ["email"], user_id: 1234 }], - recovery_photos: [ - { - start_ms: 1609459200000, - status: "EXISTS", - url: "https://s3.amazonaws.com/samsara-recovery-photos/example.jpg", - url_expires_at_ms: 1609462800000, - }, - ], - recovery_status: "YES", - status: "UNKNOWN", updated_at_ms: 1609459200000, updated_by_user_id: 1234, uuid: "550e8400-e29b-41d4-a716-446655440000", @@ -338,9 +302,7 @@ describe("PreviewApIsClient", () => { }); expect(response).toEqual({ data: { - additional_details: "Found in warehouse B", id: "12345", - missing_reason: "MISPLACED", name: "Trailer-A1234", note: "Asset was last seen at warehouse A", notification_recipients: [ @@ -349,16 +311,6 @@ describe("PreviewApIsClient", () => { user_id: 1234, }, ], - recovery_photos: [ - { - start_ms: 1609459200000, - status: "EXISTS", - url: "https://s3.amazonaws.com/samsara-recovery-photos/example.jpg", - url_expires_at_ms: 1609462800000, - }, - ], - recovery_status: "YES", - status: "UNKNOWN", updated_at_ms: 1609459200000, updated_by_user_id: 1234, uuid: "550e8400-e29b-41d4-a716-446655440000", @@ -611,9 +563,7 @@ describe("PreviewApIsClient", () => { const rawRequestBody = { missing_reason: "MISPLACED", recovery_status: "YES", status: "RECOVERED" }; const rawResponseBody = { data: { - additional_details: "Found in warehouse B", id: "12345", - missing_reason: "MISPLACED", name: "Trailer-A1234", note: "Asset was last seen at warehouse A", notification_recipients: [{ notification_types: ["email"], user_id: 1234 }], @@ -625,8 +575,6 @@ describe("PreviewApIsClient", () => { url_expires_at_ms: 1609462800000, }, ], - recovery_status: "YES", - status: "UNKNOWN", updated_at_ms: 1609459200000, updated_by_user_id: 1234, uuid: "550e8400-e29b-41d4-a716-446655440000", @@ -649,9 +597,7 @@ describe("PreviewApIsClient", () => { }); expect(response).toEqual({ data: { - additional_details: "Found in warehouse B", id: "12345", - missing_reason: "MISPLACED", name: "Trailer-A1234", note: "Asset was last seen at warehouse A", notification_recipients: [ @@ -668,8 +614,6 @@ describe("PreviewApIsClient", () => { url_expires_at_ms: 1609462800000, }, ], - recovery_status: "YES", - status: "UNKNOWN", updated_at_ms: 1609459200000, updated_by_user_id: 1234, uuid: "550e8400-e29b-41d4-a716-446655440000", @@ -938,304 +882,6 @@ describe("PreviewApIsClient", () => { }).rejects.toThrow(Samsara.GatewayTimeoutError); }); - test("getAssetRecoveryState (1)", async () => { - const server = mockServerPool.createServer(); - const client = new SamsaraClient({ - maxRetries: 0, - token: "test", - version: "2025-06-11", - environment: server.baseUrl, - }); - - const rawResponseBody = { - data: { - additional_details: "Found in warehouse B", - id: "12345", - missing_reason: "MISPLACED", - name: "Trailer-A1234", - note: "Asset was last seen at warehouse A", - notification_recipients: [{ notification_types: ["email"], user_id: 1234 }], - recovery_photos: [ - { - start_ms: 1609459200000, - status: "EXISTS", - url: "https://s3.amazonaws.com/samsara-recovery-photos/example.jpg", - url_expires_at_ms: 1609462800000, - }, - ], - recovery_status: "YES", - status: "UNKNOWN", - updated_at_ms: 1609459200000, - updated_by_user_id: 1234, - uuid: "550e8400-e29b-41d4-a716-446655440000", - }, - }; - server - .mockEndpoint() - .get("/preview/fleet/assets/device-recovery/id/recovery-state") - .respondWith() - .statusCode(200) - .jsonBody(rawResponseBody) - .build(); - - const response = await client.previewApIs.getAssetRecoveryState({ - id: "id", - }); - expect(response).toEqual({ - data: { - additional_details: "Found in warehouse B", - id: "12345", - missing_reason: "MISPLACED", - name: "Trailer-A1234", - note: "Asset was last seen at warehouse A", - notification_recipients: [ - { - notification_types: ["email"], - user_id: 1234, - }, - ], - recovery_photos: [ - { - start_ms: 1609459200000, - status: "EXISTS", - url: "https://s3.amazonaws.com/samsara-recovery-photos/example.jpg", - url_expires_at_ms: 1609462800000, - }, - ], - recovery_status: "YES", - status: "UNKNOWN", - updated_at_ms: 1609459200000, - updated_by_user_id: 1234, - uuid: "550e8400-e29b-41d4-a716-446655440000", - }, - }); - }); - - test("getAssetRecoveryState (2)", async () => { - const server = mockServerPool.createServer(); - const client = new SamsaraClient({ - maxRetries: 0, - token: "test", - version: "2025-06-11", - environment: server.baseUrl, - }); - - const rawResponseBody = { key: "value" }; - server - .mockEndpoint() - .get("/preview/fleet/assets/device-recovery/id/recovery-state") - .respondWith() - .statusCode(401) - .jsonBody(rawResponseBody) - .build(); - - await expect(async () => { - return await client.previewApIs.getAssetRecoveryState({ - id: "id", - }); - }).rejects.toThrow(Samsara.UnauthorizedError); - }); - - test("getAssetRecoveryState (3)", async () => { - const server = mockServerPool.createServer(); - const client = new SamsaraClient({ - maxRetries: 0, - token: "test", - version: "2025-06-11", - environment: server.baseUrl, - }); - - const rawResponseBody = { key: "value" }; - server - .mockEndpoint() - .get("/preview/fleet/assets/device-recovery/id/recovery-state") - .respondWith() - .statusCode(404) - .jsonBody(rawResponseBody) - .build(); - - await expect(async () => { - return await client.previewApIs.getAssetRecoveryState({ - id: "id", - }); - }).rejects.toThrow(Samsara.NotFoundError); - }); - - test("getAssetRecoveryState (4)", async () => { - const server = mockServerPool.createServer(); - const client = new SamsaraClient({ - maxRetries: 0, - token: "test", - version: "2025-06-11", - environment: server.baseUrl, - }); - - const rawResponseBody = { key: "value" }; - server - .mockEndpoint() - .get("/preview/fleet/assets/device-recovery/id/recovery-state") - .respondWith() - .statusCode(405) - .jsonBody(rawResponseBody) - .build(); - - await expect(async () => { - return await client.previewApIs.getAssetRecoveryState({ - id: "id", - }); - }).rejects.toThrow(Samsara.MethodNotAllowedError); - }); - - test("getAssetRecoveryState (5)", async () => { - const server = mockServerPool.createServer(); - const client = new SamsaraClient({ - maxRetries: 0, - token: "test", - version: "2025-06-11", - environment: server.baseUrl, - }); - - const rawResponseBody = { key: "value" }; - server - .mockEndpoint() - .get("/preview/fleet/assets/device-recovery/id/recovery-state") - .respondWith() - .statusCode(429) - .jsonBody(rawResponseBody) - .build(); - - await expect(async () => { - return await client.previewApIs.getAssetRecoveryState({ - id: "id", - }); - }).rejects.toThrow(Samsara.TooManyRequestsError); - }); - - test("getAssetRecoveryState (6)", async () => { - const server = mockServerPool.createServer(); - const client = new SamsaraClient({ - maxRetries: 0, - token: "test", - version: "2025-06-11", - environment: server.baseUrl, - }); - - const rawResponseBody = { key: "value" }; - server - .mockEndpoint() - .get("/preview/fleet/assets/device-recovery/id/recovery-state") - .respondWith() - .statusCode(500) - .jsonBody(rawResponseBody) - .build(); - - await expect(async () => { - return await client.previewApIs.getAssetRecoveryState({ - id: "id", - }); - }).rejects.toThrow(Samsara.InternalServerError); - }); - - test("getAssetRecoveryState (7)", async () => { - const server = mockServerPool.createServer(); - const client = new SamsaraClient({ - maxRetries: 0, - token: "test", - version: "2025-06-11", - environment: server.baseUrl, - }); - - const rawResponseBody = { key: "value" }; - server - .mockEndpoint() - .get("/preview/fleet/assets/device-recovery/id/recovery-state") - .respondWith() - .statusCode(501) - .jsonBody(rawResponseBody) - .build(); - - await expect(async () => { - return await client.previewApIs.getAssetRecoveryState({ - id: "id", - }); - }).rejects.toThrow(Samsara.NotImplementedError); - }); - - test("getAssetRecoveryState (8)", async () => { - const server = mockServerPool.createServer(); - const client = new SamsaraClient({ - maxRetries: 0, - token: "test", - version: "2025-06-11", - environment: server.baseUrl, - }); - - const rawResponseBody = { key: "value" }; - server - .mockEndpoint() - .get("/preview/fleet/assets/device-recovery/id/recovery-state") - .respondWith() - .statusCode(502) - .jsonBody(rawResponseBody) - .build(); - - await expect(async () => { - return await client.previewApIs.getAssetRecoveryState({ - id: "id", - }); - }).rejects.toThrow(Samsara.BadGatewayError); - }); - - test("getAssetRecoveryState (9)", async () => { - const server = mockServerPool.createServer(); - const client = new SamsaraClient({ - maxRetries: 0, - token: "test", - version: "2025-06-11", - environment: server.baseUrl, - }); - - const rawResponseBody = { key: "value" }; - server - .mockEndpoint() - .get("/preview/fleet/assets/device-recovery/id/recovery-state") - .respondWith() - .statusCode(503) - .jsonBody(rawResponseBody) - .build(); - - await expect(async () => { - return await client.previewApIs.getAssetRecoveryState({ - id: "id", - }); - }).rejects.toThrow(Samsara.ServiceUnavailableError); - }); - - test("getAssetRecoveryState (10)", async () => { - const server = mockServerPool.createServer(); - const client = new SamsaraClient({ - maxRetries: 0, - token: "test", - version: "2025-06-11", - environment: server.baseUrl, - }); - - const rawResponseBody = { key: "value" }; - server - .mockEndpoint() - .get("/preview/fleet/assets/device-recovery/id/recovery-state") - .respondWith() - .statusCode(504) - .jsonBody(rawResponseBody) - .build(); - - await expect(async () => { - return await client.previewApIs.getAssetRecoveryState({ - id: "id", - }); - }).rejects.toThrow(Samsara.GatewayTimeoutError); - }); - test("createDriverAuthToken (1)", async () => { const server = mockServerPool.createServer(); const client = new SamsaraClient({