@seamapi/http 1.5.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/connect.cjs CHANGED
@@ -2447,6 +2447,111 @@ var SeamHttpAcs = class _SeamHttpAcs {
2447
2447
  }
2448
2448
  };
2449
2449
 
2450
+ // src/lib/seam/connect/routes/acs-encoders.ts
2451
+ var SeamHttpAcsEncoders = class _SeamHttpAcsEncoders {
2452
+ constructor(apiKeyOrOptions = {}) {
2453
+ const options = parseOptions(apiKeyOrOptions);
2454
+ this.client = "client" in options ? options.client : createClient(options);
2455
+ this.defaults = limitToSeamHttpRequestOptions(options);
2456
+ }
2457
+ static fromClient(client, options = {}) {
2458
+ const constructorOptions = { ...options, client };
2459
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
2460
+ throw new SeamHttpInvalidOptionsError("Missing client");
2461
+ }
2462
+ return new _SeamHttpAcsEncoders(constructorOptions);
2463
+ }
2464
+ static fromApiKey(apiKey, options = {}) {
2465
+ const constructorOptions = { ...options, apiKey };
2466
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
2467
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
2468
+ }
2469
+ return new _SeamHttpAcsEncoders(constructorOptions);
2470
+ }
2471
+ static fromClientSessionToken(clientSessionToken, options = {}) {
2472
+ const constructorOptions = { ...options, clientSessionToken };
2473
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
2474
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
2475
+ }
2476
+ return new _SeamHttpAcsEncoders(constructorOptions);
2477
+ }
2478
+ static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
2479
+ warnOnInsecureuserIdentifierKey(userIdentifierKey);
2480
+ const clientOptions = parseOptions({ ...options, publishableKey });
2481
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
2482
+ throw new SeamHttpInvalidOptionsError(
2483
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
2484
+ );
2485
+ }
2486
+ const client = createClient(clientOptions);
2487
+ const clientSessions = SeamHttpClientSessions.fromClient(client);
2488
+ const { token } = await clientSessions.getOrCreate({
2489
+ user_identifier_key: userIdentifierKey
2490
+ });
2491
+ return _SeamHttpAcsEncoders.fromClientSessionToken(token, options);
2492
+ }
2493
+ static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
2494
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId };
2495
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
2496
+ throw new SeamHttpInvalidOptionsError(
2497
+ "Missing consoleSessionToken or workspaceId"
2498
+ );
2499
+ }
2500
+ return new _SeamHttpAcsEncoders(constructorOptions);
2501
+ }
2502
+ static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
2503
+ const constructorOptions = { ...options, personalAccessToken, workspaceId };
2504
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
2505
+ throw new SeamHttpInvalidOptionsError(
2506
+ "Missing personalAccessToken or workspaceId"
2507
+ );
2508
+ }
2509
+ return new _SeamHttpAcsEncoders(constructorOptions);
2510
+ }
2511
+ async updateClientSessionToken(clientSessionToken) {
2512
+ const { headers } = this.client.defaults;
2513
+ const authHeaders = getAuthHeadersForClientSessionToken({
2514
+ clientSessionToken
2515
+ });
2516
+ for (const key of Object.keys(authHeaders)) {
2517
+ if (headers[key] == null) {
2518
+ throw new Error(
2519
+ "Cannot update a clientSessionToken on a client created without a clientSessionToken"
2520
+ );
2521
+ }
2522
+ }
2523
+ this.client.defaults.headers = { ...headers, ...authHeaders };
2524
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client);
2525
+ await clientSessions.get();
2526
+ }
2527
+ encodeCard(body, options = {}) {
2528
+ return new SeamHttpRequest(this, {
2529
+ path: "/acs/encoders/encode_card",
2530
+ method: "post",
2531
+ body,
2532
+ responseKey: "action_attempt",
2533
+ options
2534
+ });
2535
+ }
2536
+ list(body) {
2537
+ return new SeamHttpRequest(this, {
2538
+ path: "/acs/encoders/list",
2539
+ method: "post",
2540
+ body,
2541
+ responseKey: "devices"
2542
+ });
2543
+ }
2544
+ readCard(body, options = {}) {
2545
+ return new SeamHttpRequest(this, {
2546
+ path: "/acs/encoders/read_card",
2547
+ method: "post",
2548
+ body,
2549
+ responseKey: "action_attempt",
2550
+ options
2551
+ });
2552
+ }
2553
+ };
2554
+
2450
2555
  // src/lib/seam/connect/routes/action-attempts.ts
2451
2556
  var SeamHttpActionAttempts = class _SeamHttpActionAttempts {
2452
2557
  constructor(apiKeyOrOptions = {}) {
@@ -4187,7 +4292,7 @@ var SeamHttpThermostats = class _SeamHttpThermostats {
4187
4292
  path: "/thermostats/update_climate_preset",
4188
4293
  method: "post",
4189
4294
  body,
4190
- responseKey: "climate_preset"
4295
+ responseKey: void 0
4191
4296
  });
4192
4297
  }
4193
4298
  };
@@ -4903,6 +5008,7 @@ exports.SeamHttpAcsCredentialPools = SeamHttpAcsCredentialPools;
4903
5008
  exports.SeamHttpAcsCredentialProvisioningAutomations = SeamHttpAcsCredentialProvisioningAutomations;
4904
5009
  exports.SeamHttpAcsCredentials = SeamHttpAcsCredentials;
4905
5010
  exports.SeamHttpAcsCredentialsUnmanaged = SeamHttpAcsCredentialsUnmanaged;
5011
+ exports.SeamHttpAcsEncoders = SeamHttpAcsEncoders;
4906
5012
  exports.SeamHttpAcsEntrances = SeamHttpAcsEntrances;
4907
5013
  exports.SeamHttpAcsSystems = SeamHttpAcsSystems;
4908
5014
  exports.SeamHttpAcsUsers = SeamHttpAcsUsers;
@@ -4963,5 +5069,5 @@ Object.keys(urlSearchParamsSerializer).forEach(function (k) {
4963
5069
  get: function () { return urlSearchParamsSerializer[k]; }
4964
5070
  });
4965
5071
  });
4966
- //# sourceMappingURL=out.js.map
5072
+ //# sourceMappingURL=connect.cjs.map
4967
5073
  //# sourceMappingURL=connect.cjs.map