diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index b04d701dd93c..6c7805399925 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -256,6 +256,7 @@ com.azure.spring:spring-cloud-azure-stream-binder-servicebus-core;5.22.0;5.23.0- com.azure.spring:spring-cloud-azure-stream-binder-servicebus;5.22.0;5.23.0-beta.1 com.azure.spring:spring-cloud-azure-testcontainers;5.22.0;5.23.0-beta.1 com.azure:azure-spring-data-cosmos;5.22.0;5.23.0-beta.1 +com.azure:azure-communication-programmableconnectivity;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager;2.50.0;2.51.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-appplatform;2.50.0;2.51.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-appservice;2.50.0;2.51.0-beta.1 diff --git a/sdk/communication/azure-communication-programmableconnectivity/CHANGELOG.md b/sdk/communication/azure-communication-programmableconnectivity/CHANGELOG.md new file mode 100644 index 000000000000..5d5c6eb80d3b --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/CHANGELOG.md @@ -0,0 +1,16 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +- Azure ProgrammableConnectivity client library for Java. This package contains Microsoft Azure ProgrammableConnectivity client library. + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes +### Features Added + +- Initial release for the azure-communication-programmableconnectivity Java SDK. diff --git a/sdk/communication/azure-communication-programmableconnectivity/README.md b/sdk/communication/azure-communication-programmableconnectivity/README.md new file mode 100644 index 000000000000..2a9569bf616f --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/README.md @@ -0,0 +1,78 @@ +# Azure ProgrammableConnectivity client library for Java + +Azure ProgrammableConnectivity client library for Java. + +This package contains Microsoft Azure ProgrammableConnectivity client library. + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] +- [Product documentation][product_documentation] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure:azure-communication-programmableconnectivity;current}) +```xml + + com.azure + azure-communication-programmableconnectivity + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Authentication + +[Azure Identity][azure_identity] package provides the default implementation for authenticating the client. + +## Key concepts + +## Examples + +```java com.azure.communication.programmableconnectivity.readme +``` + +### Service API versions + +The client library targets the latest service API version by default. +The service client builder accepts an optional service API version parameter to specify which API version to communicate. + +#### Select a service API version + +You have the flexibility to explicitly select a supported service API version when initializing a service client via the service client builder. +This ensures that the client can communicate with services using the specified API version. + +When selecting an API version, it is important to verify that there are no breaking changes compared to the latest API version. +If there are significant differences, API calls may fail due to incompatibility. + +Always ensure that the chosen API version is fully supported and operational for your specific use case and that it aligns with the service's versioning policy. + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[product_documentation]: https://azure.microsoft.com/services/ +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity diff --git a/sdk/communication/azure-communication-programmableconnectivity/assets.json b/sdk/communication/azure-communication-programmableconnectivity/assets.json new file mode 100644 index 000000000000..95367679c344 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/assets.json @@ -0,0 +1 @@ +{"AssetsRepo":"Azure/azure-sdk-assets","AssetsRepoPrefixPath":"java","TagPrefix":"java/communication/azure-communication-programmableconnectivity","Tag":""} \ No newline at end of file diff --git a/sdk/communication/azure-communication-programmableconnectivity/pom.xml b/sdk/communication/azure-communication-programmableconnectivity/pom.xml new file mode 100644 index 000000000000..905e17bc4b77 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/pom.xml @@ -0,0 +1,71 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure + azure-communication-programmableconnectivity + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for ProgrammableConnectivity + This package contains Microsoft Azure ProgrammableConnectivity client library. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + com.azure + azure-core + 1.55.3 + + + com.azure + azure-core-http-netty + 1.15.11 + + + com.azure + azure-core-test + 1.27.0-beta.8 + test + + + com.azure + azure-identity + 1.15.4 + test + + + diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/DeviceLocationAsyncClient.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/DeviceLocationAsyncClient.java new file mode 100644 index 000000000000..366c5c8c40fb --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/DeviceLocationAsyncClient.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity; + +import com.azure.communication.programmableconnectivity.implementation.DeviceLocationsImpl; +import com.azure.communication.programmableconnectivity.models.DeviceLocationVerificationContent; +import com.azure.communication.programmableconnectivity.models.DeviceLocationVerificationResult; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ProgrammableConnectivityClient type. + */ +@ServiceClient(builder = ProgrammableConnectivityClientBuilder.class, isAsync = true) +public final class DeviceLocationAsyncClient { + @Generated + private final DeviceLocationsImpl serviceClient; + + /** + * Initializes an instance of DeviceLocationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DeviceLocationAsyncClient(DeviceLocationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Verifies whether a device is within a specified location area, defined as an accuracy (radius) around a point, + * specified by longitude and latitude. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     networkIdentifier (Required): {
+     *         identifierType: String (Required)
+     *         identifier: String (Required)
+     *     }
+     *     latitude: double (Required)
+     *     longitude: double (Required)
+     *     accuracy: int (Required)
+     *     device (Required): {
+     *         networkAccessIdentifier: String (Optional)
+     *         phoneNumber: String (Optional)
+     *         ipv4Address (Optional): {
+     *             ipv4: String (Required)
+     *             port: int (Required)
+     *         }
+     *         ipv6Address (Optional): {
+     *             ipv6: String (Required)
+     *             port: int (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     verificationResult: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response verifying location along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> verifyWithResponse(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.verifyWithResponseAsync(apcGatewayId, body, requestOptions); + } + + /** + * Verifies whether a device is within a specified location area, defined as an accuracy (radius) around a point, + * specified by longitude and latitude. + * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response verifying location on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono verify(String apcGatewayId, DeviceLocationVerificationContent body) { + // Generated convenience method for verifyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return verifyWithResponse(apcGatewayId, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DeviceLocationVerificationResult.class)); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/DeviceLocationClient.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/DeviceLocationClient.java new file mode 100644 index 000000000000..9e10c246148f --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/DeviceLocationClient.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity; + +import com.azure.communication.programmableconnectivity.implementation.DeviceLocationsImpl; +import com.azure.communication.programmableconnectivity.models.DeviceLocationVerificationContent; +import com.azure.communication.programmableconnectivity.models.DeviceLocationVerificationResult; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous ProgrammableConnectivityClient type. + */ +@ServiceClient(builder = ProgrammableConnectivityClientBuilder.class) +public final class DeviceLocationClient { + @Generated + private final DeviceLocationsImpl serviceClient; + + /** + * Initializes an instance of DeviceLocationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DeviceLocationClient(DeviceLocationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Verifies whether a device is within a specified location area, defined as an accuracy (radius) around a point, + * specified by longitude and latitude. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     networkIdentifier (Required): {
+     *         identifierType: String (Required)
+     *         identifier: String (Required)
+     *     }
+     *     latitude: double (Required)
+     *     longitude: double (Required)
+     *     accuracy: int (Required)
+     *     device (Required): {
+     *         networkAccessIdentifier: String (Optional)
+     *         phoneNumber: String (Optional)
+     *         ipv4Address (Optional): {
+     *             ipv4: String (Required)
+     *             port: int (Required)
+     *         }
+     *         ipv6Address (Optional): {
+     *             ipv6: String (Required)
+     *             port: int (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     verificationResult: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response verifying location along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response verifyWithResponse(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.verifyWithResponse(apcGatewayId, body, requestOptions); + } + + /** + * Verifies whether a device is within a specified location area, defined as an accuracy (radius) around a point, + * specified by longitude and latitude. + * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response verifying location. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DeviceLocationVerificationResult verify(String apcGatewayId, DeviceLocationVerificationContent body) { + // Generated convenience method for verifyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return verifyWithResponse(apcGatewayId, BinaryData.fromObject(body), requestOptions).getValue() + .toObject(DeviceLocationVerificationResult.class); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/DeviceNetworkAsyncClient.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/DeviceNetworkAsyncClient.java new file mode 100644 index 000000000000..8642b6bbc0e4 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/DeviceNetworkAsyncClient.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity; + +import com.azure.communication.programmableconnectivity.implementation.DeviceNetworksImpl; +import com.azure.communication.programmableconnectivity.models.NetworkIdentifier; +import com.azure.communication.programmableconnectivity.models.NetworkRetrievalResult; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ProgrammableConnectivityClient type. + */ +@ServiceClient(builder = ProgrammableConnectivityClientBuilder.class, isAsync = true) +public final class DeviceNetworkAsyncClient { + @Generated + private final DeviceNetworksImpl serviceClient; + + /** + * Initializes an instance of DeviceNetworkAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DeviceNetworkAsyncClient(DeviceNetworksImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Retrieves the network a given device is on. Returns network in a networkCode format that can be used for other + * APIs. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     identifierType: String (Required)
+     *     identifier: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     networkCode: String (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the network that the device is on along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> retrieveWithResponse(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.retrieveWithResponseAsync(apcGatewayId, body, requestOptions); + } + + /** + * Retrieves the network a given device is on. Returns network in a networkCode format that can be used for other + * APIs. + * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the network that the device is on on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono retrieve(String apcGatewayId, NetworkIdentifier body) { + // Generated convenience method for retrieveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return retrieveWithResponse(apcGatewayId, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(NetworkRetrievalResult.class)); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/DeviceNetworkClient.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/DeviceNetworkClient.java new file mode 100644 index 000000000000..8e3e9e7a07dc --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/DeviceNetworkClient.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity; + +import com.azure.communication.programmableconnectivity.implementation.DeviceNetworksImpl; +import com.azure.communication.programmableconnectivity.models.NetworkIdentifier; +import com.azure.communication.programmableconnectivity.models.NetworkRetrievalResult; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous ProgrammableConnectivityClient type. + */ +@ServiceClient(builder = ProgrammableConnectivityClientBuilder.class) +public final class DeviceNetworkClient { + @Generated + private final DeviceNetworksImpl serviceClient; + + /** + * Initializes an instance of DeviceNetworkClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DeviceNetworkClient(DeviceNetworksImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Retrieves the network a given device is on. Returns network in a networkCode format that can be used for other + * APIs. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     identifierType: String (Required)
+     *     identifier: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     networkCode: String (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the network that the device is on along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response retrieveWithResponse(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.retrieveWithResponse(apcGatewayId, body, requestOptions); + } + + /** + * Retrieves the network a given device is on. Returns network in a networkCode format that can be used for other + * APIs. + * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the network that the device is on. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkRetrievalResult retrieve(String apcGatewayId, NetworkIdentifier body) { + // Generated convenience method for retrieveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return retrieveWithResponse(apcGatewayId, BinaryData.fromObject(body), requestOptions).getValue() + .toObject(NetworkRetrievalResult.class); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/NumberVerificationAsyncClient.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/NumberVerificationAsyncClient.java new file mode 100644 index 000000000000..c3f08d51e132 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/NumberVerificationAsyncClient.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity; + +import com.azure.communication.programmableconnectivity.implementation.NumberVerificationsImpl; +import com.azure.communication.programmableconnectivity.models.NumberVerificationResult; +import com.azure.communication.programmableconnectivity.models.NumberVerificationWithCodeContent; +import com.azure.communication.programmableconnectivity.models.NumberVerificationWithoutCodeContent; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ProgrammableConnectivityClient type. + */ +@ServiceClient(builder = ProgrammableConnectivityClientBuilder.class, isAsync = true) +public final class NumberVerificationAsyncClient { + @Generated + private final NumberVerificationsImpl serviceClient; + + /** + * Initializes an instance of NumberVerificationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NumberVerificationAsyncClient(NumberVerificationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Verifies the phone number (MSISDN) associated with a device. As part of the frontend authorization flow, the + * device is redirected to the operator network to authenticate directly. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     networkIdentifier (Required): {
+     *         identifierType: String (Required)
+     *         identifier: String (Required)
+     *     }
+     *     phoneNumber: String (Optional)
+     *     hashedPhoneNumber: String (Optional)
+     *     redirectUri: String (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> verifyWithoutCodeWithResponse(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.verifyWithoutCodeWithResponseAsync(apcGatewayId, body, requestOptions); + } + + /** + * Verifies the phone number (MSISDN) associated with a device. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     apcCode: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     verificationResult: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response verifying number of device along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> verifyWithCodeWithResponse(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.verifyWithCodeWithResponseAsync(apcGatewayId, body, requestOptions); + } + + /** + * Verifies the phone number (MSISDN) associated with a device. As part of the frontend authorization flow, the + * device is redirected to the operator network to authenticate directly. + * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono verifyWithoutCode(String apcGatewayId, NumberVerificationWithoutCodeContent body) { + // Generated convenience method for verifyWithoutCodeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return verifyWithoutCodeWithResponse(apcGatewayId, BinaryData.fromObject(body), requestOptions) + .flatMap(FluxUtil::toMono); + } + + /** + * Verifies the phone number (MSISDN) associated with a device. + * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response verifying number of device on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono verifyWithCode(String apcGatewayId, NumberVerificationWithCodeContent body) { + // Generated convenience method for verifyWithCodeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return verifyWithCodeWithResponse(apcGatewayId, BinaryData.fromObject(body), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(NumberVerificationResult.class)); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/NumberVerificationClient.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/NumberVerificationClient.java new file mode 100644 index 000000000000..4fb96f7d8fea --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/NumberVerificationClient.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity; + +import com.azure.communication.programmableconnectivity.implementation.NumberVerificationsImpl; +import com.azure.communication.programmableconnectivity.models.NumberVerificationResult; +import com.azure.communication.programmableconnectivity.models.NumberVerificationWithCodeContent; +import com.azure.communication.programmableconnectivity.models.NumberVerificationWithoutCodeContent; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous ProgrammableConnectivityClient type. + */ +@ServiceClient(builder = ProgrammableConnectivityClientBuilder.class) +public final class NumberVerificationClient { + @Generated + private final NumberVerificationsImpl serviceClient; + + /** + * Initializes an instance of NumberVerificationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NumberVerificationClient(NumberVerificationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Verifies the phone number (MSISDN) associated with a device. As part of the frontend authorization flow, the + * device is redirected to the operator network to authenticate directly. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     networkIdentifier (Required): {
+     *         identifierType: String (Required)
+     *         identifier: String (Required)
+     *     }
+     *     phoneNumber: String (Optional)
+     *     hashedPhoneNumber: String (Optional)
+     *     redirectUri: String (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response verifyWithoutCodeWithResponse(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.verifyWithoutCodeWithResponse(apcGatewayId, body, requestOptions); + } + + /** + * Verifies the phone number (MSISDN) associated with a device. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     apcCode: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     verificationResult: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response verifying number of device along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response verifyWithCodeWithResponse(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.verifyWithCodeWithResponse(apcGatewayId, body, requestOptions); + } + + /** + * Verifies the phone number (MSISDN) associated with a device. As part of the frontend authorization flow, the + * device is redirected to the operator network to authenticate directly. + * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void verifyWithoutCode(String apcGatewayId, NumberVerificationWithoutCodeContent body) { + // Generated convenience method for verifyWithoutCodeWithResponse + RequestOptions requestOptions = new RequestOptions(); + verifyWithoutCodeWithResponse(apcGatewayId, BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * Verifies the phone number (MSISDN) associated with a device. + * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response verifying number of device. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public NumberVerificationResult verifyWithCode(String apcGatewayId, NumberVerificationWithCodeContent body) { + // Generated convenience method for verifyWithCodeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return verifyWithCodeWithResponse(apcGatewayId, BinaryData.fromObject(body), requestOptions).getValue() + .toObject(NumberVerificationResult.class); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/ProgrammableConnectivityClientBuilder.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/ProgrammableConnectivityClientBuilder.java new file mode 100644 index 000000000000..b0e7fd315a9c --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/ProgrammableConnectivityClientBuilder.java @@ -0,0 +1,403 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity; + +import com.azure.communication.programmableconnectivity.implementation.ProgrammableConnectivityClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.client.traits.TokenCredentialTrait; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the ProgrammableConnectivityClient type. + */ +@ServiceClientBuilder( + serviceClients = { + DeviceLocationClient.class, + DeviceNetworkClient.class, + NumberVerificationClient.class, + SimSwapClient.class, + DeviceLocationAsyncClient.class, + DeviceNetworkAsyncClient.class, + NumberVerificationAsyncClient.class, + SimSwapAsyncClient.class }) +public final class ProgrammableConnectivityClientBuilder implements HttpTrait, + ConfigurationTrait, + TokenCredentialTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final String[] DEFAULT_SCOPES = new String[] { "https://management.azure.com//.default" }; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-communication-programmableconnectivity.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ProgrammableConnectivityClientBuilder. + */ + @Generated + public ProgrammableConnectivityClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ProgrammableConnectivityClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ProgrammableConnectivityClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ProgrammableConnectivityClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ProgrammableConnectivityClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ProgrammableConnectivityClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ProgrammableConnectivityClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ProgrammableConnectivityClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The TokenCredential used for authentication. + */ + @Generated + private TokenCredential tokenCredential; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ProgrammableConnectivityClientBuilder credential(TokenCredential tokenCredential) { + this.tokenCredential = tokenCredential; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ProgrammableConnectivityClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private ProgrammableConnectivityServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the ProgrammableConnectivityClientBuilder. + */ + @Generated + public ProgrammableConnectivityClientBuilder serviceVersion(ProgrammableConnectivityServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ProgrammableConnectivityClientBuilder. + */ + @Generated + public ProgrammableConnectivityClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ProgrammableConnectivityClientImpl with the provided parameters. + * + * @return an instance of ProgrammableConnectivityClientImpl. + */ + @Generated + private ProgrammableConnectivityClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + ProgrammableConnectivityServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : ProgrammableConnectivityServiceVersion.getLatest(); + ProgrammableConnectivityClientImpl client = new ProgrammableConnectivityClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + if (tokenCredential != null) { + policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of DeviceLocationAsyncClient class. + * + * @return an instance of DeviceLocationAsyncClient. + */ + @Generated + public DeviceLocationAsyncClient buildDeviceLocationAsyncClient() { + return new DeviceLocationAsyncClient(buildInnerClient().getDeviceLocations()); + } + + /** + * Builds an instance of DeviceNetworkAsyncClient class. + * + * @return an instance of DeviceNetworkAsyncClient. + */ + @Generated + public DeviceNetworkAsyncClient buildDeviceNetworkAsyncClient() { + return new DeviceNetworkAsyncClient(buildInnerClient().getDeviceNetworks()); + } + + /** + * Builds an instance of NumberVerificationAsyncClient class. + * + * @return an instance of NumberVerificationAsyncClient. + */ + @Generated + public NumberVerificationAsyncClient buildNumberVerificationAsyncClient() { + return new NumberVerificationAsyncClient(buildInnerClient().getNumberVerifications()); + } + + /** + * Builds an instance of SimSwapAsyncClient class. + * + * @return an instance of SimSwapAsyncClient. + */ + @Generated + public SimSwapAsyncClient buildSimSwapAsyncClient() { + return new SimSwapAsyncClient(buildInnerClient().getSimSwaps()); + } + + /** + * Builds an instance of DeviceLocationClient class. + * + * @return an instance of DeviceLocationClient. + */ + @Generated + public DeviceLocationClient buildDeviceLocationClient() { + return new DeviceLocationClient(buildInnerClient().getDeviceLocations()); + } + + /** + * Builds an instance of DeviceNetworkClient class. + * + * @return an instance of DeviceNetworkClient. + */ + @Generated + public DeviceNetworkClient buildDeviceNetworkClient() { + return new DeviceNetworkClient(buildInnerClient().getDeviceNetworks()); + } + + /** + * Builds an instance of NumberVerificationClient class. + * + * @return an instance of NumberVerificationClient. + */ + @Generated + public NumberVerificationClient buildNumberVerificationClient() { + return new NumberVerificationClient(buildInnerClient().getNumberVerifications()); + } + + /** + * Builds an instance of SimSwapClient class. + * + * @return an instance of SimSwapClient. + */ + @Generated + public SimSwapClient buildSimSwapClient() { + return new SimSwapClient(buildInnerClient().getSimSwaps()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ProgrammableConnectivityClientBuilder.class); +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/ProgrammableConnectivityServiceVersion.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/ProgrammableConnectivityServiceVersion.java new file mode 100644 index 000000000000..f7ab8ad447d5 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/ProgrammableConnectivityServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of ProgrammableConnectivityClient. + */ +public enum ProgrammableConnectivityServiceVersion implements ServiceVersion { + /** + * Enum value 2024-02-09-preview. + */ + V2024_02_09_PREVIEW("2024-02-09-preview"); + + private final String version; + + ProgrammableConnectivityServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link ProgrammableConnectivityServiceVersion}. + */ + public static ProgrammableConnectivityServiceVersion getLatest() { + return V2024_02_09_PREVIEW; + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/SimSwapAsyncClient.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/SimSwapAsyncClient.java new file mode 100644 index 000000000000..f3ebdfe076f2 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/SimSwapAsyncClient.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity; + +import com.azure.communication.programmableconnectivity.implementation.SimSwapsImpl; +import com.azure.communication.programmableconnectivity.models.SimSwapRetrievalContent; +import com.azure.communication.programmableconnectivity.models.SimSwapRetrievalResult; +import com.azure.communication.programmableconnectivity.models.SimSwapVerificationContent; +import com.azure.communication.programmableconnectivity.models.SimSwapVerificationResult; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ProgrammableConnectivityClient type. + */ +@ServiceClient(builder = ProgrammableConnectivityClientBuilder.class, isAsync = true) +public final class SimSwapAsyncClient { + @Generated + private final SimSwapsImpl serviceClient; + + /** + * Initializes an instance of SimSwapAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SimSwapAsyncClient(SimSwapsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Provides timestamp of latest SIM swap. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     phoneNumber: String (Optional)
+     *     networkIdentifier (Required): {
+     *         identifierType: String (Required)
+     *         identifier: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     date: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response with SimSwap date along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> retrieveWithResponse(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.retrieveWithResponseAsync(apcGatewayId, body, requestOptions); + } + + /** + * Verifies if a SIM swap has been performed during a past period (defined in the request with 'maxAgeHours' + * attribute). Returns 'True' if a SIM swap has occured. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     phoneNumber: String (Optional)
+     *     maxAgeHours: Integer (Optional)
+     *     networkIdentifier (Required): {
+     *         identifierType: String (Required)
+     *         identifier: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     verificationResult: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response verifying SimSwap in period along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> verifyWithResponse(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.verifyWithResponseAsync(apcGatewayId, body, requestOptions); + } + + /** + * Provides timestamp of latest SIM swap. + * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response with SimSwap date on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono retrieve(String apcGatewayId, SimSwapRetrievalContent body) { + // Generated convenience method for retrieveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return retrieveWithResponse(apcGatewayId, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SimSwapRetrievalResult.class)); + } + + /** + * Verifies if a SIM swap has been performed during a past period (defined in the request with 'maxAgeHours' + * attribute). Returns 'True' if a SIM swap has occured. + * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response verifying SimSwap in period on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono verify(String apcGatewayId, SimSwapVerificationContent body) { + // Generated convenience method for verifyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return verifyWithResponse(apcGatewayId, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SimSwapVerificationResult.class)); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/SimSwapClient.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/SimSwapClient.java new file mode 100644 index 000000000000..4f1c07daf2a4 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/SimSwapClient.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity; + +import com.azure.communication.programmableconnectivity.implementation.SimSwapsImpl; +import com.azure.communication.programmableconnectivity.models.SimSwapRetrievalContent; +import com.azure.communication.programmableconnectivity.models.SimSwapRetrievalResult; +import com.azure.communication.programmableconnectivity.models.SimSwapVerificationContent; +import com.azure.communication.programmableconnectivity.models.SimSwapVerificationResult; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous ProgrammableConnectivityClient type. + */ +@ServiceClient(builder = ProgrammableConnectivityClientBuilder.class) +public final class SimSwapClient { + @Generated + private final SimSwapsImpl serviceClient; + + /** + * Initializes an instance of SimSwapClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SimSwapClient(SimSwapsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Provides timestamp of latest SIM swap. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     phoneNumber: String (Optional)
+     *     networkIdentifier (Required): {
+     *         identifierType: String (Required)
+     *         identifier: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     date: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response with SimSwap date along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response retrieveWithResponse(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.retrieveWithResponse(apcGatewayId, body, requestOptions); + } + + /** + * Verifies if a SIM swap has been performed during a past period (defined in the request with 'maxAgeHours' + * attribute). Returns 'True' if a SIM swap has occured. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     phoneNumber: String (Optional)
+     *     maxAgeHours: Integer (Optional)
+     *     networkIdentifier (Required): {
+     *         identifierType: String (Required)
+     *         identifier: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     verificationResult: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response verifying SimSwap in period along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response verifyWithResponse(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.verifyWithResponse(apcGatewayId, body, requestOptions); + } + + /** + * Provides timestamp of latest SIM swap. + * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response with SimSwap date. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public SimSwapRetrievalResult retrieve(String apcGatewayId, SimSwapRetrievalContent body) { + // Generated convenience method for retrieveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return retrieveWithResponse(apcGatewayId, BinaryData.fromObject(body), requestOptions).getValue() + .toObject(SimSwapRetrievalResult.class); + } + + /** + * Verifies if a SIM swap has been performed during a past period (defined in the request with 'maxAgeHours' + * attribute). Returns 'True' if a SIM swap has occured. + * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response verifying SimSwap in period. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public SimSwapVerificationResult verify(String apcGatewayId, SimSwapVerificationContent body) { + // Generated convenience method for verifyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return verifyWithResponse(apcGatewayId, BinaryData.fromObject(body), requestOptions).getValue() + .toObject(SimSwapVerificationResult.class); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/implementation/DeviceLocationsImpl.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/implementation/DeviceLocationsImpl.java new file mode 100644 index 000000000000..9e739a9aef9d --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/implementation/DeviceLocationsImpl.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.implementation; + +import com.azure.communication.programmableconnectivity.ProgrammableConnectivityServiceVersion; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DeviceLocations. + */ +public final class DeviceLocationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DeviceLocationsService service; + + /** + * The service client containing this operation class. + */ + private final ProgrammableConnectivityClientImpl client; + + /** + * Initializes an instance of DeviceLocationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DeviceLocationsImpl(ProgrammableConnectivityClientImpl client) { + this.service + = RestProxy.create(DeviceLocationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ProgrammableConnectivityServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for ProgrammableConnectivityClientDeviceLocations to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ProgrammableConnecti") + public interface DeviceLocationsService { + @Post("/device-location/location:verify") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> verify(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("apc-gateway-id") String apcGatewayId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/device-location/location:verify") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response verifySync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("apc-gateway-id") String apcGatewayId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Verifies whether a device is within a specified location area, defined as an accuracy (radius) around a point, + * specified by longitude and latitude. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     networkIdentifier (Required): {
+     *         identifierType: String (Required)
+     *         identifier: String (Required)
+     *     }
+     *     latitude: double (Required)
+     *     longitude: double (Required)
+     *     accuracy: int (Required)
+     *     device (Required): {
+     *         networkAccessIdentifier: String (Optional)
+     *         phoneNumber: String (Optional)
+     *         ipv4Address (Optional): {
+     *             ipv4: String (Required)
+     *             port: int (Required)
+     *         }
+     *         ipv6Address (Optional): {
+     *             ipv6: String (Required)
+     *             port: int (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     verificationResult: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response verifying location along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> verifyWithResponseAsync(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.verify(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + apcGatewayId, contentType, accept, body, requestOptions, context)); + } + + /** + * Verifies whether a device is within a specified location area, defined as an accuracy (radius) around a point, + * specified by longitude and latitude. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     networkIdentifier (Required): {
+     *         identifierType: String (Required)
+     *         identifier: String (Required)
+     *     }
+     *     latitude: double (Required)
+     *     longitude: double (Required)
+     *     accuracy: int (Required)
+     *     device (Required): {
+     *         networkAccessIdentifier: String (Optional)
+     *         phoneNumber: String (Optional)
+     *         ipv4Address (Optional): {
+     *             ipv4: String (Required)
+     *             port: int (Required)
+     *         }
+     *         ipv6Address (Optional): {
+     *             ipv6: String (Required)
+     *             port: int (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     verificationResult: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response verifying location along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response verifyWithResponse(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.verifySync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), apcGatewayId, + contentType, accept, body, requestOptions, Context.NONE); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/implementation/DeviceNetworksImpl.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/implementation/DeviceNetworksImpl.java new file mode 100644 index 000000000000..5d2387bb4b0d --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/implementation/DeviceNetworksImpl.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.implementation; + +import com.azure.communication.programmableconnectivity.ProgrammableConnectivityServiceVersion; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DeviceNetworks. + */ +public final class DeviceNetworksImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DeviceNetworksService service; + + /** + * The service client containing this operation class. + */ + private final ProgrammableConnectivityClientImpl client; + + /** + * Initializes an instance of DeviceNetworksImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DeviceNetworksImpl(ProgrammableConnectivityClientImpl client) { + this.service + = RestProxy.create(DeviceNetworksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ProgrammableConnectivityServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for ProgrammableConnectivityClientDeviceNetworks to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ProgrammableConnecti") + public interface DeviceNetworksService { + @Post("/device-network/network:retrieve") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> retrieve(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("apc-gateway-id") String apcGatewayId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/device-network/network:retrieve") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response retrieveSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("apc-gateway-id") String apcGatewayId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Retrieves the network a given device is on. Returns network in a networkCode format that can be used for other + * APIs. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     identifierType: String (Required)
+     *     identifier: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     networkCode: String (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the network that the device is on along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> retrieveWithResponseAsync(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.retrieve(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + apcGatewayId, contentType, accept, body, requestOptions, context)); + } + + /** + * Retrieves the network a given device is on. Returns network in a networkCode format that can be used for other + * APIs. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     identifierType: String (Required)
+     *     identifier: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     networkCode: String (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the network that the device is on along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response retrieveWithResponse(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.retrieveSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + apcGatewayId, contentType, accept, body, requestOptions, Context.NONE); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/implementation/NumberVerificationsImpl.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/implementation/NumberVerificationsImpl.java new file mode 100644 index 000000000000..19ab19861fcc --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/implementation/NumberVerificationsImpl.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.implementation; + +import com.azure.communication.programmableconnectivity.ProgrammableConnectivityServiceVersion; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in NumberVerifications. + */ +public final class NumberVerificationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NumberVerificationsService service; + + /** + * The service client containing this operation class. + */ + private final ProgrammableConnectivityClientImpl client; + + /** + * Initializes an instance of NumberVerificationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NumberVerificationsImpl(ProgrammableConnectivityClientImpl client) { + this.service = RestProxy.create(NumberVerificationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ProgrammableConnectivityServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for ProgrammableConnectivityClientNumberVerifications to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ProgrammableConnecti") + public interface NumberVerificationsService { + @Post("/number-verification/number:verify") + @ExpectedResponses({ 302 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> verifyWithoutCode(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("apc-gateway-id") String apcGatewayId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/number-verification/number:verify") + @ExpectedResponses({ 302 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response verifyWithoutCodeSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("apc-gateway-id") String apcGatewayId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/number-verification/number:verify") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> verifyWithCode(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("apc-gateway-id") String apcGatewayId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/number-verification/number:verify") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response verifyWithCodeSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("apc-gateway-id") String apcGatewayId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Verifies the phone number (MSISDN) associated with a device. As part of the frontend authorization flow, the + * device is redirected to the operator network to authenticate directly. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     networkIdentifier (Required): {
+     *         identifierType: String (Required)
+     *         identifier: String (Required)
+     *     }
+     *     phoneNumber: String (Optional)
+     *     hashedPhoneNumber: String (Optional)
+     *     redirectUri: String (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> verifyWithoutCodeWithResponseAsync(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.verifyWithoutCode(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), apcGatewayId, contentType, accept, body, requestOptions, + context)); + } + + /** + * Verifies the phone number (MSISDN) associated with a device. As part of the frontend authorization flow, the + * device is redirected to the operator network to authenticate directly. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     networkIdentifier (Required): {
+     *         identifierType: String (Required)
+     *         identifier: String (Required)
+     *     }
+     *     phoneNumber: String (Optional)
+     *     hashedPhoneNumber: String (Optional)
+     *     redirectUri: String (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response verifyWithoutCodeWithResponse(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.verifyWithoutCodeSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + apcGatewayId, contentType, accept, body, requestOptions, Context.NONE); + } + + /** + * Verifies the phone number (MSISDN) associated with a device. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     apcCode: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     verificationResult: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response verifying number of device along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> verifyWithCodeWithResponseAsync(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.verifyWithCode(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + apcGatewayId, contentType, accept, body, requestOptions, context)); + } + + /** + * Verifies the phone number (MSISDN) associated with a device. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     apcCode: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     verificationResult: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response verifying number of device along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response verifyWithCodeWithResponse(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.verifyWithCodeSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + apcGatewayId, contentType, accept, body, requestOptions, Context.NONE); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/implementation/ProgrammableConnectivityClientImpl.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/implementation/ProgrammableConnectivityClientImpl.java new file mode 100644 index 000000000000..28fd60c3d1e6 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/implementation/ProgrammableConnectivityClientImpl.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.implementation; + +import com.azure.communication.programmableconnectivity.ProgrammableConnectivityServiceVersion; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; + +/** + * Initializes a new instance of the ProgrammableConnectivityClient type. + */ +public final class ProgrammableConnectivityClientImpl { + /** + * An Azure Programmable Connectivity Endpoint providing access to Network APIs, for example + * https://{region}.apcgatewayapi.azure.com. + */ + private final String endpoint; + + /** + * Gets An Azure Programmable Connectivity Endpoint providing access to Network APIs, for example + * https://{region}.apcgatewayapi.azure.com. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final ProgrammableConnectivityServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ProgrammableConnectivityServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + public SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The DeviceLocationsImpl object to access its operations. + */ + private final DeviceLocationsImpl deviceLocations; + + /** + * Gets the DeviceLocationsImpl object to access its operations. + * + * @return the DeviceLocationsImpl object. + */ + public DeviceLocationsImpl getDeviceLocations() { + return this.deviceLocations; + } + + /** + * The DeviceNetworksImpl object to access its operations. + */ + private final DeviceNetworksImpl deviceNetworks; + + /** + * Gets the DeviceNetworksImpl object to access its operations. + * + * @return the DeviceNetworksImpl object. + */ + public DeviceNetworksImpl getDeviceNetworks() { + return this.deviceNetworks; + } + + /** + * The NumberVerificationsImpl object to access its operations. + */ + private final NumberVerificationsImpl numberVerifications; + + /** + * Gets the NumberVerificationsImpl object to access its operations. + * + * @return the NumberVerificationsImpl object. + */ + public NumberVerificationsImpl getNumberVerifications() { + return this.numberVerifications; + } + + /** + * The SimSwapsImpl object to access its operations. + */ + private final SimSwapsImpl simSwaps; + + /** + * Gets the SimSwapsImpl object to access its operations. + * + * @return the SimSwapsImpl object. + */ + public SimSwapsImpl getSimSwaps() { + return this.simSwaps; + } + + /** + * Initializes an instance of ProgrammableConnectivityClient client. + * + * @param endpoint An Azure Programmable Connectivity Endpoint providing access to Network APIs, for example + * https://{region}.apcgatewayapi.azure.com. + * @param serviceVersion Service version. + */ + public ProgrammableConnectivityClientImpl(String endpoint, ProgrammableConnectivityServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of ProgrammableConnectivityClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint An Azure Programmable Connectivity Endpoint providing access to Network APIs, for example + * https://{region}.apcgatewayapi.azure.com. + * @param serviceVersion Service version. + */ + public ProgrammableConnectivityClientImpl(HttpPipeline httpPipeline, String endpoint, + ProgrammableConnectivityServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of ProgrammableConnectivityClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint An Azure Programmable Connectivity Endpoint providing access to Network APIs, for example + * https://{region}.apcgatewayapi.azure.com. + * @param serviceVersion Service version. + */ + public ProgrammableConnectivityClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint, ProgrammableConnectivityServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.deviceLocations = new DeviceLocationsImpl(this); + this.deviceNetworks = new DeviceNetworksImpl(this); + this.numberVerifications = new NumberVerificationsImpl(this); + this.simSwaps = new SimSwapsImpl(this); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/implementation/SimSwapsImpl.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/implementation/SimSwapsImpl.java new file mode 100644 index 000000000000..431665de1206 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/implementation/SimSwapsImpl.java @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.implementation; + +import com.azure.communication.programmableconnectivity.ProgrammableConnectivityServiceVersion; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SimSwaps. + */ +public final class SimSwapsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SimSwapsService service; + + /** + * The service client containing this operation class. + */ + private final ProgrammableConnectivityClientImpl client; + + /** + * Initializes an instance of SimSwapsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SimSwapsImpl(ProgrammableConnectivityClientImpl client) { + this.service = RestProxy.create(SimSwapsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ProgrammableConnectivityServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for ProgrammableConnectivityClientSimSwaps to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ProgrammableConnecti") + public interface SimSwapsService { + @Post("/sim-swap/sim-swap:retrieve") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> retrieve(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("apc-gateway-id") String apcGatewayId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/sim-swap/sim-swap:retrieve") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response retrieveSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("apc-gateway-id") String apcGatewayId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/sim-swap/sim-swap:verify") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> verify(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("apc-gateway-id") String apcGatewayId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/sim-swap/sim-swap:verify") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response verifySync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("apc-gateway-id") String apcGatewayId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Provides timestamp of latest SIM swap. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     phoneNumber: String (Optional)
+     *     networkIdentifier (Required): {
+     *         identifierType: String (Required)
+     *         identifier: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     date: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response with SimSwap date along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> retrieveWithResponseAsync(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.retrieve(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + apcGatewayId, contentType, accept, body, requestOptions, context)); + } + + /** + * Provides timestamp of latest SIM swap. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     phoneNumber: String (Optional)
+     *     networkIdentifier (Required): {
+     *         identifierType: String (Required)
+     *         identifier: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     date: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response with SimSwap date along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response retrieveWithResponse(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.retrieveSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + apcGatewayId, contentType, accept, body, requestOptions, Context.NONE); + } + + /** + * Verifies if a SIM swap has been performed during a past period (defined in the request with 'maxAgeHours' + * attribute). Returns 'True' if a SIM swap has occured. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     phoneNumber: String (Optional)
+     *     maxAgeHours: Integer (Optional)
+     *     networkIdentifier (Required): {
+     *         identifierType: String (Required)
+     *         identifier: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     verificationResult: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response verifying SimSwap in period along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> verifyWithResponseAsync(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.verify(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + apcGatewayId, contentType, accept, body, requestOptions, context)); + } + + /** + * Verifies if a SIM swap has been performed during a past period (defined in the request with 'maxAgeHours' + * attribute). Returns 'True' if a SIM swap has occured. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     phoneNumber: String (Optional)
+     *     maxAgeHours: Integer (Optional)
+     *     networkIdentifier (Required): {
+     *         identifierType: String (Required)
+     *         identifier: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     verificationResult: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param apcGatewayId The identifier of the APC Gateway resource which should handle this request. + * @param body Body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response verifying SimSwap in period along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response verifyWithResponse(String apcGatewayId, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.verifySync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), apcGatewayId, + contentType, accept, body, requestOptions, Context.NONE); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/implementation/package-info.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/implementation/package-info.java new file mode 100644 index 000000000000..f7e757bdc5fb --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for ProgrammableConnectivity. + * Azure Programmable Connectivity (APC) provides a unified interface to the Network APIs of multiple Telecom Operators. + * Note that Operators may deprecate a Network API with less advance notice than the Azure standard, in which case APC + * will also deprecate that Network API. + */ +package com.azure.communication.programmableconnectivity.implementation; diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/DeviceLocationVerificationContent.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/DeviceLocationVerificationContent.java new file mode 100644 index 000000000000..55716bd917ec --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/DeviceLocationVerificationContent.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Request to verify Location. + */ +@Immutable +public final class DeviceLocationVerificationContent implements JsonSerializable { + /* + * Network to query for this device, or device information to enable network routing. + */ + @Generated + private final NetworkIdentifier networkIdentifier; + + /* + * Latitude of location to be verified + */ + @Generated + private final double latitude; + + /* + * Longitude of location to be verified + */ + @Generated + private final double longitude; + + /* + * Accuracy expected for location verification in kilometers + */ + @Generated + private final int accuracy; + + /* + * The device to find the location for. Exactly one of Network Access Code, Phone Number, IPv4 address, or IPv6 + * address + */ + @Generated + private final LocationDevice device; + + /** + * Creates an instance of DeviceLocationVerificationContent class. + * + * @param networkIdentifier the networkIdentifier value to set. + * @param latitude the latitude value to set. + * @param longitude the longitude value to set. + * @param accuracy the accuracy value to set. + * @param device the device value to set. + */ + @Generated + public DeviceLocationVerificationContent(NetworkIdentifier networkIdentifier, double latitude, double longitude, + int accuracy, LocationDevice device) { + this.networkIdentifier = networkIdentifier; + this.latitude = latitude; + this.longitude = longitude; + this.accuracy = accuracy; + this.device = device; + } + + /** + * Get the networkIdentifier property: Network to query for this device, or device information to enable network + * routing. + * + * @return the networkIdentifier value. + */ + @Generated + public NetworkIdentifier getNetworkIdentifier() { + return this.networkIdentifier; + } + + /** + * Get the latitude property: Latitude of location to be verified. + * + * @return the latitude value. + */ + @Generated + public double getLatitude() { + return this.latitude; + } + + /** + * Get the longitude property: Longitude of location to be verified. + * + * @return the longitude value. + */ + @Generated + public double getLongitude() { + return this.longitude; + } + + /** + * Get the accuracy property: Accuracy expected for location verification in kilometers. + * + * @return the accuracy value. + */ + @Generated + public int getAccuracy() { + return this.accuracy; + } + + /** + * Get the device property: The device to find the location for. Exactly one of Network Access Code, Phone Number, + * IPv4 address, or IPv6 address. + * + * @return the device value. + */ + @Generated + public LocationDevice getDevice() { + return this.device; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("networkIdentifier", this.networkIdentifier); + jsonWriter.writeDoubleField("latitude", this.latitude); + jsonWriter.writeDoubleField("longitude", this.longitude); + jsonWriter.writeIntField("accuracy", this.accuracy); + jsonWriter.writeJsonField("device", this.device); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeviceLocationVerificationContent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeviceLocationVerificationContent if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DeviceLocationVerificationContent. + */ + @Generated + public static DeviceLocationVerificationContent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkIdentifier networkIdentifier = null; + double latitude = 0.0; + double longitude = 0.0; + int accuracy = 0; + LocationDevice device = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("networkIdentifier".equals(fieldName)) { + networkIdentifier = NetworkIdentifier.fromJson(reader); + } else if ("latitude".equals(fieldName)) { + latitude = reader.getDouble(); + } else if ("longitude".equals(fieldName)) { + longitude = reader.getDouble(); + } else if ("accuracy".equals(fieldName)) { + accuracy = reader.getInt(); + } else if ("device".equals(fieldName)) { + device = LocationDevice.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new DeviceLocationVerificationContent(networkIdentifier, latitude, longitude, accuracy, device); + }); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/DeviceLocationVerificationResult.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/DeviceLocationVerificationResult.java new file mode 100644 index 000000000000..dbd116f12518 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/DeviceLocationVerificationResult.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Response verifying location. + */ +@Immutable +public final class DeviceLocationVerificationResult implements JsonSerializable { + /* + * True if the location is in the specified area, False otherwise + */ + @Generated + private final boolean verificationResult; + + /** + * Creates an instance of DeviceLocationVerificationResult class. + * + * @param verificationResult the verificationResult value to set. + */ + @Generated + private DeviceLocationVerificationResult(boolean verificationResult) { + this.verificationResult = verificationResult; + } + + /** + * Get the verificationResult property: True if the location is in the specified area, False otherwise. + * + * @return the verificationResult value. + */ + @Generated + public boolean isVerificationResult() { + return this.verificationResult; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("verificationResult", this.verificationResult); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeviceLocationVerificationResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeviceLocationVerificationResult if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DeviceLocationVerificationResult. + */ + @Generated + public static DeviceLocationVerificationResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean verificationResult = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("verificationResult".equals(fieldName)) { + verificationResult = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new DeviceLocationVerificationResult(verificationResult); + }); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/Ipv4Address.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/Ipv4Address.java new file mode 100644 index 000000000000..bc491f182256 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/Ipv4Address.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * IPv4 device indicator. + */ +@Immutable +public final class Ipv4Address implements JsonSerializable { + /* + * An IPv4 address. This may be specified as an exact address, or as a subnet in CIDR notation. + */ + @Generated + private final String ipv4; + + /* + * User equipment port. + */ + @Generated + private final int port; + + /** + * Creates an instance of Ipv4Address class. + * + * @param ipv4 the ipv4 value to set. + * @param port the port value to set. + */ + @Generated + public Ipv4Address(String ipv4, int port) { + this.ipv4 = ipv4; + this.port = port; + } + + /** + * Get the ipv4 property: An IPv4 address. This may be specified as an exact address, or as a subnet in CIDR + * notation. + * + * @return the ipv4 value. + */ + @Generated + public String getIpv4() { + return this.ipv4; + } + + /** + * Get the port property: User equipment port. + * + * @return the port value. + */ + @Generated + public int getPort() { + return this.port; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("ipv4", this.ipv4); + jsonWriter.writeIntField("port", this.port); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Ipv4Address from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Ipv4Address if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Ipv4Address. + */ + @Generated + public static Ipv4Address fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String ipv4 = null; + int port = 0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ipv4".equals(fieldName)) { + ipv4 = reader.getString(); + } else if ("port".equals(fieldName)) { + port = reader.getInt(); + } else { + reader.skipChildren(); + } + } + return new Ipv4Address(ipv4, port); + }); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/Ipv6Address.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/Ipv6Address.java new file mode 100644 index 000000000000..1714a5626100 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/Ipv6Address.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * IPv6 device indicator. + */ +@Immutable +public final class Ipv6Address implements JsonSerializable { + /* + * An IPv6 address. This may be specified as an exact address, or as a subnet in CIDR notation. + */ + @Generated + private final String ipv6; + + /* + * User equipment port. + */ + @Generated + private final int port; + + /** + * Creates an instance of Ipv6Address class. + * + * @param ipv6 the ipv6 value to set. + * @param port the port value to set. + */ + @Generated + public Ipv6Address(String ipv6, int port) { + this.ipv6 = ipv6; + this.port = port; + } + + /** + * Get the ipv6 property: An IPv6 address. This may be specified as an exact address, or as a subnet in CIDR + * notation. + * + * @return the ipv6 value. + */ + @Generated + public String getIpv6() { + return this.ipv6; + } + + /** + * Get the port property: User equipment port. + * + * @return the port value. + */ + @Generated + public int getPort() { + return this.port; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("ipv6", this.ipv6); + jsonWriter.writeIntField("port", this.port); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Ipv6Address from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Ipv6Address if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Ipv6Address. + */ + @Generated + public static Ipv6Address fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String ipv6 = null; + int port = 0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ipv6".equals(fieldName)) { + ipv6 = reader.getString(); + } else if ("port".equals(fieldName)) { + port = reader.getInt(); + } else { + reader.skipChildren(); + } + } + return new Ipv6Address(ipv6, port); + }); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/LocationDevice.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/LocationDevice.java new file mode 100644 index 000000000000..93b4e981a67d --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/LocationDevice.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Device information needed by operator to provide location information. Include exactly one of these properties to + * identify your device. + */ +@Fluent +public final class LocationDevice implements JsonSerializable { + /* + * External identifier or network access identifier of the device + */ + @Generated + private String networkAccessIdentifier; + + /* + * Phone number in E.164 format (starting with country code), and optionally prefixed with '+' + */ + @Generated + private String phoneNumber; + + /* + * The Ipv4 address + */ + @Generated + private Ipv4Address ipv4Address; + + /* + * The Ipv6 address + */ + @Generated + private Ipv6Address ipv6Address; + + /** + * Creates an instance of LocationDevice class. + */ + @Generated + public LocationDevice() { + } + + /** + * Get the networkAccessIdentifier property: External identifier or network access identifier of the device. + * + * @return the networkAccessIdentifier value. + */ + @Generated + public String getNetworkAccessIdentifier() { + return this.networkAccessIdentifier; + } + + /** + * Set the networkAccessIdentifier property: External identifier or network access identifier of the device. + * + * @param networkAccessIdentifier the networkAccessIdentifier value to set. + * @return the LocationDevice object itself. + */ + @Generated + public LocationDevice setNetworkAccessIdentifier(String networkAccessIdentifier) { + this.networkAccessIdentifier = networkAccessIdentifier; + return this; + } + + /** + * Get the phoneNumber property: Phone number in E.164 format (starting with country code), and optionally prefixed + * with '+'. + * + * @return the phoneNumber value. + */ + @Generated + public String getPhoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: Phone number in E.164 format (starting with country code), and optionally prefixed + * with '+'. + * + * @param phoneNumber the phoneNumber value to set. + * @return the LocationDevice object itself. + */ + @Generated + public LocationDevice setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get the ipv4Address property: The Ipv4 address. + * + * @return the ipv4Address value. + */ + @Generated + public Ipv4Address getIpv4Address() { + return this.ipv4Address; + } + + /** + * Set the ipv4Address property: The Ipv4 address. + * + * @param ipv4Address the ipv4Address value to set. + * @return the LocationDevice object itself. + */ + @Generated + public LocationDevice setIpv4Address(Ipv4Address ipv4Address) { + this.ipv4Address = ipv4Address; + return this; + } + + /** + * Get the ipv6Address property: The Ipv6 address. + * + * @return the ipv6Address value. + */ + @Generated + public Ipv6Address getIpv6Address() { + return this.ipv6Address; + } + + /** + * Set the ipv6Address property: The Ipv6 address. + * + * @param ipv6Address the ipv6Address value to set. + * @return the LocationDevice object itself. + */ + @Generated + public LocationDevice setIpv6Address(Ipv6Address ipv6Address) { + this.ipv6Address = ipv6Address; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("networkAccessIdentifier", this.networkAccessIdentifier); + jsonWriter.writeStringField("phoneNumber", this.phoneNumber); + jsonWriter.writeJsonField("ipv4Address", this.ipv4Address); + jsonWriter.writeJsonField("ipv6Address", this.ipv6Address); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LocationDevice from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LocationDevice if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the LocationDevice. + */ + @Generated + public static LocationDevice fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LocationDevice deserializedLocationDevice = new LocationDevice(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("networkAccessIdentifier".equals(fieldName)) { + deserializedLocationDevice.networkAccessIdentifier = reader.getString(); + } else if ("phoneNumber".equals(fieldName)) { + deserializedLocationDevice.phoneNumber = reader.getString(); + } else if ("ipv4Address".equals(fieldName)) { + deserializedLocationDevice.ipv4Address = Ipv4Address.fromJson(reader); + } else if ("ipv6Address".equals(fieldName)) { + deserializedLocationDevice.ipv6Address = Ipv6Address.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLocationDevice; + }); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/NetworkIdentifier.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/NetworkIdentifier.java new file mode 100644 index 000000000000..dfeb04183be7 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/NetworkIdentifier.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Identifier for the network to be queried. + */ +@Immutable +public final class NetworkIdentifier implements JsonSerializable { + /* + * The type of identifier for the network. one of: 'IPv4', 'IPv6', 'MSISDN', 'NetworkCode' + */ + @Generated + private final String identifierType; + + /* + * The network identifier, based on the identifierType: an IPv4 address, an IPv6 address, an MSISDN, or a Network + * Code. + * A Network Code may be obtained from APC documentation or from the APC /Network:retrieve endpoint. + */ + @Generated + private final String identifier; + + /** + * Creates an instance of NetworkIdentifier class. + * + * @param identifierType the identifierType value to set. + * @param identifier the identifier value to set. + */ + @Generated + public NetworkIdentifier(String identifierType, String identifier) { + this.identifierType = identifierType; + this.identifier = identifier; + } + + /** + * Get the identifierType property: The type of identifier for the network. one of: 'IPv4', 'IPv6', 'MSISDN', + * 'NetworkCode'. + * + * @return the identifierType value. + */ + @Generated + public String getIdentifierType() { + return this.identifierType; + } + + /** + * Get the identifier property: The network identifier, based on the identifierType: an IPv4 address, an IPv6 + * address, an MSISDN, or a Network Code. + * A Network Code may be obtained from APC documentation or from the APC /Network:retrieve endpoint. + * + * @return the identifier value. + */ + @Generated + public String getIdentifier() { + return this.identifier; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("identifierType", this.identifierType); + jsonWriter.writeStringField("identifier", this.identifier); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NetworkIdentifier from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkIdentifier if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NetworkIdentifier. + */ + @Generated + public static NetworkIdentifier fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String identifierType = null; + String identifier = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("identifierType".equals(fieldName)) { + identifierType = reader.getString(); + } else if ("identifier".equals(fieldName)) { + identifier = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new NetworkIdentifier(identifierType, identifier); + }); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/NetworkRetrievalResult.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/NetworkRetrievalResult.java new file mode 100644 index 000000000000..f214ce2307df --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/NetworkRetrievalResult.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The network that the device is on. + */ +@Immutable +public final class NetworkRetrievalResult implements JsonSerializable { + /* + * The identifier for the network. This can be used as the networkIdentifier for the service APIs. + */ + @Generated + private final String networkCode; + + /** + * Creates an instance of NetworkRetrievalResult class. + * + * @param networkCode the networkCode value to set. + */ + @Generated + private NetworkRetrievalResult(String networkCode) { + this.networkCode = networkCode; + } + + /** + * Get the networkCode property: The identifier for the network. This can be used as the networkIdentifier for the + * service APIs. + * + * @return the networkCode value. + */ + @Generated + public String getNetworkCode() { + return this.networkCode; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("networkCode", this.networkCode); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NetworkRetrievalResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkRetrievalResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NetworkRetrievalResult. + */ + @Generated + public static NetworkRetrievalResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String networkCode = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("networkCode".equals(fieldName)) { + networkCode = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new NetworkRetrievalResult(networkCode); + }); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/NumberVerificationResult.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/NumberVerificationResult.java new file mode 100644 index 000000000000..179577c5dd23 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/NumberVerificationResult.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Response verifying number of device. + */ +@Immutable +public final class NumberVerificationResult implements JsonSerializable { + /* + * True if number if the phone number matches the device, False otherwise + */ + @Generated + private final boolean verificationResult; + + /** + * Creates an instance of NumberVerificationResult class. + * + * @param verificationResult the verificationResult value to set. + */ + @Generated + private NumberVerificationResult(boolean verificationResult) { + this.verificationResult = verificationResult; + } + + /** + * Get the verificationResult property: True if number if the phone number matches the device, False otherwise. + * + * @return the verificationResult value. + */ + @Generated + public boolean isVerificationResult() { + return this.verificationResult; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("verificationResult", this.verificationResult); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NumberVerificationResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NumberVerificationResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NumberVerificationResult. + */ + @Generated + public static NumberVerificationResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean verificationResult = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("verificationResult".equals(fieldName)) { + verificationResult = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new NumberVerificationResult(verificationResult); + }); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/NumberVerificationWithCodeContent.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/NumberVerificationWithCodeContent.java new file mode 100644 index 000000000000..0befe9b8f3c9 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/NumberVerificationWithCodeContent.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Request to verify number of device - second call. + */ +@Immutable +public final class NumberVerificationWithCodeContent implements JsonSerializable { + /* + * The code provided by APC in exchange for the operator code. + */ + @Generated + private final String apcCode; + + /** + * Creates an instance of NumberVerificationWithCodeContent class. + * + * @param apcCode the apcCode value to set. + */ + @Generated + public NumberVerificationWithCodeContent(String apcCode) { + this.apcCode = apcCode; + } + + /** + * Get the apcCode property: The code provided by APC in exchange for the operator code. + * + * @return the apcCode value. + */ + @Generated + public String getApcCode() { + return this.apcCode; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("apcCode", this.apcCode); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NumberVerificationWithCodeContent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NumberVerificationWithCodeContent if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NumberVerificationWithCodeContent. + */ + @Generated + public static NumberVerificationWithCodeContent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String apcCode = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("apcCode".equals(fieldName)) { + apcCode = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new NumberVerificationWithCodeContent(apcCode); + }); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/NumberVerificationWithoutCodeContent.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/NumberVerificationWithoutCodeContent.java new file mode 100644 index 000000000000..f373e861e7fe --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/NumberVerificationWithoutCodeContent.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Request to verify number of device - first call. + */ +@Fluent +public final class NumberVerificationWithoutCodeContent + implements JsonSerializable { + /* + * Identifier for the network to query for this device. + */ + @Generated + private final NetworkIdentifier networkIdentifier; + + /* + * Phone number in E.164 format (starting with country code), and optionally prefixed with '+' + */ + @Generated + private String phoneNumber; + + /* + * Hashed phone number. SHA-256 (in hexadecimal representation) of the mobile phone number in **E.164 format + * (starting with country code)**. Optionally prefixed with '+'. + */ + @Generated + private String hashedPhoneNumber; + + /* + * Redirect URI to backend application. + */ + @Generated + private final String redirectUri; + + /** + * Creates an instance of NumberVerificationWithoutCodeContent class. + * + * @param networkIdentifier the networkIdentifier value to set. + * @param redirectUri the redirectUri value to set. + */ + @Generated + public NumberVerificationWithoutCodeContent(NetworkIdentifier networkIdentifier, String redirectUri) { + this.networkIdentifier = networkIdentifier; + this.redirectUri = redirectUri; + } + + /** + * Get the networkIdentifier property: Identifier for the network to query for this device. + * + * @return the networkIdentifier value. + */ + @Generated + public NetworkIdentifier getNetworkIdentifier() { + return this.networkIdentifier; + } + + /** + * Get the phoneNumber property: Phone number in E.164 format (starting with country code), and optionally prefixed + * with '+'. + * + * @return the phoneNumber value. + */ + @Generated + public String getPhoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: Phone number in E.164 format (starting with country code), and optionally prefixed + * with '+'. + * + * @param phoneNumber the phoneNumber value to set. + * @return the NumberVerificationWithoutCodeContent object itself. + */ + @Generated + public NumberVerificationWithoutCodeContent setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get the hashedPhoneNumber property: Hashed phone number. SHA-256 (in hexadecimal representation) of the mobile + * phone number in **E.164 format (starting with country code)**. Optionally prefixed with '+'. + * + * @return the hashedPhoneNumber value. + */ + @Generated + public String getHashedPhoneNumber() { + return this.hashedPhoneNumber; + } + + /** + * Set the hashedPhoneNumber property: Hashed phone number. SHA-256 (in hexadecimal representation) of the mobile + * phone number in **E.164 format (starting with country code)**. Optionally prefixed with '+'. + * + * @param hashedPhoneNumber the hashedPhoneNumber value to set. + * @return the NumberVerificationWithoutCodeContent object itself. + */ + @Generated + public NumberVerificationWithoutCodeContent setHashedPhoneNumber(String hashedPhoneNumber) { + this.hashedPhoneNumber = hashedPhoneNumber; + return this; + } + + /** + * Get the redirectUri property: Redirect URI to backend application. + * + * @return the redirectUri value. + */ + @Generated + public String getRedirectUri() { + return this.redirectUri; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("networkIdentifier", this.networkIdentifier); + jsonWriter.writeStringField("redirectUri", this.redirectUri); + jsonWriter.writeStringField("phoneNumber", this.phoneNumber); + jsonWriter.writeStringField("hashedPhoneNumber", this.hashedPhoneNumber); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NumberVerificationWithoutCodeContent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NumberVerificationWithoutCodeContent if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NumberVerificationWithoutCodeContent. + */ + @Generated + public static NumberVerificationWithoutCodeContent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkIdentifier networkIdentifier = null; + String redirectUri = null; + String phoneNumber = null; + String hashedPhoneNumber = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("networkIdentifier".equals(fieldName)) { + networkIdentifier = NetworkIdentifier.fromJson(reader); + } else if ("redirectUri".equals(fieldName)) { + redirectUri = reader.getString(); + } else if ("phoneNumber".equals(fieldName)) { + phoneNumber = reader.getString(); + } else if ("hashedPhoneNumber".equals(fieldName)) { + hashedPhoneNumber = reader.getString(); + } else { + reader.skipChildren(); + } + } + NumberVerificationWithoutCodeContent deserializedNumberVerificationWithoutCodeContent + = new NumberVerificationWithoutCodeContent(networkIdentifier, redirectUri); + deserializedNumberVerificationWithoutCodeContent.phoneNumber = phoneNumber; + deserializedNumberVerificationWithoutCodeContent.hashedPhoneNumber = hashedPhoneNumber; + + return deserializedNumberVerificationWithoutCodeContent; + }); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/SimSwapRetrievalContent.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/SimSwapRetrievalContent.java new file mode 100644 index 000000000000..85cb113a5cd4 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/SimSwapRetrievalContent.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Request to retrieve SimSwap date. + */ +@Fluent +public final class SimSwapRetrievalContent implements JsonSerializable { + /* + * Phone number in E.164 format (starting with country code), and optionally prefixed with '+' + */ + @Generated + private String phoneNumber; + + /* + * Network to query for this device + */ + @Generated + private final NetworkIdentifier networkIdentifier; + + /** + * Creates an instance of SimSwapRetrievalContent class. + * + * @param networkIdentifier the networkIdentifier value to set. + */ + @Generated + public SimSwapRetrievalContent(NetworkIdentifier networkIdentifier) { + this.networkIdentifier = networkIdentifier; + } + + /** + * Get the phoneNumber property: Phone number in E.164 format (starting with country code), and optionally prefixed + * with '+'. + * + * @return the phoneNumber value. + */ + @Generated + public String getPhoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: Phone number in E.164 format (starting with country code), and optionally prefixed + * with '+'. + * + * @param phoneNumber the phoneNumber value to set. + * @return the SimSwapRetrievalContent object itself. + */ + @Generated + public SimSwapRetrievalContent setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get the networkIdentifier property: Network to query for this device. + * + * @return the networkIdentifier value. + */ + @Generated + public NetworkIdentifier getNetworkIdentifier() { + return this.networkIdentifier; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("networkIdentifier", this.networkIdentifier); + jsonWriter.writeStringField("phoneNumber", this.phoneNumber); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SimSwapRetrievalContent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SimSwapRetrievalContent if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SimSwapRetrievalContent. + */ + @Generated + public static SimSwapRetrievalContent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkIdentifier networkIdentifier = null; + String phoneNumber = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("networkIdentifier".equals(fieldName)) { + networkIdentifier = NetworkIdentifier.fromJson(reader); + } else if ("phoneNumber".equals(fieldName)) { + phoneNumber = reader.getString(); + } else { + reader.skipChildren(); + } + } + SimSwapRetrievalContent deserializedSimSwapRetrievalContent + = new SimSwapRetrievalContent(networkIdentifier); + deserializedSimSwapRetrievalContent.phoneNumber = phoneNumber; + + return deserializedSimSwapRetrievalContent; + }); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/SimSwapRetrievalResult.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/SimSwapRetrievalResult.java new file mode 100644 index 000000000000..2253cea283a9 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/SimSwapRetrievalResult.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Response with SimSwap date. + */ +@Immutable +public final class SimSwapRetrievalResult implements JsonSerializable { + /* + * Datetime of most recent swap for SIM + */ + @Generated + private OffsetDateTime date; + + /** + * Creates an instance of SimSwapRetrievalResult class. + */ + @Generated + private SimSwapRetrievalResult() { + } + + /** + * Get the date property: Datetime of most recent swap for SIM. + * + * @return the date value. + */ + @Generated + public OffsetDateTime getDate() { + return this.date; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("date", + this.date == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.date)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SimSwapRetrievalResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SimSwapRetrievalResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SimSwapRetrievalResult. + */ + @Generated + public static SimSwapRetrievalResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SimSwapRetrievalResult deserializedSimSwapRetrievalResult = new SimSwapRetrievalResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("date".equals(fieldName)) { + deserializedSimSwapRetrievalResult.date = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedSimSwapRetrievalResult; + }); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/SimSwapVerificationContent.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/SimSwapVerificationContent.java new file mode 100644 index 000000000000..b088d013a1ef --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/SimSwapVerificationContent.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Request to verify SimSwap in period. + */ +@Fluent +public final class SimSwapVerificationContent implements JsonSerializable { + /* + * Phone number in E.164 format (starting with country code), and optionally prefixed with '+' + */ + @Generated + private String phoneNumber; + + /* + * Maximum lookback for SimSwap verification + */ + @Generated + private Integer maxAgeHours; + + /* + * Identifier for the network to query for this device. + */ + @Generated + private final NetworkIdentifier networkIdentifier; + + /** + * Creates an instance of SimSwapVerificationContent class. + * + * @param networkIdentifier the networkIdentifier value to set. + */ + @Generated + public SimSwapVerificationContent(NetworkIdentifier networkIdentifier) { + this.networkIdentifier = networkIdentifier; + } + + /** + * Get the phoneNumber property: Phone number in E.164 format (starting with country code), and optionally prefixed + * with '+'. + * + * @return the phoneNumber value. + */ + @Generated + public String getPhoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: Phone number in E.164 format (starting with country code), and optionally prefixed + * with '+'. + * + * @param phoneNumber the phoneNumber value to set. + * @return the SimSwapVerificationContent object itself. + */ + @Generated + public SimSwapVerificationContent setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get the maxAgeHours property: Maximum lookback for SimSwap verification. + * + * @return the maxAgeHours value. + */ + @Generated + public Integer getMaxAgeHours() { + return this.maxAgeHours; + } + + /** + * Set the maxAgeHours property: Maximum lookback for SimSwap verification. + * + * @param maxAgeHours the maxAgeHours value to set. + * @return the SimSwapVerificationContent object itself. + */ + @Generated + public SimSwapVerificationContent setMaxAgeHours(Integer maxAgeHours) { + this.maxAgeHours = maxAgeHours; + return this; + } + + /** + * Get the networkIdentifier property: Identifier for the network to query for this device. + * + * @return the networkIdentifier value. + */ + @Generated + public NetworkIdentifier getNetworkIdentifier() { + return this.networkIdentifier; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("networkIdentifier", this.networkIdentifier); + jsonWriter.writeStringField("phoneNumber", this.phoneNumber); + jsonWriter.writeNumberField("maxAgeHours", this.maxAgeHours); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SimSwapVerificationContent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SimSwapVerificationContent if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SimSwapVerificationContent. + */ + @Generated + public static SimSwapVerificationContent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkIdentifier networkIdentifier = null; + String phoneNumber = null; + Integer maxAgeHours = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("networkIdentifier".equals(fieldName)) { + networkIdentifier = NetworkIdentifier.fromJson(reader); + } else if ("phoneNumber".equals(fieldName)) { + phoneNumber = reader.getString(); + } else if ("maxAgeHours".equals(fieldName)) { + maxAgeHours = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + SimSwapVerificationContent deserializedSimSwapVerificationContent + = new SimSwapVerificationContent(networkIdentifier); + deserializedSimSwapVerificationContent.phoneNumber = phoneNumber; + deserializedSimSwapVerificationContent.maxAgeHours = maxAgeHours; + + return deserializedSimSwapVerificationContent; + }); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/SimSwapVerificationResult.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/SimSwapVerificationResult.java new file mode 100644 index 000000000000..9987f3990ee8 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/SimSwapVerificationResult.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Response verifying SimSwap in period. + */ +@Immutable +public final class SimSwapVerificationResult implements JsonSerializable { + /* + * True if the SIM has swapped in the specified period, False otherwise + */ + @Generated + private final boolean verificationResult; + + /** + * Creates an instance of SimSwapVerificationResult class. + * + * @param verificationResult the verificationResult value to set. + */ + @Generated + private SimSwapVerificationResult(boolean verificationResult) { + this.verificationResult = verificationResult; + } + + /** + * Get the verificationResult property: True if the SIM has swapped in the specified period, False otherwise. + * + * @return the verificationResult value. + */ + @Generated + public boolean isVerificationResult() { + return this.verificationResult; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("verificationResult", this.verificationResult); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SimSwapVerificationResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SimSwapVerificationResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SimSwapVerificationResult. + */ + @Generated + public static SimSwapVerificationResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean verificationResult = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("verificationResult".equals(fieldName)) { + verificationResult = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new SimSwapVerificationResult(verificationResult); + }); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/package-info.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/package-info.java new file mode 100644 index 000000000000..288d34f46075 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for ProgrammableConnectivity. + * Azure Programmable Connectivity (APC) provides a unified interface to the Network APIs of multiple Telecom Operators. + * Note that Operators may deprecate a Network API with less advance notice than the Azure standard, in which case APC + * will also deprecate that Network API. + */ +package com.azure.communication.programmableconnectivity.models; diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/package-info.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/package-info.java new file mode 100644 index 000000000000..26b99432a0dd --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/com/azure/communication/programmableconnectivity/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for ProgrammableConnectivity. + * Azure Programmable Connectivity (APC) provides a unified interface to the Network APIs of multiple Telecom Operators. + * Note that Operators may deprecate a Network API with less advance notice than the Azure standard, in which case APC + * will also deprecate that Network API. + */ +package com.azure.communication.programmableconnectivity; diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/java/module-info.java b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/module-info.java new file mode 100644 index 000000000000..d9759d5bad82 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/java/module-info.java @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +module com.azure.communication.programmableconnectivity { + requires transitive com.azure.core; + + exports com.azure.communication.programmableconnectivity; + exports com.azure.communication.programmableconnectivity.models; + + opens com.azure.communication.programmableconnectivity.models to com.azure.core; +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/resources/META-INF/azure-communication-programmableconnectivity_apiview_properties.json b/sdk/communication/azure-communication-programmableconnectivity/src/main/resources/META-INF/azure-communication-programmableconnectivity_apiview_properties.json new file mode 100644 index 000000000000..499f4c91b133 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/resources/META-INF/azure-communication-programmableconnectivity_apiview_properties.json @@ -0,0 +1,52 @@ +{ + "flavor": "azure", + "CrossLanguageDefinitionId": { + "com.azure.communication.programmableconnectivity.DeviceLocationAsyncClient": "Azure.ProgrammableConnectivity.DeviceLocation", + "com.azure.communication.programmableconnectivity.DeviceLocationAsyncClient.verify": "Azure.ProgrammableConnectivity.DeviceLocation.verify", + "com.azure.communication.programmableconnectivity.DeviceLocationAsyncClient.verifyWithResponse": "Azure.ProgrammableConnectivity.DeviceLocation.verify", + "com.azure.communication.programmableconnectivity.DeviceLocationClient": "Azure.ProgrammableConnectivity.DeviceLocation", + "com.azure.communication.programmableconnectivity.DeviceLocationClient.verify": "Azure.ProgrammableConnectivity.DeviceLocation.verify", + "com.azure.communication.programmableconnectivity.DeviceLocationClient.verifyWithResponse": "Azure.ProgrammableConnectivity.DeviceLocation.verify", + "com.azure.communication.programmableconnectivity.DeviceNetworkAsyncClient": "Azure.ProgrammableConnectivity.DeviceNetwork", + "com.azure.communication.programmableconnectivity.DeviceNetworkAsyncClient.retrieve": "Azure.ProgrammableConnectivity.DeviceNetwork.retrieve", + "com.azure.communication.programmableconnectivity.DeviceNetworkAsyncClient.retrieveWithResponse": "Azure.ProgrammableConnectivity.DeviceNetwork.retrieve", + "com.azure.communication.programmableconnectivity.DeviceNetworkClient": "Azure.ProgrammableConnectivity.DeviceNetwork", + "com.azure.communication.programmableconnectivity.DeviceNetworkClient.retrieve": "Azure.ProgrammableConnectivity.DeviceNetwork.retrieve", + "com.azure.communication.programmableconnectivity.DeviceNetworkClient.retrieveWithResponse": "Azure.ProgrammableConnectivity.DeviceNetwork.retrieve", + "com.azure.communication.programmableconnectivity.NumberVerificationAsyncClient": "Azure.ProgrammableConnectivity.NumberVerification", + "com.azure.communication.programmableconnectivity.NumberVerificationAsyncClient.verifyWithCode": "Azure.ProgrammableConnectivity.NumberVerification.verifyWithCode", + "com.azure.communication.programmableconnectivity.NumberVerificationAsyncClient.verifyWithCodeWithResponse": "Azure.ProgrammableConnectivity.NumberVerification.verifyWithCode", + "com.azure.communication.programmableconnectivity.NumberVerificationAsyncClient.verifyWithoutCode": "Azure.ProgrammableConnectivity.NumberVerification.verifyWithoutCode", + "com.azure.communication.programmableconnectivity.NumberVerificationAsyncClient.verifyWithoutCodeWithResponse": "Azure.ProgrammableConnectivity.NumberVerification.verifyWithoutCode", + "com.azure.communication.programmableconnectivity.NumberVerificationClient": "Azure.ProgrammableConnectivity.NumberVerification", + "com.azure.communication.programmableconnectivity.NumberVerificationClient.verifyWithCode": "Azure.ProgrammableConnectivity.NumberVerification.verifyWithCode", + "com.azure.communication.programmableconnectivity.NumberVerificationClient.verifyWithCodeWithResponse": "Azure.ProgrammableConnectivity.NumberVerification.verifyWithCode", + "com.azure.communication.programmableconnectivity.NumberVerificationClient.verifyWithoutCode": "Azure.ProgrammableConnectivity.NumberVerification.verifyWithoutCode", + "com.azure.communication.programmableconnectivity.NumberVerificationClient.verifyWithoutCodeWithResponse": "Azure.ProgrammableConnectivity.NumberVerification.verifyWithoutCode", + "com.azure.communication.programmableconnectivity.ProgrammableConnectivityClientBuilder": "Azure.ProgrammableConnectivity", + "com.azure.communication.programmableconnectivity.SimSwapAsyncClient": "Azure.ProgrammableConnectivity.SimSwap", + "com.azure.communication.programmableconnectivity.SimSwapAsyncClient.retrieve": "Azure.ProgrammableConnectivity.SimSwap.retrieve", + "com.azure.communication.programmableconnectivity.SimSwapAsyncClient.retrieveWithResponse": "Azure.ProgrammableConnectivity.SimSwap.retrieve", + "com.azure.communication.programmableconnectivity.SimSwapAsyncClient.verify": "Azure.ProgrammableConnectivity.SimSwap.verify", + "com.azure.communication.programmableconnectivity.SimSwapAsyncClient.verifyWithResponse": "Azure.ProgrammableConnectivity.SimSwap.verify", + "com.azure.communication.programmableconnectivity.SimSwapClient": "Azure.ProgrammableConnectivity.SimSwap", + "com.azure.communication.programmableconnectivity.SimSwapClient.retrieve": "Azure.ProgrammableConnectivity.SimSwap.retrieve", + "com.azure.communication.programmableconnectivity.SimSwapClient.retrieveWithResponse": "Azure.ProgrammableConnectivity.SimSwap.retrieve", + "com.azure.communication.programmableconnectivity.SimSwapClient.verify": "Azure.ProgrammableConnectivity.SimSwap.verify", + "com.azure.communication.programmableconnectivity.SimSwapClient.verifyWithResponse": "Azure.ProgrammableConnectivity.SimSwap.verify", + "com.azure.communication.programmableconnectivity.models.DeviceLocationVerificationContent": "Azure.ProgrammableConnectivity.DeviceLocationVerificationContent", + "com.azure.communication.programmableconnectivity.models.DeviceLocationVerificationResult": "Azure.ProgrammableConnectivity.DeviceLocationVerificationResult", + "com.azure.communication.programmableconnectivity.models.Ipv4Address": "Azure.ProgrammableConnectivity.Ipv4Address", + "com.azure.communication.programmableconnectivity.models.Ipv6Address": "Azure.ProgrammableConnectivity.Ipv6Address", + "com.azure.communication.programmableconnectivity.models.LocationDevice": "Azure.ProgrammableConnectivity.LocationDevice", + "com.azure.communication.programmableconnectivity.models.NetworkIdentifier": "Azure.ProgrammableConnectivity.NetworkIdentifier", + "com.azure.communication.programmableconnectivity.models.NetworkRetrievalResult": "Azure.ProgrammableConnectivity.NetworkRetrievalResult", + "com.azure.communication.programmableconnectivity.models.NumberVerificationResult": "Azure.ProgrammableConnectivity.NumberVerificationResult", + "com.azure.communication.programmableconnectivity.models.NumberVerificationWithCodeContent": "Azure.ProgrammableConnectivity.NumberVerificationWithCodeContent", + "com.azure.communication.programmableconnectivity.models.NumberVerificationWithoutCodeContent": "Azure.ProgrammableConnectivity.NumberVerificationWithoutCodeContent", + "com.azure.communication.programmableconnectivity.models.SimSwapRetrievalContent": "Azure.ProgrammableConnectivity.SimSwapRetrievalContent", + "com.azure.communication.programmableconnectivity.models.SimSwapRetrievalResult": "Azure.ProgrammableConnectivity.SimSwapRetrievalResult", + "com.azure.communication.programmableconnectivity.models.SimSwapVerificationContent": "Azure.ProgrammableConnectivity.SimSwapVerificationContent", + "com.azure.communication.programmableconnectivity.models.SimSwapVerificationResult": "Azure.ProgrammableConnectivity.SimSwapVerificationResult" + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/main/resources/azure-communication-programmableconnectivity.properties b/sdk/communication/azure-communication-programmableconnectivity/src/main/resources/azure-communication-programmableconnectivity.properties new file mode 100644 index 000000000000..ca812989b4f2 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/main/resources/azure-communication-programmableconnectivity.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/ReadmeSamples.java b/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/ReadmeSamples.java new file mode 100644 index 000000000000..6b09714050ad --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/ReadmeSamples.java @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity; + +public final class ReadmeSamples { + public void readmeSamples() { + // BEGIN: com.azure.communication.programmableconnectivity.readme + // END: com.azure.communication.programmableconnectivity.readme + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/generated/DeviceLocationVerify.java b/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/generated/DeviceLocationVerify.java new file mode 100644 index 000000000000..6b81b66c2bfc --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/generated/DeviceLocationVerify.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.generated; + +import com.azure.communication.programmableconnectivity.DeviceLocationClient; +import com.azure.communication.programmableconnectivity.ProgrammableConnectivityClientBuilder; +import com.azure.communication.programmableconnectivity.models.DeviceLocationVerificationContent; +import com.azure.communication.programmableconnectivity.models.DeviceLocationVerificationResult; +import com.azure.communication.programmableconnectivity.models.Ipv4Address; +import com.azure.communication.programmableconnectivity.models.Ipv6Address; +import com.azure.communication.programmableconnectivity.models.LocationDevice; +import com.azure.communication.programmableconnectivity.models.NetworkIdentifier; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class DeviceLocationVerify { + public static void main(String[] args) { + DeviceLocationClient deviceLocationClient + = new ProgrammableConnectivityClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildDeviceLocationClient(); + // BEGIN:com.azure.communication.programmableconnectivity.generated.devicelocationverify.devicelocationverify + DeviceLocationVerificationResult response = deviceLocationClient.verify("zdgrzzaxlodrvewbksn", + new DeviceLocationVerificationContent(new NetworkIdentifier("ipv4", "12.12.12.12"), 70.0, -161.0, 91, + new LocationDevice().setNetworkAccessIdentifier("122345@domain.com") + .setPhoneNumber("+447000000000") + .setIpv4Address(new Ipv4Address("12.12.12.12", 2442)) + .setIpv6Address(new Ipv6Address("3001:0da8:75a3:0000:0000:8a2e:0370:7334", 1643)))); + // END:com.azure.communication.programmableconnectivity.generated.devicelocationverify.devicelocationverify + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/generated/DeviceNetworkRetrieve.java b/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/generated/DeviceNetworkRetrieve.java new file mode 100644 index 000000000000..ca946be5a745 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/generated/DeviceNetworkRetrieve.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.generated; + +import com.azure.communication.programmableconnectivity.DeviceNetworkClient; +import com.azure.communication.programmableconnectivity.ProgrammableConnectivityClientBuilder; +import com.azure.communication.programmableconnectivity.models.NetworkIdentifier; +import com.azure.communication.programmableconnectivity.models.NetworkRetrievalResult; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class DeviceNetworkRetrieve { + public static void main(String[] args) { + DeviceNetworkClient deviceNetworkClient + = new ProgrammableConnectivityClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildDeviceNetworkClient(); + // BEGIN:com.azure.communication.programmableconnectivity.generated.devicenetworkretrieve.devicenetworkretrieve + NetworkRetrievalResult response = deviceNetworkClient.retrieve("zdgrzzaxlodrvewbksn", + new NetworkIdentifier("ipv6", "3001:0da8:75a3:0000:0000:8a2e:0370:7334")); + // END:com.azure.communication.programmableconnectivity.generated.devicenetworkretrieve.devicenetworkretrieve + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/generated/NumberVerificationVerifyWithCode.java b/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/generated/NumberVerificationVerifyWithCode.java new file mode 100644 index 000000000000..0905e75d8217 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/generated/NumberVerificationVerifyWithCode.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.generated; + +import com.azure.communication.programmableconnectivity.NumberVerificationClient; +import com.azure.communication.programmableconnectivity.ProgrammableConnectivityClientBuilder; +import com.azure.communication.programmableconnectivity.models.NumberVerificationResult; +import com.azure.communication.programmableconnectivity.models.NumberVerificationWithCodeContent; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class NumberVerificationVerifyWithCode { + public static void main(String[] args) { + NumberVerificationClient numberVerificationClient + = new ProgrammableConnectivityClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildNumberVerificationClient(); + // BEGIN:com.azure.communication.programmableconnectivity.generated.numberverificationverifywithcode.numberverificationverifywithcode + NumberVerificationResult response = numberVerificationClient.verifyWithCode("zdgrzzaxlodrvewbksn", + new NumberVerificationWithCodeContent("fakeTokenPlaceholder")); + // END:com.azure.communication.programmableconnectivity.generated.numberverificationverifywithcode.numberverificationverifywithcode + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/generated/NumberVerificationVerifyWithoutCode.java b/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/generated/NumberVerificationVerifyWithoutCode.java new file mode 100644 index 000000000000..2a3a5fdbac0e --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/generated/NumberVerificationVerifyWithoutCode.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.generated; + +import com.azure.communication.programmableconnectivity.NumberVerificationClient; +import com.azure.communication.programmableconnectivity.ProgrammableConnectivityClientBuilder; +import com.azure.communication.programmableconnectivity.models.NetworkIdentifier; +import com.azure.communication.programmableconnectivity.models.NumberVerificationWithoutCodeContent; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class NumberVerificationVerifyWithoutCode { + public static void main(String[] args) { + NumberVerificationClient numberVerificationClient + = new ProgrammableConnectivityClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildNumberVerificationClient(); + // BEGIN:com.azure.communication.programmableconnectivity.generated.numberverificationverifywithoutcode.numberverificationverifywithoutcode + numberVerificationClient.verifyWithoutCode("zdgrzzaxlodrvewbksn", + new NumberVerificationWithoutCodeContent(new NetworkIdentifier("ipv4", "12.12.12.12"), + "https://www.contoso.com").setPhoneNumber("+14424318793").setHashedPhoneNumber("bwsl")); + // END:com.azure.communication.programmableconnectivity.generated.numberverificationverifywithoutcode.numberverificationverifywithoutcode + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/generated/SimSwapRetrieve.java b/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/generated/SimSwapRetrieve.java new file mode 100644 index 000000000000..c8b1ac08cad1 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/generated/SimSwapRetrieve.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.generated; + +import com.azure.communication.programmableconnectivity.ProgrammableConnectivityClientBuilder; +import com.azure.communication.programmableconnectivity.SimSwapClient; +import com.azure.communication.programmableconnectivity.models.NetworkIdentifier; +import com.azure.communication.programmableconnectivity.models.SimSwapRetrievalContent; +import com.azure.communication.programmableconnectivity.models.SimSwapRetrievalResult; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class SimSwapRetrieve { + public static void main(String[] args) { + SimSwapClient simSwapClient + = new ProgrammableConnectivityClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildSimSwapClient(); + // BEGIN:com.azure.communication.programmableconnectivity.generated.simswapretrieve.simswapretrieve + SimSwapRetrievalResult response = simSwapClient.retrieve("zdgrzzaxlodrvewbksn", + new SimSwapRetrievalContent(new NetworkIdentifier("IPv6", "2001:0db8:85a3:0000:0000:8a2e:0370:7334")) + .setPhoneNumber("+61215310263792")); + // END:com.azure.communication.programmableconnectivity.generated.simswapretrieve.simswapretrieve + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/generated/SimSwapVerify.java b/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/generated/SimSwapVerify.java new file mode 100644 index 000000000000..38c8bf79b150 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/samples/java/com/azure/communication/programmableconnectivity/generated/SimSwapVerify.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.generated; + +import com.azure.communication.programmableconnectivity.ProgrammableConnectivityClientBuilder; +import com.azure.communication.programmableconnectivity.SimSwapClient; +import com.azure.communication.programmableconnectivity.models.NetworkIdentifier; +import com.azure.communication.programmableconnectivity.models.SimSwapVerificationContent; +import com.azure.communication.programmableconnectivity.models.SimSwapVerificationResult; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class SimSwapVerify { + public static void main(String[] args) { + SimSwapClient simSwapClient + = new ProgrammableConnectivityClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildSimSwapClient(); + // BEGIN:com.azure.communication.programmableconnectivity.generated.simswapverify.simswapverify + SimSwapVerificationResult response = simSwapClient.verify("zdgrzzaxlodrvewbksn", + new SimSwapVerificationContent(new NetworkIdentifier("ipv4", "12.12.12.12")).setMaxAgeHours(941)); + // END:com.azure.communication.programmableconnectivity.generated.simswapverify.simswapverify + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/DeviceLocationVerifyTests.java b/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/DeviceLocationVerifyTests.java new file mode 100644 index 000000000000..7e21b4e685d9 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/DeviceLocationVerifyTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.generated; + +import com.azure.communication.programmableconnectivity.models.DeviceLocationVerificationContent; +import com.azure.communication.programmableconnectivity.models.DeviceLocationVerificationResult; +import com.azure.communication.programmableconnectivity.models.Ipv4Address; +import com.azure.communication.programmableconnectivity.models.Ipv6Address; +import com.azure.communication.programmableconnectivity.models.LocationDevice; +import com.azure.communication.programmableconnectivity.models.NetworkIdentifier; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class DeviceLocationVerifyTests extends ProgrammableConnectivityClientTestBase { + @Test + @Disabled + public void testDeviceLocationVerifyTests() { + // method invocation + DeviceLocationVerificationResult response = deviceLocationClient.verify("zdgrzzaxlodrvewbksn", + new DeviceLocationVerificationContent(new NetworkIdentifier("ipv4", "12.12.12.12"), 70.0, -161.0, 91, + new LocationDevice().setNetworkAccessIdentifier("122345@domain.com") + .setPhoneNumber("+447000000000") + .setIpv4Address(new Ipv4Address("12.12.12.12", 2442)) + .setIpv6Address(new Ipv6Address("3001:0da8:75a3:0000:0000:8a2e:0370:7334", 1643)))); + + // response assertion + Assertions.assertNotNull(response); + // verify property "verificationResult" + Assertions.assertEquals(true, response.isVerificationResult()); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/DeviceNetworkRetrieveTests.java b/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/DeviceNetworkRetrieveTests.java new file mode 100644 index 000000000000..b28d230568fb --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/DeviceNetworkRetrieveTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.generated; + +import com.azure.communication.programmableconnectivity.models.NetworkIdentifier; +import com.azure.communication.programmableconnectivity.models.NetworkRetrievalResult; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class DeviceNetworkRetrieveTests extends ProgrammableConnectivityClientTestBase { + @Test + @Disabled + public void testDeviceNetworkRetrieveTests() { + // method invocation + NetworkRetrievalResult response = deviceNetworkClient.retrieve("zdgrzzaxlodrvewbksn", + new NetworkIdentifier("ipv6", "3001:0da8:75a3:0000:0000:8a2e:0370:7334")); + + // response assertion + Assertions.assertNotNull(response); + // verify property "networkCode" + Assertions.assertEquals("Example_Network", response.getNetworkCode()); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/NumberVerificationVerifyWithCodeTests.java b/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/NumberVerificationVerifyWithCodeTests.java new file mode 100644 index 000000000000..26dffe04f3ce --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/NumberVerificationVerifyWithCodeTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.generated; + +import com.azure.communication.programmableconnectivity.models.NumberVerificationResult; +import com.azure.communication.programmableconnectivity.models.NumberVerificationWithCodeContent; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class NumberVerificationVerifyWithCodeTests extends ProgrammableConnectivityClientTestBase { + @Test + @Disabled + public void testNumberVerificationVerifyWithCodeTests() { + // method invocation + NumberVerificationResult response = numberVerificationClient.verifyWithCode("zdgrzzaxlodrvewbksn", + new NumberVerificationWithCodeContent("fakeTokenPlaceholder")); + + // response assertion + Assertions.assertNotNull(response); + // verify property "verificationResult" + Assertions.assertEquals(true, response.isVerificationResult()); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/NumberVerificationVerifyWithoutCodeTests.java b/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/NumberVerificationVerifyWithoutCodeTests.java new file mode 100644 index 000000000000..bc654bf9d2c0 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/NumberVerificationVerifyWithoutCodeTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.generated; + +import com.azure.communication.programmableconnectivity.models.NetworkIdentifier; +import com.azure.communication.programmableconnectivity.models.NumberVerificationWithoutCodeContent; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class NumberVerificationVerifyWithoutCodeTests extends ProgrammableConnectivityClientTestBase { + @Test + @Disabled + public void testNumberVerificationVerifyWithoutCodeTests() { + // method invocation + numberVerificationClient.verifyWithoutCode("zdgrzzaxlodrvewbksn", + new NumberVerificationWithoutCodeContent(new NetworkIdentifier("ipv4", "12.12.12.12"), + "https://www.contoso.com").setPhoneNumber("+14424318793").setHashedPhoneNumber("bwsl")); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/ProgrammableConnectivityClientTestBase.java b/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/ProgrammableConnectivityClientTestBase.java new file mode 100644 index 000000000000..42df67d391a4 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/ProgrammableConnectivityClientTestBase.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.communication.programmableconnectivity.DeviceLocationClient; +import com.azure.communication.programmableconnectivity.DeviceNetworkClient; +import com.azure.communication.programmableconnectivity.NumberVerificationClient; +import com.azure.communication.programmableconnectivity.ProgrammableConnectivityClientBuilder; +import com.azure.communication.programmableconnectivity.SimSwapClient; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.test.utils.MockTokenCredential; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +class ProgrammableConnectivityClientTestBase extends TestProxyTestBase { + protected DeviceLocationClient deviceLocationClient; + + protected DeviceNetworkClient deviceNetworkClient; + + protected NumberVerificationClient numberVerificationClient; + + protected SimSwapClient simSwapClient; + + @Override + protected void beforeTest() { + ProgrammableConnectivityClientBuilder deviceLocationClientbuilder = new ProgrammableConnectivityClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + deviceLocationClientbuilder.credential(new MockTokenCredential()); + } else if (getTestMode() == TestMode.RECORD) { + deviceLocationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + deviceLocationClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + deviceLocationClient = deviceLocationClientbuilder.buildDeviceLocationClient(); + + ProgrammableConnectivityClientBuilder deviceNetworkClientbuilder = new ProgrammableConnectivityClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + deviceNetworkClientbuilder.credential(new MockTokenCredential()); + } else if (getTestMode() == TestMode.RECORD) { + deviceNetworkClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + deviceNetworkClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + deviceNetworkClient = deviceNetworkClientbuilder.buildDeviceNetworkClient(); + + ProgrammableConnectivityClientBuilder numberVerificationClientbuilder + = new ProgrammableConnectivityClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + numberVerificationClientbuilder.credential(new MockTokenCredential()); + } else if (getTestMode() == TestMode.RECORD) { + numberVerificationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + numberVerificationClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + numberVerificationClient = numberVerificationClientbuilder.buildNumberVerificationClient(); + + ProgrammableConnectivityClientBuilder simSwapClientbuilder = new ProgrammableConnectivityClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + simSwapClientbuilder.credential(new MockTokenCredential()); + } else if (getTestMode() == TestMode.RECORD) { + simSwapClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + simSwapClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + simSwapClient = simSwapClientbuilder.buildSimSwapClient(); + + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/SimSwapRetrieveTests.java b/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/SimSwapRetrieveTests.java new file mode 100644 index 000000000000..67bf23e5b14f --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/SimSwapRetrieveTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.generated; + +import com.azure.communication.programmableconnectivity.models.NetworkIdentifier; +import com.azure.communication.programmableconnectivity.models.SimSwapRetrievalContent; +import com.azure.communication.programmableconnectivity.models.SimSwapRetrievalResult; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class SimSwapRetrieveTests extends ProgrammableConnectivityClientTestBase { + @Test + @Disabled + public void testSimSwapRetrieveTests() { + // method invocation + SimSwapRetrievalResult response = simSwapClient.retrieve("zdgrzzaxlodrvewbksn", + new SimSwapRetrievalContent(new NetworkIdentifier("IPv6", "2001:0db8:85a3:0000:0000:8a2e:0370:7334")) + .setPhoneNumber("+61215310263792")); + + // response assertion + Assertions.assertNotNull(response); + // verify property "date" + Assertions.assertNotNull(response.getDate()); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/SimSwapVerifyTests.java b/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/SimSwapVerifyTests.java new file mode 100644 index 000000000000..d69efd5b63e3 --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/src/test/java/com/azure/communication/programmableconnectivity/generated/SimSwapVerifyTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.communication.programmableconnectivity.generated; + +import com.azure.communication.programmableconnectivity.models.NetworkIdentifier; +import com.azure.communication.programmableconnectivity.models.SimSwapVerificationContent; +import com.azure.communication.programmableconnectivity.models.SimSwapVerificationResult; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class SimSwapVerifyTests extends ProgrammableConnectivityClientTestBase { + @Test + @Disabled + public void testSimSwapVerifyTests() { + // method invocation + SimSwapVerificationResult response = simSwapClient.verify("zdgrzzaxlodrvewbksn", + new SimSwapVerificationContent(new NetworkIdentifier("ipv4", "12.12.12.12")).setMaxAgeHours(941)); + + // response assertion + Assertions.assertNotNull(response); + // verify property "verificationResult" + Assertions.assertEquals(true, response.isVerificationResult()); + } +} diff --git a/sdk/communication/azure-communication-programmableconnectivity/tsp-location.yaml b/sdk/communication/azure-communication-programmableconnectivity/tsp-location.yaml new file mode 100644 index 000000000000..531fac16facf --- /dev/null +++ b/sdk/communication/azure-communication-programmableconnectivity/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/programmableconnectivity/Azure.ProgrammableConnectivity +commit: 541a42e3027d36ed7011d6ed61dd270de87a0b2d +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/communication/ci.yml b/sdk/communication/ci.yml new file mode 100644 index 000000000000..b9f247ccb43a --- /dev/null +++ b/sdk/communication/ci.yml @@ -0,0 +1,46 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/communication/ci.yml + - sdk/communication/azure-communication-programmableconnectivity/ + exclude: + - sdk/communication/pom.xml + - sdk/communication/azure-communication-programmableconnectivity/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/communication/ci.yml + - sdk/communication/azure-communication-programmableconnectivity/ + exclude: + - sdk/communication/pom.xml + - sdk/communication/azure-communication-programmableconnectivity/pom.xml + +parameters: + - name: release_azurecommunicationprogrammableconnectivity + displayName: azure-communication-programmableconnectivity + type: boolean + default: true + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: communication + Artifacts: + - name: azure-communication-programmableconnectivity + groupId: com.azure + safeName: azurecommunicationprogrammableconnectivity + releaseInBatch: ${{ parameters.release_azurecommunicationprogrammableconnectivity }} diff --git a/sdk/communication/pom.xml b/sdk/communication/pom.xml index b3834304553d..fa205686b300 100644 --- a/sdk/communication/pom.xml +++ b/sdk/communication/pom.xml @@ -10,18 +10,19 @@ 1.0.0 - azure-communication-callingserver - azure-communication-callautomation - azure-communication-chat - azure-communication-common - azure-communication-email - azure-communication-identity - azure-communication-phonenumbers - azure-communication-sms - azure-communication-rooms - azure-resourcemanager-communication - azure-communication-common-perf - azure-communication-jobrouter - azure-communication-messages + azure-communication-callautomation + azure-communication-callingserver + azure-communication-chat + azure-communication-common + azure-communication-common-perf + azure-communication-email + azure-communication-identity + azure-communication-jobrouter + azure-communication-messages + azure-communication-phonenumbers + azure-communication-programmableconnectivity + azure-communication-rooms + azure-communication-sms + azure-resourcemanager-communication