次の方法で共有


DeviceLocation.VerifyAsync Method

Definition

Overloads

VerifyAsync(String, DeviceLocationVerificationContent, CancellationToken)

Verifies whether a device is within a specified location area, defined as an accuracy (radius) around a point, specified by longitude and latitude.

VerifyAsync(String, RequestContent, RequestContext)

[Protocol Method] Verifies whether a device is within a specified location area, defined as an accuracy (radius) around a point, specified by longitude and latitude.

VerifyAsync(String, DeviceLocationVerificationContent, CancellationToken)

Source:
DeviceLocation.cs

Verifies whether a device is within a specified location area, defined as an accuracy (radius) around a point, specified by longitude and latitude.

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

Parameters

apcGatewayId
String

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

deviceLocationVerificationContent
DeviceLocationVerificationContent

Request to verify Location.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

apcGatewayId or deviceLocationVerificationContent is null.

Examples

This sample shows how to call VerifyAsync.

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

DeviceLocationVerificationContent deviceLocationVerificationContent = new DeviceLocationVerificationContent(new NetworkIdentifier("<identifierType>", "<identifier>"), 123.45, 123.45, 1234, new LocationDevice());
Response<DeviceLocationVerificationResult> response = await client.VerifyAsync("<apcGatewayId>", deviceLocationVerificationContent);

This sample shows how to call VerifyAsync with all parameters.

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

DeviceLocationVerificationContent deviceLocationVerificationContent = new DeviceLocationVerificationContent(new NetworkIdentifier("<identifierType>", "<identifier>"), 123.45, 123.45, 1234, new LocationDevice
{
    NetworkAccessIdentifier = "<networkAccessIdentifier>",
    PhoneNumber = "<phoneNumber>",
    Ipv4Address = new Ipv4Address("<ipv4>", 1234),
    Ipv6Address = new Ipv6Address("<ipv6>", 1234),
});
Response<DeviceLocationVerificationResult> response = await client.VerifyAsync("<apcGatewayId>", deviceLocationVerificationContent);

Applies to

VerifyAsync(String, RequestContent, RequestContext)

Source:
DeviceLocation.cs

[Protocol Method] Verifies whether a device is within a specified location area, defined as an accuracy (radius) around a point, specified by longitude and latitude.

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();
DeviceLocation client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceLocationClient(apiVersion: "2024-02-09-preview");

using RequestContent content = RequestContent.Create(new
{
    networkIdentifier = new
    {
        identifierType = "<identifierType>",
        identifier = "<identifier>",
    },
    latitude = 123.45,
    longitude = 123.45,
    accuracy = 1234,
    device = new object(),
});
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();
DeviceLocation client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceLocationClient(apiVersion: "2024-02-09-preview");

using RequestContent content = RequestContent.Create(new
{
    networkIdentifier = new
    {
        identifierType = "<identifierType>",
        identifier = "<identifier>",
    },
    latitude = 123.45,
    longitude = 123.45,
    accuracy = 1234,
    device = new
    {
        networkAccessIdentifier = "<networkAccessIdentifier>",
        phoneNumber = "<phoneNumber>",
        ipv4Address = new
        {
            ipv4 = "<ipv4>",
            port = 1234,
        },
        ipv6Address = new
        {
            ipv6 = "<ipv6>",
            port = 1234,
        },
    },
});
Response response = await client.VerifyAsync("<apcGatewayId>", content);

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

Applies to