const bookingCustomAttributesApi = client.bookingCustomAttributesApi;
BookingCustomAttributesApi
- List Booking Custom Attribute Definitions
- Create Booking Custom Attribute Definition
- Delete Booking Custom Attribute Definition
- Retrieve Booking Custom Attribute Definition
- Update Booking Custom Attribute Definition
- Bulk Delete Booking Custom Attributes
- Bulk Upsert Booking Custom Attributes
- List Booking Custom Attributes
- Delete Booking Custom Attribute
- Retrieve Booking Custom Attribute
- Upsert Booking Custom Attribute
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.
async listBookingCustomAttributeDefinitions( limit?: number,
cursor?: string,
requestOptions?: RequestOptions): Promise<ApiResponse<ListBookingCustomAttributeDefinitionsResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
limit |
number | undefined |
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 | undefined |
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. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
ListBookingCustomAttributeDefinitionsResponse
try {
const { result, ...httpResponse } = await bookingCustomAttributesApi.listBookingCustomAttributeDefinitions();
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch (error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
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.
async createBookingCustomAttributeDefinition( body: CreateBookingCustomAttributeDefinitionRequest,
requestOptions?: RequestOptions): Promise<ApiResponse<CreateBookingCustomAttributeDefinitionResponse>>
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. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
CreateBookingCustomAttributeDefinitionResponse
const body: CreateBookingCustomAttributeDefinitionRequest = {
customAttributeDefinition: {},
};
try {
const { result, ...httpResponse } = await bookingCustomAttributesApi.createBookingCustomAttributeDefinition(body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch (error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
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.
async deleteBookingCustomAttributeDefinition( key: string,
requestOptions?: RequestOptions): Promise<ApiResponse<DeleteBookingCustomAttributeDefinitionResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
key |
string |
Template, Required | The key of the custom attribute definition to delete. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
DeleteBookingCustomAttributeDefinitionResponse
const key = 'key0';
try {
const { result, ...httpResponse } = await bookingCustomAttributesApi.deleteBookingCustomAttributeDefinition(key);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch (error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
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.
async retrieveBookingCustomAttributeDefinition( key: string,
version?: number,
requestOptions?: RequestOptions): Promise<ApiResponse<RetrieveBookingCustomAttributeDefinitionResponse>>
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 |
number | undefined |
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. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
RetrieveBookingCustomAttributeDefinitionResponse
const key = 'key0';
try {
const { result, ...httpResponse } = await bookingCustomAttributesApi.retrieveBookingCustomAttributeDefinition(key);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch (error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
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.
async updateBookingCustomAttributeDefinition( key: string,
body: UpdateBookingCustomAttributeDefinitionRequest,
requestOptions?: RequestOptions): Promise<ApiResponse<UpdateBookingCustomAttributeDefinitionResponse>>
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. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
UpdateBookingCustomAttributeDefinitionResponse
const key = 'key0';
const body: UpdateBookingCustomAttributeDefinitionRequest = {
customAttributeDefinition: {},
};
try {
const { result, ...httpResponse } = await bookingCustomAttributesApi.updateBookingCustomAttributeDefinition(
key,
body
);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch (error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
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.
async bulkDeleteBookingCustomAttributes( body: BulkDeleteBookingCustomAttributesRequest,
requestOptions?: RequestOptions): Promise<ApiResponse<BulkDeleteBookingCustomAttributesResponse>>
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. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
BulkDeleteBookingCustomAttributesResponse
const body: BulkDeleteBookingCustomAttributesRequest = {
values: {
'key0': {
bookingId: 'booking_id4',
key: 'key0',
},
'key1': {
bookingId: 'booking_id4',
key: 'key0',
}
},
};
try {
const { result, ...httpResponse } = await bookingCustomAttributesApi.bulkDeleteBookingCustomAttributes(body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch (error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
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.
async bulkUpsertBookingCustomAttributes( body: BulkUpsertBookingCustomAttributesRequest,
requestOptions?: RequestOptions): Promise<ApiResponse<BulkUpsertBookingCustomAttributesResponse>>
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. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
BulkUpsertBookingCustomAttributesResponse
const body: BulkUpsertBookingCustomAttributesRequest = {
values: {
'key0': {
bookingId: 'booking_id4',
customAttribute: {},
},
'key1': {
bookingId: 'booking_id4',
customAttribute: {},
}
},
};
try {
const { result, ...httpResponse } = await bookingCustomAttributesApi.bulkUpsertBookingCustomAttributes(body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch (error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
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.
async listBookingCustomAttributes( bookingId: string,
limit?: number,
cursor?: string,
withDefinitions?: boolean,
requestOptions?: RequestOptions): Promise<ApiResponse<ListBookingCustomAttributesResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
bookingId |
string |
Template, Required | The ID of the target booking. |
limit |
number | undefined |
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 | undefined |
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 | undefined |
Query, Optional | Indicates whether to return the custom attribute definition in the definition field of eachcustom attribute. Set this parameter to true to get the name and description of each customattribute, information about the data type, or other definition details. The default value is false .Default: false |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
ListBookingCustomAttributesResponse
const bookingId = 'booking_id4';
const withDefinitions = false;
try {
const { result, ...httpResponse } = await bookingCustomAttributesApi.listBookingCustomAttributes(
bookingId,
undefined,
undefined,
withDefinitions
);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch (error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
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.
async deleteBookingCustomAttribute( bookingId: string,
key: string,
requestOptions?: RequestOptions): Promise<ApiResponse<DeleteBookingCustomAttributeResponse>>
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 customattribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
DeleteBookingCustomAttributeResponse
const bookingId = 'booking_id4';
const key = 'key0';
try {
const { result, ...httpResponse } = await bookingCustomAttributesApi.deleteBookingCustomAttribute(
bookingId,
key
);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch (error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
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.
async retrieveBookingCustomAttribute( bookingId: string,
key: string,
withDefinition?: boolean,
version?: number,
requestOptions?: RequestOptions): Promise<ApiResponse<RetrieveBookingCustomAttributeResponse>>
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 customattribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key. |
withDefinition |
boolean | undefined |
Query, Optional | Indicates whether to return the custom attribute definition in the definition field ofthe custom attribute. Set this parameter to true to get the name and description of the customattribute, information about the data type, or other definition details. The default value is false .Default: false |
version |
number | undefined |
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. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
RetrieveBookingCustomAttributeResponse
const bookingId = 'booking_id4';
const key = 'key0';
const withDefinition = false;
try {
const { result, ...httpResponse } = await bookingCustomAttributesApi.retrieveBookingCustomAttribute(
bookingId,
key,
withDefinition
);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch (error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
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.
async upsertBookingCustomAttribute( bookingId: string,
key: string,
body: UpsertBookingCustomAttributeRequest,
requestOptions?: RequestOptions): Promise<ApiResponse<UpsertBookingCustomAttributeResponse>>
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 acustom 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. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
UpsertBookingCustomAttributeResponse
const bookingId = 'booking_id4';
const key = 'key0';
const body: UpsertBookingCustomAttributeRequest = {
customAttribute: {},
};
try {
const { result, ...httpResponse } = await bookingCustomAttributesApi.upsertBookingCustomAttribute(
bookingId,
key,
body
);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch (error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}