ExBifrost.Api.Files (ex_bifrost v0.1.0)

Copy Markdown View Source

API calls for all endpoints tagged Files.

Summary

Functions

Download file content Downloads the content of a file.

List files Lists files for a provider.

Retrieve file metadata Retrieves metadata for a specific file.

Upload a file Uploads a file to be used with batch operations or other features.

Functions

delete_file(connection, file_id, provider, opts \\ [])

Delete a file Deletes a file.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • file_id (String.t): The ID of the file to delete
  • provider (ModelProvider): The provider of the file
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.DeleteFile200Response.t} on success
  • {:error, Tesla.Env.t} on failure

get_file_content(connection, file_id, provider, opts \\ [])

@spec get_file_content(
  Tesla.Env.client(),
  String.t(),
  ExBifrost.Model.ModelProvider.t(),
  keyword()
) ::
  {:ok, ExBifrost.Model.BifrostError.t()}
  | {:ok, String.t()}
  | {:error, Tesla.Env.t()}

Download file content Downloads the content of a file.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • file_id (String.t): The ID of the file
  • provider (ModelProvider): The provider of the file
  • opts (keyword): Optional parameters

Returns

  • {:ok, String.t} on success
  • {:error, Tesla.Env.t} on failure

list_files(connection, x_model_provider, opts \\ [])

List files Lists files for a provider.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • x_model_provider (ModelProvider): Provider to list files for
  • opts (keyword): Optional parameters
    • :purpose (String.t): Filter by purpose
    • :limit (integer()): Maximum number of files to return
    • :after (String.t): Cursor for pagination
    • :order (String.t): Sort order (asc/desc)

Returns

  • {:ok, ExBifrost.Model.FileListResponse.t} on success
  • {:error, Tesla.Env.t} on failure

retrieve_file(connection, file_id, provider, opts \\ [])

Retrieve file metadata Retrieves metadata for a specific file.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • file_id (String.t): The ID of the file
  • provider (ModelProvider): The provider of the file
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.RetrieveFile200Response.t} on success
  • {:error, Tesla.Env.t} on failure

upload_file(connection, file, purpose, opts \\ [])

Upload a file Uploads a file to be used with batch operations or other features.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • file (String.t):
  • purpose (String.t):
  • opts (keyword): Optional parameters
    • :provider (ExBifrost.Model.ModelProvider.t):

Returns

  • {:ok, ExBifrost.Model.FileUploadResponse.t} on success
  • {:error, Tesla.Env.t} on failure