@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/errors.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// One error type for everything the API can say no to. `code` is the stable identifier to branch on: the
|
|
2
|
+
// `code` of an RFC 9457 problem document, the `error` of an OAuth error body, or one of the SDK's own
|
|
3
|
+
// (`network`, `state_mismatch`, `not_signed_in`, `framed`, `no_flow`).
|
|
4
|
+
export class VimineError extends Error {
|
|
5
|
+
code;
|
|
6
|
+
status;
|
|
7
|
+
requestId;
|
|
8
|
+
detail;
|
|
9
|
+
errors;
|
|
10
|
+
cause;
|
|
11
|
+
constructor(code, message, opts = {}) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.name = 'VimineError';
|
|
14
|
+
this.code = code;
|
|
15
|
+
this.status = opts.status ?? null;
|
|
16
|
+
this.requestId = opts.requestId ?? null;
|
|
17
|
+
this.detail = opts.detail ?? null;
|
|
18
|
+
this.errors = opts.errors;
|
|
19
|
+
if (opts.cause !== undefined)
|
|
20
|
+
this.cause = opts.cause;
|
|
21
|
+
}
|
|
22
|
+
/** True for the errors that mean "the session is gone: sign in again". */
|
|
23
|
+
get isAuthError() {
|
|
24
|
+
return this.status === 401 || ['invalid_token', 'token_expired', 'missing_token', 'invalid_grant', 'not_signed_in'].includes(this.code);
|
|
25
|
+
}
|
|
26
|
+
static fromProblem(body, status) {
|
|
27
|
+
const code = typeof body.code === 'string' && body.code ? body.code : `http_${status}`;
|
|
28
|
+
return new VimineError(code, body.detail || body.title || `HTTP ${status}`, { status, requestId: body.request_id ?? null, detail: body.detail ?? null, errors: body.errors });
|
|
29
|
+
}
|
|
30
|
+
static fromOAuth(body, status) {
|
|
31
|
+
return new VimineError(body.error || `http_${status}`, body.error_description || body.error || `HTTP ${status}`, { status });
|
|
32
|
+
}
|
|
33
|
+
static async fromResponse(res) {
|
|
34
|
+
let body = null;
|
|
35
|
+
try {
|
|
36
|
+
body = await res.json();
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
/* non-JSON body */
|
|
40
|
+
}
|
|
41
|
+
if (body && typeof body === 'object') {
|
|
42
|
+
const b = body;
|
|
43
|
+
if (typeof b.error === 'string')
|
|
44
|
+
return VimineError.fromOAuth(b, res.status);
|
|
45
|
+
return VimineError.fromProblem(b, res.status);
|
|
46
|
+
}
|
|
47
|
+
return new VimineError(`http_${res.status}`, `HTTP ${res.status}`, { status: res.status });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"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","sourcesContent":["// One error type for everything the API can say no to. `code` is the stable identifier to branch on: the\n// `code` of an RFC 9457 problem document, the `error` of an OAuth error body, or one of the SDK's own\n// (`network`, `state_mismatch`, `not_signed_in`, `framed`, `no_flow`).\n\nimport type { FiscalCodeHint, FiscalCodeMismatch } from './types.js';\n\n/**\n * One entry of a problem's `errors[]`: the field and what is wrong with it. A `codicefiscale_mismatch` entry also says\n * what disagrees with the code and whether the person may confirm it (resend with `codicefiscale_confirmed: true`).\n */\nexport interface FieldError {\n field?: string;\n code?: string;\n message?: string;\n /** `codicefiscale_mismatch`: what disagrees with the code (never `gender`: it is not cross-checked there). */\n mismatches?: FiscalCodeMismatch[];\n /** `codicefiscale_mismatch`: `names_swapped` when the code matches once surname and given name are exchanged. */\n hints?: FiscalCodeHint[];\n /** `codicefiscale_mismatch`: `false` when both names and the date disagree — nothing ties the code to the person. */\n confirmable?: boolean;\n [k: string]: unknown;\n}\n\nexport interface ProblemDetails {\n type?: string;\n title?: string;\n status?: number;\n code?: string;\n detail?: string;\n request_id?: string;\n errors?: FieldError[];\n [k: string]: unknown;\n}\n\nexport interface OAuthErrorBody {\n error: string;\n error_description?: string;\n}\n\nexport class VimineError extends Error {\n readonly code: string;\n readonly status: number | null;\n readonly requestId: string | null;\n readonly detail: string | null;\n readonly errors: ProblemDetails['errors'];\n override readonly cause?: unknown;\n\n constructor(code: string, message: string, opts: { status?: number | null; requestId?: string | null; detail?: string | null; errors?: ProblemDetails['errors']; cause?: unknown } = {}) {\n super(message);\n this.name = 'VimineError';\n this.code = code;\n this.status = opts.status ?? null;\n this.requestId = opts.requestId ?? null;\n this.detail = opts.detail ?? null;\n this.errors = opts.errors;\n if (opts.cause !== undefined) this.cause = opts.cause;\n }\n\n /** True for the errors that mean \"the session is gone: sign in again\". */\n get isAuthError(): boolean {\n return this.status === 401 || ['invalid_token', 'token_expired', 'missing_token', 'invalid_grant', 'not_signed_in'].includes(this.code);\n }\n\n static fromProblem(body: ProblemDetails, status: number): VimineError {\n const code = typeof body.code === 'string' && body.code ? body.code : `http_${status}`;\n return new VimineError(code, body.detail || body.title || `HTTP ${status}`, { status, requestId: body.request_id ?? null, detail: body.detail ?? null, errors: body.errors });\n }\n\n static fromOAuth(body: OAuthErrorBody, status: number): VimineError {\n return new VimineError(body.error || `http_${status}`, body.error_description || body.error || `HTTP ${status}`, { status });\n }\n\n static async fromResponse(res: Response): Promise<VimineError> {\n let body: unknown = null;\n try {\n body = await res.json();\n } catch {\n /* non-JSON body */\n }\n if (body && typeof body === 'object') {\n const b = body as Record<string, unknown>;\n if (typeof b.error === 'string') return VimineError.fromOAuth(b as unknown as OAuthErrorBody, res.status);\n return VimineError.fromProblem(b as ProblemDetails, res.status);\n }\n return new VimineError(`http_${res.status}`, `HTTP ${res.status}`, { status: res.status });\n }\n}\n"]}
|
|
@@ -0,0 +1,557 @@
|
|
|
1
|
+
export interface Problem {
|
|
2
|
+
type: string;
|
|
3
|
+
title: string;
|
|
4
|
+
status: number;
|
|
5
|
+
detail?: string;
|
|
6
|
+
code: string;
|
|
7
|
+
request_id?: string;
|
|
8
|
+
errors?: Array<{
|
|
9
|
+
field?: string;
|
|
10
|
+
code?: string;
|
|
11
|
+
message?: string;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
export interface Verification {
|
|
15
|
+
status: "active" | "inactive";
|
|
16
|
+
valid_until?: string;
|
|
17
|
+
/** With `reason: not_yet_valid`: the card is genuine and active, and becomes usable at this moment */
|
|
18
|
+
valid_from?: string;
|
|
19
|
+
reason?: "expired" | "invalid" | "not_yet_valid";
|
|
20
|
+
/** Present for registration tokens */
|
|
21
|
+
kind?: "card" | "registration";
|
|
22
|
+
event?: {
|
|
23
|
+
slug?: string;
|
|
24
|
+
starts_at?: string;
|
|
25
|
+
} | null;
|
|
26
|
+
}
|
|
27
|
+
export interface MembershipType {
|
|
28
|
+
uid?: string;
|
|
29
|
+
cod?: string;
|
|
30
|
+
name?: string;
|
|
31
|
+
description?: string | null;
|
|
32
|
+
quota_amount?: number | null;
|
|
33
|
+
currency?: string;
|
|
34
|
+
expiry_model?: "solar_year" | "rolling_12" | "rolling_24" | "prorated_solar" | "custom";
|
|
35
|
+
network_eligible?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface Statuto {
|
|
38
|
+
uid?: string;
|
|
39
|
+
version?: number;
|
|
40
|
+
approvaldate?: string | null;
|
|
41
|
+
sha256?: string | null;
|
|
42
|
+
content?: string | null;
|
|
43
|
+
document_url?: string | null;
|
|
44
|
+
}
|
|
45
|
+
export interface ApsPublicConfig {
|
|
46
|
+
/** The language this answer is written in */
|
|
47
|
+
locale?: string;
|
|
48
|
+
/** The languages the association offers: its own, plus those it enabled */
|
|
49
|
+
locales?: Array<string>;
|
|
50
|
+
aps: {
|
|
51
|
+
slug?: string;
|
|
52
|
+
name?: string;
|
|
53
|
+
brandcolor?: string | null;
|
|
54
|
+
picture_url?: string | null;
|
|
55
|
+
citta?: string | null;
|
|
56
|
+
provincia?: string | null;
|
|
57
|
+
enroll_enabled?: boolean;
|
|
58
|
+
/** How the association admits its members, so that an applicant can be told up front what to expect. `model`: `board` — the request waits for a decision of the association’s board, and any fee is paid after it; `provisional` — admitted at once, ratified by the board later; `automatic` — active as soon as the conditions are met. `delay_hours`: the hours between admission and a USABLE card (0 = at once): the membership is active from admission, the card counts at the door only afterwards (see `valid_from`). */
|
|
59
|
+
admission?: {
|
|
60
|
+
model?: "board" | "provisional" | "automatic";
|
|
61
|
+
delay_hours?: number;
|
|
62
|
+
};
|
|
63
|
+
/** Kept for compatibility: true when `admission.model` is `board`. Read `admission` instead. */
|
|
64
|
+
approval_required?: boolean;
|
|
65
|
+
/** Whether the association collects its members’ address — of every member or of nobody. `none`: do not ask (an `address` sent anyway is not stored); `optional`; `required`: enrolment answers 422 without one. */
|
|
66
|
+
member_address?: "none" | "optional" | "required";
|
|
67
|
+
/** How to pay the fee, as the association words it */
|
|
68
|
+
payment_instructions?: string | null;
|
|
69
|
+
/** The activities of general interest the association carries out (Italian Third Sector Code, art. 5): `cod` is the letter of the article, `description` its Italian wording; one is marked as prevalent. */
|
|
70
|
+
activity_sectors?: Array<{
|
|
71
|
+
cod?: string;
|
|
72
|
+
description?: string;
|
|
73
|
+
prevalent?: boolean;
|
|
74
|
+
}>;
|
|
75
|
+
/** Present when the association is registered in the RUNTS (the Italian national register of Third Sector entities), as checked by the platform against the official public lists; null otherwise. Never typed by the association. */
|
|
76
|
+
registry?: {
|
|
77
|
+
/** Section of the register */
|
|
78
|
+
section?: "APS" | "ODV" | "EF" | "IS" | "RA" | "SOMS" | "ALTRI" | null | null;
|
|
79
|
+
/** Repertory number */
|
|
80
|
+
number?: string | null;
|
|
81
|
+
registered_on?: string | null;
|
|
82
|
+
/** Date of the official list the check ran against */
|
|
83
|
+
checked_on?: string | null;
|
|
84
|
+
} | null;
|
|
85
|
+
};
|
|
86
|
+
membership_types: Array<MembershipType>;
|
|
87
|
+
statuto: Statuto | unknown;
|
|
88
|
+
/** The association's in-force privacy notice to members (full text: GET /v1/aps/{slug}/privacy-notice) */
|
|
89
|
+
privacy_notice?: PrivacyNoticeRef | unknown;
|
|
90
|
+
}
|
|
91
|
+
export interface FiscalCodeCheck {
|
|
92
|
+
/** Codice fiscale (16 characters) */
|
|
93
|
+
code: string;
|
|
94
|
+
first_name?: string;
|
|
95
|
+
last_name?: string;
|
|
96
|
+
gender?: "M" | "F";
|
|
97
|
+
/** Date of birth */
|
|
98
|
+
date?: string;
|
|
99
|
+
/** Birthplace: the comune, for a person born in Italy */
|
|
100
|
+
place?: string;
|
|
101
|
+
/** Birth country, ISO 3166-1 alpha-2. A code encodes the comune for people born in Italy and only the STATE for everybody else: anything but IT is compared with that state and `place` is ignored */
|
|
102
|
+
country?: string;
|
|
103
|
+
}
|
|
104
|
+
export interface FiscalCodeResult {
|
|
105
|
+
valid?: boolean;
|
|
106
|
+
error?: "invalid" | "mismatch" | null;
|
|
107
|
+
/** What disagrees with the code, when `error` is `mismatch` */
|
|
108
|
+
mismatches?: Array<"lastName" | "firstName" | "gender" | "date" | "place">;
|
|
109
|
+
/** `names_swapped`: the code matches once surname and given name are exchanged */
|
|
110
|
+
hints?: Array<"names_swapped">;
|
|
111
|
+
/** The date of birth the code itself encodes */
|
|
112
|
+
birth_date?: string | null;
|
|
113
|
+
/** The birth country the code itself encodes, ISO 3166-1 alpha-2 (IT for a comune) */
|
|
114
|
+
birth_country?: string | null;
|
|
115
|
+
}
|
|
116
|
+
export interface CardKeys {
|
|
117
|
+
keys?: Array<{
|
|
118
|
+
kty?: string;
|
|
119
|
+
crv?: string;
|
|
120
|
+
x?: string;
|
|
121
|
+
kid?: string;
|
|
122
|
+
use?: string;
|
|
123
|
+
alg?: string;
|
|
124
|
+
}>;
|
|
125
|
+
}
|
|
126
|
+
export interface SignupRequest {
|
|
127
|
+
email: string;
|
|
128
|
+
first_name: string;
|
|
129
|
+
last_name: string;
|
|
130
|
+
phone?: string | null;
|
|
131
|
+
dob?: string | null;
|
|
132
|
+
/** Demographic only: it is not cross-checked */
|
|
133
|
+
gender?: "M" | "F" | null;
|
|
134
|
+
/** Comune (born in Italy) or city, free text (born abroad) */
|
|
135
|
+
birthplace?: string | null;
|
|
136
|
+
/** ISO 3166-1 alpha-2 */
|
|
137
|
+
birth_country?: string | null;
|
|
138
|
+
/** Validated and cross-checked against the other fields when present */
|
|
139
|
+
codicefiscale?: string | null;
|
|
140
|
+
/** The person confirms a code that disagrees with their particulars (422 `codicefiscale_mismatch` with `confirmable: true`) */
|
|
141
|
+
codicefiscale_confirmed?: boolean;
|
|
142
|
+
/** The language of the page the person filled in (`it`, `en`; a regional tag such as `en-GB` is reduced to its language). It decides the language of the mails that follow and becomes the preference of a NEW account; an existing account keeps its own. Unsupported values are ignored */
|
|
143
|
+
locale?: string | null;
|
|
144
|
+
/** The account terms (platform_terms) the person accepted on your site — optional, but when given it must name the in-force version */
|
|
145
|
+
accept_terms?: LegalRef;
|
|
146
|
+
/** The platform privacy notice (platform_privacy) the person read on your site — optional, same rule */
|
|
147
|
+
acknowledge_privacy?: LegalRef;
|
|
148
|
+
}
|
|
149
|
+
export interface EnrollRequest {
|
|
150
|
+
email: string;
|
|
151
|
+
first_name: string;
|
|
152
|
+
last_name: string;
|
|
153
|
+
/** Optional. A person is identified by a fiscal code OR by `dob` + `birthplace` + `birth_country` — never neither (422 `required` on each missing particular). When present it is validated and cross-checked against the names, the date and the place (the state, for people born abroad) */
|
|
154
|
+
codicefiscale?: string | null;
|
|
155
|
+
/** The person confirms a code that disagrees with their particulars (422 `codicefiscale_mismatch` with `confirmable: true`) */
|
|
156
|
+
codicefiscale_confirmed?: boolean;
|
|
157
|
+
/** Residence or, where different, domicile. Asked of every member or of nobody: the public profile says what the association declared (`member_address`: none — ignored, not stored · optional · required — 422 `required` on `address` without it) */
|
|
158
|
+
address?: MemberAddress;
|
|
159
|
+
phone?: string | null;
|
|
160
|
+
dob?: string | null;
|
|
161
|
+
/** Demographic only: it is not cross-checked */
|
|
162
|
+
gender?: "M" | "F" | null;
|
|
163
|
+
/** Comune (born in Italy) or city, free text (born abroad) */
|
|
164
|
+
birthplace?: string | null;
|
|
165
|
+
/** ISO 3166-1 alpha-2 */
|
|
166
|
+
birth_country?: string | null;
|
|
167
|
+
/** One of the association’s membership types (omit when it has exactly one) */
|
|
168
|
+
membership_type?: string;
|
|
169
|
+
/** The language of the page the person filled in (`it`, `en`; a regional tag such as `en-GB` is reduced to its language). It decides the language of the mails that follow and becomes the preference of a NEW account; an existing account keeps its own. Unsupported values are ignored */
|
|
170
|
+
locale?: string | null;
|
|
171
|
+
/** The in-force statuto the person accepted on your site (from GET /v1/aps/{slug}) */
|
|
172
|
+
accept_statuto: {
|
|
173
|
+
version: number;
|
|
174
|
+
sha256?: string;
|
|
175
|
+
};
|
|
176
|
+
/** The association's privacy notice the person read on your site (GET /v1/aps/{slug} → privacy_notice). REQUIRED when the association publishes one; 422 `privacy_notice_outdated` when it is not the in-force version */
|
|
177
|
+
privacy_notice?: PrivacyNoticeAck;
|
|
178
|
+
/** The account terms (platform_terms) the person accepted on your site — optional, must name the in-force version */
|
|
179
|
+
accept_terms?: LegalRef;
|
|
180
|
+
/** The platform privacy notice (platform_privacy) the person read — optional, same rule */
|
|
181
|
+
acknowledge_privacy?: LegalRef;
|
|
182
|
+
}
|
|
183
|
+
export interface Accepted {
|
|
184
|
+
status: "accepted";
|
|
185
|
+
}
|
|
186
|
+
export interface Me {
|
|
187
|
+
/** The subject identifier of this person, as in the ID token */
|
|
188
|
+
sub: string;
|
|
189
|
+
email: string;
|
|
190
|
+
email_verified: boolean;
|
|
191
|
+
first_name?: string | null;
|
|
192
|
+
last_name?: string | null;
|
|
193
|
+
phone?: string | null;
|
|
194
|
+
dob?: string | null;
|
|
195
|
+
/** Demographic only */
|
|
196
|
+
gender?: "M" | "F" | null;
|
|
197
|
+
birthplace?: string | null;
|
|
198
|
+
/** ISO 3166-1 alpha-2 */
|
|
199
|
+
birth_country?: string | null;
|
|
200
|
+
/** Optional: a person may have none */
|
|
201
|
+
codicefiscale?: string | null;
|
|
202
|
+
/** How the person is identified. `matched`: a fiscal code that agrees with their particulars; `mismatch_confirmed`: a code that disagrees, confirmed by the person; `absent`: no code — date, place and country of birth identify them; null: not identified yet (they cannot request a membership) */
|
|
203
|
+
codicefiscale_check?: "matched" | "mismatch_confirmed" | "absent" | null;
|
|
204
|
+
/** The language the person chose for the platform and its mails; null: never chosen — the language of the request, then of the association, applies */
|
|
205
|
+
locale?: "it" | "en" | null;
|
|
206
|
+
updated_at?: string | null;
|
|
207
|
+
}
|
|
208
|
+
export interface MemberAddress {
|
|
209
|
+
kind?: "residence" | "domicile";
|
|
210
|
+
/** Street and number */
|
|
211
|
+
line: string;
|
|
212
|
+
postal_code?: string | null;
|
|
213
|
+
city: string;
|
|
214
|
+
/** Italian addresses only (two letters); dropped abroad */
|
|
215
|
+
province?: string | null;
|
|
216
|
+
/** ISO 3166-1 alpha-2 */
|
|
217
|
+
country?: string;
|
|
218
|
+
}
|
|
219
|
+
export interface EnrollConfirmRequest {
|
|
220
|
+
token: string;
|
|
221
|
+
/** Only after a 409 `identification_required`: what the account still lacks — a fiscal code, or date, place and country of birth. Completes the EMPTY fields of the profile, never over what is there */
|
|
222
|
+
identification?: {
|
|
223
|
+
dob?: string;
|
|
224
|
+
birthplace?: string;
|
|
225
|
+
birth_country?: string;
|
|
226
|
+
codicefiscale?: string;
|
|
227
|
+
codicefiscale_confirmed?: boolean;
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
export interface Event {
|
|
231
|
+
id?: string;
|
|
232
|
+
slug?: string;
|
|
233
|
+
/** The language the `title` was served in. When it is not the one you asked for, the association has no translation: you got its Italian text, not a machine translation */
|
|
234
|
+
locale?: string;
|
|
235
|
+
/** The languages in which this event has a title — the association’s own always, plus those it enabled and wrote */
|
|
236
|
+
locales?: Array<string>;
|
|
237
|
+
title?: string;
|
|
238
|
+
summary?: string | null;
|
|
239
|
+
/** Markdown; render it yourself */
|
|
240
|
+
description_md?: string | null;
|
|
241
|
+
starts_at?: string;
|
|
242
|
+
ends_at?: string | null;
|
|
243
|
+
timezone?: string;
|
|
244
|
+
status?: "published" | "completed" | "cancelled";
|
|
245
|
+
visibility?: "members_only" | "public";
|
|
246
|
+
location?: {
|
|
247
|
+
name?: string | null;
|
|
248
|
+
address?: string | null;
|
|
249
|
+
lat?: number | null;
|
|
250
|
+
lng?: number | null;
|
|
251
|
+
} | null;
|
|
252
|
+
cover_url?: string | null;
|
|
253
|
+
gallery?: Array<{
|
|
254
|
+
url?: string;
|
|
255
|
+
alt?: string | null;
|
|
256
|
+
order?: number;
|
|
257
|
+
}>;
|
|
258
|
+
links?: Array<{
|
|
259
|
+
label?: string;
|
|
260
|
+
url?: string;
|
|
261
|
+
}>;
|
|
262
|
+
registration?: {
|
|
263
|
+
opens_at?: string | null;
|
|
264
|
+
closes_at?: string | null;
|
|
265
|
+
capacity?: number | null;
|
|
266
|
+
remaining?: number | null;
|
|
267
|
+
cancellation_hours?: number;
|
|
268
|
+
};
|
|
269
|
+
registration_types?: Array<{
|
|
270
|
+
uid?: string;
|
|
271
|
+
cod?: string;
|
|
272
|
+
name?: string;
|
|
273
|
+
description?: string | null;
|
|
274
|
+
/** 0 = free */
|
|
275
|
+
amount?: number;
|
|
276
|
+
currency?: string;
|
|
277
|
+
quantity?: number | null;
|
|
278
|
+
/** Places left (never who holds them) */
|
|
279
|
+
remaining?: number | null;
|
|
280
|
+
max_per_user?: number;
|
|
281
|
+
requires_active_membership?: boolean;
|
|
282
|
+
open?: boolean;
|
|
283
|
+
reason?: "sold_out" | "registration_not_open" | "registration_closed" | null | null;
|
|
284
|
+
opens_at?: string | null;
|
|
285
|
+
closes_at?: string | null;
|
|
286
|
+
}>;
|
|
287
|
+
published_at?: string | null;
|
|
288
|
+
cancelled_at?: string | null;
|
|
289
|
+
cancel_reason?: string | null;
|
|
290
|
+
}
|
|
291
|
+
export interface Registration {
|
|
292
|
+
id?: string;
|
|
293
|
+
status?: "reserved" | "confirmed" | "cancelled" | "refunded";
|
|
294
|
+
event?: {
|
|
295
|
+
id?: string;
|
|
296
|
+
slug?: string;
|
|
297
|
+
title?: string;
|
|
298
|
+
starts_at?: string;
|
|
299
|
+
ends_at?: string | null;
|
|
300
|
+
timezone?: string;
|
|
301
|
+
status?: string;
|
|
302
|
+
location?: string | null;
|
|
303
|
+
};
|
|
304
|
+
registration_type?: {
|
|
305
|
+
uid?: string;
|
|
306
|
+
cod?: string;
|
|
307
|
+
name?: string;
|
|
308
|
+
amount?: number;
|
|
309
|
+
currency?: string;
|
|
310
|
+
};
|
|
311
|
+
quantity?: number;
|
|
312
|
+
reserved_until?: string | null;
|
|
313
|
+
checked_in_at?: string | null;
|
|
314
|
+
cancelled_at?: string | null;
|
|
315
|
+
cancel_reason?: string | null;
|
|
316
|
+
can_cancel?: boolean;
|
|
317
|
+
payment?: {
|
|
318
|
+
status?: string;
|
|
319
|
+
amount?: number;
|
|
320
|
+
currency?: string;
|
|
321
|
+
method?: string;
|
|
322
|
+
paid_at?: string;
|
|
323
|
+
} | null;
|
|
324
|
+
/** How to pay the contribution while reserved */
|
|
325
|
+
payment_instructions?: string | null;
|
|
326
|
+
/** Free text the person wrote. Withheld (null) from third-party clients when the association declared it processes special categories of data */
|
|
327
|
+
note?: string | null;
|
|
328
|
+
created_at?: string;
|
|
329
|
+
/** The registration QR payload (vmt_…), confirmed registrations only */
|
|
330
|
+
token?: string | null;
|
|
331
|
+
}
|
|
332
|
+
export interface Eligibility {
|
|
333
|
+
can_register?: boolean;
|
|
334
|
+
membership_verdict?: string | null;
|
|
335
|
+
types?: Array<{
|
|
336
|
+
uid?: string;
|
|
337
|
+
cod?: string;
|
|
338
|
+
can_register?: boolean;
|
|
339
|
+
reasons?: Array<string>;
|
|
340
|
+
pending_membership?: boolean;
|
|
341
|
+
}>;
|
|
342
|
+
}
|
|
343
|
+
export interface RegistrationRequest {
|
|
344
|
+
registration_type: string;
|
|
345
|
+
note?: string | null;
|
|
346
|
+
quantity?: number;
|
|
347
|
+
/** The language the registration was made in (`it`, `en`): the language of the mails to a guest, and the fallback for a member who never chose one. Defaults to Accept-Language */
|
|
348
|
+
locale?: string | null;
|
|
349
|
+
}
|
|
350
|
+
export interface GuestRegistrationRequest {
|
|
351
|
+
email: string;
|
|
352
|
+
first_name: string;
|
|
353
|
+
last_name: string;
|
|
354
|
+
registration_type: string;
|
|
355
|
+
note?: string | null;
|
|
356
|
+
/** The language the registration was made in (`it`, `en`): the language of the mails to a guest, and the fallback for a member who never chose one. Defaults to Accept-Language */
|
|
357
|
+
locale?: string | null;
|
|
358
|
+
}
|
|
359
|
+
export interface RegistrationListItem {
|
|
360
|
+
id?: string;
|
|
361
|
+
status?: string;
|
|
362
|
+
registration_type?: string | null;
|
|
363
|
+
membership_id?: string | null;
|
|
364
|
+
quantity?: number;
|
|
365
|
+
checked_in_at?: string | null;
|
|
366
|
+
created_at?: string;
|
|
367
|
+
}
|
|
368
|
+
export interface LegalDocumentSummary {
|
|
369
|
+
uid?: string;
|
|
370
|
+
/** Document kind (platform_terms, platform_privacy, platform_cookie, aps_terms, aps_dpa, aps_dpa_annex1_processing … developer_terms) */
|
|
371
|
+
kind: string;
|
|
372
|
+
locale: "it" | "en";
|
|
373
|
+
/** Version label (1.0, 1.1, …) */
|
|
374
|
+
version: string;
|
|
375
|
+
title: string;
|
|
376
|
+
/** What changed in this version */
|
|
377
|
+
summary?: string | null;
|
|
378
|
+
effective_from?: string | null;
|
|
379
|
+
retired_at?: string | null;
|
|
380
|
+
/** SHA-256 of the canonical template body */
|
|
381
|
+
sha256?: string | null;
|
|
382
|
+
/** This is the in-force version of the kind in its locale */
|
|
383
|
+
current: boolean;
|
|
384
|
+
requires_reacceptance?: boolean;
|
|
385
|
+
}
|
|
386
|
+
export interface LegalDocumentList {
|
|
387
|
+
documents: Array<LegalDocumentSummary>;
|
|
388
|
+
/** Previous versions (with ?all=1) */
|
|
389
|
+
archive?: Array<LegalDocumentSummary>;
|
|
390
|
+
}
|
|
391
|
+
export type LegalDocument = unknown;
|
|
392
|
+
export interface SubProcessor {
|
|
393
|
+
cod: string;
|
|
394
|
+
name: string;
|
|
395
|
+
entity?: string | null;
|
|
396
|
+
service: string;
|
|
397
|
+
data_categories?: string | null;
|
|
398
|
+
location?: string | null;
|
|
399
|
+
transfer_basis?: string | null;
|
|
400
|
+
role: "processor" | "controller" | "none";
|
|
401
|
+
status: "active" | "planned" | "retired";
|
|
402
|
+
since?: string | null;
|
|
403
|
+
until?: string | null;
|
|
404
|
+
website?: string | null;
|
|
405
|
+
}
|
|
406
|
+
export interface SubProcessorRegistry {
|
|
407
|
+
/** The in-force Annex 3 version the registry is bound to */
|
|
408
|
+
version?: string | null;
|
|
409
|
+
effective_from?: string | null;
|
|
410
|
+
notice_days?: number;
|
|
411
|
+
at?: string;
|
|
412
|
+
active: Array<SubProcessor>;
|
|
413
|
+
planned: Array<SubProcessor>;
|
|
414
|
+
/** Vendors that process no tenant data (transparency) */
|
|
415
|
+
other: Array<SubProcessor>;
|
|
416
|
+
}
|
|
417
|
+
export interface PrivacyNoticeRef {
|
|
418
|
+
uid: string;
|
|
419
|
+
version: number;
|
|
420
|
+
locale: string;
|
|
421
|
+
title?: string;
|
|
422
|
+
sha256?: string | null;
|
|
423
|
+
effective_from?: string | null;
|
|
424
|
+
}
|
|
425
|
+
export type PrivacyNotice = unknown;
|
|
426
|
+
export interface LegalRef {
|
|
427
|
+
/** The in-force version label shown (GET /v1/legal/{kind}) */
|
|
428
|
+
version: string;
|
|
429
|
+
/** Its template hash, when published */
|
|
430
|
+
sha256?: string;
|
|
431
|
+
}
|
|
432
|
+
export interface PrivacyNoticeAck {
|
|
433
|
+
/** The in-force notice version shown (GET /v1/aps/{slug} → privacy_notice) */
|
|
434
|
+
version: number;
|
|
435
|
+
sha256?: string;
|
|
436
|
+
/** The language of the notice you showed (`privacy_notice.locale` of the answer you read it from). Each language is its own document, with its own version: name it when you read the profile with `?locale=`. Default: the request’s `locale`, then the association’s language */
|
|
437
|
+
locale?: string;
|
|
438
|
+
}
|
|
439
|
+
export interface AcceptanceRecord {
|
|
440
|
+
at: string;
|
|
441
|
+
action: "accepted" | "acknowledged" | "consented" | "withdrawn" | "declared";
|
|
442
|
+
channel?: "ui" | "public" | "api" | "job" | "paper";
|
|
443
|
+
kind: string;
|
|
444
|
+
title?: string;
|
|
445
|
+
version: string;
|
|
446
|
+
sha256?: string | null;
|
|
447
|
+
/** Hash of the text actually shown */
|
|
448
|
+
rendered_sha256?: string | null;
|
|
449
|
+
locale?: string | null;
|
|
450
|
+
/** The association the act concerns, when any */
|
|
451
|
+
association?: string | null;
|
|
452
|
+
}
|
|
453
|
+
export interface PendingDocument {
|
|
454
|
+
kind: string;
|
|
455
|
+
title?: string;
|
|
456
|
+
locale?: string;
|
|
457
|
+
version: string | number;
|
|
458
|
+
sha256?: string | null;
|
|
459
|
+
effective_from?: string | null;
|
|
460
|
+
/** What the person is asked to do */
|
|
461
|
+
action: "accepted" | "acknowledged" | "consented";
|
|
462
|
+
/** Never acted on any version of this kind (false: a new version requires it again) */
|
|
463
|
+
first?: boolean;
|
|
464
|
+
}
|
|
465
|
+
export interface MyAcceptances {
|
|
466
|
+
items: Array<AcceptanceRecord>;
|
|
467
|
+
pending: {
|
|
468
|
+
/** Account-layer documents still to accept / acknowledge */
|
|
469
|
+
platform?: Array<PendingDocument>;
|
|
470
|
+
/** This association's notice to members, when not yet acknowledged */
|
|
471
|
+
privacy_notice?: PendingDocument | unknown;
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
export interface AcceptanceRequest {
|
|
475
|
+
/** platform_terms | platform_privacy | network_consent | privacy_notice */
|
|
476
|
+
kind: string;
|
|
477
|
+
/** The in-force version shown */
|
|
478
|
+
version: string | number;
|
|
479
|
+
sha256?: string;
|
|
480
|
+
}
|
|
481
|
+
export interface AcceptanceResult {
|
|
482
|
+
recorded: boolean;
|
|
483
|
+
kind: string;
|
|
484
|
+
action: string;
|
|
485
|
+
version: string;
|
|
486
|
+
at: string;
|
|
487
|
+
}
|
|
488
|
+
export interface EnrollConfirmResult {
|
|
489
|
+
status: "pending" | "active" | "suspended" | "revoked" | "rejected";
|
|
490
|
+
/** The person already had a membership request or membership here */
|
|
491
|
+
already: boolean;
|
|
492
|
+
/** Why the membership is still pending, in order: the association’s approval first (when it admits by decision of its board), then the fee. Empty when active */
|
|
493
|
+
pending_reasons?: Array<"approval" | "payment">;
|
|
494
|
+
/** May the fee be paid yet? False while the approval is pending: approval opens payment */
|
|
495
|
+
payment_open?: boolean;
|
|
496
|
+
/** When the card becomes usable, for an active membership inside the association’s usability delay; null otherwise */
|
|
497
|
+
valid_from?: string | null;
|
|
498
|
+
association: {
|
|
499
|
+
name?: string;
|
|
500
|
+
slug?: string;
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
/** Every operation of the document: id → [method, path]. */
|
|
504
|
+
export declare const operations: {
|
|
505
|
+
readonly getOpenApi: readonly ["GET", "/v1/openapi.json"];
|
|
506
|
+
readonly getCardKeys: readonly ["GET", "/v1/card-keys"];
|
|
507
|
+
readonly getApsPublicConfig: readonly ["GET", "/v1/aps/{slug}"];
|
|
508
|
+
readonly verifyCard: readonly ["GET", "/v1/verify/{card_token}"];
|
|
509
|
+
readonly validateFiscalCode: readonly ["POST", "/v1/validate/fiscal-code"];
|
|
510
|
+
readonly oauthToken: readonly ["POST", "/v1/oauth/token"];
|
|
511
|
+
readonly oauthRevoke: readonly ["POST", "/v1/oauth/revoke"];
|
|
512
|
+
readonly oauthClientInfo: readonly ["GET", "/v1/oauth/client-info"];
|
|
513
|
+
readonly getMe: readonly ["GET", "/v1/me"];
|
|
514
|
+
readonly closeMe: readonly ["DELETE", "/v1/me"];
|
|
515
|
+
readonly updateMe: readonly ["PATCH", "/v1/me"];
|
|
516
|
+
readonly exportMe: readonly ["GET", "/v1/me/export"];
|
|
517
|
+
readonly getMyMembership: readonly ["GET", "/v1/me/membership"];
|
|
518
|
+
readonly requestMyMembership: readonly ["POST", "/v1/me/membership"];
|
|
519
|
+
readonly renewMyMembership: readonly ["POST", "/v1/me/membership/renew"];
|
|
520
|
+
readonly setNetworkOptIn: readonly ["PATCH", "/v1/me/membership/network-opt-in"];
|
|
521
|
+
readonly getMyCardImage: readonly ["GET", "/v1/me/membership/card.svg"];
|
|
522
|
+
readonly emailMyCard: readonly ["POST", "/v1/me/membership/card/email"];
|
|
523
|
+
readonly getGoogleWalletLink: readonly ["GET", "/v1/me/membership/wallet/google"];
|
|
524
|
+
readonly getMyMembershipEvents: readonly ["GET", "/v1/me/membership/events"];
|
|
525
|
+
readonly getMyStatuto: readonly ["GET", "/v1/me/membership/statuto"];
|
|
526
|
+
readonly acceptMyStatuto: readonly ["POST", "/v1/me/membership/statuto/accept"];
|
|
527
|
+
readonly getMyAcceptances: readonly ["GET", "/v1/me/acceptances"];
|
|
528
|
+
readonly recordMyAcceptance: readonly ["POST", "/v1/me/acceptances"];
|
|
529
|
+
readonly getMyCard: readonly ["GET", "/v1/me/membership/card"];
|
|
530
|
+
readonly getMyConnections: readonly ["GET", "/v1/me/connections"];
|
|
531
|
+
readonly revokeMyConnection: readonly ["DELETE", "/v1/me/connections/{client_id}"];
|
|
532
|
+
readonly listMemberships: readonly ["GET", "/v1/memberships"];
|
|
533
|
+
readonly getMembershipStatus: readonly ["GET", "/v1/memberships/{id}/status"];
|
|
534
|
+
readonly getSandbox: readonly ["GET", "/v1/sandbox"];
|
|
535
|
+
readonly resetSandbox: readonly ["POST", "/v1/sandbox/reset"];
|
|
536
|
+
readonly signup: readonly ["POST", "/v1/signup"];
|
|
537
|
+
readonly enroll: readonly ["POST", "/v1/enroll"];
|
|
538
|
+
readonly confirmEnrollment: readonly ["POST", "/v1/enroll/confirm"];
|
|
539
|
+
readonly createCheckin: readonly ["POST", "/v1/checkins"];
|
|
540
|
+
readonly listPublicEvents: readonly ["GET", "/v1/aps/{slug}/events"];
|
|
541
|
+
readonly getPublicEvent: readonly ["GET", "/v1/aps/{slug}/events/{event}"];
|
|
542
|
+
readonly listEvents: readonly ["GET", "/v1/events"];
|
|
543
|
+
readonly getEvent: readonly ["GET", "/v1/events/{slug}"];
|
|
544
|
+
readonly getEventEligibility: readonly ["GET", "/v1/events/{slug}/eligibility"];
|
|
545
|
+
readonly createRegistration: readonly ["POST", "/v1/events/{slug}/registrations"];
|
|
546
|
+
readonly listEventRegistrations: readonly ["GET", "/v1/events/{slug}/registrations"];
|
|
547
|
+
readonly listMyRegistrations: readonly ["GET", "/v1/me/registrations"];
|
|
548
|
+
readonly getMyRegistration: readonly ["GET", "/v1/me/registrations/{id}"];
|
|
549
|
+
readonly cancelMyRegistration: readonly ["DELETE", "/v1/me/registrations/{id}"];
|
|
550
|
+
readonly createGuestRegistration: readonly ["POST", "/v1/events/{slug}/registrations/guest"];
|
|
551
|
+
readonly confirmGuestRegistration: readonly ["POST", "/v1/registrations/confirm"];
|
|
552
|
+
readonly listLegalDocuments: readonly ["GET", "/v1/legal"];
|
|
553
|
+
readonly getSubProcessors: readonly ["GET", "/v1/legal/sub-processors"];
|
|
554
|
+
readonly getLegalDocument: readonly ["GET", "/v1/legal/{kind}"];
|
|
555
|
+
readonly getApsPrivacyNotice: readonly ["GET", "/v1/aps/{slug}/privacy-notice"];
|
|
556
|
+
};
|
|
557
|
+
export type OperationId = keyof typeof operations;
|