@azure-rest/communication-messages 1.1.0-alpha.20241018.1 → 2.0.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/index.js +24 -10
- package/dist/index.js.map +1 -1
- package/dist-esm/src/generated/src/clientDefinitions.js.map +1 -1
- package/dist-esm/src/generated/src/messagesServiceClient.js +24 -10
- package/dist-esm/src/generated/src/messagesServiceClient.js.map +1 -1
- package/dist-esm/src/generated/src/models.js.map +1 -1
- package/dist-esm/src/generated/src/outputModels.js.map +1 -1
- package/dist-esm/src/generated/src/parameters.js.map +1 -1
- package/dist-esm/src/generated/src/responses.js.map +1 -1
- package/package.json +7 -6
- package/review/communication-messages.api.md +60 -21
- package/types/communication-messages.d.ts +76 -21
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var coreAuth = require('@azure/core-auth');
|
|
6
6
|
var communicationCommon = require('@azure/communication-common');
|
|
7
|
+
var tslib = require('tslib');
|
|
7
8
|
var coreClient = require('@azure-rest/core-client');
|
|
8
9
|
var logger$1 = require('@azure/logger');
|
|
9
10
|
var corePaging = require('@azure/core-paging');
|
|
@@ -16,29 +17,42 @@ const logger = logger$1.createClientLogger("communication-messages");
|
|
|
16
17
|
// Licensed under the MIT License.
|
|
17
18
|
/**
|
|
18
19
|
* Initialize a new instance of `MessagesServiceClient`
|
|
19
|
-
* @param
|
|
20
|
+
* @param endpointParam - The communication resource, for example https://my-resource.communication.azure.com
|
|
20
21
|
* @param credentials - uniquely identify client credential
|
|
21
22
|
* @param options - the parameter for all optional parameters
|
|
22
23
|
*/
|
|
23
|
-
function createClient$1(
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const userAgentInfo = `azsdk-js-communication-messages-rest/
|
|
24
|
+
function createClient$1(endpointParam, credentials, _a = {}) {
|
|
25
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
26
|
+
var { apiVersion = "2024-08-30" } = _a, options = tslib.__rest(_a, ["apiVersion"]);
|
|
27
|
+
const endpointUrl = (_c = (_b = options.endpoint) !== null && _b !== void 0 ? _b : options.baseUrl) !== null && _c !== void 0 ? _c : `${endpointParam}`;
|
|
28
|
+
const userAgentInfo = `azsdk-js-communication-messages-rest/2.0.0`;
|
|
28
29
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
29
30
|
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
30
31
|
: `${userAgentInfo}`;
|
|
31
32
|
options = Object.assign(Object.assign({}, options), { userAgentOptions: {
|
|
32
33
|
userAgentPrefix,
|
|
33
34
|
}, loggingOptions: {
|
|
34
|
-
logger: (
|
|
35
|
+
logger: (_e = (_d = options.loggingOptions) === null || _d === void 0 ? void 0 : _d.logger) !== null && _e !== void 0 ? _e : logger.info,
|
|
35
36
|
}, credentials: {
|
|
36
|
-
scopes: (
|
|
37
|
+
scopes: (_g = (_f = options.credentials) === null || _f === void 0 ? void 0 : _f.scopes) !== null && _g !== void 0 ? _g : [
|
|
37
38
|
"https://communication.azure.com/.default",
|
|
38
39
|
],
|
|
39
|
-
apiKeyHeaderName: (
|
|
40
|
+
apiKeyHeaderName: (_j = (_h = options.credentials) === null || _h === void 0 ? void 0 : _h.apiKeyHeaderName) !== null && _j !== void 0 ? _j : "Authorization",
|
|
40
41
|
} });
|
|
41
|
-
const client = coreClient.getClient(
|
|
42
|
+
const client = coreClient.getClient(endpointUrl, credentials, options);
|
|
43
|
+
client.pipeline.removePolicy({ name: "ApiVersionPolicy" });
|
|
44
|
+
client.pipeline.addPolicy({
|
|
45
|
+
name: "ClientApiVersionPolicy",
|
|
46
|
+
sendRequest: (req, next) => {
|
|
47
|
+
// Use the apiVersion defined in request url directly
|
|
48
|
+
// Append one if there is no apiVersion and we have one at client options
|
|
49
|
+
const url = new URL(req.url);
|
|
50
|
+
if (!url.searchParams.get("api-version") && apiVersion) {
|
|
51
|
+
req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?"}api-version=${apiVersion}`;
|
|
52
|
+
}
|
|
53
|
+
return next(req);
|
|
54
|
+
},
|
|
55
|
+
});
|
|
42
56
|
return client;
|
|
43
57
|
}
|
|
44
58
|
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/generated/src/logger.ts","../src/generated/src/messagesServiceClient.ts","../src/messagesServiceClient.ts","../src/generated/src/isUnexpected.ts","../src/generated/src/paginateHelper.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"communication-messages\");\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger\";\nimport { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport { MessagesServiceClient } from \"./clientDefinitions\";\n\n/**\n * Initialize a new instance of `MessagesServiceClient`\n * @param endpoint - The communication resource, for example https://my-resource.communication.azure.com\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpoint: string,\n credentials: TokenCredential | KeyCredential,\n options: ClientOptions = {},\n): MessagesServiceClient {\n const baseUrl = options.baseUrl ?? `${endpoint}`;\n options.apiVersion = options.apiVersion ?? \"2024-02-01\";\n const userAgentInfo = `azsdk-js-communication-messages-rest/1.1.0-beta.1`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n credentials: {\n scopes: options.credentials?.scopes ?? [\n \"https://communication.azure.com/.default\",\n ],\n apiKeyHeaderName:\n options.credentials?.apiKeyHeaderName ?? \"Authorization\",\n },\n };\n\n const client = getClient(\n baseUrl,\n credentials,\n options,\n ) as MessagesServiceClient;\n\n return client;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n TokenCredential,\n isTokenCredential,\n KeyCredential,\n isKeyCredential,\n} from \"@azure/core-auth\";\nimport { ClientOptions } from \"@azure-rest/core-client\";\nimport { parseClientArguments, createCommunicationAuthPolicy } from \"@azure/communication-common\";\nimport { MessagesServiceClient } from \"./generated/src/clientDefinitions\";\nimport GeneratedAzureCommunicationMessageServiceClient from \"./generated/src/messagesServiceClient\";\n\n/**\n * Initialize a new instance of `MessagesServiceClient`\n * @param connectionString - The connectionString or url of your Communication Services resource.\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n connectionString: string,\n options?: ClientOptions,\n): MessagesServiceClient;\n\n/**\n * Initialize a new instance of `MessagesServiceClient`\n * @param endpoint - The endpoint of your Communication Services resource.\n * @param credential - The key or token credential.\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpoint: string,\n credential: KeyCredential | TokenCredential,\n options?: ClientOptions,\n): MessagesServiceClient;\n\n/**\n * Initialize a new instance of `MessagesServiceClient`\n * @param endpoint - The communication resource, for example https://my-resource.communication.azure.com\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpointOrConnectionString: string,\n credentialOrOptions?: ClientOptions | (TokenCredential | KeyCredential),\n options?: ClientOptions,\n): MessagesServiceClient {\n if (!(isTokenCredential(credentialOrOptions) || isKeyCredential(credentialOrOptions))) {\n options = credentialOrOptions as ClientOptions;\n }\n\n if (options === undefined) {\n options = {};\n }\n\n const { url, credential } = parseClientArguments(endpointOrConnectionString, credentialOrOptions);\n const baseUrl = options.baseUrl ?? `${url}`;\n\n const client = GeneratedAzureCommunicationMessageServiceClient(baseUrl, credential, options);\n const authPolicy = createCommunicationAuthPolicy(credential);\n client.pipeline.addPolicy(authPolicy);\n\n return client;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n GetMedia200Response,\n GetMediaDefaultResponse,\n Send202Response,\n SendDefaultResponse,\n ListTemplates200Response,\n ListTemplatesDefaultResponse,\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /messages/streams/{id}\": [\"200\"],\n \"POST /messages/notifications:send\": [\"202\"],\n \"GET /messages/channels/{channelId}/templates\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: GetMedia200Response | GetMediaDefaultResponse,\n): response is GetMediaDefaultResponse;\nexport function isUnexpected(\n response: Send202Response | SendDefaultResponse,\n): response is SendDefaultResponse;\nexport function isUnexpected(\n response: ListTemplates200Response | ListTemplatesDefaultResponse,\n): response is ListTemplatesDefaultResponse;\nexport function isUnexpected(\n response:\n | GetMedia200Response\n | GetMediaDefaultResponse\n | Send202Response\n | SendDefaultResponse\n | ListTemplates200Response\n | ListTemplatesDefaultResponse,\n): response is\n | GetMediaDefaultResponse\n | SendDefaultResponse\n | ListTemplatesDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (\n let i = candidateParts.length - 1, j = pathParts.length - 1;\n i >= 1 && j >= 1;\n i--, j--\n ) {\n if (\n candidateParts[i]?.startsWith(\"{\") &&\n candidateParts[i]?.indexOf(\"}\") !== -1\n ) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(\n `${candidateParts[i]?.slice(start, end)}`,\n ).test(pathParts[j] || \"\");\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n getPagedAsyncIterator,\n PagedAsyncIterableIterator,\n PagedResult,\n} from \"@azure/core-paging\";\nimport {\n Client,\n createRestError,\n PathUncheckedResponse,\n} from \"@azure-rest/core-client\";\n\n/**\n * Helper type to extract the type of an array\n */\nexport type GetArrayType<T> = T extends Array<infer TData> ? TData : never;\n\n/**\n * The type of a custom function that defines how to get a page and a link to the next one if any.\n */\nexport type GetPage<TPage> = (\n pageLink: string,\n maxPageSize?: number,\n) => Promise<{\n page: TPage;\n nextPageLink?: string;\n}>;\n\n/**\n * Options for the paging helper\n */\nexport interface PagingOptions<TResponse> {\n /**\n * Custom function to extract pagination details for crating the PagedAsyncIterableIterator\n */\n customGetPage?: GetPage<PaginateReturn<TResponse>[]>;\n}\n\n/**\n * Helper type to infer the Type of the paged elements from the response type\n * This type is generated based on the swagger information for x-ms-pageable\n * specifically on the itemName property which indicates the property of the response\n * where the page items are found. The default value is `value`.\n * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter\n */\nexport type PaginateReturn<TResult> = TResult extends {\n body: { value?: infer TPage };\n}\n ? GetArrayType<TPage>\n : Array<unknown>;\n\n/**\n * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension\n * @param client - Client to use for sending the next page requests\n * @param initialResponse - Initial response containing the nextLink and current page of elements\n * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results\n * @returns - PagedAsyncIterableIterator to iterate the elements\n */\nexport function paginate<TResponse extends PathUncheckedResponse>(\n client: Client,\n initialResponse: TResponse,\n options: PagingOptions<TResponse> = {},\n): PagedAsyncIterableIterator<PaginateReturn<TResponse>> {\n // Extract element type from initial response\n type TElement = PaginateReturn<TResponse>;\n let firstRun = true;\n const itemName = \"value\";\n const nextLinkName = \"nextLink\";\n const { customGetPage } = options;\n const pagedResult: PagedResult<TElement[]> = {\n firstPageLink: \"\",\n getPage:\n typeof customGetPage === \"function\"\n ? customGetPage\n : async (pageLink: string) => {\n const result = firstRun\n ? initialResponse\n : await client.pathUnchecked(pageLink).get();\n firstRun = false;\n checkPagingRequest(result);\n const nextLink = getNextLink(result.body, nextLinkName);\n const values = getElements<TElement>(result.body, itemName);\n return {\n page: values,\n nextPageLink: nextLink,\n };\n },\n };\n\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\") {\n throw new Error(\n `Body Property ${nextLinkName} should be a string or undefined`,\n );\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n\n // value has to be an array according to the x-ms-pageable extension.\n // The fact that this must be an array is used above to calculate the\n // type of elements in the page in PaginateReturn\n if (!Array.isArray(value)) {\n throw new Error(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`,\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse): void {\n const Http2xxStatusCodes = [\n \"200\",\n \"201\",\n \"202\",\n \"203\",\n \"204\",\n \"205\",\n \"206\",\n \"207\",\n \"208\",\n \"226\",\n ];\n if (!Http2xxStatusCodes.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response,\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport MessagesServiceClient from \"./messagesServiceClient\";\nexport * from \"./generated/src/messagesServiceClient\";\nexport * from \"./generated/src/parameters\";\nexport * from \"./generated/src/responses\";\nexport * from \"./generated/src/clientDefinitions\";\nexport * from \"./generated/src/isUnexpected\";\nexport * from \"./generated/src/models\";\nexport * from \"./generated/src/outputModels\";\nexport * from \"./generated/src/paginateHelper\";\nexport default MessagesServiceClient;\n"],"names":["createClientLogger","createClient","getClient","isTokenCredential","isKeyCredential","parseClientArguments","GeneratedAzureCommunicationMessageServiceClient","createCommunicationAuthPolicy","getPagedAsyncIterator","createRestError"],"mappings":";;;;;;;;;;AAAA;AACA;AAGO,MAAM,MAAM,GAAGA,2BAAkB,CAAC,wBAAwB,CAAC;;ACJlE;AACA;AAOA;;;;;AAKG;AACW,SAAUC,cAAY,CAClC,QAAgB,EAChB,WAA4C,EAC5C,OAAA,GAAyB,EAAE,EAAA;;IAE3B,MAAM,OAAO,GAAG,CAAA,EAAA,GAAA,OAAO,CAAC,OAAO,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,CAAA,EAAG,QAAQ,CAAA,CAAE,C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AAC;KACH;AACH;;ACzJA;AACA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/generated/src/logger.ts","../src/generated/src/messagesServiceClient.ts","../src/messagesServiceClient.ts","../src/generated/src/isUnexpected.ts","../src/generated/src/paginateHelper.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"communication-messages\");\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger\";\nimport { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport { MessagesServiceClient } from \"./clientDefinitions\";\n\n/** The optional parameters for the client */\nexport interface MessagesServiceClientOptions extends ClientOptions {\n /** The api version option of the client */\n apiVersion?: string;\n}\n\n/**\n * Initialize a new instance of `MessagesServiceClient`\n * @param endpointParam - The communication resource, for example https://my-resource.communication.azure.com\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpointParam: string,\n credentials: TokenCredential | KeyCredential,\n { apiVersion = \"2024-08-30\", ...options }: MessagesServiceClientOptions = {},\n): MessagesServiceClient {\n const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}`;\n const userAgentInfo = `azsdk-js-communication-messages-rest/2.0.0`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n credentials: {\n scopes: options.credentials?.scopes ?? [\n \"https://communication.azure.com/.default\",\n ],\n apiKeyHeaderName:\n options.credentials?.apiKeyHeaderName ?? \"Authorization\",\n },\n };\n const client = getClient(\n endpointUrl,\n credentials,\n options,\n ) as MessagesServiceClient;\n\n client.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n client.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\") && apiVersion) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n\n return client;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n TokenCredential,\n isTokenCredential,\n KeyCredential,\n isKeyCredential,\n} from \"@azure/core-auth\";\nimport { ClientOptions } from \"@azure-rest/core-client\";\nimport { parseClientArguments, createCommunicationAuthPolicy } from \"@azure/communication-common\";\nimport { MessagesServiceClient } from \"./generated/src/clientDefinitions\";\nimport GeneratedAzureCommunicationMessageServiceClient from \"./generated/src/messagesServiceClient\";\n\n/**\n * Initialize a new instance of `MessagesServiceClient`\n * @param connectionString - The connectionString or url of your Communication Services resource.\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n connectionString: string,\n options?: ClientOptions,\n): MessagesServiceClient;\n\n/**\n * Initialize a new instance of `MessagesServiceClient`\n * @param endpoint - The endpoint of your Communication Services resource.\n * @param credential - The key or token credential.\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpoint: string,\n credential: KeyCredential | TokenCredential,\n options?: ClientOptions,\n): MessagesServiceClient;\n\n/**\n * Initialize a new instance of `MessagesServiceClient`\n * @param endpoint - The communication resource, for example https://my-resource.communication.azure.com\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpointOrConnectionString: string,\n credentialOrOptions?: ClientOptions | (TokenCredential | KeyCredential),\n options?: ClientOptions,\n): MessagesServiceClient {\n if (!(isTokenCredential(credentialOrOptions) || isKeyCredential(credentialOrOptions))) {\n options = credentialOrOptions as ClientOptions;\n }\n\n if (options === undefined) {\n options = {};\n }\n\n const { url, credential } = parseClientArguments(endpointOrConnectionString, credentialOrOptions);\n const baseUrl = options.baseUrl ?? `${url}`;\n\n const client = GeneratedAzureCommunicationMessageServiceClient(baseUrl, credential, options);\n const authPolicy = createCommunicationAuthPolicy(credential);\n client.pipeline.addPolicy(authPolicy);\n\n return client;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n GetMedia200Response,\n GetMediaDefaultResponse,\n Send202Response,\n SendDefaultResponse,\n ListTemplates200Response,\n ListTemplatesDefaultResponse,\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /messages/streams/{id}\": [\"200\"],\n \"POST /messages/notifications:send\": [\"202\"],\n \"GET /messages/channels/{channelId}/templates\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: GetMedia200Response | GetMediaDefaultResponse,\n): response is GetMediaDefaultResponse;\nexport function isUnexpected(\n response: Send202Response | SendDefaultResponse,\n): response is SendDefaultResponse;\nexport function isUnexpected(\n response: ListTemplates200Response | ListTemplatesDefaultResponse,\n): response is ListTemplatesDefaultResponse;\nexport function isUnexpected(\n response:\n | GetMedia200Response\n | GetMediaDefaultResponse\n | Send202Response\n | SendDefaultResponse\n | ListTemplates200Response\n | ListTemplatesDefaultResponse,\n): response is\n | GetMediaDefaultResponse\n | SendDefaultResponse\n | ListTemplatesDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (\n let i = candidateParts.length - 1, j = pathParts.length - 1;\n i >= 1 && j >= 1;\n i--, j--\n ) {\n if (\n candidateParts[i]?.startsWith(\"{\") &&\n candidateParts[i]?.indexOf(\"}\") !== -1\n ) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(\n `${candidateParts[i]?.slice(start, end)}`,\n ).test(pathParts[j] || \"\");\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n getPagedAsyncIterator,\n PagedAsyncIterableIterator,\n PagedResult,\n} from \"@azure/core-paging\";\nimport {\n Client,\n createRestError,\n PathUncheckedResponse,\n} from \"@azure-rest/core-client\";\n\n/**\n * Helper type to extract the type of an array\n */\nexport type GetArrayType<T> = T extends Array<infer TData> ? TData : never;\n\n/**\n * The type of a custom function that defines how to get a page and a link to the next one if any.\n */\nexport type GetPage<TPage> = (\n pageLink: string,\n maxPageSize?: number,\n) => Promise<{\n page: TPage;\n nextPageLink?: string;\n}>;\n\n/**\n * Options for the paging helper\n */\nexport interface PagingOptions<TResponse> {\n /**\n * Custom function to extract pagination details for crating the PagedAsyncIterableIterator\n */\n customGetPage?: GetPage<PaginateReturn<TResponse>[]>;\n}\n\n/**\n * Helper type to infer the Type of the paged elements from the response type\n * This type is generated based on the swagger information for x-ms-pageable\n * specifically on the itemName property which indicates the property of the response\n * where the page items are found. The default value is `value`.\n * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter\n */\nexport type PaginateReturn<TResult> = TResult extends {\n body: { value?: infer TPage };\n}\n ? GetArrayType<TPage>\n : Array<unknown>;\n\n/**\n * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension\n * @param client - Client to use for sending the next page requests\n * @param initialResponse - Initial response containing the nextLink and current page of elements\n * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results\n * @returns - PagedAsyncIterableIterator to iterate the elements\n */\nexport function paginate<TResponse extends PathUncheckedResponse>(\n client: Client,\n initialResponse: TResponse,\n options: PagingOptions<TResponse> = {},\n): PagedAsyncIterableIterator<PaginateReturn<TResponse>> {\n // Extract element type from initial response\n type TElement = PaginateReturn<TResponse>;\n let firstRun = true;\n const itemName = \"value\";\n const nextLinkName = \"nextLink\";\n const { customGetPage } = options;\n const pagedResult: PagedResult<TElement[]> = {\n firstPageLink: \"\",\n getPage:\n typeof customGetPage === \"function\"\n ? customGetPage\n : async (pageLink: string) => {\n const result = firstRun\n ? initialResponse\n : await client.pathUnchecked(pageLink).get();\n firstRun = false;\n checkPagingRequest(result);\n const nextLink = getNextLink(result.body, nextLinkName);\n const values = getElements<TElement>(result.body, itemName);\n return {\n page: values,\n nextPageLink: nextLink,\n };\n },\n };\n\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\") {\n throw new Error(\n `Body Property ${nextLinkName} should be a string or undefined`,\n );\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n\n // value has to be an array according to the x-ms-pageable extension.\n // The fact that this must be an array is used above to calculate the\n // type of elements in the page in PaginateReturn\n if (!Array.isArray(value)) {\n throw new Error(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`,\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse): void {\n const Http2xxStatusCodes = [\n \"200\",\n \"201\",\n \"202\",\n \"203\",\n \"204\",\n \"205\",\n \"206\",\n \"207\",\n \"208\",\n \"226\",\n ];\n if (!Http2xxStatusCodes.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response,\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport MessagesServiceClient from \"./messagesServiceClient\";\nexport * from \"./generated/src/messagesServiceClient\";\nexport * from \"./generated/src/parameters\";\nexport * from \"./generated/src/responses\";\nexport * from \"./generated/src/clientDefinitions\";\nexport * from \"./generated/src/isUnexpected\";\nexport * from \"./generated/src/models\";\nexport * from \"./generated/src/outputModels\";\nexport * from \"./generated/src/paginateHelper\";\nexport default MessagesServiceClient;\n"],"names":["createClientLogger","createClient","__rest","getClient","isTokenCredential","isKeyCredential","parseClientArguments","GeneratedAzureCommunicationMessageServiceClient","createCommunicationAuthPolicy","getPagedAsyncIterator","createRestError"],"mappings":";;;;;;;;;;;AAAA;AACA;AAGO,MAAM,MAAM,GAAGA,2BAAkB,CAAC,wBAAwB,CAAC;;ACJlE;AACA;AAaA;;;;;AAKG;AACW,SAAUC,cAAY,CAClC,aAAqB,EACrB,WAA4C,EA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AAC,YAAY,CAAC,CAAC;IAEjE,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;AACnE,QAAA,MAAM,IAAI,KAAK,CACb,iBAAiB,YAAY,CAAA,gCAAA,CAAkC,CAChE,CAAC;KACH;AAED,IAAA,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;AAEG;AACH,SAAS,WAAW,CAAc,IAAa,EAAE,QAAgB,EAAA;AAC/D,IAAA,MAAM,KAAK,GAAI,IAAgC,CAAC,QAAQ,CAAQ,CAAC;;;;IAKjE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AACzB,QAAA,MAAM,IAAI,KAAK,CACb,kFAAkF,QAAQ,CAAA,CAAE,CAC7F,CAAC;KACH;AAED,IAAA,OAAO,KAAK,KAAL,IAAA,IAAA,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC;AACrB,CAAC;AAED;;AAEG;AACH,SAAS,kBAAkB,CAAC,QAA+B,EAAA;AACzD,IAAA,MAAM,kBAAkB,GAAG;QACzB,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;KACN,CAAC;IACF,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACjD,MAAMC,0BAAe,CACnB,CAAA,6CAAA,EAAgD,QAAQ,CAAC,MAAM,CAAE,CAAA,EACjE,QAAQ,CACT,CAAC;KACH;AACH;;ACzJA;AACA;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientDefinitions.js","sourceRoot":"","sources":["../../../../src/generated/src/clientDefinitions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n GetMediaParameters,\n SendParameters,\n ListTemplatesParameters,\n} from \"./parameters\";\nimport {\n GetMedia200Response,\n GetMediaDefaultResponse,\n Send202Response,\n SendDefaultResponse,\n ListTemplates200Response,\n ListTemplatesDefaultResponse,\n} from \"./responses\";\nimport { Client, StreamableMethod } from \"@azure-rest/core-client\";\n\nexport interface GetMedia {\n /** Download the Media payload from a User to Business message. */\n get(\n options?: GetMediaParameters,\n ): StreamableMethod<GetMedia200Response | GetMediaDefaultResponse>;\n}\n\nexport interface Send {\n /** Sends a notification message from Business to User. */\n post(\n options
|
|
1
|
+
{"version":3,"file":"clientDefinitions.js","sourceRoot":"","sources":["../../../../src/generated/src/clientDefinitions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n GetMediaParameters,\n SendParameters,\n ListTemplatesParameters,\n} from \"./parameters\";\nimport {\n GetMedia200Response,\n GetMediaDefaultResponse,\n Send202Response,\n SendDefaultResponse,\n ListTemplates200Response,\n ListTemplatesDefaultResponse,\n} from \"./responses\";\nimport { Client, StreamableMethod } from \"@azure-rest/core-client\";\n\nexport interface GetMedia {\n /** Download the Media payload from a User to Business message. */\n get(\n options?: GetMediaParameters,\n ): StreamableMethod<GetMedia200Response | GetMediaDefaultResponse>;\n}\n\nexport interface Send {\n /** Sends a notification message from Business to User. */\n post(\n options: SendParameters,\n ): StreamableMethod<Send202Response | SendDefaultResponse>;\n}\n\nexport interface ListTemplates {\n /** List all templates for given Azure Communication Services channel */\n get(\n options?: ListTemplatesParameters,\n ): StreamableMethod<ListTemplates200Response | ListTemplatesDefaultResponse>;\n}\n\nexport interface Routes {\n /** Resource for '/messages/streams/\\{id\\}' has methods for the following verbs: get */\n (path: \"/messages/streams/{id}\", id: string): GetMedia;\n /** Resource for '/messages/notifications:send' has methods for the following verbs: post */\n (path: \"/messages/notifications:send\"): Send;\n /** Resource for '/messages/channels/\\{channelId\\}/templates' has methods for the following verbs: get */\n (\n path: \"/messages/channels/{channelId}/templates\",\n channelId: string,\n ): ListTemplates;\n}\n\nexport type MessagesServiceClient = Client & {\n path: Routes;\n};\n"]}
|
|
@@ -1,32 +1,46 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
+
import { __rest } from "tslib";
|
|
3
4
|
import { getClient } from "@azure-rest/core-client";
|
|
4
5
|
import { logger } from "./logger";
|
|
5
6
|
/**
|
|
6
7
|
* Initialize a new instance of `MessagesServiceClient`
|
|
7
|
-
* @param
|
|
8
|
+
* @param endpointParam - The communication resource, for example https://my-resource.communication.azure.com
|
|
8
9
|
* @param credentials - uniquely identify client credential
|
|
9
10
|
* @param options - the parameter for all optional parameters
|
|
10
11
|
*/
|
|
11
|
-
export default function createClient(
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const userAgentInfo = `azsdk-js-communication-messages-rest/
|
|
12
|
+
export default function createClient(endpointParam, credentials, _a = {}) {
|
|
13
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
14
|
+
var { apiVersion = "2024-08-30" } = _a, options = __rest(_a, ["apiVersion"]);
|
|
15
|
+
const endpointUrl = (_c = (_b = options.endpoint) !== null && _b !== void 0 ? _b : options.baseUrl) !== null && _c !== void 0 ? _c : `${endpointParam}`;
|
|
16
|
+
const userAgentInfo = `azsdk-js-communication-messages-rest/2.0.0`;
|
|
16
17
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
17
18
|
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
18
19
|
: `${userAgentInfo}`;
|
|
19
20
|
options = Object.assign(Object.assign({}, options), { userAgentOptions: {
|
|
20
21
|
userAgentPrefix,
|
|
21
22
|
}, loggingOptions: {
|
|
22
|
-
logger: (
|
|
23
|
+
logger: (_e = (_d = options.loggingOptions) === null || _d === void 0 ? void 0 : _d.logger) !== null && _e !== void 0 ? _e : logger.info,
|
|
23
24
|
}, credentials: {
|
|
24
|
-
scopes: (
|
|
25
|
+
scopes: (_g = (_f = options.credentials) === null || _f === void 0 ? void 0 : _f.scopes) !== null && _g !== void 0 ? _g : [
|
|
25
26
|
"https://communication.azure.com/.default",
|
|
26
27
|
],
|
|
27
|
-
apiKeyHeaderName: (
|
|
28
|
+
apiKeyHeaderName: (_j = (_h = options.credentials) === null || _h === void 0 ? void 0 : _h.apiKeyHeaderName) !== null && _j !== void 0 ? _j : "Authorization",
|
|
28
29
|
} });
|
|
29
|
-
const client = getClient(
|
|
30
|
+
const client = getClient(endpointUrl, credentials, options);
|
|
31
|
+
client.pipeline.removePolicy({ name: "ApiVersionPolicy" });
|
|
32
|
+
client.pipeline.addPolicy({
|
|
33
|
+
name: "ClientApiVersionPolicy",
|
|
34
|
+
sendRequest: (req, next) => {
|
|
35
|
+
// Use the apiVersion defined in request url directly
|
|
36
|
+
// Append one if there is no apiVersion and we have one at client options
|
|
37
|
+
const url = new URL(req.url);
|
|
38
|
+
if (!url.searchParams.get("api-version") && apiVersion) {
|
|
39
|
+
req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?"}api-version=${apiVersion}`;
|
|
40
|
+
}
|
|
41
|
+
return next(req);
|
|
42
|
+
},
|
|
43
|
+
});
|
|
30
44
|
return client;
|
|
31
45
|
}
|
|
32
46
|
//# sourceMappingURL=messagesServiceClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messagesServiceClient.js","sourceRoot":"","sources":["../../../../src/generated/src/messagesServiceClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"messagesServiceClient.js","sourceRoot":"","sources":["../../../../src/generated/src/messagesServiceClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,SAAS,EAAiB,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU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AM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,UAAU,EAAE,CAAC;gBACvD,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger\";\nimport { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport { MessagesServiceClient } from \"./clientDefinitions\";\n\n/** The optional parameters for the client */\nexport interface MessagesServiceClientOptions extends ClientOptions {\n /** The api version option of the client */\n apiVersion?: string;\n}\n\n/**\n * Initialize a new instance of `MessagesServiceClient`\n * @param endpointParam - The communication resource, for example https://my-resource.communication.azure.com\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpointParam: string,\n credentials: TokenCredential | KeyCredential,\n { apiVersion = \"2024-08-30\", ...options }: MessagesServiceClientOptions = {},\n): MessagesServiceClient {\n const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}`;\n const userAgentInfo = `azsdk-js-communication-messages-rest/2.0.0`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n credentials: {\n scopes: options.credentials?.scopes ?? [\n \"https://communication.azure.com/.default\",\n ],\n apiKeyHeaderName:\n options.credentials?.apiKeyHeaderName ?? \"Authorization\",\n },\n };\n const client = getClient(\n endpointUrl,\n credentials,\n options,\n ) as MessagesServiceClient;\n\n client.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n client.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\") && apiVersion) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n\n return client;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/generated/src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/** Details of the message to send. */\nexport interface NotificationContentParent {\n /** The Channel Registration ID for the Business Identifier. */\n channelRegistrationId: string;\n /** The native external platform user identifiers of the recipient. */\n to: string[];\n kind:
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/generated/src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/** Details of the message to send. */\nexport interface NotificationContentParent {\n /** The Channel Registration ID for the Business Identifier. */\n channelRegistrationId: string;\n /** The native external platform user identifiers of the recipient. */\n to: string[];\n kind: CommunicationMessageKind;\n}\n\n/** A request to send a text notification. */\nexport interface TextNotificationContent extends NotificationContentParent {\n /** Message notification type is text. */\n kind: \"text\";\n /** Message content. */\n content: string;\n}\n\n/** @deprecated A request to send an image notification. */\nexport interface MediaNotificationContent extends NotificationContentParent {\n /** Message notification type is image. */\n kind: \"image_v0\";\n /** Optional text content. */\n content?: string;\n /** A media url for the file. Required if the type is one of the supported media types, e.g. image */\n mediaUri: string;\n}\n\n/** A request to send an image notification. */\nexport interface ImageNotificationContent extends NotificationContentParent {\n /** Message notification type is image. */\n kind: \"image\";\n /** Optional text content. */\n caption?: string;\n /** A media url for the file. Required if the type is one of the supported media types, e.g. image */\n mediaUri: string;\n}\n\n/** A request to send a document notification. */\nexport interface DocumentNotificationContent extends NotificationContentParent {\n /** Message notification type is image. */\n kind: \"document\";\n /** Optional text content. */\n caption?: string;\n /** Optional name for the file. */\n fileName?: string;\n /** A media url for the file. Required if the type is one of the supported media types, e.g. image */\n mediaUri: string;\n}\n\n/** A request to send a video notification. */\nexport interface VideoNotificationContent extends NotificationContentParent {\n /** Message notification type is image. */\n kind: \"video\";\n /** Optional text content. */\n caption?: string;\n /** A media url for the file. Required if the type is one of the supported media types, e.g. image */\n mediaUri: string;\n}\n\n/** A request to send an audio notification. */\nexport interface AudioNotificationContent extends NotificationContentParent {\n /** Message notification type is audio. */\n kind: \"audio\";\n /** A media url for the file. Required if the type is one of the supported media types, e.g. image */\n mediaUri: string;\n}\n\n/** A request to send a template notification. */\nexport interface TemplateNotificationContent extends NotificationContentParent {\n /** Message notification type is template. */\n kind: \"template\";\n /** The template object used to create templates. */\n template: MessageTemplate;\n}\n\n/** The template object used to create templates. */\nexport interface MessageTemplate {\n /** Name of the template. */\n name: string;\n /** The template's language, in the ISO 639 format, consist of a two-letter language code followed by an optional two-letter country code, e.g., 'en' or 'en_US'. */\n language: string;\n /** The template values. */\n values?: Array<MessageTemplateValue>;\n /** The binding object to link values to the template specific locations */\n bindings?: MessageTemplateBindings;\n}\n\n/** The class describes a parameter of a template. */\nexport interface MessageTemplateValueParent {\n /** Template binding reference name */\n name: string;\n kind: MessageTemplateValueKind;\n}\n\n/** The message template's text value information. */\nexport interface MessageTemplateText extends MessageTemplateValueParent {\n /** Message parameter type is text. */\n kind: \"text\";\n /** The text value. */\n text: string;\n}\n\n/** The message template's image value information. */\nexport interface MessageTemplateImage extends MessageTemplateValueParent {\n /** Message parameter type is image. */\n kind: \"image\";\n /** The (public) URL of the media. */\n url: string;\n /** The [optional] caption of the media object. */\n caption?: string;\n /** The [optional] filename of the media file. */\n fileName?: string;\n}\n\n/** The message template's document value information. */\nexport interface MessageTemplateDocument extends MessageTemplateValueParent {\n /** Message parameter type is document. */\n kind: \"document\";\n /** The (public) URL of the media. */\n url: string;\n /** The [optional] caption of the media object. */\n caption?: string;\n /** The [optional] filename of the media file. */\n fileName?: string;\n}\n\n/** The message template's video value information. */\nexport interface MessageTemplateVideo extends MessageTemplateValueParent {\n /** Message parameter type is video. */\n kind: \"video\";\n /** The (public) URL of the media. */\n url: string;\n /** The [optional] caption of the media object. */\n caption?: string;\n /** The [optional] filename of the media file. */\n fileName?: string;\n}\n\n/** The message template's location value information. */\nexport interface MessageTemplateLocation extends MessageTemplateValueParent {\n /** Message parameter type is location. */\n kind: \"location\";\n /** The [Optional] name of the location. */\n locationName?: string;\n /** The [Optional] address of the location. */\n address?: string;\n /** The latitude of the location. */\n latitude: number;\n /** The longitude of the location. */\n longitude: number;\n}\n\n/** The message template's quick action value information. */\nexport interface MessageTemplateQuickAction extends MessageTemplateValueParent {\n /** Message parameter type is quick action. */\n kind: \"quickAction\";\n /** The [Optional] quick action text */\n text?: string;\n /** The [Optional] quick action payload */\n payload?: string;\n}\n\n/** The binding object to link values to the template specific locations */\nexport interface MessageTemplateBindingsParent {\n kind: MessageTemplateBindingsKind;\n}\n\n/** The template bindings for WhatsApp */\nexport interface WhatsAppMessageTemplateBindings\n extends MessageTemplateBindingsParent {\n /** MessageTemplateBindings is whatsApp */\n kind: \"whatsApp\";\n /** The header template bindings */\n header?: Array<WhatsAppMessageTemplateBindingsComponent>;\n /** The body template bindings */\n body?: Array<WhatsAppMessageTemplateBindingsComponent>;\n /** The footer template bindings */\n footer?: Array<WhatsAppMessageTemplateBindingsComponent>;\n /** The button template bindings */\n buttons?: Array<WhatsAppMessageTemplateBindingsButton>;\n}\n\n/** The template bindings component for WhatsApp */\nexport interface WhatsAppMessageTemplateBindingsComponent {\n /** The name of the referenced item in the template values. */\n refValue: string;\n}\n\n/** The template bindings component button for WhatsApp */\nexport interface WhatsAppMessageTemplateBindingsButton {\n /**\n * The WhatsApp button sub type\n *\n * Possible values: \"quickReply\", \"url\"\n */\n subType: WhatsAppMessageButtonSubType;\n /** The name of the referenced item in the template values. */\n refValue: string;\n}\n\n/** Details of the message to send. */\nexport type NotificationContent =\n | NotificationContentParent\n | TextNotificationContent\n | MediaNotificationContent\n | ImageNotificationContent\n | DocumentNotificationContent\n | VideoNotificationContent\n | AudioNotificationContent\n | TemplateNotificationContent;\n/** The class describes a parameter of a template. */\nexport type MessageTemplateValue =\n | MessageTemplateValueParent\n | MessageTemplateText\n | MessageTemplateImage\n | MessageTemplateDocument\n | MessageTemplateVideo\n | MessageTemplateLocation\n | MessageTemplateQuickAction;\n/** The binding object to link values to the template specific locations */\nexport type MessageTemplateBindings =\n | MessageTemplateBindingsParent\n | WhatsAppMessageTemplateBindings;\n/** Alias for CommunicationMessageKind */\nexport type CommunicationMessageKind = string;\n/** Alias for MessageTemplateValueKind */\nexport type MessageTemplateValueKind = string;\n/** Alias for MessageTemplateBindingsKind */\nexport type MessageTemplateBindingsKind = string;\n/** Alias for WhatsAppMessageButtonSubType */\nexport type WhatsAppMessageButtonSubType = string;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../../../src/generated/src/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Paged } from \"@azure/core-paging\";\n\n/**
|
|
1
|
+
{"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../../../src/generated/src/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Paged } from \"@azure/core-paging\";\n\n/** Result of the send message operation. */\nexport interface SendMessageResultOutput {\n /** Receipts of the send message operation. */\n receipts: Array<MessageReceiptOutput>;\n}\n\n/** Receipt of the sending one message. */\nexport interface MessageReceiptOutput {\n /** The message id. */\n messageId: string;\n /** The native external platform user identifier of the recipient. */\n to: string;\n}\n\n/** The message template as returned from the service. */\nexport interface MessageTemplateItemOutputParent {\n /** The template's name. */\n readonly name: string;\n /** The template's language, in the ISO 639 format, consist of a two-letter language code followed by an optional two-letter country code, e.g., 'en' or 'en_US'. */\n language: string;\n /**\n * The aggregated template status.\n *\n * Possible values: \"approved\", \"rejected\", \"pending\", \"paused\"\n */\n status: MessageTemplateStatusOutput;\n kind: CommunicationMessagesChannelOutput;\n}\n\n/** The WhatsApp-specific template response contract */\nexport interface WhatsAppMessageTemplateItemOutput\n extends MessageTemplateItemOutputParent {\n /** WhatsApp platform's template content. This is the payload returned from WhatsApp API. */\n content?: any;\n /** Message template response type is whatsApp. */\n kind: \"whatsApp\";\n}\n\n/** The message template as returned from the service. */\nexport type MessageTemplateItemOutput =\n | MessageTemplateItemOutputParent\n | WhatsAppMessageTemplateItemOutput;\n/** Alias for RepeatabilityResultOutput */\nexport type RepeatabilityResultOutput = \"accepted\" | \"rejected\";\n/** Paged collection of MessageTemplateItem items */\nexport type PagedMessageTemplateItemOutput = Paged<MessageTemplateItemOutput>;\n/** Alias for MessageTemplateStatusOutput */\nexport type MessageTemplateStatusOutput = string;\n/** Alias for CommunicationMessagesChannelOutput */\nexport type CommunicationMessagesChannelOutput = string;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../../../src/generated/src/parameters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { RawHttpHeadersInput } from \"@azure/core-rest-pipeline\";\nimport { RequestParameters } from \"@azure-rest/core-client\";\nimport { NotificationContent } from \"./models\";\n\nexport interface GetMediaHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface GetMediaHeaderParam {\n headers?: RawHttpHeadersInput & GetMediaHeaders;\n}\n\nexport type GetMediaParameters = GetMediaHeaderParam & RequestParameters;\n\nexport interface SendHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"Repeatability-Request-ID\"?: string;\n /** Specifies the date and time at which the request was first created. */\n \"Repeatability-First-Sent\"?: string;\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface SendBodyParam {\n body
|
|
1
|
+
{"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../../../src/generated/src/parameters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { RawHttpHeadersInput } from \"@azure/core-rest-pipeline\";\nimport { RequestParameters } from \"@azure-rest/core-client\";\nimport { NotificationContent } from \"./models\";\n\nexport interface GetMediaHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface GetMediaHeaderParam {\n headers?: RawHttpHeadersInput & GetMediaHeaders;\n}\n\nexport type GetMediaParameters = GetMediaHeaderParam & RequestParameters;\n\nexport interface SendHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"Repeatability-Request-ID\"?: string;\n /** Specifies the date and time at which the request was first created. */\n \"Repeatability-First-Sent\"?: string;\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface SendBodyParam {\n /** Details of the message to send. */\n body: NotificationContent;\n}\n\nexport interface SendHeaderParam {\n headers?: RawHttpHeadersInput & SendHeaders;\n}\n\nexport type SendParameters = SendHeaderParam &\n SendBodyParam &\n RequestParameters;\n\nexport interface ListTemplatesHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface ListTemplatesQueryParamProperties {\n /** Number of objects to return per page. */\n maxpagesize?: number;\n}\n\nexport interface ListTemplatesQueryParam {\n queryParameters?: ListTemplatesQueryParamProperties;\n}\n\nexport interface ListTemplatesHeaderParam {\n headers?: RawHttpHeadersInput & ListTemplatesHeaders;\n}\n\nexport type ListTemplatesParameters = ListTemplatesQueryParam &\n ListTemplatesHeaderParam &\n RequestParameters;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.js","sourceRoot":"","sources":["../../../../src/generated/src/responses.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { RawHttpHeaders } from \"@azure/core-rest-pipeline\";\nimport { HttpResponse, ErrorResponse } from \"@azure-rest/core-client\";\nimport {\n RepeatabilityResultOutput,\n SendMessageResultOutput,\n PagedMessageTemplateItemOutput,\n} from \"./outputModels\";\n\nexport interface GetMedia200Headers {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\n/** The request has succeeded. */\nexport interface GetMedia200Response extends HttpResponse {\n status: \"200\";\n /** Value may contain any sequence of octets */\n body: Uint8Array;\n headers: RawHttpHeaders & GetMedia200Headers;\n}\n\nexport interface GetMediaDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetMediaDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetMediaDefaultHeaders;\n}\n\nexport interface Send202Headers {\n /** Indicates whether the repeatable request was accepted or rejected. */\n \"repeatability-result\"?: RepeatabilityResultOutput;\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\n/** The request has been accepted for processing, but processing has not yet completed. */\nexport interface Send202Response extends HttpResponse {\n status: \"202\";\n body: SendMessageResultOutput;\n headers: RawHttpHeaders & Send202Headers;\n}\n\nexport interface SendDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface SendDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & SendDefaultHeaders;\n}\n\nexport interface ListTemplates200Headers {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\n/** The request has succeeded. */\nexport interface ListTemplates200Response extends HttpResponse {\n status: \"200\";\n body: PagedMessageTemplateItemOutput;\n headers: RawHttpHeaders & ListTemplates200Headers;\n}\n\nexport interface ListTemplatesDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface ListTemplatesDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & ListTemplatesDefaultHeaders;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"responses.js","sourceRoot":"","sources":["../../../../src/generated/src/responses.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { RawHttpHeaders } from \"@azure/core-rest-pipeline\";\nimport { HttpResponse, ErrorResponse } from \"@azure-rest/core-client\";\nimport {\n RepeatabilityResultOutput,\n SendMessageResultOutput,\n PagedMessageTemplateItemOutput,\n} from \"./outputModels\";\n\nexport interface GetMedia200Headers {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n /** The stream content type. */\n \"content-type\": \"application/octet-stream\";\n}\n\n/** The request has succeeded. */\nexport interface GetMedia200Response extends HttpResponse {\n status: \"200\";\n /** Value may contain any sequence of octets */\n body: Uint8Array;\n headers: RawHttpHeaders & GetMedia200Headers;\n}\n\nexport interface GetMediaDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetMediaDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetMediaDefaultHeaders;\n}\n\nexport interface Send202Headers {\n /** Indicates whether the repeatable request was accepted or rejected. */\n \"repeatability-result\"?: RepeatabilityResultOutput;\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\n/** The request has been accepted for processing, but processing has not yet completed. */\nexport interface Send202Response extends HttpResponse {\n status: \"202\";\n body: SendMessageResultOutput;\n headers: RawHttpHeaders & Send202Headers;\n}\n\nexport interface SendDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface SendDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & SendDefaultHeaders;\n}\n\nexport interface ListTemplates200Headers {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\n/** The request has succeeded. */\nexport interface ListTemplates200Response extends HttpResponse {\n status: \"200\";\n body: PagedMessageTemplateItemOutput;\n headers: RawHttpHeaders & ListTemplates200Headers;\n}\n\nexport interface ListTemplatesDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface ListTemplatesDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & ListTemplatesDefaultHeaders;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@azure-rest/communication-messages",
|
|
3
3
|
"sdk-type": "client",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "2.0.0",
|
|
6
6
|
"description": "Azure client library for Azure Communication Messages services",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"node",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"sideEffects": false,
|
|
62
62
|
"autoPublish": false,
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@azure-rest/core-client": "^1.
|
|
64
|
+
"@azure-rest/core-client": "^1.4.0",
|
|
65
65
|
"@azure/communication-common": "^2.2.0",
|
|
66
|
-
"@azure/core-auth": "^1.
|
|
66
|
+
"@azure/core-auth": "^1.6.0",
|
|
67
67
|
"@azure/core-paging": "^1.5.0",
|
|
68
68
|
"@azure/core-rest-pipeline": "^1.12.0",
|
|
69
69
|
"@azure/core-util": "^1.7.0",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@azure-tools/test-credential": "^1.0.0",
|
|
75
75
|
"@azure-tools/test-recorder": "^3.0.0",
|
|
76
|
-
"@azure/dev-tool": "
|
|
77
|
-
"@azure/eslint-plugin-azure-sdk": "
|
|
76
|
+
"@azure/dev-tool": "^1.0.0",
|
|
77
|
+
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
|
|
78
78
|
"@azure/identity": "^4.2.1",
|
|
79
79
|
"@microsoft/api-extractor": "^7.31.1",
|
|
80
80
|
"@types/chai": "^4.2.8",
|
|
@@ -120,6 +120,7 @@
|
|
|
120
120
|
"productSlugs": [
|
|
121
121
|
"azure",
|
|
122
122
|
"azure-communication-services"
|
|
123
|
-
]
|
|
123
|
+
],
|
|
124
|
+
"apiRefLink": "https://learn.microsoft.com/javascript/api/overview/azure/communication-messages-rest-readme?view=azure-node-latest"
|
|
124
125
|
}
|
|
125
126
|
}
|
|
@@ -19,9 +19,17 @@ import { StreamableMethod } from '@azure-rest/core-client';
|
|
|
19
19
|
import { TokenCredential } from '@azure/core-auth';
|
|
20
20
|
|
|
21
21
|
// @public
|
|
22
|
-
export interface
|
|
22
|
+
export interface AudioNotificationContent extends NotificationContentParent {
|
|
23
|
+
kind: "audio";
|
|
24
|
+
mediaUri: string;
|
|
23
25
|
}
|
|
24
26
|
|
|
27
|
+
// @public
|
|
28
|
+
export type CommunicationMessageKind = string;
|
|
29
|
+
|
|
30
|
+
// @public
|
|
31
|
+
export type CommunicationMessagesChannelOutput = string;
|
|
32
|
+
|
|
25
33
|
// @public
|
|
26
34
|
function createClient(connectionString: string, options?: ClientOptions): MessagesServiceClient;
|
|
27
35
|
|
|
@@ -29,6 +37,14 @@ function createClient(connectionString: string, options?: ClientOptions): Messag
|
|
|
29
37
|
function createClient(endpoint: string, credential: KeyCredential | TokenCredential, options?: ClientOptions): MessagesServiceClient;
|
|
30
38
|
export default createClient;
|
|
31
39
|
|
|
40
|
+
// @public
|
|
41
|
+
export interface DocumentNotificationContent extends NotificationContentParent {
|
|
42
|
+
caption?: string;
|
|
43
|
+
fileName?: string;
|
|
44
|
+
kind: "document";
|
|
45
|
+
mediaUri: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
32
48
|
// @public
|
|
33
49
|
export type GetArrayType<T> = T extends Array<infer TData> ? TData : never;
|
|
34
50
|
|
|
@@ -39,6 +55,7 @@ export interface GetMedia {
|
|
|
39
55
|
|
|
40
56
|
// @public (undocumented)
|
|
41
57
|
export interface GetMedia200Headers {
|
|
58
|
+
"content-type": "application/octet-stream";
|
|
42
59
|
"x-ms-client-request-id"?: string;
|
|
43
60
|
}
|
|
44
61
|
|
|
@@ -86,6 +103,13 @@ export type GetPage<TPage> = (pageLink: string, maxPageSize?: number) => Promise
|
|
|
86
103
|
nextPageLink?: string;
|
|
87
104
|
}>;
|
|
88
105
|
|
|
106
|
+
// @public
|
|
107
|
+
export interface ImageNotificationContent extends NotificationContentParent {
|
|
108
|
+
caption?: string;
|
|
109
|
+
kind: "image";
|
|
110
|
+
mediaUri: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
89
113
|
// @public (undocumented)
|
|
90
114
|
export function isUnexpected(response: GetMedia200Response | GetMediaDefaultResponse): response is GetMediaDefaultResponse;
|
|
91
115
|
|
|
@@ -155,10 +179,10 @@ export interface ListTemplatesQueryParamProperties {
|
|
|
155
179
|
maxpagesize?: number;
|
|
156
180
|
}
|
|
157
181
|
|
|
158
|
-
// @public
|
|
182
|
+
// @public @deprecated (undocumented)
|
|
159
183
|
export interface MediaNotificationContent extends NotificationContentParent {
|
|
160
184
|
content?: string;
|
|
161
|
-
kind: "
|
|
185
|
+
kind: "image_v0";
|
|
162
186
|
mediaUri: string;
|
|
163
187
|
}
|
|
164
188
|
|
|
@@ -173,6 +197,11 @@ export type MessagesServiceClient = Client & {
|
|
|
173
197
|
path: Routes;
|
|
174
198
|
};
|
|
175
199
|
|
|
200
|
+
// @public
|
|
201
|
+
export interface MessagesServiceClientOptions extends ClientOptions {
|
|
202
|
+
apiVersion?: string;
|
|
203
|
+
}
|
|
204
|
+
|
|
176
205
|
// @public
|
|
177
206
|
export interface MessageTemplate {
|
|
178
207
|
bindings?: MessageTemplateBindings;
|
|
@@ -184,10 +213,13 @@ export interface MessageTemplate {
|
|
|
184
213
|
// @public
|
|
185
214
|
export type MessageTemplateBindings = MessageTemplateBindingsParent | WhatsAppMessageTemplateBindings;
|
|
186
215
|
|
|
216
|
+
// @public
|
|
217
|
+
export type MessageTemplateBindingsKind = string;
|
|
218
|
+
|
|
187
219
|
// @public
|
|
188
220
|
export interface MessageTemplateBindingsParent {
|
|
189
221
|
// (undocumented)
|
|
190
|
-
kind:
|
|
222
|
+
kind: MessageTemplateBindingsKind;
|
|
191
223
|
}
|
|
192
224
|
|
|
193
225
|
// @public
|
|
@@ -212,10 +244,10 @@ export type MessageTemplateItemOutput = MessageTemplateItemOutputParent | WhatsA
|
|
|
212
244
|
// @public
|
|
213
245
|
export interface MessageTemplateItemOutputParent {
|
|
214
246
|
// (undocumented)
|
|
215
|
-
kind:
|
|
247
|
+
kind: CommunicationMessagesChannelOutput;
|
|
216
248
|
language: string;
|
|
217
249
|
readonly name: string;
|
|
218
|
-
status:
|
|
250
|
+
status: MessageTemplateStatusOutput;
|
|
219
251
|
}
|
|
220
252
|
|
|
221
253
|
// @public
|
|
@@ -234,6 +266,9 @@ export interface MessageTemplateQuickAction extends MessageTemplateValueParent {
|
|
|
234
266
|
text?: string;
|
|
235
267
|
}
|
|
236
268
|
|
|
269
|
+
// @public
|
|
270
|
+
export type MessageTemplateStatusOutput = string;
|
|
271
|
+
|
|
237
272
|
// @public
|
|
238
273
|
export interface MessageTemplateText extends MessageTemplateValueParent {
|
|
239
274
|
kind: "text";
|
|
@@ -243,10 +278,13 @@ export interface MessageTemplateText extends MessageTemplateValueParent {
|
|
|
243
278
|
// @public
|
|
244
279
|
export type MessageTemplateValue = MessageTemplateValueParent | MessageTemplateText | MessageTemplateImage | MessageTemplateDocument | MessageTemplateVideo | MessageTemplateLocation | MessageTemplateQuickAction;
|
|
245
280
|
|
|
281
|
+
// @public
|
|
282
|
+
export type MessageTemplateValueKind = string;
|
|
283
|
+
|
|
246
284
|
// @public
|
|
247
285
|
export interface MessageTemplateValueParent {
|
|
248
286
|
// (undocumented)
|
|
249
|
-
kind:
|
|
287
|
+
kind: MessageTemplateValueKind;
|
|
250
288
|
name: string;
|
|
251
289
|
}
|
|
252
290
|
|
|
@@ -259,13 +297,13 @@ export interface MessageTemplateVideo extends MessageTemplateValueParent {
|
|
|
259
297
|
}
|
|
260
298
|
|
|
261
299
|
// @public
|
|
262
|
-
export type NotificationContent = NotificationContentParent | TextNotificationContent | MediaNotificationContent | TemplateNotificationContent;
|
|
300
|
+
export type NotificationContent = NotificationContentParent | TextNotificationContent | MediaNotificationContent | ImageNotificationContent | DocumentNotificationContent | VideoNotificationContent | AudioNotificationContent | TemplateNotificationContent;
|
|
263
301
|
|
|
264
302
|
// @public
|
|
265
303
|
export interface NotificationContentParent {
|
|
266
304
|
channelRegistrationId: string;
|
|
267
305
|
// (undocumented)
|
|
268
|
-
kind:
|
|
306
|
+
kind: CommunicationMessageKind;
|
|
269
307
|
to: string[];
|
|
270
308
|
}
|
|
271
309
|
|
|
@@ -287,14 +325,6 @@ export interface PagingOptions<TResponse> {
|
|
|
287
325
|
customGetPage?: GetPage<PaginateReturn<TResponse>[]>;
|
|
288
326
|
}
|
|
289
327
|
|
|
290
|
-
// @public
|
|
291
|
-
export interface RepeatabilityRequestHeadersOutput {
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
// @public
|
|
295
|
-
export interface RepeatabilityResponseHeadersOutput {
|
|
296
|
-
}
|
|
297
|
-
|
|
298
328
|
// @public
|
|
299
329
|
export type RepeatabilityResultOutput = "accepted" | "rejected";
|
|
300
330
|
|
|
@@ -307,7 +337,7 @@ export interface Routes {
|
|
|
307
337
|
|
|
308
338
|
// @public (undocumented)
|
|
309
339
|
export interface Send {
|
|
310
|
-
post(options
|
|
340
|
+
post(options: SendParameters): StreamableMethod<Send202Response | SendDefaultResponse>;
|
|
311
341
|
}
|
|
312
342
|
|
|
313
343
|
// @public (undocumented)
|
|
@@ -328,8 +358,7 @@ export interface Send202Response extends HttpResponse {
|
|
|
328
358
|
|
|
329
359
|
// @public (undocumented)
|
|
330
360
|
export interface SendBodyParam {
|
|
331
|
-
|
|
332
|
-
body?: NotificationContent;
|
|
361
|
+
body: NotificationContent;
|
|
333
362
|
}
|
|
334
363
|
|
|
335
364
|
// @public (undocumented)
|
|
@@ -380,6 +409,16 @@ export interface TextNotificationContent extends NotificationContentParent {
|
|
|
380
409
|
kind: "text";
|
|
381
410
|
}
|
|
382
411
|
|
|
412
|
+
// @public
|
|
413
|
+
export interface VideoNotificationContent extends NotificationContentParent {
|
|
414
|
+
caption?: string;
|
|
415
|
+
kind: "video";
|
|
416
|
+
mediaUri: string;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// @public
|
|
420
|
+
export type WhatsAppMessageButtonSubType = string;
|
|
421
|
+
|
|
383
422
|
// @public
|
|
384
423
|
export interface WhatsAppMessageTemplateBindings extends MessageTemplateBindingsParent {
|
|
385
424
|
body?: Array<WhatsAppMessageTemplateBindingsComponent>;
|
|
@@ -392,7 +431,7 @@ export interface WhatsAppMessageTemplateBindings extends MessageTemplateBindings
|
|
|
392
431
|
// @public
|
|
393
432
|
export interface WhatsAppMessageTemplateBindingsButton {
|
|
394
433
|
refValue: string;
|
|
395
|
-
subType:
|
|
434
|
+
subType: WhatsAppMessageButtonSubType;
|
|
396
435
|
}
|
|
397
436
|
|
|
398
437
|
// @public
|
|
@@ -12,10 +12,20 @@ import { RequestParameters } from '@azure-rest/core-client';
|
|
|
12
12
|
import { StreamableMethod } from '@azure-rest/core-client';
|
|
13
13
|
import { TokenCredential } from '@azure/core-auth';
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
export declare interface
|
|
15
|
+
/** A request to send an audio notification. */
|
|
16
|
+
export declare interface AudioNotificationContent extends NotificationContentParent {
|
|
17
|
+
/** Message notification type is audio. */
|
|
18
|
+
kind: "audio";
|
|
19
|
+
/** A media url for the file. Required if the type is one of the supported media types, e.g. image */
|
|
20
|
+
mediaUri: string;
|
|
17
21
|
}
|
|
18
22
|
|
|
23
|
+
/** Alias for CommunicationMessageKind */
|
|
24
|
+
export declare type CommunicationMessageKind = string;
|
|
25
|
+
|
|
26
|
+
/** Alias for CommunicationMessagesChannelOutput */
|
|
27
|
+
export declare type CommunicationMessagesChannelOutput = string;
|
|
28
|
+
|
|
19
29
|
/**
|
|
20
30
|
* Initialize a new instance of `MessagesServiceClient`
|
|
21
31
|
* @param connectionString - The connectionString or url of your Communication Services resource.
|
|
@@ -32,6 +42,18 @@ declare function createClient(connectionString: string, options?: ClientOptions)
|
|
|
32
42
|
declare function createClient(endpoint: string, credential: KeyCredential | TokenCredential, options?: ClientOptions): MessagesServiceClient;
|
|
33
43
|
export default createClient;
|
|
34
44
|
|
|
45
|
+
/** A request to send a document notification. */
|
|
46
|
+
export declare interface DocumentNotificationContent extends NotificationContentParent {
|
|
47
|
+
/** Message notification type is image. */
|
|
48
|
+
kind: "document";
|
|
49
|
+
/** Optional text content. */
|
|
50
|
+
caption?: string;
|
|
51
|
+
/** Optional name for the file. */
|
|
52
|
+
fileName?: string;
|
|
53
|
+
/** A media url for the file. Required if the type is one of the supported media types, e.g. image */
|
|
54
|
+
mediaUri: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
35
57
|
/**
|
|
36
58
|
* Helper type to extract the type of an array
|
|
37
59
|
*/
|
|
@@ -45,6 +67,8 @@ export declare interface GetMedia {
|
|
|
45
67
|
export declare interface GetMedia200Headers {
|
|
46
68
|
/** An opaque, globally-unique, client-generated string identifier for the request. */
|
|
47
69
|
"x-ms-client-request-id"?: string;
|
|
70
|
+
/** The stream content type. */
|
|
71
|
+
"content-type": "application/octet-stream";
|
|
48
72
|
}
|
|
49
73
|
|
|
50
74
|
/** The request has succeeded. */
|
|
@@ -85,6 +109,16 @@ export declare type GetPage<TPage> = (pageLink: string, maxPageSize?: number) =>
|
|
|
85
109
|
nextPageLink?: string;
|
|
86
110
|
}>;
|
|
87
111
|
|
|
112
|
+
/** A request to send an image notification. */
|
|
113
|
+
export declare interface ImageNotificationContent extends NotificationContentParent {
|
|
114
|
+
/** Message notification type is image. */
|
|
115
|
+
kind: "image";
|
|
116
|
+
/** Optional text content. */
|
|
117
|
+
caption?: string;
|
|
118
|
+
/** A media url for the file. Required if the type is one of the supported media types, e.g. image */
|
|
119
|
+
mediaUri: string;
|
|
120
|
+
}
|
|
121
|
+
|
|
88
122
|
export declare function isUnexpected(response: GetMedia200Response | GetMediaDefaultResponse): response is GetMediaDefaultResponse;
|
|
89
123
|
|
|
90
124
|
export declare function isUnexpected(response: Send202Response | SendDefaultResponse): response is SendDefaultResponse;
|
|
@@ -139,10 +173,10 @@ export declare interface ListTemplatesQueryParamProperties {
|
|
|
139
173
|
maxpagesize?: number;
|
|
140
174
|
}
|
|
141
175
|
|
|
142
|
-
/** A request to send
|
|
176
|
+
/** @deprecated A request to send an image notification. */
|
|
143
177
|
export declare interface MediaNotificationContent extends NotificationContentParent {
|
|
144
178
|
/** Message notification type is image. */
|
|
145
|
-
kind: "
|
|
179
|
+
kind: "image_v0";
|
|
146
180
|
/** Optional text content. */
|
|
147
181
|
content?: string;
|
|
148
182
|
/** A media url for the file. Required if the type is one of the supported media types, e.g. image */
|
|
@@ -161,6 +195,12 @@ export declare type MessagesServiceClient = Client & {
|
|
|
161
195
|
path: Routes;
|
|
162
196
|
};
|
|
163
197
|
|
|
198
|
+
/** The optional parameters for the client */
|
|
199
|
+
export declare interface MessagesServiceClientOptions extends ClientOptions {
|
|
200
|
+
/** The api version option of the client */
|
|
201
|
+
apiVersion?: string;
|
|
202
|
+
}
|
|
203
|
+
|
|
164
204
|
/** The template object used to create templates. */
|
|
165
205
|
export declare interface MessageTemplate {
|
|
166
206
|
/** Name of the template. */
|
|
@@ -176,9 +216,12 @@ export declare interface MessageTemplate {
|
|
|
176
216
|
/** The binding object to link values to the template specific locations */
|
|
177
217
|
export declare type MessageTemplateBindings = MessageTemplateBindingsParent | WhatsAppMessageTemplateBindings;
|
|
178
218
|
|
|
219
|
+
/** Alias for MessageTemplateBindingsKind */
|
|
220
|
+
export declare type MessageTemplateBindingsKind = string;
|
|
221
|
+
|
|
179
222
|
/** The binding object to link values to the template specific locations */
|
|
180
223
|
export declare interface MessageTemplateBindingsParent {
|
|
181
|
-
kind:
|
|
224
|
+
kind: MessageTemplateBindingsKind;
|
|
182
225
|
}
|
|
183
226
|
|
|
184
227
|
/** The message template's document value information. */
|
|
@@ -219,8 +262,8 @@ export declare interface MessageTemplateItemOutputParent {
|
|
|
219
262
|
*
|
|
220
263
|
* Possible values: "approved", "rejected", "pending", "paused"
|
|
221
264
|
*/
|
|
222
|
-
status:
|
|
223
|
-
kind:
|
|
265
|
+
status: MessageTemplateStatusOutput;
|
|
266
|
+
kind: CommunicationMessagesChannelOutput;
|
|
224
267
|
}
|
|
225
268
|
|
|
226
269
|
/** The message template's location value information. */
|
|
@@ -247,6 +290,9 @@ export declare interface MessageTemplateQuickAction extends MessageTemplateValue
|
|
|
247
290
|
payload?: string;
|
|
248
291
|
}
|
|
249
292
|
|
|
293
|
+
/** Alias for MessageTemplateStatusOutput */
|
|
294
|
+
export declare type MessageTemplateStatusOutput = string;
|
|
295
|
+
|
|
250
296
|
/** The message template's text value information. */
|
|
251
297
|
export declare interface MessageTemplateText extends MessageTemplateValueParent {
|
|
252
298
|
/** Message parameter type is text. */
|
|
@@ -258,11 +304,14 @@ export declare interface MessageTemplateText extends MessageTemplateValueParent
|
|
|
258
304
|
/** The class describes a parameter of a template. */
|
|
259
305
|
export declare type MessageTemplateValue = MessageTemplateValueParent | MessageTemplateText | MessageTemplateImage | MessageTemplateDocument | MessageTemplateVideo | MessageTemplateLocation | MessageTemplateQuickAction;
|
|
260
306
|
|
|
307
|
+
/** Alias for MessageTemplateValueKind */
|
|
308
|
+
export declare type MessageTemplateValueKind = string;
|
|
309
|
+
|
|
261
310
|
/** The class describes a parameter of a template. */
|
|
262
311
|
export declare interface MessageTemplateValueParent {
|
|
263
312
|
/** Template binding reference name */
|
|
264
313
|
name: string;
|
|
265
|
-
kind:
|
|
314
|
+
kind: MessageTemplateValueKind;
|
|
266
315
|
}
|
|
267
316
|
|
|
268
317
|
/** The message template's video value information. */
|
|
@@ -278,7 +327,7 @@ export declare interface MessageTemplateVideo extends MessageTemplateValueParent
|
|
|
278
327
|
}
|
|
279
328
|
|
|
280
329
|
/** Details of the message to send. */
|
|
281
|
-
export declare type NotificationContent = NotificationContentParent | TextNotificationContent | MediaNotificationContent | TemplateNotificationContent;
|
|
330
|
+
export declare type NotificationContent = NotificationContentParent | TextNotificationContent | MediaNotificationContent | ImageNotificationContent | DocumentNotificationContent | VideoNotificationContent | AudioNotificationContent | TemplateNotificationContent;
|
|
282
331
|
|
|
283
332
|
/** Details of the message to send. */
|
|
284
333
|
export declare interface NotificationContentParent {
|
|
@@ -286,7 +335,7 @@ export declare interface NotificationContentParent {
|
|
|
286
335
|
channelRegistrationId: string;
|
|
287
336
|
/** The native external platform user identifiers of the recipient. */
|
|
288
337
|
to: string[];
|
|
289
|
-
kind:
|
|
338
|
+
kind: CommunicationMessageKind;
|
|
290
339
|
}
|
|
291
340
|
|
|
292
341
|
/** Paged collection of MessageTemplateItem items */
|
|
@@ -324,14 +373,6 @@ export declare interface PagingOptions<TResponse> {
|
|
|
324
373
|
customGetPage?: GetPage<PaginateReturn<TResponse>[]>;
|
|
325
374
|
}
|
|
326
375
|
|
|
327
|
-
/** Provides the 'Repeatability-*' headers to enable repeatable requests. */
|
|
328
|
-
export declare interface RepeatabilityRequestHeadersOutput {
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/** Provides the 'Repeatability-*' headers to enable repeatable requests. */
|
|
332
|
-
export declare interface RepeatabilityResponseHeadersOutput {
|
|
333
|
-
}
|
|
334
|
-
|
|
335
376
|
/** Alias for RepeatabilityResultOutput */
|
|
336
377
|
export declare type RepeatabilityResultOutput = "accepted" | "rejected";
|
|
337
378
|
|
|
@@ -346,7 +387,7 @@ export declare interface Routes {
|
|
|
346
387
|
|
|
347
388
|
export declare interface Send {
|
|
348
389
|
/** Sends a notification message from Business to User. */
|
|
349
|
-
post(options
|
|
390
|
+
post(options: SendParameters): StreamableMethod<Send202Response | SendDefaultResponse>;
|
|
350
391
|
}
|
|
351
392
|
|
|
352
393
|
export declare interface Send202Headers {
|
|
@@ -364,7 +405,8 @@ export declare interface Send202Response extends HttpResponse {
|
|
|
364
405
|
}
|
|
365
406
|
|
|
366
407
|
export declare interface SendBodyParam {
|
|
367
|
-
|
|
408
|
+
/** Details of the message to send. */
|
|
409
|
+
body: NotificationContent;
|
|
368
410
|
}
|
|
369
411
|
|
|
370
412
|
export declare interface SendDefaultHeaders {
|
|
@@ -415,6 +457,19 @@ export declare interface TextNotificationContent extends NotificationContentPare
|
|
|
415
457
|
content: string;
|
|
416
458
|
}
|
|
417
459
|
|
|
460
|
+
/** A request to send a video notification. */
|
|
461
|
+
export declare interface VideoNotificationContent extends NotificationContentParent {
|
|
462
|
+
/** Message notification type is image. */
|
|
463
|
+
kind: "video";
|
|
464
|
+
/** Optional text content. */
|
|
465
|
+
caption?: string;
|
|
466
|
+
/** A media url for the file. Required if the type is one of the supported media types, e.g. image */
|
|
467
|
+
mediaUri: string;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/** Alias for WhatsAppMessageButtonSubType */
|
|
471
|
+
export declare type WhatsAppMessageButtonSubType = string;
|
|
472
|
+
|
|
418
473
|
/** The template bindings for WhatsApp */
|
|
419
474
|
export declare interface WhatsAppMessageTemplateBindings extends MessageTemplateBindingsParent {
|
|
420
475
|
/** MessageTemplateBindings is whatsApp */
|
|
@@ -436,7 +491,7 @@ export declare interface WhatsAppMessageTemplateBindingsButton {
|
|
|
436
491
|
*
|
|
437
492
|
* Possible values: "quickReply", "url"
|
|
438
493
|
*/
|
|
439
|
-
subType:
|
|
494
|
+
subType: WhatsAppMessageButtonSubType;
|
|
440
495
|
/** The name of the referenced item in the template values. */
|
|
441
496
|
refValue: string;
|
|
442
497
|
}
|