gleetube/client

Types

Opaque HTTP client wrapping configuration.

pub opaque type Client

Values

pub fn config(client: Client) -> config.Config

Get the configuration from a client.

pub fn delete(
  client: Client,
  path: String,
  query_params: List(#(String, String)),
) -> Result(Nil, error.GleeTubeError)

Execute a DELETE request against the YouTube API.

pub fn get(
  client: Client,
  path: String,
  query_params: List(#(String, String)),
  decoder: decode.Decoder(a),
) -> Result(a, error.GleeTubeError)

Execute a GET request against the YouTube API.

pub fn get_raw(
  client: Client,
  path: String,
  query_params: List(#(String, String)),
) -> Result(String, error.GleeTubeError)

Execute a GET request that returns raw response body (for downloads).

pub fn new(config: config.Config) -> Client

Create a new Client from a Config.

pub fn post(
  client: Client,
  path: String,
  query_params: List(#(String, String)),
  body: json.Json,
  decoder: decode.Decoder(a),
) -> Result(a, error.GleeTubeError)

Execute a POST request against the YouTube API.

pub fn post_no_content(
  client: Client,
  path: String,
  query_params: List(#(String, String)),
  body: json.Json,
) -> Result(Nil, error.GleeTubeError)

Execute a POST request without response body (returns Nil on success).

pub fn post_raw(
  client: Client,
  path: String,
  query_params: List(#(String, String)),
  body: String,
  content_type: String,
  decoder: decode.Decoder(a),
) -> Result(a, error.GleeTubeError)

Execute a POST request with raw body (for media uploads).

pub fn post_raw_no_content(
  client: Client,
  path: String,
  query_params: List(#(String, String)),
  body: String,
  content_type: String,
) -> Result(Nil, error.GleeTubeError)

Execute a POST request with raw body, no JSON response.

pub fn post_upload_init(
  client: Client,
  path: String,
  query_params: List(#(String, String)),
  metadata: json.Json,
  media_type: String,
  media_size: Int,
) -> Result(String, error.GleeTubeError)

Initiate a resumable upload session. Returns the resumable URI.

pub fn put(
  client: Client,
  path: String,
  query_params: List(#(String, String)),
  body: json.Json,
  decoder: decode.Decoder(a),
) -> Result(a, error.GleeTubeError)

Execute a PUT request against the YouTube API.

pub fn put_chunk(
  client: Client,
  uri: String,
  chunk: BitArray,
  offset: Int,
  total: Int,
  content_type: String,
) -> Result(response.Response(String), error.GleeTubeError)

Upload a chunk of data to a resumable upload URI.

pub const upload_base_url: String

YouTube upload API base URL (different from regular API).

Search Document