Skip to content

Latest commit

 

History

History
177 lines (131 loc) · 4.44 KB

locations.md

File metadata and controls

177 lines (131 loc) · 4.44 KB

Locations

ILocationsApi locationsApi = client.LocationsApi;

Class Name

LocationsApi

Methods

List Locations

Provides information of all locations of a business.

Most other Connect API endpoints have a required location_id path parameter. The id field of the Location objects returned by this endpoint correspond to that location_id parameter.

ListLocationsAsync()

Response Type

Task<Models.ListLocationsResponse>

Example Usage

try
{
    ListLocationsResponse result = await locationsApi.ListLocationsAsync();
}
catch (ApiException e){};

Create Location

Creates a location. For more information about locations, see Locations API Overview.

CreateLocationAsync(Models.CreateLocationRequest body)

Parameters

Parameter Type Tags Description
body Models.CreateLocationRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

Task<Models.CreateLocationResponse>

Example Usage

var bodyLocationAddress = new Address.Builder()
    .AddressLine1("1234 Peachtree St. NE")
    .Locality("Atlanta")
    .AdministrativeDistrictLevel1("GA")
    .PostalCode("30309")
    .Build();
var bodyLocation = new Location.Builder()
    .Name("New location name")
    .Address(bodyLocationAddress)
    .Description("My new location.")
    .Build();
var body = new CreateLocationRequest.Builder()
    .Location(bodyLocation)
    .Build();

try
{
    CreateLocationResponse result = await locationsApi.CreateLocationAsync(body);
}
catch (ApiException e){};

Retrieve Location

Retrieves details of a location.

RetrieveLocationAsync(string locationId)

Parameters

Parameter Type Tags Description
locationId string Template, Required The ID of the location to retrieve.

Response Type

Task<Models.RetrieveLocationResponse>

Example Usage

string locationId = "location_id4";

try
{
    RetrieveLocationResponse result = await locationsApi.RetrieveLocationAsync(locationId);
}
catch (ApiException e){};

Update Location

Updates a location.

UpdateLocationAsync(string locationId, Models.UpdateLocationRequest body)

Parameters

Parameter Type Tags Description
locationId string Template, Required The ID of the location to update.
body Models.UpdateLocationRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

Task<Models.UpdateLocationResponse>

Example Usage

string locationId = "location_id4";
var bodyLocationAddress = new Address.Builder()
    .AddressLine1("1234 Peachtree St. NE")
    .Locality("Atlanta")
    .AdministrativeDistrictLevel1("GA")
    .PostalCode("30309")
    .Build();
var bodyLocationBusinessHoursPeriods = new List<BusinessHoursPeriod>();

var bodyLocationBusinessHoursPeriods0 = new BusinessHoursPeriod.Builder()
    .DayOfWeek("MON")
    .StartLocalTime("09:00")
    .EndLocalTime("17:00")
    .Build();
bodyLocationBusinessHoursPeriods.Add(bodyLocationBusinessHoursPeriods0);

var bodyLocationBusinessHours = new BusinessHours.Builder()
    .Periods(bodyLocationBusinessHoursPeriods)
    .Build();
var bodyLocation = new Location.Builder()
    .Name("Updated nickname")
    .Address(bodyLocationAddress)
    .BusinessHours(bodyLocationBusinessHours)
    .Description("Updated description")
    .TwitterUsername("twitter")
    .InstagramUsername("instagram")
    .Build();
var body = new UpdateLocationRequest.Builder()
    .Location(bodyLocation)
    .Build();

try
{
    UpdateLocationResponse result = await locationsApi.UpdateLocationAsync(locationId, body);
}
catch (ApiException e){};