From c979e82835d55e239f7e0672deca40d76cd43a8e Mon Sep 17 00:00:00 2001 From: rtrevino89 <99822668+rtrevino89@users.noreply.github.com> Date: Mon, 26 Jun 2023 19:43:21 -0600 Subject: [PATCH] [Communication][communication-alpha-ids] Update swagger - Include pre-registered alpha ids (#26274) Updating communication-alpha-ids swagger. -- Adding new tests for the new endpoints. The new endpoints design is the following: ![image](https://github.com/Azure/azure-sdk-for-js/assets/99822668/0a482108-f6ab-4c80-8c10-76e465e08c5e) numberType param was removed and "number" param was replaced by "value" in the AlphaID object. --- .../communication-alpha-ids/CHANGELOG.md | 2 + ..._list_all_dynamic_alpha_ids_countries.json | 65 +++++ .../recording_can_manage_configuration.json | 87 ++---- ..._can_list_all_preregistered_alpha_ids.json | 83 ++++++ ...t_all_preregistered_alpha_ids_by_page.json | 46 ++++ ...all_preregistered_alpha_ids_countries.json | 52 ++++ ..._list_all_dynamic_alpha_ids_countries.json | 56 ++++ .../recording_can_manage_configuration.json | 78 ++---- ..._can_list_all_preregistered_alpha_ids.json | 65 +++++ ...t_all_preregistered_alpha_ids_by_page.json | 37 +++ ...all_preregistered_alpha_ids_countries.json | 43 +++ .../review/communication-alpha-ids.api.md | 54 +++- .../samples-dev/getConfiguration.ts | 5 +- .../src/alphaIdsClient.ts | 79 +++++- .../src/generated/src/alphaIDsClient.ts | 28 +- .../src/generated/src/index.ts | 2 + .../src/generated/src/models/index.ts | 87 +++++- .../src/generated/src/models/mappers.ts | 86 +++++- .../src/generated/src/models/parameters.ts | 40 ++- .../src/generated/src/operations/alphaIds.ts | 259 ++++++++++++++++-- .../src/operationsInterfaces/alphaIds.ts | 55 +++- .../src/generated/src/pagingHelper.ts | 39 +++ .../communication-alpha-ids/src/models.ts | 32 ++- .../swagger/alphaids.json | 214 +++++++++++++-- .../test/internal/generated_client.spec.ts | 37 +-- .../test/internal/headers.spec.ts | 8 +- .../test/public/dynamicAlphaId.spec.ts | 61 +++++ .../public/manageAlphaIdConfiguration.spec.ts | 30 -- .../test/public/preRegisteredAlphaId.spec.ts | 48 ++++ .../public/utils/alphaIdClientTestUtils.ts | 36 --- 30 files changed, 1470 insertions(+), 344 deletions(-) create mode 100644 sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__manage_configuration/recording_can_list_all_dynamic_alpha_ids_countries.json create mode 100644 sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids.json create mode 100644 sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids_by_page.json create mode 100644 sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids_countries.json create mode 100644 sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__manage_configuration/recording_can_list_all_dynamic_alpha_ids_countries.json create mode 100644 sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids.json create mode 100644 sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids_by_page.json create mode 100644 sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids_countries.json create mode 100644 sdk/communication/communication-alpha-ids/src/generated/src/pagingHelper.ts create mode 100644 sdk/communication/communication-alpha-ids/test/public/dynamicAlphaId.spec.ts delete mode 100644 sdk/communication/communication-alpha-ids/test/public/manageAlphaIdConfiguration.spec.ts create mode 100644 sdk/communication/communication-alpha-ids/test/public/preRegisteredAlphaId.spec.ts delete mode 100644 sdk/communication/communication-alpha-ids/test/public/utils/alphaIdClientTestUtils.ts diff --git a/sdk/communication/communication-alpha-ids/CHANGELOG.md b/sdk/communication/communication-alpha-ids/CHANGELOG.md index 33a6c8b38921..5bc3c300f308 100644 --- a/sdk/communication/communication-alpha-ids/CHANGELOG.md +++ b/sdk/communication/communication-alpha-ids/CHANGELOG.md @@ -4,6 +4,8 @@ ### Features Added +- APIs for querying and managing the usage of Pre-registered Alpha IDs + ### Breaking Changes ### Bugs Fixed diff --git a/sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__manage_configuration/recording_can_list_all_dynamic_alpha_ids_countries.json b/sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__manage_configuration/recording_can_list_all_dynamic_alpha_ids_countries.json new file mode 100644 index 000000000000..eebd924f566e --- /dev/null +++ b/sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__manage_configuration/recording_can_list_all_dynamic_alpha_ids_countries.json @@ -0,0 +1,65 @@ +{ + "Entries": [ + { + "RequestUri": "https://endpoint/alphaIds/dynamic/countries?api-version=2023-07-12", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate, br", + "Accept-Language": "en-US", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "Referer": "http://localhost:9876/", + "sec-ch-ua": "", + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": "\u0022\u0022", + "Sec-Fetch-Dest": "empty", + "Sec-Fetch-Mode": "cors", + "Sec-Fetch-Site": "same-site", + "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/112.0.5614.0 Safari/537.36", + "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000", + "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", + "x-ms-date": "Mon, 26 Jun 2023 21:39:22 GMT", + "x-ms-useragent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.11.1 OS" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "api-supported-versions": "2022-09-26-preview, 2023-07-12", + "Content-Length": "115", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 26 Jun 2023 21:39:23 GMT", + "MS-CV": "E9jdHz\u002BCskC3dz2Q8FwiWA.0", + "Strict-Transport-Security": "max-age=2592000", + "X-Azure-Ref": "0jAWaZAAAAABTsb5nc7NZQ5tyTHO5V6amREZXMzBFREdFMTYxNwA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "X-Cache": "CONFIG_NOCACHE", + "X-Processing-Time": "342ms" + }, + "ResponseBody": { + "countries": [ + "GB", + "AU", + "FR", + "CH", + "SE", + "IT", + "ES", + "DK", + "IE", + "PT", + "PL", + "AT", + "LT", + "LV", + "EE", + "HU", + "US", + "PR", + "CA", + "IN" + ] + } + } + ], + "Variables": {} +} diff --git a/sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__manage_configuration/recording_can_manage_configuration.json b/sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__manage_configuration/recording_can_manage_configuration.json index 02a22418e1d2..ec80d24ec9cd 100644 --- a/sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__manage_configuration/recording_can_manage_configuration.json +++ b/sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__manage_configuration/recording_can_manage_configuration.json @@ -1,7 +1,7 @@ { "Entries": [ { - "RequestUri": "https://endpoint/alphaIds/configuration?api-version=2022-09-26-preview", + "RequestUri": "https://endpoint/alphaIds/dynamic/configuration?api-version=2023-07-12", "RequestMethod": "PATCH", "RequestHeaders": { "Accept": "application/json", @@ -21,30 +21,30 @@ "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/112.0.5614.0 Safari/537.36", "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000", "x-ms-content-sha256": "JrNCayWTdjyW0IkLSnegu/ZtE/xRKwxrE4ojwpDzCio=", - "x-ms-date": "Wed, 17 May 2023 18:56:26 GMT", - "x-ms-useragent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.10.4 OS" + "x-ms-date": "Mon, 26 Jun 2023 21:39:20 GMT", + "x-ms-useragent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.11.1 OS" }, "RequestBody": { "enabled": true }, "StatusCode": 200, "ResponseHeaders": { - "api-supported-versions": "2022-09-26-preview", + "api-supported-versions": "2022-09-26-preview, 2023-07-12", "Content-Length": "16", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 17 May 2023 18:56:28 GMT", - "MS-CV": "Ba0/TBglUUWG07us\u002Btv2Pw.0", + "Date": "Mon, 26 Jun 2023 21:39:22 GMT", + "MS-CV": "mNRHyK/F8Uq7xsQrhNdnnQ.0", "Strict-Transport-Security": "max-age=2592000", - "X-Azure-Ref": "0XCNlZAAAAAC8OU0OBB/BTbbJ8dmhR9AFREZXMzBFREdFMTYxOAA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "X-Azure-Ref": "0igWaZAAAAADGyurFDBM6RaNLlTYGNT4SREZXMzBFREdFMTYxNwA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", "X-Cache": "CONFIG_NOCACHE", - "X-Processing-Time": "965ms" + "X-Processing-Time": "701ms" }, "ResponseBody": { "enabled": true } }, { - "RequestUri": "https://endpoint/alphaIds/configuration?api-version=2022-09-26-preview", + "RequestUri": "https://endpoint/alphaIds/dynamic/configuration?api-version=2023-07-12", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", @@ -62,28 +62,28 @@ "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/112.0.5614.0 Safari/537.36", "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000", "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", - "x-ms-date": "Wed, 17 May 2023 18:56:28 GMT", - "x-ms-useragent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.10.4 OS" + "x-ms-date": "Mon, 26 Jun 2023 21:39:21 GMT", + "x-ms-useragent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.11.1 OS" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "api-supported-versions": "2022-09-26-preview", + "api-supported-versions": "2022-09-26-preview, 2023-07-12", "Content-Length": "16", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 17 May 2023 18:56:29 GMT", - "MS-CV": "uYZslqCbMUCAajPb44ly7w.0", + "Date": "Mon, 26 Jun 2023 21:39:22 GMT", + "MS-CV": "LlyVApzSw0WnfhUruVCsOw.0", "Strict-Transport-Security": "max-age=2592000", - "X-Azure-Ref": "0XSNlZAAAAADHvfDZ\u002B589TLT/Q89xv95HREZXMzBFREdFMTYxOAA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "X-Azure-Ref": "0iwWaZAAAAAAQdzU8bWT0RYXJziKS0vRkREZXMzBFREdFMTYxNwA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", "X-Cache": "CONFIG_NOCACHE", - "X-Processing-Time": "332ms" + "X-Processing-Time": "280ms" }, "ResponseBody": { "enabled": true } }, { - "RequestUri": "https://endpoint/alphaIds/configuration?api-version=2022-09-26-preview", + "RequestUri": "https://endpoint/alphaIds/dynamic/configuration?api-version=2023-07-12", "RequestMethod": "PATCH", "RequestHeaders": { "Accept": "application/json", @@ -103,62 +103,23 @@ "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/112.0.5614.0 Safari/537.36", "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000", "x-ms-content-sha256": "Ws8/93tEIGd7WSMHHzA/rKunqSc6NGKEpmeidd8yUUY=", - "x-ms-date": "Wed, 17 May 2023 18:56:28 GMT", - "x-ms-useragent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.10.4 OS" + "x-ms-date": "Mon, 26 Jun 2023 21:39:21 GMT", + "x-ms-useragent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.11.1 OS" }, "RequestBody": { "enabled": false }, "StatusCode": 200, "ResponseHeaders": { - "api-supported-versions": "2022-09-26-preview", + "api-supported-versions": "2022-09-26-preview, 2023-07-12", "Content-Length": "17", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 17 May 2023 18:56:29 GMT", - "MS-CV": "y6tLhSN1ykSsJfrtl8e5NQ.0", + "Date": "Mon, 26 Jun 2023 21:39:23 GMT", + "MS-CV": "4NPHARdHFUCK1y8uytZZkg.0", "Strict-Transport-Security": "max-age=2592000", - "X-Azure-Ref": "0XSNlZAAAAAC9zjk7M2BZToNVVn/VAR7uREZXMzBFREdFMTYxOAA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "X-Azure-Ref": "0iwWaZAAAAABQuA3yOhocQYqiw1zMgAGXREZXMzBFREdFMTYxNwA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", "X-Cache": "CONFIG_NOCACHE", - "X-Processing-Time": "584ms" - }, - "ResponseBody": { - "enabled": false - } - }, - { - "RequestUri": "https://endpoint/alphaIds/configuration?api-version=2022-09-26-preview", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate, br", - "Accept-Language": "en-US", - "Authorization": "Sanitized", - "Connection": "keep-alive", - "Referer": "http://localhost:9876/", - "sec-ch-ua": "", - "sec-ch-ua-mobile": "?0", - "sec-ch-ua-platform": "\u0022\u0022", - "Sec-Fetch-Dest": "empty", - "Sec-Fetch-Mode": "cors", - "Sec-Fetch-Site": "same-site", - "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/112.0.5614.0 Safari/537.36", - "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000", - "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", - "x-ms-date": "Wed, 17 May 2023 18:56:29 GMT", - "x-ms-useragent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.10.4 OS" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "api-supported-versions": "2022-09-26-preview", - "Content-Length": "17", - "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 17 May 2023 18:56:30 GMT", - "MS-CV": "FePsUhv6iEqxU\u002BlPG2GREw.0", - "Strict-Transport-Security": "max-age=2592000", - "X-Azure-Ref": "0XiNlZAAAAACBVBjGgyzdQKmASRmwbhGZREZXMzBFREdFMTYxOAA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", - "X-Cache": "CONFIG_NOCACHE", - "X-Processing-Time": "405ms" + "X-Processing-Time": "413ms" }, "ResponseBody": { "enabled": false diff --git a/sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids.json b/sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids.json new file mode 100644 index 000000000000..5cfccc8fbbc5 --- /dev/null +++ b/sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids.json @@ -0,0 +1,83 @@ +{ + "Entries": [ + { + "RequestUri": "https://endpoint/alphaIds?skip=0\u0026top=100\u0026api-version=2023-07-12", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate, br", + "Accept-Language": "en-US", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "Referer": "http://localhost:9876/", + "sec-ch-ua": "", + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": "\u0022\u0022", + "Sec-Fetch-Dest": "empty", + "Sec-Fetch-Mode": "cors", + "Sec-Fetch-Site": "same-site", + "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/112.0.5614.0 Safari/537.36", + "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000", + "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", + "x-ms-date": "Mon, 26 Jun 2023 21:39:22 GMT", + "x-ms-useragent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.11.1 OS" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "api-supported-versions": "2022-09-26-preview, 2023-07-12", + "Content-Length": "15", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 26 Jun 2023 21:39:24 GMT", + "MS-CV": "\u002BCniR9QVIEGA32UJkR4QfA.0", + "Strict-Transport-Security": "max-age=2592000", + "X-Azure-Ref": "0jAWaZAAAAACMrjUaVQ0UR7TbKlz3XAnnREZXMzBFREdFMTYxNwA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "X-Cache": "CONFIG_NOCACHE", + "X-Processing-Time": "227ms" + }, + "ResponseBody": { + "alphaIds": [] + } + }, + { + "RequestUri": "https://endpoint/alphaIds?skip=0\u0026top=1\u0026api-version=2023-07-12", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate, br", + "Accept-Language": "en-US", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "Referer": "http://localhost:9876/", + "sec-ch-ua": "", + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": "\u0022\u0022", + "Sec-Fetch-Dest": "empty", + "Sec-Fetch-Mode": "cors", + "Sec-Fetch-Site": "same-site", + "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/112.0.5614.0 Safari/537.36", + "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000", + "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", + "x-ms-date": "Mon, 26 Jun 2023 21:39:23 GMT", + "x-ms-useragent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.11.1 OS" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "api-supported-versions": "2022-09-26-preview, 2023-07-12", + "Content-Length": "15", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 26 Jun 2023 21:39:24 GMT", + "MS-CV": "DSOum7sjoEew0NjXEUhFpQ.0", + "Strict-Transport-Security": "max-age=2592000", + "X-Azure-Ref": "0jAWaZAAAAABzLsZixf9eSqGZuAVBMFTnREZXMzBFREdFMTYxNwA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "X-Cache": "CONFIG_NOCACHE", + "X-Processing-Time": "183ms" + }, + "ResponseBody": { + "alphaIds": [] + } + } + ], + "Variables": {} +} diff --git a/sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids_by_page.json b/sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids_by_page.json new file mode 100644 index 000000000000..501823ad7d4b --- /dev/null +++ b/sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids_by_page.json @@ -0,0 +1,46 @@ +{ + "Entries": [ + { + "RequestUri": "https://endpoint/alphaIds?skip=0\u0026top=100\u0026api-version=2023-07-12", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate, br", + "Accept-Language": "en-US", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "Referer": "http://localhost:9876/", + "sec-ch-ua": "", + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": "\u0022\u0022", + "Sec-Fetch-Dest": "empty", + "Sec-Fetch-Mode": "cors", + "Sec-Fetch-Site": "same-site", + "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/112.0.5614.0 Safari/537.36", + "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000", + "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", + "x-ms-date": "Tue, 20 Jun 2023 15:19:54 GMT", + "x-ms-useragent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.11.1 OS" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Accept-Ranges": "bytes", + "api-supported-versions": "2022-09-26-preview, 2023-07-12", + "Connection": "keep-alive", + "Content-Length": "15", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 20 Jun 2023 15:19:56 GMT", + "MS-CV": "S\u002BYJ/8pHR0ORLd6vvlG6XQ.0", + "Strict-Transport-Security": "max-age=2592000", + "x-azure-ref": "20230620T151955Z-4v16pcke8d0f55s5uc5gugve9c00000001qg00000000rw1y", + "X-Cache": "CONFIG_NOCACHE", + "X-Processing-Time": "300ms" + }, + "ResponseBody": { + "alphaIds": [] + } + } + ], + "Variables": {} +} diff --git a/sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids_countries.json b/sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids_countries.json new file mode 100644 index 000000000000..3add96047820 --- /dev/null +++ b/sdk/communication/communication-alpha-ids/recordings/browsers/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids_countries.json @@ -0,0 +1,52 @@ +{ + "Entries": [ + { + "RequestUri": "https://endpoint/alphaIds/pre-registered/countries?api-version=2023-07-12", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate, br", + "Accept-Language": "en-US", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "Referer": "http://localhost:9876/", + "sec-ch-ua": "", + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": "\u0022\u0022", + "Sec-Fetch-Dest": "empty", + "Sec-Fetch-Mode": "cors", + "Sec-Fetch-Site": "same-site", + "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/112.0.5614.0 Safari/537.36", + "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000", + "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", + "x-ms-date": "Mon, 26 Jun 2023 21:39:23 GMT", + "x-ms-useragent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.11.1 OS" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "api-supported-versions": "2022-09-26-preview, 2023-07-12", + "Content-Length": "50", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 26 Jun 2023 21:39:24 GMT", + "MS-CV": "Oo\u002BRosL8nk6Sb5h2RQBOSw.0", + "Strict-Transport-Security": "max-age=2592000", + "X-Azure-Ref": "0jQWaZAAAAADOxWzBjakHSozW5o27uvHUREZXMzBFREdFMTYxNwA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "X-Cache": "CONFIG_NOCACHE", + "X-Processing-Time": "316ms" + }, + "ResponseBody": { + "countries": [ + "NO", + "FI", + "RO", + "SK", + "SI", + "CZ", + "HR" + ] + } + } + ], + "Variables": {} +} diff --git a/sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__manage_configuration/recording_can_list_all_dynamic_alpha_ids_countries.json b/sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__manage_configuration/recording_can_list_all_dynamic_alpha_ids_countries.json new file mode 100644 index 000000000000..a6869d852543 --- /dev/null +++ b/sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__manage_configuration/recording_can_list_all_dynamic_alpha_ids_countries.json @@ -0,0 +1,56 @@ +{ + "Entries": [ + { + "RequestUri": "https://endpoint/alphaIds/dynamic/countries?api-version=2023-07-12", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.11.1 Node/v18.13.0 OS/(x64-Linux-5.15.90.1-microsoft-standard-WSL2)", + "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000", + "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", + "x-ms-date": "Mon, 26 Jun 2023 21:39:09 GMT" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "api-supported-versions": "2022-09-26-preview, 2023-07-12", + "Content-Length": "115", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 26 Jun 2023 21:39:11 GMT", + "MS-CV": "ZNZw1JlNxkGGdxB51lVRBg.0", + "Strict-Transport-Security": "max-age=2592000", + "X-Azure-Ref": "0fwWaZAAAAADxGLYJq5w0SbxR8gBIhIHtREZXMzBFREdFMTUxNwA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "X-Cache": "CONFIG_NOCACHE", + "X-Processing-Time": "415ms" + }, + "ResponseBody": { + "countries": [ + "GB", + "AU", + "FR", + "CH", + "SE", + "IT", + "ES", + "DK", + "IE", + "PT", + "PL", + "AT", + "LT", + "LV", + "EE", + "HU", + "US", + "PR", + "CA", + "IN" + ] + } + } + ], + "Variables": {} +} diff --git a/sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__manage_configuration/recording_can_manage_configuration.json b/sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__manage_configuration/recording_can_manage_configuration.json index f92b7eea1ec3..7c8e86e2385a 100644 --- a/sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__manage_configuration/recording_can_manage_configuration.json +++ b/sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__manage_configuration/recording_can_manage_configuration.json @@ -1,7 +1,7 @@ { "Entries": [ { - "RequestUri": "https://endpoint/alphaIds/configuration?api-version=2022-09-26-preview", + "RequestUri": "https://endpoint/alphaIds/dynamic/configuration?api-version=2023-07-12", "RequestMethod": "PATCH", "RequestHeaders": { "Accept": "application/json", @@ -10,62 +10,62 @@ "Connection": "keep-alive", "Content-Length": "16", "Content-Type": "application/merge-patch\u002Bjson", - "User-Agent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.10.4 Node/v18.13.0 OS/(x64-Linux-5.15.90.1-microsoft-standard-WSL2)", + "User-Agent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.11.1 Node/v18.13.0 OS/(x64-Linux-5.15.90.1-microsoft-standard-WSL2)", "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000", "x-ms-content-sha256": "JrNCayWTdjyW0IkLSnegu/ZtE/xRKwxrE4ojwpDzCio=", - "x-ms-date": "Wed, 17 May 2023 18:56:19 GMT" + "x-ms-date": "Mon, 26 Jun 2023 21:39:08 GMT" }, "RequestBody": { "enabled": true }, "StatusCode": 200, "ResponseHeaders": { - "api-supported-versions": "2022-09-26-preview", + "api-supported-versions": "2022-09-26-preview, 2023-07-12", "Content-Length": "16", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 17 May 2023 18:56:20 GMT", - "MS-CV": "KqcGyYryOUq7/JiDkcE8sQ.0", + "Date": "Mon, 26 Jun 2023 21:39:09 GMT", + "MS-CV": "zxMpMRb1qUS4EepAgTIkoQ.0", "Strict-Transport-Security": "max-age=2592000", - "X-Azure-Ref": "0VCNlZAAAAABlpqY5wVxDR6IxOrjWguleREZXMzBFREdFMTYyMQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "X-Azure-Ref": "0fgWaZAAAAACTcFp7m/\u002BYQYMdvUEYRlFRREZXMzBFREdFMTUxNwA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", "X-Cache": "CONFIG_NOCACHE", - "X-Processing-Time": "620ms" + "X-Processing-Time": "422ms" }, "ResponseBody": { "enabled": true } }, { - "RequestUri": "https://endpoint/alphaIds/configuration?api-version=2022-09-26-preview", + "RequestUri": "https://endpoint/alphaIds/dynamic/configuration?api-version=2023-07-12", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip,deflate", "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.10.4 Node/v18.13.0 OS/(x64-Linux-5.15.90.1-microsoft-standard-WSL2)", + "User-Agent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.11.1 Node/v18.13.0 OS/(x64-Linux-5.15.90.1-microsoft-standard-WSL2)", "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000", "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", - "x-ms-date": "Wed, 17 May 2023 18:56:20 GMT" + "x-ms-date": "Mon, 26 Jun 2023 21:39:09 GMT" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "api-supported-versions": "2022-09-26-preview", + "api-supported-versions": "2022-09-26-preview, 2023-07-12", "Content-Length": "16", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 17 May 2023 18:56:21 GMT", - "MS-CV": "fDXbRyyrw0myHbVoHQqHmA.0", + "Date": "Mon, 26 Jun 2023 21:39:10 GMT", + "MS-CV": "szIIkg4fUUutMHrPMkOdvg.0", "Strict-Transport-Security": "max-age=2592000", - "X-Azure-Ref": "0VSNlZAAAAAAzrDTcuI65Spl\u002B77bOEpJQREZXMzBFREdFMTYyMQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "X-Azure-Ref": "0fgWaZAAAAADd\u002Bxpv\u002Bu0VSr/LsBqssGXdREZXMzBFREdFMTUxNwA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", "X-Cache": "CONFIG_NOCACHE", - "X-Processing-Time": "293ms" + "X-Processing-Time": "205ms" }, "ResponseBody": { "enabled": true } }, { - "RequestUri": "https://endpoint/alphaIds/configuration?api-version=2022-09-26-preview", + "RequestUri": "https://endpoint/alphaIds/dynamic/configuration?api-version=2023-07-12", "RequestMethod": "PATCH", "RequestHeaders": { "Accept": "application/json", @@ -74,55 +74,25 @@ "Connection": "keep-alive", "Content-Length": "17", "Content-Type": "application/merge-patch\u002Bjson", - "User-Agent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.10.4 Node/v18.13.0 OS/(x64-Linux-5.15.90.1-microsoft-standard-WSL2)", + "User-Agent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.11.1 Node/v18.13.0 OS/(x64-Linux-5.15.90.1-microsoft-standard-WSL2)", "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000", "x-ms-content-sha256": "Ws8/93tEIGd7WSMHHzA/rKunqSc6NGKEpmeidd8yUUY=", - "x-ms-date": "Wed, 17 May 2023 18:56:20 GMT" + "x-ms-date": "Mon, 26 Jun 2023 21:39:09 GMT" }, "RequestBody": { "enabled": false }, "StatusCode": 200, "ResponseHeaders": { - "api-supported-versions": "2022-09-26-preview", + "api-supported-versions": "2022-09-26-preview, 2023-07-12", "Content-Length": "17", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 17 May 2023 18:56:21 GMT", - "MS-CV": "7oXtV3ZoTEGJMsh1ql37kA.0", + "Date": "Mon, 26 Jun 2023 21:39:10 GMT", + "MS-CV": "KK18JwBXmEGPw5aCU/fPCw.0", "Strict-Transport-Security": "max-age=2592000", - "X-Azure-Ref": "0VSNlZAAAAAAGQ/8nNAADT4LfOxAd6y8YREZXMzBFREdFMTYyMQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "X-Azure-Ref": "0fwWaZAAAAAALySJMTqc5SbniDK2gw6\u002BjREZXMzBFREdFMTUxNwA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", "X-Cache": "CONFIG_NOCACHE", - "X-Processing-Time": "398ms" - }, - "ResponseBody": { - "enabled": false - } - }, - { - "RequestUri": "https://endpoint/alphaIds/configuration?api-version=2022-09-26-preview", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Accept-Encoding": "gzip,deflate", - "Authorization": "Sanitized", - "Connection": "keep-alive", - "User-Agent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.10.4 Node/v18.13.0 OS/(x64-Linux-5.15.90.1-microsoft-standard-WSL2)", - "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000", - "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", - "x-ms-date": "Wed, 17 May 2023 18:56:21 GMT" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "api-supported-versions": "2022-09-26-preview", - "Content-Length": "17", - "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 17 May 2023 18:56:21 GMT", - "MS-CV": "ikP0xR5/e0SXpb18E0BZ3A.0", - "Strict-Transport-Security": "max-age=2592000", - "X-Azure-Ref": "0ViNlZAAAAACrmo8VjPsqRK1\u002BrC5p6lHhREZXMzBFREdFMTYyMQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", - "X-Cache": "CONFIG_NOCACHE", - "X-Processing-Time": "296ms" + "X-Processing-Time": "263ms" }, "ResponseBody": { "enabled": false diff --git a/sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids.json b/sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids.json new file mode 100644 index 000000000000..4f0287a36ce6 --- /dev/null +++ b/sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids.json @@ -0,0 +1,65 @@ +{ + "Entries": [ + { + "RequestUri": "https://endpoint/alphaIds?skip=0\u0026top=100\u0026api-version=2023-07-12", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.11.1 Node/v18.13.0 OS/(x64-Linux-5.15.90.1-microsoft-standard-WSL2)", + "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000", + "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", + "x-ms-date": "Mon, 26 Jun 2023 21:39:10 GMT" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "api-supported-versions": "2022-09-26-preview, 2023-07-12", + "Content-Length": "15", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 26 Jun 2023 21:39:11 GMT", + "MS-CV": "hGFvYnCt8Um\u002BJAQA5yaRnA.0", + "Strict-Transport-Security": "max-age=2592000", + "X-Azure-Ref": "0gAWaZAAAAADZ7bQlBvurTpVFmsOZwBEAREZXMzBFREdFMTUxNwA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "X-Cache": "CONFIG_NOCACHE", + "X-Processing-Time": "448ms" + }, + "ResponseBody": { + "alphaIds": [] + } + }, + { + "RequestUri": "https://endpoint/alphaIds?skip=0\u0026top=1\u0026api-version=2023-07-12", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.11.1 Node/v18.13.0 OS/(x64-Linux-5.15.90.1-microsoft-standard-WSL2)", + "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000", + "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", + "x-ms-date": "Mon, 26 Jun 2023 21:39:10 GMT" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "api-supported-versions": "2022-09-26-preview, 2023-07-12", + "Content-Length": "15", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 26 Jun 2023 21:39:12 GMT", + "MS-CV": "8sST0o/FgUWZLQbXZLhzGA.0", + "Strict-Transport-Security": "max-age=2592000", + "X-Azure-Ref": "0gAWaZAAAAAA5t3\u002BMPkv/QZOk21lWDP11REZXMzBFREdFMTUxNwA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "X-Cache": "CONFIG_NOCACHE", + "X-Processing-Time": "302ms" + }, + "ResponseBody": { + "alphaIds": [] + } + } + ], + "Variables": {} +} diff --git a/sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids_by_page.json b/sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids_by_page.json new file mode 100644 index 000000000000..790f81fee3e0 --- /dev/null +++ b/sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids_by_page.json @@ -0,0 +1,37 @@ +{ + "Entries": [ + { + "RequestUri": "https://endpoint/alphaIds?skip=0\u0026top=100\u0026api-version=2023-07-12", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.11.1 Node/v18.13.0 OS/(x64-Linux-5.15.90.1-microsoft-standard-WSL2)", + "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000", + "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", + "x-ms-date": "Tue, 20 Jun 2023 15:19:29 GMT" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Accept-Ranges": "bytes", + "api-supported-versions": "2022-09-26-preview, 2023-07-12", + "Connection": "keep-alive", + "Content-Length": "15", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 20 Jun 2023 15:19:43 GMT", + "MS-CV": "kVQXI7ltnk2dHZX8bUTInQ.0", + "Strict-Transport-Security": "max-age=2592000", + "x-azure-ref": "20230620T151931Z-61eagpmamh4yp7nzbxs6x2yz40000000013g000000009t07", + "X-Cache": "CONFIG_NOCACHE", + "X-Processing-Time": "11359ms" + }, + "ResponseBody": { + "alphaIds": [] + } + } + ], + "Variables": {} +} diff --git a/sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids_countries.json b/sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids_countries.json new file mode 100644 index 000000000000..28dbb9e5f11c --- /dev/null +++ b/sdk/communication/communication-alpha-ids/recordings/node/alphaidsclient__preregistered_alpha_ids_operations/recording_can_list_all_preregistered_alpha_ids_countries.json @@ -0,0 +1,43 @@ +{ + "Entries": [ + { + "RequestUri": "https://endpoint/alphaIds/pre-registered/countries?api-version=2023-07-12", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-communication-alpha-ids/1.0.0-beta.2 core-rest-pipeline/1.11.1 Node/v18.13.0 OS/(x64-Linux-5.15.90.1-microsoft-standard-WSL2)", + "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000", + "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", + "x-ms-date": "Mon, 26 Jun 2023 21:39:11 GMT" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "api-supported-versions": "2022-09-26-preview, 2023-07-12", + "Content-Length": "50", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 26 Jun 2023 21:39:12 GMT", + "MS-CV": "\u002B/3wMuJsdkm3sZtTdEhm\u002Bg.0", + "Strict-Transport-Security": "max-age=2592000", + "X-Azure-Ref": "0gQWaZAAAAAA7JnAs2bIRRYk\u002B3ntj\u002BsxRREZXMzBFREdFMTUxNwA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "X-Cache": "CONFIG_NOCACHE", + "X-Processing-Time": "357ms" + }, + "ResponseBody": { + "countries": [ + "NO", + "FI", + "RO", + "SK", + "SI", + "CZ", + "HR" + ] + } + } + ], + "Variables": {} +} diff --git a/sdk/communication/communication-alpha-ids/review/communication-alpha-ids.api.md b/sdk/communication/communication-alpha-ids/review/communication-alpha-ids.api.md index 37f5b7ca02d8..b84438bf1c55 100644 --- a/sdk/communication/communication-alpha-ids/review/communication-alpha-ids.api.md +++ b/sdk/communication/communication-alpha-ids/review/communication-alpha-ids.api.md @@ -7,13 +7,17 @@ /// import { CommonClientOptions } from '@azure/core-client'; +import * as coreClient from '@azure/core-client'; import { KeyCredential } from '@azure/core-auth'; import { OperationOptions } from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; import { TokenCredential } from '@azure/core-auth'; // @public -export interface AlphaIdConfiguration { - enabled: boolean; +export interface AlphaId { + countryCode?: string; + purchaseDate?: Date; + value?: string; } // @public (undocumented) @@ -22,19 +26,61 @@ export class AlphaIdsClient { constructor(endpoint: string, credential: KeyCredential, options?: AlphaIdsClientOptions); constructor(endpoint: string, credential: TokenCredential, options?: AlphaIdsClientOptions); // (undocumented) - getConfiguration(options?: GetConfigurationOptions): Promise; + getAlphaIds(options?: ListAlphaIdsOptions): PagedAsyncIterableIterator; + // (undocumented) + getDynamicAlphaIdConfiguration(options?: GetConfigurationOptions): Promise; + // (undocumented) + getDynamicAlphaIdCountries(options?: GetDynamicAlphaIdCountriesOptions): Promise; + // (undocumented) + getPreRegisteredAlphaIdCountries(options?: GetPreRegisteredAlphaIdCountriesOptions): Promise; // (undocumented) - upsertConfiguration(enabled: boolean, options?: UpsertConfigurationOptions): Promise; + upsertDynamicAlphaIdConfiguration(enabled: boolean, options?: UpsertConfigurationOptions): Promise; } // @public export interface AlphaIdsClientOptions extends CommonClientOptions { } +// @public +export interface AlphaIdsGetAlphaIdsOptionalParams extends coreClient.OperationOptions { + skip?: number; + top?: number; +} + +// @public +export interface AlphaIdsGetDynamicAlphaIdCountriesOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface AlphaIdsGetPreRegisteredAlphaIdCountriesOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface DynamicAlphaIdConfiguration { + enabled: boolean; +} + // @public export interface GetConfigurationOptions extends OperationOptions { } +// @public +export interface GetDynamicAlphaIdCountriesOptions extends AlphaIdsGetDynamicAlphaIdCountriesOptionalParams { +} + +// @public +export interface GetPreRegisteredAlphaIdCountriesOptions extends AlphaIdsGetPreRegisteredAlphaIdCountriesOptionalParams { +} + +// @public +export interface ListAlphaIdsOptions extends AlphaIdsGetAlphaIdsOptionalParams { +} + +// @public +export interface SupportedCountries { + countries?: string[]; +} + // @public export interface UpsertConfigurationOptions extends OperationOptions { } diff --git a/sdk/communication/communication-alpha-ids/samples-dev/getConfiguration.ts b/sdk/communication/communication-alpha-ids/samples-dev/getConfiguration.ts index c89e09f53d18..eb2c31fa7048 100644 --- a/sdk/communication/communication-alpha-ids/samples-dev/getConfiguration.ts +++ b/sdk/communication/communication-alpha-ids/samples-dev/getConfiguration.ts @@ -5,7 +5,7 @@ * @summary Get the Alpha IDs configuration that's applied for the current resource */ -import { AlphaIdConfiguration, AlphaIdsClient } from "@azure-tools/communication-alpha-ids"; +import { DynamicAlphaIdConfiguration, AlphaIdsClient } from "@azure-tools/communication-alpha-ids"; import { RestError } from "@azure/core-rest-pipeline"; // Load the .env file if it exists @@ -26,7 +26,8 @@ export async function main() { try { // get the applied configuration for the current resource - const configuration: AlphaIdConfiguration = await client.getConfiguration(); + const configuration: DynamicAlphaIdConfiguration = + await client.getDynamicAlphaIdConfiguration(); usageIsEnabled = configuration.enabled; } catch (error) { // 403 errors also mean that the usage is disallowed diff --git a/sdk/communication/communication-alpha-ids/src/alphaIdsClient.ts b/sdk/communication/communication-alpha-ids/src/alphaIdsClient.ts index 8c00140068d7..4ced71477058 100644 --- a/sdk/communication/communication-alpha-ids/src/alphaIdsClient.ts +++ b/sdk/communication/communication-alpha-ids/src/alphaIdsClient.ts @@ -2,9 +2,14 @@ // Licensed under the MIT license. /// import { - AlphaIdConfiguration, + DynamicAlphaIdConfiguration, GetConfigurationOptions, UpsertConfigurationOptions, + ListAlphaIdsOptions, + GetDynamicAlphaIdCountriesOptions, + GetPreRegisteredAlphaIdCountriesOptions, + AlphaId, + SupportedCountries, } from "./models"; import { isKeyCredential, parseClientArguments } from "@azure/communication-common"; import { KeyCredential, TokenCredential, isTokenCredential } from "@azure/core-auth"; @@ -13,6 +18,8 @@ import { AlphaIDsClient as AlphaIDsGeneratedClient } from "./generated/src"; import { createCommunicationAuthPolicy } from "@azure/communication-common"; import { logger } from "./utils"; import { tracingClient } from "./generated/src/tracing"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; + /** * Client options used to configure the AlphaIdsClient API requests. */ @@ -61,26 +68,86 @@ export class AlphaIdsClient { this.client.pipeline.addPolicy(authPolicy); } - public getConfiguration(options: GetConfigurationOptions = {}): Promise { + public getDynamicAlphaIdConfiguration( + options: GetConfigurationOptions = {} + ): Promise { return tracingClient.withSpan( "AlphaIdsClient-getConfiguration", options, async (updatedOptions) => { - return this.client.alphaIds.getConfiguration(updatedOptions); + return this.client.alphaIds.getDynamicAlphaIdConfiguration(updatedOptions); } ); } - public upsertConfiguration( + public upsertDynamicAlphaIdConfiguration( enabled: boolean, options: UpsertConfigurationOptions = {} - ): Promise { + ): Promise { return tracingClient.withSpan( "AlphaIdsClient-upsertConfiguration", options, async (updatedOptions) => { - return this.client.alphaIds.upsertConfiguration(enabled, updatedOptions); + return this.client.alphaIds.upsertDynamicAlphaIdConfiguration(enabled, updatedOptions); } ); } + + public getAlphaIds(options: ListAlphaIdsOptions = {}): PagedAsyncIterableIterator { + const { span, updatedOptions } = tracingClient.startSpan( + "AlphaIdsClient-listAlphaIds", + options + ); + try { + return this.client.alphaIds.listAlphaIds(updatedOptions); + } catch (e: any) { + span.setStatus({ + status: "error", + error: e, + }); + throw e; + } finally { + span.end(); + } + } + + public getDynamicAlphaIdCountries( + options: GetDynamicAlphaIdCountriesOptions = {} + ): Promise { + const { span, updatedOptions } = tracingClient.startSpan( + "AlphaIdsClient-getDynamicAlphaIdCountries", + options + ); + try { + return this.client.alphaIds.getDynamicAlphaIdCountries(updatedOptions); + } catch (e: any) { + span.setStatus({ + status: "error", + error: e, + }); + throw e; + } finally { + span.end(); + } + } + + public getPreRegisteredAlphaIdCountries( + options: GetPreRegisteredAlphaIdCountriesOptions = {} + ): Promise { + const { span, updatedOptions } = tracingClient.startSpan( + "AlphaIdsClient-getPreRegisteredAlphaIdCountries", + options + ); + try { + return this.client.alphaIds.getPreRegisteredAlphaIdCountries(updatedOptions); + } catch (e: any) { + span.setStatus({ + status: "error", + error: e, + }); + throw e; + } finally { + span.end(); + } + } } diff --git a/sdk/communication/communication-alpha-ids/src/generated/src/alphaIDsClient.ts b/sdk/communication/communication-alpha-ids/src/generated/src/alphaIDsClient.ts index 60d6749895f1..dc07df1d4b45 100644 --- a/sdk/communication/communication-alpha-ids/src/generated/src/alphaIDsClient.ts +++ b/sdk/communication/communication-alpha-ids/src/generated/src/alphaIDsClient.ts @@ -7,7 +7,6 @@ */ import * as coreClient from "@azure/core-client"; -import * as coreRestPipeline from "@azure/core-rest-pipeline"; import { PipelineRequest, PipelineResponse, @@ -51,37 +50,14 @@ export class AlphaIDsClient extends coreClient.ServiceClient { userAgentOptions: { userAgentPrefix }, - baseUri: options.endpoint ?? options.baseUri ?? "{endpoint}" + endpoint: options.endpoint ?? options.baseUri ?? "{endpoint}" }; super(optionsWithDefaults); - - if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { - const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); - const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( - (pipelinePolicy) => - pipelinePolicy.name === - coreRestPipeline.bearerTokenAuthenticationPolicyName - ); - if (!bearerTokenAuthenticationPolicyFound) { - this.pipeline.removePolicy({ - name: coreRestPipeline.bearerTokenAuthenticationPolicyName - }); - this.pipeline.addPolicy( - coreRestPipeline.bearerTokenAuthenticationPolicy({ - scopes: `${optionsWithDefaults.baseUri}/.default`, - challengeCallbacks: { - authorizeRequestOnChallenge: - coreClient.authorizeRequestOnClaimChallenge - } - }) - ); - } - } // Parameter assignments this.endpoint = endpoint; // Assigning values to Constant parameters - this.apiVersion = options.apiVersion || "2022-09-26-preview"; + this.apiVersion = options.apiVersion || "2023-07-12"; this.alphaIds = new AlphaIdsImpl(this); this.addCustomApiVersionPolicy(options.apiVersion); } diff --git a/sdk/communication/communication-alpha-ids/src/generated/src/index.ts b/sdk/communication/communication-alpha-ids/src/generated/src/index.ts index 17d5a55472c5..d47cc39c52c3 100644 --- a/sdk/communication/communication-alpha-ids/src/generated/src/index.ts +++ b/sdk/communication/communication-alpha-ids/src/generated/src/index.ts @@ -6,6 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ +/// +export { getContinuationToken } from "./pagingHelper"; export * from "./models"; export { AlphaIDsClient } from "./alphaIDsClient"; export * from "./operationsInterfaces"; diff --git a/sdk/communication/communication-alpha-ids/src/generated/src/models/index.ts b/sdk/communication/communication-alpha-ids/src/generated/src/models/index.ts index 54473ffd0483..4038a1eb1e2b 100644 --- a/sdk/communication/communication-alpha-ids/src/generated/src/models/index.ts +++ b/sdk/communication/communication-alpha-ids/src/generated/src/models/index.ts @@ -8,15 +8,22 @@ import * as coreClient from "@azure/core-client"; -/** - *
Represents a collection of settings for configuring Alpha ID support for a specific resource. - *
- * Initially, Alpha IDs were restricted to customers that had valid use cases for them, so this configuration could be leveraged to enable its usage. - * - */ -export interface AlphaIdConfiguration { - /** Indicates whether the use of Alpha IDs is supported for a specific resource. */ - enabled: boolean; +/** A wrapper for a list of alpha id entities. */ +export interface AcquiredAlphaIds { + /** List of alpha ids. */ + alphaIds?: AlphaId[]; + /** Represents the URL link to the next page. */ + nextLink?: string; +} + +/** Represents an AlphaId acquired in a given country. */ +export interface AlphaId { + /** The value of the AlphaId e.g. 'CONTOSO', etc. */ + value?: string; + /** ISO 3166 2-char code representing the country e.g. 'US'. */ + countryCode?: string; + /** Date in which number was purchased. */ + purchaseDate?: Date; } /** The Communication Services error. */ @@ -48,19 +55,69 @@ export interface CommunicationError { readonly innerError?: CommunicationError; } +/** + *
Represents a collection of settings for configuring Dynamic Alpha ID support for a specific resource. + *
+ * Initially, Alpha IDs were restricted to customers that had valid use cases for them, so this configuration could be leveraged to enable its usage. + * + */ +export interface DynamicAlphaIdConfiguration { + /** Indicates whether the use of Dynamic Alpha IDs is supported for a specific resource. */ + enabled: boolean; +} + +/** A wrapper for a list of countries. */ +export interface SupportedCountries { + /** List of conutries supporting alpha ids. */ + countries?: string[]; +} + +/** Optional parameters. */ +export interface AlphaIdsGetAlphaIdsOptionalParams + extends coreClient.OperationOptions { + /** An optional parameter for how many entries to skip, for pagination purposes. */ + skip?: number; + /** An optional parameter for how many entries to return, for pagination purposes. */ + top?: number; +} + +/** Contains response data for the getAlphaIds operation. */ +export type AlphaIdsGetAlphaIdsResponse = AcquiredAlphaIds; + +/** Optional parameters. */ +export interface AlphaIdsGetDynamicAlphaIdConfigurationOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDynamicAlphaIdConfiguration operation. */ +export type AlphaIdsGetDynamicAlphaIdConfigurationResponse = DynamicAlphaIdConfiguration; + +/** Optional parameters. */ +export interface AlphaIdsUpsertDynamicAlphaIdConfigurationOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the upsertDynamicAlphaIdConfiguration operation. */ +export type AlphaIdsUpsertDynamicAlphaIdConfigurationResponse = DynamicAlphaIdConfiguration; + +/** Optional parameters. */ +export interface AlphaIdsGetDynamicAlphaIdCountriesOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDynamicAlphaIdCountries operation. */ +export type AlphaIdsGetDynamicAlphaIdCountriesResponse = SupportedCountries; + /** Optional parameters. */ -export interface AlphaIdsGetConfigurationOptionalParams +export interface AlphaIdsGetPreRegisteredAlphaIdCountriesOptionalParams extends coreClient.OperationOptions {} -/** Contains response data for the getConfiguration operation. */ -export type AlphaIdsGetConfigurationResponse = AlphaIdConfiguration; +/** Contains response data for the getPreRegisteredAlphaIdCountries operation. */ +export type AlphaIdsGetPreRegisteredAlphaIdCountriesResponse = SupportedCountries; /** Optional parameters. */ -export interface AlphaIdsUpsertConfigurationOptionalParams +export interface AlphaIdsGetAlphaIdsNextOptionalParams extends coreClient.OperationOptions {} -/** Contains response data for the upsertConfiguration operation. */ -export type AlphaIdsUpsertConfigurationResponse = AlphaIdConfiguration; +/** Contains response data for the getAlphaIdsNext operation. */ +export type AlphaIdsGetAlphaIdsNextResponse = AcquiredAlphaIds; /** Optional parameters. */ export interface AlphaIDsClientOptionalParams diff --git a/sdk/communication/communication-alpha-ids/src/generated/src/models/mappers.ts b/sdk/communication/communication-alpha-ids/src/generated/src/models/mappers.ts index 18779b86ccd1..c4ae013240b2 100644 --- a/sdk/communication/communication-alpha-ids/src/generated/src/models/mappers.ts +++ b/sdk/communication/communication-alpha-ids/src/generated/src/models/mappers.ts @@ -8,16 +8,54 @@ import * as coreClient from "@azure/core-client"; -export const AlphaIdConfiguration: coreClient.CompositeMapper = { +export const AcquiredAlphaIds: coreClient.CompositeMapper = { type: { name: "Composite", - className: "AlphaIdConfiguration", + className: "AcquiredAlphaIds", modelProperties: { - enabled: { - serializedName: "enabled", - required: true, + alphaIds: { + serializedName: "alphaIds", type: { - name: "Boolean" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AlphaId" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const AlphaId: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AlphaId", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "String" + } + }, + countryCode: { + serializedName: "countryCode", + type: { + name: "String" + } + }, + purchaseDate: { + serializedName: "purchaseDate", + type: { + name: "DateTime" } } } @@ -89,3 +127,39 @@ export const CommunicationError: coreClient.CompositeMapper = { } } }; + +export const DynamicAlphaIdConfiguration: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DynamicAlphaIdConfiguration", + modelProperties: { + enabled: { + serializedName: "enabled", + required: true, + type: { + name: "Boolean" + } + } + } + } +}; + +export const SupportedCountries: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SupportedCountries", + modelProperties: { + countries: { + serializedName: "countries", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; diff --git a/sdk/communication/communication-alpha-ids/src/generated/src/models/parameters.ts b/sdk/communication/communication-alpha-ids/src/generated/src/models/parameters.ts index fd835efab351..81480fe02902 100644 --- a/sdk/communication/communication-alpha-ids/src/generated/src/models/parameters.ts +++ b/sdk/communication/communication-alpha-ids/src/generated/src/models/parameters.ts @@ -11,7 +11,7 @@ import { OperationURLParameter, OperationQueryParameter } from "@azure/core-client"; -import { AlphaIdConfiguration as AlphaIdConfigurationMapper } from "../models/mappers"; +import { DynamicAlphaIdConfiguration as DynamicAlphaIdConfigurationMapper } from "../models/mappers"; export const accept: OperationParameter = { parameterPath: "accept", @@ -37,10 +37,32 @@ export const endpoint: OperationURLParameter = { skipEncoding: true }; +export const skip: OperationQueryParameter = { + parameterPath: ["options", "skip"], + mapper: { + defaultValue: 0, + serializedName: "skip", + type: { + name: "Number" + } + } +}; + +export const top: OperationQueryParameter = { + parameterPath: ["options", "top"], + mapper: { + defaultValue: 100, + serializedName: "top", + type: { + name: "Number" + } + } +}; + export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2022-09-26-preview", + defaultValue: "2023-07-12", isConstant: true, serializedName: "api-version", type: { @@ -63,5 +85,17 @@ export const contentType: OperationParameter = { export const enabled: OperationParameter = { parameterPath: "enabled", - mapper: AlphaIdConfigurationMapper + mapper: DynamicAlphaIdConfigurationMapper +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true }; diff --git a/sdk/communication/communication-alpha-ids/src/generated/src/operations/alphaIds.ts b/sdk/communication/communication-alpha-ids/src/generated/src/operations/alphaIds.ts index 6530ba32edb0..1c4948dd28ad 100644 --- a/sdk/communication/communication-alpha-ids/src/generated/src/operations/alphaIds.ts +++ b/sdk/communication/communication-alpha-ids/src/generated/src/operations/alphaIds.ts @@ -7,18 +7,30 @@ */ import { tracingClient } from "../tracing"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { AlphaIds } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { AlphaIDsClient } from "../alphaIDsClient"; import { - AlphaIdsGetConfigurationOptionalParams, - AlphaIdsGetConfigurationResponse, - AlphaIdsUpsertConfigurationOptionalParams, - AlphaIdsUpsertConfigurationResponse + AlphaId, + AlphaIdsGetAlphaIdsNextOptionalParams, + AlphaIdsGetAlphaIdsOptionalParams, + AlphaIdsGetAlphaIdsResponse, + AlphaIdsGetDynamicAlphaIdConfigurationOptionalParams, + AlphaIdsGetDynamicAlphaIdConfigurationResponse, + AlphaIdsUpsertDynamicAlphaIdConfigurationOptionalParams, + AlphaIdsUpsertDynamicAlphaIdConfigurationResponse, + AlphaIdsGetDynamicAlphaIdCountriesOptionalParams, + AlphaIdsGetDynamicAlphaIdCountriesResponse, + AlphaIdsGetPreRegisteredAlphaIdCountriesOptionalParams, + AlphaIdsGetPreRegisteredAlphaIdCountriesResponse, + AlphaIdsGetAlphaIdsNextResponse } from "../models"; +/// /** Class containing AlphaIds operations. */ export class AlphaIdsImpl implements AlphaIds { private readonly client: AlphaIDsClient; @@ -32,41 +44,173 @@ export class AlphaIdsImpl implements AlphaIds { } /** - * Get the Alpha IDs configuration that's applied for the current resource. + * Gets the list of alpha ids for the current resource. * @param options The options parameters. */ - async getConfiguration( - options?: AlphaIdsGetConfigurationOptionalParams - ): Promise { + public listAlphaIds( + options?: AlphaIdsGetAlphaIdsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.getAlphaIdsPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.getAlphaIdsPagingPage(options, settings); + } + }; + } + + private async *getAlphaIdsPagingPage( + options?: AlphaIdsGetAlphaIdsOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: AlphaIdsGetAlphaIdsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._getAlphaIds(options); + let page = result.alphaIds || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._getAlphaIdsNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.alphaIds || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *getAlphaIdsPagingAll( + options?: AlphaIdsGetAlphaIdsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.getAlphaIdsPagingPage(options)) { + yield* page; + } + } + + /** + * Gets the list of alpha ids for the current resource. + * @param options The options parameters. + */ + private async _getAlphaIds( + options?: AlphaIdsGetAlphaIdsOptionalParams + ): Promise { + return tracingClient.withSpan( + "AlphaIDsClient._getAlphaIds", + options ?? {}, + async (options) => { + return this.client.sendOperationRequest( + { options }, + getAlphaIdsOperationSpec + ) as Promise; + } + ); + } + + /** + * Get the Dynamic Alpha ID configuration that's applied for the current resource. + * @param options The options parameters. + */ + async getDynamicAlphaIdConfiguration( + options?: AlphaIdsGetDynamicAlphaIdConfigurationOptionalParams + ): Promise { return tracingClient.withSpan( - "AlphaIDsClient.getConfiguration", + "AlphaIDsClient.getDynamicAlphaIdConfiguration", options ?? {}, async (options) => { return this.client.sendOperationRequest( { options }, - getConfigurationOperationSpec - ) as Promise; + getDynamicAlphaIdConfigurationOperationSpec + ) as Promise; } ); } /** - * Creates or updates Alpha ID Configuration for the current resource. - * @param enabled Indicates whether the use of Alpha IDs is supported for a specific resource. + * Creates or updates Dynamic Alpha ID Configuration for the current resource. + * @param enabled Indicates whether the use of Dynamic Alpha IDs is supported for a specific resource. * @param options The options parameters. */ - async upsertConfiguration( + async upsertDynamicAlphaIdConfiguration( enabled: boolean, - options?: AlphaIdsUpsertConfigurationOptionalParams - ): Promise { + options?: AlphaIdsUpsertDynamicAlphaIdConfigurationOptionalParams + ): Promise { return tracingClient.withSpan( - "AlphaIDsClient.upsertConfiguration", + "AlphaIDsClient.upsertDynamicAlphaIdConfiguration", options ?? {}, async (options) => { return this.client.sendOperationRequest( { enabled, options }, - upsertConfigurationOperationSpec - ) as Promise; + upsertDynamicAlphaIdConfigurationOperationSpec + ) as Promise; + } + ); + } + + /** + * Gets the list of countries that support Dynamic Alpha IDs. + * @param options The options parameters. + */ + async getDynamicAlphaIdCountries( + options?: AlphaIdsGetDynamicAlphaIdCountriesOptionalParams + ): Promise { + return tracingClient.withSpan( + "AlphaIDsClient.getDynamicAlphaIdCountries", + options ?? {}, + async (options) => { + return this.client.sendOperationRequest( + { options }, + getDynamicAlphaIdCountriesOperationSpec + ) as Promise; + } + ); + } + + /** + * Gets the list of countries that support Pre-Registered Alpha IDs. + * @param options The options parameters. + */ + async getPreRegisteredAlphaIdCountries( + options?: AlphaIdsGetPreRegisteredAlphaIdCountriesOptionalParams + ): Promise { + return tracingClient.withSpan( + "AlphaIDsClient.getPreRegisteredAlphaIdCountries", + options ?? {}, + async (options) => { + return this.client.sendOperationRequest( + { options }, + getPreRegisteredAlphaIdCountriesOperationSpec + ) as Promise; + } + ); + } + + /** + * GetAlphaIdsNext + * @param nextLink The nextLink from the previous successful call to the GetAlphaIds method. + * @param options The options parameters. + */ + private async _getAlphaIdsNext( + nextLink: string, + options?: AlphaIdsGetAlphaIdsNextOptionalParams + ): Promise { + return tracingClient.withSpan( + "AlphaIDsClient._getAlphaIdsNext", + options ?? {}, + async (options) => { + return this.client.sendOperationRequest( + { nextLink, options }, + getAlphaIdsNextOperationSpec + ) as Promise; } ); } @@ -74,12 +218,28 @@ export class AlphaIdsImpl implements AlphaIds { // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); -const getConfigurationOperationSpec: coreClient.OperationSpec = { - path: "/alphaIds/configuration", +const getAlphaIdsOperationSpec: coreClient.OperationSpec = { + path: "/alphaIds", httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.AlphaIdConfiguration + bodyMapper: Mappers.AcquiredAlphaIds + }, + default: { + bodyMapper: Mappers.CommunicationErrorResponse + } + }, + queryParameters: [Parameters.skip, Parameters.top, Parameters.apiVersion], + urlParameters: [Parameters.endpoint], + headerParameters: [Parameters.accept], + serializer +}; +const getDynamicAlphaIdConfigurationOperationSpec: coreClient.OperationSpec = { + path: "/alphaIds/dynamic/configuration", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DynamicAlphaIdConfiguration }, default: { bodyMapper: Mappers.CommunicationErrorResponse @@ -90,12 +250,12 @@ const getConfigurationOperationSpec: coreClient.OperationSpec = { headerParameters: [Parameters.accept], serializer }; -const upsertConfigurationOperationSpec: coreClient.OperationSpec = { - path: "/alphaIds/configuration", +const upsertDynamicAlphaIdConfigurationOperationSpec: coreClient.OperationSpec = { + path: "/alphaIds/dynamic/configuration", httpMethod: "PATCH", responses: { 200: { - bodyMapper: Mappers.AlphaIdConfiguration + bodyMapper: Mappers.DynamicAlphaIdConfiguration }, default: { bodyMapper: Mappers.CommunicationErrorResponse @@ -103,7 +263,7 @@ const upsertConfigurationOperationSpec: coreClient.OperationSpec = { }, requestBody: { parameterPath: { enabled: ["enabled"] }, - mapper: { ...Mappers.AlphaIdConfiguration, required: true } + mapper: { ...Mappers.DynamicAlphaIdConfiguration, required: true } }, queryParameters: [Parameters.apiVersion], urlParameters: [Parameters.endpoint], @@ -111,3 +271,50 @@ const upsertConfigurationOperationSpec: coreClient.OperationSpec = { mediaType: "json", serializer }; +const getDynamicAlphaIdCountriesOperationSpec: coreClient.OperationSpec = { + path: "/alphaIds/dynamic/countries", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SupportedCountries + }, + default: { + bodyMapper: Mappers.CommunicationErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.endpoint], + headerParameters: [Parameters.accept], + serializer +}; +const getPreRegisteredAlphaIdCountriesOperationSpec: coreClient.OperationSpec = { + path: "/alphaIds/pre-registered/countries", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SupportedCountries + }, + default: { + bodyMapper: Mappers.CommunicationErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.endpoint], + headerParameters: [Parameters.accept], + serializer +}; +const getAlphaIdsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AcquiredAlphaIds + }, + default: { + bodyMapper: Mappers.CommunicationErrorResponse + } + }, + urlParameters: [Parameters.endpoint, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/communication/communication-alpha-ids/src/generated/src/operationsInterfaces/alphaIds.ts b/sdk/communication/communication-alpha-ids/src/generated/src/operationsInterfaces/alphaIds.ts index e9811ba6b37a..9ceda36e1cf2 100644 --- a/sdk/communication/communication-alpha-ids/src/generated/src/operationsInterfaces/alphaIds.ts +++ b/sdk/communication/communication-alpha-ids/src/generated/src/operationsInterfaces/alphaIds.ts @@ -6,29 +6,58 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ +import { PagedAsyncIterableIterator } from "@azure/core-paging"; import { - AlphaIdsGetConfigurationOptionalParams, - AlphaIdsGetConfigurationResponse, - AlphaIdsUpsertConfigurationOptionalParams, - AlphaIdsUpsertConfigurationResponse + AlphaId, + AlphaIdsGetAlphaIdsOptionalParams, + AlphaIdsGetDynamicAlphaIdConfigurationOptionalParams, + AlphaIdsGetDynamicAlphaIdConfigurationResponse, + AlphaIdsUpsertDynamicAlphaIdConfigurationOptionalParams, + AlphaIdsUpsertDynamicAlphaIdConfigurationResponse, + AlphaIdsGetDynamicAlphaIdCountriesOptionalParams, + AlphaIdsGetDynamicAlphaIdCountriesResponse, + AlphaIdsGetPreRegisteredAlphaIdCountriesOptionalParams, + AlphaIdsGetPreRegisteredAlphaIdCountriesResponse } from "../models"; +/// /** Interface representing a AlphaIds. */ export interface AlphaIds { /** - * Get the Alpha IDs configuration that's applied for the current resource. + * Gets the list of alpha ids for the current resource. * @param options The options parameters. */ - getConfiguration( - options?: AlphaIdsGetConfigurationOptionalParams - ): Promise; + listAlphaIds( + options?: AlphaIdsGetAlphaIdsOptionalParams + ): PagedAsyncIterableIterator; /** - * Creates or updates Alpha ID Configuration for the current resource. - * @param enabled Indicates whether the use of Alpha IDs is supported for a specific resource. + * Get the Dynamic Alpha ID configuration that's applied for the current resource. * @param options The options parameters. */ - upsertConfiguration( + getDynamicAlphaIdConfiguration( + options?: AlphaIdsGetDynamicAlphaIdConfigurationOptionalParams + ): Promise; + /** + * Creates or updates Dynamic Alpha ID Configuration for the current resource. + * @param enabled Indicates whether the use of Dynamic Alpha IDs is supported for a specific resource. + * @param options The options parameters. + */ + upsertDynamicAlphaIdConfiguration( enabled: boolean, - options?: AlphaIdsUpsertConfigurationOptionalParams - ): Promise; + options?: AlphaIdsUpsertDynamicAlphaIdConfigurationOptionalParams + ): Promise; + /** + * Gets the list of countries that support Dynamic Alpha IDs. + * @param options The options parameters. + */ + getDynamicAlphaIdCountries( + options?: AlphaIdsGetDynamicAlphaIdCountriesOptionalParams + ): Promise; + /** + * Gets the list of countries that support Pre-Registered Alpha IDs. + * @param options The options parameters. + */ + getPreRegisteredAlphaIdCountries( + options?: AlphaIdsGetPreRegisteredAlphaIdCountriesOptionalParams + ): Promise; } diff --git a/sdk/communication/communication-alpha-ids/src/generated/src/pagingHelper.ts b/sdk/communication/communication-alpha-ids/src/generated/src/pagingHelper.ts new file mode 100644 index 000000000000..269a2b9814b5 --- /dev/null +++ b/sdk/communication/communication-alpha-ids/src/generated/src/pagingHelper.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export interface PageInfo { + continuationToken?: string; +} + +const pageMap = new WeakMap(); + +/** + * Given the last `.value` produced by the `byPage` iterator, + * returns a continuation token that can be used to begin paging from + * that point later. + * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. + * @returns The continuation token that can be passed into byPage() during future calls. + */ +export function getContinuationToken(page: unknown): string | undefined { + if (typeof page !== "object" || page === null) { + return undefined; + } + return pageMap.get(page)?.continuationToken; +} + +export function setContinuationToken( + page: unknown, + continuationToken: string | undefined +): void { + if (typeof page !== "object" || page === null || !continuationToken) { + return; + } + const pageInfo = pageMap.get(page) ?? {}; + pageInfo.continuationToken = continuationToken; + pageMap.set(page, pageInfo); +} diff --git a/sdk/communication/communication-alpha-ids/src/models.ts b/sdk/communication/communication-alpha-ids/src/models.ts index 20685a5f6167..10832bcba94e 100644 --- a/sdk/communication/communication-alpha-ids/src/models.ts +++ b/sdk/communication/communication-alpha-ids/src/models.ts @@ -2,15 +2,43 @@ // Licensed under the MIT license. import { OperationOptions } from "@azure/core-client"; - +import { + AlphaIdsGetAlphaIdsOptionalParams, + AlphaIdsGetDynamicAlphaIdCountriesOptionalParams, + AlphaIdsGetPreRegisteredAlphaIdCountriesOptionalParams, +} from "."; /** * Additional options for the Get Alpha ID Configuration request. */ export interface GetConfigurationOptions extends OperationOptions {} +/** + * Additional options for the ListAlphaIds request. + */ +export interface ListAlphaIdsOptions extends AlphaIdsGetAlphaIdsOptionalParams {} + +/** + * Additional options for the GetDynamicAlphaIdCountries request. + */ +export interface GetDynamicAlphaIdCountriesOptions + extends AlphaIdsGetDynamicAlphaIdCountriesOptionalParams {} + +/** + * Additional options for the GetPreRegisteredAlphaIdCountries request. + */ +export interface GetPreRegisteredAlphaIdCountriesOptions + extends AlphaIdsGetPreRegisteredAlphaIdCountriesOptionalParams {} + /** * Additional options for the Upsert Alpha ID Configuration request. */ export interface UpsertConfigurationOptions extends OperationOptions {} -export { AlphaIdConfiguration } from "./generated/src/models/"; +export { + DynamicAlphaIdConfiguration, + AlphaId, + AlphaIdsGetAlphaIdsOptionalParams, + AlphaIdsGetDynamicAlphaIdCountriesOptionalParams, + AlphaIdsGetPreRegisteredAlphaIdCountriesOptionalParams, + SupportedCountries, +} from "./generated/src/models/"; diff --git a/sdk/communication/communication-alpha-ids/swagger/alphaids.json b/sdk/communication/communication-alpha-ids/swagger/alphaids.json index ff6a250696a7..d023bff71317 100644 --- a/sdk/communication/communication-alpha-ids/swagger/alphaids.json +++ b/sdk/communication/communication-alpha-ids/swagger/alphaids.json @@ -3,16 +3,72 @@ "info": { "title": "AlphaIdsClient", "description": "The alpha ids client uses Azure Communication Services to purchase and manage alpha ids.", - "version": "2022-09-26-preview" + "version": "2023-07-12" }, "paths": { - "/alphaIds/configuration": { + "/alphaIds": { "get": { "tags": [ - "AlphaIDs - Configuration" + "AlphaIDs" ], - "summary": "Get the Alpha IDs configuration that's applied for the current resource.", - "operationId": "AlphaIds_GetConfiguration", + "summary": "Gets the list of alpha ids for the current resource.", + "operationId": "AlphaIds_GetAlphaIds", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "query", + "name": "skip", + "description": "An optional parameter for how many entries to skip, for pagination purposes.", + "type": "integer", + "format": "int32", + "default": 0 + }, + { + "in": "query", + "name": "top", + "description": "An optional parameter for how many entries to return, for pagination purposes.", + "type": "integer", + "format": "int32", + "default": 100 + }, + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/AcquiredAlphaIds" + } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/CommunicationErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink", + "itemName": "alphaIds" + }, + "x-ms-examples": { + "List alpha ids": { + "$ref": "./examples/GetAlphaIds.json" + } + } + } + }, + "/alphaIds/dynamic/configuration": { + "get": { + "tags": [ + "AlphaIDs" + ], + "summary": "Get the Dynamic Alpha ID configuration that's applied for the current resource.", + "operationId": "AlphaIds_GetDynamicAlphaIdConfiguration", "produces": [ "application/json" ], @@ -25,7 +81,7 @@ "200": { "description": "Success", "schema": { - "$ref": "#/definitions/AlphaIdConfiguration" + "$ref": "#/definitions/DynamicAlphaIdConfiguration" } }, "default": { @@ -36,17 +92,17 @@ } }, "x-ms-examples": { - "Get the current Alpha IDs configuration": { - "$ref": "./examples/GetAlphaIdConfiguration.json" + "Get the current Dynamic Alpha IDs configuration": { + "$ref": "./examples/GetDynamicAlphaIdConfiguration.json" } } }, "patch": { "tags": [ - "AlphaIDs - Configuration" + "AlphaIDs" ], - "summary": "Creates or updates Alpha ID Configuration for the current resource.", - "operationId": "AlphaIds_UpsertConfiguration", + "summary": "Creates or updates Dynamic Alpha ID Configuration for the current resource.", + "operationId": "AlphaIds_UpsertDynamicAlphaIdConfiguration", "consumes": [ "application/merge-patch+json" ], @@ -62,15 +118,87 @@ "name": "body", "description": "The configuration data that is intended to be applied.", "schema": { - "$ref": "#/definitions/AlphaIdConfiguration" + "$ref": "#/definitions/DynamicAlphaIdConfiguration" + } + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/DynamicAlphaIdConfiguration" + } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/CommunicationErrorResponse" + } + } + }, + "x-ms-examples": { + "Enables Dynamic Alpha IDs for the current resource": { + "$ref": "./examples/UpsertDynamicAlphaIdConfiguration.json" + } + } + } + }, + "/alphaIds/dynamic/countries": { + "get": { + "tags": [ + "AlphaIDs" + ], + "summary": "Gets the list of countries that support Dynamic Alpha IDs.", + "operationId": "AlphaIds_GetDynamicAlphaIdCountries", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/SupportedCountries" } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/CommunicationErrorResponse" + } + } + }, + "x-ms-examples": { + "List dynamic alpha id countries": { + "$ref": "./examples/GetDynamicAlphaIdCountries.json" + } + } + } + }, + "/alphaIds/pre-registered/countries": { + "get": { + "tags": [ + "AlphaIDs" + ], + "summary": "Gets the list of countries that support Pre-Registered Alpha IDs.", + "operationId": "AlphaIds_GetPreRegisteredAlphaIdCountries", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" } ], "responses": { "200": { "description": "Success", "schema": { - "$ref": "#/definitions/AlphaIdConfiguration" + "$ref": "#/definitions/SupportedCountries" } }, "default": { @@ -81,27 +209,77 @@ } }, "x-ms-examples": { - "Enables Alpha ID for the current resource": { - "$ref": "./examples/UpsertAlphaIdConfiguration.json" + "List pre-registered alpha id countries": { + "$ref": "./examples/GetPreRegisteredAlphaIdCountries.json" } } } } }, "definitions": { - "AlphaIdConfiguration": { - "description": "
Represents a collection of settings for configuring Alpha ID support for a specific resource.\r\n
\r\n Initially, Alpha IDs were restricted to customers that had valid use cases for them, so this configuration could be leveraged to enable its usage.\r\n ", + "AcquiredAlphaIds": { + "description": "A wrapper for a list of alpha id entities.", + "type": "object", + "properties": { + "alphaIds": { + "description": "List of alpha ids.", + "type": "array", + "items": { + "$ref": "#/definitions/AlphaId" + } + }, + "nextLink": { + "description": "Represents the URL link to the next page.", + "type": "string" + } + } + }, + "AlphaId": { + "description": "Represents an AlphaId acquired in a given country.", + "type": "object", + "properties": { + "value": { + "description": "The value of the AlphaId e.g. 'CONTOSO', etc.", + "type": "string" + }, + "countryCode": { + "description": "ISO 3166 2-char code representing the country e.g. 'US'.", + "type": "string" + }, + "purchaseDate": { + "format": "date-time", + "description": "Date in which number was purchased.", + "type": "string" + } + } + }, + "DynamicAlphaIdConfiguration": { + "description": "
Represents a collection of settings for configuring Dynamic Alpha ID support for a specific resource.\r\n
\r\n Initially, Alpha IDs were restricted to customers that had valid use cases for them, so this configuration could be leveraged to enable its usage.\r\n ", "required": [ "enabled" ], "type": "object", "properties": { "enabled": { - "description": "Indicates whether the use of Alpha IDs is supported for a specific resource.", + "description": "Indicates whether the use of Dynamic Alpha IDs is supported for a specific resource.", "type": "boolean" } } }, + "SupportedCountries": { + "description": "A wrapper for a list of countries.", + "type": "object", + "properties": { + "countries": { + "description": "List of conutries supporting alpha ids.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "CommunicationErrorResponse": { "description": "The Communication Services error.", "type": "object", diff --git a/sdk/communication/communication-alpha-ids/test/internal/generated_client.spec.ts b/sdk/communication/communication-alpha-ids/test/internal/generated_client.spec.ts index 39ebd8a7b1db..047890a75330 100644 --- a/sdk/communication/communication-alpha-ids/test/internal/generated_client.spec.ts +++ b/sdk/communication/communication-alpha-ids/test/internal/generated_client.spec.ts @@ -109,42 +109,7 @@ describe("AlphaIdsGeneratedClient - constructor", function () { ); const spy = sinon.spy(mockHttpClient, "sendRequest"); - await client.alphaIds.upsertConfiguration(true); - sinon.assert.calledOnce(spy); - }); - - it("verify bearer policy exists without explicitly adding it", async function () { - const connectionString = `endpoint=${endpoint};accesskey=${accessKey}`; - const mockHttpClient = createMockHttpClient(); - const customHeaderPolicyName = "custom-header-policy"; - const customHeader = "alphaidsclient-headers-test-additional"; - const testPipeline = createEmptyPipeline(); - testPipeline.addPolicy(userAgentPolicy(customHeader, customHeaderPolicyName)); - const { url } = parseClientArguments(connectionString, {}); - const client = new AlphaIDsGeneratedClient(url, { - apiVersion: "customApiVersion", - httpClient: mockHttpClient, - pipeline: testPipeline, - endpoint: "https://contoso.spool.azure.local?param1=param1", - }); - const policies = client.pipeline.getOrderedPolicies(); - assert.isDefined(policies, "default pipeline should contain policies"); - // verify bearer token policy exists, after explicitly adding it - assert.isDefined( - policies.find((p) => p.name === bearerTokenAuthenticationPolicyName), - "pipeline should have bearerTokenAuthenticationPolicyName" - ); - assert.isDefined( - policies.find((p) => p.name === customHeaderPolicyName), - "pipeline should have customHeaderPolicyName" - ); - assert.isDefined( - policies.find((p) => p.name === "CustomApiVersionPolicy"), - "pipeline should have CustomApiVersionPolicy" - ); - - const spy = sinon.spy(mockHttpClient, "sendRequest"); - await client.alphaIds.upsertConfiguration(true); + await client.alphaIds.upsertDynamicAlphaIdConfiguration(true); sinon.assert.calledOnce(spy); }); }); diff --git a/sdk/communication/communication-alpha-ids/test/internal/headers.spec.ts b/sdk/communication/communication-alpha-ids/test/internal/headers.spec.ts index 91d79d35bede..e19a4a2c339a 100644 --- a/sdk/communication/communication-alpha-ids/test/internal/headers.spec.ts +++ b/sdk/communication/communication-alpha-ids/test/internal/headers.spec.ts @@ -27,7 +27,7 @@ describe("AlphaIdsClient - headers", function () { it("calls the spy", async function () { const spy = sinon.spy(configurationHttpClient, "sendRequest"); - await client.getConfiguration(); + await client.getDynamicAlphaIdConfiguration(); sinon.assert.calledOnce(spy); request = spy.getCall(0).args[0]; @@ -67,7 +67,7 @@ describe("AlphaIdsClient - headers", function () { }); const spy = sinon.spy(configurationHttpClient, "sendRequest"); - await client.getConfiguration(); + await client.getDynamicAlphaIdConfiguration(); sinon.assert.calledOnce(spy); request = spy.getCall(0).args[0]; @@ -86,7 +86,7 @@ describe("AlphaIdsClient - headers", function () { }); const spy = sinon.spy(configurationHttpClient, "sendRequest"); - await client.getConfiguration(); + await client.getDynamicAlphaIdConfiguration(); sinon.assert.calledOnce(spy); request = spy.getCall(0).args[0]; @@ -103,7 +103,7 @@ describe("AlphaIdsClient - headers", function () { }); const spy = sinon.spy(configurationHttpClient, "sendRequest"); - await client.getConfiguration(); + await client.getDynamicAlphaIdConfiguration(); sinon.assert.calledOnce(spy); request = spy.getCall(0).args[0]; diff --git a/sdk/communication/communication-alpha-ids/test/public/dynamicAlphaId.spec.ts b/sdk/communication/communication-alpha-ids/test/public/dynamicAlphaId.spec.ts new file mode 100644 index 000000000000..81101f323bc6 --- /dev/null +++ b/sdk/communication/communication-alpha-ids/test/public/dynamicAlphaId.spec.ts @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { AlphaIdsClient } from "../../src"; +import { Context } from "mocha"; +import { Recorder } from "@azure-tools/test-recorder"; +import { createRecordedClient } from "./utils/recordedClient"; +import { assert } from "chai"; +import { FullOperationResponse, OperationOptions } from "@azure/core-client"; +import { DynamicAlphaIdConfiguration } from "../../src"; + +describe(`AlphaIdsClient - manage configuration`, function () { + let recorder: Recorder; + let client: AlphaIdsClient; + + beforeEach(async function (this: Context) { + ({ client, recorder } = await createRecordedClient(this)); + }); + + afterEach(async function (this: Context) { + if (!this.currentTest?.isPending()) { + await recorder.stop(); + } + }); + + it("can manage configuration", async function () { + let configuration: DynamicAlphaIdConfiguration; + let configurationResponse: FullOperationResponse | undefined; + const getConfigurationRequest: OperationOptions = { + onResponse: (response) => { + configurationResponse = response; + }, + }; + + configuration = await client.upsertDynamicAlphaIdConfiguration(true, getConfigurationRequest); + assert.isOk(configuration); + assert.isTrue( + configuration.enabled, + `The expected configuration: true is different than the received configuration: false + CV: ${configurationResponse?.headers.get("MS-CV")}` + ); + + configuration = await client.getDynamicAlphaIdConfiguration(getConfigurationRequest); + assert.isOk(configuration); + + configuration = await client.upsertDynamicAlphaIdConfiguration(false, getConfigurationRequest); + assert.isOk(configuration); + assert.isFalse( + configuration.enabled, + `The expected configuration: false is different than the received configuration: true + CV: ${configurationResponse?.headers.get("MS-CV")}` + ); + }).timeout(15000); + + it("can list all dynamic alpha ids countries", async function () { + const countries = (await client.getDynamicAlphaIdCountries()).countries; + countries?.forEach((countryCode) => { + assert.isNotNull(countryCode); + }); + }).timeout(20000); +}); diff --git a/sdk/communication/communication-alpha-ids/test/public/manageAlphaIdConfiguration.spec.ts b/sdk/communication/communication-alpha-ids/test/public/manageAlphaIdConfiguration.spec.ts deleted file mode 100644 index 53356a04b27d..000000000000 --- a/sdk/communication/communication-alpha-ids/test/public/manageAlphaIdConfiguration.spec.ts +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { AlphaIdsClient } from "../../src"; -import { Context } from "mocha"; -import { Recorder } from "@azure-tools/test-recorder"; -import { createRecordedClient } from "./utils/recordedClient"; -import { ignoreSubscriptionNotEligibleError } from "./utils/alphaIdClientTestUtils"; - -describe(`AlphaIdsClient - manage configuration`, function () { - let recorder: Recorder; - let client: AlphaIdsClient; - - beforeEach(async function (this: Context) { - ({ client, recorder } = await createRecordedClient(this)); - }); - - afterEach(async function (this: Context) { - if (!this.currentTest?.isPending()) { - await recorder.stop(); - } - }); - - it("can manage configuration", async function () { - await ignoreSubscriptionNotEligibleError(() => client.upsertConfiguration(true), true); - await ignoreSubscriptionNotEligibleError(() => client.getConfiguration(), true); - await ignoreSubscriptionNotEligibleError(() => client.upsertConfiguration(false), false); - await ignoreSubscriptionNotEligibleError(() => client.getConfiguration(), false); - }).timeout(15000); -}); diff --git a/sdk/communication/communication-alpha-ids/test/public/preRegisteredAlphaId.spec.ts b/sdk/communication/communication-alpha-ids/test/public/preRegisteredAlphaId.spec.ts new file mode 100644 index 000000000000..c1f330b1f5e8 --- /dev/null +++ b/sdk/communication/communication-alpha-ids/test/public/preRegisteredAlphaId.spec.ts @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { Context } from "mocha"; +import { Recorder } from "@azure-tools/test-recorder"; +import { AlphaIdsClient } from "../../src"; +import { assert } from "chai"; +import { createRecordedClient } from "./utils/recordedClient"; + +describe(`AlphaIdsClient - Preregistered Alpha Ids Operations`, function () { + let recorder: Recorder; + let client: AlphaIdsClient; + + beforeEach(async function (this: Context) { + ({ client, recorder } = await createRecordedClient(this)); + }); + + afterEach(async function (this: Context) { + if (!this.currentTest?.isPending()) { + await recorder.stop(); + } + }); + + it("can list all pre-registered alpha ids", async function () { + let totalItems = 0; + for await (const alphaId of client.getAlphaIds()) { + totalItems++; + assert.isNotNull(alphaId.value); + } + + // now test using pagination + const itemsPerPage = totalItems > 1 ? Math.floor(totalItems / 2) : 1; + const pages = client.getAlphaIds({ top: itemsPerPage }).byPage(); + for await (const page of pages) { + // loop over each item in the page + for (const alphaId of page) { + assert.isNotNull(alphaId.value); + } + } + }).timeout(40000); + + it("can list all pre-registered alpha ids countries", async function () { + const countries = (await client.getPreRegisteredAlphaIdCountries()).countries; + countries?.forEach((countryCode) => { + assert.isNotNull(countryCode); + }); + }).timeout(20000); +}); diff --git a/sdk/communication/communication-alpha-ids/test/public/utils/alphaIdClientTestUtils.ts b/sdk/communication/communication-alpha-ids/test/public/utils/alphaIdClientTestUtils.ts deleted file mode 100644 index 625332d915d0..000000000000 --- a/sdk/communication/communication-alpha-ids/test/public/utils/alphaIdClientTestUtils.ts +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { AlphaIdConfiguration } from "../../../src"; -import { RestError } from "@azure/core-rest-pipeline"; -import { assert } from "chai"; - -export async function ignoreSubscriptionNotEligibleError( - call: () => Promise, - expectedConfiguration: boolean -): Promise { - try { - const configuration = await call(); - assert.isOk(configuration); - assert.isTrue( - configuration.enabled === expectedConfiguration, - `The expected configuration: ${expectedConfiguration} is different than the received configuration: ${configuration.enabled}` - ); - } catch (error) { - if (isNotEligibleError(error)) { - return; - } - - throw error; - } -} - -function isNotEligibleError(error: any): boolean { - let errorMessage = error?.details?.error?.message; - - if (error instanceof RestError) { - errorMessage = error?.response?.bodyAsText; - } - - return error.statusCode === 403 && errorMessage.includes("is not eligible for Alpha IDs usage"); -}