Header menu logo FSharp.ATProto

QueryParams Module

Serializes F# records to URL query strings for XRPC query parameters. Used internally by query to convert typed parameter records into query-string form.

Functions and values

Function or value Description

toQueryString record

Full Usage: toQueryString record

Parameters:
    record : 'T - An F# record whose fields map to query-string parameters.

Returns: string A query string such as "?actor=my-handle.bsky.social&limit=50", or an empty string if the record produces no parameters.

Converts an F# record to a URL query string (including the leading ?).

Field names are converted to camelCase. The following field types are supported:

  • option fields: omitted when None; the inner value is emitted when Some.
  • list fields: emitted as repeated query parameters (e.g. uris=a&uris=b).
  • Scalar fields (string, int, int64, bool): emitted directly. Booleans serialize as "true"/"false".
All values are URI-escaped via EscapeDataString.

record : 'T

An F# record whose fields map to query-string parameters.

Returns: string

A query string such as "?actor=my-handle.bsky.social&limit=50", or an empty string if the record produces no parameters.

Example

 type Params = { Actor: string; Limit: int option }
 QueryParams.toQueryString { Actor = "my-handle.bsky.social"; Limit = Some 25 }
 // returns "?actor=my-handle.bsky.social&limit=25"
type Params = { Actor: string Limit: int option }
Multiple items
val string: value: 'T -> string

--------------------
type string = System.String
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
type 'T option = Option<'T>
union case Option.Some: Value: 'T -> Option<'T>

Type something to start searching.