@azure-tools/communication-short-codes 1.0.0-beta.3 → 1.0.0-beta.4

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 CHANGED
@@ -7,6 +7,7 @@ var communicationCommon = require('@azure/communication-common');
7
7
  var coreTracing = require('@azure/core-tracing');
8
8
  var logger$1 = require('@azure/logger');
9
9
  var coreClient = require('@azure/core-client');
10
+ var coreRestPipeline = require('@azure/core-rest-pipeline');
10
11
  var tslib = require('tslib');
11
12
 
12
13
  function _interopNamespace(e) {
@@ -28,23 +29,19 @@ function _interopNamespace(e) {
28
29
  }
29
30
 
30
31
  var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
32
+ var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipeline);
31
33
 
32
- // Copyright (c) Microsoft Corporation.
33
- /**
34
- * The \@azure\/logger configuration for this package.
35
- */
36
- const logger = logger$1.createClientLogger("communication-short-codes");
37
-
38
- // Copyright (c) Microsoft Corporation.
39
- /**
40
- * Creates a span using the global tracer.
41
- * @internal
42
- * @param name - The name of the operation being performed.
43
- * @param tracingOptions - The options for the underlying http request.
34
+ /*
35
+ * Copyright (c) Microsoft Corporation.
36
+ * Licensed under the MIT License.
37
+ *
38
+ * Code generated by Microsoft (R) AutoRest Code Generator.
39
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
44
40
  */
45
- const createSpan = coreTracing.createSpanFunction({
46
- packagePrefix: "Azure.Communication",
41
+ const tracingClient = coreTracing.createTracingClient({
47
42
  namespace: "Microsoft.Communication",
43
+ packageName: "@azure/communication-short-codes",
44
+ packageVersion: "1.0.0-beta.4"
48
45
  });
49
46
 
50
47
  /*
@@ -931,7 +928,7 @@ const top = {
931
928
  const apiVersion = {
932
929
  parameterPath: "apiVersion",
933
930
  mapper: {
934
- defaultValue: "2021-10-25-preview",
931
+ defaultValue: "2022-09-06",
935
932
  isConstant: true,
936
933
  serializedName: "api-version",
937
934
  type: {
@@ -1163,47 +1160,59 @@ class ShortCodesOperationsImpl {
1163
1160
  * Gets the list of short codes for the current resource.
1164
1161
  * @param options The options parameters.
1165
1162
  */
1166
- _getShortCodes(options) {
1167
- return this.client.sendOperationRequest({ options }, getShortCodesOperationSpec);
1163
+ async _getShortCodes(options) {
1164
+ return tracingClient.withSpan("ShortCodesClient._getShortCodes", options !== null && options !== void 0 ? options : {}, async (options) => {
1165
+ return this.client.sendOperationRequest({ options }, getShortCodesOperationSpec);
1166
+ });
1168
1167
  }
1169
1168
  /**
1170
1169
  * Creates or updates a US Program Brief.
1171
1170
  * @param programBriefId Program Brief Id. Must be a valid GUID
1172
1171
  * @param options The options parameters.
1173
1172
  */
1174
- upsertUSProgramBrief(programBriefId, options) {
1175
- return this.client.sendOperationRequest({ programBriefId, options }, upsertUSProgramBriefOperationSpec);
1173
+ async upsertUSProgramBrief(programBriefId, options) {
1174
+ return tracingClient.withSpan("ShortCodesClient.upsertUSProgramBrief", options !== null && options !== void 0 ? options : {}, async (options) => {
1175
+ return this.client.sendOperationRequest({ programBriefId, options }, upsertUSProgramBriefOperationSpec);
1176
+ });
1176
1177
  }
1177
1178
  /**
1178
1179
  * Deletes a US Program Brief.
1179
1180
  * @param programBriefId Program Brief Id. Must be a valid GUID
1180
1181
  * @param options The options parameters.
1181
1182
  */
1182
- deleteUSProgramBrief(programBriefId, options) {
1183
- return this.client.sendOperationRequest({ programBriefId, options }, deleteUSProgramBriefOperationSpec);
1183
+ async deleteUSProgramBrief(programBriefId, options) {
1184
+ return tracingClient.withSpan("ShortCodesClient.deleteUSProgramBrief", options !== null && options !== void 0 ? options : {}, async (options) => {
1185
+ return this.client.sendOperationRequest({ programBriefId, options }, deleteUSProgramBriefOperationSpec);
1186
+ });
1184
1187
  }
1185
1188
  /**
1186
1189
  * Get a US Program Brief by id.
1187
1190
  * @param programBriefId Program Brief Id. Must be a valid GUID
1188
1191
  * @param options The options parameters.
1189
1192
  */
1190
- getUSProgramBrief(programBriefId, options) {
1191
- return this.client.sendOperationRequest({ programBriefId, options }, getUSProgramBriefOperationSpec);
1193
+ async getUSProgramBrief(programBriefId, options) {
1194
+ return tracingClient.withSpan("ShortCodesClient.getUSProgramBrief", options !== null && options !== void 0 ? options : {}, async (options) => {
1195
+ return this.client.sendOperationRequest({ programBriefId, options }, getUSProgramBriefOperationSpec);
1196
+ });
1192
1197
  }
1193
1198
  /**
1194
1199
  * Submits a US Program Brief for review.
1195
1200
  * @param programBriefId Program Brief Id. Must be a valid GUID
1196
1201
  * @param options The options parameters.
1197
1202
  */
1198
- submitUSProgramBrief(programBriefId, options) {
1199
- return this.client.sendOperationRequest({ programBriefId, options }, submitUSProgramBriefOperationSpec);
1203
+ async submitUSProgramBrief(programBriefId, options) {
1204
+ return tracingClient.withSpan("ShortCodesClient.submitUSProgramBrief", options !== null && options !== void 0 ? options : {}, async (options) => {
1205
+ return this.client.sendOperationRequest({ programBriefId, options }, submitUSProgramBriefOperationSpec);
1206
+ });
1200
1207
  }
1201
1208
  /**
1202
1209
  * Gets the list of US Program Briefs for the current resource.
1203
1210
  * @param options The options parameters.
1204
1211
  */
1205
- _getUSProgramBriefs(options) {
1206
- return this.client.sendOperationRequest({ options }, getUSProgramBriefsOperationSpec);
1212
+ async _getUSProgramBriefs(options) {
1213
+ return tracingClient.withSpan("ShortCodesClient._getUSProgramBriefs", options !== null && options !== void 0 ? options : {}, async (options) => {
1214
+ return this.client.sendOperationRequest({ options }, getUSProgramBriefsOperationSpec);
1215
+ });
1207
1216
  }
1208
1217
  /**
1209
1218
  * Creates or replace an attachment on a US Program Brief.
@@ -1219,17 +1228,19 @@ class ShortCodesOperationsImpl {
1219
1228
  * e.g. 'callToAction', 'termsOfService'
1220
1229
  * @param options The options parameters.
1221
1230
  */
1222
- createOrReplaceUSProgramBriefAttachment(programBriefId, attachmentId, id, fileName, fileType, fileContentBase64, type, options) {
1223
- return this.client.sendOperationRequest({
1224
- programBriefId,
1225
- attachmentId,
1226
- id,
1227
- fileName,
1228
- fileType,
1229
- fileContentBase64,
1230
- type,
1231
- options
1232
- }, createOrReplaceUSProgramBriefAttachmentOperationSpec);
1231
+ async createOrReplaceUSProgramBriefAttachment(programBriefId, attachmentId, id, fileName, fileType, fileContentBase64, type, options) {
1232
+ return tracingClient.withSpan("ShortCodesClient.createOrReplaceUSProgramBriefAttachment", options !== null && options !== void 0 ? options : {}, async (options) => {
1233
+ return this.client.sendOperationRequest({
1234
+ programBriefId,
1235
+ attachmentId,
1236
+ id,
1237
+ fileName,
1238
+ fileType,
1239
+ fileContentBase64,
1240
+ type,
1241
+ options
1242
+ }, createOrReplaceUSProgramBriefAttachmentOperationSpec);
1243
+ });
1233
1244
  }
1234
1245
  /**
1235
1246
  * Gets a specific an attachment from a US Program Brief.
@@ -1237,8 +1248,10 @@ class ShortCodesOperationsImpl {
1237
1248
  * @param attachmentId Attachment Id. Must be a valid GUID
1238
1249
  * @param options The options parameters.
1239
1250
  */
1240
- getUSProgramBriefAttachment(programBriefId, attachmentId, options) {
1241
- return this.client.sendOperationRequest({ programBriefId, attachmentId, options }, getUSProgramBriefAttachmentOperationSpec);
1251
+ async getUSProgramBriefAttachment(programBriefId, attachmentId, options) {
1252
+ return tracingClient.withSpan("ShortCodesClient.getUSProgramBriefAttachment", options !== null && options !== void 0 ? options : {}, async (options) => {
1253
+ return this.client.sendOperationRequest({ programBriefId, attachmentId, options }, getUSProgramBriefAttachmentOperationSpec);
1254
+ });
1242
1255
  }
1243
1256
  /**
1244
1257
  * Deletes a specific attachment from a US Program Brief.
@@ -1246,32 +1259,40 @@ class ShortCodesOperationsImpl {
1246
1259
  * @param attachmentId Attachment Id. Must be a valid GUID
1247
1260
  * @param options The options parameters.
1248
1261
  */
1249
- deleteUSProgramBriefAttachment(programBriefId, attachmentId, options) {
1250
- return this.client.sendOperationRequest({ programBriefId, attachmentId, options }, deleteUSProgramBriefAttachmentOperationSpec);
1262
+ async deleteUSProgramBriefAttachment(programBriefId, attachmentId, options) {
1263
+ return tracingClient.withSpan("ShortCodesClient.deleteUSProgramBriefAttachment", options !== null && options !== void 0 ? options : {}, async (options) => {
1264
+ return this.client.sendOperationRequest({ programBriefId, attachmentId, options }, deleteUSProgramBriefAttachmentOperationSpec);
1265
+ });
1251
1266
  }
1252
1267
  /**
1253
1268
  * Gets the list of attachments from a US Program Brief.
1254
1269
  * @param programBriefId
1255
1270
  * @param options The options parameters.
1256
1271
  */
1257
- _getUSProgramBriefAttachments(programBriefId, options) {
1258
- return this.client.sendOperationRequest({ programBriefId, options }, getUSProgramBriefAttachmentsOperationSpec);
1272
+ async _getUSProgramBriefAttachments(programBriefId, options) {
1273
+ return tracingClient.withSpan("ShortCodesClient._getUSProgramBriefAttachments", options !== null && options !== void 0 ? options : {}, async (options) => {
1274
+ return this.client.sendOperationRequest({ programBriefId, options }, getUSProgramBriefAttachmentsOperationSpec);
1275
+ });
1259
1276
  }
1260
1277
  /**
1261
1278
  * GetShortCodesNext
1262
1279
  * @param nextLink The nextLink from the previous successful call to the GetShortCodes method.
1263
1280
  * @param options The options parameters.
1264
1281
  */
1265
- _getShortCodesNext(nextLink, options) {
1266
- return this.client.sendOperationRequest({ nextLink, options }, getShortCodesNextOperationSpec);
1282
+ async _getShortCodesNext(nextLink, options) {
1283
+ return tracingClient.withSpan("ShortCodesClient._getShortCodesNext", options !== null && options !== void 0 ? options : {}, async (options) => {
1284
+ return this.client.sendOperationRequest({ nextLink, options }, getShortCodesNextOperationSpec);
1285
+ });
1267
1286
  }
1268
1287
  /**
1269
1288
  * GetUSProgramBriefsNext
1270
1289
  * @param nextLink The nextLink from the previous successful call to the GetUSProgramBriefs method.
1271
1290
  * @param options The options parameters.
1272
1291
  */
1273
- _getUSProgramBriefsNext(nextLink, options) {
1274
- return this.client.sendOperationRequest({ nextLink, options }, getUSProgramBriefsNextOperationSpec);
1292
+ async _getUSProgramBriefsNext(nextLink, options) {
1293
+ return tracingClient.withSpan("ShortCodesClient._getUSProgramBriefsNext", options !== null && options !== void 0 ? options : {}, async (options) => {
1294
+ return this.client.sendOperationRequest({ nextLink, options }, getUSProgramBriefsNextOperationSpec);
1295
+ });
1275
1296
  }
1276
1297
  /**
1277
1298
  * GetUSProgramBriefAttachmentsNext
@@ -1280,8 +1301,10 @@ class ShortCodesOperationsImpl {
1280
1301
  * method.
1281
1302
  * @param options The options parameters.
1282
1303
  */
1283
- _getUSProgramBriefAttachmentsNext(programBriefId, nextLink, options) {
1284
- return this.client.sendOperationRequest({ programBriefId, nextLink, options }, getUSProgramBriefAttachmentsNextOperationSpec);
1304
+ async _getUSProgramBriefAttachmentsNext(programBriefId, nextLink, options) {
1305
+ return tracingClient.withSpan("ShortCodesClient._getUSProgramBriefAttachmentsNext", options !== null && options !== void 0 ? options : {}, async (options) => {
1306
+ return this.client.sendOperationRequest({ programBriefId, nextLink, options }, getUSProgramBriefAttachmentsNextOperationSpec);
1307
+ });
1285
1308
  }
1286
1309
  }
1287
1310
  // Operation Specifications
@@ -1534,13 +1557,14 @@ const getUSProgramBriefAttachmentsNextOperationSpec = {
1534
1557
  * Code generated by Microsoft (R) AutoRest Code Generator.
1535
1558
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
1536
1559
  */
1537
- class ShortCodesClientContext extends coreClient__namespace.ServiceClient {
1560
+ class ShortCodesClient$1 extends coreClient__namespace.ServiceClient {
1538
1561
  /**
1539
- * Initializes a new instance of the ShortCodesClientContext class.
1562
+ * Initializes a new instance of the ShortCodesClient class.
1540
1563
  * @param endpoint The communication resource, for example https://resourcename.communication.azure.com
1541
1564
  * @param options The parameter options
1542
1565
  */
1543
1566
  constructor(endpoint, options) {
1567
+ var _a, _b;
1544
1568
  if (endpoint === undefined) {
1545
1569
  throw new Error("'endpoint' cannot be null");
1546
1570
  }
@@ -1551,40 +1575,71 @@ class ShortCodesClientContext extends coreClient__namespace.ServiceClient {
1551
1575
  const defaults = {
1552
1576
  requestContentType: "application/json; charset=utf-8"
1553
1577
  };
1554
- const packageDetails = `azsdk-js-communication-short-codes/1.0.0-beta.3`;
1578
+ const packageDetails = `azsdk-js-communication-short-codes/1.0.0-beta.4`;
1555
1579
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
1556
1580
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
1557
1581
  : `${packageDetails}`;
1558
1582
  const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
1559
1583
  userAgentPrefix
1560
- }, baseUri: options.endpoint || "{endpoint}" });
1584
+ }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{endpoint}" });
1561
1585
  super(optionsWithDefaults);
1586
+ if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
1587
+ const pipelinePolicies = options.pipeline.getOrderedPolicies();
1588
+ const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
1589
+ coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName);
1590
+ if (!bearerTokenAuthenticationPolicyFound) {
1591
+ this.pipeline.removePolicy({
1592
+ name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
1593
+ });
1594
+ this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
1595
+ scopes: `${optionsWithDefaults.baseUri}/.default`,
1596
+ challengeCallbacks: {
1597
+ authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
1598
+ }
1599
+ }));
1600
+ }
1601
+ }
1562
1602
  // Parameter assignments
1563
1603
  this.endpoint = endpoint;
1564
1604
  // Assigning values to Constant parameters
1565
- this.apiVersion = options.apiVersion || "2021-10-25-preview";
1605
+ this.apiVersion = options.apiVersion || "2022-09-06";
1606
+ this.shortCodesOperations = new ShortCodesOperationsImpl(this);
1607
+ this.addCustomApiVersionPolicy(options.apiVersion);
1608
+ }
1609
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
1610
+ addCustomApiVersionPolicy(apiVersion) {
1611
+ if (!apiVersion) {
1612
+ return;
1613
+ }
1614
+ const apiVersionPolicy = {
1615
+ name: "CustomApiVersionPolicy",
1616
+ async sendRequest(request, next) {
1617
+ const param = request.url.split("?");
1618
+ if (param.length > 1) {
1619
+ const newParams = param[1].split("&").map((item) => {
1620
+ if (item.indexOf("api-version") > -1) {
1621
+ return "api-version=" + apiVersion;
1622
+ }
1623
+ else {
1624
+ return item;
1625
+ }
1626
+ });
1627
+ request.url = param[0] + "?" + newParams.join("&");
1628
+ }
1629
+ return next(request);
1630
+ }
1631
+ };
1632
+ this.pipeline.addPolicy(apiVersionPolicy);
1566
1633
  }
1567
1634
  }
1568
1635
 
1569
- /*
1570
- * Copyright (c) Microsoft Corporation.
1571
- * Licensed under the MIT License.
1572
- *
1573
- * Code generated by Microsoft (R) AutoRest Code Generator.
1574
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
1636
+ // Copyright (c) Microsoft Corporation.
1637
+ /**
1638
+ * The \@azure\/logger configuration for this package.
1575
1639
  */
1576
- class ShortCodesClient$1 extends ShortCodesClientContext {
1577
- /**
1578
- * Initializes a new instance of the ShortCodesClient class.
1579
- * @param endpoint The communication resource, for example https://resourcename.communication.azure.com
1580
- * @param options The parameter options
1581
- */
1582
- constructor(endpoint, options) {
1583
- super(endpoint, options);
1584
- this.shortCodesOperations = new ShortCodesOperationsImpl(this);
1585
- }
1586
- }
1640
+ const logger = logger$1.createClientLogger("communication-short-codes");
1587
1641
 
1642
+ // Copyright (c) Microsoft Corporation.
1588
1643
  const isShortCodesClientOptions = (options) => options && !communicationCommon.isKeyCredential(options) && !coreAuth.isTokenCredential(options);
1589
1644
  class ShortCodesClient {
1590
1645
  constructor(connectionStringOrUrl, credentialOrOptions, maybeOptions = {}) {
@@ -1602,14 +1657,14 @@ class ShortCodesClient {
1602
1657
  this.client.pipeline.addPolicy(authPolicy);
1603
1658
  }
1604
1659
  listShortCodes(options = {}) {
1605
- const { span, updatedOptions } = createSpan("ShortCodesClient-listShortCodes", options);
1660
+ const { span, updatedOptions } = tracingClient.startSpan("ShortCodesClient-listShortCodes", options);
1606
1661
  try {
1607
1662
  return this.client.shortCodesOperations.listShortCodes(updatedOptions);
1608
1663
  }
1609
1664
  catch (e) {
1610
1665
  span.setStatus({
1611
- code: coreTracing.SpanStatusCode.ERROR,
1612
- message: e.message,
1666
+ status: "error",
1667
+ error: e,
1613
1668
  });
1614
1669
  throw e;
1615
1670
  }
@@ -1617,63 +1672,30 @@ class ShortCodesClient {
1617
1672
  span.end();
1618
1673
  }
1619
1674
  }
1620
- async upsertUSProgramBrief(programBriefId, options = {}) {
1621
- const { span, updatedOptions } = createSpan("ShortCodesClient-upsertUSProgramBrief", options);
1622
- try {
1623
- return await this.client.shortCodesOperations.upsertUSProgramBrief(programBriefId, updatedOptions);
1624
- }
1625
- catch (e) {
1626
- span.setStatus({
1627
- code: coreTracing.SpanStatusCode.ERROR,
1628
- message: e.message,
1629
- });
1630
- throw e;
1631
- }
1632
- finally {
1633
- span.end();
1634
- }
1675
+ upsertUSProgramBrief(programBriefId, options = {}) {
1676
+ return tracingClient.withSpan("ShortCodesClient-upsertUSProgramBrief", options, (updatedOptions) => {
1677
+ return this.client.shortCodesOperations.upsertUSProgramBrief(programBriefId, updatedOptions);
1678
+ });
1635
1679
  }
1636
- async deleteUSProgramBrief(programBriefId, options) {
1637
- const { span, updatedOptions } = createSpan("ShortCodesClient-deleteUSProgramBrief", options);
1638
- try {
1639
- return await this.client.shortCodesOperations.deleteUSProgramBrief(programBriefId, updatedOptions);
1640
- }
1641
- catch (e) {
1642
- span.setStatus({
1643
- code: coreTracing.SpanStatusCode.ERROR,
1644
- message: e.message,
1645
- });
1646
- throw e;
1647
- }
1648
- finally {
1649
- span.end();
1650
- }
1680
+ deleteUSProgramBrief(programBriefId, options = {}) {
1681
+ return tracingClient.withSpan("ShortCodesClient-deleteUSProgramBrief", options, (updatedOptions) => {
1682
+ return this.client.shortCodesOperations.deleteUSProgramBrief(programBriefId, updatedOptions);
1683
+ });
1651
1684
  }
1652
- async getUSProgramBrief(programBriefId, options) {
1653
- const { span, updatedOptions } = createSpan("ShortCodesClient-getUSProgramBrief", options);
1654
- try {
1655
- return await this.client.shortCodesOperations.getUSProgramBrief(programBriefId, updatedOptions);
1656
- }
1657
- catch (e) {
1658
- span.setStatus({
1659
- code: coreTracing.SpanStatusCode.ERROR,
1660
- message: e.message,
1661
- });
1662
- throw e;
1663
- }
1664
- finally {
1665
- span.end();
1666
- }
1685
+ getUSProgramBrief(programBriefId, options = {}) {
1686
+ return tracingClient.withSpan("ShortCodesClient-getUSProgramBrief", options, (updatedOptions) => {
1687
+ return this.client.shortCodesOperations.getUSProgramBrief(programBriefId, updatedOptions);
1688
+ });
1667
1689
  }
1668
1690
  listUSProgramBriefs(options = {}) {
1669
- const { span, updatedOptions } = createSpan("ShortCodesClient-listUSProgramBriefs", options);
1691
+ const { span, updatedOptions } = tracingClient.startSpan("ShortCodesClient-listUSProgramBriefs", options);
1670
1692
  try {
1671
1693
  return this.client.shortCodesOperations.listUSProgramBriefs(updatedOptions);
1672
1694
  }
1673
1695
  catch (e) {
1674
1696
  span.setStatus({
1675
- code: coreTracing.SpanStatusCode.ERROR,
1676
- message: e.message,
1697
+ status: "error",
1698
+ error: e,
1677
1699
  });
1678
1700
  throw e;
1679
1701
  }
@@ -1681,47 +1703,25 @@ class ShortCodesClient {
1681
1703
  span.end();
1682
1704
  }
1683
1705
  }
1684
- async submitUSProgramBrief(programBriefId, options) {
1685
- const { span, updatedOptions } = createSpan("ShortCodesClient-submitUSProgramBrief", options);
1686
- try {
1687
- return await this.client.shortCodesOperations.submitUSProgramBrief(programBriefId, updatedOptions);
1688
- }
1689
- catch (e) {
1690
- span.setStatus({
1691
- code: coreTracing.SpanStatusCode.ERROR,
1692
- message: e.message,
1693
- });
1694
- throw e;
1695
- }
1696
- finally {
1697
- span.end();
1698
- }
1706
+ submitUSProgramBrief(programBriefId, options = {}) {
1707
+ return tracingClient.withSpan("ShortCodesClient-submitUSProgramBrief", options, (updatedOptions) => {
1708
+ return this.client.shortCodesOperations.submitUSProgramBrief(programBriefId, updatedOptions);
1709
+ });
1699
1710
  }
1700
- async getUSProgramBriefAttachment(programBriefId, attachmentId, options) {
1701
- const { span, updatedOptions } = createSpan("ShortCodesClient-getUSProgramBriefAttachment", options);
1702
- try {
1703
- return await this.client.shortCodesOperations.getUSProgramBriefAttachment(programBriefId, attachmentId, updatedOptions);
1704
- }
1705
- catch (e) {
1706
- span.setStatus({
1707
- code: coreTracing.SpanStatusCode.ERROR,
1708
- message: e.message,
1709
- });
1710
- throw e;
1711
- }
1712
- finally {
1713
- span.end();
1714
- }
1711
+ getUSProgramBriefAttachment(programBriefId, attachmentId, options = {}) {
1712
+ return tracingClient.withSpan("ShortCodesClient-getUSProgramBriefAttachment", options, (updatedOptions) => {
1713
+ return this.client.shortCodesOperations.getUSProgramBriefAttachment(programBriefId, attachmentId, updatedOptions);
1714
+ });
1715
1715
  }
1716
1716
  listUSProgramBriefAttachments(programBriefId, options = {}) {
1717
- const { span, updatedOptions } = createSpan("ShortCodesClient-listUSProgramBriefAttachments", options);
1717
+ const { span, updatedOptions } = tracingClient.startSpan("ShortCodesClient-listUSProgramBriefAttachments", options);
1718
1718
  try {
1719
1719
  return this.client.shortCodesOperations.listUSProgramBriefAttachments(programBriefId, updatedOptions);
1720
1720
  }
1721
1721
  catch (e) {
1722
1722
  span.setStatus({
1723
- code: coreTracing.SpanStatusCode.ERROR,
1724
- message: e.message,
1723
+ status: "error",
1724
+ error: e,
1725
1725
  });
1726
1726
  throw e;
1727
1727
  }
@@ -1729,37 +1729,15 @@ class ShortCodesClient {
1729
1729
  span.end();
1730
1730
  }
1731
1731
  }
1732
- async deleteUSProgramBriefAttachment(programBriefId, attachmentId, options) {
1733
- const { span, updatedOptions } = createSpan("ShortCodesClient-deleteUSProgramBriefAttachment", options);
1734
- try {
1735
- return await this.client.shortCodesOperations.deleteUSProgramBriefAttachment(programBriefId, attachmentId, updatedOptions);
1736
- }
1737
- catch (e) {
1738
- span.setStatus({
1739
- code: coreTracing.SpanStatusCode.ERROR,
1740
- message: e.message,
1741
- });
1742
- throw e;
1743
- }
1744
- finally {
1745
- span.end();
1746
- }
1732
+ deleteUSProgramBriefAttachment(programBriefId, attachmentId, options = {}) {
1733
+ return tracingClient.withSpan("ShortCodesClient-deleteUSProgramBriefAttachment", options, (updatedOptions) => {
1734
+ return this.client.shortCodesOperations.deleteUSProgramBriefAttachment(programBriefId, attachmentId, updatedOptions);
1735
+ });
1747
1736
  }
1748
- async createOrReplaceUSProgramBriefAttachment(programBriefId, attachmentId, fileName, fileType, fileContent, attachmentType, options = {}) {
1749
- const { span, updatedOptions } = createSpan("ShortCodesClient-createOrReplaceUSProgramBriefAttachment", options);
1750
- try {
1751
- return await this.client.shortCodesOperations.createOrReplaceUSProgramBriefAttachment(programBriefId, attachmentId, attachmentId, fileName, fileType, fileContent, attachmentType, updatedOptions);
1752
- }
1753
- catch (e) {
1754
- span.setStatus({
1755
- code: coreTracing.SpanStatusCode.ERROR,
1756
- message: e.message,
1757
- });
1758
- throw e;
1759
- }
1760
- finally {
1761
- span.end();
1762
- }
1737
+ createOrReplaceUSProgramBriefAttachment(programBriefId, attachmentId, fileName, fileType, fileContent, attachmentType, options = {}) {
1738
+ return tracingClient.withSpan("ShortCodesClient-createOrReplaceUSProgramBriefAttachment", options, (updatedOptions) => {
1739
+ return this.client.shortCodesOperations.createOrReplaceUSProgramBriefAttachment(programBriefId, attachmentId, attachmentId, fileName, fileType, fileContent, attachmentType, updatedOptions);
1740
+ });
1763
1741
  }
1764
1742
  }
1765
1743