@wats/graph 0.3.1 → 0.3.3
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/client.d.ts +2 -2
- package/dist/client.js +3 -3
- package/dist/createFetchTransport.d.ts +1 -1
- package/dist/createFetchTransport.js +1 -1
- package/dist/createMockTransport.d.ts +1 -1
- package/dist/endpoint.d.ts +1 -1
- package/dist/endpoint.js +1 -1
- package/dist/endpoints/businessManagement.d.ts +153 -9
- package/dist/endpoints/businessManagement.js +279 -7
- package/dist/endpoints/calling.d.ts +7 -7
- package/dist/endpoints/calling.js +2 -2
- package/dist/endpoints/flows/callables.d.ts +10 -10
- package/dist/endpoints/flows/callables.js +2 -2
- package/dist/endpoints/flows/dataExchange.d.ts +1 -1
- package/dist/endpoints/flows/dataExchange.js +2 -2
- package/dist/endpoints/flows/flowJson.d.ts +1 -1
- package/dist/endpoints/flows/flowJson.js +1 -1
- package/dist/endpoints/flows/index.d.ts +6 -6
- package/dist/endpoints/flows/index.js +4 -4
- package/dist/endpoints/flows/shared.d.ts +1 -1
- package/dist/endpoints/flows/shared.js +1 -1
- package/dist/endpoints/flows/types.d.ts +1 -1
- package/dist/endpoints/flows.d.ts +2 -2
- package/dist/endpoints/flows.js +1 -1
- package/dist/endpoints/media.d.ts +1 -1
- package/dist/endpoints/media.js +1 -1
- package/dist/endpoints/messages/builders-basic.d.ts +11 -0
- package/dist/endpoints/messages/builders-basic.js +272 -0
- package/dist/endpoints/messages/builders-interactive.d.ts +11 -0
- package/dist/endpoints/messages/builders-interactive.js +156 -0
- package/dist/endpoints/messages/builders-template.d.ts +3 -0
- package/dist/endpoints/messages/builders-template.js +121 -0
- package/dist/endpoints/messages/callables.d.ts +31 -0
- package/dist/endpoints/messages/callables.js +57 -0
- package/dist/endpoints/messages/index.d.ts +6 -0
- package/dist/endpoints/messages/index.js +56 -0
- package/dist/endpoints/messages/types.d.ts +363 -0
- package/dist/endpoints/messages/types.js +0 -0
- package/dist/endpoints/messages/validation.d.ts +43 -0
- package/dist/endpoints/messages/validation.js +277 -0
- package/dist/endpoints/messages.d.ts +1 -375
- package/dist/endpoints/messages.js +1 -675
- package/dist/endpoints/templates/builders.d.ts +1 -1
- package/dist/endpoints/templates/builders.js +24 -1
- package/dist/endpoints/templates/callables.d.ts +7 -6
- package/dist/endpoints/templates/callables.js +7 -5
- package/dist/endpoints/templates/groups.d.ts +126 -0
- package/dist/endpoints/templates/groups.js +156 -0
- package/dist/endpoints/templates/index.d.ts +7 -5
- package/dist/endpoints/templates/index.js +11 -3
- package/dist/endpoints/templates/shared.d.ts +2 -2
- package/dist/endpoints/templates/shared.js +1 -1
- package/dist/endpoints/templates/types.d.ts +15 -2
- package/dist/endpoints/templates/validation.d.ts +1 -1
- package/dist/endpoints/templates/validation.js +2 -2
- package/dist/endpoints/templates.d.ts +2 -2
- package/dist/endpoints/templates.js +7 -1
- package/dist/endpoints/waba/index.d.ts +4 -4
- package/dist/endpoints/waba/index.js +1 -1
- package/dist/endpoints/waba/phoneNumbers.d.ts +6 -4
- package/dist/endpoints/waba/phoneNumbers.js +3 -3
- package/dist/endpoints/wabaEndpoints.d.ts +6 -6
- package/dist/endpoints/wabaEndpoints.js +9 -3
- package/dist/errorRegistry.d.ts +1 -1
- package/dist/errorSubclasses.d.ts +30 -2
- package/dist/errorSubclasses.js +65 -2
- package/dist/errors.js +1 -1
- package/dist/index.d.ts +20 -20
- package/dist/index.js +15 -15
- package/dist/internal/validation/arrays.js +2 -2
- package/dist/internal/validation/errors.d.ts +1 -1
- package/dist/internal/validation/errors.js +1 -1
- package/dist/internal/validation/headers.js +3 -3
- package/dist/internal/validation/index.d.ts +8 -8
- package/dist/internal/validation/index.js +8 -8
- package/dist/internal/validation/json.js +4 -4
- package/dist/internal/validation/options.js +2 -2
- package/dist/internal/validation/paths.js +2 -2
- package/dist/internal/validation/records.js +2 -2
- package/dist/internal/validation/strings.js +1 -1
- package/dist/pagination.d.ts +2 -2
- package/dist/subclients/phoneNumberClient.d.ts +21 -5
- package/dist/subclients/phoneNumberClient.js +78 -7
- package/dist/subclients/wabaClient.d.ts +19 -5
- package/dist/subclients/wabaClient.js +39 -6
- package/package.json +10 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { listPhoneNumbers } from "./waba/index";
|
|
1
|
+
export { listPhoneNumbers } from "./waba/index.js";
|
|
2
2
|
export {
|
|
3
3
|
buildCreateMessageTemplateBody,
|
|
4
4
|
buildUpdateMessageTemplateBody,
|
|
@@ -11,8 +11,14 @@ export {
|
|
|
11
11
|
getMessageTemplate,
|
|
12
12
|
listMessageTemplates,
|
|
13
13
|
updateMessageTemplate,
|
|
14
|
+
listTemplateGroups,
|
|
15
|
+
createTemplateGroup,
|
|
16
|
+
getTemplateGroup,
|
|
17
|
+
updateTemplateGroup,
|
|
18
|
+
deleteTemplateGroup,
|
|
19
|
+
getTemplateGroupAnalytics,
|
|
14
20
|
validateTemplateParameterCounts
|
|
15
|
-
} from "./templates/index";
|
|
21
|
+
} from "./templates/index.js";
|
|
16
22
|
export {
|
|
17
23
|
FLOW_JSON_MAX_ARRAY_LENGTH,
|
|
18
24
|
FLOW_JSON_MAX_BYTES,
|
|
@@ -35,4 +41,4 @@ export {
|
|
|
35
41
|
updateFlowJson,
|
|
36
42
|
updateFlowMetadata,
|
|
37
43
|
validateFlowJson
|
|
38
|
-
} from "./flows/index";
|
|
44
|
+
} from "./flows/index.js";
|
package/dist/errorRegistry.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GraphApiError, GraphAuthError, GraphRateLimitError } from "./errors";
|
|
2
|
-
import { type GraphErrorFactoryContext } from "./errorRegistry";
|
|
1
|
+
import { GraphApiError, GraphAuthError, GraphRateLimitError } from "./errors.js";
|
|
2
|
+
import { type GraphErrorFactoryContext } from "./errorRegistry.js";
|
|
3
3
|
export declare class AuthException extends GraphAuthError {
|
|
4
4
|
static readonly errorCode: 0;
|
|
5
5
|
constructor(ctx: GraphErrorFactoryContext);
|
|
@@ -134,6 +134,34 @@ export declare class TemplateDisabledError extends GraphApiError {
|
|
|
134
134
|
static readonly errorCode: 132016;
|
|
135
135
|
constructor(ctx: GraphErrorFactoryContext);
|
|
136
136
|
}
|
|
137
|
+
export declare class InvalidTemplateParameterError extends GraphApiError {
|
|
138
|
+
static readonly errorCode: 132018;
|
|
139
|
+
constructor(ctx: GraphErrorFactoryContext);
|
|
140
|
+
}
|
|
141
|
+
export declare class TemplateClassificationRateLimitError extends GraphApiError {
|
|
142
|
+
static readonly errorCode: 131064;
|
|
143
|
+
constructor(ctx: GraphErrorFactoryContext);
|
|
144
|
+
}
|
|
145
|
+
export declare class MarketingMessagesLiteUnsupportedMessageTypeError extends GraphApiError {
|
|
146
|
+
static readonly errorCode: 134100;
|
|
147
|
+
constructor(ctx: GraphErrorFactoryContext);
|
|
148
|
+
}
|
|
149
|
+
export declare class MarketingMessagesLiteUnsupportedTemplateCategoryError extends GraphApiError {
|
|
150
|
+
static readonly errorCode: 134101;
|
|
151
|
+
constructor(ctx: GraphErrorFactoryContext);
|
|
152
|
+
}
|
|
153
|
+
export declare class MarketingMessagesLiteInvalidFlowError extends GraphApiError {
|
|
154
|
+
static readonly errorCode: 134102;
|
|
155
|
+
constructor(ctx: GraphErrorFactoryContext);
|
|
156
|
+
}
|
|
157
|
+
export declare class MarketingMessagesLiteUnsupportedTemplateStructureError extends GraphApiError {
|
|
158
|
+
static readonly errorCode: 134103;
|
|
159
|
+
constructor(ctx: GraphErrorFactoryContext);
|
|
160
|
+
}
|
|
161
|
+
export declare class InvalidTemplateCursorError extends GraphApiError {
|
|
162
|
+
static readonly errorCode: 131059;
|
|
163
|
+
constructor(ctx: GraphErrorFactoryContext);
|
|
164
|
+
}
|
|
137
165
|
export declare class FlowBlockedError extends GraphApiError {
|
|
138
166
|
static readonly errorCode: 132068;
|
|
139
167
|
constructor(ctx: GraphErrorFactoryContext);
|
package/dist/errorSubclasses.js
CHANGED
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
GraphApiError,
|
|
3
3
|
GraphAuthError,
|
|
4
4
|
GraphRateLimitError
|
|
5
|
-
} from "./errors";
|
|
5
|
+
} from "./errors.js";
|
|
6
6
|
import {
|
|
7
7
|
isBuiltInRegistered,
|
|
8
8
|
markBuiltInRegistered,
|
|
9
9
|
registerErrorCode
|
|
10
|
-
} from "./errorRegistry";
|
|
10
|
+
} from "./errorRegistry.js";
|
|
11
11
|
function messageOf(ctx, fallback) {
|
|
12
12
|
const payload = ctx.payload;
|
|
13
13
|
if (payload !== undefined && typeof payload.message === "string" && payload.message.length > 0) {
|
|
@@ -266,6 +266,62 @@ export class TemplateDisabledError extends GraphApiError {
|
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
+
export class InvalidTemplateParameterError extends GraphApiError {
|
|
270
|
+
static errorCode = 132018;
|
|
271
|
+
constructor(ctx) {
|
|
272
|
+
super(coreParams(ctx, "Template message has invalid parameters."));
|
|
273
|
+
this.name = "InvalidTemplateParameterError";
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export class TemplateClassificationRateLimitError extends GraphApiError {
|
|
278
|
+
static errorCode = 131064;
|
|
279
|
+
constructor(ctx) {
|
|
280
|
+
super(coreParams(ctx, "Template classification rate limit reached."));
|
|
281
|
+
this.name = "TemplateClassificationRateLimitError";
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export class MarketingMessagesLiteUnsupportedMessageTypeError extends GraphApiError {
|
|
286
|
+
static errorCode = 134100;
|
|
287
|
+
constructor(ctx) {
|
|
288
|
+
super(coreParams(ctx, "Marketing Messages Lite does not support this message type."));
|
|
289
|
+
this.name = "MarketingMessagesLiteUnsupportedMessageTypeError";
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export class MarketingMessagesLiteUnsupportedTemplateCategoryError extends GraphApiError {
|
|
294
|
+
static errorCode = 134101;
|
|
295
|
+
constructor(ctx) {
|
|
296
|
+
super(coreParams(ctx, "Marketing Messages Lite does not support this template category."));
|
|
297
|
+
this.name = "MarketingMessagesLiteUnsupportedTemplateCategoryError";
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export class MarketingMessagesLiteInvalidFlowError extends GraphApiError {
|
|
302
|
+
static errorCode = 134102;
|
|
303
|
+
constructor(ctx) {
|
|
304
|
+
super(coreParams(ctx, "Marketing Messages Lite Flow is invalid."));
|
|
305
|
+
this.name = "MarketingMessagesLiteInvalidFlowError";
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export class MarketingMessagesLiteUnsupportedTemplateStructureError extends GraphApiError {
|
|
310
|
+
static errorCode = 134103;
|
|
311
|
+
constructor(ctx) {
|
|
312
|
+
super(coreParams(ctx, "Marketing Messages Lite does not support this template structure."));
|
|
313
|
+
this.name = "MarketingMessagesLiteUnsupportedTemplateStructureError";
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
export class InvalidTemplateCursorError extends GraphApiError {
|
|
318
|
+
static errorCode = 131059;
|
|
319
|
+
constructor(ctx) {
|
|
320
|
+
super(coreParams(ctx, "Invalid message_templates cursor."));
|
|
321
|
+
this.name = "InvalidTemplateCursorError";
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
269
325
|
export class FlowBlockedError extends GraphApiError {
|
|
270
326
|
static errorCode = 132068;
|
|
271
327
|
constructor(ctx) {
|
|
@@ -560,6 +616,7 @@ const BUILT_IN_SEEDS = [
|
|
|
560
616
|
{ code: 132012, errorName: "TemplateParamFormatMismatchError", factory: (ctx) => new TemplateParamFormatMismatchError(ctx) },
|
|
561
617
|
{ code: 132015, errorName: "TemplatePausedError", factory: (ctx) => new TemplatePausedError(ctx) },
|
|
562
618
|
{ code: 132016, errorName: "TemplateDisabledError", factory: (ctx) => new TemplateDisabledError(ctx) },
|
|
619
|
+
{ code: 132018, errorName: "InvalidTemplateParameterError", factory: (ctx) => new InvalidTemplateParameterError(ctx) },
|
|
563
620
|
{ code: 132068, errorName: "FlowBlockedError", factory: (ctx) => new FlowBlockedError(ctx) },
|
|
564
621
|
{ code: 132069, errorName: "FlowThrottledError", factory: (ctx) => new FlowThrottledError(ctx) },
|
|
565
622
|
{ code: 135000, errorName: "GenericError", factory: (ctx) => new GenericError(ctx) },
|
|
@@ -571,6 +628,8 @@ const BUILT_IN_SEEDS = [
|
|
|
571
628
|
{ code: 131044, errorName: "BusinessPaymentIssueError", factory: (ctx) => new BusinessPaymentIssueError(ctx) },
|
|
572
629
|
{ code: 131045, errorName: "IncorrectCertificateError", factory: (ctx) => new IncorrectCertificateError(ctx) },
|
|
573
630
|
{ code: 131057, errorName: "AccountInMaintenanceModeError", factory: (ctx) => new AccountInMaintenanceModeError(ctx) },
|
|
631
|
+
{ code: 131059, errorName: "InvalidTemplateCursorError", factory: (ctx) => new InvalidTemplateCursorError(ctx) },
|
|
632
|
+
{ code: 131064, errorName: "TemplateClassificationRateLimitError", factory: (ctx) => new TemplateClassificationRateLimitError(ctx) },
|
|
574
633
|
{ code: 131050, errorName: "UserStoppedMarketingMessagesError", factory: (ctx) => new UserStoppedMarketingMessagesError(ctx) },
|
|
575
634
|
{ code: 137000, errorName: "RecipientIdentityKeyMismatchError", factory: (ctx) => new RecipientIdentityKeyMismatchError(ctx) },
|
|
576
635
|
{ code: 139000, errorName: "FlowBlockedByIntegrityError", factory: (ctx) => new FlowBlockedByIntegrityError(ctx) },
|
|
@@ -582,6 +641,10 @@ const BUILT_IN_SEEDS = [
|
|
|
582
641
|
{ code: 139101, errorName: "BlockListLimitReachedError", factory: (ctx) => new BlockListLimitReachedError(ctx) },
|
|
583
642
|
{ code: 139102, errorName: "BlockListConcurrentUpdateError", factory: (ctx) => new BlockListConcurrentUpdateError(ctx) },
|
|
584
643
|
{ code: 139103, errorName: "BlockUserInternalError", factory: (ctx) => new BlockUserInternalError(ctx) },
|
|
644
|
+
{ code: 134100, errorName: "MarketingMessagesLiteUnsupportedMessageTypeError", factory: (ctx) => new MarketingMessagesLiteUnsupportedMessageTypeError(ctx) },
|
|
645
|
+
{ code: 134101, errorName: "MarketingMessagesLiteUnsupportedTemplateCategoryError", factory: (ctx) => new MarketingMessagesLiteUnsupportedTemplateCategoryError(ctx) },
|
|
646
|
+
{ code: 134102, errorName: "MarketingMessagesLiteInvalidFlowError", factory: (ctx) => new MarketingMessagesLiteInvalidFlowError(ctx) },
|
|
647
|
+
{ code: 134103, errorName: "MarketingMessagesLiteUnsupportedTemplateStructureError", factory: (ctx) => new MarketingMessagesLiteUnsupportedTemplateStructureError(ctx) },
|
|
585
648
|
{ code: 138000, errorName: "CallingNotEnabledError", factory: (ctx) => new CallingNotEnabledError(ctx) },
|
|
586
649
|
{ code: 138018, errorName: "CallingCannotBeEnabledError", factory: (ctx) => new CallingCannotBeEnabledError(ctx) },
|
|
587
650
|
{ code: 138001, errorName: "ReceiverUncallableError", factory: (ctx) => new ReceiverUncallableError(ctx) },
|
package/dist/errors.js
CHANGED
|
@@ -244,7 +244,7 @@ export function createGraphApiError(params) {
|
|
|
244
244
|
}
|
|
245
245
|
return new GraphApiError(ctorParams);
|
|
246
246
|
}
|
|
247
|
-
import { resolveRegisteredError as _resolveRegisteredError } from "./errorRegistry";
|
|
247
|
+
import { resolveRegisteredError as _resolveRegisteredError } from "./errorRegistry.js";
|
|
248
248
|
function resolveRegisteredErrorSafely(code, subcode) {
|
|
249
249
|
return _resolveRegisteredError(code, subcode);
|
|
250
250
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export * from "./client";
|
|
2
|
-
export * from "./errors";
|
|
3
|
-
export * from "./errorRegistry";
|
|
4
|
-
export * from "./errorSubclasses";
|
|
5
|
-
export * from "./endpoints/messages";
|
|
6
|
-
export * from "./endpoints/calling";
|
|
7
|
-
export * from "./endpoints/businessManagement";
|
|
8
|
-
export * from "./endpoints/wabaEndpoints";
|
|
9
|
-
export * from "./endpoint";
|
|
10
|
-
export { PhoneNumberClient, validatePhoneNumberClientConfig } from "./subclients/phoneNumberClient";
|
|
11
|
-
export type { PhoneNumberClientConfig } from "./subclients/phoneNumberClient";
|
|
12
|
-
export { WABAClient, validateWABAClientConfig } from "./subclients/wabaClient";
|
|
13
|
-
export type { WABAClientConfig } from "./subclients/wabaClient";
|
|
14
|
-
export * from "./transport";
|
|
15
|
-
export { createFetchTransport } from "./createFetchTransport";
|
|
16
|
-
export type { CreateFetchTransportOptions } from "./createFetchTransport";
|
|
17
|
-
export { paginate, paginateAll, PaginationError } from "./pagination";
|
|
18
|
-
export type { PaginationOptions, PaginatedResult, PaginatedPage, PaginationErrorCode } from "./pagination";
|
|
19
|
-
export { uploadMedia, downloadMedia, deleteMedia, downloadMediaBytes, decryptEncryptedMedia, createUploadSession, uploadFileToSession, getUploadSession, MediaNotImplementedError, MediaValidationError, MediaCryptoError, MediaIntegrityError, DEFAULT_MAX_MEDIA_UPLOAD_BYTES, MAX_MEDIA_UPLOAD_BYTES, DEFAULT_MAX_MEDIA_DOWNLOAD_BYTES, MAX_MEDIA_DOWNLOAD_BYTES, DEFAULT_MAX_UPLOAD_SESSION_BYTES, MAX_UPLOAD_SESSION_BYTES, MEDIA_LINEAR_ISSUE_UPLOAD, MEDIA_LINEAR_ISSUE_DOWNLOAD, MEDIA_LINEAR_ISSUE_DELETE, MEDIA_LINEAR_ISSUE_DECRYPT } from "./endpoints/media";
|
|
20
|
-
export type { MediaOperation, MediaNotImplementedCode, MediaValidationErrorCode, MediaCryptoErrorCode, MediaIntegrityErrorCode, MediaUploadBody, MediaUploadOptions, MediaUploadResponse, MediaDownloadOptions, MediaDownloadResponse, MediaDeleteOptions, MediaDeleteResponse, MediaDownloadBytesOptions, MediaDownloadBytesResponse, EncryptedMediaBundle, CreateUploadSessionParams, UploadSessionOptions, CreateUploadSessionResponse, UploadFileToSessionParams, UploadFileToSessionResponse, GetUploadSessionParams, GetUploadSessionResponse } from "./endpoints/media";
|
|
1
|
+
export * from "./client.js";
|
|
2
|
+
export * from "./errors.js";
|
|
3
|
+
export * from "./errorRegistry.js";
|
|
4
|
+
export * from "./errorSubclasses.js";
|
|
5
|
+
export * from "./endpoints/messages.js";
|
|
6
|
+
export * from "./endpoints/calling.js";
|
|
7
|
+
export * from "./endpoints/businessManagement.js";
|
|
8
|
+
export * from "./endpoints/wabaEndpoints.js";
|
|
9
|
+
export * from "./endpoint.js";
|
|
10
|
+
export { PhoneNumberClient, validatePhoneNumberClientConfig } from "./subclients/phoneNumberClient.js";
|
|
11
|
+
export type { PhoneNumberClientConfig } from "./subclients/phoneNumberClient.js";
|
|
12
|
+
export { WABAClient, validateWABAClientConfig } from "./subclients/wabaClient.js";
|
|
13
|
+
export type { WABAClientConfig } from "./subclients/wabaClient.js";
|
|
14
|
+
export * from "./transport.js";
|
|
15
|
+
export { createFetchTransport } from "./createFetchTransport.js";
|
|
16
|
+
export type { CreateFetchTransportOptions } from "./createFetchTransport.js";
|
|
17
|
+
export { paginate, paginateAll, PaginationError } from "./pagination.js";
|
|
18
|
+
export type { PaginationOptions, PaginatedResult, PaginatedPage, PaginationErrorCode } from "./pagination.js";
|
|
19
|
+
export { uploadMedia, downloadMedia, deleteMedia, downloadMediaBytes, decryptEncryptedMedia, createUploadSession, uploadFileToSession, getUploadSession, MediaNotImplementedError, MediaValidationError, MediaCryptoError, MediaIntegrityError, DEFAULT_MAX_MEDIA_UPLOAD_BYTES, MAX_MEDIA_UPLOAD_BYTES, DEFAULT_MAX_MEDIA_DOWNLOAD_BYTES, MAX_MEDIA_DOWNLOAD_BYTES, DEFAULT_MAX_UPLOAD_SESSION_BYTES, MAX_UPLOAD_SESSION_BYTES, MEDIA_LINEAR_ISSUE_UPLOAD, MEDIA_LINEAR_ISSUE_DOWNLOAD, MEDIA_LINEAR_ISSUE_DELETE, MEDIA_LINEAR_ISSUE_DECRYPT } from "./endpoints/media.js";
|
|
20
|
+
export type { MediaOperation, MediaNotImplementedCode, MediaValidationErrorCode, MediaCryptoErrorCode, MediaIntegrityErrorCode, MediaUploadBody, MediaUploadOptions, MediaUploadResponse, MediaDownloadOptions, MediaDownloadResponse, MediaDeleteOptions, MediaDeleteResponse, MediaDownloadBytesOptions, MediaDownloadBytesResponse, EncryptedMediaBundle, CreateUploadSessionParams, UploadSessionOptions, CreateUploadSessionResponse, UploadFileToSessionParams, UploadFileToSessionResponse, GetUploadSessionParams, GetUploadSessionResponse } from "./endpoints/media.js";
|
package/dist/index.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
export * from "./client";
|
|
2
|
-
export * from "./errors";
|
|
3
|
-
export * from "./errorRegistry";
|
|
4
|
-
export * from "./errorSubclasses";
|
|
5
|
-
export * from "./endpoints/messages";
|
|
6
|
-
export * from "./endpoints/calling";
|
|
7
|
-
export * from "./endpoints/businessManagement";
|
|
8
|
-
export * from "./endpoints/wabaEndpoints";
|
|
9
|
-
export * from "./endpoint";
|
|
1
|
+
export * from "./client.js";
|
|
2
|
+
export * from "./errors.js";
|
|
3
|
+
export * from "./errorRegistry.js";
|
|
4
|
+
export * from "./errorSubclasses.js";
|
|
5
|
+
export * from "./endpoints/messages.js";
|
|
6
|
+
export * from "./endpoints/calling.js";
|
|
7
|
+
export * from "./endpoints/businessManagement.js";
|
|
8
|
+
export * from "./endpoints/wabaEndpoints.js";
|
|
9
|
+
export * from "./endpoint.js";
|
|
10
10
|
export {
|
|
11
11
|
PhoneNumberClient,
|
|
12
12
|
validatePhoneNumberClientConfig
|
|
13
|
-
} from "./subclients/phoneNumberClient";
|
|
13
|
+
} from "./subclients/phoneNumberClient.js";
|
|
14
14
|
export {
|
|
15
15
|
WABAClient,
|
|
16
16
|
validateWABAClientConfig
|
|
17
|
-
} from "./subclients/wabaClient";
|
|
18
|
-
export * from "./transport";
|
|
19
|
-
export { createFetchTransport } from "./createFetchTransport";
|
|
17
|
+
} from "./subclients/wabaClient.js";
|
|
18
|
+
export * from "./transport.js";
|
|
19
|
+
export { createFetchTransport } from "./createFetchTransport.js";
|
|
20
20
|
export {
|
|
21
21
|
paginate,
|
|
22
22
|
paginateAll,
|
|
23
23
|
PaginationError
|
|
24
|
-
} from "./pagination";
|
|
24
|
+
} from "./pagination.js";
|
|
25
25
|
export {
|
|
26
26
|
uploadMedia,
|
|
27
27
|
downloadMedia,
|
|
@@ -45,4 +45,4 @@ export {
|
|
|
45
45
|
MEDIA_LINEAR_ISSUE_DOWNLOAD,
|
|
46
46
|
MEDIA_LINEAR_ISSUE_DELETE,
|
|
47
47
|
MEDIA_LINEAR_ISSUE_DECRYPT
|
|
48
|
-
} from "./endpoints/media";
|
|
48
|
+
} from "./endpoints/media.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { graphValidationError, wrapGraphValidation } from "./errors";
|
|
2
|
-
import { assertQueryString } from "./strings";
|
|
1
|
+
import { graphValidationError, wrapGraphValidation } from "./errors.js";
|
|
2
|
+
import { assertQueryString } from "./strings.js";
|
|
3
3
|
function isUnsafePrototypeKey(key) {
|
|
4
4
|
return key === "__proto__" || key === "constructor" || key === "prototype";
|
|
5
5
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { GraphRequestValidationError } from "../../errors";
|
|
1
|
+
import { GraphRequestValidationError } from "../../errors.js";
|
|
2
2
|
export declare function graphValidationError(message: string, cause?: unknown): GraphRequestValidationError;
|
|
3
3
|
export declare function wrapGraphValidation<T>(message: string, fn: () => T): T;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { graphValidationError, wrapGraphValidation } from "./errors";
|
|
2
|
-
import { hasAsciiControlChar } from "./strings";
|
|
3
|
-
import { isUnsafePrototypeKey } from "./records";
|
|
1
|
+
import { graphValidationError, wrapGraphValidation } from "./errors.js";
|
|
2
|
+
import { hasAsciiControlChar } from "./strings.js";
|
|
3
|
+
import { isUnsafePrototypeKey } from "./records.js";
|
|
4
4
|
function invalidTypeMessage(opts) {
|
|
5
5
|
return opts.invalidTypeMessage ?? `Invalid ${opts.helperName} input: ${opts.path} must be a plain object.`;
|
|
6
6
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from "./arrays";
|
|
2
|
-
export * from "./errors";
|
|
3
|
-
export * from "./headers";
|
|
4
|
-
export * from "./json";
|
|
5
|
-
export * from "./options";
|
|
6
|
-
export * from "./paths";
|
|
7
|
-
export * from "./records";
|
|
8
|
-
export * from "./strings";
|
|
1
|
+
export * from "./arrays.js";
|
|
2
|
+
export * from "./errors.js";
|
|
3
|
+
export * from "./headers.js";
|
|
4
|
+
export * from "./json.js";
|
|
5
|
+
export * from "./options.js";
|
|
6
|
+
export * from "./paths.js";
|
|
7
|
+
export * from "./records.js";
|
|
8
|
+
export * from "./strings.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from "./arrays";
|
|
2
|
-
export * from "./errors";
|
|
3
|
-
export * from "./headers";
|
|
4
|
-
export * from "./json";
|
|
5
|
-
export * from "./options";
|
|
6
|
-
export * from "./paths";
|
|
7
|
-
export * from "./records";
|
|
8
|
-
export * from "./strings";
|
|
1
|
+
export * from "./arrays.js";
|
|
2
|
+
export * from "./errors.js";
|
|
3
|
+
export * from "./headers.js";
|
|
4
|
+
export * from "./json.js";
|
|
5
|
+
export * from "./options.js";
|
|
6
|
+
export * from "./paths.js";
|
|
7
|
+
export * from "./records.js";
|
|
8
|
+
export * from "./strings.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { assertDenseDataArray } from "./arrays";
|
|
2
|
-
import { graphValidationError, wrapGraphValidation } from "./errors";
|
|
3
|
-
import { assertPlainDataRecord } from "./records";
|
|
4
|
-
import { hasAsciiControlChar } from "./strings";
|
|
1
|
+
import { assertDenseDataArray } from "./arrays.js";
|
|
2
|
+
import { graphValidationError, wrapGraphValidation } from "./errors.js";
|
|
3
|
+
import { assertPlainDataRecord } from "./records.js";
|
|
4
|
+
import { hasAsciiControlChar } from "./strings.js";
|
|
5
5
|
function childPath(path, key) {
|
|
6
6
|
return /^[A-Za-z_$][A-Za-z0-9_$]*$/u.test(key) ? `${path}.${key}` : `${path}[${JSON.stringify(key)}]`;
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { graphValidationError, wrapGraphValidation } from "./errors";
|
|
2
|
-
import { assertPlainDataRecord } from "./records";
|
|
1
|
+
import { graphValidationError, wrapGraphValidation } from "./errors.js";
|
|
2
|
+
import { assertPlainDataRecord } from "./records.js";
|
|
3
3
|
export function copyOptionalParamsObject(params, helperName) {
|
|
4
4
|
if (params === undefined)
|
|
5
5
|
return {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { graphValidationError } from "./errors";
|
|
2
|
-
import { assertBoundedString, hasAsciiControlChar } from "./strings";
|
|
1
|
+
import { graphValidationError } from "./errors.js";
|
|
2
|
+
import { assertBoundedString, hasAsciiControlChar } from "./strings.js";
|
|
3
3
|
function assertSafePathSegmentString(value, opts) {
|
|
4
4
|
if (hasAsciiControlChar(value)) {
|
|
5
5
|
throw graphValidationError(`Invalid ${opts.helperName} input: ${opts.fieldName} must not contain control characters.`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { graphValidationError, wrapGraphValidation } from "./errors";
|
|
2
|
-
import { hasAsciiControlChar } from "./strings";
|
|
1
|
+
import { graphValidationError, wrapGraphValidation } from "./errors.js";
|
|
2
|
+
import { hasAsciiControlChar } from "./strings.js";
|
|
3
3
|
export function isUnsafePrototypeKey(key) {
|
|
4
4
|
return key === "__proto__" || key === "constructor" || key === "prototype";
|
|
5
5
|
}
|
package/dist/pagination.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { EndpointCallable } from "./endpoint";
|
|
2
|
-
import type { GraphClient } from "./client";
|
|
1
|
+
import type { EndpointCallable } from "./endpoint.js";
|
|
2
|
+
import type { GraphClient } from "./client.js";
|
|
3
3
|
export interface PaginationOptions {
|
|
4
4
|
readonly maxPages?: number;
|
|
5
5
|
readonly pageSize?: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { GraphClient } from "../client";
|
|
2
|
-
import type { EndpointInvokeOptions } from "../endpoint";
|
|
3
|
-
import { type BusinessProfileResponse, type CommerceSettingsResponse, type GetBusinessProfileInput, type GetCommerceSettingsInput, type GetPhoneNumberInfoInput, type GetPhoneNumberSettingsInput, type PhoneNumberInfo, type PhoneNumberSettingsResponse } from "../endpoints/businessManagement";
|
|
4
|
-
import { type AcceptCallRequest, type CallLifecycleResponse, type InitiateCallRequest, type PreAcceptCallRequest, type RejectCallRequest, type TerminateCallRequest } from "../endpoints/calling";
|
|
5
|
-
import { type GraphMessagesMarkMessageAsReadInput, type GraphMessagesRemoveReactionInput, type GraphMessagesRequestLocationInput, type GraphMessagesSendAudioInput, type GraphMessagesSendBody, type GraphMessagesSendButtonsInput, type GraphMessagesSendCatalogInput, type GraphMessagesSendContactsInput, type GraphMessagesSendCtaUrlInput, type GraphMessagesSendDocumentInput, type GraphMessagesSendImageInput, type GraphMessagesSendListInput, type GraphMessagesSendLocationInput, type GraphMessagesSendProductInput, type GraphMessagesSendProductsInput, type GraphMessagesSendReactionInput, type GraphMessagesSendResponse, type GraphMessagesSendStickerInput, type GraphMessagesSendTemplateInput, type GraphMessagesSendTextInput, type GraphMessagesSendVideoInput, type GraphMessagesTypingIndicatorInput } from "../endpoints/messages";
|
|
1
|
+
import type { GraphClient } from "../client.js";
|
|
2
|
+
import type { EndpointInvokeOptions } from "../endpoint.js";
|
|
3
|
+
import { type BlockUsersInput, type BlockUsersResponse, type BlockedUsersResponse, type BusinessProfileResponse, type CommerceSettingsResponse, type GetBusinessProfileInput, type GetCommerceSettingsInput, type GetOfficialBusinessAccountStatusInput, type GetPhoneNumberInfoInput, type GetPhoneNumberSettingsInput, type ListBlockedUsersInput, type OfficialBusinessAccountReviewResponse, type OfficialBusinessAccountStatusResponse, type PhoneNumberInfo, type PhoneNumberSettingsResponse, type PhoneNumberSettingsUpdateResponse, type RequestOfficialBusinessAccountReviewInput, type SubmitDisplayNameForReviewInput, type SubmitDisplayNameForReviewResponse, type UnblockUsersInput, type UnblockUsersResponse, type UpdatePhoneNumberSettingsInput } from "../endpoints/businessManagement.js";
|
|
4
|
+
import { type AcceptCallRequest, type CallLifecycleResponse, type InitiateCallRequest, type PreAcceptCallRequest, type RejectCallRequest, type TerminateCallRequest } from "../endpoints/calling.js";
|
|
5
|
+
import { type GraphMessagesMarkMessageAsReadInput, type GraphMessagesRemoveReactionInput, type GraphMessagesRequestLocationInput, type GraphMessagesSendAudioInput, type GraphMessagesSendBody, type GraphMessagesSendButtonsInput, type GraphMessagesSendCallPermissionRequestInput, type GraphMessagesSendCatalogInput, type GraphMessagesSendContactsInput, type GraphMessagesSendCtaUrlInput, type GraphMessagesSendDocumentInput, type GraphMessagesSendImageInput, type GraphMessagesSendListInput, type GraphMessagesSendLocationInput, type GraphMessagesSendMarketingTemplateInput, type GraphMessagesMarketingTemplateResponse, type GraphMessagesSendProductInput, type GraphMessagesSendProductsInput, type GraphMessagesSendReactionInput, type GraphMessagesSendResponse, type GraphMessagesSendStickerInput, type GraphMessagesSendTemplateInput, type GraphMessagesSendTextInput, type GraphMessagesSendVideoInput, type GraphMessagesTypingIndicatorInput } from "../endpoints/messages.js";
|
|
6
6
|
export interface PhoneNumberClientConfig {
|
|
7
7
|
readonly graphClient: GraphClient;
|
|
8
8
|
readonly phoneNumberId: string;
|
|
@@ -17,10 +17,24 @@ export declare class PhoneNumberClient {
|
|
|
17
17
|
getInfo(params?: Omit<GetPhoneNumberInfoInput, "phoneNumberId">, opts?: EndpointInvokeOptions): Promise<PhoneNumberInfo>;
|
|
18
18
|
/** Graph `GET /{phoneNumberId}/settings`; includeSipCredentials responses may be sensitive. */
|
|
19
19
|
getSettings(params?: Omit<GetPhoneNumberSettingsInput, "phoneNumberId">, opts?: EndpointInvokeOptions): Promise<PhoneNumberSettingsResponse>;
|
|
20
|
+
/** Graph `POST /{phoneNumberId}/settings`; WATS-93 local-storage settings update. */
|
|
21
|
+
updateSettings(params: Omit<UpdatePhoneNumberSettingsInput, "phoneNumberId">, opts?: EndpointInvokeOptions): Promise<PhoneNumberSettingsUpdateResponse>;
|
|
20
22
|
/** Graph `GET /{phoneNumberId}/whatsapp_business_profile`. */
|
|
21
23
|
getBusinessProfile(params?: Omit<GetBusinessProfileInput, "phoneNumberId">, opts?: EndpointInvokeOptions): Promise<BusinessProfileResponse>;
|
|
22
24
|
/** Graph `GET /{phoneNumberId}/whatsapp_commerce_settings`. */
|
|
23
25
|
getCommerceSettings(params?: Omit<GetCommerceSettingsInput, "phoneNumberId">, opts?: EndpointInvokeOptions): Promise<CommerceSettingsResponse>;
|
|
26
|
+
/** Graph `GET /{phoneNumberId}/block_users`. */
|
|
27
|
+
listBlockedUsers(params?: Omit<ListBlockedUsersInput, "phoneNumberId">, opts?: EndpointInvokeOptions): Promise<BlockedUsersResponse>;
|
|
28
|
+
/** Graph `POST /{phoneNumberId}/block_users`. */
|
|
29
|
+
blockUsers(params: Omit<BlockUsersInput, "phoneNumberId">, opts?: EndpointInvokeOptions): Promise<BlockUsersResponse>;
|
|
30
|
+
/** Graph `DELETE /{phoneNumberId}/block_users`. */
|
|
31
|
+
unblockUsers(params: Omit<UnblockUsersInput, "phoneNumberId">, opts?: EndpointInvokeOptions): Promise<UnblockUsersResponse>;
|
|
32
|
+
/** Graph `GET /{phoneNumberId}/official_business_account`. */
|
|
33
|
+
getOfficialBusinessAccountStatus(params?: Omit<GetOfficialBusinessAccountStatusInput, "phoneNumberId">, opts?: EndpointInvokeOptions): Promise<OfficialBusinessAccountStatusResponse>;
|
|
34
|
+
/** Graph `POST /{phoneNumberId}/official_business_account`. */
|
|
35
|
+
requestOfficialBusinessAccountReview(params: Omit<RequestOfficialBusinessAccountReviewInput, "phoneNumberId">, opts?: EndpointInvokeOptions): Promise<OfficialBusinessAccountReviewResponse>;
|
|
36
|
+
/** Graph `POST /{phoneNumberId}` with Graph `new_display_name`. */
|
|
37
|
+
submitDisplayNameForReview(params: Omit<SubmitDisplayNameForReviewInput, "phoneNumberId">, opts?: EndpointInvokeOptions): Promise<SubmitDisplayNameForReviewResponse>;
|
|
24
38
|
/**
|
|
25
39
|
* Graph `POST /{phoneNumberId}/messages` — delegates to the F-6
|
|
26
40
|
* endpoint-registry `sendMessage` callable with the bound
|
|
@@ -36,6 +50,7 @@ export declare class PhoneNumberClient {
|
|
|
36
50
|
sendImage(input: GraphMessagesSendImageInput, opts?: EndpointInvokeOptions): Promise<GraphMessagesSendResponse>;
|
|
37
51
|
sendVideo(input: GraphMessagesSendVideoInput, opts?: EndpointInvokeOptions): Promise<GraphMessagesSendResponse>;
|
|
38
52
|
sendAudio(input: GraphMessagesSendAudioInput, opts?: EndpointInvokeOptions): Promise<GraphMessagesSendResponse>;
|
|
53
|
+
sendCallPermissionRequest(input: GraphMessagesSendCallPermissionRequestInput, opts?: EndpointInvokeOptions): Promise<GraphMessagesSendResponse>;
|
|
39
54
|
sendDocument(input: GraphMessagesSendDocumentInput, opts?: EndpointInvokeOptions): Promise<GraphMessagesSendResponse>;
|
|
40
55
|
sendSticker(input: GraphMessagesSendStickerInput, opts?: EndpointInvokeOptions): Promise<GraphMessagesSendResponse>;
|
|
41
56
|
sendLocation(input: GraphMessagesSendLocationInput, opts?: EndpointInvokeOptions): Promise<GraphMessagesSendResponse>;
|
|
@@ -52,6 +67,7 @@ export declare class PhoneNumberClient {
|
|
|
52
67
|
markMessageAsRead(input: GraphMessagesMarkMessageAsReadInput, opts?: EndpointInvokeOptions): Promise<GraphMessagesSendResponse>;
|
|
53
68
|
indicateTyping(input: GraphMessagesTypingIndicatorInput, opts?: EndpointInvokeOptions): Promise<GraphMessagesSendResponse>;
|
|
54
69
|
sendTemplate(input: GraphMessagesSendTemplateInput, opts?: EndpointInvokeOptions): Promise<GraphMessagesSendResponse>;
|
|
70
|
+
sendMarketingTemplate(input: GraphMessagesSendMarketingTemplateInput, opts?: EndpointInvokeOptions): Promise<GraphMessagesMarketingTemplateResponse>;
|
|
55
71
|
initiateCall(input: InitiateCallRequest, opts?: EndpointInvokeOptions): Promise<CallLifecycleResponse>;
|
|
56
72
|
preAcceptCall(input: PreAcceptCallRequest, opts?: EndpointInvokeOptions): Promise<CallLifecycleResponse>;
|
|
57
73
|
acceptCall(input: AcceptCallRequest, opts?: EndpointInvokeOptions): Promise<CallLifecycleResponse>;
|
|
@@ -22,6 +22,11 @@ export class PhoneNumberClient {
|
|
|
22
22
|
scopedParams.phoneNumberId = this.#phoneNumberId;
|
|
23
23
|
return getPhoneNumberSettingsEndpoint(this.#graphClient, scopedParams, undefined, opts);
|
|
24
24
|
}
|
|
25
|
+
async updateSettings(params, opts) {
|
|
26
|
+
const scopedParams = copyOptionalParamsObject(params, "PhoneNumberClient.updateSettings");
|
|
27
|
+
scopedParams.phoneNumberId = this.#phoneNumberId;
|
|
28
|
+
return updatePhoneNumberSettingsEndpoint(this.#graphClient, scopedParams, undefined, opts);
|
|
29
|
+
}
|
|
25
30
|
async getBusinessProfile(params, opts) {
|
|
26
31
|
const scopedParams = copyOptionalParamsObject(params, "PhoneNumberClient.getBusinessProfile");
|
|
27
32
|
scopedParams.phoneNumberId = this.#phoneNumberId;
|
|
@@ -32,6 +37,35 @@ export class PhoneNumberClient {
|
|
|
32
37
|
scopedParams.phoneNumberId = this.#phoneNumberId;
|
|
33
38
|
return getCommerceSettingsEndpoint(this.#graphClient, scopedParams, undefined, opts);
|
|
34
39
|
}
|
|
40
|
+
async listBlockedUsers(params, opts) {
|
|
41
|
+
copyOptionalParamsObject(params, "PhoneNumberClient.listBlockedUsers");
|
|
42
|
+
return listBlockedUsersEndpoint(this.#graphClient, { phoneNumberId: this.#phoneNumberId }, undefined, opts);
|
|
43
|
+
}
|
|
44
|
+
async blockUsers(params, opts) {
|
|
45
|
+
const scopedParams = copyOptionalParamsObject(params, "PhoneNumberClient.blockUsers");
|
|
46
|
+
scopedParams.phoneNumberId = this.#phoneNumberId;
|
|
47
|
+
return blockUsersEndpoint(this.#graphClient, scopedParams, undefined, opts);
|
|
48
|
+
}
|
|
49
|
+
async unblockUsers(params, opts) {
|
|
50
|
+
const scopedParams = copyOptionalParamsObject(params, "PhoneNumberClient.unblockUsers");
|
|
51
|
+
scopedParams.phoneNumberId = this.#phoneNumberId;
|
|
52
|
+
return unblockUsersEndpoint(this.#graphClient, scopedParams, undefined, opts);
|
|
53
|
+
}
|
|
54
|
+
async getOfficialBusinessAccountStatus(params, opts) {
|
|
55
|
+
const scopedParams = copyOptionalParamsObject(params, "PhoneNumberClient.getOfficialBusinessAccountStatus");
|
|
56
|
+
scopedParams.phoneNumberId = this.#phoneNumberId;
|
|
57
|
+
return getOfficialBusinessAccountStatusEndpoint(this.#graphClient, scopedParams, undefined, opts);
|
|
58
|
+
}
|
|
59
|
+
async requestOfficialBusinessAccountReview(params, opts) {
|
|
60
|
+
const scopedParams = copyOptionalParamsObject(params, "PhoneNumberClient.requestOfficialBusinessAccountReview");
|
|
61
|
+
scopedParams.phoneNumberId = this.#phoneNumberId;
|
|
62
|
+
return requestOfficialBusinessAccountReviewEndpoint(this.#graphClient, scopedParams, undefined, opts);
|
|
63
|
+
}
|
|
64
|
+
async submitDisplayNameForReview(params, opts) {
|
|
65
|
+
const scopedParams = copyOptionalParamsObject(params, "PhoneNumberClient.submitDisplayNameForReview");
|
|
66
|
+
scopedParams.phoneNumberId = this.#phoneNumberId;
|
|
67
|
+
return submitDisplayNameForReviewEndpoint(this.#graphClient, scopedParams, undefined, opts);
|
|
68
|
+
}
|
|
35
69
|
async sendMessage(body, opts) {
|
|
36
70
|
return sendMessageEndpoint(this.#graphClient, { phoneNumberId: this.#phoneNumberId }, body, opts);
|
|
37
71
|
}
|
|
@@ -47,6 +81,9 @@ export class PhoneNumberClient {
|
|
|
47
81
|
async sendAudio(input, opts) {
|
|
48
82
|
return this.sendMessage(buildSendAudioPayload(input), opts);
|
|
49
83
|
}
|
|
84
|
+
async sendCallPermissionRequest(input, opts) {
|
|
85
|
+
return this.sendMessage(buildSendCallPermissionRequestPayload(input), opts);
|
|
86
|
+
}
|
|
50
87
|
async sendDocument(input, opts) {
|
|
51
88
|
return this.sendMessage(buildSendDocumentPayload(input), opts);
|
|
52
89
|
}
|
|
@@ -95,6 +132,31 @@ export class PhoneNumberClient {
|
|
|
95
132
|
async sendTemplate(input, opts) {
|
|
96
133
|
return this.sendMessage(buildSendTemplatePayload(input), opts);
|
|
97
134
|
}
|
|
135
|
+
async sendMarketingTemplate(input, opts) {
|
|
136
|
+
try {
|
|
137
|
+
if (typeof input !== "object" || input === null) {
|
|
138
|
+
throw new GraphRequestValidationError("Invalid PhoneNumberClient.sendMarketingTemplate input: expected an options object.");
|
|
139
|
+
}
|
|
140
|
+
if (Array.isArray(input)) {
|
|
141
|
+
throw new GraphRequestValidationError("Invalid PhoneNumberClient.sendMarketingTemplate input: expected an options object.");
|
|
142
|
+
}
|
|
143
|
+
const record = input;
|
|
144
|
+
const descriptors = Object.getOwnPropertyDescriptors(record);
|
|
145
|
+
const body = {};
|
|
146
|
+
for (const [key, descriptor] of Object.entries(descriptors)) {
|
|
147
|
+
if (typeof descriptor.get === "function" || typeof descriptor.set === "function") {
|
|
148
|
+
throw new GraphRequestValidationError(`Invalid PhoneNumberClient.sendMarketingTemplate input: ${key} must not use accessors.`);
|
|
149
|
+
}
|
|
150
|
+
if (key !== "phoneNumberId" && descriptor.value !== undefined)
|
|
151
|
+
body[key] = descriptor.value;
|
|
152
|
+
}
|
|
153
|
+
return sendMarketingTemplateEndpoint(this.#graphClient, { phoneNumberId: this.#phoneNumberId }, body, opts);
|
|
154
|
+
} catch (error) {
|
|
155
|
+
if (error instanceof GraphRequestValidationError)
|
|
156
|
+
throw error;
|
|
157
|
+
throw new GraphRequestValidationError("Invalid PhoneNumberClient.sendMarketingTemplate input: body could not be inspected.");
|
|
158
|
+
}
|
|
159
|
+
}
|
|
98
160
|
async initiateCall(input, opts) {
|
|
99
161
|
return initiateCallEndpoint(this.#graphClient, { phoneNumberId: this.#phoneNumberId }, input, opts);
|
|
100
162
|
}
|
|
@@ -111,28 +173,36 @@ export class PhoneNumberClient {
|
|
|
111
173
|
return terminateCallEndpoint(this.#graphClient, { phoneNumberId: this.#phoneNumberId }, input, opts);
|
|
112
174
|
}
|
|
113
175
|
}
|
|
114
|
-
import { assertSafePathParamValue } from "../endpoint";
|
|
115
|
-
import { GraphRequestValidationError } from "../errors";
|
|
116
|
-
import { copyOptionalParamsObject } from "../internal/validation/options";
|
|
176
|
+
import { assertSafePathParamValue } from "../endpoint.js";
|
|
177
|
+
import { GraphRequestValidationError } from "../errors.js";
|
|
178
|
+
import { copyOptionalParamsObject } from "../internal/validation/options.js";
|
|
117
179
|
import {
|
|
118
180
|
getBusinessProfile as getBusinessProfileEndpoint,
|
|
119
181
|
getCommerceSettings as getCommerceSettingsEndpoint,
|
|
120
182
|
getPhoneNumberInfo as getPhoneNumberInfoEndpoint,
|
|
121
|
-
getPhoneNumberSettings as getPhoneNumberSettingsEndpoint
|
|
122
|
-
|
|
183
|
+
getPhoneNumberSettings as getPhoneNumberSettingsEndpoint,
|
|
184
|
+
updatePhoneNumberSettings as updatePhoneNumberSettingsEndpoint,
|
|
185
|
+
listBlockedUsers as listBlockedUsersEndpoint,
|
|
186
|
+
blockUsers as blockUsersEndpoint,
|
|
187
|
+
unblockUsers as unblockUsersEndpoint,
|
|
188
|
+
getOfficialBusinessAccountStatus as getOfficialBusinessAccountStatusEndpoint,
|
|
189
|
+
requestOfficialBusinessAccountReview as requestOfficialBusinessAccountReviewEndpoint,
|
|
190
|
+
submitDisplayNameForReview as submitDisplayNameForReviewEndpoint
|
|
191
|
+
} from "../endpoints/businessManagement.js";
|
|
123
192
|
import {
|
|
124
193
|
acceptCall as acceptCallEndpoint,
|
|
125
194
|
initiateCall as initiateCallEndpoint,
|
|
126
195
|
preAcceptCall as preAcceptCallEndpoint,
|
|
127
196
|
rejectCall as rejectCallEndpoint,
|
|
128
197
|
terminateCall as terminateCallEndpoint
|
|
129
|
-
} from "../endpoints/calling";
|
|
198
|
+
} from "../endpoints/calling.js";
|
|
130
199
|
import {
|
|
131
200
|
buildMarkMessageAsReadPayload,
|
|
132
201
|
buildRemoveReactionPayload,
|
|
133
202
|
buildRequestLocationPayload,
|
|
134
203
|
buildSendAudioPayload,
|
|
135
204
|
buildSendButtonsPayload,
|
|
205
|
+
buildSendCallPermissionRequestPayload,
|
|
136
206
|
buildSendCatalogPayload,
|
|
137
207
|
buildSendContactsPayload,
|
|
138
208
|
buildSendCtaUrlPayload,
|
|
@@ -145,11 +215,12 @@ import {
|
|
|
145
215
|
buildSendReactionPayload,
|
|
146
216
|
buildSendStickerPayload,
|
|
147
217
|
buildSendTemplatePayload,
|
|
218
|
+
sendMarketingTemplate as sendMarketingTemplateEndpoint,
|
|
148
219
|
buildSendTextPayload,
|
|
149
220
|
buildSendVideoPayload,
|
|
150
221
|
buildTypingIndicatorPayload,
|
|
151
222
|
sendMessage as sendMessageEndpoint
|
|
152
|
-
} from "../endpoints/messages";
|
|
223
|
+
} from "../endpoints/messages.js";
|
|
153
224
|
function hasRequestMethod(candidate) {
|
|
154
225
|
if (candidate === null || typeof candidate !== "object") {
|
|
155
226
|
return false;
|