@seamapi/http 0.21.0 → 0.22.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/README.md +1 -1
- package/dist/connect.cjs +91 -0
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +19 -1
- package/lib/seam/connect/routes/index.d.ts +1 -0
- package/lib/seam/connect/routes/index.js +1 -0
- package/lib/seam/connect/routes/index.js.map +1 -1
- package/lib/seam/connect/routes/phones-simulate.d.ts +20 -0
- package/lib/seam/connect/routes/phones-simulate.js +87 -0
- package/lib/seam/connect/routes/phones-simulate.js.map +1 -0
- package/lib/seam/connect/routes/phones.d.ts +2 -0
- package/lib/seam/connect/routes/phones.js +4 -0
- package/lib/seam/connect/routes/phones.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/lib/seam/connect/routes/index.ts +1 -0
- package/src/lib/seam/connect/routes/phones-simulate.ts +177 -0
- package/src/lib/seam/connect/routes/phones.ts +5 -0
- package/src/lib/version.ts +1 -1
package/README.md
CHANGED
package/dist/connect.cjs
CHANGED
|
@@ -3015,6 +3015,93 @@ var SeamHttpNoiseSensors = class _SeamHttpNoiseSensors {
|
|
|
3015
3015
|
}
|
|
3016
3016
|
};
|
|
3017
3017
|
|
|
3018
|
+
// src/lib/seam/connect/routes/phones-simulate.ts
|
|
3019
|
+
var SeamHttpPhonesSimulate = class _SeamHttpPhonesSimulate {
|
|
3020
|
+
constructor(apiKeyOrOptions = {}) {
|
|
3021
|
+
const options = parseOptions(apiKeyOrOptions);
|
|
3022
|
+
this.client = "client" in options ? options.client : createClient(options);
|
|
3023
|
+
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
3024
|
+
}
|
|
3025
|
+
static fromClient(client, options = {}) {
|
|
3026
|
+
const constructorOptions = { ...options, client };
|
|
3027
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
3028
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
3029
|
+
}
|
|
3030
|
+
return new _SeamHttpPhonesSimulate(constructorOptions);
|
|
3031
|
+
}
|
|
3032
|
+
static fromApiKey(apiKey, options = {}) {
|
|
3033
|
+
const constructorOptions = { ...options, apiKey };
|
|
3034
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
3035
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
3036
|
+
}
|
|
3037
|
+
return new _SeamHttpPhonesSimulate(constructorOptions);
|
|
3038
|
+
}
|
|
3039
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
3040
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
3041
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
3042
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
3043
|
+
}
|
|
3044
|
+
return new _SeamHttpPhonesSimulate(constructorOptions);
|
|
3045
|
+
}
|
|
3046
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
3047
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
3048
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
3049
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
3050
|
+
throw new SeamHttpInvalidOptionsError(
|
|
3051
|
+
"The client option cannot be used with SeamHttp.fromPublishableKey"
|
|
3052
|
+
);
|
|
3053
|
+
}
|
|
3054
|
+
const client = createClient(clientOptions);
|
|
3055
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
3056
|
+
const { token } = await clientSessions.getOrCreate({
|
|
3057
|
+
user_identifier_key: userIdentifierKey
|
|
3058
|
+
});
|
|
3059
|
+
return _SeamHttpPhonesSimulate.fromClientSessionToken(token, options);
|
|
3060
|
+
}
|
|
3061
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
3062
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
3063
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
3064
|
+
throw new SeamHttpInvalidOptionsError(
|
|
3065
|
+
"Missing consoleSessionToken or workspaceId"
|
|
3066
|
+
);
|
|
3067
|
+
}
|
|
3068
|
+
return new _SeamHttpPhonesSimulate(constructorOptions);
|
|
3069
|
+
}
|
|
3070
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
3071
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
3072
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
3073
|
+
throw new SeamHttpInvalidOptionsError(
|
|
3074
|
+
"Missing personalAccessToken or workspaceId"
|
|
3075
|
+
);
|
|
3076
|
+
}
|
|
3077
|
+
return new _SeamHttpPhonesSimulate(constructorOptions);
|
|
3078
|
+
}
|
|
3079
|
+
async updateClientSessionToken(clientSessionToken) {
|
|
3080
|
+
const { headers } = this.client.defaults;
|
|
3081
|
+
const authHeaders = getAuthHeadersForClientSessionToken({
|
|
3082
|
+
clientSessionToken
|
|
3083
|
+
});
|
|
3084
|
+
for (const key of Object.keys(authHeaders)) {
|
|
3085
|
+
if (headers[key] == null) {
|
|
3086
|
+
throw new Error(
|
|
3087
|
+
"Cannot update a clientSessionToken on a client created without a clientSessionToken"
|
|
3088
|
+
);
|
|
3089
|
+
}
|
|
3090
|
+
}
|
|
3091
|
+
this.client.defaults.headers = { ...headers, ...authHeaders };
|
|
3092
|
+
const clientSessions = SeamHttpClientSessions.fromClient(this.client);
|
|
3093
|
+
await clientSessions.get();
|
|
3094
|
+
}
|
|
3095
|
+
async createSandboxPhone(body) {
|
|
3096
|
+
const { data } = await this.client.request({
|
|
3097
|
+
url: "/phones/simulate/create_sandbox_phone",
|
|
3098
|
+
method: "post",
|
|
3099
|
+
data: body
|
|
3100
|
+
});
|
|
3101
|
+
return data.phone;
|
|
3102
|
+
}
|
|
3103
|
+
};
|
|
3104
|
+
|
|
3018
3105
|
// src/lib/seam/connect/routes/phones.ts
|
|
3019
3106
|
var SeamHttpPhones = class _SeamHttpPhones {
|
|
3020
3107
|
constructor(apiKeyOrOptions = {}) {
|
|
@@ -3092,6 +3179,9 @@ var SeamHttpPhones = class _SeamHttpPhones {
|
|
|
3092
3179
|
const clientSessions = SeamHttpClientSessions.fromClient(this.client);
|
|
3093
3180
|
await clientSessions.get();
|
|
3094
3181
|
}
|
|
3182
|
+
get simulate() {
|
|
3183
|
+
return SeamHttpPhonesSimulate.fromClient(this.client, this.defaults);
|
|
3184
|
+
}
|
|
3095
3185
|
async deactivate(body) {
|
|
3096
3186
|
await this.client.request({
|
|
3097
3187
|
url: "/phones/deactivate",
|
|
@@ -4106,6 +4196,7 @@ exports.SeamHttpNetworks = SeamHttpNetworks;
|
|
|
4106
4196
|
exports.SeamHttpNoiseSensors = SeamHttpNoiseSensors;
|
|
4107
4197
|
exports.SeamHttpNoiseSensorsNoiseThresholds = SeamHttpNoiseSensorsNoiseThresholds;
|
|
4108
4198
|
exports.SeamHttpPhones = SeamHttpPhones;
|
|
4199
|
+
exports.SeamHttpPhonesSimulate = SeamHttpPhonesSimulate;
|
|
4109
4200
|
exports.SeamHttpThermostats = SeamHttpThermostats;
|
|
4110
4201
|
exports.SeamHttpThermostatsClimateSettingSchedules = SeamHttpThermostatsClimateSettingSchedules;
|
|
4111
4202
|
exports.SeamHttpUnauthorizedError = SeamHttpUnauthorizedError;
|