@azure-tools/communication-short-codes 1.0.0-beta.1 → 1.0.0-beta.2
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/CHANGELOG.md +7 -0
- package/dist/index.js +80 -155
- package/dist/index.js.map +1 -1
- package/dist-esm/src/generated/src/index.js +1 -0
- package/dist-esm/src/generated/src/index.js.map +1 -1
- package/dist-esm/src/generated/src/models/index.js.map +1 -1
- package/dist-esm/src/generated/src/models/mappers.js +8 -65
- package/dist-esm/src/generated/src/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/src/models/parameters.js +1 -0
- package/dist-esm/src/generated/src/models/parameters.js.map +1 -1
- package/dist-esm/src/generated/src/operations/index.js +1 -1
- package/dist-esm/src/generated/src/operations/index.js.map +1 -1
- package/dist-esm/src/generated/src/operations/{shortCodes.js → shortCodesOperations.js} +19 -46
- package/dist-esm/src/generated/src/operations/shortCodesOperations.js.map +1 -0
- package/dist-esm/src/generated/src/operationsInterfaces/index.js +9 -0
- package/dist-esm/src/generated/src/operationsInterfaces/index.js.map +1 -0
- package/dist-esm/src/generated/src/operationsInterfaces/shortCodesOperations.js +9 -0
- package/dist-esm/src/generated/src/operationsInterfaces/shortCodesOperations.js.map +1 -0
- package/dist-esm/src/generated/src/shortCodesClient.js +2 -2
- package/dist-esm/src/generated/src/shortCodesClient.js.map +1 -1
- package/dist-esm/src/generated/src/shortCodesClientContext.js +13 -11
- package/dist-esm/src/generated/src/shortCodesClientContext.js.map +1 -1
- package/dist-esm/src/models.js.map +1 -1
- package/dist-esm/src/shortCodesClient.js +19 -29
- package/dist-esm/src/shortCodesClient.js.map +1 -1
- package/dist-esm/src/utils/constants.js +1 -1
- package/dist-esm/src/utils/constants.js.map +1 -1
- package/dist-esm/src/utils/tracing.js +1 -1
- package/dist-esm/src/utils/tracing.js.map +1 -1
- package/package.json +32 -28
- package/types/communication-short-codes.d.ts +10 -10
- package/dist-esm/src/generated/src/operations/shortCodes.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
/// <reference lib="esnext.asynciterable" />
|
|
4
|
-
import {
|
|
4
|
+
import { isKeyCredential, parseClientArguments } from "@azure/communication-common";
|
|
5
5
|
import { isTokenCredential } from "@azure/core-auth";
|
|
6
|
-
import {
|
|
7
|
-
import { logger, createSpan, SDK_VERSION } from "./utils";
|
|
6
|
+
import { createSpan, logger } from "./utils";
|
|
8
7
|
import { ShortCodesClient as ShortCodesGeneratedClient } from "./generated/src";
|
|
9
8
|
import { SpanStatusCode } from "@azure/core-tracing";
|
|
9
|
+
import { createCommunicationAuthPolicy } from "@azure/communication-common";
|
|
10
10
|
const isShortCodesClientOptions = (options) => options && !isKeyCredential(options) && !isTokenCredential(options);
|
|
11
11
|
export class ShortCodesClient {
|
|
12
12
|
constructor(connectionStringOrUrl, credentialOrOptions, maybeOptions = {}) {
|
|
@@ -14,34 +14,24 @@ export class ShortCodesClient {
|
|
|
14
14
|
const options = isShortCodesClientOptions(credentialOrOptions)
|
|
15
15
|
? credentialOrOptions
|
|
16
16
|
: maybeOptions;
|
|
17
|
-
const libInfo = `azsdk-js-communication-short-codes/${SDK_VERSION}`;
|
|
18
|
-
if (!options.userAgentOptions) {
|
|
19
|
-
options.userAgentOptions = {};
|
|
20
|
-
}
|
|
21
|
-
if (options.userAgentOptions.userAgentPrefix) {
|
|
22
|
-
options.userAgentOptions.userAgentPrefix = `${options.userAgentOptions.userAgentPrefix} ${libInfo}`;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
options.userAgentOptions.userAgentPrefix = libInfo;
|
|
26
|
-
}
|
|
27
17
|
const internalPipelineOptions = Object.assign(Object.assign({}, options), {
|
|
28
18
|
loggingOptions: {
|
|
29
|
-
logger: logger.info
|
|
30
|
-
}
|
|
19
|
+
logger: logger.info,
|
|
20
|
+
},
|
|
31
21
|
});
|
|
22
|
+
this.client = new ShortCodesGeneratedClient(url, internalPipelineOptions);
|
|
32
23
|
const authPolicy = createCommunicationAuthPolicy(credential);
|
|
33
|
-
|
|
34
|
-
this.client = new ShortCodesGeneratedClient(url, pipeline).shortCodes;
|
|
24
|
+
this.client.pipeline.addPolicy(authPolicy);
|
|
35
25
|
}
|
|
36
26
|
listShortCodes(options = {}) {
|
|
37
27
|
const { span, updatedOptions } = createSpan("ShortCodesClient-listShortCodes", options);
|
|
38
28
|
try {
|
|
39
|
-
return this.client.listShortCodes(updatedOptions);
|
|
29
|
+
return this.client.shortCodesOperations.listShortCodes(updatedOptions);
|
|
40
30
|
}
|
|
41
31
|
catch (e) {
|
|
42
32
|
span.setStatus({
|
|
43
33
|
code: SpanStatusCode.ERROR,
|
|
44
|
-
message: e.message
|
|
34
|
+
message: e.message,
|
|
45
35
|
});
|
|
46
36
|
throw e;
|
|
47
37
|
}
|
|
@@ -52,12 +42,12 @@ export class ShortCodesClient {
|
|
|
52
42
|
async upsertUSProgramBrief(programBriefId, options = {}) {
|
|
53
43
|
const { span, updatedOptions } = createSpan("ShortCodesClient-upsertUSProgramBrief", options);
|
|
54
44
|
try {
|
|
55
|
-
return await this.client.upsertUSProgramBrief(programBriefId, updatedOptions);
|
|
45
|
+
return await this.client.shortCodesOperations.upsertUSProgramBrief(programBriefId, updatedOptions);
|
|
56
46
|
}
|
|
57
47
|
catch (e) {
|
|
58
48
|
span.setStatus({
|
|
59
49
|
code: SpanStatusCode.ERROR,
|
|
60
|
-
message: e.message
|
|
50
|
+
message: e.message,
|
|
61
51
|
});
|
|
62
52
|
throw e;
|
|
63
53
|
}
|
|
@@ -68,12 +58,12 @@ export class ShortCodesClient {
|
|
|
68
58
|
async deleteUSProgramBrief(programBriefId, options) {
|
|
69
59
|
const { span, updatedOptions } = createSpan("ShortCodesClient-deleteUSProgramBrief", options);
|
|
70
60
|
try {
|
|
71
|
-
return await this.client.deleteUSProgramBrief(programBriefId, updatedOptions);
|
|
61
|
+
return await this.client.shortCodesOperations.deleteUSProgramBrief(programBriefId, updatedOptions);
|
|
72
62
|
}
|
|
73
63
|
catch (e) {
|
|
74
64
|
span.setStatus({
|
|
75
65
|
code: SpanStatusCode.ERROR,
|
|
76
|
-
message: e.message
|
|
66
|
+
message: e.message,
|
|
77
67
|
});
|
|
78
68
|
throw e;
|
|
79
69
|
}
|
|
@@ -84,12 +74,12 @@ export class ShortCodesClient {
|
|
|
84
74
|
async getUSProgramBrief(programBriefId, options) {
|
|
85
75
|
const { span, updatedOptions } = createSpan("ShortCodesClient-getUSProgramBrief", options);
|
|
86
76
|
try {
|
|
87
|
-
return await this.client.getUSProgramBrief(programBriefId, updatedOptions);
|
|
77
|
+
return await this.client.shortCodesOperations.getUSProgramBrief(programBriefId, updatedOptions);
|
|
88
78
|
}
|
|
89
79
|
catch (e) {
|
|
90
80
|
span.setStatus({
|
|
91
81
|
code: SpanStatusCode.ERROR,
|
|
92
|
-
message: e.message
|
|
82
|
+
message: e.message,
|
|
93
83
|
});
|
|
94
84
|
throw e;
|
|
95
85
|
}
|
|
@@ -100,12 +90,12 @@ export class ShortCodesClient {
|
|
|
100
90
|
listUSProgramBriefs(options = {}) {
|
|
101
91
|
const { span, updatedOptions } = createSpan("ShortCodesClient-listUSProgramBriefs", options);
|
|
102
92
|
try {
|
|
103
|
-
return this.client.listUSProgramBriefs(updatedOptions);
|
|
93
|
+
return this.client.shortCodesOperations.listUSProgramBriefs(updatedOptions);
|
|
104
94
|
}
|
|
105
95
|
catch (e) {
|
|
106
96
|
span.setStatus({
|
|
107
97
|
code: SpanStatusCode.ERROR,
|
|
108
|
-
message: e.message
|
|
98
|
+
message: e.message,
|
|
109
99
|
});
|
|
110
100
|
throw e;
|
|
111
101
|
}
|
|
@@ -116,12 +106,12 @@ export class ShortCodesClient {
|
|
|
116
106
|
async submitUSProgramBrief(programBriefId, options) {
|
|
117
107
|
const { span, updatedOptions } = createSpan("ShortCodesClient-submitUSProgramBrief", options);
|
|
118
108
|
try {
|
|
119
|
-
return await this.client.submitUSProgramBrief(programBriefId, updatedOptions);
|
|
109
|
+
return await this.client.shortCodesOperations.submitUSProgramBrief(programBriefId, updatedOptions);
|
|
120
110
|
}
|
|
121
111
|
catch (e) {
|
|
122
112
|
span.setStatus({
|
|
123
113
|
code: SpanStatusCode.ERROR,
|
|
124
|
-
message: e.message
|
|
114
|
+
message: e.message,
|
|
125
115
|
});
|
|
126
116
|
throw e;
|
|
127
117
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shortCodesClient.js","sourceRoot":"","sources":["../../src/shortCodesClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,4CAA4C;AAE5C,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,6BAA6B,EAC9B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAkC,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAGL,yBAAyB,EAE1B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,gBAAgB,IAAI,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAOhF,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAcrD,MAAM,yBAAyB,GAAG,CAAC,OAAY,EAAsC,EAAE,CACrF,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAEtE,MAAM,OAAO,gBAAgB;IAoB3B,YACE,qBAA6B,EAC7B,mBAA+E,EAC/E,eAAwC,EAAE;QAE1C,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,oBAAoB,CAAC,qBAAqB,EAAE,mBAAmB,CAAC,CAAC;QAC7F,MAAM,OAAO,GAAG,yBAAyB,CAAC,mBAAmB,CAAC;YAC5D,CAAC,CAAC,mBAAmB;YACrB,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AAS,CAAC;gBACb,IAAI,EAAE,cAAc,CAAC,KAAK;gBAC1B,OAAO,EAAE,CAAC,CAAC,OAAO;aACnB,CAAC,CAAC;YACH,MAAM,CAAC,CAAC;SACT;gBAAS;YACR,IAAI,CAAC,GAAG,EAAE,CAAC;SACZ;IACH,CAAC;IAEM,mBAAmB,CACxB,UAAsC,EAAE;QAExC,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,UAAU,CAAC,sCAAsC,EAAE,OAAO,CAAC,CAAC;QAC7F,IAAI;YACF,OAAO,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC;SACxD;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,SAAS,CAAC;gBACb,IAAI,EAAE,cAAc,CAAC,KAAK;gBAC1B,OAAO,EAAE,CAAC,CAAC,OAAO;aACnB,CAAC,CAAC;YACH,MAAM,CAAC,CAAC;SACT;gBAAS;YACR,IAAI,CAAC,GAAG,EAAE,CAAC;SACZ;IACH,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAC/B,cAAsB,EACtB,OAAqC;QAErC,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,UAAU,CAAC,uCAAuC,EAAE,OAAO,CAAC,CAAC;QAC9F,IAAI;YACF,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;SAC/E;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,SAAS,CAAC;gBACb,IAAI,EAAE,cAAc,CAAC,KAAK;gBAC1B,OAAO,EAAE,CAAC,CAAC,OAAO;aACnB,CAAC,CAAC;YACH,MAAM,CAAC,CAAC;SACT;gBAAS;YACR,IAAI,CAAC,GAAG,EAAE,CAAC;SACZ;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n/// <reference lib=\"esnext.asynciterable\" />\n\nimport {\n parseClientArguments,\n isKeyCredential,\n createCommunicationAuthPolicy\n} from \"@azure/communication-common\";\nimport { isTokenCredential, KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport {\n PipelineOptions,\n InternalPipelineOptions,\n createPipelineFromOptions,\n RestResponse\n} from \"@azure/core-http\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { logger, createSpan, SDK_VERSION } from \"./utils\";\nimport { ShortCodesClient as ShortCodesGeneratedClient } from \"./generated/src\";\nimport { ShortCodes as GeneratedClient } from \"./generated/src/operations\";\nimport {\n ShortCode,\n ShortCodesUpsertUSProgramBriefOptionalParams,\n USProgramBrief\n} from \"./generated/src/models/\";\nimport { SpanStatusCode } from \"@azure/core-tracing\";\nimport {\n DeleteUSProgramBriefOptions,\n GetUSProgramBriefOptions,\n ListShortCodesOptions,\n ListUSProgramBriefsOptions,\n SubmitUSProgramBriefOptions\n} from \"./models\";\n\n/**\n * Client options used to configure the ShortCodesClient API requests.\n */\nexport interface ShortCodesClientOptions extends PipelineOptions {}\n\nconst isShortCodesClientOptions = (options: any): options is ShortCodesClientOptions =>\n options && !isKeyCredential(options) && !isTokenCredential(options);\n\nexport class ShortCodesClient {\n /**\n * A reference to the auto-generated ShortCodes HTTP client.\n */\n private readonly client: GeneratedClient;\n\n public constructor(connectionString: string, options?: ShortCodesClientOptions);\n\n public constructor(\n endpoint: string,\n credential: KeyCredential,\n options?: ShortCodesClientOptions\n );\n\n public constructor(\n endpoint: string,\n credential: TokenCredential,\n options?: ShortCodesClientOptions\n );\n\n public constructor(\n connectionStringOrUrl: string,\n credentialOrOptions?: KeyCredential | TokenCredential | ShortCodesClientOptions,\n maybeOptions: ShortCodesClientOptions = {}\n ) {\n const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);\n const options = isShortCodesClientOptions(credentialOrOptions)\n ? credentialOrOptions\n : maybeOptions;\n const libInfo = `azsdk-js-communication-short-codes/${SDK_VERSION}`;\n\n if (!options.userAgentOptions) {\n options.userAgentOptions = {};\n }\n\n if (options.userAgentOptions.userAgentPrefix) {\n options.userAgentOptions.userAgentPrefix = `${options.userAgentOptions.userAgentPrefix} ${libInfo}`;\n } else {\n options.userAgentOptions.userAgentPrefix = libInfo;\n }\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info\n }\n }\n };\n\n const authPolicy = createCommunicationAuthPolicy(credential);\n const pipeline = createPipelineFromOptions(internalPipelineOptions, authPolicy);\n this.client = new ShortCodesGeneratedClient(url, pipeline).shortCodes;\n }\n\n public listShortCodes(\n options: ListShortCodesOptions = {}\n ): PagedAsyncIterableIterator<ShortCode> {\n const { span, updatedOptions } = createSpan(\"ShortCodesClient-listShortCodes\", options);\n try {\n return this.client.listShortCodes(updatedOptions);\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n public async upsertUSProgramBrief(\n programBriefId: string,\n options: ShortCodesUpsertUSProgramBriefOptionalParams = {}\n ): Promise<RestResponse> {\n const { span, updatedOptions } = createSpan(\"ShortCodesClient-upsertUSProgramBrief\", options);\n try {\n return await this.client.upsertUSProgramBrief(programBriefId, updatedOptions);\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n public async deleteUSProgramBrief(\n programBriefId: string,\n options?: DeleteUSProgramBriefOptions\n ): Promise<RestResponse> {\n const { span, updatedOptions } = createSpan(\"ShortCodesClient-deleteUSProgramBrief\", options);\n try {\n return await this.client.deleteUSProgramBrief(programBriefId, updatedOptions);\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n public async getUSProgramBrief(\n programBriefId: string,\n options?: GetUSProgramBriefOptions\n ): Promise<USProgramBrief> {\n const { span, updatedOptions } = createSpan(\"ShortCodesClient-getUSProgramBrief\", options);\n try {\n return await this.client.getUSProgramBrief(programBriefId, updatedOptions);\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n public listUSProgramBriefs(\n options: ListUSProgramBriefsOptions = {}\n ): PagedAsyncIterableIterator<USProgramBrief> {\n const { span, updatedOptions } = createSpan(\"ShortCodesClient-listUSProgramBriefs\", options);\n try {\n return this.client.listUSProgramBriefs(updatedOptions);\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n public async submitUSProgramBrief(\n programBriefId: string,\n options?: SubmitUSProgramBriefOptions\n ): Promise<RestResponse> {\n const { span, updatedOptions } = createSpan(\"ShortCodesClient-submitUSProgramBrief\", options);\n try {\n return await this.client.submitUSProgramBrief(programBriefId, updatedOptions);\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"shortCodesClient.js","sourceRoot":"","sources":["../../src/shortCodesClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,4CAA4C;AAE5C,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAkC,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrF,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,gBAAgB,IAAI,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAMhF,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAQrD,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAO5E,MAAM,yBAAyB,GAAG,CAAC,OAAY,EAAsC,EAAE,CACrF,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CA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gBAC1B,OAAO,EAAE,CAAC,CAAC,OAAO;aACnB,CAAC,CAAC;YACH,MAAM,CAAC,CAAC;SACT;gBAAS;YACR,IAAI,CAAC,GAAG,EAAE,CAAC;SACZ;IACH,CAAC;IAEM,mBAAmB,CACxB,UAAsC,EAAE;QAExC,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,UAAU,CAAC,sCAAsC,EAAE,OAAO,CAAC,CAAC;QAC7F,IAAI;YACF,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC;SAC7E;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,SAAS,CAAC;gBACb,IAAI,EAAE,cAAc,CAAC,KAAK;gBAC1B,OAAO,EAAE,CAAC,CAAC,OAAO;aACnB,CAAC,CAAC;YACH,MAAM,CAAC,CAAC;SACT;gBAAS;YACR,IAAI,CAAC,GAAG,EAAE,CAAC;SACZ;IACH,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAC/B,cAAsB,EACtB,OAAqC;QAErC,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,UAAU,CAAC,uCAAuC,EAAE,OAAO,CAAC,CAAC;QAC9F,IAAI;YACF,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,oBAAoB,CAChE,cAAc,EACd,cAAc,CACf,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,SAAS,CAAC;gBACb,IAAI,EAAE,cAAc,CAAC,KAAK;gBAC1B,OAAO,EAAE,CAAC,CAAC,OAAO;aACnB,CAAC,CAAC;YACH,MAAM,CAAC,CAAC;SACT;gBAAS;YACR,IAAI,CAAC,GAAG,EAAE,CAAC;SACZ;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n/// <reference lib=\"esnext.asynciterable\" />\n\nimport { isKeyCredential, parseClientArguments } from \"@azure/communication-common\";\nimport { KeyCredential, TokenCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { CommonClientOptions, InternalClientPipelineOptions } from \"@azure/core-client\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { createSpan, logger } from \"./utils\";\nimport { ShortCodesClient as ShortCodesGeneratedClient } from \"./generated/src\";\nimport {\n ShortCode,\n ShortCodesUpsertUSProgramBriefOptionalParams,\n USProgramBrief,\n} from \"./generated/src/models/\";\nimport { SpanStatusCode } from \"@azure/core-tracing\";\nimport {\n DeleteUSProgramBriefOptions,\n GetUSProgramBriefOptions,\n ListShortCodesOptions,\n ListUSProgramBriefsOptions,\n SubmitUSProgramBriefOptions,\n} from \"./models\";\nimport { createCommunicationAuthPolicy } from \"@azure/communication-common\";\n\n/**\n * Client options used to configure the ShortCodesClient API requests.\n */\nexport interface ShortCodesClientOptions extends CommonClientOptions {}\n\nconst isShortCodesClientOptions = (options: any): options is ShortCodesClientOptions =>\n options && !isKeyCredential(options) && !isTokenCredential(options);\n\nexport class ShortCodesClient {\n /**\n * A reference to the auto-generated ShortCodes HTTP client.\n */\n private readonly client: ShortCodesGeneratedClient;\n\n public constructor(connectionString: string, options?: ShortCodesClientOptions);\n\n public constructor(\n endpoint: string,\n credential: KeyCredential,\n options?: ShortCodesClientOptions\n );\n\n public constructor(\n endpoint: string,\n credential: TokenCredential,\n options?: ShortCodesClientOptions\n );\n\n public constructor(\n connectionStringOrUrl: string,\n credentialOrOptions?: KeyCredential | TokenCredential | ShortCodesClientOptions,\n maybeOptions: ShortCodesClientOptions = {}\n ) {\n const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);\n const options = isShortCodesClientOptions(credentialOrOptions)\n ? credentialOrOptions\n : maybeOptions;\n\n const internalPipelineOptions: InternalClientPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n },\n },\n };\n\n this.client = new ShortCodesGeneratedClient(url, internalPipelineOptions);\n const authPolicy = createCommunicationAuthPolicy(credential);\n this.client.pipeline.addPolicy(authPolicy);\n }\n\n public listShortCodes(\n options: ListShortCodesOptions = {}\n ): PagedAsyncIterableIterator<ShortCode> {\n const { span, updatedOptions } = createSpan(\"ShortCodesClient-listShortCodes\", options);\n try {\n return this.client.shortCodesOperations.listShortCodes(updatedOptions);\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n public async upsertUSProgramBrief(\n programBriefId: string,\n options: ShortCodesUpsertUSProgramBriefOptionalParams = {}\n ): Promise<USProgramBrief> {\n const { span, updatedOptions } = createSpan(\"ShortCodesClient-upsertUSProgramBrief\", options);\n try {\n return await this.client.shortCodesOperations.upsertUSProgramBrief(\n programBriefId,\n updatedOptions\n );\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n public async deleteUSProgramBrief(\n programBriefId: string,\n options?: DeleteUSProgramBriefOptions\n ): Promise<void> {\n const { span, updatedOptions } = createSpan(\"ShortCodesClient-deleteUSProgramBrief\", options);\n try {\n return await this.client.shortCodesOperations.deleteUSProgramBrief(\n programBriefId,\n updatedOptions\n );\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n public async getUSProgramBrief(\n programBriefId: string,\n options?: GetUSProgramBriefOptions\n ): Promise<USProgramBrief> {\n const { span, updatedOptions } = createSpan(\"ShortCodesClient-getUSProgramBrief\", options);\n try {\n return await this.client.shortCodesOperations.getUSProgramBrief(\n programBriefId,\n updatedOptions\n );\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n public listUSProgramBriefs(\n options: ListUSProgramBriefsOptions = {}\n ): PagedAsyncIterableIterator<USProgramBrief> {\n const { span, updatedOptions } = createSpan(\"ShortCodesClient-listUSProgramBriefs\", options);\n try {\n return this.client.shortCodesOperations.listUSProgramBriefs(updatedOptions);\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n public async submitUSProgramBrief(\n programBriefId: string,\n options?: SubmitUSProgramBriefOptions\n ): Promise<USProgramBrief> {\n const { span, updatedOptions } = createSpan(\"ShortCodesClient-submitUSProgramBrief\", options);\n try {\n return await this.client.shortCodesOperations.submitUSProgramBrief(\n programBriefId,\n updatedOptions\n );\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAW,cAAc,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport const SDK_VERSION: string = \"1.0.0-beta.
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAW,cAAc,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport const SDK_VERSION: string = \"1.0.0-beta.2\";\n"]}
|
|
@@ -9,6 +9,6 @@ import { createSpanFunction } from "@azure/core-tracing";
|
|
|
9
9
|
*/
|
|
10
10
|
export const createSpan = createSpanFunction({
|
|
11
11
|
packagePrefix: "Azure.Communication",
|
|
12
|
-
namespace: "Microsoft.Communication"
|
|
12
|
+
namespace: "Microsoft.Communication",
|
|
13
13
|
});
|
|
14
14
|
//# sourceMappingURL=tracing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../../src/utils/tracing.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC;IAC3C,aAAa,EAAE,qBAAqB;IACpC,SAAS,EAAE,yBAAyB;CACrC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createSpanFunction } from \"@azure/core-tracing\";\n\n/**\n * Creates a span using the global tracer.\n * @internal\n * @param name - The name of the operation being performed.\n * @param tracingOptions - The options for the underlying http request.\n */\nexport const createSpan = createSpanFunction({\n packagePrefix: \"Azure.Communication\",\n namespace: \"Microsoft.Communication\"
|
|
1
|
+
{"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../../src/utils/tracing.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC;IAC3C,aAAa,EAAE,qBAAqB;IACpC,SAAS,EAAE,yBAAyB;CACrC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createSpanFunction } from \"@azure/core-tracing\";\n\n/**\n * Creates a span using the global tracer.\n * @internal\n * @param name - The name of the operation being performed.\n * @param tracingOptions - The options for the underlying http request.\n */\nexport const createSpan = createSpanFunction({\n packagePrefix: \"Azure.Communication\",\n namespace: \"Microsoft.Communication\",\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/communication-short-codes",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
4
|
-
"description": "SDK for Azure Communication Services which facilitates short code management
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
|
+
"description": "SDK for Azure Communication Services which facilitates short code management.",
|
|
5
5
|
"sdk-type": "client",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist-esm/src/index.js",
|
|
8
8
|
"types": "types/communication-short-codes.d.ts",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
|
|
11
|
-
"build": "npm run clean && tsc -p . &&
|
|
11
|
+
"build": "npm run clean && tsc -p . && dev-tool run bundle && api-extractor run --local",
|
|
12
12
|
"build:autorest": "autorest --typescript --version=3.0.6267 --v3 ./swagger/README.md && rushx format",
|
|
13
13
|
"build:clean": "rush update --recheck && rush rebuild && npm run build",
|
|
14
|
-
"build:browser": "tsc -p . &&
|
|
15
|
-
"build:node": "tsc -p . &&
|
|
14
|
+
"build:browser": "tsc -p . && dev-tool run bundle",
|
|
15
|
+
"build:node": "tsc -p . && dev-tool run bundle",
|
|
16
16
|
"build:samples": "dev-tool samples publish --force",
|
|
17
|
-
"build:test": "tsc -p . &&
|
|
17
|
+
"build:test": "tsc -p . && dev-tool run bundle",
|
|
18
18
|
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
|
19
19
|
"clean": "rimraf dist dist-* types *.tgz *.log",
|
|
20
20
|
"execute:samples": "dev-tool samples run samples-dev",
|
|
@@ -31,9 +31,8 @@
|
|
|
31
31
|
"test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node",
|
|
32
32
|
"test:watch": "npm run test -- --watch --reporter min",
|
|
33
33
|
"unit-test:browser": "karma start --single-run",
|
|
34
|
-
"unit-test:node": "mocha --reporter ../../../common/tools/mocha-multi-reporter.js
|
|
35
|
-
"unit-test": "npm run unit-test:node && npm run unit-test:browser"
|
|
36
|
-
"docs": "typedoc --excludePrivate --excludeNotExported --excludeExternals --stripInternal --mode file --out ./dist/docs ./src"
|
|
34
|
+
"unit-test:node": "mocha -r esm -r ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --full-trace --exclude \"test/**/browser/*.spec.ts\" \"test/**/*.spec.ts\"",
|
|
35
|
+
"unit-test": "npm run unit-test:node && npm run unit-test:browser"
|
|
37
36
|
},
|
|
38
37
|
"files": [
|
|
39
38
|
"dist/",
|
|
@@ -60,12 +59,13 @@
|
|
|
60
59
|
"sideEffects": false,
|
|
61
60
|
"prettier": "@azure/eslint-plugin-azure-sdk/prettier.json",
|
|
62
61
|
"dependencies": {
|
|
63
|
-
"@azure/communication-common": "^1.1.0",
|
|
64
62
|
"@azure/abort-controller": "^1.0.0",
|
|
63
|
+
"@azure/communication-common": "^2.0.0",
|
|
65
64
|
"@azure/core-auth": "^1.3.0",
|
|
66
|
-
"@azure/core-
|
|
65
|
+
"@azure/core-client": "^1.3.2",
|
|
67
66
|
"@azure/core-lro": "^2.2.0",
|
|
68
67
|
"@azure/core-paging": "^1.1.1",
|
|
68
|
+
"@azure/core-rest-pipeline": "^1.3.2",
|
|
69
69
|
"@azure/core-tracing": "1.0.0-preview.13",
|
|
70
70
|
"@azure/logger": "^1.0.0",
|
|
71
71
|
"events": "^3.0.0",
|
|
@@ -75,19 +75,13 @@
|
|
|
75
75
|
"@azure-tools/test-recorder": "^1.0.0",
|
|
76
76
|
"@azure/dev-tool": "^1.0.0",
|
|
77
77
|
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
|
|
78
|
-
"@azure/identity": "2.0.
|
|
78
|
+
"@azure/identity": "^2.0.1",
|
|
79
79
|
"@azure/test-utils": "^1.0.0",
|
|
80
|
-
"@microsoft/api-extractor": "7.
|
|
81
|
-
"@rollup/plugin-commonjs": "11.0.2",
|
|
82
|
-
"@rollup/plugin-json": "^4.0.0",
|
|
83
|
-
"@rollup/plugin-multi-entry": "^3.0.0",
|
|
84
|
-
"@rollup/plugin-node-resolve": "^8.0.0",
|
|
85
|
-
"@rollup/plugin-replace": "^2.2.0",
|
|
80
|
+
"@microsoft/api-extractor": "^7.18.11",
|
|
86
81
|
"@types/chai": "^4.1.6",
|
|
87
82
|
"@types/mocha": "^7.0.2",
|
|
88
83
|
"@types/node": "^12.0.0",
|
|
89
84
|
"@types/sinon": "^9.0.4",
|
|
90
|
-
"assert": "^1.4.1",
|
|
91
85
|
"chai": "^4.2.0",
|
|
92
86
|
"cross-env": "^7.0.2",
|
|
93
87
|
"dotenv": "^8.2.0",
|
|
@@ -107,19 +101,29 @@
|
|
|
107
101
|
"karma-mocha-reporter": "^2.2.5",
|
|
108
102
|
"karma-sourcemap-loader": "^0.3.8",
|
|
109
103
|
"mocha": "^7.1.1",
|
|
110
|
-
"mocha-junit-reporter": "^
|
|
111
|
-
"nyc": "^
|
|
112
|
-
"prettier": "^
|
|
104
|
+
"mocha-junit-reporter": "^2.0.0",
|
|
105
|
+
"nyc": "^15.0.0",
|
|
106
|
+
"prettier": "^2.5.1",
|
|
113
107
|
"rimraf": "^3.0.0",
|
|
114
|
-
"rollup": "^1.16.3",
|
|
115
|
-
"rollup-plugin-shim": "^1.0.0",
|
|
116
|
-
"rollup-plugin-sourcemaps": "^0.4.2",
|
|
117
|
-
"rollup-plugin-terser": "^5.1.1",
|
|
118
|
-
"rollup-plugin-visualizer": "^4.0.4",
|
|
119
108
|
"sinon": "^9.0.2",
|
|
120
|
-
"typedoc": "0.15.2",
|
|
121
109
|
"typescript": "~4.2.0"
|
|
122
110
|
},
|
|
111
|
+
"//metadata": {
|
|
112
|
+
"constantPaths": [
|
|
113
|
+
{
|
|
114
|
+
"path": "src/generated/src/shortCodesClientContext.ts",
|
|
115
|
+
"prefix": "packageDetails"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"path": "src/utils/constants.ts",
|
|
119
|
+
"prefix": "SDK_VERSION"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"path": "swagger/README.md",
|
|
123
|
+
"prefix": "package-version"
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
},
|
|
123
127
|
"//sampleConfiguration": {
|
|
124
128
|
"productName": "Azure Communication Services - Short Codes",
|
|
125
129
|
"productSlugs": [
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference lib="esnext.asynciterable" />
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import { CommonClientOptions } from '@azure/core-client';
|
|
4
|
+
import * as coreClient from '@azure/core-client';
|
|
3
5
|
import { KeyCredential } from '@azure/core-auth';
|
|
4
|
-
import { OperationOptions } from '@azure/core-
|
|
6
|
+
import { OperationOptions } from '@azure/core-client';
|
|
5
7
|
import { PagedAsyncIterableIterator } from '@azure/core-paging';
|
|
6
|
-
import { PipelineOptions } from '@azure/core-http';
|
|
7
|
-
import { RestResponse } from '@azure/core-http';
|
|
8
8
|
import { TokenCredential } from '@azure/core-auth';
|
|
9
9
|
|
|
10
10
|
/** Defines values for BillingFrequency. */
|
|
@@ -207,21 +207,21 @@ export declare class ShortCodesClient {
|
|
|
207
207
|
constructor(endpoint: string, credential: KeyCredential, options?: ShortCodesClientOptions);
|
|
208
208
|
constructor(endpoint: string, credential: TokenCredential, options?: ShortCodesClientOptions);
|
|
209
209
|
listShortCodes(options?: ListShortCodesOptions): PagedAsyncIterableIterator<ShortCode>;
|
|
210
|
-
upsertUSProgramBrief(programBriefId: string, options?: ShortCodesUpsertUSProgramBriefOptionalParams): Promise<
|
|
211
|
-
deleteUSProgramBrief(programBriefId: string, options?: DeleteUSProgramBriefOptions): Promise<
|
|
210
|
+
upsertUSProgramBrief(programBriefId: string, options?: ShortCodesUpsertUSProgramBriefOptionalParams): Promise<USProgramBrief>;
|
|
211
|
+
deleteUSProgramBrief(programBriefId: string, options?: DeleteUSProgramBriefOptions): Promise<void>;
|
|
212
212
|
getUSProgramBrief(programBriefId: string, options?: GetUSProgramBriefOptions): Promise<USProgramBrief>;
|
|
213
213
|
listUSProgramBriefs(options?: ListUSProgramBriefsOptions): PagedAsyncIterableIterator<USProgramBrief>;
|
|
214
|
-
submitUSProgramBrief(programBriefId: string, options?: SubmitUSProgramBriefOptions): Promise<
|
|
214
|
+
submitUSProgramBrief(programBriefId: string, options?: SubmitUSProgramBriefOptions): Promise<USProgramBrief>;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
/**
|
|
218
218
|
* Client options used to configure the ShortCodesClient API requests.
|
|
219
219
|
*/
|
|
220
|
-
export declare interface ShortCodesClientOptions extends
|
|
220
|
+
export declare interface ShortCodesClientOptions extends CommonClientOptions {
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
/** Optional parameters. */
|
|
224
|
-
export declare interface ShortCodesGetShortCodesOptionalParams extends
|
|
224
|
+
export declare interface ShortCodesGetShortCodesOptionalParams extends coreClient.OperationOptions {
|
|
225
225
|
/** An optional parameter for how many entries to skip, for pagination purposes. */
|
|
226
226
|
skip?: number;
|
|
227
227
|
/** An optional parameter for how many entries to return, for pagination purposes. */
|
|
@@ -229,7 +229,7 @@ export declare interface ShortCodesGetShortCodesOptionalParams extends coreHttp.
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
/** Optional parameters. */
|
|
232
|
-
export declare interface ShortCodesUpsertUSProgramBriefOptionalParams extends
|
|
232
|
+
export declare interface ShortCodesUpsertUSProgramBriefOptionalParams extends coreClient.OperationOptions {
|
|
233
233
|
/** Data to create new a Program Brief or fields to update an existing Program Brief */
|
|
234
234
|
body?: USProgramBrief;
|
|
235
235
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shortCodes.js","sourceRoot":"","sources":["../../../../../src/generated/src/operations/shortCodes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAGH,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,sBAAsB,CAAC;AAmBnD,uCAAuC;AACvC,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ACF;IACD,eAAe,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,UAAU,CAAC;IACzE,aAAa,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC;IACzD,gBAAgB,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;IACrC,UAAU;CACX,CAAC;AACF,MAAM,mCAAmC,GAA2B;IAClE,IAAI,EAAE,YAAY;IAClB,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE;QACT,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,eAAe;SACpC;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,0BAA0B;SAC/C;KACF;IACD,eAAe,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,UAAU,CAAC;IACzE,aAAa,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC;IACzD,gBAAgB,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;IACrC,UAAU;CACX,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport * as coreHttp from \"@azure/core-http\";\nimport * as Mappers from \"../models/mappers\";\nimport * as Parameters from \"../models/parameters\";\nimport { ShortCodesClientContext } from \"../shortCodesClientContext\";\nimport {\n ShortCode,\n ShortCodesGetShortCodesNextOptionalParams,\n ShortCodesGetShortCodesOptionalParams,\n USProgramBrief,\n ShortCodesGetUSProgramBriefsNextOptionalParams,\n ShortCodesGetUSProgramBriefsOptionalParams,\n ShortCodesGetShortCodesResponse,\n ShortCodesUpsertUSProgramBriefOptionalParams,\n ShortCodesUpsertUSProgramBriefResponse,\n ShortCodesGetUSProgramBriefResponse,\n ShortCodesSubmitUSProgramBriefResponse,\n ShortCodesGetUSProgramBriefsResponse,\n ShortCodesGetShortCodesNextResponse,\n ShortCodesGetUSProgramBriefsNextResponse\n} from \"../models\";\n\n/** Class representing a ShortCodes. */\nexport class ShortCodes {\n private readonly client: ShortCodesClientContext;\n\n /**\n * Initialize a new instance of the class ShortCodes class.\n * @param client Reference to the service client\n */\n constructor(client: ShortCodesClientContext) {\n this.client = client;\n }\n\n /**\n * Gets the list of short codes for the current resource.\n * @param options The options parameters.\n */\n public listShortCodes(\n options?: ShortCodesGetShortCodesOptionalParams\n ): PagedAsyncIterableIterator<ShortCode> {\n const iter = this.getShortCodesPagingAll(options);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: () => {\n return this.getShortCodesPagingPage(options);\n }\n };\n }\n\n private async *getShortCodesPagingPage(\n options?: ShortCodesGetShortCodesOptionalParams\n ): AsyncIterableIterator<ShortCode[]> {\n let result = await this._getShortCodes(options);\n yield result.shortCodes || [];\n let continuationToken = result.nextLink;\n while (continuationToken) {\n result = await this._getShortCodesNext(continuationToken, options);\n continuationToken = result.nextLink;\n yield result.shortCodes || [];\n }\n }\n\n private async *getShortCodesPagingAll(\n options?: ShortCodesGetShortCodesOptionalParams\n ): AsyncIterableIterator<ShortCode> {\n for await (const page of this.getShortCodesPagingPage(options)) {\n yield* page;\n }\n }\n\n /**\n * Gets the list of US Program Briefs for the current resource.\n * @param options The options parameters.\n */\n public listUSProgramBriefs(\n options?: ShortCodesGetUSProgramBriefsOptionalParams\n ): PagedAsyncIterableIterator<USProgramBrief> {\n const iter = this.getUSProgramBriefsPagingAll(options);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: () => {\n return this.getUSProgramBriefsPagingPage(options);\n }\n };\n }\n\n private async *getUSProgramBriefsPagingPage(\n options?: ShortCodesGetUSProgramBriefsOptionalParams\n ): AsyncIterableIterator<USProgramBrief[]> {\n let result = await this._getUSProgramBriefs(options);\n yield result.programBriefs || [];\n let continuationToken = result.nextLink;\n while (continuationToken) {\n result = await this._getUSProgramBriefsNext(continuationToken, options);\n continuationToken = result.nextLink;\n yield result.programBriefs || [];\n }\n }\n\n private async *getUSProgramBriefsPagingAll(\n options?: ShortCodesGetUSProgramBriefsOptionalParams\n ): AsyncIterableIterator<USProgramBrief> {\n for await (const page of this.getUSProgramBriefsPagingPage(options)) {\n yield* page;\n }\n }\n\n /**\n * Gets the list of short codes for the current resource.\n * @param options The options parameters.\n */\n private _getShortCodes(\n options?: ShortCodesGetShortCodesOptionalParams\n ): Promise<ShortCodesGetShortCodesResponse> {\n const operationArguments: coreHttp.OperationArguments = {\n options: coreHttp.operationOptionsToRequestOptionsBase(options || {})\n };\n return this.client.sendOperationRequest(\n operationArguments,\n getShortCodesOperationSpec\n ) as Promise<ShortCodesGetShortCodesResponse>;\n }\n\n /**\n * Creates or updates a US Program Brief.\n * @param programBriefId Program Brief Id. Must be a valid GUID\n * @param options The options parameters.\n */\n upsertUSProgramBrief(\n programBriefId: string,\n options?: ShortCodesUpsertUSProgramBriefOptionalParams\n ): Promise<ShortCodesUpsertUSProgramBriefResponse> {\n const operationArguments: coreHttp.OperationArguments = {\n programBriefId,\n options: coreHttp.operationOptionsToRequestOptionsBase(options || {})\n };\n return this.client.sendOperationRequest(\n operationArguments,\n upsertUSProgramBriefOperationSpec\n ) as Promise<ShortCodesUpsertUSProgramBriefResponse>;\n }\n\n /**\n * Deletes a US Program Brief.\n * @param programBriefId Program Brief Id. Must be a valid GUID\n * @param options The options parameters.\n */\n deleteUSProgramBrief(\n programBriefId: string,\n options?: coreHttp.OperationOptions\n ): Promise<coreHttp.RestResponse> {\n const operationArguments: coreHttp.OperationArguments = {\n programBriefId,\n options: coreHttp.operationOptionsToRequestOptionsBase(options || {})\n };\n return this.client.sendOperationRequest(\n operationArguments,\n deleteUSProgramBriefOperationSpec\n ) as Promise<coreHttp.RestResponse>;\n }\n\n /**\n * @param programBriefId\n * @param options The options parameters.\n */\n getUSProgramBrief(\n programBriefId: string,\n options?: coreHttp.OperationOptions\n ): Promise<ShortCodesGetUSProgramBriefResponse> {\n const operationArguments: coreHttp.OperationArguments = {\n programBriefId,\n options: coreHttp.operationOptionsToRequestOptionsBase(options || {})\n };\n return this.client.sendOperationRequest(\n operationArguments,\n getUSProgramBriefOperationSpec\n ) as Promise<ShortCodesGetUSProgramBriefResponse>;\n }\n\n /**\n * @param programBriefId\n * @param options The options parameters.\n */\n submitUSProgramBrief(\n programBriefId: string,\n options?: coreHttp.OperationOptions\n ): Promise<ShortCodesSubmitUSProgramBriefResponse> {\n const operationArguments: coreHttp.OperationArguments = {\n programBriefId,\n options: coreHttp.operationOptionsToRequestOptionsBase(options || {})\n };\n return this.client.sendOperationRequest(\n operationArguments,\n submitUSProgramBriefOperationSpec\n ) as Promise<ShortCodesSubmitUSProgramBriefResponse>;\n }\n\n /**\n * Gets the list of US Program Briefs for the current resource.\n * @param options The options parameters.\n */\n private _getUSProgramBriefs(\n options?: ShortCodesGetUSProgramBriefsOptionalParams\n ): Promise<ShortCodesGetUSProgramBriefsResponse> {\n const operationArguments: coreHttp.OperationArguments = {\n options: coreHttp.operationOptionsToRequestOptionsBase(options || {})\n };\n return this.client.sendOperationRequest(\n operationArguments,\n getUSProgramBriefsOperationSpec\n ) as Promise<ShortCodesGetUSProgramBriefsResponse>;\n }\n\n /**\n * GetShortCodesNext\n * @param nextLink The nextLink from the previous successful call to the GetShortCodes method.\n * @param options The options parameters.\n */\n private _getShortCodesNext(\n nextLink: string,\n options?: ShortCodesGetShortCodesNextOptionalParams\n ): Promise<ShortCodesGetShortCodesNextResponse> {\n const operationArguments: coreHttp.OperationArguments = {\n nextLink,\n options: coreHttp.operationOptionsToRequestOptionsBase(options || {})\n };\n return this.client.sendOperationRequest(\n operationArguments,\n getShortCodesNextOperationSpec\n ) as Promise<ShortCodesGetShortCodesNextResponse>;\n }\n\n /**\n * GetUSProgramBriefsNext\n * @param nextLink The nextLink from the previous successful call to the GetUSProgramBriefs method.\n * @param options The options parameters.\n */\n private _getUSProgramBriefsNext(\n nextLink: string,\n options?: ShortCodesGetUSProgramBriefsNextOptionalParams\n ): Promise<ShortCodesGetUSProgramBriefsNextResponse> {\n const operationArguments: coreHttp.OperationArguments = {\n nextLink,\n options: coreHttp.operationOptionsToRequestOptionsBase(options || {})\n };\n return this.client.sendOperationRequest(\n operationArguments,\n getUSProgramBriefsNextOperationSpec\n ) as Promise<ShortCodesGetUSProgramBriefsNextResponse>;\n }\n}\n// Operation Specifications\nconst serializer = new coreHttp.Serializer(Mappers, /* isXml */ false);\n\nconst getShortCodesOperationSpec: coreHttp.OperationSpec = {\n path: \"/shortCodes\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.ShortCodes\n },\n default: {\n bodyMapper: Mappers.CommunicationErrorResponse\n }\n },\n queryParameters: [Parameters.skip, Parameters.top, Parameters.apiVersion],\n urlParameters: [Parameters.endpoint],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst upsertUSProgramBriefOperationSpec: coreHttp.OperationSpec = {\n path: \"/shortCodes/countries/US/programBriefs/{programBriefId}\",\n httpMethod: \"PATCH\",\n responses: {\n 200: {\n bodyMapper: Mappers.USProgramBrief\n },\n 201: {\n bodyMapper: Mappers.USProgramBrief\n },\n default: {\n bodyMapper: Mappers.CommunicationErrorResponse\n }\n },\n requestBody: Parameters.body,\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.endpoint, Parameters.programBriefId],\n headerParameters: [Parameters.accept, Parameters.contentType],\n mediaType: \"json\",\n serializer\n};\nconst deleteUSProgramBriefOperationSpec: coreHttp.OperationSpec = {\n path: \"/shortCodes/countries/US/programBriefs/{programBriefId}\",\n httpMethod: \"DELETE\",\n responses: {\n 204: {},\n default: {\n bodyMapper: Mappers.CommunicationErrorResponse\n }\n },\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.endpoint, Parameters.programBriefId],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst getUSProgramBriefOperationSpec: coreHttp.OperationSpec = {\n path: \"/shortCodes/countries/US/programBriefs/{programBriefId}\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.USProgramBrief\n },\n default: {\n bodyMapper: Mappers.CommunicationErrorResponse\n }\n },\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.endpoint, Parameters.programBriefId],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst submitUSProgramBriefOperationSpec: coreHttp.OperationSpec = {\n path: \"/shortCodes/countries/US/programBriefs/{programBriefId}/:submit\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.USProgramBrief\n },\n default: {\n bodyMapper: Mappers.CommunicationErrorResponse\n }\n },\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.endpoint, Parameters.programBriefId],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst getUSProgramBriefsOperationSpec: coreHttp.OperationSpec = {\n path: \"/shortCodes/countries/US/programBriefs\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.USProgramBriefs\n },\n default: {\n bodyMapper: Mappers.CommunicationErrorResponse\n }\n },\n queryParameters: [Parameters.skip, Parameters.top, Parameters.apiVersion],\n urlParameters: [Parameters.endpoint],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst getShortCodesNextOperationSpec: coreHttp.OperationSpec = {\n path: \"{nextLink}\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.ShortCodes\n },\n default: {\n bodyMapper: Mappers.CommunicationErrorResponse\n }\n },\n queryParameters: [Parameters.skip, Parameters.top, Parameters.apiVersion],\n urlParameters: [Parameters.endpoint, Parameters.nextLink],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst getUSProgramBriefsNextOperationSpec: coreHttp.OperationSpec = {\n path: \"{nextLink}\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.USProgramBriefs\n },\n default: {\n bodyMapper: Mappers.CommunicationErrorResponse\n }\n },\n queryParameters: [Parameters.skip, Parameters.top, Parameters.apiVersion],\n urlParameters: [Parameters.endpoint, Parameters.nextLink],\n headerParameters: [Parameters.accept],\n serializer\n};\n"]}
|