@vimine/sdk 0.2.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 +97 -0
- package/dist/elements.d.ts +37 -0
- package/dist/elements.js +331 -0
- package/dist/elements.js.map +1 -0
- package/dist/errors.d.ts +51 -0
- package/dist/errors.js +50 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated.d.ts +557 -0
- package/dist/generated.js +57 -0
- package/dist/generated.js.map +1 -0
- package/dist/index.d.ts +205 -0
- package/dist/index.js +401 -0
- package/dist/index.js.map +1 -0
- package/dist/pkce.d.ts +14 -0
- package/dist/pkce.js +34 -0
- package/dist/pkce.js.map +1 -0
- package/dist/public.d.ts +43 -0
- package/dist/public.js +59 -0
- package/dist/public.js.map +1 -0
- package/dist/react.d.ts +29 -0
- package/dist/react.js +55 -0
- package/dist/react.js.map +1 -0
- package/dist/server.d.ts +86 -0
- package/dist/server.js +146 -0
- package/dist/server.js.map +1 -0
- package/dist/storage.d.ts +14 -0
- package/dist/storage.js +64 -0
- package/dist/storage.js.map +1 -0
- package/dist/types.d.ts +782 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/package.json +63 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,782 @@
|
|
|
1
|
+
/** Permissions a member (user scopes) or an association's own system (client scopes) may hold. */
|
|
2
|
+
export type Scope = 'profile:read' | 'profile:write' | 'membership:read' | 'membership:request' | 'statuto:accept' | 'network:manage' | 'identity:signup' | 'enroll:write' | 'verify:read' | 'memberships:read' | 'checkins:write' | 'webhooks:manage' | 'events:read' | 'registrations:read' | 'registrations:write';
|
|
3
|
+
/** `rejected`: the request for admission was not accepted (a different act from `revoked`, which excludes a member). */
|
|
4
|
+
export type MembershipStatus = 'pending' | 'active' | 'suspended' | 'revoked' | 'rejected';
|
|
5
|
+
/** What the card is worth right now: `valid`, `expired`, `statuto_required` (re-acceptance overdue) or `inactive`. */
|
|
6
|
+
/** `not_yet_valid`: active and unexpired, but inside the association's usability delay — see `Membership.valid_from`. */
|
|
7
|
+
export type MembershipVerdict = 'valid' | 'expired' | 'not_yet_valid' | 'statuto_required' | 'inactive';
|
|
8
|
+
export interface TokenResponse {
|
|
9
|
+
access_token: string;
|
|
10
|
+
token_type: 'Bearer';
|
|
11
|
+
expires_in: number;
|
|
12
|
+
refresh_token?: string;
|
|
13
|
+
scope: string;
|
|
14
|
+
/** Pairwise subject of the member (per association); absent on client tokens. */
|
|
15
|
+
sub?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ClientInfo {
|
|
18
|
+
client_id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
kind: 'public' | 'native' | 'confidential' | 'first_party';
|
|
21
|
+
aps: {
|
|
22
|
+
slug: string;
|
|
23
|
+
name: string;
|
|
24
|
+
brandcolor: string | null;
|
|
25
|
+
picture_url: string | null;
|
|
26
|
+
};
|
|
27
|
+
scopes: Array<{
|
|
28
|
+
code: Scope;
|
|
29
|
+
label: string;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A language the platform speaks (`it`, `en` today). Wherever the API takes one it also takes a regional tag
|
|
34
|
+
* (`en-GB`) and reduces it; a language it does not speak is ignored, never an error — except on `PATCH /v1/me`.
|
|
35
|
+
*/
|
|
36
|
+
export type Locale = 'it' | 'en';
|
|
37
|
+
/** Ask for the association's copy in a language (`?locale=`). Default: the member's own, then `Accept-Language`, then the association's. */
|
|
38
|
+
export interface LocaleParam {
|
|
39
|
+
locale?: Locale | string;
|
|
40
|
+
}
|
|
41
|
+
export interface Me {
|
|
42
|
+
sub: string;
|
|
43
|
+
email: string;
|
|
44
|
+
email_verified: boolean;
|
|
45
|
+
first_name: string | null;
|
|
46
|
+
last_name: string | null;
|
|
47
|
+
phone: string | null;
|
|
48
|
+
/** ISO date (YYYY-MM-DD) */
|
|
49
|
+
dob: string | null;
|
|
50
|
+
/** Demographic only: it is never cross-checked against a fiscal code. */
|
|
51
|
+
gender: 'M' | 'F' | null;
|
|
52
|
+
/** Comune (born in Italy) or city, free text (born abroad). */
|
|
53
|
+
birthplace: string | null;
|
|
54
|
+
/** Country of birth, ISO 3166-1 alpha-2. */
|
|
55
|
+
birth_country: string | null;
|
|
56
|
+
/** Optional: a person may have none. */
|
|
57
|
+
codicefiscale: string | null;
|
|
58
|
+
/** How the person is identified; `null` = not identified yet (they cannot request a membership). */
|
|
59
|
+
codicefiscale_check: CodiceFiscaleCheck | null;
|
|
60
|
+
/** The language the person chose for the platform and its mails; `null` = never chosen (the request's, then the association's, applies). */
|
|
61
|
+
locale: Locale | null;
|
|
62
|
+
updated_at: string | null;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* How a person is identified — by a fiscal code OR by their particulars (date, place and country of birth), never
|
|
66
|
+
* neither. `matched`: a fiscal code that agrees with the particulars; `mismatch_confirmed`: a code that disagrees,
|
|
67
|
+
* confirmed by the person as the one on their health card; `absent`: no code, the particulars identify them.
|
|
68
|
+
*/
|
|
69
|
+
export type CodiceFiscaleCheck = 'matched' | 'mismatch_confirmed' | 'absent';
|
|
70
|
+
export interface MeUpdate {
|
|
71
|
+
phone?: string | null;
|
|
72
|
+
dob?: string | null;
|
|
73
|
+
gender?: 'M' | 'F' | null;
|
|
74
|
+
birthplace?: string | null;
|
|
75
|
+
/** ISO 3166-1 alpha-2. For a person born abroad a fiscal code encodes only the STATE: this is what it is compared with. */
|
|
76
|
+
birth_country?: string | null;
|
|
77
|
+
/** May be added later, or set to `null`. Validated and cross-checked when present (422 `codicefiscale_mismatch`). */
|
|
78
|
+
codicefiscale?: string | null;
|
|
79
|
+
/** Write-only: the person confirms a code that disagrees with their particulars (only after a `confirmable: true`). */
|
|
80
|
+
codicefiscale_confirmed?: boolean;
|
|
81
|
+
/** The person's language; `null` clears the choice. 422 `unsupported` for a language the platform does not speak. */
|
|
82
|
+
locale?: Locale | null;
|
|
83
|
+
}
|
|
84
|
+
export interface MembershipTypeRef {
|
|
85
|
+
uid: string;
|
|
86
|
+
cod: string;
|
|
87
|
+
name: string;
|
|
88
|
+
}
|
|
89
|
+
export interface MembershipStatuto {
|
|
90
|
+
current_version: number | null;
|
|
91
|
+
current_sha256: string | null;
|
|
92
|
+
accepted_version_id: string | null;
|
|
93
|
+
accepted_at: string | null;
|
|
94
|
+
/** A newer statuto was published since the member accepted one. */
|
|
95
|
+
pending: boolean;
|
|
96
|
+
/** … and the association's grace window for re-acceptance has elapsed. */
|
|
97
|
+
overdue: boolean;
|
|
98
|
+
}
|
|
99
|
+
export interface CardToken {
|
|
100
|
+
/** The `vmt_…` token: what a QR carries and what `/v1/verify/{card_token}` checks. */
|
|
101
|
+
token: string;
|
|
102
|
+
/** Validity window (unix seconds). */
|
|
103
|
+
nbf: number;
|
|
104
|
+
exp: number;
|
|
105
|
+
}
|
|
106
|
+
export interface Membership {
|
|
107
|
+
id: string;
|
|
108
|
+
status: MembershipStatus;
|
|
109
|
+
verdict: MembershipVerdict;
|
|
110
|
+
subdate: string | null;
|
|
111
|
+
issued_at: string | null;
|
|
112
|
+
expires_at: string | null;
|
|
113
|
+
membership_type: MembershipTypeRef | null;
|
|
114
|
+
statuto: MembershipStatuto;
|
|
115
|
+
/**
|
|
116
|
+
* Why a `pending` membership is still pending, IN ORDER: the association's approval of the request first (when it
|
|
117
|
+
* admits by decision of its board), then the quota of a paid type. Empty when active.
|
|
118
|
+
*/
|
|
119
|
+
pending_reasons: PendingReason[];
|
|
120
|
+
/** May the quota be paid yet? `false` while the approval is still pending: approval opens payment. */
|
|
121
|
+
payment_open: boolean;
|
|
122
|
+
/** When the card starts to count at the door (the association's usability delay); `null` = since activation. */
|
|
123
|
+
valid_from: string | null;
|
|
124
|
+
/** Is the card usable right now? `status` may be `active` while this is still `false` (see `valid_from`). */
|
|
125
|
+
usable: boolean;
|
|
126
|
+
/** The quota of a paid membership type and whether it is paid for the current period; `null` for a free type. */
|
|
127
|
+
quota: {
|
|
128
|
+
amount: number;
|
|
129
|
+
currency: string;
|
|
130
|
+
paid: boolean;
|
|
131
|
+
} | null;
|
|
132
|
+
/** The association's instructions for paying the quota, only once the payment is open (`payment_open`). */
|
|
133
|
+
payment_instructions: string | null;
|
|
134
|
+
/** Days to expiry (negative once expired). */
|
|
135
|
+
expires_in_days: number | null;
|
|
136
|
+
/** Self-service renewal: open 60 days before expiry; `requested_at` once the member asked. */
|
|
137
|
+
renewal: {
|
|
138
|
+
window_open: boolean;
|
|
139
|
+
requested_at: string | null;
|
|
140
|
+
};
|
|
141
|
+
network_opt_in: boolean;
|
|
142
|
+
/** The signed card token. `null` unless `status` is `active` (a pending, suspended or revoked membership has no card) or when card signing is not configured. */
|
|
143
|
+
card: CardToken | null;
|
|
144
|
+
}
|
|
145
|
+
export type PendingReason = 'approval' | 'payment';
|
|
146
|
+
/** How an association admits its members (`GET /v1/aps/{slug}` → `aps.admission.model`). */
|
|
147
|
+
export type AdmissionModel = 'board' | 'provisional' | 'automatic';
|
|
148
|
+
export interface MembershipRequest {
|
|
149
|
+
/** Membership type uid; optional when the association offers exactly one. */
|
|
150
|
+
membership_type?: string;
|
|
151
|
+
/** Must name the in-force statuto (see `Statuto.version`; `sha256` when published). */
|
|
152
|
+
accept_statuto: {
|
|
153
|
+
version: number;
|
|
154
|
+
sha256?: string;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/** A free type with no approval gate is issued `active` at once; otherwise `pending` with its reasons. */
|
|
158
|
+
/** What every answer about a membership request says about its gates. */
|
|
159
|
+
export interface MembershipGates {
|
|
160
|
+
/** In order: the association's approval first (board model), then the fee. Empty when active. */
|
|
161
|
+
pending_reasons: PendingReason[];
|
|
162
|
+
/** May the fee be paid yet? `false` while the approval is pending: approval opens payment. */
|
|
163
|
+
payment_open: boolean;
|
|
164
|
+
/** When the card becomes usable, for an active membership inside the usability delay; `null` otherwise. */
|
|
165
|
+
valid_from: string | null;
|
|
166
|
+
}
|
|
167
|
+
export type MembershipRequestResult = ({
|
|
168
|
+
created: true;
|
|
169
|
+
status: MembershipStatus;
|
|
170
|
+
id: string;
|
|
171
|
+
} & MembershipGates) | ({
|
|
172
|
+
already_requested: true;
|
|
173
|
+
status: MembershipStatus;
|
|
174
|
+
} & MembershipGates);
|
|
175
|
+
export interface MembershipEvent {
|
|
176
|
+
from: MembershipStatus | null;
|
|
177
|
+
to: MembershipStatus;
|
|
178
|
+
reason: string | null;
|
|
179
|
+
changed_at: string;
|
|
180
|
+
channel: string;
|
|
181
|
+
}
|
|
182
|
+
export interface MembershipEvents {
|
|
183
|
+
items: MembershipEvent[];
|
|
184
|
+
next_cursor: string | null;
|
|
185
|
+
}
|
|
186
|
+
export interface StatutoInfo {
|
|
187
|
+
uid: string;
|
|
188
|
+
version: number;
|
|
189
|
+
approvaldate: string | null;
|
|
190
|
+
sha256: string | null;
|
|
191
|
+
content: string | null;
|
|
192
|
+
document_url: string | null;
|
|
193
|
+
accepted: boolean;
|
|
194
|
+
accepted_at: string | null;
|
|
195
|
+
overdue: boolean;
|
|
196
|
+
}
|
|
197
|
+
export interface StatutoAccept {
|
|
198
|
+
version: number;
|
|
199
|
+
sha256?: string;
|
|
200
|
+
}
|
|
201
|
+
export interface Card extends CardToken {
|
|
202
|
+
status: MembershipStatus;
|
|
203
|
+
}
|
|
204
|
+
export interface Connection {
|
|
205
|
+
client_id: string;
|
|
206
|
+
name: string;
|
|
207
|
+
kind: ClientInfo['kind'];
|
|
208
|
+
scopes: Scope[];
|
|
209
|
+
granted_at: string;
|
|
210
|
+
}
|
|
211
|
+
export interface Verification {
|
|
212
|
+
status: 'active' | 'inactive';
|
|
213
|
+
valid_until?: string;
|
|
214
|
+
/** With `reason: 'not_yet_valid'`: the card is genuine and active, and becomes usable at this moment. */
|
|
215
|
+
valid_from?: string;
|
|
216
|
+
reason?: 'expired' | 'invalid' | 'not_yet_valid';
|
|
217
|
+
}
|
|
218
|
+
export interface MembershipType {
|
|
219
|
+
uid: string;
|
|
220
|
+
cod: string;
|
|
221
|
+
name: string;
|
|
222
|
+
description: string | null;
|
|
223
|
+
quota_amount: number | null;
|
|
224
|
+
currency: string;
|
|
225
|
+
expiry_model: 'solar_year' | 'rolling_12' | 'rolling_24' | 'prorated_solar' | 'custom';
|
|
226
|
+
network_eligible: boolean;
|
|
227
|
+
}
|
|
228
|
+
export interface Statuto {
|
|
229
|
+
uid: string;
|
|
230
|
+
version: number;
|
|
231
|
+
approvaldate: string | null;
|
|
232
|
+
sha256: string | null;
|
|
233
|
+
content: string | null;
|
|
234
|
+
document_url: string | null;
|
|
235
|
+
}
|
|
236
|
+
export interface AssociationPublicConfig {
|
|
237
|
+
/** The language this answer is written in: the one you asked for when the association offers it, its own otherwise. */
|
|
238
|
+
locale: Locale;
|
|
239
|
+
/** The languages the association offers: its own, plus those it enabled. */
|
|
240
|
+
locales: Locale[];
|
|
241
|
+
aps: {
|
|
242
|
+
slug: string;
|
|
243
|
+
name: string;
|
|
244
|
+
brandcolor: string | null;
|
|
245
|
+
picture_url: string | null;
|
|
246
|
+
citta: string | null;
|
|
247
|
+
provincia: string | null;
|
|
248
|
+
enroll_enabled: boolean;
|
|
249
|
+
/** Enrolment is on AND the association can take one more member right now (plan caps are never disclosed). */
|
|
250
|
+
accepting_requests: boolean;
|
|
251
|
+
/**
|
|
252
|
+
* How the association admits its members — tell an applicant up front. `board`: the request waits for a decision
|
|
253
|
+
* of the association's board, and any fee is paid after it; `provisional`: admitted at once, ratified later;
|
|
254
|
+
* `automatic`: active as soon as the conditions are met. `delay_hours`: hours between admission and a USABLE card
|
|
255
|
+
* (0 = at once) — the membership is active from admission, the card counts at the door only afterwards.
|
|
256
|
+
*/
|
|
257
|
+
admission: {
|
|
258
|
+
model: AdmissionModel;
|
|
259
|
+
delay_hours: number;
|
|
260
|
+
};
|
|
261
|
+
/** @deprecated Kept for compatibility: `true` when `admission.model` is `board`. Read `admission`. */
|
|
262
|
+
approval_required: boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Whether the association collects its members' address — of every member or of nobody. `none`: do not ask (an
|
|
265
|
+
* `address` sent anyway is not stored); `optional`; `required`: enrolment answers 422 `required` on `address`
|
|
266
|
+
* without one.
|
|
267
|
+
*/
|
|
268
|
+
member_address: MemberAddressPolicy;
|
|
269
|
+
/** How to pay the quota (IBAN, causale…), when the association published it. */
|
|
270
|
+
payment_instructions: string | null;
|
|
271
|
+
/**
|
|
272
|
+
* The activities of general interest the association carries out (Italian Third Sector Code, art. 5): `cod` is
|
|
273
|
+
* the letter of the article, `description` its Italian wording; one is marked as prevalent.
|
|
274
|
+
*/
|
|
275
|
+
activity_sectors: Array<{
|
|
276
|
+
cod: string;
|
|
277
|
+
description: string;
|
|
278
|
+
prevalent: boolean;
|
|
279
|
+
}>;
|
|
280
|
+
/**
|
|
281
|
+
* Present when the association is registered in the RUNTS (the Italian national register of Third Sector
|
|
282
|
+
* entities), as checked by the platform against the official public lists; `null` otherwise. Never typed by
|
|
283
|
+
* the association.
|
|
284
|
+
*/
|
|
285
|
+
registry: {
|
|
286
|
+
section: 'APS' | 'ODV' | 'EF' | 'IS' | 'RA' | 'SOMS' | 'ALTRI' | null;
|
|
287
|
+
/** Repertory number. */
|
|
288
|
+
number: string | null;
|
|
289
|
+
registered_on: string | null;
|
|
290
|
+
/** Date of the official list the check ran against. */
|
|
291
|
+
checked_on: string | null;
|
|
292
|
+
} | null;
|
|
293
|
+
};
|
|
294
|
+
membership_types: MembershipType[];
|
|
295
|
+
statuto: Statuto | null;
|
|
296
|
+
}
|
|
297
|
+
export interface FiscalCodeCheck {
|
|
298
|
+
/** Codice fiscale (16 characters). */
|
|
299
|
+
code: string;
|
|
300
|
+
first_name?: string;
|
|
301
|
+
last_name?: string;
|
|
302
|
+
gender?: 'M' | 'F';
|
|
303
|
+
/** Date of birth, YYYY-MM-DD. */
|
|
304
|
+
date?: string;
|
|
305
|
+
/** Birthplace: the comune, for a person born in Italy. */
|
|
306
|
+
place?: string;
|
|
307
|
+
/**
|
|
308
|
+
* Birth country, ISO 3166-1 alpha-2. A code encodes the comune for people born in Italy and only the STATE for
|
|
309
|
+
* everybody else: anything but `IT` is compared with that state, and `place` is ignored.
|
|
310
|
+
*/
|
|
311
|
+
country?: string;
|
|
312
|
+
}
|
|
313
|
+
/** What may disagree with a fiscal code. `gender` only where it is sent: enrolment and the profile never cross-check it. */
|
|
314
|
+
export type FiscalCodeMismatch = 'lastName' | 'firstName' | 'gender' | 'date' | 'place';
|
|
315
|
+
/** `names_swapped`: the code matches once surname and given name are exchanged. */
|
|
316
|
+
export type FiscalCodeHint = 'names_swapped';
|
|
317
|
+
export interface FiscalCodeResult {
|
|
318
|
+
valid: boolean;
|
|
319
|
+
/** `invalid`: structure or check character; `mismatch`: a well-formed code that disagrees with the data sent. */
|
|
320
|
+
error: 'invalid' | 'mismatch' | null;
|
|
321
|
+
/** What disagrees with the code, when `error` is `mismatch`. */
|
|
322
|
+
mismatches: FiscalCodeMismatch[];
|
|
323
|
+
hints: FiscalCodeHint[];
|
|
324
|
+
/** The date of birth the code itself encodes (YYYY-MM-DD). */
|
|
325
|
+
birth_date: string | null;
|
|
326
|
+
/** The birth country the code itself encodes, ISO 3166-1 alpha-2 (`IT` for a comune). */
|
|
327
|
+
birth_country: string | null;
|
|
328
|
+
}
|
|
329
|
+
export interface CardKeys {
|
|
330
|
+
keys: Array<{
|
|
331
|
+
kty: string;
|
|
332
|
+
crv: string;
|
|
333
|
+
x: string;
|
|
334
|
+
kid: string;
|
|
335
|
+
use: string;
|
|
336
|
+
alg: string;
|
|
337
|
+
}>;
|
|
338
|
+
}
|
|
339
|
+
/** A person your system registers on Vimine (`POST /v1/signup`). */
|
|
340
|
+
export interface SignupInput {
|
|
341
|
+
email: string;
|
|
342
|
+
first_name: string;
|
|
343
|
+
last_name: string;
|
|
344
|
+
phone?: string | null;
|
|
345
|
+
/** YYYY-MM-DD */
|
|
346
|
+
dob?: string | null;
|
|
347
|
+
/** Demographic only: it is not cross-checked. */
|
|
348
|
+
gender?: 'M' | 'F' | null;
|
|
349
|
+
/** Comune (born in Italy) or city, free text (born abroad). */
|
|
350
|
+
birthplace?: string | null;
|
|
351
|
+
/** ISO 3166-1 alpha-2. Send it for a person born abroad: their fiscal code encodes only the state. */
|
|
352
|
+
birth_country?: string | null;
|
|
353
|
+
/** Validated and cross-checked against the other fields when present. */
|
|
354
|
+
codicefiscale?: string | null;
|
|
355
|
+
/** The person confirms a code that disagrees with their particulars (422 `codicefiscale_mismatch` with `confirmable: true`). */
|
|
356
|
+
codicefiscale_confirmed?: boolean;
|
|
357
|
+
/** The account terms (`platform_terms`) the person accepted on your site — optional; when given it must name the in-force version (`GET /v1/legal/platform_terms`). */
|
|
358
|
+
accept_terms?: LegalRef;
|
|
359
|
+
/** The platform privacy notice (`platform_privacy`) the person read on your site — optional, same rule. */
|
|
360
|
+
acknowledge_privacy?: LegalRef;
|
|
361
|
+
/**
|
|
362
|
+
* The language of the page the person filled in. It decides the language of the mails that follow and becomes the
|
|
363
|
+
* preference of a NEW account; an existing account keeps its own.
|
|
364
|
+
*/
|
|
365
|
+
locale?: Locale | string;
|
|
366
|
+
}
|
|
367
|
+
/** Whether an association collects its members' address (`GET /v1/aps/{slug}` → `aps.member_address`). */
|
|
368
|
+
export type MemberAddressPolicy = 'none' | 'optional' | 'required';
|
|
369
|
+
/** A member's address, as `POST /v1/enroll` takes it. */
|
|
370
|
+
export interface MemberAddress {
|
|
371
|
+
/** `residence` (the default) or, where different, `domicile`. */
|
|
372
|
+
kind?: 'residence' | 'domicile';
|
|
373
|
+
/** Street and number. */
|
|
374
|
+
line: string;
|
|
375
|
+
postal_code?: string | null;
|
|
376
|
+
city: string;
|
|
377
|
+
/** Italian addresses only (two letters); dropped abroad. */
|
|
378
|
+
province?: string | null;
|
|
379
|
+
/** ISO 3166-1 alpha-2 (default `IT`). */
|
|
380
|
+
country?: string;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* `POST /v1/enroll/confirm` after a 409 `identification_required`: what the account still lacks — a fiscal code, or
|
|
384
|
+
* date, place and country of birth. It completes the EMPTY fields of the profile, never over what is there.
|
|
385
|
+
*/
|
|
386
|
+
export interface EnrollIdentification {
|
|
387
|
+
/** YYYY-MM-DD */
|
|
388
|
+
dob?: string;
|
|
389
|
+
birthplace?: string;
|
|
390
|
+
/** ISO 3166-1 alpha-2 */
|
|
391
|
+
birth_country?: string;
|
|
392
|
+
codicefiscale?: string;
|
|
393
|
+
codicefiscale_confirmed?: boolean;
|
|
394
|
+
}
|
|
395
|
+
/** A published legal text named by version (and hash when published). */
|
|
396
|
+
export interface LegalRef {
|
|
397
|
+
version: string;
|
|
398
|
+
sha256?: string;
|
|
399
|
+
}
|
|
400
|
+
/** A membership request your system submits for a person (`POST /v1/enroll`). */
|
|
401
|
+
export interface EnrollInput extends SignupInput {
|
|
402
|
+
/**
|
|
403
|
+
* Optional. A person is identified by a fiscal code OR by `dob` + `birthplace` + `birth_country` — never neither
|
|
404
|
+
* (422 `required` on each missing particular). When present it is validated and cross-checked against the names,
|
|
405
|
+
* the date and the place (the state, for people born abroad).
|
|
406
|
+
*/
|
|
407
|
+
codicefiscale?: string | null;
|
|
408
|
+
/**
|
|
409
|
+
* Residence or, where different, domicile. Asked of every member or of nobody: the public profile says what the
|
|
410
|
+
* association declared (`aps.member_address`).
|
|
411
|
+
*/
|
|
412
|
+
address?: MemberAddress;
|
|
413
|
+
/** Membership type uid; optional when the association offers exactly one. */
|
|
414
|
+
membership_type?: string;
|
|
415
|
+
/** The in-force statuto the person accepted on your site (see `Statuto.version`; `sha256` when published). */
|
|
416
|
+
accept_statuto: {
|
|
417
|
+
version: number;
|
|
418
|
+
sha256?: string;
|
|
419
|
+
};
|
|
420
|
+
/**
|
|
421
|
+
* The association's privacy notice the person read on your site (`ApsPublicConfig.privacy_notice`). REQUIRED when the
|
|
422
|
+
* association publishes one; 422 `privacy_notice_outdated` when it is not the in-force version.
|
|
423
|
+
*/
|
|
424
|
+
privacy_notice?: {
|
|
425
|
+
version: number;
|
|
426
|
+
sha256?: string;
|
|
427
|
+
locale?: Locale | string;
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
/** One acceptance, acknowledgement or consent the person recorded (`GET /v1/me/acceptances`). */
|
|
431
|
+
export interface AcceptanceRecord {
|
|
432
|
+
at: string;
|
|
433
|
+
action: 'accepted' | 'acknowledged' | 'consented' | 'withdrawn' | 'declared';
|
|
434
|
+
channel: 'ui' | 'public' | 'api' | 'job' | 'paper';
|
|
435
|
+
kind: string;
|
|
436
|
+
title: string;
|
|
437
|
+
version: string;
|
|
438
|
+
sha256: string | null;
|
|
439
|
+
/** Hash of the text actually shown. */
|
|
440
|
+
rendered_sha256: string | null;
|
|
441
|
+
locale: string | null;
|
|
442
|
+
/** The association the act concerns, when any. */
|
|
443
|
+
association: string | null;
|
|
444
|
+
}
|
|
445
|
+
/** A document the person has not acted on at its in-force version. */
|
|
446
|
+
export interface PendingDocument {
|
|
447
|
+
kind: string;
|
|
448
|
+
title: string;
|
|
449
|
+
locale: string;
|
|
450
|
+
version: string | number;
|
|
451
|
+
sha256: string | null;
|
|
452
|
+
effective_from: string | null;
|
|
453
|
+
/** What the person is asked to do. */
|
|
454
|
+
action: 'accepted' | 'acknowledged' | 'consented';
|
|
455
|
+
/** Never acted on any version of this kind (false: a new version requires it again). */
|
|
456
|
+
first: boolean;
|
|
457
|
+
}
|
|
458
|
+
export interface MyAcceptances {
|
|
459
|
+
items: AcceptanceRecord[];
|
|
460
|
+
pending: {
|
|
461
|
+
/** Account-layer documents still to accept / acknowledge. */
|
|
462
|
+
platform: PendingDocument[];
|
|
463
|
+
/** This association's notice to members, when not yet acknowledged. */
|
|
464
|
+
privacy_notice: PendingDocument | null;
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
/** `POST /v1/me/acceptances`: the in-force version your app showed. */
|
|
468
|
+
export interface AcceptanceInput {
|
|
469
|
+
/** `platform_terms` | `platform_privacy` | `network_consent` | `privacy_notice` */
|
|
470
|
+
kind: string;
|
|
471
|
+
version: string | number;
|
|
472
|
+
sha256?: string;
|
|
473
|
+
}
|
|
474
|
+
export interface AcceptanceResult {
|
|
475
|
+
recorded: true;
|
|
476
|
+
kind: string;
|
|
477
|
+
action: string;
|
|
478
|
+
version: string;
|
|
479
|
+
at: string;
|
|
480
|
+
}
|
|
481
|
+
/** The uniform answer of the creating routes: whatever happened behind the address, it was accepted. */
|
|
482
|
+
export interface Accepted {
|
|
483
|
+
status: 'accepted';
|
|
484
|
+
}
|
|
485
|
+
/** `POST /v1/enroll/confirm` — the outcome of the confirmation link an existing account's owner uses. */
|
|
486
|
+
export interface EnrollConfirmResult {
|
|
487
|
+
status: MembershipStatus;
|
|
488
|
+
/** The person already had a membership request or membership here; nothing new was created. */
|
|
489
|
+
already: boolean;
|
|
490
|
+
/** In order: the association's approval first (board model), then the fee. */
|
|
491
|
+
pending_reasons: PendingReason[];
|
|
492
|
+
payment_open: boolean;
|
|
493
|
+
valid_from: string | null;
|
|
494
|
+
association: {
|
|
495
|
+
name: string;
|
|
496
|
+
slug: string;
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
/** `POST /v1/me/membership/renew` — renewed at once (free type, no approval gate) or turned into a request. */
|
|
500
|
+
export interface RenewResult {
|
|
501
|
+
renewed: boolean;
|
|
502
|
+
requested: boolean;
|
|
503
|
+
status: MembershipStatus;
|
|
504
|
+
expires_at: string | null;
|
|
505
|
+
renewal_requested_at: string | null;
|
|
506
|
+
}
|
|
507
|
+
/** `PATCH /v1/me/membership/network-opt-in` */
|
|
508
|
+
export interface NetworkOptIn {
|
|
509
|
+
network_opt_in: boolean;
|
|
510
|
+
network_opt_in_at: string | null;
|
|
511
|
+
}
|
|
512
|
+
/** `POST /v1/checkins` — a door check-in from a scanned card token. No personal data. */
|
|
513
|
+
/** `POST /v1/checkins` for a CARD token. */
|
|
514
|
+
export interface CardCheckinResult {
|
|
515
|
+
kind: 'card';
|
|
516
|
+
verdict: MembershipVerdict;
|
|
517
|
+
status: MembershipStatus;
|
|
518
|
+
membership_id: string;
|
|
519
|
+
valid_until: string | null;
|
|
520
|
+
/** With `verdict: 'not_yet_valid'`: when the card becomes usable. The scan is recorded all the same. */
|
|
521
|
+
valid_from: string | null;
|
|
522
|
+
/**
|
|
523
|
+
* A note for whoever staffs the gate, never part of `verdict`: it restricts nothing. `pending`: the member has no
|
|
524
|
+
* verifiable fiscal code and nobody of the association has looked at a document yet — show it. Cleared from the
|
|
525
|
+
* association's console. `null`: nothing to check. The public `verifyCard` never carries it.
|
|
526
|
+
*/
|
|
527
|
+
identity_check: IdentityCheck | null;
|
|
528
|
+
checked_in_at: string;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* The identity check at first presence (`CardCheckinResult.identity_check`). `pending`: a document is still to be
|
|
532
|
+
* looked at; `verified`: somebody of the association looked at one; `flagged`: somebody did, and it did not agree —
|
|
533
|
+
* a matter for the association's office, which revokes nothing by itself.
|
|
534
|
+
*/
|
|
535
|
+
export type IdentityCheck = 'pending' | 'verified' | 'flagged';
|
|
536
|
+
export type RegistrationCheckinVerdict = 'valid' | 'already_checked_in' | 'not_confirmed' | 'cancelled' | 'event_cancelled' | 'membership_invalid';
|
|
537
|
+
/** `POST /v1/checkins` for an event REGISTRATION token (`k:'reg'` in the payload). */
|
|
538
|
+
export interface RegistrationCheckinResult {
|
|
539
|
+
kind: 'registration';
|
|
540
|
+
verdict: RegistrationCheckinVerdict;
|
|
541
|
+
status: RegistrationStatus;
|
|
542
|
+
registration_id: string;
|
|
543
|
+
event: {
|
|
544
|
+
slug: string;
|
|
545
|
+
title: string;
|
|
546
|
+
starts_at: string;
|
|
547
|
+
};
|
|
548
|
+
registration_type: string | null;
|
|
549
|
+
membership_id: string | null;
|
|
550
|
+
membership_verdict: MembershipVerdict | null;
|
|
551
|
+
/** True the first time this registration is checked in. */
|
|
552
|
+
first: boolean;
|
|
553
|
+
checked_in_at: string | null;
|
|
554
|
+
}
|
|
555
|
+
export type CheckinResult = CardCheckinResult | RegistrationCheckinResult;
|
|
556
|
+
/** One row of `GET /v1/memberships` — ids and status only. */
|
|
557
|
+
export interface MembershipListItem {
|
|
558
|
+
id: string;
|
|
559
|
+
status: MembershipStatus;
|
|
560
|
+
verdict: MembershipVerdict;
|
|
561
|
+
membership_type: {
|
|
562
|
+
cod: string;
|
|
563
|
+
} | null;
|
|
564
|
+
issued_at: string | null;
|
|
565
|
+
valid_until: string | null;
|
|
566
|
+
updated_at: string;
|
|
567
|
+
}
|
|
568
|
+
export interface MembershipList {
|
|
569
|
+
items: MembershipListItem[];
|
|
570
|
+
next_cursor: string | null;
|
|
571
|
+
}
|
|
572
|
+
export interface MembershipListParams {
|
|
573
|
+
status?: MembershipStatus;
|
|
574
|
+
/** RFC 3339: only rows changed after this instant (incremental sync). */
|
|
575
|
+
updated_since?: string;
|
|
576
|
+
limit?: number;
|
|
577
|
+
cursor?: string;
|
|
578
|
+
}
|
|
579
|
+
export interface MembershipStatusInfo {
|
|
580
|
+
id: string;
|
|
581
|
+
status: MembershipStatus;
|
|
582
|
+
verdict: MembershipVerdict;
|
|
583
|
+
valid_until: string | null;
|
|
584
|
+
membership_type: {
|
|
585
|
+
cod: string;
|
|
586
|
+
} | null;
|
|
587
|
+
}
|
|
588
|
+
export interface SandboxMember {
|
|
589
|
+
email: string;
|
|
590
|
+
name: string;
|
|
591
|
+
status: MembershipStatus;
|
|
592
|
+
expires_at: string | null;
|
|
593
|
+
statuto_accepted: boolean;
|
|
594
|
+
}
|
|
595
|
+
export interface SandboxMembers {
|
|
596
|
+
slug: string;
|
|
597
|
+
members: SandboxMember[];
|
|
598
|
+
}
|
|
599
|
+
export interface SandboxReset {
|
|
600
|
+
/** The synthetic members' shared password — shown only here. */
|
|
601
|
+
password: string;
|
|
602
|
+
members: Array<Pick<SandboxMember, 'email' | 'name' | 'status'>>;
|
|
603
|
+
}
|
|
604
|
+
export type EventStatus = 'published' | 'completed' | 'cancelled';
|
|
605
|
+
export type EventVisibility = 'members_only' | 'public';
|
|
606
|
+
export type RegistrationStatus = 'reserved' | 'confirmed' | 'cancelled' | 'refunded';
|
|
607
|
+
/** Why a registration type is not open right now. */
|
|
608
|
+
export type RegistrationTypeReason = 'sold_out' | 'registration_not_open' | 'registration_closed';
|
|
609
|
+
/** Why the member may not register (`GET /v1/events/{slug}/eligibility`, `422 not_eligible`). */
|
|
610
|
+
export type EligibilityReason = 'membership_required' | 'membership_not_active'
|
|
611
|
+
/** The event starts before the member's card is usable (the association's usability delay). */
|
|
612
|
+
| 'membership_not_yet_valid' | 'membership_type_not_allowed' | 'sold_out' | 'event_full' | 'registration_not_open' | 'registration_closed' | 'max_per_user' | 'event_past' | 'event_cancelled' | 'event_not_published' | 'plan_limit' | 'invalid_type';
|
|
613
|
+
export interface EventLocation {
|
|
614
|
+
name: string | null;
|
|
615
|
+
address: string | null;
|
|
616
|
+
lat: number | null;
|
|
617
|
+
lng: number | null;
|
|
618
|
+
}
|
|
619
|
+
/** An admission class of an event: free (`amount` 0) or a contribution; places and window are live. */
|
|
620
|
+
export interface RegistrationType {
|
|
621
|
+
uid: string;
|
|
622
|
+
cod: string;
|
|
623
|
+
name: string;
|
|
624
|
+
description: string | null;
|
|
625
|
+
amount: number;
|
|
626
|
+
currency: string;
|
|
627
|
+
quantity: number | null;
|
|
628
|
+
/** Places left (never who holds them); null = unlimited. */
|
|
629
|
+
remaining: number | null;
|
|
630
|
+
max_per_user: number;
|
|
631
|
+
requires_active_membership: boolean;
|
|
632
|
+
open: boolean;
|
|
633
|
+
reason: RegistrationTypeReason | null;
|
|
634
|
+
opens_at: string | null;
|
|
635
|
+
closes_at: string | null;
|
|
636
|
+
}
|
|
637
|
+
/** An event as the API describes it: headless copy, dates, place, images, live availability per type. */
|
|
638
|
+
export interface Event {
|
|
639
|
+
id: string;
|
|
640
|
+
slug: string;
|
|
641
|
+
/**
|
|
642
|
+
* The language the `title` was served in. When it is not the one you asked for, the association wrote no
|
|
643
|
+
* translation: you got its own text — never a machine translation. Each text falls back on its own.
|
|
644
|
+
*/
|
|
645
|
+
locale: Locale;
|
|
646
|
+
/** The languages in which this event has a title. */
|
|
647
|
+
locales: Locale[];
|
|
648
|
+
title: string;
|
|
649
|
+
summary: string | null;
|
|
650
|
+
/** Markdown — render it yourself. */
|
|
651
|
+
description_md: string | null;
|
|
652
|
+
starts_at: string;
|
|
653
|
+
ends_at: string | null;
|
|
654
|
+
timezone: string;
|
|
655
|
+
status: EventStatus;
|
|
656
|
+
visibility: EventVisibility;
|
|
657
|
+
location: EventLocation | null;
|
|
658
|
+
cover_url: string | null;
|
|
659
|
+
gallery: {
|
|
660
|
+
url: string;
|
|
661
|
+
alt: string | null;
|
|
662
|
+
order: number;
|
|
663
|
+
}[];
|
|
664
|
+
links: {
|
|
665
|
+
label: string;
|
|
666
|
+
url: string;
|
|
667
|
+
}[];
|
|
668
|
+
registration: {
|
|
669
|
+
opens_at: string | null;
|
|
670
|
+
closes_at: string | null;
|
|
671
|
+
capacity: number | null;
|
|
672
|
+
remaining: number | null;
|
|
673
|
+
cancellation_hours: number;
|
|
674
|
+
};
|
|
675
|
+
registration_types: RegistrationType[];
|
|
676
|
+
published_at: string | null;
|
|
677
|
+
cancelled_at: string | null;
|
|
678
|
+
cancel_reason: string | null;
|
|
679
|
+
}
|
|
680
|
+
export interface EventList {
|
|
681
|
+
items: Event[];
|
|
682
|
+
}
|
|
683
|
+
export interface EventListParams extends LocaleParam {
|
|
684
|
+
/** `upcoming` (default) | `past` | `cancelled` | `all` */
|
|
685
|
+
filter?: 'upcoming' | 'past' | 'cancelled' | 'all';
|
|
686
|
+
/** RFC 3339 bounds on `starts_at`. */
|
|
687
|
+
from?: string;
|
|
688
|
+
to?: string;
|
|
689
|
+
limit?: number;
|
|
690
|
+
}
|
|
691
|
+
export interface Eligibility {
|
|
692
|
+
can_register: boolean;
|
|
693
|
+
membership_verdict: MembershipVerdict | null;
|
|
694
|
+
types: {
|
|
695
|
+
uid: string;
|
|
696
|
+
cod: string;
|
|
697
|
+
can_register: boolean;
|
|
698
|
+
reasons: EligibilityReason[];
|
|
699
|
+
pending_membership: boolean;
|
|
700
|
+
}[];
|
|
701
|
+
}
|
|
702
|
+
export interface RegistrationRequest {
|
|
703
|
+
registration_type: string;
|
|
704
|
+
note?: string | null;
|
|
705
|
+
quantity?: number;
|
|
706
|
+
/** The language the registration was made in: the fallback for a member who never chose one. */
|
|
707
|
+
locale?: Locale | string;
|
|
708
|
+
}
|
|
709
|
+
/** A person's registration (the member's own, or a guest's after the confirmation link). */
|
|
710
|
+
export interface Registration {
|
|
711
|
+
id: string;
|
|
712
|
+
status: RegistrationStatus;
|
|
713
|
+
event: {
|
|
714
|
+
id: string;
|
|
715
|
+
slug: string;
|
|
716
|
+
title: string;
|
|
717
|
+
starts_at: string;
|
|
718
|
+
ends_at: string | null;
|
|
719
|
+
timezone: string;
|
|
720
|
+
status: EventStatus;
|
|
721
|
+
location: string | null;
|
|
722
|
+
cancel_reason: string | null;
|
|
723
|
+
} | null;
|
|
724
|
+
registration_type: {
|
|
725
|
+
uid: string;
|
|
726
|
+
cod: string;
|
|
727
|
+
name: string;
|
|
728
|
+
amount: number;
|
|
729
|
+
currency: string;
|
|
730
|
+
} | null;
|
|
731
|
+
quantity: number;
|
|
732
|
+
reserved_until: string | null;
|
|
733
|
+
checked_in_at: string | null;
|
|
734
|
+
cancelled_at: string | null;
|
|
735
|
+
cancel_reason: 'user' | 'staff' | 'expired' | 'event_cancelled' | null;
|
|
736
|
+
can_cancel: boolean;
|
|
737
|
+
payment: {
|
|
738
|
+
status: 'recorded' | 'refunded' | 'void';
|
|
739
|
+
amount: number;
|
|
740
|
+
currency: string;
|
|
741
|
+
method: string;
|
|
742
|
+
paid_at: string;
|
|
743
|
+
} | null;
|
|
744
|
+
/** How to pay the contribution while `reserved` (the association's own text). */
|
|
745
|
+
payment_instructions?: string | null;
|
|
746
|
+
note: string | null;
|
|
747
|
+
created_at: string;
|
|
748
|
+
/** The registration QR payload (`vmt_…`), confirmed registrations only — draw it as a QR code. */
|
|
749
|
+
token?: string | null;
|
|
750
|
+
}
|
|
751
|
+
export interface RegistrationList {
|
|
752
|
+
items: Registration[];
|
|
753
|
+
}
|
|
754
|
+
/** `POST /v1/events/{slug}/registrations/guest` (client scope `registrations:write`, public events only). */
|
|
755
|
+
export interface GuestRegistrationRequest {
|
|
756
|
+
email: string;
|
|
757
|
+
first_name: string;
|
|
758
|
+
last_name: string;
|
|
759
|
+
registration_type: string;
|
|
760
|
+
note?: string | null;
|
|
761
|
+
/** The language the registration was made in — for a guest, the language of every mail they receive. */
|
|
762
|
+
locale?: Locale | string;
|
|
763
|
+
}
|
|
764
|
+
/** One row of `GET /v1/events/{slug}/registrations` — no personal data. */
|
|
765
|
+
export interface RegistrationListItem {
|
|
766
|
+
id: string;
|
|
767
|
+
status: RegistrationStatus;
|
|
768
|
+
registration_type: string | null;
|
|
769
|
+
membership_id: string | null;
|
|
770
|
+
quantity: number;
|
|
771
|
+
checked_in_at: string | null;
|
|
772
|
+
created_at: string;
|
|
773
|
+
}
|
|
774
|
+
export interface EventRegistrationList {
|
|
775
|
+
items: RegistrationListItem[];
|
|
776
|
+
next_cursor: string | null;
|
|
777
|
+
}
|
|
778
|
+
export interface EventRegistrationListParams {
|
|
779
|
+
status?: RegistrationStatus;
|
|
780
|
+
limit?: number;
|
|
781
|
+
cursor?: string;
|
|
782
|
+
}
|