class

Polar::Api::CustomFields

Inherits Reference < Object

API client for custom_fields operations

Constants

Log = ::Log.for(self)

Constructors

new(client : Client)

Creates a new CustomFields instance

@param client [Client] The Polar API client instance

Source

Instance methods

Create Custom Field

Create a custom field.

Scopes: custom_fields:write

Endpoint: POST /v1/custom-fields/

Parameters:

  • body (required): Request body as Polar::Models::CustomFieldCreate

Returns: Polar::Models::CustomField

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source
delete(id : String)

Delete Custom Field

Delete a custom field.

Scopes: custom_fields:write

Endpoint: DELETE /v1/custom-fields/{id}

Parameters:

  • id (required): The custom field ID.

Returns: JSON response string

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source

Get Custom Field

Get a custom field by ID.

Scopes: custom_fields:read custom_fields:write

Endpoint: GET /v1/custom-fields/{id}

Parameters:

  • id (required): The custom field ID.

Returns: Polar::Models::CustomField

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source
list(organization_id : String | Nil = nil, query : String | Nil = nil, type : String | Nil = nil, page : Int32 | Nil = nil, limit : Int32 | Nil = nil, sorting : String | Nil = nil) : Polar::Models::ListResource(Polar::Models::CustomField)

List Custom Fields

List custom fields.

Scopes: custom_fields:read custom_fields:write

Endpoint: GET /v1/custom-fields/

Parameters:

  • organization_id (optional): Filter by organization ID.
  • query (optional): Filter by custom field name or slug.
  • type (optional): Filter by custom field type.
  • page (optional): Page number, defaults to 1.
  • limit (optional): Size of a page, defaults to 10. Maximum is 100.
  • sorting (optional): Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign - before the criteria name to sort by descending order.

Returns: Polar::Models::ListResource(Polar::Models::CustomField)

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source

Update Custom Field

Update a custom field.

Scopes: custom_fields:write

Endpoint: PATCH /v1/custom-fields/{id}

Parameters:

  • id (required): The custom field ID.
  • body (required): Request body as Polar::Models::CustomFieldUpdate

Returns: Polar::Models::CustomField

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source