Skip to content

Latest commit

 

History

History
534 lines (390 loc) · 21.9 KB

booking-custom-attributes.md

File metadata and controls

534 lines (390 loc) · 21.9 KB

Booking Custom Attributes

BookingCustomAttributesApi bookingCustomAttributesApi = client.getBookingCustomAttributesApi();

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.

CompletableFuture<ListBookingCustomAttributeDefinitionsResponse> listBookingCustomAttributeDefinitionsAsync(
    final Integer limit,
    final String cursor)

Parameters

Parameter Type Tags Description
limit Integer 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

ListBookingCustomAttributeDefinitionsResponse

Example Usage

bookingCustomAttributesApi.listBookingCustomAttributeDefinitionsAsync(null, null).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    // TODO failure callback handler
    exception.printStackTrace();
    return null;
});

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.

CompletableFuture<CreateBookingCustomAttributeDefinitionResponse> createBookingCustomAttributeDefinitionAsync(
    final 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

CreateBookingCustomAttributeDefinitionResponse

Example Usage

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

bookingCustomAttributesApi.createBookingCustomAttributeDefinitionAsync(body).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    // TODO failure callback handler
    exception.printStackTrace();
    return null;
});

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.

CompletableFuture<DeleteBookingCustomAttributeDefinitionResponse> deleteBookingCustomAttributeDefinitionAsync(
    final String key)

Parameters

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

Response Type

DeleteBookingCustomAttributeDefinitionResponse

Example Usage

String key = "key0";

bookingCustomAttributesApi.deleteBookingCustomAttributeDefinitionAsync(key).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    // TODO failure callback handler
    exception.printStackTrace();
    return null;
});

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.

CompletableFuture<RetrieveBookingCustomAttributeDefinitionResponse> retrieveBookingCustomAttributeDefinitionAsync(
    final String key,
    final Integer version)

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 Integer 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

RetrieveBookingCustomAttributeDefinitionResponse

Example Usage

String key = "key0";

bookingCustomAttributesApi.retrieveBookingCustomAttributeDefinitionAsync(key, null).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    // TODO failure callback handler
    exception.printStackTrace();
    return null;
});

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.

CompletableFuture<UpdateBookingCustomAttributeDefinitionResponse> updateBookingCustomAttributeDefinitionAsync(
    final String key,
    final 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

UpdateBookingCustomAttributeDefinitionResponse

Example Usage

String key = "key0";
UpdateBookingCustomAttributeDefinitionRequest body = new UpdateBookingCustomAttributeDefinitionRequest.Builder(
    new CustomAttributeDefinition.Builder()
        .build()
)
.build();

bookingCustomAttributesApi.updateBookingCustomAttributeDefinitionAsync(key, body).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    // TODO failure callback handler
    exception.printStackTrace();
    return null;
});

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.

CompletableFuture<BulkDeleteBookingCustomAttributesResponse> bulkDeleteBookingCustomAttributesAsync(
    final 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

BulkDeleteBookingCustomAttributesResponse

Example Usage

BulkDeleteBookingCustomAttributesRequest body = new BulkDeleteBookingCustomAttributesRequest.Builder(
    new LinkedHashMap<String, BookingCustomAttributeDeleteRequest>() {{
        put("key0", new BookingCustomAttributeDeleteRequest.Builder(
            "booking_id4",
            "key0"
        )
        .build());
        put("key1", new BookingCustomAttributeDeleteRequest.Builder(
            "booking_id4",
            "key0"
        )
        .build());
    }}
)
.build();

bookingCustomAttributesApi.bulkDeleteBookingCustomAttributesAsync(body).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    // TODO failure callback handler
    exception.printStackTrace();
    return null;
});

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.

CompletableFuture<BulkUpsertBookingCustomAttributesResponse> bulkUpsertBookingCustomAttributesAsync(
    final 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

BulkUpsertBookingCustomAttributesResponse

Example Usage

BulkUpsertBookingCustomAttributesRequest body = new BulkUpsertBookingCustomAttributesRequest.Builder(
    new LinkedHashMap<String, BookingCustomAttributeUpsertRequest>() {{
        put("key0", new BookingCustomAttributeUpsertRequest.Builder(
            "booking_id4",
            new CustomAttribute.Builder()
                .build()
        )
        .build());
        put("key1", new BookingCustomAttributeUpsertRequest.Builder(
            "booking_id4",
            new CustomAttribute.Builder()
                .build()
        )
        .build());
    }}
)
.build();

bookingCustomAttributesApi.bulkUpsertBookingCustomAttributesAsync(body).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    // TODO failure callback handler
    exception.printStackTrace();
    return null;
});

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.

CompletableFuture<ListBookingCustomAttributesResponse> listBookingCustomAttributesAsync(
    final String bookingId,
    final Integer limit,
    final String cursor,
    final Boolean withDefinitions)

Parameters

Parameter Type Tags Description
bookingId String Template, Required The ID of the target booking.
limit Integer 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 Boolean 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

ListBookingCustomAttributesResponse

Example Usage

String bookingId = "booking_id4";
Boolean withDefinitions = false;

bookingCustomAttributesApi.listBookingCustomAttributesAsync(bookingId, null, null, withDefinitions).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    // TODO failure callback handler
    exception.printStackTrace();
    return null;
});

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.

CompletableFuture<DeleteBookingCustomAttributeResponse> deleteBookingCustomAttributeAsync(
    final String bookingId,
    final 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

DeleteBookingCustomAttributeResponse

Example Usage

String bookingId = "booking_id4";
String key = "key0";

bookingCustomAttributesApi.deleteBookingCustomAttributeAsync(bookingId, key).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    // TODO failure callback handler
    exception.printStackTrace();
    return null;
});

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.

CompletableFuture<RetrieveBookingCustomAttributeResponse> retrieveBookingCustomAttributeAsync(
    final String bookingId,
    final String key,
    final Boolean withDefinition,
    final Integer version)

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 Boolean 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 Integer 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

RetrieveBookingCustomAttributeResponse

Example Usage

String bookingId = "booking_id4";
String key = "key0";
Boolean withDefinition = false;

bookingCustomAttributesApi.retrieveBookingCustomAttributeAsync(bookingId, key, withDefinition, null).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    // TODO failure callback handler
    exception.printStackTrace();
    return null;
});

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.

CompletableFuture<UpsertBookingCustomAttributeResponse> upsertBookingCustomAttributeAsync(
    final String bookingId,
    final String key,
    final 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

UpsertBookingCustomAttributeResponse

Example Usage

String bookingId = "booking_id4";
String key = "key0";
UpsertBookingCustomAttributeRequest body = new UpsertBookingCustomAttributeRequest.Builder(
    new CustomAttribute.Builder()
        .build()
)
.build();

bookingCustomAttributesApi.upsertBookingCustomAttributeAsync(bookingId, key, body).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    // TODO failure callback handler
    exception.printStackTrace();
    return null;
});