טיפול בספריות לקוח ל-תיקוף של ה-API

בדף הזה מוסבר איך להתחיל לעבוד עם ספריות הלקוח של Address Validation API.

מידע נוסף על ספריות הלקוח זמין במאמר הסבר על ספריות לקוח.

התקנת ספריית הלקוח

C#

למידע נוסף, ראו הגדרת סביבת פיתוח C#.

Install-Package Google.Maps.AddressValidation.V1 -Pre

הגדרת אימות

כשמשתמשים בספריות לקוח, צריך להשתמש ב-Application Default Credentials (ADC) כדי לבצע את האימות. במאמר איך מספקים פרטי כניסה ל-Application Default Credentials מוסבר איך מגדירים את ADC. במאמר אימות באמצעות ספריות לקוח תוכלו לקרוא מידע נוסף על השימוש ב-ADC עם ספריות לקוח.

שימוש בספריית הלקוח

C#

using Google.Maps.AddressValidation.V1;
using Google.Type;
using System.Threading.Tasks;

public sealed partial class GeneratedAddressValidationClientSnippets
{
    /// <summary>Snippet for ValidateAddressAsync</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public async Task ValidateAddressRequestObjectAsync()
    {
        // Create client
        AddressValidationClient addressValidationClient = await AddressValidationClient.CreateAsync();
        // Initialize request argument(s)
        ValidateAddressRequest request = new ValidateAddressRequest
        {
            Address = new PostalAddress(),
            PreviousResponseId = "",
            EnableUspsCass = false,
            SessionToken = "",
        };
        // Make the request
        ValidateAddressResponse response = await addressValidationClient.ValidateAddressAsync(request);
    }
}

מקורות מידע נוספים