You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
curl -X POST https://example.com/rpc/planet/create \
@@ -19,13 +59,41 @@ curl -X POST https://example.com/rpc/planet/create \
19
59
"name": "Earth",
20
60
"detached_at": "2022-01-01T00:00:00.000Z"
21
61
},
22
-
"meta": [
23
-
["detached_at", "date"]
24
-
]
62
+
"meta": [[1, ["detached_at"]]]
25
63
}'
26
64
```
27
65
28
-
This request targets the `create` procedure within the `planet` module. The JSON payload includes `name` and `detached_at`, where `detached_at` is flagged as a date and will be converted to a Date object upon deserialization.
An error response uses an HTTP status code between 400 and 599 and returns an `ORPCError` object.
138
+
An error response has an HTTP status code between `400-599` and returns an `ORPCError` object.
70
139
71
-
## Request Methods
140
+
## Meta
72
141
73
-
Although the examples above use the `POST` method, the RPC protocol is method-agnostic. You can use any HTTP method. For example, here’s how to use a `GET` request with input in the URL:
The `meta` field describes native data in the format `[type: number, path: (string | number)[]]`.
77
143
78
-
url.searchParams.append('data', JSON.stringify({
79
-
json: {
80
-
name: 'Earth',
81
-
detached_at: '2022-01-01T00:00:00.000Z'
82
-
},
83
-
meta: [
84
-
['detached_at', 'date']
85
-
]
86
-
}))
144
+
-**type**: Data type (see [Supported Types](#supported-types)).
145
+
-**path**: Path to the data inside `json`.
87
146
88
-
const response =awaitfetch(url)
89
-
```
147
+
### Supported Types
90
148
91
-
## File Upload/Download
149
+
| Type | Description |
150
+
| ---- | ----------- |
151
+
| 0 | bigint |
152
+
| 1 | date |
153
+
| 2 | nan |
154
+
| 3 | undefined |
155
+
| 4 | url |
156
+
| 5 | regexp |
157
+
| 6 | set |
158
+
| 7 | map |
92
159
93
-
When the payload includes files or blobs, it is sent as a `FormData` object with `data` and `maps` fields. In the `data` object, file placeholders appear as empty objects `{}`. The `maps` array maps file keys in the `FormData` to their corresponding paths in the `data` object.
0 commit comments