ReqAnthropic.Beta (ReqAnthropic v0.2.1)

Copy Markdown View Source

Helpers for managing the anthropic-beta request header.

Anthropic accepts one or more beta opt-ins as a comma-separated list. This module normalizes the various shapes (string, list, nil) into a deduped list and into the comma-joined header value.

Summary

Functions

Ensure one or more beta values are present on a keyword list of client options, merging with anything already there. Used by resource modules that gate on a specific beta header (files, managed agents, advisor).

Render a list of beta values as the comma-joined header value, or nil if empty.

Merge any number of beta values into a single deduped list, preserving the order of first appearance.

Normalize a single value into a list of beta strings.

Types

t()

@type t() :: String.t() | [String.t()] | nil

Functions

ensure(opts, required)

@spec ensure(
  keyword(),
  String.t() | [String.t()]
) :: keyword()

Ensure one or more beta values are present on a keyword list of client options, merging with anything already there. Used by resource modules that gate on a specific beta header (files, managed agents, advisor).

header_value(values)

@spec header_value([String.t()]) :: String.t() | nil

Render a list of beta values as the comma-joined header value, or nil if empty.

merge(values)

@spec merge([t()]) :: [String.t()]

Merge any number of beta values into a single deduped list, preserving the order of first appearance.

normalize(value)

@spec normalize(t()) :: [String.t()]

Normalize a single value into a list of beta strings.