oaspec/codegen/client_request
Values
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 build_request_object_call_args(
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),
) -> option.Option(String)
Build the call-site argument list for the _with_request wrapper that
unpacks a request_types.*Request record into the flat client function
it delegates to. Returns None if the operation uses a multi-content
body (where the flat API also takes a content_type argument that the
request type does not carry).
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_delimited_array_query_param(
sb: string_tree.StringTree,
param: spec.Parameter(spec.Resolved),
param_name: String,
joiner: String,
ctx: context.Context,
) -> string_tree.StringTree
Generate non-exploded delimited array query parameter: tags=a|b|c (pipeDelimited) or tags=a%20b%20c (spaceDelimited).
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_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_delimited_array_param(
param: spec.Parameter(spec.Resolved),
ctx: context.Context,
) -> option.Option(String)
Returns Some(joiner) if the parameter is a non-exploded delimited array (pipeDelimited or spaceDelimited). Returns None for everything else including form arrays — we keep that on the existing path.
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 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 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.