Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/http/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["http","sse"], { url: "<url>" });
console.log(JSON.stringify(result));From the command line
$ mark http sse --url <string>
As data, in a program
{ "$proc": ["http", "sse"], "input": { "url": "<url>" } }JSON Schemas
{
"input": {
"type": "object",
"properties": {
"url": {
"type": "string",
"format": "uri",
"description": "The URL: http: or https:"
},
"method": {
"description": "GET or POST (default: POST with body or json, GET without them)",
"type": "string",
"enum": [
"GET",
"POST"
]
},
"headers": {
"description": "The headers of the request",
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "string"
}
},
"query": {
"description": "More parameters for the query of the URL. A list gives the parameter more than one time",
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"anyOf": [
{
"type": [
"string",
"number",
"boolean"
]
},
{
"type": "array",
"items": {
"type": [
"string",
"number",
"boolean"
]
}
}
]
}
},
"body": {
"description": "A body of text for a POST",
"type": "string"
},
"json": {
"description": "A body of JSON for a POST: the procedure sets content-type: application/json"
},
"timeoutMs": {
"description": "The time of the whole stream, in milliseconds (default: no limit)",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 86400000
},
"idleTimeoutMs": {
"description": "The longest time without data, in milliseconds (default: no limit)",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 86400000
},
"lastEventId": {
"description": "The Last-Event-ID header: the server continues after this event",
"type": "string"
},
"maxEventBytes": {
"description": "The largest event, in bytes (default: 1 MiB)",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"url"
]
},
"output": {
"type": "object",
"properties": {
"event": {
"type": "string",
"description": "The type of the event (default: message)"
},
"data": {
"type": "string",
"description": "The data of the event: its data lines joined with LF"
},
"id": {
"description": "The last event ID of the stream",
"type": "string"
},
"retry": {
"description": "The reconnection time that the event gave, in milliseconds",
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
}
},
"required": [
"event",
"data"
],
"additionalProperties": false
}
}