class

Polar::Api::Files

Inherits Reference < Object

API client for files operations

Constants

Log = ::Log.for(self)

Constructors

new(client : Client)

Creates a new Files instance

@param client [Client] The Polar API client instance

Source

Instance methods

Create File

Create a file.

Scopes: files:write

Endpoint: POST /v1/files/

Parameters:

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

Returns: Polar::Models::FileUpload

Raises:

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

Delete File

Delete a file.

Scopes: files:write

Endpoint: DELETE /v1/files/{id}

Parameters:

  • id (required): Path parameter

Returns: JSON response string

Raises:

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

List Files

List files.

Scopes: files:read files:write

Endpoint: GET /v1/files/

Parameters:

  • organization_id (optional): Filter by organization ID.
  • ids (optional): Filter by file ID.
  • page (optional): Page number, defaults to 1.
  • limit (optional): Size of a page, defaults to 10. Maximum is 100.

Returns: Polar::Models::ListResource(Polar::Models::FileRead)

Raises:

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

Update File

Update a file.

Scopes: files:write

Endpoint: PATCH /v1/files/{id}

Parameters:

  • id (required): The file ID.
  • body (required): Request body as Polar::Models::FilePatch

Returns: Polar::Models::DownloadableFileRead

Raises:

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

Complete File Upload

Complete a file upload.

Scopes: files:write

Endpoint: POST /v1/files/{id}/uploaded

Parameters:

  • id (required): The file ID.
  • body (required): Request body as Polar::Models::FileUploadCompleted

Returns: Polar::Models::DownloadableFileRead

Raises:

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