oaspec/codegen/client_request

Values

pub fn array_item_to_string_fn(
  items: schema.SchemaRef,
  ctx: context.Context,
) -> String

Return a function expression that converts an array item to String. Used in generated code: list.map(param, <fn>).

pub fn build_param_list(
  path_params: List(spec.Parameter(spec.Resolved)),
  query_params: List(spec.Parameter(spec.Resolved)),
  header_params: List(spec.Parameter(spec.Resolved)),
  cookie_params: List(spec.Parameter(spec.Resolved)),
  operation: spec.Operation(spec.Resolved),
  op_id: String,
  ctx: context.Context,
) -> String

Build parameter list for function signature.

pub fn deep_object_array_item_to_string(
  prop_ref: schema.SchemaRef,
  ctx: context.Context,
) -> String

Convert a deepObject array item to a string expression.

pub fn form_array_item_to_string(
  field_schema: schema.SchemaRef,
  ctx: context.Context,
) -> String

Convert an array field’s items to a string expression for form-urlencoded encoding. Returns an expression that converts item to a String.

pub fn generate_deep_object_query_param(
  sb: string_tree.StringTree,
  param: spec.Parameter(spec.Resolved),
  param_name: String,
  ctx: context.Context,
) -> string_tree.StringTree

Generate deepObject-style query parameters: key[prop]=value for each property.

pub fn generate_exploded_array_query_param(
  sb: string_tree.StringTree,
  param: spec.Parameter(spec.Resolved),
  param_name: String,
  ctx: context.Context,
) -> string_tree.StringTree

Generate exploded array query parameter: tags=a&tags=b

pub fn generate_form_bracket_fields(
  sb: string_tree.StringTree,
  key_prefix: String,
  accessor_prefix: String,
  field_schema: schema.SchemaRef,
  is_required: Bool,
  indent_base: Int,
  parts_var: String,
  ctx: context.Context,
) -> string_tree.StringTree

Recursively generate bracket-encoded form fields for nested objects. Produces key[sub]=value for leaf fields and recurses for object children.

pub fn generate_form_nested_object(
  sb: string_tree.StringTree,
  field_name: String,
  gleam_field: String,
  field_schema: schema.SchemaRef,
  is_required: Bool,
  ctx: context.Context,
) -> string_tree.StringTree

Generate form encoding for a nested object property. Serializes as field[subkey]=value for each sub-property.

pub fn generate_form_urlencoded_body(
  sb: string_tree.StringTree,
  rb: spec.RequestBody(spec.Resolved),
  op_id: String,
  ctx: context.Context,
) -> string_tree.StringTree

Generate application/x-www-form-urlencoded body encoding in the client function.

pub fn generate_multipart_body(
  sb: string_tree.StringTree,
  rb: spec.RequestBody(spec.Resolved),
  op_id: String,
  ctx: context.Context,
) -> string_tree.StringTree

Generate multipart/form-data body encoding in the client function.

pub fn get_body_encode_expr(
  rb: spec.RequestBody(spec.Resolved),
  op_id: String,
  ctx: context.Context,
) -> String

Get the encode expression for a request body.

pub fn get_body_type(
  rb: spec.RequestBody(spec.Resolved),
  op_id: String,
) -> String

Get the Gleam type for a request body parameter.

pub fn is_deep_object_param(
  param: spec.Parameter(spec.Resolved),
  ctx: context.Context,
) -> Bool

Check if a parameter uses deepObject style with an object schema.

pub fn is_exploded_array_param(
  param: spec.Parameter(spec.Resolved),
  ctx: context.Context,
) -> Bool

Check if a parameter is an array with explode behavior. OpenAPI default: style: form has explode: true by default.

pub fn multipart_field_is_binary(
  field_schema: schema.SchemaRef,
  ctx: context.Context,
) -> Bool
pub fn multipart_field_to_string_fn(
  field_schema: schema.SchemaRef,
  ctx: context.Context,
) -> String
pub fn param_to_string_expr(
  param: spec.Parameter(spec.Resolved),
  param_name: String,
  ctx: context.Context,
) -> String

Convert a parameter value to its String representation for URL/header use.

pub fn param_to_type(
  param: spec.Parameter(spec.Resolved),
  ctx: context.Context,
) -> String

Convert a parameter to its Gleam type string.

pub fn schema_ref_to_string_expr(
  schema_ref: schema.SchemaRef,
  accessor: String,
  ctx: context.Context,
) -> String

Convert a SchemaRef to a string expression for a given accessor.

pub fn to_str_for_optional_value(
  param: spec.Parameter(spec.Resolved),
  ctx: context.Context,
) -> String

Convert an optional param value (bound to v) to string.

pub fn to_str_for_required(
  param: spec.Parameter(spec.Resolved),
  param_name: String,
  ctx: context.Context,
) -> String

Convert a required param to string for query building.

Search Document