@pincast/api 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +140 -2
- package/openapi/placecard-v1.openapi.json +1074 -0
- package/package.json +57 -4
- package/src/client.js +155 -0
- package/src/errors.js +31 -0
- package/src/generated/operations.js +19 -0
- package/src/generated/types.d.ts +537 -0
- package/src/index.d.ts +109 -0
- package/src/index.js +5 -0
- package/src/keys.js +39 -0
- package/src/mock.d.ts +45 -0
- package/src/mock.js +156 -0
- package/src/openapi.js +28 -0
- package/src/resend-queue.d.ts +60 -0
- package/src/resend-queue.js +122 -0
- package/src/validate.js +72 -0
|
@@ -0,0 +1,1074 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.1.0",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "Placecard registry",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"summary": "Register your app's cards with Placecard and record what people collect.",
|
|
7
|
+
"description": "Eight calls. Six go from your server with your app key: register a card set and its cards, record a collect, read what one person holds, link a person when they sign in to your app, move a guest's cards to them, and read a set back. The seventh, the list of apps on Pincast, is public and needs no key. The eighth, POST /test-apps, needs no key or account either: it makes a test app to try these calls with, and is the one call the older address doesn't take.\n\nAddresses: call https://api.pincast.fm/v1 with your key in the X-Pincast-Key header. The older address, https://www.pincaster.com/api/placecard/v1, and the header's older name, X-Placecard-Key, keep working: the same calls and the same answers, except that a key error at the older address names X-Placecard-Key.\n\nChecks run in this order on every call that takes a key: the key first (400 when X-Pincast-Key and X-Placecard-Key both come and differ, 401 without one, 403 for a wrong, revoked, expired or disabled one), then your key's limit (429), then your app's daily quota (429), then whether this key may make this call (403), then the set id (400), then the Idempotency-Key when one is sent (400), then the body (400). Three more checks follow the body, each a 403: a collect that sends a whole card needs sets:write, a test key's call must name a test person, and a collect for a signed in person or a claim needs that person's sign-in link. Every error answers with the same JSON body: see the Error schema. On a 4xx its data says what to do: a code to branch on, the field at fault when there is one, and a fix in one sentence.\n\nRetries: every call that takes a key is safe to send again, and each write says how. POST /test-apps makes a new app each time, so send it again only after a failure. For the three writes (PUT a set, POST a collect, POST a claim) you can also send an Idempotency-Key header: Placecard keeps the first 200 answer to that key for 24 hours and answers a retry with it, marked Idempotent-Replayed: true, without running the call again.\n\nSign-in: when a person signs in to your app through id.pincast.fm, send their ID token to POST /people once. Placecard checks it with id.pincast.fm and links the person to your app. From then on your key can record collects (actor.source logto) and claims (to) for that person, and for nobody who hasn't signed in to your app: those calls answer 403. Guest collects need no link, and a guest token is never a person's id: a guest collect for an id that holds cards in your app as a signed-in person answers 409. Placecard reads only the token's issuer, subject, audience and times, and keeps none of the person's profile.\n\nKeys: a secret key may make every call. A restricted key may make only the calls its abilities name: sets:read for GET /sets/{set}, sets:write for PUT /sets/{set}, collects:read for GET /sets/{set}/collects, collects:write for POST /sets/{set}/collects, claims:write for POST /sets/{set}/claims and people:write for POST /people. A collect that sends a whole card creates or rewrites that card, so it needs sets:write too.\n\nTest keys: a test key reaches only its own test app and writes only for test people, whose ids start test_. Test people need no sign-in link, and POST /people takes testPerson in place of token and stores nothing. A test app holds at most 3 sets, 200 cards and 1,000 collects until someone claims it, then 20 sets, 2,000 cards and 20,000 collects. Each person's hold of a card counts as one collect, and so does a parent card held through it. A write past those limits answers 409 test_limit_reached. A write that adds nothing always goes through, so an app at its limit can still update what it holds and resend a collect.\n\nLimits: each key takes 600 calls a minute, counted over the last 60 seconds, unless Pincast gave it a limit of its own. The key POST /test-apps makes takes 60. Past that, a call answers 429 rate_limited with a Retry-After header, the seconds to wait, and the refused call counts toward nothing, so the call sent after the wait goes through.\n\nEach app also has a quota of calls for the UTC day, counted across its keys: 2,000 for a test app, 50,000 for a live app that isn't listed and 200,000 for a listed app, unless Pincast set one of its own. An app Pincast set up by hand, with no owner on the dashboard, has no quota. Past its quota, a call answers 429 quota_exceeded with a Retry-After header, the seconds to the next UTC midnight. That refused call adds nothing to the day, and it still takes a place in the key's minute. Any other call that gets past the key check counts toward both, whatever it answers.\n\nPlacecard logs each call made with your key (its time, method, path without the query string, key and answer, never the body) and keeps the log 90 days. The list of apps has no limit of its own and logs nothing: its answer is the same for everyone, and the edge keeps it 5 minutes.\n\nThis file describes the registry as it runs today. The tests in tests/placecardApiV1.test.js send every example here to the real handlers and fail when an answer and this file disagree."
|
|
8
|
+
},
|
|
9
|
+
"servers": [
|
|
10
|
+
{
|
|
11
|
+
"url": "https://api.pincast.fm/v1",
|
|
12
|
+
"description": "Production: the Pincast address for the card registry. Send your key in X-Pincast-Key."
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"url": "https://www.pincaster.com/api/placecard/v1",
|
|
16
|
+
"description": "Production, the older address, kept working: the same calls and answers, and a key error here names X-Placecard-Key. Use api.pincast.fm for new work."
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"security": [
|
|
20
|
+
{ "pincastKey": [] }
|
|
21
|
+
],
|
|
22
|
+
"tags": [
|
|
23
|
+
{ "name": "Sets", "description": "Card sets and their cards." },
|
|
24
|
+
{ "name": "Collects", "description": "What people collect, and what they hold." },
|
|
25
|
+
{ "name": "Claims", "description": "A guest's cards, moved to them when they sign in." },
|
|
26
|
+
{ "name": "People", "description": "The people who signed in to your app." },
|
|
27
|
+
{ "name": "Apps", "description": "The apps listed on Pincast." },
|
|
28
|
+
{ "name": "Test apps", "description": "A test app with no account, to try the API before you sign up." }
|
|
29
|
+
],
|
|
30
|
+
"paths": {
|
|
31
|
+
"/sets/{set}": {
|
|
32
|
+
"parameters": [
|
|
33
|
+
{ "$ref": "#/components/parameters/Set" }
|
|
34
|
+
],
|
|
35
|
+
"put": {
|
|
36
|
+
"operationId": "putSet",
|
|
37
|
+
"tags": ["Sets"],
|
|
38
|
+
"summary": "Register a card set, or update it and its cards",
|
|
39
|
+
"description": "Creates the set the first time and updates its name and meta after that. Cards are matched by key: a new key adds a card, a known key updates it, and a card you leave out of the call is kept as it is (send it with status retired to retire it). A card's parent may be in the same call or already registered. The whole call is one transaction: one bad card fails the call and nothing is written. Safe to send again: an unchanged card counts as unchanged and isn't touched. With an Idempotency-Key, a retry answers the first answer (setCreated true, the first counts) and writes nothing.\n\nA restricted key needs sets:write. Under a test key, a write past the test limits answers 409 and writes nothing.",
|
|
40
|
+
"security": [{ "pincastKey": [] }],
|
|
41
|
+
"parameters": [
|
|
42
|
+
{ "$ref": "#/components/parameters/IdempotencyKey" }
|
|
43
|
+
],
|
|
44
|
+
"requestBody": {
|
|
45
|
+
"required": true,
|
|
46
|
+
"content": {
|
|
47
|
+
"application/json": {
|
|
48
|
+
"schema": { "$ref": "#/components/schemas/PutSetRequest" },
|
|
49
|
+
"examples": {
|
|
50
|
+
"story": {
|
|
51
|
+
"summary": "A set of park trees: one species card and one tree card that belongs to it",
|
|
52
|
+
"value": {
|
|
53
|
+
"name": "Central Park Trees",
|
|
54
|
+
"meta": { "city": "New York" },
|
|
55
|
+
"cards": [
|
|
56
|
+
{
|
|
57
|
+
"key": "species:ginkgo",
|
|
58
|
+
"type": "species",
|
|
59
|
+
"title": "Ginkgo",
|
|
60
|
+
"subtitle": "Ginkgo biloba",
|
|
61
|
+
"fact": "21,024 in New York",
|
|
62
|
+
"rarity": "common",
|
|
63
|
+
"image": {
|
|
64
|
+
"url": "https://images.example.org/ginkgo.jpg",
|
|
65
|
+
"credit": "A. Photographer",
|
|
66
|
+
"license": "CC BY-SA 4.0"
|
|
67
|
+
},
|
|
68
|
+
"data": { "count": 21024 }
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"key": "tree:2614648",
|
|
72
|
+
"type": "tree",
|
|
73
|
+
"parent": "species:ginkgo",
|
|
74
|
+
"title": "Ginkgo on East Drive",
|
|
75
|
+
"url": "https://app.example.org/tree/2614648",
|
|
76
|
+
"lat": 40.77945,
|
|
77
|
+
"lng": -73.96318
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"responses": {
|
|
87
|
+
"200": {
|
|
88
|
+
"description": "The set is registered. The counts say what this call changed; active counts the set's active cards by type after it.",
|
|
89
|
+
"headers": {
|
|
90
|
+
"Idempotent-Replayed": { "$ref": "#/components/headers/IdempotentReplayed" }
|
|
91
|
+
},
|
|
92
|
+
"content": {
|
|
93
|
+
"application/json": {
|
|
94
|
+
"schema": { "$ref": "#/components/schemas/PutSetResponse" },
|
|
95
|
+
"examples": {
|
|
96
|
+
"story": {
|
|
97
|
+
"value": {
|
|
98
|
+
"app": "demo",
|
|
99
|
+
"set": "central-park-trees",
|
|
100
|
+
"name": "Central Park Trees",
|
|
101
|
+
"setCreated": true,
|
|
102
|
+
"cards": { "created": 2, "updated": 0, "unchanged": 0, "parentsSet": 1 },
|
|
103
|
+
"active": { "species": 1, "tree": 1 }
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"400": {
|
|
111
|
+
"description": "The set id or the body breaks a rule. Messages: Invalid set id; Invalid Idempotency-Key; JSON body required; name required (120 characters at most); meta must be an object under 8000 characters; meta.checkout must be a Pincast checkout path; cards must be an array; At most 5000 cards per call; cards[i]: followed by the card's rule; Duplicate card keys in one call; Parent cards not registered: followed by up to five keys.",
|
|
112
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
|
|
113
|
+
},
|
|
114
|
+
"401": { "$ref": "#/components/responses/KeyMissing" },
|
|
115
|
+
"403": { "$ref": "#/components/responses/KeyRefused" },
|
|
116
|
+
"409": {
|
|
117
|
+
"description": "A test key's write would take its test app past the test limits. Nothing is written. Message: Test limit reached.",
|
|
118
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
|
|
119
|
+
},
|
|
120
|
+
"422": { "$ref": "#/components/responses/IdempotencyKeyReused" },
|
|
121
|
+
"429": { "$ref": "#/components/responses/RateLimited" },
|
|
122
|
+
"default": { "$ref": "#/components/responses/ServerError" }
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"get": {
|
|
126
|
+
"operationId": "getSet",
|
|
127
|
+
"tags": ["Sets"],
|
|
128
|
+
"summary": "Read a set back",
|
|
129
|
+
"description": "The set as Placecard holds it: its name and meta, its active cards by type, how many collects it has and how many people made them, and whether it lists. An app reads only its own sets. A restricted key needs sets:read.",
|
|
130
|
+
"security": [{ "pincastKey": [] }],
|
|
131
|
+
"responses": {
|
|
132
|
+
"200": {
|
|
133
|
+
"description": "The set.",
|
|
134
|
+
"content": {
|
|
135
|
+
"application/json": {
|
|
136
|
+
"schema": { "$ref": "#/components/schemas/SetResponse" },
|
|
137
|
+
"examples": {
|
|
138
|
+
"story": {
|
|
139
|
+
"value": {
|
|
140
|
+
"app": "demo",
|
|
141
|
+
"set": "central-park-trees",
|
|
142
|
+
"name": "Central Park Trees",
|
|
143
|
+
"meta": { "city": "New York" },
|
|
144
|
+
"updatedAt": "2026-11-14T15:00:00.000Z",
|
|
145
|
+
"active": { "species": 1, "tree": 1 },
|
|
146
|
+
"collects": 1,
|
|
147
|
+
"players": 1,
|
|
148
|
+
"listing": { "listed": true, "reason": null }
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"400": {
|
|
156
|
+
"description": "Message: Invalid set id.",
|
|
157
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
|
|
158
|
+
},
|
|
159
|
+
"401": { "$ref": "#/components/responses/KeyMissing" },
|
|
160
|
+
"403": { "$ref": "#/components/responses/KeyRefused" },
|
|
161
|
+
"404": { "$ref": "#/components/responses/SetMissing" },
|
|
162
|
+
"429": { "$ref": "#/components/responses/RateLimited" },
|
|
163
|
+
"default": { "$ref": "#/components/responses/ServerError" }
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"/sets/{set}/collects": {
|
|
168
|
+
"parameters": [
|
|
169
|
+
{ "$ref": "#/components/parameters/Set" }
|
|
170
|
+
],
|
|
171
|
+
"post": {
|
|
172
|
+
"operationId": "postCollect",
|
|
173
|
+
"tags": ["Collects"],
|
|
174
|
+
"summary": "Record that a person collected a card",
|
|
175
|
+
"description": "Send the card's key, or the whole card to register or update it first. The actor is the person as your app knows them: a Logto id once they have signed in and your app has sent their sign-in token with POST /people, or your app's guest token for this device before that. The card's parent (a tree card's species card) is held through it and recorded with it.\n\nSafe to send again until you hear back: a collect with the same card, actor and time changes nothing and answers as the first send did, first included. A later time counts one more collect; an earlier time moves the first collect back. A collect sent without at takes Placecard's clock, so each send of it is a new time: send it with an Idempotency-Key to retry it safely.\n\nA restricted key needs collects:write, and sets:write as well when you send the whole card. Under a test key, actor.id must start test_, no sign-in link is needed, and a write past the test limits answers 409 and writes nothing.",
|
|
176
|
+
"security": [{ "pincastKey": [] }],
|
|
177
|
+
"parameters": [
|
|
178
|
+
{ "$ref": "#/components/parameters/IdempotencyKey" }
|
|
179
|
+
],
|
|
180
|
+
"requestBody": {
|
|
181
|
+
"required": true,
|
|
182
|
+
"content": {
|
|
183
|
+
"application/json": {
|
|
184
|
+
"schema": { "$ref": "#/components/schemas/CollectRequest" },
|
|
185
|
+
"examples": {
|
|
186
|
+
"story": {
|
|
187
|
+
"summary": "A guest collects the tree card at the tree",
|
|
188
|
+
"value": {
|
|
189
|
+
"card": "tree:2614648",
|
|
190
|
+
"actor": { "id": "guest-7f3c9a2e5b41", "source": "anonymous" },
|
|
191
|
+
"at": "2026-11-14T15:04:05Z",
|
|
192
|
+
"lat": 40.77951,
|
|
193
|
+
"lng": -73.96311,
|
|
194
|
+
"accuracy": 8
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"responses": {
|
|
202
|
+
"200": {
|
|
203
|
+
"description": "The collect is recorded. first is true when this collect's time is this person's first hold of the card: on their first collect, on a resend of it, and on a collect dated before their first. count is how many times they collected it directly.",
|
|
204
|
+
"headers": {
|
|
205
|
+
"Idempotent-Replayed": { "$ref": "#/components/headers/IdempotentReplayed" }
|
|
206
|
+
},
|
|
207
|
+
"content": {
|
|
208
|
+
"application/json": {
|
|
209
|
+
"schema": { "$ref": "#/components/schemas/CollectResponse" },
|
|
210
|
+
"examples": {
|
|
211
|
+
"story": {
|
|
212
|
+
"value": {
|
|
213
|
+
"collected": true,
|
|
214
|
+
"first": true,
|
|
215
|
+
"count": 1,
|
|
216
|
+
"collectedAt": "2026-11-14T15:04:05.000Z",
|
|
217
|
+
"card": { "key": "tree:2614648", "type": "tree" },
|
|
218
|
+
"parent": { "key": "species:ginkgo", "first": true }
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"400": {
|
|
226
|
+
"description": "The set id or the body breaks a rule. Messages: Invalid set id; Invalid Idempotency-Key; JSON body required; actor required; actor.id required; actor.source is logto or anonymous; at must be an ISO time, not in the future; lat and lng go together, as numbers; accuracy must be metres; card required (a key, or a card); card: followed by the card's rule, when a whole card is sent.",
|
|
227
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
|
|
228
|
+
},
|
|
229
|
+
"401": { "$ref": "#/components/responses/KeyMissing" },
|
|
230
|
+
"403": { "$ref": "#/components/responses/WriteRefused" },
|
|
231
|
+
"404": {
|
|
232
|
+
"description": "The set or the card is not registered. Messages: Set <id> is not registered; Card <key> is not registered.",
|
|
233
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
|
|
234
|
+
},
|
|
235
|
+
"409": {
|
|
236
|
+
"description": "The card is retired and takes no new collects. People who hold it keep it. Message: Card <key> is retired. Or the collect is a guest's (actor.source anonymous) for an id that holds cards in your app as a signed-in person: a guest write never lands on a person's cards. Message: Actor holds cards as a signed-in person. Or a test key's write would take its test app past the test limits. Message: Test limit reached.",
|
|
237
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
|
|
238
|
+
},
|
|
239
|
+
"422": { "$ref": "#/components/responses/IdempotencyKeyReused" },
|
|
240
|
+
"429": { "$ref": "#/components/responses/RateLimited" },
|
|
241
|
+
"default": { "$ref": "#/components/responses/ServerError" }
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
"get": {
|
|
245
|
+
"operationId": "getCollects",
|
|
246
|
+
"tags": ["Collects"],
|
|
247
|
+
"summary": "Read what a person holds in this set",
|
|
248
|
+
"description": "One person's cards in this set, first collect first (cards collected at the same moment in key order). Send up to three actor ids for the same person, a Logto id with this device's guest token for example: a card held under more than one is listed once, at its earliest collect. A guest's cards that have been claimed are listed under the person who claimed them. A restricted key needs collects:read.",
|
|
249
|
+
"security": [{ "pincastKey": [] }],
|
|
250
|
+
"parameters": [
|
|
251
|
+
{ "$ref": "#/components/parameters/Actor" }
|
|
252
|
+
],
|
|
253
|
+
"responses": {
|
|
254
|
+
"200": {
|
|
255
|
+
"description": "The cards this person holds. held counts them by type. A parent card held only through one of its children has count 0 and names that child in via.",
|
|
256
|
+
"content": {
|
|
257
|
+
"application/json": {
|
|
258
|
+
"schema": { "$ref": "#/components/schemas/CollectsResponse" },
|
|
259
|
+
"examples": {
|
|
260
|
+
"story": {
|
|
261
|
+
"value": {
|
|
262
|
+
"app": "demo",
|
|
263
|
+
"set": "central-park-trees",
|
|
264
|
+
"held": { "species": 1, "tree": 1 },
|
|
265
|
+
"cards": [
|
|
266
|
+
{
|
|
267
|
+
"key": "species:ginkgo",
|
|
268
|
+
"type": "species",
|
|
269
|
+
"parent": null,
|
|
270
|
+
"via": "tree:2614648",
|
|
271
|
+
"collectedAt": "2026-11-14T15:04:05.000Z",
|
|
272
|
+
"lastCollectedAt": "2026-11-14T15:04:05.000Z",
|
|
273
|
+
"count": 0,
|
|
274
|
+
"source": "anonymous"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"key": "tree:2614648",
|
|
278
|
+
"type": "tree",
|
|
279
|
+
"parent": "species:ginkgo",
|
|
280
|
+
"via": null,
|
|
281
|
+
"collectedAt": "2026-11-14T15:04:05.000Z",
|
|
282
|
+
"lastCollectedAt": "2026-11-14T15:04:05.000Z",
|
|
283
|
+
"count": 1,
|
|
284
|
+
"source": "anonymous"
|
|
285
|
+
}
|
|
286
|
+
]
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
"400": {
|
|
294
|
+
"description": "Messages: Invalid set id; actor required; At most three actor ids (also sent when an id is longer than 255 characters).",
|
|
295
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
|
|
296
|
+
},
|
|
297
|
+
"401": { "$ref": "#/components/responses/KeyMissing" },
|
|
298
|
+
"403": { "$ref": "#/components/responses/KeyRefused" },
|
|
299
|
+
"404": { "$ref": "#/components/responses/SetMissing" },
|
|
300
|
+
"429": { "$ref": "#/components/responses/RateLimited" },
|
|
301
|
+
"default": { "$ref": "#/components/responses/ServerError" }
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
"/sets/{set}/claims": {
|
|
306
|
+
"parameters": [
|
|
307
|
+
{ "$ref": "#/components/parameters/Set" }
|
|
308
|
+
],
|
|
309
|
+
"post": {
|
|
310
|
+
"operationId": "postClaim",
|
|
311
|
+
"tags": ["Claims"],
|
|
312
|
+
"summary": "Move a guest's cards to the person who just signed in",
|
|
313
|
+
"description": "Your app vouches for both ids: it has signed the person in (to) and sent their sign-in token with POST /people, and it read this device's guest token itself (from), never from what the person sent. Only cards collected as a guest move. A card the person already holds is merged into theirs (the earlier first collect, the later last collect, the counts added) and the guest's copy is kept, marked as claimed.\n\nSafe to send again until you hear back: a claim with nothing left to move answers claimed 0. With an Idempotency-Key, a retry answers the first answer instead (claimed 2, say).\n\nA restricted key needs claims:write. Under a test key, from and to must both start test_, and no sign-in link is needed. A claim adds no row, so the test limits don't apply to it.",
|
|
314
|
+
"security": [{ "pincastKey": [] }],
|
|
315
|
+
"parameters": [
|
|
316
|
+
{ "$ref": "#/components/parameters/IdempotencyKey" }
|
|
317
|
+
],
|
|
318
|
+
"requestBody": {
|
|
319
|
+
"required": true,
|
|
320
|
+
"content": {
|
|
321
|
+
"application/json": {
|
|
322
|
+
"schema": { "$ref": "#/components/schemas/ClaimRequest" },
|
|
323
|
+
"examples": {
|
|
324
|
+
"story": {
|
|
325
|
+
"summary": "The guest signs in, and their two cards move to them",
|
|
326
|
+
"value": { "from": "guest-7f3c9a2e5b41", "to": "q8n2v5x7c1z4" }
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
"responses": {
|
|
333
|
+
"200": {
|
|
334
|
+
"description": "The claim is done. moved counts cards that moved; merged counts cards the person already held; claimed is the two added.",
|
|
335
|
+
"headers": {
|
|
336
|
+
"Idempotent-Replayed": { "$ref": "#/components/headers/IdempotentReplayed" }
|
|
337
|
+
},
|
|
338
|
+
"content": {
|
|
339
|
+
"application/json": {
|
|
340
|
+
"schema": { "$ref": "#/components/schemas/ClaimResponse" },
|
|
341
|
+
"examples": {
|
|
342
|
+
"story": {
|
|
343
|
+
"value": { "app": "demo", "set": "central-park-trees", "claimed": 2, "moved": 2, "merged": 0 }
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
"400": {
|
|
350
|
+
"description": "Messages: Invalid set id; Invalid Idempotency-Key; JSON body required; from required; to required; from and to are the same player.",
|
|
351
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
|
|
352
|
+
},
|
|
353
|
+
"401": { "$ref": "#/components/responses/KeyMissing" },
|
|
354
|
+
"403": { "$ref": "#/components/responses/WriteRefused" },
|
|
355
|
+
"404": { "$ref": "#/components/responses/SetMissing" },
|
|
356
|
+
"422": { "$ref": "#/components/responses/IdempotencyKeyReused" },
|
|
357
|
+
"429": { "$ref": "#/components/responses/RateLimited" },
|
|
358
|
+
"default": { "$ref": "#/components/responses/ServerError" }
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
"/people": {
|
|
363
|
+
"post": {
|
|
364
|
+
"operationId": "postPerson",
|
|
365
|
+
"tags": ["People"],
|
|
366
|
+
"summary": "Link a person who signed in to your app",
|
|
367
|
+
"description": "Send the person's ID token, exactly as id.pincast.fm gave it to your app when they signed in. Placecard checks its signature against id.pincast.fm's public keys, its issuer, its times, and that it was made for one of your app's sign-in clients (Pincast adds your id.pincast.fm application id when it gives you your key). Then it links the person (the token's subject) to your app, and your key can record collects and claims for them.\n\nSafe to send again: a token for a person already linked answers the same link. Send it at each sign-in if that is simpler for your app.\n\nUnder a test key, send testPerson in place of token, with an id that starts test_. The answer has the same shape with simulated: true, linkedAt is the time of the call, and nothing is stored. A test key can't link a real person: a call that sends token under a test key is refused.\n\nA restricted key needs people:write.",
|
|
368
|
+
"security": [{ "pincastKey": [] }],
|
|
369
|
+
"requestBody": {
|
|
370
|
+
"required": true,
|
|
371
|
+
"content": {
|
|
372
|
+
"application/json": {
|
|
373
|
+
"schema": { "$ref": "#/components/schemas/PersonRequest" },
|
|
374
|
+
"examples": {
|
|
375
|
+
"story": {
|
|
376
|
+
"summary": "The guest signs in, and your app sends their sign-in token",
|
|
377
|
+
"value": { "token": "eyJhbGciOiJFUzM4NCIsInR5cCI6IkpXVCIsImtpZCI6InN0b3J5LWtleSJ9.eyJpc3MiOiJodHRwczovL2lkLnBpbmNhc3QuZm0vb2lkYyIsInN1YiI6InE4bjJ2NXg3YzF6NCIsImF1ZCI6ImRlbW9hcHBzaWduaW4wY2xpZW50MSIsImV4cCI6NDA3MDkwODgwMCwiaWF0IjoxNzk0NjY5MDAwfQ.868gLKGOj3abQ4a2LfkoSd5LOEBwhTVrXZxHz9UKfaJPeidE3zIvbZIqNHRv4zytmC3xqxpxswUC1KP0IdeFDpB32uTi8JQXUHsqgtuK1OVU3blC0Ki8xCCkAqpsUHty" }
|
|
378
|
+
},
|
|
379
|
+
"testKey": {
|
|
380
|
+
"summary": "Under a test key, a test person in place of a token",
|
|
381
|
+
"value": { "testPerson": "test_demo" }
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
},
|
|
387
|
+
"responses": {
|
|
388
|
+
"200": {
|
|
389
|
+
"description": "The person is linked to your app. linkedAt is when the link was first made, so a resend answers the same. Under a test key nothing is stored: the answer carries simulated: true, and linkedAt is the time of the call.",
|
|
390
|
+
"content": {
|
|
391
|
+
"application/json": {
|
|
392
|
+
"schema": { "$ref": "#/components/schemas/PersonResponse" },
|
|
393
|
+
"examples": {
|
|
394
|
+
"story": { "value": { "app": "demo", "person": "q8n2v5x7c1z4", "linkedAt": "2026-11-14T15:10:01.000Z" } },
|
|
395
|
+
"testKey": { "value": { "app": "test-abcdefghij", "person": "test_demo", "linkedAt": "2026-11-14T15:10:01.000Z", "simulated": true } }
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
"400": {
|
|
401
|
+
"description": "The body or the token breaks a rule. Messages: JSON body required; token required; Invalid sign-in token, when it is not a token id.pincast.fm signed for your app (its data.fix says which check failed); Sign-in token expired, when its exp has passed: send a fresh one; testPerson required, when a test key's call has no testPerson.",
|
|
402
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
|
|
403
|
+
},
|
|
404
|
+
"401": { "$ref": "#/components/responses/KeyMissing" },
|
|
405
|
+
"403": {
|
|
406
|
+
"description": "The key is refused, or the token was made for another app. Message: Invalid key, when it has the wrong shape, is unknown, was revoked or belongs to a disabled app. Message: Key expired, when it is past its expiry: use your app's newer key. Message: Key lacks this ability, when a restricted key does not name the ability this call needs: send a key that does. Message: Key kind refused, when this kind of key cannot make this call. Message: Sign-in token is for another app, when its audience names none of your app's sign-in clients. Message: Test person required, when a test key sends token, or a testPerson that does not start test_.",
|
|
407
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
|
|
408
|
+
},
|
|
409
|
+
"429": { "$ref": "#/components/responses/RateLimited" },
|
|
410
|
+
"503": { "$ref": "#/components/responses/SignInCheckUnavailable" },
|
|
411
|
+
"default": { "$ref": "#/components/responses/ServerError" }
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
"/apps": {
|
|
416
|
+
"get": {
|
|
417
|
+
"operationId": "getApps",
|
|
418
|
+
"tags": ["Apps"],
|
|
419
|
+
"summary": "List the apps on Pincast",
|
|
420
|
+
"description": "Every app Pincast lists, with cards on Placecard or without: the featured app first while its slot runs, then every app by name. An app joins the list once Pincast has reviewed it, and leaves it when Pincast hides it or disables it. Pincast sets each app's description, icon, category, color and featured slot at the review.\n\nPublic: no key needed, and a key sent is ignored (never checked, counted or logged), so a web page may call it too. The answer is the same for everyone: the edge keeps it 5 minutes, and may give a copy up to a day old while it fetches a fresh one. Every text field is plain text: escape it before you put it in a page. A HEAD request answers the same status and headers with no body.",
|
|
421
|
+
"security": [],
|
|
422
|
+
"responses": {
|
|
423
|
+
"200": {
|
|
424
|
+
"description": "The listed apps.",
|
|
425
|
+
"headers": {
|
|
426
|
+
"Cache-Control": { "$ref": "#/components/headers/AppsCacheControl" },
|
|
427
|
+
"Access-Control-Allow-Origin": { "$ref": "#/components/headers/AnyOrigin" }
|
|
428
|
+
},
|
|
429
|
+
"content": {
|
|
430
|
+
"application/json": {
|
|
431
|
+
"schema": { "$ref": "#/components/schemas/AppsResponse" },
|
|
432
|
+
"examples": {
|
|
433
|
+
"directory": {
|
|
434
|
+
"summary": "Three listed apps: the featured one first, then the rest by name. Demo shows the story's set: its species card counts, and the tree under it is a place.",
|
|
435
|
+
"value": { "apps": [
|
|
436
|
+
{"id": "skywatch", "name": "Sky Watch", "description": "The birds of your city's parks, one card for each kind you spot.", "url": "https://skywatch.example", "icon": "https://skywatch.example/icon.png", "color": "#2f6f4f", "category": "nature", "featured": {"note": "New on Pincast", "until": null}, "cardApp": true, "cardCount": 3},
|
|
437
|
+
{"id": "demo", "name": "Demo", "description": "The trees of Central Park, one card for each species.", "url": "https://demo.example", "icon": null, "color": "#3b5bdb", "category": "nature", "featured": null, "cardApp": true, "cardCount": 1},
|
|
438
|
+
{"id": "nightowl", "name": "Night Owl", "description": "Late shows and open kitchens near you, after ten.", "url": "https://nightowl.example", "icon": "https://nightowl.example/icon.png", "color": null, "category": "food", "featured": null, "cardApp": false, "cardCount": 0}
|
|
439
|
+
] }
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
"default": { "$ref": "#/components/responses/ServerError" }
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
"/test-apps": {
|
|
450
|
+
"servers": [
|
|
451
|
+
{
|
|
452
|
+
"url": "https://api.pincast.fm/v1",
|
|
453
|
+
"description": "The Pincast address. This call runs here only."
|
|
454
|
+
}
|
|
455
|
+
],
|
|
456
|
+
"post": {
|
|
457
|
+
"operationId": "postTestApp",
|
|
458
|
+
"tags": [
|
|
459
|
+
"Test apps"
|
|
460
|
+
],
|
|
461
|
+
"summary": "Make a test app with no account",
|
|
462
|
+
"description": "Makes a test app and answers with a restricted test key and a one-time claim code. No account and no key. Send it from your server or the command line: a call from a web page is refused. Send no body, or a JSON body with Content-Type: application/json.\n\nThe key holds all six abilities and works on the six keyed calls, for this test app only and for test people only (ids that start test_), up to 60 calls a minute and 2,000 calls a day. The app holds at most 3 sets, 200 cards and 1,000 collects. The app and its key end after 7 days unless someone claims the app. To keep it, open the claim url while signed in to Pincast: the code works once, the key then keeps working with no end date, and the app can hold 20 sets, 2,000 cards and 20,000 collects. The key and the code are shown only in this answer, and Pincast stores only their hashes, so keep them safe.\n\nA test app is never listed and never counts toward anything public. Pincast's database keeps no address or other detail of who called. It takes calls at https://api.pincast.fm/v1 only: at the older address this path answers 404, with no data. Pincast limits how many test apps one source can make, and how many it makes in a day. Each call makes a new app, so this call isn't one to send again after a success.",
|
|
463
|
+
"security": [],
|
|
464
|
+
"requestBody": {
|
|
465
|
+
"required": false,
|
|
466
|
+
"description": "Optional. With no body, the app is named Test app.",
|
|
467
|
+
"content": {
|
|
468
|
+
"application/json": {
|
|
469
|
+
"schema": {
|
|
470
|
+
"$ref": "#/components/schemas/TestAppRequest"
|
|
471
|
+
},
|
|
472
|
+
"examples": {
|
|
473
|
+
"named": {
|
|
474
|
+
"summary": "A test app with a name.",
|
|
475
|
+
"value": {
|
|
476
|
+
"name": "Bird log"
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
},
|
|
483
|
+
"responses": {
|
|
484
|
+
"200": {
|
|
485
|
+
"description": "The test app, its key and its claim code.",
|
|
486
|
+
"headers": {
|
|
487
|
+
"Cache-Control": {
|
|
488
|
+
"$ref": "#/components/headers/NoStore"
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
"content": {
|
|
492
|
+
"application/json": {
|
|
493
|
+
"schema": {
|
|
494
|
+
"$ref": "#/components/schemas/TestAppResponse"
|
|
495
|
+
},
|
|
496
|
+
"examples": {
|
|
497
|
+
"named": {
|
|
498
|
+
"summary": "A new test app. The key and code here are made up.",
|
|
499
|
+
"value": {
|
|
500
|
+
"app": {
|
|
501
|
+
"id": "test-k3f7x2m4qa",
|
|
502
|
+
"name": "Bird log",
|
|
503
|
+
"mode": "test",
|
|
504
|
+
"expiresAt": "2026-11-29T15:04:05.123Z"
|
|
505
|
+
},
|
|
506
|
+
"key": "pck_test-k3f7x2m4qa_rk_Ex4mpleKeyNotRealEx4mpleKeyNotRealEx4mpleKe",
|
|
507
|
+
"keyId": "key_0123456789ab",
|
|
508
|
+
"claim": {
|
|
509
|
+
"code": "pcc_Ex4mpleCodeNotRealEx4mpleCodeNotRealEx4mple",
|
|
510
|
+
"url": "https://pincast.fm/developers/claim#code=pcc_Ex4mpleCodeNotRealEx4mpleCodeNotRealEx4mple",
|
|
511
|
+
"expiresAt": "2026-11-29T15:04:05.123Z"
|
|
512
|
+
},
|
|
513
|
+
"api": "https://api.pincast.fm/v1"
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
},
|
|
520
|
+
"400": {
|
|
521
|
+
"description": "Messages: JSON body required, when a body comes without Content-Type application/json, isn't a JSON object or runs past 2,048 bytes; name required, when name is blank; name must be text. A field other than name is refused, and so is a name past 80 characters or one holding control characters, line separators or characters that reorder text: each answers field_invalid and names the field.",
|
|
522
|
+
"content": {
|
|
523
|
+
"application/json": {
|
|
524
|
+
"schema": {
|
|
525
|
+
"$ref": "#/components/schemas/Error"
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
},
|
|
530
|
+
"403": {
|
|
531
|
+
"description": "The call came from a web page (it carries an Origin header). Message: Browser calls are not allowed.",
|
|
532
|
+
"content": {
|
|
533
|
+
"application/json": {
|
|
534
|
+
"schema": {
|
|
535
|
+
"$ref": "#/components/schemas/Error"
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
},
|
|
540
|
+
"429": {
|
|
541
|
+
"description": "Pincast has made all the test apps it makes in a day. Wait the seconds in the Retry-After header. Pincast's edge can also answer 429 when one source makes too many, with a body of its own.",
|
|
542
|
+
"headers": {
|
|
543
|
+
"Retry-After": {
|
|
544
|
+
"$ref": "#/components/headers/TestAppsRetryAfter"
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
"content": {
|
|
548
|
+
"application/json": {
|
|
549
|
+
"schema": {
|
|
550
|
+
"$ref": "#/components/schemas/Error"
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
"default": {
|
|
556
|
+
"$ref": "#/components/responses/ServerError"
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
},
|
|
562
|
+
"components": {
|
|
563
|
+
"securitySchemes": {
|
|
564
|
+
"pincastKey": {
|
|
565
|
+
"type": "apiKey",
|
|
566
|
+
"in": "header",
|
|
567
|
+
"name": "X-Pincast-Key",
|
|
568
|
+
"description": "Your app's key, sent on every call from your server only. It reads pck_, your app id, an underscore, then a secret of 20 or more letters, digits, underscores or hyphens. Never put it in a web page, an app bundle or a query string. Placecard stores only its sha256.\n\nA secret key may make every call. A restricted key may make only the calls its abilities name, and each call's page names the one it needs. A newer key shows its kind right after your app id, sk_ for secret and rk_ for restricted, so you and a leak scanner can tell them apart. An older key has no mark and works as a secret key.\n\nYour app can hold two working keys at once, in test and in live each, so a key is replaced with no outage: the new key works at once, and the old one keeps working until its expiry (seven days after the new key is made, unless you ask for less). A revoked key is refused from the next call.\n\nX-Placecard-Key, the older name of this header, is taken too, at either address. Send one of the two; if both come and they differ, the call answers 400 key_conflict."
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
"parameters": {
|
|
572
|
+
"Set": {
|
|
573
|
+
"name": "set",
|
|
574
|
+
"in": "path",
|
|
575
|
+
"required": true,
|
|
576
|
+
"description": "Your set's id, chosen by your app.",
|
|
577
|
+
"schema": { "$ref": "#/components/schemas/SetId" },
|
|
578
|
+
"examples": { "story": { "value": "central-park-trees" } }
|
|
579
|
+
},
|
|
580
|
+
"Actor": {
|
|
581
|
+
"name": "actor",
|
|
582
|
+
"in": "query",
|
|
583
|
+
"required": true,
|
|
584
|
+
"description": "The person's id as your app sends it in collects. Repeat the parameter for up to three ids of the same person.",
|
|
585
|
+
"style": "form",
|
|
586
|
+
"explode": true,
|
|
587
|
+
"schema": {
|
|
588
|
+
"type": "array",
|
|
589
|
+
"minItems": 1,
|
|
590
|
+
"maxItems": 3,
|
|
591
|
+
"items": { "type": "string", "minLength": 1, "maxLength": 255 }
|
|
592
|
+
},
|
|
593
|
+
"examples": { "story": { "value": ["guest-7f3c9a2e5b41"] } }
|
|
594
|
+
},
|
|
595
|
+
"IdempotencyKey": {
|
|
596
|
+
"name": "Idempotency-Key",
|
|
597
|
+
"in": "header",
|
|
598
|
+
"required": false,
|
|
599
|
+
"description": "Optional, on the three writes. A string your app makes for one request, a UUID for example, and sends again unchanged with each retry of that request. Placecard keeps the first 200 answer to it for 24 hours, for your app only. A retry with the same key and the same request (method, path and body; the order of keys in the body does not matter) answers that answer again, marked Idempotent-Replayed: true, and runs nothing. The same key with a different request answers 422. A refused call keeps nothing, so its retry runs again.",
|
|
600
|
+
"schema": { "type": "string", "pattern": "^[\\x21-\\x7E]{1,255}$", "description": "1 to 255 visible ASCII characters, with no spaces." },
|
|
601
|
+
"examples": { "retry": { "value": "5f0c2a9e-7d41-4b8e-a3c6-1e9d2b7f4a60" } }
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
"headers": {
|
|
605
|
+
"IdempotentReplayed": {
|
|
606
|
+
"description": "true when this answer is the kept answer to your Idempotency-Key, given again. Not sent otherwise.",
|
|
607
|
+
"schema": { "type": "string", "const": "true" }
|
|
608
|
+
},
|
|
609
|
+
"RetryAfter": {
|
|
610
|
+
"description": "The seconds to wait before you send the call again, from 1 to 60.",
|
|
611
|
+
"schema": { "type": "integer", "minimum": 1, "maximum": 60 }
|
|
612
|
+
},
|
|
613
|
+
"LimitRetryAfter": {
|
|
614
|
+
"description": "The seconds to wait before you send the call again: from 1 to 60 past the minute limit, and up to 86400, the seconds to the next UTC midnight, past the daily quota.",
|
|
615
|
+
"schema": { "type": "integer", "minimum": 1, "maximum": 86400 }
|
|
616
|
+
},
|
|
617
|
+
"AppsCacheControl": {
|
|
618
|
+
"description": "The edge keeps the list 5 minutes, and may give a copy up to a day old while it fetches a fresh one.",
|
|
619
|
+
"schema": { "type": "string", "const": "public, s-maxage=300, stale-while-revalidate=86400" }
|
|
620
|
+
},
|
|
621
|
+
"NoStore": {
|
|
622
|
+
"description": "The answer holds a key, so nothing may keep it.",
|
|
623
|
+
"schema": { "type": "string", "const": "no-store" }
|
|
624
|
+
},
|
|
625
|
+
"TestAppsRetryAfter": {
|
|
626
|
+
"description": "The seconds until Pincast can make another test app, from 1 to 86400.",
|
|
627
|
+
"schema": { "type": "integer", "minimum": 1, "maximum": 86400 }
|
|
628
|
+
},
|
|
629
|
+
"AnyOrigin": {
|
|
630
|
+
"description": "Any web page may read the list.",
|
|
631
|
+
"schema": { "type": "string", "const": "*" }
|
|
632
|
+
}
|
|
633
|
+
},
|
|
634
|
+
"responses": {
|
|
635
|
+
"KeyMissing": {
|
|
636
|
+
"description": "No key was sent. Message: X-Pincast-Key required (X-Placecard-Key required at the older address).",
|
|
637
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
|
|
638
|
+
},
|
|
639
|
+
"KeyRefused": {
|
|
640
|
+
"description": "The key is refused. Message: Invalid key, when it has the wrong shape, is unknown, was revoked or belongs to a disabled app. Message: Key expired, when it is past its expiry: use your app's newer key. Message: Key lacks this ability, when a restricted key does not name the ability this call needs: send a key that does. Message: Key kind refused, when this kind of key cannot make this call.",
|
|
641
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
|
|
642
|
+
},
|
|
643
|
+
"SetMissing": {
|
|
644
|
+
"description": "Your app has no set with this id. Message: Set <id> is not registered.",
|
|
645
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
|
|
646
|
+
},
|
|
647
|
+
"IdempotencyKeyReused": {
|
|
648
|
+
"description": "Your app already used this Idempotency-Key, in the last 24 hours, for a different request. Message: Idempotency-Key already used for a different request.",
|
|
649
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
|
|
650
|
+
},
|
|
651
|
+
"RateLimited": {
|
|
652
|
+
"description": "Your key made as many calls in the last 60 seconds as its limit allows: 600 unless Pincast gave it a limit of its own, and 60 for the key POST /test-apps makes. Message: Too many requests. Or your app made all the calls its daily quota allows, counted across its keys for the UTC day: 2,000 for a test app, 50,000 for a live app that isn't listed, 200,000 for a listed app, unless Pincast set a quota of its own. Message: Daily call quota reached. Either way, wait the seconds in Retry-After, then send the call again. A call refused at the minute limit counts toward nothing. A call refused at the quota adds nothing to the day, and it still takes a place in the key's minute.",
|
|
653
|
+
"headers": { "Retry-After": { "$ref": "#/components/headers/LimitRetryAfter" } },
|
|
654
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
|
|
655
|
+
},
|
|
656
|
+
"WriteRefused": {
|
|
657
|
+
"description": "The key is refused, or the person is not signed in to your app. Message: Invalid key, when it has the wrong shape, is unknown, was revoked or belongs to a disabled app. Message: Key expired, when it is past its expiry: use your app's newer key. Message: Key lacks this ability, when a restricted key does not name the ability this call needs: send a key that does. Message: Key kind refused, when this kind of key cannot make this call. Message: Person not signed in to this app, when the call is for a signed in person your app has not sent a sign-in token for: send it with POST /people, then send this call again. Message: Test person required, when a test key's call names a person whose id does not start test_: send a test person, such as test_demo.",
|
|
658
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
|
|
659
|
+
},
|
|
660
|
+
"SignInCheckUnavailable": {
|
|
661
|
+
"description": "Placecard could not reach id.pincast.fm to check the token, or the token names a key Placecard has not seen yet: id.pincast.fm's keys are checked again at most once a minute, so a key it just started using works within a minute. Message: Sign-in check unavailable. Wait the seconds in Retry-After, then send the same call again.",
|
|
662
|
+
"headers": { "Retry-After": { "$ref": "#/components/headers/RetryAfter" } },
|
|
663
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
|
|
664
|
+
},
|
|
665
|
+
"ServerError": {
|
|
666
|
+
"description": "Something failed on Placecard's side. Message: internal server error. Safe to send the same call again later.",
|
|
667
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
|
|
668
|
+
}
|
|
669
|
+
},
|
|
670
|
+
"schemas": {
|
|
671
|
+
"Error": {
|
|
672
|
+
"type": "object",
|
|
673
|
+
"description": "The body of every error. message says what was wrong, for a person to read; statusCode repeats the HTTP status; data, on every 4xx and on a 503, says what to do.",
|
|
674
|
+
"required": ["url", "statusCode", "statusMessage", "message"],
|
|
675
|
+
"additionalProperties": false,
|
|
676
|
+
"properties": {
|
|
677
|
+
"url": { "type": "string", "description": "The path that was called." },
|
|
678
|
+
"statusCode": { "type": "integer", "minimum": 400, "maximum": 599 },
|
|
679
|
+
"statusMessage": { "type": "string", "description": "Empty, or Not Found on a 404." },
|
|
680
|
+
"message": { "type": "string" },
|
|
681
|
+
"stack": { "type": "string", "description": "Always empty in production." },
|
|
682
|
+
"data": { "$ref": "#/components/schemas/ErrorData" }
|
|
683
|
+
}
|
|
684
|
+
},
|
|
685
|
+
"ErrorData": {
|
|
686
|
+
"type": "object",
|
|
687
|
+
"description": "What to do about a 4xx or a 503. Branch on code: it stays the same from release to release, while message and fix are for people and may be worded better later.",
|
|
688
|
+
"required": ["code", "fix"],
|
|
689
|
+
"additionalProperties": false,
|
|
690
|
+
"properties": {
|
|
691
|
+
"code": {
|
|
692
|
+
"type": "string",
|
|
693
|
+
"enum": ["key_missing", "key_invalid", "key_expired", "key_conflict", "key_ability_missing", "key_kind_refused", "test_person_required", "test_limit_reached", "test_apps_limit", "browser_not_allowed", "rate_limited", "quota_exceeded", "set_id_invalid", "idempotency_key_invalid", "body_not_json", "field_required", "field_invalid", "too_many_cards", "duplicate_card_key", "parent_not_registered", "too_many_actors", "same_player", "set_not_registered", "card_not_registered", "card_retired", "actor_signed_in", "idempotency_key_reused", "token_invalid", "token_expired", "token_other_app", "person_not_signed_in", "signin_check_unavailable"],
|
|
694
|
+
"description": "Each code with the status it comes with: key_missing 401, key_invalid 403, key_expired 403, key_conflict 400, key_ability_missing 403, key_kind_refused 403, test_person_required 403, test_limit_reached 409, test_apps_limit 429, browser_not_allowed 403, rate_limited 429, quota_exceeded 429, set_id_invalid 400, idempotency_key_invalid 400, body_not_json 400, field_required 400, field_invalid 400, too_many_cards 400, duplicate_card_key 400, parent_not_registered 400, too_many_actors 400, same_player 400, set_not_registered 404, card_not_registered 404, card_retired 409, actor_signed_in 409, idempotency_key_reused 422, token_invalid 400, token_expired 400, token_other_app 403, person_not_signed_in 403, signin_check_unavailable 503. field_required is a field left out or blank; field_invalid is one sent with the wrong type, shape, length or range. key_conflict is a call that sent X-Pincast-Key and X-Placecard-Key with different keys. key_ability_missing is a restricted key that does not name what this call needs. key_kind_refused is a kind of key that cannot make this call. test_person_required is a test key's call for a person whose id does not start test_, or one that sends a sign-in token. test_limit_reached is a test key's write that would take its test app past the test limits. test_apps_limit is POST /test-apps when Pincast has made all the test apps it makes in a day. browser_not_allowed is POST /test-apps called from a web page. quota_exceeded is a call past your app's quota of calls for the UTC day."
|
|
695
|
+
},
|
|
696
|
+
"field": { "type": "string", "description": "Where the fault is: a body field's path (name, meta.checkout, cards[3].key, card.title, actor.id, from, to, token, testPerson), the set path parameter (set), the actor query parameter (actor), or a header (X-Pincast-Key at api.pincast.fm, X-Placecard-Key at the older address, Idempotency-Key). Left out when no one field is at fault." },
|
|
697
|
+
"fix": { "type": "string", "minLength": 1, "description": "What to send instead, in one sentence." }
|
|
698
|
+
}
|
|
699
|
+
},
|
|
700
|
+
"SetId": {
|
|
701
|
+
"type": "string",
|
|
702
|
+
"description": "Lowercase letters, digits, underscores and hyphens, starting with a letter or digit, 64 characters at most.",
|
|
703
|
+
"pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
|
|
704
|
+
},
|
|
705
|
+
"CardKey": {
|
|
706
|
+
"type": "string",
|
|
707
|
+
"description": "Your app's own id for the card, unique in the set: letters, digits and : _ . or hyphen, starting with a letter or digit, 128 characters at most.",
|
|
708
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9:_.-]{0,127}$"
|
|
709
|
+
},
|
|
710
|
+
"CardType": {
|
|
711
|
+
"type": "string",
|
|
712
|
+
"description": "Your app's own word for the kind of card (species, tree): a lowercase word of 32 characters at most.",
|
|
713
|
+
"pattern": "^[a-z][a-z0-9_-]{0,31}$"
|
|
714
|
+
},
|
|
715
|
+
"Time": {
|
|
716
|
+
"type": "string",
|
|
717
|
+
"format": "date-time",
|
|
718
|
+
"description": "An ISO 8601 time."
|
|
719
|
+
},
|
|
720
|
+
"TypeCounts": {
|
|
721
|
+
"type": "object",
|
|
722
|
+
"description": "A count for each card type.",
|
|
723
|
+
"propertyNames": { "$ref": "#/components/schemas/CardType" },
|
|
724
|
+
"additionalProperties": { "type": "integer", "minimum": 1 }
|
|
725
|
+
},
|
|
726
|
+
"Card": {
|
|
727
|
+
"type": "object",
|
|
728
|
+
"description": "One card as your app sends it. An empty string or null counts as left out. The server ignores fields not listed here.",
|
|
729
|
+
"required": ["key", "type", "title"],
|
|
730
|
+
"additionalProperties": false,
|
|
731
|
+
"dependentRequired": { "lat": ["lng"], "lng": ["lat"] },
|
|
732
|
+
"properties": {
|
|
733
|
+
"key": { "$ref": "#/components/schemas/CardKey" },
|
|
734
|
+
"type": { "$ref": "#/components/schemas/CardType" },
|
|
735
|
+
"parent": {
|
|
736
|
+
"$ref": "#/components/schemas/CardKey",
|
|
737
|
+
"description": "The key of the card this one belongs to (a tree card's species card). It must be in the same call or already registered, and is never the card itself."
|
|
738
|
+
},
|
|
739
|
+
"title": { "type": "string", "minLength": 1, "maxLength": 200 },
|
|
740
|
+
"subtitle": { "type": "string", "maxLength": 200 },
|
|
741
|
+
"fact": { "type": "string", "maxLength": 300 },
|
|
742
|
+
"rarity": { "type": "string", "maxLength": 32, "description": "Your app's own word, printed as given." },
|
|
743
|
+
"foil": { "type": "boolean", "description": "Only true makes a foil card." },
|
|
744
|
+
"image": {
|
|
745
|
+
"type": "object",
|
|
746
|
+
"additionalProperties": false,
|
|
747
|
+
"properties": {
|
|
748
|
+
"url": { "type": "string", "maxLength": 1000, "pattern": "^https?://" },
|
|
749
|
+
"credit": { "type": "string", "maxLength": 300 },
|
|
750
|
+
"license": { "type": "string", "maxLength": 100 }
|
|
751
|
+
}
|
|
752
|
+
},
|
|
753
|
+
"url": { "type": "string", "maxLength": 1000, "pattern": "^https?://", "description": "Where your app plays this card." },
|
|
754
|
+
"lat": { "type": "number", "minimum": -90, "maximum": 90, "description": "Sent with lng. A numeric string is also accepted." },
|
|
755
|
+
"lng": { "type": "number", "minimum": -180, "maximum": 180, "description": "Sent with lat. A numeric string is also accepted." },
|
|
756
|
+
"data": { "type": "object", "description": "Anything else your card's face needs, under 8000 characters as JSON." },
|
|
757
|
+
"status": { "type": "string", "enum": ["active", "retired"], "default": "active", "description": "A retired card stays with the people who hold it and takes no new collects." }
|
|
758
|
+
}
|
|
759
|
+
},
|
|
760
|
+
"PutSetRequest": {
|
|
761
|
+
"type": "object",
|
|
762
|
+
"required": ["name"],
|
|
763
|
+
"additionalProperties": false,
|
|
764
|
+
"properties": {
|
|
765
|
+
"name": { "type": "string", "minLength": 1, "maxLength": 120, "description": "Trimmed before the check." },
|
|
766
|
+
"meta": { "type": "object", "description": "Anything about the set your app wants kept, under 8000 characters as JSON. Two keys matter to every app: listed (false keeps the set off the map, the front page and card pages for people who do not hold its cards) and checkout (refused with field_invalid unless it is one of Pincast's own checkout paths for your app; selling through Pincast's checkout comes later)." },
|
|
767
|
+
"cards": { "type": "array", "maxItems": 5000, "items": { "$ref": "#/components/schemas/Card" } }
|
|
768
|
+
}
|
|
769
|
+
},
|
|
770
|
+
"PutSetResponse": {
|
|
771
|
+
"type": "object",
|
|
772
|
+
"required": ["app", "set", "name", "setCreated", "cards", "active"],
|
|
773
|
+
"additionalProperties": false,
|
|
774
|
+
"properties": {
|
|
775
|
+
"app": { "type": "string", "description": "Your app's id." },
|
|
776
|
+
"set": { "$ref": "#/components/schemas/SetId" },
|
|
777
|
+
"name": { "type": "string" },
|
|
778
|
+
"setCreated": { "type": "boolean", "description": "True when this call created the set." },
|
|
779
|
+
"cards": {
|
|
780
|
+
"type": "object",
|
|
781
|
+
"required": ["created", "updated", "unchanged", "parentsSet"],
|
|
782
|
+
"additionalProperties": false,
|
|
783
|
+
"properties": {
|
|
784
|
+
"created": { "type": "integer", "minimum": 0 },
|
|
785
|
+
"updated": { "type": "integer", "minimum": 0 },
|
|
786
|
+
"unchanged": { "type": "integer", "minimum": 0 },
|
|
787
|
+
"parentsSet": { "type": "integer", "minimum": 0, "description": "Cards whose parent this call set or changed." }
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
"active": { "$ref": "#/components/schemas/TypeCounts" }
|
|
791
|
+
}
|
|
792
|
+
},
|
|
793
|
+
"SetResponse": {
|
|
794
|
+
"type": "object",
|
|
795
|
+
"required": ["app", "set", "name", "meta", "updatedAt", "active", "collects", "players", "listing"],
|
|
796
|
+
"additionalProperties": false,
|
|
797
|
+
"properties": {
|
|
798
|
+
"app": { "type": "string" },
|
|
799
|
+
"set": { "$ref": "#/components/schemas/SetId" },
|
|
800
|
+
"name": { "type": "string" },
|
|
801
|
+
"meta": { "type": "object" },
|
|
802
|
+
"updatedAt": { "$ref": "#/components/schemas/Time" },
|
|
803
|
+
"active": { "$ref": "#/components/schemas/TypeCounts" },
|
|
804
|
+
"collects": { "type": "integer", "minimum": 0, "description": "Cards collected directly, one per person and card." },
|
|
805
|
+
"players": { "type": "integer", "minimum": 0, "description": "People who collected at least one card." },
|
|
806
|
+
"listing": {
|
|
807
|
+
"type": "object",
|
|
808
|
+
"description": "Whether the set lists: on the Placecard map, the front page and card pages for people who do not hold its cards. A new app's sets list once Pincast has reviewed the app.",
|
|
809
|
+
"required": ["listed", "reason"],
|
|
810
|
+
"additionalProperties": false,
|
|
811
|
+
"properties": {
|
|
812
|
+
"listed": { "type": "boolean" },
|
|
813
|
+
"reason": {
|
|
814
|
+
"type": ["string", "null"],
|
|
815
|
+
"enum": ["app_not_reviewed", "app_hidden", "set_hidden", "set_off", null],
|
|
816
|
+
"description": "Null when the set lists, otherwise the first reason it doesn't: app_not_reviewed (Pincast hasn't reviewed your app yet; a test app always answers this, because it never lists), app_hidden or set_hidden (Pincast took your app or this set off the lists; ask us why), set_off (your own meta.listed is false). People keep the cards they hold either way, and your key keeps writing."
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
},
|
|
822
|
+
"Actor": {
|
|
823
|
+
"type": "object",
|
|
824
|
+
"required": ["id", "source"],
|
|
825
|
+
"additionalProperties": false,
|
|
826
|
+
"properties": {
|
|
827
|
+
"id": { "type": "string", "minLength": 1, "maxLength": 255, "description": "A Logto id, or your app's guest token for this device. Trimmed before the check. Under a test key, an id that starts test_." },
|
|
828
|
+
"source": { "type": "string", "enum": ["logto", "anonymous"], "description": "logto for a signed in person, once your app has sent their sign-in token with POST /people; anonymous for a guest token, never a person's id (409 actor_signed_in for an id that holds cards in your app as a signed-in person)." }
|
|
829
|
+
}
|
|
830
|
+
},
|
|
831
|
+
"CollectRequest": {
|
|
832
|
+
"type": "object",
|
|
833
|
+
"required": ["card", "actor"],
|
|
834
|
+
"additionalProperties": false,
|
|
835
|
+
"dependentRequired": { "lat": ["lng"], "lng": ["lat"] },
|
|
836
|
+
"properties": {
|
|
837
|
+
"card": {
|
|
838
|
+
"description": "The card's key, or the whole card to register or update it first.",
|
|
839
|
+
"oneOf": [
|
|
840
|
+
{ "$ref": "#/components/schemas/CardKey" },
|
|
841
|
+
{ "$ref": "#/components/schemas/Card" }
|
|
842
|
+
]
|
|
843
|
+
},
|
|
844
|
+
"actor": { "$ref": "#/components/schemas/Actor" },
|
|
845
|
+
"at": { "$ref": "#/components/schemas/Time", "description": "When it was collected, on your app's clock. Not more than five minutes ahead of Placecard's clock, and not before 2015. Leave it out for now." },
|
|
846
|
+
"lat": { "type": "number", "minimum": -90, "maximum": 90, "description": "Where it was collected. Sent with lng." },
|
|
847
|
+
"lng": { "type": "number", "minimum": -180, "maximum": 180, "description": "Sent with lat." },
|
|
848
|
+
"accuracy": { "type": "number", "minimum": 0, "description": "How sure the place is, in metres." }
|
|
849
|
+
}
|
|
850
|
+
},
|
|
851
|
+
"CollectResponse": {
|
|
852
|
+
"type": "object",
|
|
853
|
+
"required": ["collected", "first", "count", "collectedAt", "card", "parent"],
|
|
854
|
+
"additionalProperties": false,
|
|
855
|
+
"properties": {
|
|
856
|
+
"collected": { "const": true },
|
|
857
|
+
"first": { "type": "boolean", "description": "True when this collect's time is this person's first hold of the card, so a resend answers as the first send did." },
|
|
858
|
+
"count": { "type": "integer", "minimum": 1, "description": "How many times this person collected the card directly." },
|
|
859
|
+
"collectedAt": { "$ref": "#/components/schemas/Time", "description": "This person's first collect of the card." },
|
|
860
|
+
"card": {
|
|
861
|
+
"type": "object",
|
|
862
|
+
"required": ["key", "type"],
|
|
863
|
+
"additionalProperties": false,
|
|
864
|
+
"properties": {
|
|
865
|
+
"key": { "$ref": "#/components/schemas/CardKey" },
|
|
866
|
+
"type": { "$ref": "#/components/schemas/CardType" }
|
|
867
|
+
}
|
|
868
|
+
},
|
|
869
|
+
"parent": {
|
|
870
|
+
"type": ["object", "null"],
|
|
871
|
+
"description": "The parent card, held through this one; null when the card has none.",
|
|
872
|
+
"required": ["key", "first"],
|
|
873
|
+
"additionalProperties": false,
|
|
874
|
+
"properties": {
|
|
875
|
+
"key": { "$ref": "#/components/schemas/CardKey" },
|
|
876
|
+
"first": { "type": "boolean", "description": "True when this collect is this person's first hold of the parent: its time is their first hold of the parent, and through this card." }
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
},
|
|
881
|
+
"HeldCard": {
|
|
882
|
+
"type": "object",
|
|
883
|
+
"required": ["key", "type", "parent", "via", "collectedAt", "lastCollectedAt", "count", "source"],
|
|
884
|
+
"additionalProperties": false,
|
|
885
|
+
"properties": {
|
|
886
|
+
"key": { "$ref": "#/components/schemas/CardKey" },
|
|
887
|
+
"type": { "$ref": "#/components/schemas/CardType" },
|
|
888
|
+
"parent": { "type": ["string", "null"], "description": "The key of the card this one belongs to." },
|
|
889
|
+
"via": { "type": ["string", "null"], "description": "The child card this one was first held through, when it was." },
|
|
890
|
+
"collectedAt": { "$ref": "#/components/schemas/Time" },
|
|
891
|
+
"lastCollectedAt": { "$ref": "#/components/schemas/Time" },
|
|
892
|
+
"count": { "type": "integer", "minimum": 0, "description": "Direct collects; 0 when held only through a child card." },
|
|
893
|
+
"source": { "type": "string", "enum": ["logto", "anonymous"] }
|
|
894
|
+
}
|
|
895
|
+
},
|
|
896
|
+
"CollectsResponse": {
|
|
897
|
+
"type": "object",
|
|
898
|
+
"required": ["app", "set", "held", "cards"],
|
|
899
|
+
"additionalProperties": false,
|
|
900
|
+
"properties": {
|
|
901
|
+
"app": { "type": "string" },
|
|
902
|
+
"set": { "$ref": "#/components/schemas/SetId" },
|
|
903
|
+
"held": { "$ref": "#/components/schemas/TypeCounts" },
|
|
904
|
+
"cards": { "type": "array", "items": { "$ref": "#/components/schemas/HeldCard" } }
|
|
905
|
+
}
|
|
906
|
+
},
|
|
907
|
+
"ClaimRequest": {
|
|
908
|
+
"type": "object",
|
|
909
|
+
"required": ["from", "to"],
|
|
910
|
+
"additionalProperties": false,
|
|
911
|
+
"properties": {
|
|
912
|
+
"from": { "type": "string", "minLength": 1, "maxLength": 255, "description": "This device's guest token, as your app read it. Under a test key, an id that starts test_." },
|
|
913
|
+
"to": { "type": "string", "minLength": 1, "maxLength": 255, "description": "The Logto id of the person who just signed in, once your app has sent their sign-in token with POST /people. Never the same as from. Under a test key, an id that starts test_." }
|
|
914
|
+
}
|
|
915
|
+
},
|
|
916
|
+
"ClaimResponse": {
|
|
917
|
+
"type": "object",
|
|
918
|
+
"required": ["app", "set", "claimed", "moved", "merged"],
|
|
919
|
+
"additionalProperties": false,
|
|
920
|
+
"properties": {
|
|
921
|
+
"app": { "type": "string" },
|
|
922
|
+
"set": { "$ref": "#/components/schemas/SetId" },
|
|
923
|
+
"claimed": { "type": "integer", "minimum": 0 },
|
|
924
|
+
"moved": { "type": "integer", "minimum": 0 },
|
|
925
|
+
"merged": { "type": "integer", "minimum": 0 }
|
|
926
|
+
}
|
|
927
|
+
},
|
|
928
|
+
"PersonRequest": {
|
|
929
|
+
"type": "object",
|
|
930
|
+
"description": "token under a live key, testPerson under a test key.",
|
|
931
|
+
"oneOf": [{ "required": ["token"] }, { "required": ["testPerson"] }],
|
|
932
|
+
"additionalProperties": false,
|
|
933
|
+
"properties": {
|
|
934
|
+
"token": { "type": "string", "minLength": 1, "maxLength": 8192, "description": "The person's ID token from id.pincast.fm, a JWT, exactly as your app received it at sign-in. Refused under a test key." },
|
|
935
|
+
"testPerson": { "type": "string", "pattern": "^test_[a-z0-9_-]{1,64}$", "description": "Under a test key: the test person to answer for, such as test_demo. Nothing is stored." }
|
|
936
|
+
}
|
|
937
|
+
},
|
|
938
|
+
"PersonResponse": {
|
|
939
|
+
"type": "object",
|
|
940
|
+
"required": ["app", "person", "linkedAt"],
|
|
941
|
+
"additionalProperties": false,
|
|
942
|
+
"properties": {
|
|
943
|
+
"app": { "type": "string" },
|
|
944
|
+
"person": { "type": "string", "minLength": 1, "maxLength": 255, "description": "The person's Logto id, the token's subject, or under a test key the testPerson you sent: send it as actor.id and as to." },
|
|
945
|
+
"linkedAt": { "$ref": "#/components/schemas/Time" },
|
|
946
|
+
"simulated": { "const": true, "description": "Present only under a test key: nothing was stored." }
|
|
947
|
+
}
|
|
948
|
+
},
|
|
949
|
+
"TestAppRequest": {
|
|
950
|
+
"type": "object",
|
|
951
|
+
"additionalProperties": false,
|
|
952
|
+
"description": "What POST /test-apps takes. Any other field is refused.",
|
|
953
|
+
"properties": {
|
|
954
|
+
"name": {
|
|
955
|
+
"type": "string",
|
|
956
|
+
"minLength": 1,
|
|
957
|
+
"maxLength": 80,
|
|
958
|
+
"description": "The app's name. Left out, it is Test app."
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
},
|
|
962
|
+
"TestAppResponse": {
|
|
963
|
+
"type": "object",
|
|
964
|
+
"required": [
|
|
965
|
+
"app",
|
|
966
|
+
"key",
|
|
967
|
+
"keyId",
|
|
968
|
+
"claim",
|
|
969
|
+
"api"
|
|
970
|
+
],
|
|
971
|
+
"additionalProperties": false,
|
|
972
|
+
"properties": {
|
|
973
|
+
"app": {
|
|
974
|
+
"type": "object",
|
|
975
|
+
"required": [
|
|
976
|
+
"id",
|
|
977
|
+
"name",
|
|
978
|
+
"mode",
|
|
979
|
+
"expiresAt"
|
|
980
|
+
],
|
|
981
|
+
"additionalProperties": false,
|
|
982
|
+
"properties": {
|
|
983
|
+
"id": {
|
|
984
|
+
"type": "string",
|
|
985
|
+
"pattern": "^test-[a-z2-7]{10}$"
|
|
986
|
+
},
|
|
987
|
+
"name": {
|
|
988
|
+
"type": "string",
|
|
989
|
+
"minLength": 1,
|
|
990
|
+
"maxLength": 80
|
|
991
|
+
},
|
|
992
|
+
"mode": {
|
|
993
|
+
"const": "test"
|
|
994
|
+
},
|
|
995
|
+
"expiresAt": {
|
|
996
|
+
"$ref": "#/components/schemas/Time"
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
},
|
|
1000
|
+
"key": {
|
|
1001
|
+
"type": "string",
|
|
1002
|
+
"pattern": "^pck_test-[a-z2-7]{10}_rk_[A-Za-z0-9_-]{43}$",
|
|
1003
|
+
"description": "The restricted test key, shown only here. Send it in X-Pincast-Key."
|
|
1004
|
+
},
|
|
1005
|
+
"keyId": {
|
|
1006
|
+
"type": "string",
|
|
1007
|
+
"pattern": "^key_[a-f0-9]{12}$"
|
|
1008
|
+
},
|
|
1009
|
+
"claim": {
|
|
1010
|
+
"type": "object",
|
|
1011
|
+
"required": [
|
|
1012
|
+
"code",
|
|
1013
|
+
"url",
|
|
1014
|
+
"expiresAt"
|
|
1015
|
+
],
|
|
1016
|
+
"additionalProperties": false,
|
|
1017
|
+
"properties": {
|
|
1018
|
+
"code": {
|
|
1019
|
+
"type": "string",
|
|
1020
|
+
"pattern": "^pcc_[A-Za-z0-9_-]{43}$",
|
|
1021
|
+
"description": "Works once, shown only here."
|
|
1022
|
+
},
|
|
1023
|
+
"url": {
|
|
1024
|
+
"type": "string",
|
|
1025
|
+
"pattern": "^https://pincast\\.fm/developers/claim#code=pcc_[A-Za-z0-9_-]{43}$",
|
|
1026
|
+
"description": "Open it signed in to Pincast to keep this app."
|
|
1027
|
+
},
|
|
1028
|
+
"expiresAt": {
|
|
1029
|
+
"$ref": "#/components/schemas/Time"
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
},
|
|
1033
|
+
"api": {
|
|
1034
|
+
"const": "https://api.pincast.fm/v1"
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
},
|
|
1038
|
+
"AppsResponse": {
|
|
1039
|
+
"type": "object",
|
|
1040
|
+
"required": ["apps"],
|
|
1041
|
+
"additionalProperties": false,
|
|
1042
|
+
"properties": {
|
|
1043
|
+
"apps": { "type": "array", "items": { "$ref": "#/components/schemas/App" }, "description": "The featured app first while its slot runs, then every app by name." }
|
|
1044
|
+
}
|
|
1045
|
+
},
|
|
1046
|
+
"App": {
|
|
1047
|
+
"type": "object",
|
|
1048
|
+
"required": ["id", "name", "description", "url", "icon", "color", "category", "featured", "cardApp", "cardCount"],
|
|
1049
|
+
"additionalProperties": false,
|
|
1050
|
+
"properties": {
|
|
1051
|
+
"id": { "type": "string", "pattern": "^[a-z0-9-]{1,32}$", "description": "The app's id: the one in its key, and app on every set and card." },
|
|
1052
|
+
"name": { "type": "string", "minLength": 1, "maxLength": 80 },
|
|
1053
|
+
"description": { "type": ["string", "null"], "minLength": 1, "maxLength": 200, "description": "What the app is, in a sentence or two of plain text. Null when it has none yet." },
|
|
1054
|
+
"url": { "type": ["string", "null"], "pattern": "^https://", "description": "The app's home page, always https. Null when it has none." },
|
|
1055
|
+
"icon": { "type": ["string", "null"], "pattern": "^https://\\S+$", "maxLength": 1000, "description": "The address of the app's icon, always https. Null when it has none." },
|
|
1056
|
+
"color": { "type": ["string", "null"], "pattern": "^#[0-9a-fA-F]{6}$", "description": "The app's color as #rrggbb, for its chips, pins and marks. Null when it has none." },
|
|
1057
|
+
"category": { "type": ["string", "null"], "enum": ["walks", "nature", "history", "art", "food", "games", "making", null], "description": "What kind of app it is, one of a short list Pincast keeps. The list may grow. Null when it has none yet." },
|
|
1058
|
+
"featured": {
|
|
1059
|
+
"type": ["object", "null"],
|
|
1060
|
+
"required": ["note", "until"],
|
|
1061
|
+
"additionalProperties": false,
|
|
1062
|
+
"description": "Set on the featured app while its slot runs, null on every other app. One app at a time.",
|
|
1063
|
+
"properties": {
|
|
1064
|
+
"note": { "type": ["string", "null"], "minLength": 1, "maxLength": 200, "description": "A line on why the app is featured, or null." },
|
|
1065
|
+
"until": { "type": ["string", "null"], "format": "date-time", "description": "When the slot ends, or null when Pincast ends it by hand." }
|
|
1066
|
+
}
|
|
1067
|
+
},
|
|
1068
|
+
"cardApp": { "type": "boolean", "description": "true when the app has cards on Placecard: a listed set with one card or more." },
|
|
1069
|
+
"cardCount": { "type": "integer", "minimum": 0, "description": "The cards in the app's listed sets that Placecard shows as cards: active ones that show on their own: not an experience (a walk, say), not a place (a tree), and with no parent or an experience for a parent." }
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
}
|