Skip to content

Latest commit

 

History

History
561 lines (422 loc) · 20.6 KB

booking-custom-attributes.md

File metadata and controls

561 lines (422 loc) · 20.6 KB

Booking Custom Attributes

IBookingCustomAttributesApi bookingCustomAttributesApi = client.BookingCustomAttributesApi;

Class Name

BookingCustomAttributesApi

Methods

List Booking Custom Attribute Definitions

Get all bookings custom attribute definitions.

To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_READ and APPOINTMENTS_READ for the OAuth scope.

ListBookingCustomAttributeDefinitionsAsync(
    int? limit = null,
    string cursor = null)

Parameters

Parameter Type Tags Description
limit int? Query, Optional The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see Pagination.
cursor string Query, Optional The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request.
For more information, see Pagination.

Response Type

Task<Models.ListBookingCustomAttributeDefinitionsResponse>

Example Usage

try
{
    ListBookingCustomAttributeDefinitionsResponse result = await bookingCustomAttributesApi.ListBookingCustomAttributeDefinitionsAsync();
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Create Booking Custom Attribute Definition

Creates a bookings custom attribute definition.

To call this endpoint with buyer-level permissions, set APPOINTMENTS_WRITE for the OAuth scope. To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_WRITE and APPOINTMENTS_WRITE for the OAuth scope.

For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.

CreateBookingCustomAttributeDefinitionAsync(
    Models.CreateBookingCustomAttributeDefinitionRequest body)

Parameters

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

See the corresponding object definition for field details.

Response Type

Task<Models.CreateBookingCustomAttributeDefinitionResponse>

Example Usage

CreateBookingCustomAttributeDefinitionRequest body = new CreateBookingCustomAttributeDefinitionRequest.Builder(
    new CustomAttributeDefinition.Builder()
    .Build()
)
.Build();

try
{
    CreateBookingCustomAttributeDefinitionResponse result = await bookingCustomAttributesApi.CreateBookingCustomAttributeDefinitionAsync(body);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Delete Booking Custom Attribute Definition

Deletes a bookings custom attribute definition.

To call this endpoint with buyer-level permissions, set APPOINTMENTS_WRITE for the OAuth scope. To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_WRITE and APPOINTMENTS_WRITE for the OAuth scope.

For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.

DeleteBookingCustomAttributeDefinitionAsync(
    string key)

Parameters

Parameter Type Tags Description
key string Template, Required The key of the custom attribute definition to delete.

Response Type

Task<Models.DeleteBookingCustomAttributeDefinitionResponse>

Example Usage

string key = "key0";
try
{
    DeleteBookingCustomAttributeDefinitionResponse result = await bookingCustomAttributesApi.DeleteBookingCustomAttributeDefinitionAsync(key);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Retrieve Booking Custom Attribute Definition

Retrieves a bookings custom attribute definition.

To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_READ and APPOINTMENTS_READ for the OAuth scope.

RetrieveBookingCustomAttributeDefinitionAsync(
    string key,
    int? version = null)

Parameters

Parameter Type Tags Description
key string Template, Required The key of the custom attribute definition to retrieve. If the requesting application
is not the definition owner, you must use the qualified key.
version int? Query, Optional The current version of the custom attribute definition, which is used for strongly consistent
reads to guarantee that you receive the most up-to-date data. When included in the request,
Square returns the specified version or a higher version if one exists. If the specified version
is higher than the current version, Square returns a BAD_REQUEST error.

Response Type

Task<Models.RetrieveBookingCustomAttributeDefinitionResponse>

Example Usage

string key = "key0";
try
{
    RetrieveBookingCustomAttributeDefinitionResponse result = await bookingCustomAttributesApi.RetrieveBookingCustomAttributeDefinitionAsync(key);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Update Booking Custom Attribute Definition

Updates a bookings custom attribute definition.

To call this endpoint with buyer-level permissions, set APPOINTMENTS_WRITE for the OAuth scope. To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_WRITE and APPOINTMENTS_WRITE for the OAuth scope.

For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.

UpdateBookingCustomAttributeDefinitionAsync(
    string key,
    Models.UpdateBookingCustomAttributeDefinitionRequest body)

Parameters

Parameter Type Tags Description
key string Template, Required The key of the custom attribute definition to update.
body UpdateBookingCustomAttributeDefinitionRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

Task<Models.UpdateBookingCustomAttributeDefinitionResponse>

Example Usage

string key = "key0";
UpdateBookingCustomAttributeDefinitionRequest body = new UpdateBookingCustomAttributeDefinitionRequest.Builder(
    new CustomAttributeDefinition.Builder()
    .Build()
)
.Build();

try
{
    UpdateBookingCustomAttributeDefinitionResponse result = await bookingCustomAttributesApi.UpdateBookingCustomAttributeDefinitionAsync(
        key,
        body
    );
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Bulk Delete Booking Custom Attributes

Bulk deletes bookings custom attributes.

To call this endpoint with buyer-level permissions, set APPOINTMENTS_WRITE for the OAuth scope. To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_WRITE and APPOINTMENTS_WRITE for the OAuth scope.

For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.

BulkDeleteBookingCustomAttributesAsync(
    Models.BulkDeleteBookingCustomAttributesRequest body)

Parameters

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

See the corresponding object definition for field details.

Response Type

Task<Models.BulkDeleteBookingCustomAttributesResponse>

Example Usage

BulkDeleteBookingCustomAttributesRequest body = new BulkDeleteBookingCustomAttributesRequest.Builder(
    new Dictionary<string, BookingCustomAttributeDeleteRequest>
    {
        ["key0"] = new BookingCustomAttributeDeleteRequest.Builder(
            "booking_id4",
            "key0"
        )
        .Build(),
        ["key1"] = new BookingCustomAttributeDeleteRequest.Builder(
            "booking_id4",
            "key0"
        )
        .Build(),
    }
)
.Build();

try
{
    BulkDeleteBookingCustomAttributesResponse result = await bookingCustomAttributesApi.BulkDeleteBookingCustomAttributesAsync(body);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Bulk Upsert Booking Custom Attributes

Bulk upserts bookings custom attributes.

To call this endpoint with buyer-level permissions, set APPOINTMENTS_WRITE for the OAuth scope. To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_WRITE and APPOINTMENTS_WRITE for the OAuth scope.

For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.

BulkUpsertBookingCustomAttributesAsync(
    Models.BulkUpsertBookingCustomAttributesRequest body)

Parameters

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

See the corresponding object definition for field details.

Response Type

Task<Models.BulkUpsertBookingCustomAttributesResponse>

Example Usage

BulkUpsertBookingCustomAttributesRequest body = new BulkUpsertBookingCustomAttributesRequest.Builder(
    new Dictionary<string, BookingCustomAttributeUpsertRequest>
    {
        ["key0"] = new BookingCustomAttributeUpsertRequest.Builder(
            "booking_id4",
            new CustomAttribute.Builder()
            .Build()
        )
        .Build(),
        ["key1"] = new BookingCustomAttributeUpsertRequest.Builder(
            "booking_id4",
            new CustomAttribute.Builder()
            .Build()
        )
        .Build(),
    }
)
.Build();

try
{
    BulkUpsertBookingCustomAttributesResponse result = await bookingCustomAttributesApi.BulkUpsertBookingCustomAttributesAsync(body);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

List Booking Custom Attributes

Lists a booking's custom attributes.

To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_READ and APPOINTMENTS_READ for the OAuth scope.

ListBookingCustomAttributesAsync(
    string bookingId,
    int? limit = null,
    string cursor = null,
    bool? withDefinitions = false)

Parameters

Parameter Type Tags Description
bookingId string Template, Required The ID of the target booking.
limit int? Query, Optional The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see Pagination.
cursor string Query, Optional The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request. For more
information, see Pagination.
withDefinitions bool? Query, Optional Indicates whether to return the custom attribute definition in the definition field of each
custom attribute. Set this parameter to true to get the name and description of each custom
attribute, information about the data type, or other definition details. The default value is false.
Default: false

Response Type

Task<Models.ListBookingCustomAttributesResponse>

Example Usage

string bookingId = "booking_id4";
bool? withDefinitions = false;
try
{
    ListBookingCustomAttributesResponse result = await bookingCustomAttributesApi.ListBookingCustomAttributesAsync(
        bookingId,
        null,
        null,
        withDefinitions
    );
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Delete Booking Custom Attribute

Deletes a bookings custom attribute.

To call this endpoint with buyer-level permissions, set APPOINTMENTS_WRITE for the OAuth scope. To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_WRITE and APPOINTMENTS_WRITE for the OAuth scope.

For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.

DeleteBookingCustomAttributeAsync(
    string bookingId,
    string key)

Parameters

Parameter Type Tags Description
bookingId string Template, Required The ID of the target booking.
key string Template, Required The key of the custom attribute to delete. This key must match the key of a custom
attribute definition in the Square seller account. If the requesting application is not the
definition owner, you must use the qualified key.

Response Type

Task<Models.DeleteBookingCustomAttributeResponse>

Example Usage

string bookingId = "booking_id4";
string key = "key0";
try
{
    DeleteBookingCustomAttributeResponse result = await bookingCustomAttributesApi.DeleteBookingCustomAttributeAsync(
        bookingId,
        key
    );
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Retrieve Booking Custom Attribute

Retrieves a bookings custom attribute.

To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_READ and APPOINTMENTS_READ for the OAuth scope.

RetrieveBookingCustomAttributeAsync(
    string bookingId,
    string key,
    bool? withDefinition = false,
    int? version = null)

Parameters

Parameter Type Tags Description
bookingId string Template, Required The ID of the target booking.
key string Template, Required The key of the custom attribute to retrieve. This key must match the key of a custom
attribute definition in the Square seller account. If the requesting application is not the
definition owner, you must use the qualified key.
withDefinition bool? Query, Optional Indicates whether to return the custom attribute definition in the definition field of
the custom attribute. Set this parameter to true to get the name and description of the custom
attribute, information about the data type, or other definition details. The default value is false.
Default: false
version int? Query, Optional The current version of the custom attribute, which is used for strongly consistent reads to
guarantee that you receive the most up-to-date data. When included in the request, Square
returns the specified version or a higher version if one exists. If the specified version is
higher than the current version, Square returns a BAD_REQUEST error.

Response Type

Task<Models.RetrieveBookingCustomAttributeResponse>

Example Usage

string bookingId = "booking_id4";
string key = "key0";
bool? withDefinition = false;
try
{
    RetrieveBookingCustomAttributeResponse result = await bookingCustomAttributesApi.RetrieveBookingCustomAttributeAsync(
        bookingId,
        key,
        withDefinition
    );
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Upsert Booking Custom Attribute

Upserts a bookings custom attribute.

To call this endpoint with buyer-level permissions, set APPOINTMENTS_WRITE for the OAuth scope. To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_WRITE and APPOINTMENTS_WRITE for the OAuth scope.

For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.

UpsertBookingCustomAttributeAsync(
    string bookingId,
    string key,
    Models.UpsertBookingCustomAttributeRequest body)

Parameters

Parameter Type Tags Description
bookingId string Template, Required The ID of the target booking.
key string Template, Required The key of the custom attribute to create or update. This key must match the key of a
custom attribute definition in the Square seller account. If the requesting application is not
the definition owner, you must use the qualified key.
body UpsertBookingCustomAttributeRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

Task<Models.UpsertBookingCustomAttributeResponse>

Example Usage

string bookingId = "booking_id4";
string key = "key0";
UpsertBookingCustomAttributeRequest body = new UpsertBookingCustomAttributeRequest.Builder(
    new CustomAttribute.Builder()
    .Build()
)
.Build();

try
{
    UpsertBookingCustomAttributeResponse result = await bookingCustomAttributesApi.UpsertBookingCustomAttributeAsync(
        bookingId,
        key,
        body
    );
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}