@seamapi/http 0.23.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +15 -0
  2. package/dist/connect.cjs +847 -727
  3. package/dist/connect.cjs.map +1 -1
  4. package/dist/connect.d.cts +167 -126
  5. package/lib/seam/connect/routes/access-codes-unmanaged.d.ts +6 -5
  6. package/lib/seam/connect/routes/access-codes-unmanaged.js +26 -22
  7. package/lib/seam/connect/routes/access-codes-unmanaged.js.map +1 -1
  8. package/lib/seam/connect/routes/access-codes.d.ts +9 -8
  9. package/lib/seam/connect/routes/access-codes.js +41 -38
  10. package/lib/seam/connect/routes/access-codes.js.map +1 -1
  11. package/lib/seam/connect/routes/acs-access-groups.d.ts +6 -5
  12. package/lib/seam/connect/routes/acs-access-groups.js +26 -23
  13. package/lib/seam/connect/routes/acs-access-groups.js.map +1 -1
  14. package/lib/seam/connect/routes/acs-credential-pools.d.ts +2 -1
  15. package/lib/seam/connect/routes/acs-credential-pools.js +6 -5
  16. package/lib/seam/connect/routes/acs-credential-pools.js.map +1 -1
  17. package/lib/seam/connect/routes/acs-credential-provisioning-automations.d.ts +2 -1
  18. package/lib/seam/connect/routes/acs-credential-provisioning-automations.js +6 -5
  19. package/lib/seam/connect/routes/acs-credential-provisioning-automations.js.map +1 -1
  20. package/lib/seam/connect/routes/acs-credentials.d.ts +8 -7
  21. package/lib/seam/connect/routes/acs-credentials.js +36 -34
  22. package/lib/seam/connect/routes/acs-credentials.js.map +1 -1
  23. package/lib/seam/connect/routes/acs-entrances.d.ts +5 -4
  24. package/lib/seam/connect/routes/acs-entrances.js +21 -19
  25. package/lib/seam/connect/routes/acs-entrances.js.map +1 -1
  26. package/lib/seam/connect/routes/acs-systems.d.ts +3 -2
  27. package/lib/seam/connect/routes/acs-systems.js +11 -10
  28. package/lib/seam/connect/routes/acs-systems.js.map +1 -1
  29. package/lib/seam/connect/routes/acs-users.d.ts +12 -11
  30. package/lib/seam/connect/routes/acs-users.js +56 -48
  31. package/lib/seam/connect/routes/acs-users.js.map +1 -1
  32. package/lib/seam/connect/routes/action-attempts.d.ts +3 -2
  33. package/lib/seam/connect/routes/action-attempts.js +12 -18
  34. package/lib/seam/connect/routes/action-attempts.js.map +1 -1
  35. package/lib/seam/connect/routes/client-sessions.d.ts +8 -7
  36. package/lib/seam/connect/routes/client-sessions.js +36 -33
  37. package/lib/seam/connect/routes/client-sessions.js.map +1 -1
  38. package/lib/seam/connect/routes/connect-webviews.d.ts +6 -5
  39. package/lib/seam/connect/routes/connect-webviews.js +25 -22
  40. package/lib/seam/connect/routes/connect-webviews.js.map +1 -1
  41. package/lib/seam/connect/routes/connected-accounts.d.ts +5 -4
  42. package/lib/seam/connect/routes/connected-accounts.js +21 -19
  43. package/lib/seam/connect/routes/connected-accounts.js.map +1 -1
  44. package/lib/seam/connect/routes/devices-simulate.d.ts +21 -0
  45. package/lib/seam/connect/routes/devices-simulate.js +88 -0
  46. package/lib/seam/connect/routes/devices-simulate.js.map +1 -0
  47. package/lib/seam/connect/routes/devices-unmanaged.d.ts +4 -3
  48. package/lib/seam/connect/routes/devices-unmanaged.js +16 -14
  49. package/lib/seam/connect/routes/devices-unmanaged.js.map +1 -1
  50. package/lib/seam/connect/routes/devices.d.ts +8 -5
  51. package/lib/seam/connect/routes/devices.js +30 -23
  52. package/lib/seam/connect/routes/devices.js.map +1 -1
  53. package/lib/seam/connect/routes/events.d.ts +3 -2
  54. package/lib/seam/connect/routes/events.js +11 -10
  55. package/lib/seam/connect/routes/events.js.map +1 -1
  56. package/lib/seam/connect/routes/index.d.ts +1 -0
  57. package/lib/seam/connect/routes/index.js +1 -0
  58. package/lib/seam/connect/routes/index.js.map +1 -1
  59. package/lib/seam/connect/routes/locks.d.ts +5 -4
  60. package/lib/seam/connect/routes/locks.js +23 -36
  61. package/lib/seam/connect/routes/locks.js.map +1 -1
  62. package/lib/seam/connect/routes/networks.d.ts +3 -2
  63. package/lib/seam/connect/routes/networks.js +11 -10
  64. package/lib/seam/connect/routes/networks.js.map +1 -1
  65. package/lib/seam/connect/routes/noise-sensors-noise-thresholds.d.ts +6 -5
  66. package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js +26 -23
  67. package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js.map +1 -1
  68. package/lib/seam/connect/routes/phones-simulate.d.ts +2 -1
  69. package/lib/seam/connect/routes/phones-simulate.js +6 -5
  70. package/lib/seam/connect/routes/phones-simulate.js.map +1 -1
  71. package/lib/seam/connect/routes/phones.d.ts +3 -2
  72. package/lib/seam/connect/routes/phones.js +11 -9
  73. package/lib/seam/connect/routes/phones.js.map +1 -1
  74. package/lib/seam/connect/routes/thermostats-climate-setting-schedules.d.ts +6 -5
  75. package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js +26 -23
  76. package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js.map +1 -1
  77. package/lib/seam/connect/routes/thermostats.d.ts +9 -8
  78. package/lib/seam/connect/routes/thermostats.js +46 -76
  79. package/lib/seam/connect/routes/thermostats.js.map +1 -1
  80. package/lib/seam/connect/routes/user-identities-enrollment-automations.d.ts +5 -4
  81. package/lib/seam/connect/routes/user-identities-enrollment-automations.js +21 -19
  82. package/lib/seam/connect/routes/user-identities-enrollment-automations.js.map +1 -1
  83. package/lib/seam/connect/routes/user-identities.d.ts +13 -12
  84. package/lib/seam/connect/routes/user-identities.js +61 -54
  85. package/lib/seam/connect/routes/user-identities.js.map +1 -1
  86. package/lib/seam/connect/routes/webhooks.d.ts +6 -5
  87. package/lib/seam/connect/routes/webhooks.js +26 -23
  88. package/lib/seam/connect/routes/webhooks.js.map +1 -1
  89. package/lib/seam/connect/routes/workspaces.d.ts +5 -4
  90. package/lib/seam/connect/routes/workspaces.js +21 -19
  91. package/lib/seam/connect/routes/workspaces.js.map +1 -1
  92. package/lib/seam/connect/seam-http-request.d.ts +26 -0
  93. package/lib/seam/connect/seam-http-request.js +87 -0
  94. package/lib/seam/connect/seam-http-request.js.map +1 -0
  95. package/lib/version.d.ts +1 -1
  96. package/lib/version.js +1 -1
  97. package/package.json +4 -4
  98. package/src/lib/seam/connect/routes/access-codes-unmanaged.ts +37 -34
  99. package/src/lib/seam/connect/routes/access-codes.ts +56 -60
  100. package/src/lib/seam/connect/routes/acs-access-groups.ts +33 -32
  101. package/src/lib/seam/connect/routes/acs-credential-pools.ts +7 -7
  102. package/src/lib/seam/connect/routes/acs-credential-provisioning-automations.ts +11 -13
  103. package/src/lib/seam/connect/routes/acs-credentials.ts +42 -46
  104. package/src/lib/seam/connect/routes/acs-entrances.ts +31 -28
  105. package/src/lib/seam/connect/routes/acs-systems.ts +13 -14
  106. package/src/lib/seam/connect/routes/acs-users.ts +66 -61
  107. package/src/lib/seam/connect/routes/action-attempts.ts +14 -26
  108. package/src/lib/seam/connect/routes/client-sessions.ts +45 -49
  109. package/src/lib/seam/connect/routes/connect-webviews.ts +28 -28
  110. package/src/lib/seam/connect/routes/connected-accounts.ts +26 -29
  111. package/src/lib/seam/connect/routes/devices-simulate.ts +174 -0
  112. package/src/lib/seam/connect/routes/devices-unmanaged.ts +18 -18
  113. package/src/lib/seam/connect/routes/devices.ts +35 -31
  114. package/src/lib/seam/connect/routes/events.ts +11 -12
  115. package/src/lib/seam/connect/routes/index.ts +1 -0
  116. package/src/lib/seam/connect/routes/locks.ts +25 -50
  117. package/src/lib/seam/connect/routes/networks.ts +14 -13
  118. package/src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts +48 -38
  119. package/src/lib/seam/connect/routes/phones-simulate.ts +9 -10
  120. package/src/lib/seam/connect/routes/phones.ts +11 -10
  121. package/src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts +47 -55
  122. package/src/lib/seam/connect/routes/thermostats.ts +53 -110
  123. package/src/lib/seam/connect/routes/user-identities-enrollment-automations.ts +39 -48
  124. package/src/lib/seam/connect/routes/user-identities.ts +81 -78
  125. package/src/lib/seam/connect/routes/webhooks.ts +30 -28
  126. package/src/lib/seam/connect/routes/workspaces.ts +26 -25
  127. package/src/lib/seam/connect/seam-http-request.ts +144 -0
  128. package/src/lib/version.ts +1 -1
@@ -0,0 +1,26 @@
1
+ import type { Method } from 'axios';
2
+ import type { Client } from './client.js';
3
+ import type { SeamHttpRequestOptions } from './options.js';
4
+ interface SeamHttpRequestParent {
5
+ readonly client: Client;
6
+ readonly defaults: Required<SeamHttpRequestOptions>;
7
+ }
8
+ interface SeamHttpRequestConfig<TResponseKey> {
9
+ readonly path: string;
10
+ readonly method: Method;
11
+ readonly body?: unknown;
12
+ readonly params?: undefined | Record<string, unknown>;
13
+ readonly responseKey: TResponseKey;
14
+ readonly options?: Pick<SeamHttpRequestOptions, 'waitForActionAttempt'>;
15
+ }
16
+ export declare class SeamHttpRequest<const TResponse, const TResponseKey extends keyof TResponse | undefined> implements PromiseLike<TResponseKey extends keyof TResponse ? TResponse[TResponseKey] : undefined> {
17
+ #private;
18
+ constructor(parent: SeamHttpRequestParent, config: SeamHttpRequestConfig<TResponseKey>);
19
+ get responseKey(): TResponseKey;
20
+ get url(): URL;
21
+ get method(): Method;
22
+ get body(): unknown;
23
+ execute(): Promise<TResponseKey extends keyof TResponse ? TResponse[TResponseKey] : undefined>;
24
+ then<TResult1 = TResponseKey extends keyof TResponse ? TResponse[TResponseKey] : undefined, TResult2 = never>(onfulfilled?: ((value: TResponseKey extends keyof TResponse ? TResponse[TResponseKey] : undefined) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): PromiseLike<TResult1 | TResult2>;
25
+ }
26
+ export {};
@@ -0,0 +1,87 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _SeamHttpRequest_parent, _SeamHttpRequest_config;
13
+ import { serializeUrlSearchParams } from '@seamapi/url-search-params-serializer';
14
+ import { resolveActionAttempt } from './resolve-action-attempt.js';
15
+ import { SeamHttpActionAttempts } from './routes/index.js';
16
+ export class SeamHttpRequest {
17
+ constructor(parent, config) {
18
+ _SeamHttpRequest_parent.set(this, void 0);
19
+ _SeamHttpRequest_config.set(this, void 0);
20
+ __classPrivateFieldSet(this, _SeamHttpRequest_parent, parent, "f");
21
+ __classPrivateFieldSet(this, _SeamHttpRequest_config, config, "f");
22
+ }
23
+ get responseKey() {
24
+ return __classPrivateFieldGet(this, _SeamHttpRequest_config, "f").responseKey;
25
+ }
26
+ get url() {
27
+ const { client } = __classPrivateFieldGet(this, _SeamHttpRequest_parent, "f");
28
+ const { params } = __classPrivateFieldGet(this, _SeamHttpRequest_config, "f");
29
+ const serializer = typeof client.defaults.paramsSerializer === 'function'
30
+ ? client.defaults.paramsSerializer
31
+ : serializeUrlSearchParams;
32
+ const origin = getUrlPrefix(client.defaults.baseURL ?? '');
33
+ const pathname = __classPrivateFieldGet(this, _SeamHttpRequest_config, "f").path.startsWith('/')
34
+ ? __classPrivateFieldGet(this, _SeamHttpRequest_config, "f").path
35
+ : `/${__classPrivateFieldGet(this, _SeamHttpRequest_config, "f").path}`;
36
+ const path = params == null ? pathname : `${pathname}?${serializer(params)}`;
37
+ return new URL(`${origin}${path}`);
38
+ }
39
+ get method() {
40
+ return __classPrivateFieldGet(this, _SeamHttpRequest_config, "f").method;
41
+ }
42
+ get body() {
43
+ return __classPrivateFieldGet(this, _SeamHttpRequest_config, "f").body;
44
+ }
45
+ async execute() {
46
+ const { client } = __classPrivateFieldGet(this, _SeamHttpRequest_parent, "f");
47
+ const response = await client.request({
48
+ url: __classPrivateFieldGet(this, _SeamHttpRequest_config, "f").path,
49
+ method: __classPrivateFieldGet(this, _SeamHttpRequest_config, "f").method,
50
+ data: __classPrivateFieldGet(this, _SeamHttpRequest_config, "f").body,
51
+ params: __classPrivateFieldGet(this, _SeamHttpRequest_config, "f").params,
52
+ });
53
+ if (this.responseKey === undefined) {
54
+ return undefined;
55
+ }
56
+ const data = response.data[this.responseKey];
57
+ if (this.responseKey === 'action_attempt') {
58
+ const waitForActionAttempt = __classPrivateFieldGet(this, _SeamHttpRequest_config, "f").options?.waitForActionAttempt ??
59
+ __classPrivateFieldGet(this, _SeamHttpRequest_parent, "f").defaults.waitForActionAttempt;
60
+ if (waitForActionAttempt !== false) {
61
+ return await resolveActionAttempt(data, SeamHttpActionAttempts.fromClient(client, {
62
+ ...__classPrivateFieldGet(this, _SeamHttpRequest_parent, "f").defaults,
63
+ waitForActionAttempt: false,
64
+ }), typeof waitForActionAttempt === 'boolean' ? {} : waitForActionAttempt);
65
+ }
66
+ }
67
+ return data;
68
+ }
69
+ then(onfulfilled, onrejected) {
70
+ return this.execute().then(onfulfilled, onrejected);
71
+ }
72
+ }
73
+ _SeamHttpRequest_parent = new WeakMap(), _SeamHttpRequest_config = new WeakMap();
74
+ const getUrlPrefix = (input) => {
75
+ if (URL.canParse(input)) {
76
+ const url = new URL(input).toString();
77
+ if (url.endsWith('/'))
78
+ return url.slice(0, -1);
79
+ return url;
80
+ }
81
+ if (globalThis.location != null) {
82
+ const pathname = input.startsWith('/') ? input : `/${input}`;
83
+ return new URL(`${globalThis.location.origin}${pathname}`).toString();
84
+ }
85
+ throw new Error(`Cannot resolve origin from ${input} in a non-browser environment`);
86
+ };
87
+ //# sourceMappingURL=seam-http-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seam-http-request.js","sourceRoot":"","sources":["../../../src/lib/seam/connect/seam-http-request.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAA;AAKhF,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAgB1D,MAAM,OAAO,eAAe;IAW1B,YACE,MAA6B,EAC7B,MAA2C;QALpC,0CAA8B;QAC9B,0CAA4C;QAMnD,uBAAA,IAAI,2BAAW,MAAM,MAAA,CAAA;QACrB,uBAAA,IAAI,2BAAW,MAAM,MAAA,CAAA;IACvB,CAAC;IAED,IAAW,WAAW;QACpB,OAAO,uBAAA,IAAI,+BAAQ,CAAC,WAAW,CAAA;IACjC,CAAC;IAED,IAAW,GAAG;QACZ,MAAM,EAAE,MAAM,EAAE,GAAG,uBAAA,IAAI,+BAAQ,CAAA;QAC/B,MAAM,EAAE,MAAM,EAAE,GAAG,uBAAA,IAAI,+BAAQ,CAAA;QAE/B,MAAM,UAAU,GACd,OAAO,MAAM,CAAC,QAAQ,CAAC,gBAAgB,KAAK,UAAU;YACpD,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB;YAClC,CAAC,CAAC,wBAAwB,CAAA;QAE9B,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,IAAI,EAAE,CAAC,CAAA;QAE1D,MAAM,QAAQ,GAAG,uBAAA,IAAI,+BAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAChD,CAAC,CAAC,uBAAA,IAAI,+BAAQ,CAAC,IAAI;YACnB,CAAC,CAAC,IAAI,uBAAA,IAAI,+BAAQ,CAAC,IAAI,EAAE,CAAA;QAE3B,MAAM,IAAI,GAAG,MAA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seamapiJavascriptHttpVersion;
package/lib/version.js CHANGED
@@ -1,3 +1,3 @@
1
- const seamapiJavascriptHttpVersion = '0.23.0';
1
+ const seamapiJavascriptHttpVersion = '0.25.0';
2
2
  export default seamapiJavascriptHttpVersion;
3
3
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamapi/http",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "description": "JavaScript HTTP client for the Seam API written in TypeScript.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -84,7 +84,7 @@
84
84
  "npm": ">= 9.0.0"
85
85
  },
86
86
  "peerDependencies": {
87
- "@seamapi/types": "^1.129.0",
87
+ "@seamapi/types": "^1.138.0",
88
88
  "type-fest": "^4.0.0"
89
89
  },
90
90
  "peerDependenciesMeta": {
@@ -103,7 +103,7 @@
103
103
  },
104
104
  "devDependencies": {
105
105
  "@seamapi/fake-seam-connect": "^1.44.2",
106
- "@seamapi/types": "1.129.0",
106
+ "@seamapi/types": "1.138.0",
107
107
  "@types/eslint": "^8.44.2",
108
108
  "@types/node": "^20.8.10",
109
109
  "ava": "^5.0.1",
@@ -118,7 +118,7 @@
118
118
  "eslint-plugin-simple-import-sort": "^12.0.0",
119
119
  "eslint-plugin-unused-imports": "^3.0.0",
120
120
  "execa": "^8.0.1",
121
- "landlubber": "^1.0.0",
121
+ "landlubber": "^2.0.0",
122
122
  "nock": "^13.4.0",
123
123
  "node-fetch": "^3.3.2",
124
124
  "prettier": "^3.0.0",
@@ -31,6 +31,7 @@ import {
31
31
  limitToSeamHttpRequestOptions,
32
32
  parseOptions,
33
33
  } from 'lib/seam/connect/parse-options.js'
34
+ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
34
35
 
35
36
  import { SeamHttpClientSessions } from './client-sessions.js'
36
37
 
@@ -153,56 +154,58 @@ export class SeamHttpAccessCodesUnmanaged {
153
154
  await clientSessions.get()
154
155
  }
155
156
 
156
- async convertToManaged(
157
+ convertToManaged(
157
158
  body?: AccessCodesUnmanagedConvertToManagedBody,
158
- ): Promise<void> {
159
- await this.client.request<AccessCodesUnmanagedConvertToManagedResponse>({
160
- url: '/access_codes/unmanaged/convert_to_managed',
159
+ ): SeamHttpRequest<void, undefined> {
160
+ return new SeamHttpRequest(this, {
161
+ path: '/access_codes/unmanaged/convert_to_managed',
161
162
  method: 'post',
162
- data: body,
163
+ body,
164
+ responseKey: undefined,
163
165
  })
164
166
  }
165
167
 
166
- async delete(body?: AccessCodesUnmanagedDeleteBody): Promise<void> {
167
- await this.client.request<AccessCodesUnmanagedDeleteResponse>({
168
- url: '/access_codes/unmanaged/delete',
168
+ delete(
169
+ body?: AccessCodesUnmanagedDeleteBody,
170
+ ): SeamHttpRequest<void, undefined> {
171
+ return new SeamHttpRequest(this, {
172
+ path: '/access_codes/unmanaged/delete',
169
173
  method: 'post',
170
- data: body,
174
+ body,
175
+ responseKey: undefined,
171
176
  })
172
177
  }
173
178
 
174
- async get(
179
+ get(
175
180
  body?: AccessCodesUnmanagedGetParams,
176
- ): Promise<AccessCodesUnmanagedGetResponse['access_code']> {
177
- const { data } = await this.client.request<AccessCodesUnmanagedGetResponse>(
178
- {
179
- url: '/access_codes/unmanaged/get',
180
- method: 'post',
181
- data: body,
182
- },
183
- )
184
-
185
- return data.access_code
181
+ ): SeamHttpRequest<AccessCodesUnmanagedGetResponse, 'access_code'> {
182
+ return new SeamHttpRequest(this, {
183
+ path: '/access_codes/unmanaged/get',
184
+ method: 'post',
185
+ body,
186
+ responseKey: 'access_code',
187
+ })
186
188
  }
187
189
 
188
- async list(
190
+ list(
189
191
  body?: AccessCodesUnmanagedListParams,
190
- ): Promise<AccessCodesUnmanagedListResponse['access_codes']> {
191
- const { data } =
192
- await this.client.request<AccessCodesUnmanagedListResponse>({
193
- url: '/access_codes/unmanaged/list',
194
- method: 'post',
195
- data: body,
196
- })
197
-
198
- return data.access_codes
192
+ ): SeamHttpRequest<AccessCodesUnmanagedListResponse, 'access_codes'> {
193
+ return new SeamHttpRequest(this, {
194
+ path: '/access_codes/unmanaged/list',
195
+ method: 'post',
196
+ body,
197
+ responseKey: 'access_codes',
198
+ })
199
199
  }
200
200
 
201
- async update(body?: AccessCodesUnmanagedUpdateBody): Promise<void> {
202
- await this.client.request<AccessCodesUnmanagedUpdateResponse>({
203
- url: '/access_codes/unmanaged/update',
201
+ update(
202
+ body?: AccessCodesUnmanagedUpdateBody,
203
+ ): SeamHttpRequest<void, undefined> {
204
+ return new SeamHttpRequest(this, {
205
+ path: '/access_codes/unmanaged/update',
204
206
  method: 'post',
205
- data: body,
207
+ body,
208
+ responseKey: undefined,
206
209
  })
207
210
  }
208
211
  }
@@ -31,6 +31,7 @@ import {
31
31
  limitToSeamHttpRequestOptions,
32
32
  parseOptions,
33
33
  } from 'lib/seam/connect/parse-options.js'
34
+ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
34
35
 
35
36
  import { SeamHttpAccessCodesUnmanaged } from './access-codes-unmanaged.js'
36
37
  import { SeamHttpClientSessions } from './client-sessions.js'
@@ -158,95 +159,90 @@ export class SeamHttpAccessCodes {
158
159
  return SeamHttpAccessCodesUnmanaged.fromClient(this.client, this.defaults)
159
160
  }
160
161
 
161
- async create(
162
+ create(
162
163
  body?: AccessCodesCreateBody,
163
- ): Promise<AccessCodesCreateResponse['access_code']> {
164
- const { data } = await this.client.request<AccessCodesCreateResponse>({
165
- url: '/access_codes/create',
164
+ ): SeamHttpRequest<AccessCodesCreateResponse, 'access_code'> {
165
+ return new SeamHttpRequest(this, {
166
+ path: '/access_codes/create',
166
167
  method: 'post',
167
- data: body,
168
+ body,
169
+ responseKey: 'access_code',
168
170
  })
169
-
170
- return data.access_code
171
171
  }
172
172
 
173
- async createMultiple(
173
+ createMultiple(
174
174
  body?: AccessCodesCreateMultipleBody,
175
- ): Promise<AccessCodesCreateMultipleResponse['access_codes']> {
176
- const { data } =
177
- await this.client.request<AccessCodesCreateMultipleResponse>({
178
- url: '/access_codes/create_multiple',
179
- method: 'post',
180
- data: body,
181
- })
182
-
183
- return data.access_codes
175
+ ): SeamHttpRequest<AccessCodesCreateMultipleResponse, 'access_codes'> {
176
+ return new SeamHttpRequest(this, {
177
+ path: '/access_codes/create_multiple',
178
+ method: 'post',
179
+ body,
180
+ responseKey: 'access_codes',
181
+ })
184
182
  }
185
183
 
186
- async delete(body?: AccessCodesDeleteBody): Promise<void> {
187
- await this.client.request<AccessCodesDeleteResponse>({
188
- url: '/access_codes/delete',
184
+ delete(body?: AccessCodesDeleteBody): SeamHttpRequest<void, undefined> {
185
+ return new SeamHttpRequest(this, {
186
+ path: '/access_codes/delete',
189
187
  method: 'post',
190
- data: body,
188
+ body,
189
+ responseKey: undefined,
191
190
  })
192
191
  }
193
192
 
194
- async generateCode(
193
+ generateCode(
195
194
  body?: AccessCodesGenerateCodeBody,
196
- ): Promise<AccessCodesGenerateCodeResponse['generated_code']> {
197
- const { data } = await this.client.request<AccessCodesGenerateCodeResponse>(
198
- {
199
- url: '/access_codes/generate_code',
200
- method: 'post',
201
- data: body,
202
- },
203
- )
204
-
205
- return data.generated_code
195
+ ): SeamHttpRequest<AccessCodesGenerateCodeResponse, 'generated_code'> {
196
+ return new SeamHttpRequest(this, {
197
+ path: '/access_codes/generate_code',
198
+ method: 'post',
199
+ body,
200
+ responseKey: 'generated_code',
201
+ })
206
202
  }
207
203
 
208
- async get(
204
+ get(
209
205
  body?: AccessCodesGetParams,
210
- ): Promise<AccessCodesGetResponse['access_code']> {
211
- const { data } = await this.client.request<AccessCodesGetResponse>({
212
- url: '/access_codes/get',
206
+ ): SeamHttpRequest<AccessCodesGetResponse, 'access_code'> {
207
+ return new SeamHttpRequest(this, {
208
+ path: '/access_codes/get',
213
209
  method: 'post',
214
- data: body,
210
+ body,
211
+ responseKey: 'access_code',
215
212
  })
216
-
217
- return data.access_code
218
213
  }
219
214
 
220
- async list(
215
+ list(
221
216
  body?: AccessCodesListParams,
222
- ): Promise<AccessCodesListResponse['access_codes']> {
223
- const { data } = await this.client.request<AccessCodesListResponse>({
224
- url: '/access_codes/list',
217
+ ): SeamHttpRequest<AccessCodesListResponse, 'access_codes'> {
218
+ return new SeamHttpRequest(this, {
219
+ path: '/access_codes/list',
225
220
  method: 'post',
226
- data: body,
221
+ body,
222
+ responseKey: 'access_codes',
227
223
  })
228
-
229
- return data.access_codes
230
224
  }
231
225
 
232
- async pullBackupAccessCode(
226
+ pullBackupAccessCode(
233
227
  body?: AccessCodesPullBackupAccessCodeBody,
234
- ): Promise<AccessCodesPullBackupAccessCodeResponse['backup_access_code']> {
235
- const { data } =
236
- await this.client.request<AccessCodesPullBackupAccessCodeResponse>({
237
- url: '/access_codes/pull_backup_access_code',
238
- method: 'post',
239
- data: body,
240
- })
241
-
242
- return data.backup_access_code
228
+ ): SeamHttpRequest<
229
+ AccessCodesPullBackupAccessCodeResponse,
230
+ 'backup_access_code'
231
+ > {
232
+ return new SeamHttpRequest(this, {
233
+ path: '/access_codes/pull_backup_access_code',
234
+ method: 'post',
235
+ body,
236
+ responseKey: 'backup_access_code',
237
+ })
243
238
  }
244
239
 
245
- async update(body?: AccessCodesUpdateBody): Promise<void> {
246
- await this.client.request<AccessCodesUpdateResponse>({
247
- url: '/access_codes/update',
240
+ update(body?: AccessCodesUpdateBody): SeamHttpRequest<void, undefined> {
241
+ return new SeamHttpRequest(this, {
242
+ path: '/access_codes/update',
248
243
  method: 'post',
249
- data: body,
244
+ body,
245
+ responseKey: undefined,
250
246
  })
251
247
  }
252
248
  }
@@ -31,6 +31,7 @@ import {
31
31
  limitToSeamHttpRequestOptions,
32
32
  parseOptions,
33
33
  } from 'lib/seam/connect/parse-options.js'
34
+ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
34
35
 
35
36
  import { SeamHttpClientSessions } from './client-sessions.js'
36
37
 
@@ -153,56 +154,56 @@ export class SeamHttpAcsAccessGroups {
153
154
  await clientSessions.get()
154
155
  }
155
156
 
156
- async addUser(body?: AcsAccessGroupsAddUserBody): Promise<void> {
157
- await this.client.request<AcsAccessGroupsAddUserResponse>({
158
- url: '/acs/access_groups/add_user',
157
+ addUser(body?: AcsAccessGroupsAddUserBody): SeamHttpRequest<void, undefined> {
158
+ return new SeamHttpRequest(this, {
159
+ path: '/acs/access_groups/add_user',
159
160
  method: 'post',
160
- data: body,
161
+ body,
162
+ responseKey: undefined,
161
163
  })
162
164
  }
163
165
 
164
- async get(
166
+ get(
165
167
  body?: AcsAccessGroupsGetParams,
166
- ): Promise<AcsAccessGroupsGetResponse['acs_access_group']> {
167
- const { data } = await this.client.request<AcsAccessGroupsGetResponse>({
168
- url: '/acs/access_groups/get',
168
+ ): SeamHttpRequest<AcsAccessGroupsGetResponse, 'acs_access_group'> {
169
+ return new SeamHttpRequest(this, {
170
+ path: '/acs/access_groups/get',
169
171
  method: 'post',
170
- data: body,
172
+ body,
173
+ responseKey: 'acs_access_group',
171
174
  })
172
-
173
- return data.acs_access_group
174
175
  }
175
176
 
176
- async list(
177
+ list(
177
178
  body?: AcsAccessGroupsListParams,
178
- ): Promise<AcsAccessGroupsListResponse['acs_access_groups']> {
179
- const { data } = await this.client.request<AcsAccessGroupsListResponse>({
180
- url: '/acs/access_groups/list',
179
+ ): SeamHttpRequest<AcsAccessGroupsListResponse, 'acs_access_groups'> {
180
+ return new SeamHttpRequest(this, {
181
+ path: '/acs/access_groups/list',
181
182
  method: 'post',
182
- data: body,
183
+ body,
184
+ responseKey: 'acs_access_groups',
183
185
  })
184
-
185
- return data.acs_access_groups
186
186
  }
187
187
 
188
- async listUsers(
188
+ listUsers(
189
189
  body?: AcsAccessGroupsListUsersParams,
190
- ): Promise<AcsAccessGroupsListUsersResponse['acs_users']> {
191
- const { data } =
192
- await this.client.request<AcsAccessGroupsListUsersResponse>({
193
- url: '/acs/access_groups/list_users',
194
- method: 'post',
195
- data: body,
196
- })
197
-
198
- return data.acs_users
190
+ ): SeamHttpRequest<AcsAccessGroupsListUsersResponse, 'acs_users'> {
191
+ return new SeamHttpRequest(this, {
192
+ path: '/acs/access_groups/list_users',
193
+ method: 'post',
194
+ body,
195
+ responseKey: 'acs_users',
196
+ })
199
197
  }
200
198
 
201
- async removeUser(body?: AcsAccessGroupsRemoveUserBody): Promise<void> {
202
- await this.client.request<AcsAccessGroupsRemoveUserResponse>({
203
- url: '/acs/access_groups/remove_user',
199
+ removeUser(
200
+ body?: AcsAccessGroupsRemoveUserBody,
201
+ ): SeamHttpRequest<void, undefined> {
202
+ return new SeamHttpRequest(this, {
203
+ path: '/acs/access_groups/remove_user',
204
204
  method: 'post',
205
- data: body,
205
+ body,
206
+ responseKey: undefined,
206
207
  })
207
208
  }
208
209
  }
@@ -31,6 +31,7 @@ import {
31
31
  limitToSeamHttpRequestOptions,
32
32
  parseOptions,
33
33
  } from 'lib/seam/connect/parse-options.js'
34
+ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
34
35
 
35
36
  import { SeamHttpClientSessions } from './client-sessions.js'
36
37
 
@@ -153,16 +154,15 @@ export class SeamHttpAcsCredentialPools {
153
154
  await clientSessions.get()
154
155
  }
155
156
 
156
- async list(
157
+ list(
157
158
  body?: AcsCredentialPoolsListParams,
158
- ): Promise<AcsCredentialPoolsListResponse['acs_credential_pools']> {
159
- const { data } = await this.client.request<AcsCredentialPoolsListResponse>({
160
- url: '/acs/credential_pools/list',
159
+ ): SeamHttpRequest<AcsCredentialPoolsListResponse, 'acs_credential_pools'> {
160
+ return new SeamHttpRequest(this, {
161
+ path: '/acs/credential_pools/list',
161
162
  method: 'post',
162
- data: body,
163
+ body,
164
+ responseKey: 'acs_credential_pools',
163
165
  })
164
-
165
- return data.acs_credential_pools
166
166
  }
167
167
  }
168
168
 
@@ -31,6 +31,7 @@ import {
31
31
  limitToSeamHttpRequestOptions,
32
32
  parseOptions,
33
33
  } from 'lib/seam/connect/parse-options.js'
34
+ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
34
35
 
35
36
  import { SeamHttpClientSessions } from './client-sessions.js'
36
37
 
@@ -156,21 +157,18 @@ export class SeamHttpAcsCredentialProvisioningAutomations {
156
157
  await clientSessions.get()
157
158
  }
158
159
 
159
- async launch(
160
+ launch(
160
161
  body?: AcsCredentialProvisioningAutomationsLaunchBody,
161
- ): Promise<
162
- AcsCredentialProvisioningAutomationsLaunchResponse['acs_credential_provisioning_automation']
162
+ ): SeamHttpRequest<
163
+ AcsCredentialProvisioningAutomationsLaunchResponse,
164
+ 'acs_credential_provisioning_automation'
163
165
  > {
164
- const { data } =
165
- await this.client.request<AcsCredentialProvisioningAutomationsLaunchResponse>(
166
- {
167
- url: '/acs/credential_provisioning_automations/launch',
168
- method: 'post',
169
- data: body,
170
- },
171
- )
172
-
173
- return data.acs_credential_provisioning_automation
166
+ return new SeamHttpRequest(this, {
167
+ path: '/acs/credential_provisioning_automations/launch',
168
+ method: 'post',
169
+ body,
170
+ responseKey: 'acs_credential_provisioning_automation',
171
+ })
174
172
  }
175
173
  }
176
174