Share via


SimSwap.VerifyAsync Method

Definition

Overloads

VerifyAsync(String, SimSwapVerificationContent, CancellationToken)

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.

VerifyAsync(String, RequestContent, RequestContext)

[Protocol Method] 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.

VerifyAsync(String, SimSwapVerificationContent, CancellationToken)

Source:
SimSwap.cs

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.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.ProgrammableConnectivity.SimSwapVerificationResult>> VerifyAsync (string apcGatewayId, Azure.Communication.ProgrammableConnectivity.SimSwapVerificationContent simSwapVerificationContent, System.Threading.CancellationToken cancellationToken = default);
abstract member VerifyAsync : string * Azure.Communication.ProgrammableConnectivity.SimSwapVerificationContent * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Communication.ProgrammableConnectivity.SimSwapVerificationResult>>
override this.VerifyAsync : string * Azure.Communication.ProgrammableConnectivity.SimSwapVerificationContent * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Communication.ProgrammableConnectivity.SimSwapVerificationResult>>
Public Overridable Function VerifyAsync (apcGatewayId As String, simSwapVerificationContent As SimSwapVerificationContent, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of SimSwapVerificationResult))

Parameters

apcGatewayId
String

The identifier of the APC Gateway resource which should handle this request.

simSwapVerificationContent
SimSwapVerificationContent

Request to verify SimSwap in period.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

apcGatewayId or simSwapVerificationContent is null.

Examples

This sample shows how to call VerifyAsync.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "2024-02-09-preview");

SimSwapVerificationContent simSwapVerificationContent = new SimSwapVerificationContent(new NetworkIdentifier("<identifierType>", "<identifier>"));
Response<SimSwapVerificationResult> response = await client.VerifyAsync("<apcGatewayId>", simSwapVerificationContent);

This sample shows how to call VerifyAsync with all parameters.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "2024-02-09-preview");

SimSwapVerificationContent simSwapVerificationContent = new SimSwapVerificationContent(new NetworkIdentifier("<identifierType>", "<identifier>"))
{
    PhoneNumber = "<phoneNumber>",
    MaxAgeHours = 1234,
};
Response<SimSwapVerificationResult> response = await client.VerifyAsync("<apcGatewayId>", simSwapVerificationContent);

Applies to

VerifyAsync(String, RequestContent, RequestContext)

Source:
SimSwap.cs

[Protocol Method] 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.

public virtual System.Threading.Tasks.Task<Azure.Response> VerifyAsync (string apcGatewayId, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member VerifyAsync : string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.VerifyAsync : string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function VerifyAsync (apcGatewayId As String, content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Response)

Parameters

apcGatewayId
String

The identifier of the APC Gateway resource which should handle this request.

content
RequestContent

The content to send as the body of the request.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

apcGatewayId or content is null.

Service returned a non-success status code.

Examples

This sample shows how to call VerifyAsync and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "2024-02-09-preview");

using RequestContent content = RequestContent.Create(new
{
    networkIdentifier = new
    {
        identifierType = "<identifierType>",
        identifier = "<identifier>",
    },
});
Response response = await client.VerifyAsync("<apcGatewayId>", content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("verificationResult").ToString());

This sample shows how to call VerifyAsync with all parameters and request content and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "2024-02-09-preview");

using RequestContent content = RequestContent.Create(new
{
    phoneNumber = "<phoneNumber>",
    maxAgeHours = 1234,
    networkIdentifier = new
    {
        identifierType = "<identifierType>",
        identifier = "<identifier>",
    },
});
Response response = await client.VerifyAsync("<apcGatewayId>", content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("verificationResult").ToString());

Applies to