diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e82fb5440a55..8d300ccafb86 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -39,6 +39,7 @@ /sdk/communication/communication-phone-numbers/ @miguhern @danielav7 @whisper6284 @AlonsoMondal /sdk/communication/communication-network-traversal/ @AriZavala2 /sdk/communication/communication-sms/ @RoyHerrod @arifibrahim4 +/sdk/communication/communication-short-codes/ @danielav7 @AlonsoMondal @ericasp16 /sdk/communication/communication-common/ @Azure/acs-identity-sdk # PRLabel: %Container Registry diff --git a/sdk/communication/communication-short-codes/recordings/browsers/shortcodesclient__creates_gets_updates_lists_and_deletes_us_program_brief/recording_can_create_get_update_list_and_delete_a_us_program_brief.json b/sdk/communication/communication-short-codes/recordings/browsers/shortcodesclient__creates_gets_updates_lists_and_deletes_us_program_brief/recording_can_create_get_update_list_and_delete_a_us_program_brief.json new file mode 100644 index 000000000000..97a2cd6daa02 --- /dev/null +++ b/sdk/communication/communication-short-codes/recordings/browsers/shortcodesclient__creates_gets_updates_lists_and_deletes_us_program_brief/recording_can_create_get_update_list_and_delete_a_us_program_brief.json @@ -0,0 +1,170 @@ +{ + "recordings": [ + { + "method": "GET", + "url": "https://endpoint/shortCodes/countries/US/programBriefs/00000000-0000-0000-0000-000000000000", + "query": { + "api-version": "2021-10-25-preview" + }, + "requestBody": null, + "status": 404, + "response": "{\"error\":{\"code\":\"NotFound\",\"message\":\"Could not find the ProgramBrief with key 'Azure|00000000-0000-0000-0000-000000000000|00000000-0000-0000-0000-000000000000'\"}}", + "responseHeaders": { + "api-supported-versions": "2021-10-25-preview", + "content-type": "application/json", + "date": "Mon, 15 Nov 2021 22:40:34 GMT", + "ms-cv": "zErQ4Ec7a0i0sFdmWoK/rQ.0", + "request-context": "appId=", + "x-azure-ref": "04+GSYQAAAAC9sRVfIXB+ToPN1jzr+CyKV1NURURHRTA4MTQAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "x-cache": "CONFIG_NOCACHE", + "x-processing-time": "204ms" + } + }, + { + "method": "PATCH", + "url": "https://endpoint/shortCodes/countries/US/programBriefs/00000000-0000-0000-0000-000000000000", + "query": { + "api-version": "2021-10-25-preview" + }, + "requestBody": "{\"id\":\"00000000-0000-0000-0000-000000000000\",\"programDetails\":{\"isVanity\":false,\"numberType\":\"shortCode\",\"isPoliticalCampaign\":false,\"name\":\"Contoso Loyalty Program\",\"description\":\"TEST Customers can sign up to receive regular updates on coupons and other perks of our loyalty program.\",\"url\":\"https://endpoint/loyalty-program\",\"signUpTypes\":[\"sms\",\"website\"],\"signUpUrl\":\"https://contoso.com/sign-up\",\"termsOfServiceUrl\":\"https://contoso.com/terms\",\"privacyPolicyUrl\":\"https://contoso.com/privacy\"},\"companyInformation\":{\"name\":\"Contoso\",\"url\":\"https://contoso.com\",\"address\":\"1 Contoso Way Redmond, WA 98052\",\"contactInformation\":{\"name\":\"Alex\",\"phone\":\"+14255551234\",\"email\":\"alex@contoso.com\"},\"customerCareInformation\":{\"tollFreeNumber\":\"+18005551234\",\"email\":\"customercare@contoso.com\"}},\"messageDetails\":{\"supportedProtocols\":[\"sms\"],\"recurrence\":\"subscription\",\"helpMessage\":\"Send 'Stop' to unsubscribe, send 'Start' to resubscribe.\",\"optOutMessage\":\"You've been unsubscribed from these messages. Send 'Start' if you want to resubscribe.\",\"optInMessage\":\"Someone requested to subscribe this number to receive updates about Contoso's loyalty program. To confirm subscription, reply to this message with 'JOIN'\",\"optInReply\":\"JOIN\",\"confirmationMessage\":\"Congrats, you have been successfully subscribed to loyalty program updates. Welcome!\",\"directionality\":\"twoWay\",\"useCases\":[{\"contentCategory\":\"coupons\",\"examples\":[{\"messages\":[{\"direction\":\"fromUser\",\"text\":\"txtMessage\"}]}]},{\"contentCategory\":\"loyaltyProgram\",\"examples\":[{\"messages\":[{\"direction\":\"toUser\",\"text\":\"txtMessage\"}]}]},{\"contentCategory\":\"loyaltyProgramPointsPrizes\",\"examples\":[{\"messages\":[{\"direction\":\"toUser\",\"text\":\"txtMessage\"}]}]}]},\"trafficDetails\":{\"totalMonthlyVolume\":10000,\"monthlyAverageMessagesFromUser\":1,\"monthlyAverageMessagesToUser\":3,\"isSpiky\":true,\"spikeDetails\":\"Higher traffic expected around major shopping holidays, most notably Black Friday and Memorial Day.\",\"estimatedRampUpTimeInDays\":0}}", + "status": 201, + "response": "{\"id\":\"00000000-0000-0000-0000-000000000000\",\"status\":\"draft\",\"reviewNotes\":[],\"costs\":[{\"amount\":650.0,\"currencyCode\":\"USD\",\"billingFrequency\":\"once\"},{\"amount\":1000.0,\"currencyCode\":\"USD\",\"billingFrequency\":\"monthly\"}],\"statusUpdatedDate\":\"2021-11-15T22:40:37.3636499+00:00\",\"programDetails\":{\"isVanity\":false,\"numberType\":\"shortCode\",\"isPoliticalCampaign\":false,\"name\":\"Contoso Loyalty Program\",\"description\":\"TEST Customers can sign up to receive regular updates on coupons and other perks of our loyalty program.\",\"url\":\"https://endpoint/loyalty-program\",\"signUpTypes\":[\"sms\",\"website\"],\"signUpUrl\":\"https://contoso.com/sign-up\",\"termsOfServiceUrl\":\"https://contoso.com/terms\",\"privacyPolicyUrl\":\"https://contoso.com/privacy\"},\"companyInformation\":{\"name\":\"Contoso\",\"url\":\"https://contoso.com\",\"address\":\"1 Contoso Way Redmond, WA 98052\",\"contactInformation\":{\"name\":\"Alex\",\"phone\":\"+14255551234\",\"email\":\"alex@contoso.com\"},\"customerCareInformation\":{\"tollFreeNumber\":\"+18005551234\",\"email\":\"customercare@contoso.com\"}},\"messageDetails\":{\"supportedProtocols\":[\"sms\"],\"recurrence\":\"subscription\",\"helpMessage\":\"Send 'Stop' to unsubscribe, send 'Start' to resubscribe.\",\"optOutMessage\":\"You've been unsubscribed from these messages. Send 'Start' if you want to resubscribe.\",\"optInMessage\":\"Someone requested to subscribe this number to receive updates about Contoso's loyalty program. To confirm subscription, reply to this message with 'JOIN'\",\"optInReply\":\"JOIN\",\"confirmationMessage\":\"Congrats, you have been successfully subscribed to loyalty program updates. Welcome!\",\"directionality\":\"twoWay\",\"useCases\":[{\"contentCategory\":\"coupons\",\"examples\":[{\"messages\":[{\"direction\":\"fromUser\",\"text\":\"txtMessage\"}]}]},{\"contentCategory\":\"loyaltyProgram\",\"examples\":[{\"messages\":[{\"direction\":\"toUser\",\"text\":\"txtMessage\"}]}]},{\"contentCategory\":\"loyaltyProgramPointsPrizes\",\"examples\":[{\"messages\":[{\"direction\":\"toUser\",\"text\":\"txtMessage\"}]}]}]},\"trafficDetails\":{\"totalMonthlyVolume\":10000,\"monthlyAverageMessagesFromUser\":1,\"monthlyAverageMessagesToUser\":3,\"isSpiky\":true,\"spikeDetails\":\"Higher traffic expected around major shopping holidays, most notably Black Friday and Memorial Day.\",\"estimatedRampUpTimeInDays\":0}}", + "responseHeaders": { + "api-supported-versions": "2021-10-25-preview", + "content-type": "application/json; charset=utf-8", + "date": "Mon, 15 Nov 2021 22:40:36 GMT", + "location": "https://endpoint/shortCodes/countries/US/programBriefs/00000000-0000-0000-0000-000000000000", + "ms-cv": "G0v7LrdrjU67oZgHrpa1Pw.0", + "request-context": "appId=", + "x-azure-ref": "04+GSYQAAAADvmEVc3Pl4QKcQCIbV4nM3V1NURURHRTA4MTQAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "x-cache": "CONFIG_NOCACHE", + "x-processing-time": "1952ms" + } + }, + { + "method": "GET", + "url": "https://endpoint/shortCodes/countries/US/programBriefs/00000000-0000-0000-0000-000000000000", + "query": { + "api-version": "2021-10-25-preview" + }, + "requestBody": null, + "status": 200, + "response": "{\"id\":\"00000000-0000-0000-0000-000000000000\",\"status\":\"draft\",\"reviewNotes\":[],\"costs\":[{\"amount\":650.0,\"currencyCode\":\"USD\",\"billingFrequency\":\"once\"},{\"amount\":1000.0,\"currencyCode\":\"USD\",\"billingFrequency\":\"monthly\"}],\"statusUpdatedDate\":\"2021-11-15T22:40:37.3636499+00:00\",\"programDetails\":{\"isVanity\":false,\"numberType\":\"shortCode\",\"isPoliticalCampaign\":false,\"name\":\"Contoso Loyalty Program\",\"description\":\"TEST Customers can sign up to receive regular updates on coupons and other perks of our loyalty program.\",\"url\":\"https://endpoint/loyalty-program\",\"signUpTypes\":[\"sms\",\"website\"],\"signUpUrl\":\"https://contoso.com/sign-up\",\"termsOfServiceUrl\":\"https://contoso.com/terms\",\"privacyPolicyUrl\":\"https://contoso.com/privacy\"},\"companyInformation\":{\"name\":\"Contoso\",\"url\":\"https://contoso.com\",\"address\":\"1 Contoso Way Redmond, WA 98052\",\"contactInformation\":{\"name\":\"Alex\",\"phone\":\"+14255551234\",\"email\":\"alex@contoso.com\"},\"customerCareInformation\":{\"tollFreeNumber\":\"+18005551234\",\"email\":\"customercare@contoso.com\"}},\"messageDetails\":{\"supportedProtocols\":[\"sms\"],\"recurrence\":\"subscription\",\"helpMessage\":\"Send 'Stop' to unsubscribe, send 'Start' to resubscribe.\",\"optOutMessage\":\"You've been unsubscribed from these messages. Send 'Start' if you want to resubscribe.\",\"optInMessage\":\"Someone requested to subscribe this number to receive updates about Contoso's loyalty program. To confirm subscription, reply to this message with 'JOIN'\",\"optInReply\":\"JOIN\",\"confirmationMessage\":\"Congrats, you have been successfully subscribed to loyalty program updates. Welcome!\",\"directionality\":\"twoWay\",\"useCases\":[{\"contentCategory\":\"coupons\",\"examples\":[{\"messages\":[{\"direction\":\"fromUser\",\"text\":\"txtMessage\"}]}]},{\"contentCategory\":\"loyaltyProgram\",\"examples\":[{\"messages\":[{\"direction\":\"toUser\",\"text\":\"txtMessage\"}]}]},{\"contentCategory\":\"loyaltyProgramPointsPrizes\",\"examples\":[{\"messages\":[{\"direction\":\"toUser\",\"text\":\"txtMessage\"}]}]}]},\"trafficDetails\":{\"totalMonthlyVolume\":10000,\"monthlyAverageMessagesFromUser\":1,\"monthlyAverageMessagesToUser\":3,\"isSpiky\":true,\"spikeDetails\":\"Higher traffic expected around major shopping holidays, most notably Black Friday and Memorial Day.\",\"estimatedRampUpTimeInDays\":0}}", + "responseHeaders": { + "api-supported-versions": "2021-10-25-preview", + "content-type": "application/json; charset=utf-8", + "date": "Mon, 15 Nov 2021 22:40:38 GMT", + "ms-cv": "J+qbtHjUZ0+BVGPSqBJ6mA.0", + "request-context": "appId=", + "x-azure-ref": "05eGSYQAAAABKs6iTAuWlT6ZSEp4Up91rV1NURURHRTA4MTQAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "x-cache": "CONFIG_NOCACHE", + "x-processing-time": "1255ms" + } + }, + { + "method": "PATCH", + "url": "https://endpoint/shortCodes/countries/US/programBriefs/00000000-0000-0000-0000-000000000000", + "query": { + "api-version": "2021-10-25-preview" + }, + "requestBody": "{\"id\":\"00000000-0000-0000-0000-000000000000\",\"programDetails\":{\"signUpUrl\":\"https://endpoint/updated-sign-up\",\"termsOfServiceUrl\":\"https://endpoint/updated-terms\",\"privacyPolicyUrl\":\"https://endpoint/updated-privacy\"}}", + "status": 200, + "response": "{\"id\":\"00000000-0000-0000-0000-000000000000\",\"status\":\"draft\",\"reviewNotes\":[],\"costs\":[{\"amount\":650.0,\"currencyCode\":\"USD\",\"billingFrequency\":\"once\"},{\"amount\":1000.0,\"currencyCode\":\"USD\",\"billingFrequency\":\"monthly\"}],\"statusUpdatedDate\":\"2021-11-15T22:40:37.3636499+00:00\",\"programDetails\":{\"isVanity\":false,\"numberType\":\"shortCode\",\"isPoliticalCampaign\":false,\"name\":\"Contoso Loyalty Program\",\"description\":\"TEST Customers can sign up to receive regular updates on coupons and other perks of our loyalty program.\",\"url\":\"https://endpoint/loyalty-program\",\"signUpTypes\":[\"sms\",\"website\"],\"signUpUrl\":\"https://endpoint/updated-sign-up\",\"termsOfServiceUrl\":\"https://endpoint/updated-terms\",\"privacyPolicyUrl\":\"https://endpoint/updated-privacy\"},\"companyInformation\":{\"name\":\"Contoso\",\"url\":\"https://contoso.com\",\"address\":\"1 Contoso Way Redmond, WA 98052\",\"contactInformation\":{\"name\":\"Alex\",\"phone\":\"+14255551234\",\"email\":\"alex@contoso.com\"},\"customerCareInformation\":{\"tollFreeNumber\":\"+18005551234\",\"email\":\"customercare@contoso.com\"}},\"messageDetails\":{\"supportedProtocols\":[\"sms\"],\"recurrence\":\"subscription\",\"helpMessage\":\"Send 'Stop' to unsubscribe, send 'Start' to resubscribe.\",\"optOutMessage\":\"You've been unsubscribed from these messages. Send 'Start' if you want to resubscribe.\",\"optInMessage\":\"Someone requested to subscribe this number to receive updates about Contoso's loyalty program. To confirm subscription, reply to this message with 'JOIN'\",\"optInReply\":\"JOIN\",\"confirmationMessage\":\"Congrats, you have been successfully subscribed to loyalty program updates. Welcome!\",\"directionality\":\"twoWay\",\"useCases\":[{\"contentCategory\":\"coupons\",\"examples\":[{\"messages\":[{\"direction\":\"fromUser\",\"text\":\"txtMessage\"}]}]},{\"contentCategory\":\"loyaltyProgram\",\"examples\":[{\"messages\":[{\"direction\":\"toUser\",\"text\":\"txtMessage\"}]}]},{\"contentCategory\":\"loyaltyProgramPointsPrizes\",\"examples\":[{\"messages\":[{\"direction\":\"toUser\",\"text\":\"txtMessage\"}]}]}]},\"trafficDetails\":{\"totalMonthlyVolume\":10000,\"monthlyAverageMessagesFromUser\":1,\"monthlyAverageMessagesToUser\":3,\"isSpiky\":true,\"spikeDetails\":\"Higher traffic expected around major shopping holidays, most notably Black Friday and Memorial Day.\",\"estimatedRampUpTimeInDays\":0}}", + "responseHeaders": { + "api-supported-versions": "2021-10-25-preview", + "content-type": "application/json; charset=utf-8", + "date": "Mon, 15 Nov 2021 22:40:39 GMT", + "ms-cv": "05uefirc8kisJRB9e+lzQA.0", + "request-context": "appId=", + "x-azure-ref": "05+GSYQAAAAAudLy8sJ4aR44esIzuS6r/V1NURURHRTA4MTQAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "x-cache": "CONFIG_NOCACHE", + "x-processing-time": "1516ms" + } + }, + { + "method": "GET", + "url": "https://endpoint/shortCodes/countries/US/programBriefs/00000000-0000-0000-0000-000000000000", + "query": { + "api-version": "2021-10-25-preview" + }, + "requestBody": null, + "status": 200, + "response": "{\"id\":\"00000000-0000-0000-0000-000000000000\",\"status\":\"draft\",\"reviewNotes\":[],\"costs\":[{\"amount\":650.0,\"currencyCode\":\"USD\",\"billingFrequency\":\"once\"},{\"amount\":1000.0,\"currencyCode\":\"USD\",\"billingFrequency\":\"monthly\"}],\"statusUpdatedDate\":\"2021-11-15T22:40:37.3636499+00:00\",\"programDetails\":{\"isVanity\":false,\"numberType\":\"shortCode\",\"isPoliticalCampaign\":false,\"name\":\"Contoso Loyalty Program\",\"description\":\"TEST Customers can sign up to receive regular updates on coupons and other perks of our loyalty program.\",\"url\":\"https://endpoint/loyalty-program\",\"signUpTypes\":[\"sms\",\"website\"],\"signUpUrl\":\"https://endpoint/updated-sign-up\",\"termsOfServiceUrl\":\"https://endpoint/updated-terms\",\"privacyPolicyUrl\":\"https://endpoint/updated-privacy\"},\"companyInformation\":{\"name\":\"Contoso\",\"url\":\"https://contoso.com\",\"address\":\"1 Contoso Way Redmond, WA 98052\",\"contactInformation\":{\"name\":\"Alex\",\"phone\":\"+14255551234\",\"email\":\"alex@contoso.com\"},\"customerCareInformation\":{\"tollFreeNumber\":\"+18005551234\",\"email\":\"customercare@contoso.com\"}},\"messageDetails\":{\"supportedProtocols\":[\"sms\"],\"recurrence\":\"subscription\",\"helpMessage\":\"Send 'Stop' to unsubscribe, send 'Start' to resubscribe.\",\"optOutMessage\":\"You've been unsubscribed from these messages. Send 'Start' if you want to resubscribe.\",\"optInMessage\":\"Someone requested to subscribe this number to receive updates about Contoso's loyalty program. To confirm subscription, reply to this message with 'JOIN'\",\"optInReply\":\"JOIN\",\"confirmationMessage\":\"Congrats, you have been successfully subscribed to loyalty program updates. Welcome!\",\"directionality\":\"twoWay\",\"useCases\":[{\"contentCategory\":\"coupons\",\"examples\":[{\"messages\":[{\"direction\":\"fromUser\",\"text\":\"txtMessage\"}]}]},{\"contentCategory\":\"loyaltyProgram\",\"examples\":[{\"messages\":[{\"direction\":\"toUser\",\"text\":\"txtMessage\"}]}]},{\"contentCategory\":\"loyaltyProgramPointsPrizes\",\"examples\":[{\"messages\":[{\"direction\":\"toUser\",\"text\":\"txtMessage\"}]}]}]},\"trafficDetails\":{\"totalMonthlyVolume\":10000,\"monthlyAverageMessagesFromUser\":1,\"monthlyAverageMessagesToUser\":3,\"isSpiky\":true,\"spikeDetails\":\"Higher traffic expected around major shopping holidays, most notably Black Friday and Memorial Day.\",\"estimatedRampUpTimeInDays\":0}}", + "responseHeaders": { + "api-supported-versions": "2021-10-25-preview", + "content-type": "application/json; charset=utf-8", + "date": "Mon, 15 Nov 2021 22:40:41 GMT", + "ms-cv": "cn8CMWtdPUeiUbXw+OByHQ.0", + "request-context": "appId=", + "x-azure-ref": "06OGSYQAAAACPuj0JRjmmTbLWCVVswx7eV1NURURHRTA4MTQAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "x-cache": "CONFIG_NOCACHE", + "x-processing-time": "1292ms" + } + }, + { + "method": "GET", + "url": "https://endpoint/shortCodes/countries/US/programBriefs", + "query": { + "top": "100", + "api-version": "2021-10-25-preview" + }, + "requestBody": null, + "status": 200, + "response": "{\"programBriefs\":[{\"id\":\"00000000-0000-0000-0000-000000000000\",\"status\":\"draft\",\"reviewNotes\":[],\"costs\":[{\"amount\":650.0,\"currencyCode\":\"USD\",\"billingFrequency\":\"once\"},{\"amount\":1000.0,\"currencyCode\":\"USD\",\"billingFrequency\":\"monthly\"}],\"statusUpdatedDate\":\"2021-11-15T22:40:37.3636499+00:00\",\"programDetails\":{\"isVanity\":false,\"numberType\":\"shortCode\",\"isPoliticalCampaign\":false,\"name\":\"Contoso Loyalty Program\",\"description\":\"TEST Customers can sign up to receive regular updates on coupons and other perks of our loyalty program.\",\"url\":\"https://endpoint/loyalty-program\",\"signUpTypes\":[\"sms\",\"website\"],\"signUpUrl\":\"https://endpoint/updated-sign-up\",\"termsOfServiceUrl\":\"https://endpoint/updated-terms\",\"privacyPolicyUrl\":\"https://endpoint/updated-privacy\"},\"companyInformation\":{\"name\":\"Contoso\",\"url\":\"https://contoso.com\",\"address\":\"1 Contoso Way Redmond, WA 98052\",\"contactInformation\":{\"name\":\"Alex\",\"phone\":\"+14255551234\",\"email\":\"alex@contoso.com\"},\"customerCareInformation\":{\"tollFreeNumber\":\"+18005551234\",\"email\":\"customercare@contoso.com\"}},\"messageDetails\":{\"supportedProtocols\":[\"sms\"],\"recurrence\":\"subscription\",\"helpMessage\":\"Send 'Stop' to unsubscribe, send 'Start' to resubscribe.\",\"optOutMessage\":\"You've been unsubscribed from these messages. Send 'Start' if you want to resubscribe.\",\"optInMessage\":\"Someone requested to subscribe this number to receive updates about Contoso's loyalty program. To confirm subscription, reply to this message with 'JOIN'\",\"optInReply\":\"JOIN\",\"confirmationMessage\":\"Congrats, you have been successfully subscribed to loyalty program updates. Welcome!\",\"directionality\":\"twoWay\",\"useCases\":[{\"contentCategory\":\"coupons\",\"examples\":[{\"messages\":[{\"direction\":\"fromUser\",\"text\":\"txtMessage\"}]}]},{\"contentCategory\":\"loyaltyProgram\",\"examples\":[{\"messages\":[{\"direction\":\"toUser\",\"text\":\"txtMessage\"}]}]},{\"contentCategory\":\"loyaltyProgramPointsPrizes\",\"examples\":[{\"messages\":[{\"direction\":\"toUser\",\"text\":\"txtMessage\"}]}]}]},\"trafficDetails\":{\"totalMonthlyVolume\":10000,\"monthlyAverageMessagesFromUser\":1,\"monthlyAverageMessagesToUser\":3,\"isSpiky\":true,\"spikeDetails\":\"Higher traffic expected around major shopping holidays, most notably Black Friday and Memorial Day.\",\"estimatedRampUpTimeInDays\":0}}]}", + "responseHeaders": { + "api-supported-versions": "2021-10-25-preview", + "content-type": "application/json; charset=utf-8", + "date": "Mon, 15 Nov 2021 22:40:42 GMT", + "ms-cv": "Myx6UbRC2kqU0+csuqcHBQ.0", + "request-context": "appId=", + "x-azure-ref": "06uGSYQAAAAAhCWQDadr0QpuTZS6gc+MbV1NURURHRTA4MTQAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "x-cache": "CONFIG_NOCACHE", + "x-processing-time": "1257ms" + } + }, + { + "method": "DELETE", + "url": "https://endpoint/shortCodes/countries/US/programBriefs/00000000-0000-0000-0000-000000000000", + "query": { + "api-version": "2021-10-25-preview" + }, + "requestBody": null, + "status": 204, + "response": "", + "responseHeaders": { + "api-supported-versions": "2021-10-25-preview", + "date": "Mon, 15 Nov 2021 22:40:43 GMT", + "ms-cv": "Z1Gdrq8eAEyVsQB0+Qhjig.0", + "request-context": "appId=", + "x-azure-ref": "06+GSYQAAAABfVAQ7obBkTqg+I5Zzt7woV1NURURHRTA4MTQAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "x-cache": "CONFIG_NOCACHE", + "x-processing-time": "402ms" + } + }, + { + "method": "GET", + "url": "https://endpoint/shortCodes/countries/US/programBriefs/00000000-0000-0000-0000-000000000000", + "query": { + "api-version": "2021-10-25-preview" + }, + "requestBody": null, + "status": 404, + "response": "{\"error\":{\"code\":\"NotFound\",\"message\":\"Could not find the ProgramBrief with key 'Azure|00000000-0000-0000-0000-000000000000|00000000-0000-0000-0000-000000000000'\"}}", + "responseHeaders": { + "api-supported-versions": "2021-10-25-preview", + "content-type": "application/json", + "date": "Mon, 15 Nov 2021 22:40:43 GMT", + "ms-cv": "edWxQM/KC062fD5WBLbpmA.0", + "request-context": "appId=", + "x-azure-ref": "07OGSYQAAAABzevHrfeh8TYNfesAfCD2rV1NURURHRTA4MTQAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "x-cache": "CONFIG_NOCACHE", + "x-processing-time": "191ms" + } + } + ], + "uniqueTestInfo": { + "uniqueName": {}, + "newDate": {} + }, + "hash": "4a6fd68a9ce6df85fa67bf14f8797a43" +} \ No newline at end of file diff --git a/sdk/communication/communication-short-codes/recordings/browsers/shortcodesclient__lists_short_codes/recording_can_list_all_acquired_short_codes.json b/sdk/communication/communication-short-codes/recordings/browsers/shortcodesclient__lists_short_codes/recording_can_list_all_acquired_short_codes.json index f05c9ef289c8..8a3e271e917f 100644 --- a/sdk/communication/communication-short-codes/recordings/browsers/shortcodesclient__lists_short_codes/recording_can_list_all_acquired_short_codes.json +++ b/sdk/communication/communication-short-codes/recordings/browsers/shortcodesclient__lists_short_codes/recording_can_list_all_acquired_short_codes.json @@ -2,23 +2,23 @@ "recordings": [ { "method": "GET", - "url": "https://endpoint/shortCodes/countries/US/programBriefs", + "url": "https://endpoint/shortCodes", "query": { "top": "100", "api-version": "2021-10-25-preview" }, "requestBody": null, "status": 200, - "response": "{\"programBriefs\":[{\"id\":\"00000000-0000-0000-0000-000000000000\",\"status\":\"draft\",\"reviewNotes\":[],\"costs\":[{\"amount\":650.0,\"currencyCode\":\"USD\",\"billingFrequency\":\"once\"},{\"amount\":1000.0,\"currencyCode\":\"USD\",\"billingFrequency\":\"monthly\"}],\"statusUpdatedDate\":\"2021-11-04T21:21:28.6423419+00:00\",\"programDetails\":{\"isVanity\":false,\"numberType\":\"shortCode\",\"isPoliticalCampaign\":false,\"name\":\"Contoso Loyalty Program\",\"description\":\"TEST UPDATEThu Nov 04 2021 15:49:00 GMT-0600 (Central Standard Time)\",\"url\":\"https://endpoint/loyalty-program\",\"signUpTypes\":[\"sms\",\"website\"],\"signUpUrl\":\"https://contoso.com/sign-up\",\"termsOfServiceUrl\":\"https://contoso.com/terms\",\"privacyPolicyUrl\":\"https://contoso.com/privacy\",\"expectedDateOfService\":\"2022-02-25T06:00:00+00:00\"},\"companyInformation\":{\"name\":\"Contoso\",\"url\":\"https://contoso.com\",\"address\":\"1 Contoso Way Redmond, WA 98052\",\"contactInformation\":{\"name\":\"Alex\",\"phone\":\"+14255551234\",\"email\":\"alex@contoso.com\"},\"customerCareInformation\":{\"tollFreeNumber\":\"+18005551234\",\"email\":\"customercare@contoso.com\"}},\"messageDetails\":{\"supportedProtocols\":[\"sms\"],\"recurrence\":\"subscription\",\"helpMessage\":\"Help Message\",\"optOutMessage\":\"OUT\",\"optInMessage\":\"Someone requested to subscribe this number to receive updates about Contoso's loyalty program. To confirm subscription, reply to this message with 'JOIN'\",\"optInReply\":\"JOIN\",\"confirmationMessage\":\"Congrats, you have been successfully subscribed to loyalty program updates. Welcome!\",\"directionality\":\"twoWay\",\"useCases\":[{\"contentCategory\":\"coupons\",\"examples\":[{\"messages\":[{\"direction\":\"fromUser\",\"text\":\"txtMessage\"}]}]},{\"contentCategory\":\"loyaltyProgram\",\"examples\":[{\"messages\":[{\"direction\":\"toUser\",\"text\":\"txtMessage\"}]}]},{\"contentCategory\":\"loyaltyProgramPointsPrizes\",\"examples\":[{\"messages\":[{\"direction\":\"toUser\",\"text\":\"txtMessage\"}]}]}]},\"trafficDetails\":{\"totalMonthlyVolume\":10000,\"monthlyAverageMessagesFromUser\":1,\"monthlyAverageMessagesToUser\":3,\"isSpiky\":true,\"spikeDetails\":\"Higher traffic expected around major shopping holidays, most notably Black Friday and Memorial Day.\"}},{\"id\":\"00000000-0000-0000-0000-000000000000\",\"status\":\"draft\",\"reviewNotes\":[],\"costs\":[{\"amount\":650.0,\"currencyCode\":\"USD\",\"billingFrequency\":\"once\"},{\"amount\":1000.0,\"currencyCode\":\"USD\",\"billingFrequency\":\"monthly\"}],\"statusUpdatedDate\":\"2021-11-04T22:54:05.1182784+00:00\",\"programDetails\":{\"isVanity\":false,\"numberType\":\"shortCode\",\"isPoliticalCampaign\":false,\"name\":\"Contoso Loyalty Program\",\"description\":\"TEST UPDATE\",\"url\":\"https://endpoint/loyalty-program\",\"signUpTypes\":[\"sms\",\"website\"],\"signUpUrl\":\"https://contoso.com/sign-up\",\"termsOfServiceUrl\":\"https://contoso.com/terms\",\"privacyPolicyUrl\":\"https://contoso.com/privacy\"},\"companyInformation\":{\"name\":\"Contoso\",\"url\":\"https://contoso.com\",\"address\":\"1 Contoso Way Redmond, WA 98052\",\"contactInformation\":{\"name\":\"Alex\",\"phone\":\"+14255551234\",\"email\":\"alex@contoso.com\"},\"customerCareInformation\":{\"tollFreeNumber\":\"+18005551234\",\"email\":\"customercare@contoso.com\"}},\"messageDetails\":{\"supportedProtocols\":[\"sms\"],\"recurrence\":\"subscription\",\"helpMessage\":\"Help Message\",\"optOutMessage\":\"OUT\",\"optInMessage\":\"Someone requested to subscribe this number to receive updates about Contoso's loyalty program. To confirm subscription, reply to this message with 'JOIN'\",\"optInReply\":\"JOIN\",\"confirmationMessage\":\"Congrats, you have been successfully subscribed to loyalty program updates. Welcome!\",\"directionality\":\"twoWay\",\"useCases\":[{\"contentCategory\":\"coupons\",\"examples\":[{\"messages\":[{\"direction\":\"fromUser\",\"text\":\"txtMessage\"}]}]},{\"contentCategory\":\"loyaltyProgram\",\"examples\":[{\"messages\":[{\"direction\":\"toUser\",\"text\":\"txtMessage\"}]}]},{\"contentCategory\":\"loyaltyProgramPointsPrizes\",\"examples\":[{\"messages\":[{\"direction\":\"toUser\",\"text\":\"txtMessage\"}]}]}]},\"trafficDetails\":{\"totalMonthlyVolume\":10000,\"monthlyAverageMessagesFromUser\":1,\"monthlyAverageMessagesToUser\":3,\"isSpiky\":true,\"spikeDetails\":\"Higher traffic expected around major shopping holidays, most notably Black Friday and Memorial Day.\"}}]}", + "response": "{\"shortCodes\":[]}", "responseHeaders": { "api-supported-versions": "2021-10-25-preview", "content-type": "application/json; charset=utf-8", - "date": "Thu, 04 Nov 2021 22:54:08 GMT", - "ms-cv": "KihOMQRkAE+ixj7SbXzhFA.0", + "date": "Mon, 15 Nov 2021 22:40:34 GMT", + "ms-cv": "+674kVjwPES0vEbm6uOHag.0", "request-context": "appId=", - "x-azure-ref": "0kGSEYQAAAABJExzzPkNaSaIP+8NFIIIBTUlBMzAxMDAwMTA5MDQ5ADlmYzdiNTE5LWE4Y2MtNGY4OS05MzVlLWM5MTQ4YWUwOWU4MQ==", + "x-azure-ref": "04uGSYQAAAAC21OB5ieczR6VA/3Fnn9LRV1NURURHRTA4MTQAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", "x-cache": "CONFIG_NOCACHE", - "x-processing-time": "1612ms" + "x-processing-time": "384ms" } } ], @@ -26,5 +26,5 @@ "uniqueName": {}, "newDate": {} }, - "hash": "628c6c7035af7c2bed6e0c0809e8b13b" + "hash": "09d87905de946cf74582e07adbf6234b" } \ No newline at end of file diff --git a/sdk/communication/communication-short-codes/recordings/node/shortcodesclient__creates_gets_updates_lists_and_deletes_us_program_brief/recording_can_create_get_update_list_and_delete_a_us_program_brief.js b/sdk/communication/communication-short-codes/recordings/node/shortcodesclient__creates_gets_updates_lists_and_deletes_us_program_brief/recording_can_create_get_update_list_and_delete_a_us_program_brief.js new file mode 100644 index 000000000000..b5eb16a1db07 --- /dev/null +++ b/sdk/communication/communication-short-codes/recordings/node/shortcodesclient__creates_gets_updates_lists_and_deletes_us_program_brief/recording_can_create_get_update_list_and_delete_a_us_program_brief.js @@ -0,0 +1,211 @@ +let nock = require('nock'); + +module.exports.hash = "4d852ec321ad8daf08cbb2381a510539"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} + +nock('https://endpoint', {"encodedQueryParams":true}) + .get('/shortCodes/countries/US/programBriefs/00000000-0000-0000-0000-000000000000') + .query(true) + .reply(404, {"error":{"code":"NotFound","message":"Could not find the ProgramBrief with key 'Azure|00000000-0000-0000-0000-000000000000|00000000-0000-0000-0000-000000000000'"}}, [ + 'Date', + 'Mon, 15 Nov 2021 22:40:07 GMT', + 'Content-Type', + 'application/json', + 'Transfer-Encoding', + 'chunked', + 'Connection', + 'keep-alive', + 'Request-Context', + 'appId=', + 'MS-CV', + 'cnge6RMf20yD8hGYK0Jxdw.0', + 'api-supported-versions', + '2021-10-25-preview', + 'X-Processing-Time', + '237ms', + 'x-azure-ref', + '20211115T224007Z-6gfrwk89mp1791236q2316qve40000000fp000000000854p', + 'X-Cache', + 'CONFIG_NOCACHE' +]); + +nock('https://endpoint', {"encodedQueryParams":true}) + .patch('/shortCodes/countries/US/programBriefs/00000000-0000-0000-0000-000000000000', {"id":"00000000-0000-0000-0000-000000000000","programDetails":{"isVanity":false,"numberType":"shortCode","isPoliticalCampaign":false,"name":"Contoso Loyalty Program","description":"TEST Customers can sign up to receive regular updates on coupons and other perks of our loyalty program.","url":"https://endpoint/loyalty-program","signUpTypes":["sms","website"],"signUpUrl":"https://contoso.com/sign-up","termsOfServiceUrl":"https://contoso.com/terms","privacyPolicyUrl":"https://contoso.com/privacy"},"companyInformation":{"name":"Contoso","url":"https://contoso.com","address":"1 Contoso Way Redmond, WA 98052","contactInformation":{"name":"Alex","phone":"+14255551234","email":"alex@contoso.com"},"customerCareInformation":{"tollFreeNumber":"+18005551234","email":"customercare@contoso.com"}},"messageDetails":{"supportedProtocols":["sms"],"recurrence":"subscription","helpMessage":"Send 'Stop' to unsubscribe, send 'Start' to resubscribe.","optOutMessage":"You've been unsubscribed from these messages. Send 'Start' if you want to resubscribe.","optInMessage":"Someone requested to subscribe this number to receive updates about Contoso's loyalty program. To confirm subscription, reply to this message with 'JOIN'","optInReply":"JOIN","confirmationMessage":"Congrats, you have been successfully subscribed to loyalty program updates. Welcome!","directionality":"twoWay","useCases":[{"contentCategory":"coupons","examples":[{"messages":[{"direction":"fromUser","text":"txtMessage"}]}]},{"contentCategory":"loyaltyProgram","examples":[{"messages":[{"direction":"toUser","text":"txtMessage"}]}]},{"contentCategory":"loyaltyProgramPointsPrizes","examples":[{"messages":[{"direction":"toUser","text":"txtMessage"}]}]}]},"trafficDetails":{"totalMonthlyVolume":10000,"monthlyAverageMessagesFromUser":1,"monthlyAverageMessagesToUser":3,"isSpiky":true,"spikeDetails":"Higher traffic expected around major shopping holidays, most notably Black Friday and Memorial Day.","estimatedRampUpTimeInDays":0}}) + .query(true) + .reply(201, {"id":"00000000-0000-0000-0000-000000000000","status":"draft","reviewNotes":[],"costs":[{"amount":650,"currencyCode":"USD","billingFrequency":"once"},{"amount":1000,"currencyCode":"USD","billingFrequency":"monthly"}],"statusUpdatedDate":"2021-11-15T22:40:19.3355182+00:00","programDetails":{"isVanity":false,"numberType":"shortCode","isPoliticalCampaign":false,"name":"Contoso Loyalty Program","description":"TEST Customers can sign up to receive regular updates on coupons and other perks of our loyalty program.","url":"https://endpoint/loyalty-program","signUpTypes":["sms","website"],"signUpUrl":"https://contoso.com/sign-up","termsOfServiceUrl":"https://contoso.com/terms","privacyPolicyUrl":"https://contoso.com/privacy"},"companyInformation":{"name":"Contoso","url":"https://contoso.com","address":"1 Contoso Way Redmond, WA 98052","contactInformation":{"name":"Alex","phone":"+14255551234","email":"alex@contoso.com"},"customerCareInformation":{"tollFreeNumber":"+18005551234","email":"customercare@contoso.com"}},"messageDetails":{"supportedProtocols":["sms"],"recurrence":"subscription","helpMessage":"Send 'Stop' to unsubscribe, send 'Start' to resubscribe.","optOutMessage":"You've been unsubscribed from these messages. Send 'Start' if you want to resubscribe.","optInMessage":"Someone requested to subscribe this number to receive updates about Contoso's loyalty program. To confirm subscription, reply to this message with 'JOIN'","optInReply":"JOIN","confirmationMessage":"Congrats, you have been successfully subscribed to loyalty program updates. Welcome!","directionality":"twoWay","useCases":[{"contentCategory":"coupons","examples":[{"messages":[{"direction":"fromUser","text":"txtMessage"}]}]},{"contentCategory":"loyaltyProgram","examples":[{"messages":[{"direction":"toUser","text":"txtMessage"}]}]},{"contentCategory":"loyaltyProgramPointsPrizes","examples":[{"messages":[{"direction":"toUser","text":"txtMessage"}]}]}]},"trafficDetails":{"totalMonthlyVolume":10000,"monthlyAverageMessagesFromUser":1,"monthlyAverageMessagesToUser":3,"isSpiky":true,"spikeDetails":"Higher traffic expected around major shopping holidays, most notably Black Friday and Memorial Day.","estimatedRampUpTimeInDays":0}}, [ + 'Date', + 'Mon, 15 Nov 2021 22:40:11 GMT', + 'Content-Type', + 'application/json; charset=utf-8', + 'Transfer-Encoding', + 'chunked', + 'Connection', + 'keep-alive', + 'Location', + 'https://smstestapp.communication.azure.com/shortCodes/countries/US/programBriefs/00000000-0000-0000-0000-000000000000', + 'Request-Context', + 'appId=', + 'MS-CV', + 'A6fW2ZU8eUu6bcyeO+/OrA.0', + 'api-supported-versions', + '2021-10-25-preview', + 'X-Processing-Time', + '2828ms', + 'x-azure-ref', + '20211115T224008Z-6gfrwk89mp1791236q2316qve40000000fp00000000085az', + 'X-Cache', + 'CONFIG_NOCACHE' +]); + +nock('https://endpoint', {"encodedQueryParams":true}) + .get('/shortCodes/countries/US/programBriefs/00000000-0000-0000-0000-000000000000') + .query(true) + .reply(200, {"id":"00000000-0000-0000-0000-000000000000","status":"draft","reviewNotes":[],"costs":[{"amount":650,"currencyCode":"USD","billingFrequency":"once"},{"amount":1000,"currencyCode":"USD","billingFrequency":"monthly"}],"statusUpdatedDate":"2021-11-15T22:40:19.3355182+00:00","programDetails":{"isVanity":false,"numberType":"shortCode","isPoliticalCampaign":false,"name":"Contoso Loyalty Program","description":"TEST Customers can sign up to receive regular updates on coupons and other perks of our loyalty program.","url":"https://endpoint/loyalty-program","signUpTypes":["sms","website"],"signUpUrl":"https://contoso.com/sign-up","termsOfServiceUrl":"https://contoso.com/terms","privacyPolicyUrl":"https://contoso.com/privacy"},"companyInformation":{"name":"Contoso","url":"https://contoso.com","address":"1 Contoso Way Redmond, WA 98052","contactInformation":{"name":"Alex","phone":"+14255551234","email":"alex@contoso.com"},"customerCareInformation":{"tollFreeNumber":"+18005551234","email":"customercare@contoso.com"}},"messageDetails":{"supportedProtocols":["sms"],"recurrence":"subscription","helpMessage":"Send 'Stop' to unsubscribe, send 'Start' to resubscribe.","optOutMessage":"You've been unsubscribed from these messages. Send 'Start' if you want to resubscribe.","optInMessage":"Someone requested to subscribe this number to receive updates about Contoso's loyalty program. To confirm subscription, reply to this message with 'JOIN'","optInReply":"JOIN","confirmationMessage":"Congrats, you have been successfully subscribed to loyalty program updates. Welcome!","directionality":"twoWay","useCases":[{"contentCategory":"coupons","examples":[{"messages":[{"direction":"fromUser","text":"txtMessage"}]}]},{"contentCategory":"loyaltyProgram","examples":[{"messages":[{"direction":"toUser","text":"txtMessage"}]}]},{"contentCategory":"loyaltyProgramPointsPrizes","examples":[{"messages":[{"direction":"toUser","text":"txtMessage"}]}]}]},"trafficDetails":{"totalMonthlyVolume":10000,"monthlyAverageMessagesFromUser":1,"monthlyAverageMessagesToUser":3,"isSpiky":true,"spikeDetails":"Higher traffic expected around major shopping holidays, most notably Black Friday and Memorial Day.","estimatedRampUpTimeInDays":0}}, [ + 'Date', + 'Mon, 15 Nov 2021 22:40:12 GMT', + 'Content-Type', + 'application/json; charset=utf-8', + 'Transfer-Encoding', + 'chunked', + 'Connection', + 'keep-alive', + 'Request-Context', + 'appId=', + 'MS-CV', + 'KpZzGKmxjE2AUNsQoyRJLg.0', + 'api-supported-versions', + '2021-10-25-preview', + 'X-Processing-Time', + '1485ms', + 'x-azure-ref', + '20211115T224011Z-6gfrwk89mp1791236q2316qve40000000fp00000000085zz', + 'X-Cache', + 'CONFIG_NOCACHE' +]); + +nock('https://endpoint', {"encodedQueryParams":true}) + .patch('/shortCodes/countries/US/programBriefs/00000000-0000-0000-0000-000000000000', {"id":"00000000-0000-0000-0000-000000000000","programDetails":{"signUpUrl":"https://endpoint/updated-sign-up","termsOfServiceUrl":"https://endpoint/updated-terms","privacyPolicyUrl":"https://endpoint/updated-privacy"}}) + .query(true) + .reply(200, {"id":"00000000-0000-0000-0000-000000000000","status":"draft","reviewNotes":[],"costs":[{"amount":650,"currencyCode":"USD","billingFrequency":"once"},{"amount":1000,"currencyCode":"USD","billingFrequency":"monthly"}],"statusUpdatedDate":"2021-11-15T22:40:19.3355182+00:00","programDetails":{"isVanity":false,"numberType":"shortCode","isPoliticalCampaign":false,"name":"Contoso Loyalty Program","description":"TEST Customers can sign up to receive regular updates on coupons and other perks of our loyalty program.","url":"https://endpoint/loyalty-program","signUpTypes":["sms","website"],"signUpUrl":"https://endpoint/updated-sign-up","termsOfServiceUrl":"https://endpoint/updated-terms","privacyPolicyUrl":"https://endpoint/updated-privacy"},"companyInformation":{"name":"Contoso","url":"https://contoso.com","address":"1 Contoso Way Redmond, WA 98052","contactInformation":{"name":"Alex","phone":"+14255551234","email":"alex@contoso.com"},"customerCareInformation":{"tollFreeNumber":"+18005551234","email":"customercare@contoso.com"}},"messageDetails":{"supportedProtocols":["sms"],"recurrence":"subscription","helpMessage":"Send 'Stop' to unsubscribe, send 'Start' to resubscribe.","optOutMessage":"You've been unsubscribed from these messages. Send 'Start' if you want to resubscribe.","optInMessage":"Someone requested to subscribe this number to receive updates about Contoso's loyalty program. To confirm subscription, reply to this message with 'JOIN'","optInReply":"JOIN","confirmationMessage":"Congrats, you have been successfully subscribed to loyalty program updates. Welcome!","directionality":"twoWay","useCases":[{"contentCategory":"coupons","examples":[{"messages":[{"direction":"fromUser","text":"txtMessage"}]}]},{"contentCategory":"loyaltyProgram","examples":[{"messages":[{"direction":"toUser","text":"txtMessage"}]}]},{"contentCategory":"loyaltyProgramPointsPrizes","examples":[{"messages":[{"direction":"toUser","text":"txtMessage"}]}]}]},"trafficDetails":{"totalMonthlyVolume":10000,"monthlyAverageMessagesFromUser":1,"monthlyAverageMessagesToUser":3,"isSpiky":true,"spikeDetails":"Higher traffic expected around major shopping holidays, most notably Black Friday and Memorial Day.","estimatedRampUpTimeInDays":0}}, [ + 'Date', + 'Mon, 15 Nov 2021 22:40:14 GMT', + 'Content-Type', + 'application/json; charset=utf-8', + 'Transfer-Encoding', + 'chunked', + 'Connection', + 'keep-alive', + 'Request-Context', + 'appId=', + 'MS-CV', + 'tL136UZtE0C7+i2hq5mR9w.0', + 'api-supported-versions', + '2021-10-25-preview', + 'X-Processing-Time', + '1942ms', + 'x-azure-ref', + '20211115T224012Z-6gfrwk89mp1791236q2316qve40000000fp00000000086d2', + 'X-Cache', + 'CONFIG_NOCACHE' +]); + +nock('https://endpoint', {"encodedQueryParams":true}) + .get('/shortCodes/countries/US/programBriefs/00000000-0000-0000-0000-000000000000') + .query(true) + .reply(200, {"id":"00000000-0000-0000-0000-000000000000","status":"draft","reviewNotes":[],"costs":[{"amount":650,"currencyCode":"USD","billingFrequency":"once"},{"amount":1000,"currencyCode":"USD","billingFrequency":"monthly"}],"statusUpdatedDate":"2021-11-15T22:40:19.3355182+00:00","programDetails":{"isVanity":false,"numberType":"shortCode","isPoliticalCampaign":false,"name":"Contoso Loyalty Program","description":"TEST Customers can sign up to receive regular updates on coupons and other perks of our loyalty program.","url":"https://endpoint/loyalty-program","signUpTypes":["sms","website"],"signUpUrl":"https://endpoint/updated-sign-up","termsOfServiceUrl":"https://endpoint/updated-terms","privacyPolicyUrl":"https://endpoint/updated-privacy"},"companyInformation":{"name":"Contoso","url":"https://contoso.com","address":"1 Contoso Way Redmond, WA 98052","contactInformation":{"name":"Alex","phone":"+14255551234","email":"alex@contoso.com"},"customerCareInformation":{"tollFreeNumber":"+18005551234","email":"customercare@contoso.com"}},"messageDetails":{"supportedProtocols":["sms"],"recurrence":"subscription","helpMessage":"Send 'Stop' to unsubscribe, send 'Start' to resubscribe.","optOutMessage":"You've been unsubscribed from these messages. Send 'Start' if you want to resubscribe.","optInMessage":"Someone requested to subscribe this number to receive updates about Contoso's loyalty program. To confirm subscription, reply to this message with 'JOIN'","optInReply":"JOIN","confirmationMessage":"Congrats, you have been successfully subscribed to loyalty program updates. Welcome!","directionality":"twoWay","useCases":[{"contentCategory":"coupons","examples":[{"messages":[{"direction":"fromUser","text":"txtMessage"}]}]},{"contentCategory":"loyaltyProgram","examples":[{"messages":[{"direction":"toUser","text":"txtMessage"}]}]},{"contentCategory":"loyaltyProgramPointsPrizes","examples":[{"messages":[{"direction":"toUser","text":"txtMessage"}]}]}]},"trafficDetails":{"totalMonthlyVolume":10000,"monthlyAverageMessagesFromUser":1,"monthlyAverageMessagesToUser":3,"isSpiky":true,"spikeDetails":"Higher traffic expected around major shopping holidays, most notably Black Friday and Memorial Day.","estimatedRampUpTimeInDays":0}}, [ + 'Date', + 'Mon, 15 Nov 2021 22:40:16 GMT', + 'Content-Type', + 'application/json; charset=utf-8', + 'Transfer-Encoding', + 'chunked', + 'Connection', + 'keep-alive', + 'Request-Context', + 'appId=', + 'MS-CV', + 'F+wbYVG42E+yG09ZABKVqw.0', + 'api-supported-versions', + '2021-10-25-preview', + 'X-Processing-Time', + '1673ms', + 'x-azure-ref', + '20211115T224014Z-6gfrwk89mp1791236q2316qve40000000fp00000000086x8', + 'X-Cache', + 'CONFIG_NOCACHE' +]); + +nock('https://endpoint', {"encodedQueryParams":true}) + .get('/shortCodes/countries/US/programBriefs') + .query(true) + .reply(200, {"programBriefs":[{"id":"00000000-0000-0000-0000-000000000000","status":"draft","reviewNotes":[],"costs":[{"amount":650,"currencyCode":"USD","billingFrequency":"once"},{"amount":1000,"currencyCode":"USD","billingFrequency":"monthly"}],"statusUpdatedDate":"2021-11-15T22:40:19.3355182+00:00","programDetails":{"isVanity":false,"numberType":"shortCode","isPoliticalCampaign":false,"name":"Contoso Loyalty Program","description":"TEST Customers can sign up to receive regular updates on coupons and other perks of our loyalty program.","url":"https://endpoint/loyalty-program","signUpTypes":["sms","website"],"signUpUrl":"https://endpoint/updated-sign-up","termsOfServiceUrl":"https://endpoint/updated-terms","privacyPolicyUrl":"https://endpoint/updated-privacy"},"companyInformation":{"name":"Contoso","url":"https://contoso.com","address":"1 Contoso Way Redmond, WA 98052","contactInformation":{"name":"Alex","phone":"+14255551234","email":"alex@contoso.com"},"customerCareInformation":{"tollFreeNumber":"+18005551234","email":"customercare@contoso.com"}},"messageDetails":{"supportedProtocols":["sms"],"recurrence":"subscription","helpMessage":"Send 'Stop' to unsubscribe, send 'Start' to resubscribe.","optOutMessage":"You've been unsubscribed from these messages. Send 'Start' if you want to resubscribe.","optInMessage":"Someone requested to subscribe this number to receive updates about Contoso's loyalty program. To confirm subscription, reply to this message with 'JOIN'","optInReply":"JOIN","confirmationMessage":"Congrats, you have been successfully subscribed to loyalty program updates. Welcome!","directionality":"twoWay","useCases":[{"contentCategory":"coupons","examples":[{"messages":[{"direction":"fromUser","text":"txtMessage"}]}]},{"contentCategory":"loyaltyProgram","examples":[{"messages":[{"direction":"toUser","text":"txtMessage"}]}]},{"contentCategory":"loyaltyProgramPointsPrizes","examples":[{"messages":[{"direction":"toUser","text":"txtMessage"}]}]}]},"trafficDetails":{"totalMonthlyVolume":10000,"monthlyAverageMessagesFromUser":1,"monthlyAverageMessagesToUser":3,"isSpiky":true,"spikeDetails":"Higher traffic expected around major shopping holidays, most notably Black Friday and Memorial Day.","estimatedRampUpTimeInDays":0}}]}, [ + 'Date', + 'Mon, 15 Nov 2021 22:40:18 GMT', + 'Content-Type', + 'application/json; charset=utf-8', + 'Transfer-Encoding', + 'chunked', + 'Connection', + 'keep-alive', + 'Request-Context', + 'appId=', + 'MS-CV', + 'Taga7R3XZEmV+t9kXFMfLA.0', + 'api-supported-versions', + '2021-10-25-preview', + 'X-Processing-Time', + '1649ms', + 'x-azure-ref', + '20211115T224016Z-6gfrwk89mp1791236q2316qve40000000fp00000000087bs', + 'X-Cache', + 'CONFIG_NOCACHE' +]); + +nock('https://endpoint', {"encodedQueryParams":true}) + .delete('/shortCodes/countries/US/programBriefs/00000000-0000-0000-0000-000000000000') + .query(true) + .reply(204, "", [ + 'Date', + 'Mon, 15 Nov 2021 22:40:19 GMT', + 'Connection', + 'keep-alive', + 'Request-Context', + 'appId=', + 'MS-CV', + 'zS5t0JI9xkGQ6SsYpLAwew.0', + 'api-supported-versions', + '2021-10-25-preview', + 'X-Processing-Time', + '519ms', + 'x-azure-ref', + '20211115T224018Z-6gfrwk89mp1791236q2316qve40000000fp00000000087uq', + 'X-Cache', + 'CONFIG_NOCACHE' +]); + +nock('https://endpoint', {"encodedQueryParams":true}) + .get('/shortCodes/countries/US/programBriefs/00000000-0000-0000-0000-000000000000') + .query(true) + .reply(404, {"error":{"code":"NotFound","message":"Could not find the ProgramBrief with key 'Azure|00000000-0000-0000-0000-000000000000|00000000-0000-0000-0000-000000000000'"}}, [ + 'Date', + 'Mon, 15 Nov 2021 22:40:19 GMT', + 'Content-Type', + 'application/json', + 'Transfer-Encoding', + 'chunked', + 'Connection', + 'keep-alive', + 'Request-Context', + 'appId=', + 'MS-CV', + 'JF27intjRUuVVe7QQNApZw.0', + 'api-supported-versions', + '2021-10-25-preview', + 'X-Processing-Time', + '233ms', + 'x-azure-ref', + '20211115T224019Z-6gfrwk89mp1791236q2316qve40000000fp000000000881e', + 'X-Cache', + 'CONFIG_NOCACHE' +]); diff --git a/sdk/communication/communication-short-codes/recordings/node/shortcodesclient__lists_short_codes/recording_can_list_all_acquired_short_codes.js b/sdk/communication/communication-short-codes/recordings/node/shortcodesclient__lists_short_codes/recording_can_list_all_acquired_short_codes.js index 796dc0c3af75..68b2803984b8 100644 --- a/sdk/communication/communication-short-codes/recordings/node/shortcodesclient__lists_short_codes/recording_can_list_all_acquired_short_codes.js +++ b/sdk/communication/communication-short-codes/recordings/node/shortcodesclient__lists_short_codes/recording_can_list_all_acquired_short_codes.js @@ -1,13 +1,13 @@ let nock = require('nock'); -module.exports.hash = "d4b785d0204238f71c49c5b65024d8cd"; +module.exports.hash = "cd026b9bd924e93065b201c18fbe020e"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} nock('https://endpoint', {"encodedQueryParams":true}) - .get('/shortCodes/countries/US/programBriefs') + .get('/shortCodes') .query(true) - .reply(200, {"programBriefs":[{"id":"00000000-0000-0000-0000-000000000000","status":"draft","reviewNotes":[],"costs":[{"amount":650,"currencyCode":"USD","billingFrequency":"once"},{"amount":1000,"currencyCode":"USD","billingFrequency":"monthly"}],"statusUpdatedDate":"2021-11-04T21:21:28.6423419+00:00","programDetails":{"isVanity":false,"numberType":"shortCode","isPoliticalCampaign":false,"name":"Contoso Loyalty Program","description":"TEST UPDATEThu Nov 04 2021 15:49:00 GMT-0600 (Central Standard Time)","url":"https://contoso.com/loyalty-program","signUpTypes":["sms","website"],"signUpUrl":"https://contoso.com/sign-up","termsOfServiceUrl":"https://contoso.com/terms","privacyPolicyUrl":"https://contoso.com/privacy","expectedDateOfService":"2022-02-25T06:00:00+00:00"},"companyInformation":{"name":"Contoso","url":"https://contoso.com","address":"1 Contoso Way Redmond, WA 98052","contactInformation":{"name":"Alex","phone":"+14255551234","email":"alex@contoso.com"},"customerCareInformation":{"tollFreeNumber":"+18005551234","email":"customercare@contoso.com"}},"messageDetails":{"supportedProtocols":["sms"],"recurrence":"subscription","helpMessage":"Help Message","optOutMessage":"OUT","optInMessage":"Someone requested to subscribe this number to receive updates about Contoso's loyalty program. To confirm subscription, reply to this message with 'JOIN'","optInReply":"JOIN","confirmationMessage":"Congrats, you have been successfully subscribed to loyalty program updates. Welcome!","directionality":"twoWay","useCases":[{"contentCategory":"coupons","examples":[{"messages":[{"direction":"fromUser","text":"txtMessage"}]}]},{"contentCategory":"loyaltyProgram","examples":[{"messages":[{"direction":"toUser","text":"txtMessage"}]}]},{"contentCategory":"loyaltyProgramPointsPrizes","examples":[{"messages":[{"direction":"toUser","text":"txtMessage"}]}]}]},"trafficDetails":{"totalMonthlyVolume":10000,"monthlyAverageMessagesFromUser":1,"monthlyAverageMessagesToUser":3,"isSpiky":true,"spikeDetails":"Higher traffic expected around major shopping holidays, most notably Black Friday and Memorial Day."}},{"id":"00000000-0000-0000-0000-000000000000","status":"draft","reviewNotes":[],"costs":[{"amount":650,"currencyCode":"USD","billingFrequency":"once"},{"amount":1000,"currencyCode":"USD","billingFrequency":"monthly"}],"statusUpdatedDate":"2021-11-04T22:53:48.0978151+00:00","programDetails":{"isVanity":false,"numberType":"shortCode","isPoliticalCampaign":false,"name":"Contoso Loyalty Program","description":"TEST UPDATE","url":"https://endpoint/loyalty-program","signUpTypes":["sms","website"],"signUpUrl":"https://contoso.com/sign-up","termsOfServiceUrl":"https://contoso.com/terms","privacyPolicyUrl":"https://contoso.com/privacy"},"companyInformation":{"name":"Contoso","url":"https://contoso.com","address":"1 Contoso Way Redmond, WA 98052","contactInformation":{"name":"Alex","phone":"+14255551234","email":"alex@contoso.com"},"customerCareInformation":{"tollFreeNumber":"+18005551234","email":"customercare@contoso.com"}},"messageDetails":{"supportedProtocols":["sms"],"recurrence":"subscription","helpMessage":"Help Message","optOutMessage":"OUT","optInMessage":"Someone requested to subscribe this number to receive updates about Contoso's loyalty program. To confirm subscription, reply to this message with 'JOIN'","optInReply":"JOIN","confirmationMessage":"Congrats, you have been successfully subscribed to loyalty program updates. Welcome!","directionality":"twoWay","useCases":[{"contentCategory":"coupons","examples":[{"messages":[{"direction":"fromUser","text":"txtMessage"}]}]},{"contentCategory":"loyaltyProgram","examples":[{"messages":[{"direction":"toUser","text":"txtMessage"}]}]},{"contentCategory":"loyaltyProgramPointsPrizes","examples":[{"messages":[{"direction":"toUser","text":"txtMessage"}]}]}]},"trafficDetails":{"totalMonthlyVolume":10000,"monthlyAverageMessagesFromUser":1,"monthlyAverageMessagesToUser":3,"isSpiky":true,"spikeDetails":"Higher traffic expected around major shopping holidays, most notably Black Friday and Memorial Day."}}]}, [ + .reply(200, {"shortCodes":[]}, [ 'Transfer-Encoding', 'chunked', 'Content-Type', @@ -15,15 +15,15 @@ nock('https://endpoint', {"encodedQueryParams":true}) 'Request-Context', 'appId=', 'MS-CV', - '8SFa2jF6CkCEzNeP4zgr4Q.0', + 'hM3lBNqudkGXkJIDR1letg.0', 'api-supported-versions', '2021-10-25-preview', 'X-Processing-Time', - '1698ms', + '465ms', 'X-Cache', 'CONFIG_NOCACHE', 'X-Azure-Ref', - '0fmSEYQAAAAC37qPJR6HmTrZSJeZSZ82rTUlBMzAxMDAwMTA5MDI5ADlmYzdiNTE5LWE4Y2MtNGY4OS05MzVlLWM5MTQ4YWUwOWU4MQ==', + '0z+GSYQAAAAC/7IlfQV7ORJ/vKFE/fdn9V1NURURHRTA4MTUAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx', 'Date', - 'Thu, 04 Nov 2021 22:53:52 GMT' + 'Mon, 15 Nov 2021 22:40:15 GMT' ]); diff --git a/sdk/communication/communication-short-codes/test/public/createGetDeleteUSProgramBrief.spec.ts b/sdk/communication/communication-short-codes/test/public/createGetDeleteUSProgramBrief.spec.ts deleted file mode 100644 index a52bd3585322..000000000000 --- a/sdk/communication/communication-short-codes/test/public/createGetDeleteUSProgramBrief.spec.ts +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { Recorder } from "@azure-tools/test-recorder"; -import { assert } from "chai"; -import { Context } from "mocha"; -import { ShortCodesClient, ShortCodesUpsertUSProgramBriefOptionalParams } from "../../src"; -import { createRecordedClient } from "./utils/recordedClient"; -import { getTestUSProgramBrief } from "./utils/testUSProgramBrief"; - -describe(`ShortCodesClient - creates US Program Brief using upsert`, function() { - let recorder: Recorder; - let client: ShortCodesClient; - - beforeEach(function(this: Context) { - ({ client, recorder } = createRecordedClient(this)); - }); - - afterEach(async function(this: Context) { - if (!this.currentTest?.isPending()) { - await recorder.stop(); - } - }); - - it("can create, get and delete a US Program Brief", async function() { - const uspb = getTestUSProgramBrief(); - const programBriefRequest: ShortCodesUpsertUSProgramBriefOptionalParams = { - body: uspb - }; - - const submitRes = await client.upsertUSProgramBrief(uspb.id, programBriefRequest); - console.log(submitRes._response.parsedBody["id"]); - assert.isOk(submitRes); - - const { id } = await client.getUSProgramBrief(uspb.id); - assert.strictEqual(uspb.id, id); - - const delRes = await client.deleteUSProgramBrief(id); - assert.isOk(delRes); - }).timeout(15000); -}); diff --git a/sdk/communication/communication-short-codes/test/public/createUpdateUSProgramBrief.spec.ts b/sdk/communication/communication-short-codes/test/public/createUpdateUSProgramBrief.spec.ts deleted file mode 100644 index 8e1f4314e670..000000000000 --- a/sdk/communication/communication-short-codes/test/public/createUpdateUSProgramBrief.spec.ts +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { Recorder } from "@azure-tools/test-recorder"; -import { assert } from "chai"; -import { Context } from "mocha"; -import { ShortCodesClient, ShortCodesUpsertUSProgramBriefOptionalParams } from "../../src"; -import { createRecordedClient } from "./utils/recordedClient"; -import { getTestUSProgramBrief } from "./utils/testUSProgramBrief"; - -describe(`ShortCodesClient - updates US Program Brief using upsert`, function() { - let recorder: Recorder; - let client: ShortCodesClient; - - beforeEach(function(this: Context) { - ({ client, recorder } = createRecordedClient(this)); - }); - - afterEach(async function(this: Context) { - if (!this.currentTest?.isPending()) { - await recorder.stop(); - } - }); - - it("can create and update a US Program Brief", async function() { - const uspb = getTestUSProgramBrief(); - const programBriefRequest: ShortCodesUpsertUSProgramBriefOptionalParams = { - body: uspb - }; - const submitRes = await client.upsertUSProgramBrief(uspb.id, programBriefRequest); - assert.isOk(submitRes); - - uspb.programDetails!.description = "TEST UPDATE"; - programBriefRequest.body = uspb; - - const updateRes = await client.upsertUSProgramBrief(uspb.id, programBriefRequest); - - assert.isOk(updateRes); - assert.equal( - updateRes._response.parsedBody.programDetails.description, - uspb.programDetails?.description - ); - }).timeout(15000); -}); diff --git a/sdk/communication/communication-short-codes/test/public/listShortCodes.spec.ts b/sdk/communication/communication-short-codes/test/public/listShortCodes.spec.ts index 8b6f68151b9d..626dc9eba268 100644 --- a/sdk/communication/communication-short-codes/test/public/listShortCodes.spec.ts +++ b/sdk/communication/communication-short-codes/test/public/listShortCodes.spec.ts @@ -22,8 +22,7 @@ describe(`ShortCodesClient - lists Short Codes`, function() { }); it("can list all acquired short codes", async function() { - for await (const shortCode of client.listUSProgramBriefs()) { - assert.isString(shortCode.id); + for await (const shortCode of client.listShortCodes()) { assert.isNotNull(shortCode.number); } }).timeout(10000); diff --git a/sdk/communication/communication-short-codes/test/public/listUSProgramBrief.spec.ts b/sdk/communication/communication-short-codes/test/public/listUSProgramBrief.spec.ts deleted file mode 100644 index 793af0a171ed..000000000000 --- a/sdk/communication/communication-short-codes/test/public/listUSProgramBrief.spec.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { Recorder } from "@azure-tools/test-recorder"; -import { assert } from "chai"; -import { Context } from "mocha"; -import { ShortCodesClient } from "../../src"; -import { createRecordedClient } from "./utils/recordedClient"; - -describe(`ShortCodesClient - lists US Program Brief`, function() { - let recorder: Recorder; - let client: ShortCodesClient; - - beforeEach(function(this: Context) { - ({ client, recorder } = createRecordedClient(this)); - }); - - afterEach(async function(this: Context) { - if (!this.currentTest?.isPending()) { - await recorder.stop(); - } - }); - - it("can list all US Program Briefs", async function() { - for await (const programBrief of client.listUSProgramBriefs()) { - assert.isString(programBrief.id); - } - }).timeout(10000); -}); diff --git a/sdk/communication/communication-short-codes/test/public/manageUSProgramBriefs.spec.ts b/sdk/communication/communication-short-codes/test/public/manageUSProgramBriefs.spec.ts new file mode 100644 index 000000000000..5c76dd03361e --- /dev/null +++ b/sdk/communication/communication-short-codes/test/public/manageUSProgramBriefs.spec.ts @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { Recorder } from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; +import { ShortCodesClient, ShortCodesUpsertUSProgramBriefOptionalParams } from "../../src"; +import { createRecordedClient } from "./utils/recordedClient"; +import { + assertEditableFieldsAreEqual, + doesProgramBriefExist, + getTestUSProgramBrief +} from "./utils/testUSProgramBrief"; + +describe(`ShortCodesClient - creates, gets, updates, lists, and deletes US Program Brief`, function() { + let recorder: Recorder; + let client: ShortCodesClient; + + beforeEach(function(this: Context) { + ({ client, recorder } = createRecordedClient(this)); + }); + + afterEach(async function(this: Context) { + if (!this.currentTest?.isPending()) { + await recorder.stop(); + } + }); + + it("can create, get, update, list, and delete a US Program Brief", async function() { + const uspb = getTestUSProgramBrief(); + const createRequest: ShortCodesUpsertUSProgramBriefOptionalParams = { + body: uspb + }; + const updateRequest: ShortCodesUpsertUSProgramBriefOptionalParams = { + body: { + id: uspb.id, + programDetails: { + signUpUrl: "https://endpoint/updated-sign-up", + privacyPolicyUrl: "https://endpoint/updated-privacy", + termsOfServiceUrl: "https://endpoint/updated-terms" + } + } + }; + + // before test begins, make sure program brief does not exist, clean up if necessary + if (await doesProgramBriefExist(client, uspb.id)) { + console.warn( + "Program brief should not exist, it has not yet been created. Cleaning up program brief." + ); + await client.deleteUSProgramBrief(uspb.id); + if (await doesProgramBriefExist(client, uspb.id)) { + assert.fail("Program brief should not exist, and could not be deleted"); + } + } + + // create program brief by calling upsert + const submitResult = await client.upsertUSProgramBrief(uspb.id, createRequest); + assert.isOk(submitResult, "Failed to create program brief"); + assert.equal( + uspb.id, + submitResult._response.parsedBody["id"], + "Program brief creation returned the wrong Id" + ); + + // get program brief, verify it was created correctly + let getRes = await client.getUSProgramBrief(uspb.id); + assertEditableFieldsAreEqual(uspb, getRes, "get after initial create"); + + // update program brief by calling upsert + if (uspb.programDetails) { + uspb.programDetails.signUpUrl = updateRequest.body?.programDetails?.signUpUrl; + uspb.programDetails.privacyPolicyUrl = updateRequest.body?.programDetails?.privacyPolicyUrl; + uspb.programDetails.termsOfServiceUrl = updateRequest.body?.programDetails?.termsOfServiceUrl; + } + + const updateResult = await client.upsertUSProgramBrief(uspb.id, updateRequest); + assert.isOk(updateResult, "Update program brief failed"); + assert.equal( + uspb.id, + updateResult._response.parsedBody["id"], + "Update program brief returned the wrong Id" + ); + + // get program brief, verify it was updated correctly + getRes = await client.getUSProgramBrief(uspb.id); + assertEditableFieldsAreEqual(uspb, getRes, "get after update"); + + // list program briefs, validate test program brief is in the list + let foundTestProgramBrief = false; + for await (const pb of client.listUSProgramBriefs()) { + if (pb.id === uspb.id) { + foundTestProgramBrief = true; + assertEditableFieldsAreEqual(uspb, pb, "list all program briefs"); + } + } + assert.isTrue( + foundTestProgramBrief, + "Test program brief was not returned in list of all program briefs" + ); + + // delete program brief, ensure it was removed + const delRes = await client.deleteUSProgramBrief(uspb.id); + assert.isOk(delRes, "Deleting program brief failed"); + assert.isFalse( + await doesProgramBriefExist(client, uspb.id), + "Delete program brief was unsuccessful, program brief is still returned" + ); + }).timeout(15000); +}); diff --git a/sdk/communication/communication-short-codes/test/public/utils/testUSProgramBrief.ts b/sdk/communication/communication-short-codes/test/public/utils/testUSProgramBrief.ts index be94d2d97b00..79c009970340 100644 --- a/sdk/communication/communication-short-codes/test/public/utils/testUSProgramBrief.ts +++ b/sdk/communication/communication-short-codes/test/public/utils/testUSProgramBrief.ts @@ -1,7 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +import { RestError } from "@azure/core-http"; +import { assert } from "chai"; import { USProgramBrief } from "../../../src"; +import { ShortCodesClient } from "../../../src"; export function getTestUSProgramBrief(): USProgramBrief { const testUSProgramBrief: USProgramBrief = { @@ -56,10 +59,12 @@ export function getTestUSProgramBrief(): USProgramBrief { confirmationMessage: "Congrats, you have been successfully subscribed to loyalty program updates. Welcome!", directionality: "twoWay", - helpMessage: "Help Message", - optOutMessage: "OUT" + helpMessage: "Send 'Stop' to unsubscribe, send 'Start' to resubscribe.", + optOutMessage: + "You've been unsubscribed from these messages. Send 'Start' if you want to resubscribe." }, trafficDetails: { + estimatedRampUpTimeInDays: 0, totalMonthlyVolume: 10000, monthlyAverageMessagesFromUser: 1, monthlyAverageMessagesToUser: 3, @@ -71,3 +76,51 @@ export function getTestUSProgramBrief(): USProgramBrief { return testUSProgramBrief; } + +export function assertEditableFieldsAreEqual( + expected: USProgramBrief, + actual: USProgramBrief, + messageContext: string +): void { + assert.equal(expected.id, actual.id, `Program brief Id is incorrect - ${messageContext}`); + assert.deepEqual( + expected.programDetails, + actual.programDetails, + `Program Details do not match - ${messageContext}` + ); + assert.deepEqual( + expected.companyInformation, + actual.companyInformation, + `Company Information does not match - ${messageContext}` + ); + assert.deepEqual( + expected.messageDetails, + actual.messageDetails, + `Message Details do not match - ${messageContext}` + ); + assert.deepEqual( + expected.trafficDetails, + actual.trafficDetails, + `Traffic Details do not match - ${messageContext}` + ); +} + +export async function doesProgramBriefExist( + client: ShortCodesClient, + id: string +): Promise { + try { + const programBrief = await client.getUSProgramBrief(id); + if (programBrief.id === id) { + return true; + } else { + return false; + } + } catch (e) { + const error = e as RestError; + if (error.statusCode === 404) { + return false; + } + throw e; + } +}