@seamapi/http 1.25.1 → 1.26.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
@@ -4855,6 +4855,144 @@ var SeamHttpThermostats = class _SeamHttpThermostats {
4855
4855
  }
4856
4856
  };
4857
4857
 
4858
+ // src/lib/seam/connect/routes/unstable-locations.ts
4859
+ var SeamHttpUnstableLocations = class _SeamHttpUnstableLocations {
4860
+ constructor(apiKeyOrOptions = {}) {
4861
+ const options = parseOptions(apiKeyOrOptions);
4862
+ this.client = "client" in options ? options.client : createClient(options);
4863
+ this.defaults = limitToSeamHttpRequestOptions(options);
4864
+ }
4865
+ static fromClient(client, options = {}) {
4866
+ const constructorOptions = { ...options, client };
4867
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
4868
+ throw new SeamHttpInvalidOptionsError("Missing client");
4869
+ }
4870
+ return new _SeamHttpUnstableLocations(constructorOptions);
4871
+ }
4872
+ static fromApiKey(apiKey, options = {}) {
4873
+ const constructorOptions = { ...options, apiKey };
4874
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
4875
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
4876
+ }
4877
+ return new _SeamHttpUnstableLocations(constructorOptions);
4878
+ }
4879
+ static fromClientSessionToken(clientSessionToken, options = {}) {
4880
+ const constructorOptions = { ...options, clientSessionToken };
4881
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
4882
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
4883
+ }
4884
+ return new _SeamHttpUnstableLocations(constructorOptions);
4885
+ }
4886
+ static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
4887
+ warnOnInsecureuserIdentifierKey(userIdentifierKey);
4888
+ const clientOptions = parseOptions({ ...options, publishableKey });
4889
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
4890
+ throw new SeamHttpInvalidOptionsError(
4891
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
4892
+ );
4893
+ }
4894
+ const client = createClient(clientOptions);
4895
+ const clientSessions = SeamHttpClientSessions.fromClient(client);
4896
+ const { token } = await clientSessions.getOrCreate({
4897
+ user_identifier_key: userIdentifierKey
4898
+ });
4899
+ return _SeamHttpUnstableLocations.fromClientSessionToken(token, options);
4900
+ }
4901
+ static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
4902
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId };
4903
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
4904
+ throw new SeamHttpInvalidOptionsError(
4905
+ "Missing consoleSessionToken or workspaceId"
4906
+ );
4907
+ }
4908
+ return new _SeamHttpUnstableLocations(constructorOptions);
4909
+ }
4910
+ static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
4911
+ const constructorOptions = { ...options, personalAccessToken, workspaceId };
4912
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
4913
+ throw new SeamHttpInvalidOptionsError(
4914
+ "Missing personalAccessToken or workspaceId"
4915
+ );
4916
+ }
4917
+ return new _SeamHttpUnstableLocations(constructorOptions);
4918
+ }
4919
+ createPaginator(request) {
4920
+ return new SeamPaginator(this, request);
4921
+ }
4922
+ async updateClientSessionToken(clientSessionToken) {
4923
+ const { headers } = this.client.defaults;
4924
+ const authHeaders = getAuthHeadersForClientSessionToken({
4925
+ clientSessionToken
4926
+ });
4927
+ for (const key of Object.keys(authHeaders)) {
4928
+ if (headers[key] == null) {
4929
+ throw new Error(
4930
+ "Cannot update a clientSessionToken on a client created without a clientSessionToken"
4931
+ );
4932
+ }
4933
+ }
4934
+ this.client.defaults.headers = { ...headers, ...authHeaders };
4935
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client);
4936
+ await clientSessions.get();
4937
+ }
4938
+ addDevices(body) {
4939
+ return new SeamHttpRequest(this, {
4940
+ pathname: "/unstable_locations/add_devices",
4941
+ method: "post",
4942
+ body,
4943
+ responseKey: void 0
4944
+ });
4945
+ }
4946
+ create(body) {
4947
+ return new SeamHttpRequest(this, {
4948
+ pathname: "/unstable_locations/create",
4949
+ method: "post",
4950
+ body,
4951
+ responseKey: "location"
4952
+ });
4953
+ }
4954
+ delete(body) {
4955
+ return new SeamHttpRequest(this, {
4956
+ pathname: "/unstable_locations/delete",
4957
+ method: "post",
4958
+ body,
4959
+ responseKey: void 0
4960
+ });
4961
+ }
4962
+ get(body) {
4963
+ return new SeamHttpRequest(this, {
4964
+ pathname: "/unstable_locations/get",
4965
+ method: "post",
4966
+ body,
4967
+ responseKey: "location"
4968
+ });
4969
+ }
4970
+ list(body) {
4971
+ return new SeamHttpRequest(this, {
4972
+ pathname: "/unstable_locations/list",
4973
+ method: "post",
4974
+ body,
4975
+ responseKey: "locations"
4976
+ });
4977
+ }
4978
+ removeDevices(body) {
4979
+ return new SeamHttpRequest(this, {
4980
+ pathname: "/unstable_locations/remove_devices",
4981
+ method: "post",
4982
+ body,
4983
+ responseKey: void 0
4984
+ });
4985
+ }
4986
+ update(body) {
4987
+ return new SeamHttpRequest(this, {
4988
+ pathname: "/unstable_locations/update",
4989
+ method: "post",
4990
+ body,
4991
+ responseKey: "location"
4992
+ });
4993
+ }
4994
+ };
4995
+
4858
4996
  // src/lib/seam/connect/routes/user-identities-enrollment-automations.ts
4859
4997
  var SeamHttpUserIdentitiesEnrollmentAutomations = class _SeamHttpUserIdentitiesEnrollmentAutomations {
4860
4998
  constructor(apiKeyOrOptions = {}) {
@@ -5614,6 +5752,7 @@ exports.SeamHttpThermostats = SeamHttpThermostats;
5614
5752
  exports.SeamHttpThermostatsSchedules = SeamHttpThermostatsSchedules;
5615
5753
  exports.SeamHttpThermostatsSimulate = SeamHttpThermostatsSimulate;
5616
5754
  exports.SeamHttpUnauthorizedError = SeamHttpUnauthorizedError;
5755
+ exports.SeamHttpUnstableLocations = SeamHttpUnstableLocations;
5617
5756
  exports.SeamHttpUserIdentities = SeamHttpUserIdentities;
5618
5757
  exports.SeamHttpUserIdentitiesEnrollmentAutomations = SeamHttpUserIdentitiesEnrollmentAutomations;
5619
5758
  exports.SeamHttpWebhooks = SeamHttpWebhooks;