Skip to content

Latest commit

 

History

History
532 lines (360 loc) · 20.1 KB

booking-custom-attributes.md

File metadata and controls

532 lines (360 loc) · 20.1 KB

Booking Custom Attributes

booking_custom_attributes_api = client.booking_custom_attributes

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.

def list_booking_custom_attribute_definitions(limit: nil,
                                              cursor: nil)

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

This method returns a \ApiResponse instance. The data property in this instance returns the response data which is of type List Booking Custom Attribute Definitions Response Hash.

Example Usage

result = booking_custom_attributes_api.list_booking_custom_attribute_definitions

if result.success?
  puts result.data
elsif result.error?
  warn result.errors
end

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.

def create_booking_custom_attribute_definition(body:)

Parameters

Parameter Type Tags Description
body Create Booking Custom Attribute Definition Request Hash Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

This method returns a \ApiResponse instance. The data property in this instance returns the response data which is of type Create Booking Custom Attribute Definition Response Hash.

Example Usage

body = {
  :custom_attribute_definition => {}
}


result = booking_custom_attributes_api.create_booking_custom_attribute_definition(body: body)

if result.success?
  puts result.data
elsif result.error?
  warn result.errors
end

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.

def delete_booking_custom_attribute_definition(key:)

Parameters

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

Response Type

This method returns a \ApiResponse instance. The data property in this instance returns the response data which is of type Delete Booking Custom Attribute Definition Response Hash.

Example Usage

key = 'key0'


result = booking_custom_attributes_api.delete_booking_custom_attribute_definition(key: key)

if result.success?
  puts result.data
elsif result.error?
  warn result.errors
end

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.

def retrieve_booking_custom_attribute_definition(key:,
                                                 version: nil)

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

This method returns a \ApiResponse instance. The data property in this instance returns the response data which is of type Retrieve Booking Custom Attribute Definition Response Hash.

Example Usage

key = 'key0'


result = booking_custom_attributes_api.retrieve_booking_custom_attribute_definition(key: key)

if result.success?
  puts result.data
elsif result.error?
  warn result.errors
end

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.

def update_booking_custom_attribute_definition(key:,
                                               body:)

Parameters

Parameter Type Tags Description
key String Template, Required The key of the custom attribute definition to update.
body Update Booking Custom Attribute Definition Request Hash Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

This method returns a \ApiResponse instance. The data property in this instance returns the response data which is of type Update Booking Custom Attribute Definition Response Hash.

Example Usage

key = 'key0'

body = {
  :custom_attribute_definition => {}
}


result = booking_custom_attributes_api.update_booking_custom_attribute_definition(
  key: key,
  body: body
)

if result.success?
  puts result.data
elsif result.error?
  warn result.errors
end

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.

def bulk_delete_booking_custom_attributes(body:)

Parameters

Parameter Type Tags Description
body Bulk Delete Booking Custom Attributes Request Hash Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

This method returns a \ApiResponse instance. The data property in this instance returns the response data which is of type Bulk Delete Booking Custom Attributes Response Hash.

Example Usage

body = {
  :values => {
    'key0': {
      :booking_id => 'booking_id4',
      :key => 'key0'
    },
    'key1': {
      :booking_id => 'booking_id4',
      :key => 'key0'
    }
  }
}


result = booking_custom_attributes_api.bulk_delete_booking_custom_attributes(body: body)

if result.success?
  puts result.data
elsif result.error?
  warn result.errors
end

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.

def bulk_upsert_booking_custom_attributes(body:)

Parameters

Parameter Type Tags Description
body Bulk Upsert Booking Custom Attributes Request Hash Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

This method returns a \ApiResponse instance. The data property in this instance returns the response data which is of type Bulk Upsert Booking Custom Attributes Response Hash.

Example Usage

body = {
  :values => {
    'key0': {
      :booking_id => 'booking_id4',
      :custom_attribute => {}
    },
    'key1': {
      :booking_id => 'booking_id4',
      :custom_attribute => {}
    }
  }
}


result = booking_custom_attributes_api.bulk_upsert_booking_custom_attributes(body: body)

if result.success?
  puts result.data
elsif result.error?
  warn result.errors
end

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.

def list_booking_custom_attributes(booking_id:,
                                   limit: nil,
                                   cursor: nil,
                                   with_definitions: false)

Parameters

Parameter Type Tags Description
booking_id 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.
with_definitions TrueClass | FalseClass 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.

Response Type

This method returns a \ApiResponse instance. The data property in this instance returns the response data which is of type List Booking Custom Attributes Response Hash.

Example Usage

booking_id = 'booking_id4'

with_definitions = false


result = booking_custom_attributes_api.list_booking_custom_attributes(
  booking_id: booking_id,
  with_definitions: with_definitions
)

if result.success?
  puts result.data
elsif result.error?
  warn result.errors
end

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.

def delete_booking_custom_attribute(booking_id:,
                                    key:)

Parameters

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

This method returns a \ApiResponse instance. The data property in this instance returns the response data which is of type Delete Booking Custom Attribute Response Hash.

Example Usage

booking_id = 'booking_id4'

key = 'key0'


result = booking_custom_attributes_api.delete_booking_custom_attribute(
  booking_id: booking_id,
  key: key
)

if result.success?
  puts result.data
elsif result.error?
  warn result.errors
end

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.

def retrieve_booking_custom_attribute(booking_id:,
                                      key:,
                                      with_definition: false,
                                      version: nil)

Parameters

Parameter Type Tags Description
booking_id 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.
with_definition TrueClass | FalseClass 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.
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

This method returns a \ApiResponse instance. The data property in this instance returns the response data which is of type Retrieve Booking Custom Attribute Response Hash.

Example Usage

booking_id = 'booking_id4'

key = 'key0'

with_definition = false


result = booking_custom_attributes_api.retrieve_booking_custom_attribute(
  booking_id: booking_id,
  key: key,
  with_definition: with_definition
)

if result.success?
  puts result.data
elsif result.error?
  warn result.errors
end

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.

def upsert_booking_custom_attribute(booking_id:,
                                    key:,
                                    body:)

Parameters

Parameter Type Tags Description
booking_id 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 Upsert Booking Custom Attribute Request Hash Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

This method returns a \ApiResponse instance. The data property in this instance returns the response data which is of type Upsert Booking Custom Attribute Response Hash.

Example Usage

booking_id = 'booking_id4'

key = 'key0'

body = {
  :custom_attribute => {}
}


result = booking_custom_attributes_api.upsert_booking_custom_attribute(
  booking_id: booking_id,
  key: key,
  body: body
)

if result.success?
  puts result.data
elsif result.error?
  warn result.errors
end