pify/request
Target-agnostic request building. Execution lives in execute.
Types
pub type ShopifyRequest {
ShopifyRequest(
url: String,
headers: List(#(String, String)),
body: String,
)
}
Constructors
-
ShopifyRequest( url: String, headers: List(#(String, String)), body: String, )
A request url the http request type cannot hold. text stops before
the query, which can carry a token.
pub type ShopifyRequestError {
ShopifyRequestUrlInvalid(text: String)
}
Constructors
-
ShopifyRequestUrlInvalid(text: String)
Values
pub fn graphql(
client: pify.Client,
query: String,
variables: json.Json,
) -> ShopifyRequest
pub fn graphql_at(
url url: String,
token_headers token_headers: List(#(String, String)),
query query: String,
variables variables: json.Json,
timeout_ms timeout_ms: Int,
) -> ShopifyRequest
A GraphQL POST to url with the token headers of the Admin or the
Storefront API.
pub fn post_json(
url: String,
body: json.Json,
timeout_ms: Int,
) -> ShopifyRequest
A JSON POST with no access token, such as the client-credentials grant.
pub const timeout_header: String
The header that carries Client.timeout_ms to whatever runs the
effect. midas Fetch has no timeout slot, so the runner reads this
header, strips it and bounds the call. It never reaches Shopify.
pub fn to_http_request(
shopify_request: ShopifyRequest,
) -> Result(request.Request(BitArray), ShopifyRequestError)