@oursprivacy/platform-sdk 1.41.0 → 1.42.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.
@@ -1,5 +1,446 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
6
+ import { RequestOptions } from '../internal/request-options';
7
+ import { path } from '../internal/utils/path';
4
8
 
5
- export class ShortLinks extends APIResource {}
9
+ export class ShortLinks extends APIResource {
10
+ /**
11
+ * List all short links (QR codes / redirects) for this account, newest first.
12
+ * Supports cursor pagination and optional `status` and `nameContains` filters.
13
+ * Each entity bundles the destination URL, the composed public `shortUrl`, and the
14
+ * QR/campaign design. Requires scope: source:list
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * // Automatically fetches more pages as needed.
19
+ * for await (const shortLinkListResponse of client.shortLinks.list()) {
20
+ * // ...
21
+ * }
22
+ * ```
23
+ */
24
+ list(
25
+ query: ShortLinkListParams | null | undefined = {},
26
+ options?: RequestOptions,
27
+ ): PagePromise<ShortLinkListResponsesCursor, ShortLinkListResponse> {
28
+ return this._client.getAPIList('/rest/v1/short-links', Cursor<ShortLinkListResponse>, {
29
+ query,
30
+ ...options,
31
+ });
32
+ }
33
+
34
+ /**
35
+ * Create a short link (QR code / redirect) with its destination, campaign tags,
36
+ * and QR styling in a single call. The short code is generated automatically; the
37
+ * response `shortUrl` is the public URL the QR encodes. All body fields are
38
+ * optional — send `{}` to create an unconfigured link and fill it in later with
39
+ * PATCH. A newly created short link only resolves at the edge once a version is
40
+ * published. Requires scope: source:create
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * const shortLink = await client.shortLinks.create();
45
+ * ```
46
+ */
47
+ create(
48
+ body: ShortLinkCreateParams | null | undefined = {},
49
+ options?: RequestOptions,
50
+ ): APIPromise<ShortLinkCreateResponse> {
51
+ return this._client.post('/rest/v1/short-links', { body, ...options });
52
+ }
53
+
54
+ /**
55
+ * Fetch a single short link by id, including its destination, composed `shortUrl`,
56
+ * and QR/campaign design. Returns 404 when no short link matches the id or it
57
+ * belongs to a different account. Requires scope: source:view
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * const shortLink = await client.shortLinks.retrieve('id');
62
+ * ```
63
+ */
64
+ retrieve(id: string, options?: RequestOptions): APIPromise<ShortLinkRetrieveResponse> {
65
+ return this._client.get(path`/rest/v1/short-links/${id}`, options);
66
+ }
67
+
68
+ /**
69
+ * Partially update a short link. Only the fields you send are changed; omitted
70
+ * fields are unchanged. Send explicit `null` to clear `redirectUrl`. The `utm` and
71
+ * `qr` objects are replaced wholesale when sent. Returns the full short link
72
+ * entity after the update. Requires scope: source:update
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * const shortLink = await client.shortLinks.update('id');
77
+ * ```
78
+ */
79
+ update(
80
+ id: string,
81
+ body: ShortLinkUpdateParams,
82
+ options?: RequestOptions,
83
+ ): APIPromise<ShortLinkUpdateResponse> {
84
+ return this._client.patch(path`/rest/v1/short-links/${id}`, { body, ...options });
85
+ }
86
+
87
+ /**
88
+ * Delete a short link and its QR/campaign design. After deletion the short URL
89
+ * stops resolving on the next publish. Requires scope: source:delete
90
+ *
91
+ * @example
92
+ * ```ts
93
+ * const shortLink = await client.shortLinks.delete('id');
94
+ * ```
95
+ */
96
+ delete(id: string, options?: RequestOptions): APIPromise<ShortLinkDeleteResponse> {
97
+ return this._client.delete(path`/rest/v1/short-links/${id}`, options);
98
+ }
99
+
100
+ /**
101
+ * Aggregate click analytics for a short link over a date window: total and unique
102
+ * clicks, a time series (daily or hourly), and breakdowns by country, city, and
103
+ * device. QR scans are counted as clicks. Pass `from`/`to` as UTC calendar days
104
+ * (`YYYY-MM-DD`); set `granularity=HOURLY` for hourly buckets and
105
+ * `excludeBots=false` to include bot traffic. Requires the `shortlink:reporting`
106
+ * scope, which is gated separately because analytics data is PHI-bearing. Requires
107
+ * scope: shortlink:reporting
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * const response = await client.shortLinks.results('id', {
112
+ * from: '2026-06-01',
113
+ * to: '2026-06-30',
114
+ * });
115
+ * ```
116
+ */
117
+ results(
118
+ id: string,
119
+ query: ShortLinkResultsParams,
120
+ options?: RequestOptions,
121
+ ): APIPromise<ShortLinkResultsResponse> {
122
+ return this._client.get(path`/rest/v1/short-links/${id}/results`, { query, ...options });
123
+ }
124
+ }
125
+
126
+ export type ShortLinkListResponsesCursor = Cursor<ShortLinkListResponse>;
127
+
128
+ export interface ShortLinkListResponse {
129
+ id: string;
130
+
131
+ /**
132
+ * Organization id that owns this short link.
133
+ */
134
+ accountId: string;
135
+
136
+ createdAt: string;
137
+
138
+ status: 'Disabled' | 'Enabled';
139
+
140
+ /**
141
+ * Whether this short link exists in the currently published version. An
142
+ * unpublished short link does not resolve at the edge.
143
+ */
144
+ isPublished?: boolean | null;
145
+
146
+ name?: string | null;
147
+
148
+ /**
149
+ * The short code embedded in the public URL (`/redirect/{pixel}`).
150
+ * Server-assigned.
151
+ */
152
+ pixel?: string | null;
153
+
154
+ /**
155
+ * The destination URL this short link redirects to.
156
+ */
157
+ redirectUrl?: string | null;
158
+
159
+ /**
160
+ * QR styling + campaign tags. Null until the link is styled.
161
+ */
162
+ shortLinkDesign?: unknown | null;
163
+
164
+ /**
165
+ * The public short-link URL that the QR encodes and callers share. Composed from
166
+ * the short code, the link name (sent as the tracked event), and the campaign
167
+ * tags. Also resolves on any branded custom domains configured for the account.
168
+ */
169
+ shortUrl?: string | null;
170
+ }
171
+
172
+ export interface ShortLinkCreateResponse {
173
+ id: string;
174
+
175
+ /**
176
+ * Organization id that owns this short link.
177
+ */
178
+ accountId: string;
179
+
180
+ createdAt: string;
181
+
182
+ status: 'Disabled' | 'Enabled';
183
+
184
+ /**
185
+ * Whether this short link exists in the currently published version. An
186
+ * unpublished short link does not resolve at the edge.
187
+ */
188
+ isPublished?: boolean | null;
189
+
190
+ name?: string | null;
191
+
192
+ /**
193
+ * The short code embedded in the public URL (`/redirect/{pixel}`).
194
+ * Server-assigned.
195
+ */
196
+ pixel?: string | null;
197
+
198
+ /**
199
+ * The destination URL this short link redirects to.
200
+ */
201
+ redirectUrl?: string | null;
202
+
203
+ /**
204
+ * QR styling + campaign tags. Null until the link is styled.
205
+ */
206
+ shortLinkDesign?: unknown | null;
207
+
208
+ /**
209
+ * The public short-link URL that the QR encodes and callers share. Composed from
210
+ * the short code, the link name (sent as the tracked event), and the campaign
211
+ * tags. Also resolves on any branded custom domains configured for the account.
212
+ */
213
+ shortUrl?: string | null;
214
+ }
215
+
216
+ export interface ShortLinkRetrieveResponse {
217
+ id: string;
218
+
219
+ /**
220
+ * Organization id that owns this short link.
221
+ */
222
+ accountId: string;
223
+
224
+ createdAt: string;
225
+
226
+ status: 'Disabled' | 'Enabled';
227
+
228
+ /**
229
+ * Whether this short link exists in the currently published version. An
230
+ * unpublished short link does not resolve at the edge.
231
+ */
232
+ isPublished?: boolean | null;
233
+
234
+ name?: string | null;
235
+
236
+ /**
237
+ * The short code embedded in the public URL (`/redirect/{pixel}`).
238
+ * Server-assigned.
239
+ */
240
+ pixel?: string | null;
241
+
242
+ /**
243
+ * The destination URL this short link redirects to.
244
+ */
245
+ redirectUrl?: string | null;
246
+
247
+ /**
248
+ * QR styling + campaign tags. Null until the link is styled.
249
+ */
250
+ shortLinkDesign?: unknown | null;
251
+
252
+ /**
253
+ * The public short-link URL that the QR encodes and callers share. Composed from
254
+ * the short code, the link name (sent as the tracked event), and the campaign
255
+ * tags. Also resolves on any branded custom domains configured for the account.
256
+ */
257
+ shortUrl?: string | null;
258
+ }
259
+
260
+ export interface ShortLinkUpdateResponse {
261
+ id: string;
262
+
263
+ /**
264
+ * Organization id that owns this short link.
265
+ */
266
+ accountId: string;
267
+
268
+ createdAt: string;
269
+
270
+ status: 'Disabled' | 'Enabled';
271
+
272
+ /**
273
+ * Whether this short link exists in the currently published version. An
274
+ * unpublished short link does not resolve at the edge.
275
+ */
276
+ isPublished?: boolean | null;
277
+
278
+ name?: string | null;
279
+
280
+ /**
281
+ * The short code embedded in the public URL (`/redirect/{pixel}`).
282
+ * Server-assigned.
283
+ */
284
+ pixel?: string | null;
285
+
286
+ /**
287
+ * The destination URL this short link redirects to.
288
+ */
289
+ redirectUrl?: string | null;
290
+
291
+ /**
292
+ * QR styling + campaign tags. Null until the link is styled.
293
+ */
294
+ shortLinkDesign?: unknown | null;
295
+
296
+ /**
297
+ * The public short-link URL that the QR encodes and callers share. Composed from
298
+ * the short code, the link name (sent as the tracked event), and the campaign
299
+ * tags. Also resolves on any branded custom domains configured for the account.
300
+ */
301
+ shortUrl?: string | null;
302
+ }
303
+
304
+ export interface ShortLinkDeleteResponse {
305
+ deleted: true;
306
+ }
307
+
308
+ export interface ShortLinkResultsResponse {
309
+ devices: Array<ShortLinkResultsResponse.Device>;
310
+
311
+ geoByCity: Array<ShortLinkResultsResponse.GeoByCity>;
312
+
313
+ geoByCountry: Array<ShortLinkResultsResponse.GeoByCountry>;
314
+
315
+ timeSeries: Array<ShortLinkResultsResponse.TimeSeries>;
316
+
317
+ totalClicks: number;
318
+
319
+ uniqueClicks: number;
320
+ }
321
+
322
+ export namespace ShortLinkResultsResponse {
323
+ export interface Device {
324
+ clicks: number;
325
+
326
+ name: string;
327
+
328
+ uniqueClicks: number;
329
+ }
330
+
331
+ export interface GeoByCity {
332
+ clicks: number;
333
+
334
+ name: string;
335
+
336
+ uniqueClicks: number;
337
+ }
338
+
339
+ export interface GeoByCountry {
340
+ clicks: number;
341
+
342
+ name: string;
343
+
344
+ uniqueClicks: number;
345
+ }
346
+
347
+ export interface TimeSeries {
348
+ clicks: number;
349
+
350
+ period: string;
351
+
352
+ uniqueClicks: number;
353
+ }
354
+ }
355
+
356
+ export interface ShortLinkListParams extends CursorParams {
357
+ /**
358
+ * Case-insensitive substring filter on the short link name.
359
+ */
360
+ nameContains?: string;
361
+
362
+ /**
363
+ * Filter by short link status.
364
+ */
365
+ status?: 'Disabled' | 'Enabled';
366
+ }
367
+
368
+ export interface ShortLinkCreateParams {
369
+ /**
370
+ * Human-readable name. Also sent as the tracked event name on every click/scan.
371
+ */
372
+ name?: string | null;
373
+
374
+ /**
375
+ * QR code visual styling.
376
+ */
377
+ qr?: unknown | null;
378
+
379
+ /**
380
+ * Destination URL the short link redirects to. Must be a valid URL.
381
+ */
382
+ redirectUrl?: string | null;
383
+
384
+ /**
385
+ * Campaign / UTM tags appended to the tracked short-link URL.
386
+ */
387
+ utm?: unknown | null;
388
+ }
389
+
390
+ export interface ShortLinkUpdateParams {
391
+ name?: string | null;
392
+
393
+ qr?: unknown | null;
394
+
395
+ /**
396
+ * Destination URL the short link redirects to. Must be a valid URL. Send `null` to
397
+ * clear it.
398
+ */
399
+ redirectUrl?: string | null;
400
+
401
+ /**
402
+ * Whether the short link resolves at the edge. Send `Enabled` or `Disabled`;
403
+ * `null` is rejected since storage cannot represent it.
404
+ */
405
+ status?: string | null;
406
+
407
+ utm?: unknown | null;
408
+ }
409
+
410
+ export interface ShortLinkResultsParams {
411
+ /**
412
+ * Inclusive lower bound of the report window, a UTC calendar day in `YYYY-MM-DD`.
413
+ */
414
+ from: string;
415
+
416
+ /**
417
+ * Inclusive upper bound of the report window, a UTC calendar day in `YYYY-MM-DD`.
418
+ */
419
+ to: string;
420
+
421
+ /**
422
+ * Exclude bot traffic from the counts. Defaults to `true`.
423
+ */
424
+ excludeBots?: boolean;
425
+
426
+ /**
427
+ * Time-series bucket size. Defaults to `DAILY`.
428
+ */
429
+ granularity?: 'DAILY' | 'HOURLY';
430
+ }
431
+
432
+ export declare namespace ShortLinks {
433
+ export {
434
+ type ShortLinkListResponse as ShortLinkListResponse,
435
+ type ShortLinkCreateResponse as ShortLinkCreateResponse,
436
+ type ShortLinkRetrieveResponse as ShortLinkRetrieveResponse,
437
+ type ShortLinkUpdateResponse as ShortLinkUpdateResponse,
438
+ type ShortLinkDeleteResponse as ShortLinkDeleteResponse,
439
+ type ShortLinkResultsResponse as ShortLinkResultsResponse,
440
+ type ShortLinkListResponsesCursor as ShortLinkListResponsesCursor,
441
+ type ShortLinkListParams as ShortLinkListParams,
442
+ type ShortLinkCreateParams as ShortLinkCreateParams,
443
+ type ShortLinkUpdateParams as ShortLinkUpdateParams,
444
+ type ShortLinkResultsParams as ShortLinkResultsParams,
445
+ };
446
+ }
@@ -589,6 +589,12 @@ export interface SourceCreateParams {
589
589
  | 'iOSNativeApi';
590
590
 
591
591
  name?: string | null;
592
+
593
+ /**
594
+ * Destination URL for a RedirectSource (short link). Ignored by other source
595
+ * types. Must be a valid http(s) URL.
596
+ */
597
+ redirectUrl?: string | null;
592
598
  }
593
599
 
594
600
  export interface SourceUpdateParams {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.41.0'; // x-release-please-version
1
+ export const VERSION = '1.42.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.41.0";
1
+ export declare const VERSION = "1.42.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.41.0";
1
+ export declare const VERSION = "1.42.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.41.0'; // x-release-please-version
4
+ exports.VERSION = '1.42.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.41.0'; // x-release-please-version
1
+ export const VERSION = '1.42.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map