@postrun/js 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.
@@ -0,0 +1,4077 @@
1
+ 'use strict';
2
+
3
+ var z = require('zod');
4
+
5
+ function _interopNamespace(e) {
6
+ if (e && e.__esModule) return e;
7
+ var n = Object.create(null);
8
+ if (e) {
9
+ Object.keys(e).forEach(function (k) {
10
+ if (k !== 'default') {
11
+ var d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: function () { return e[k]; }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n.default = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ var z__namespace = /*#__PURE__*/_interopNamespace(z);
24
+
25
+ // src/client/core/bodySerializer.gen.ts
26
+ var jsonBodySerializer = {
27
+ bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
28
+ };
29
+
30
+ // src/client/core/serverSentEvents.gen.ts
31
+ function createSseClient({
32
+ onRequest,
33
+ onSseError,
34
+ onSseEvent,
35
+ responseTransformer,
36
+ responseValidator,
37
+ sseDefaultRetryDelay,
38
+ sseMaxRetryAttempts,
39
+ sseMaxRetryDelay,
40
+ sseSleepFn,
41
+ url: url2,
42
+ ...options
43
+ }) {
44
+ let lastEventId;
45
+ const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
46
+ const createStream = async function* () {
47
+ let retryDelay = sseDefaultRetryDelay ?? 3e3;
48
+ let attempt = 0;
49
+ const signal = options.signal ?? new AbortController().signal;
50
+ while (true) {
51
+ if (signal.aborted) break;
52
+ attempt++;
53
+ const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
54
+ if (lastEventId !== void 0) {
55
+ headers.set("Last-Event-ID", lastEventId);
56
+ }
57
+ try {
58
+ const requestInit = {
59
+ redirect: "follow",
60
+ ...options,
61
+ body: options.serializedBody,
62
+ headers,
63
+ signal
64
+ };
65
+ let request = new Request(url2, requestInit);
66
+ if (onRequest) {
67
+ request = await onRequest(url2, requestInit);
68
+ }
69
+ const _fetch = options.fetch ?? globalThis.fetch;
70
+ const response = await _fetch(request);
71
+ if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
72
+ if (!response.body) throw new Error("No body in SSE response");
73
+ const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
74
+ let buffer = "";
75
+ const abortHandler = () => {
76
+ try {
77
+ reader.cancel();
78
+ } catch {
79
+ }
80
+ };
81
+ signal.addEventListener("abort", abortHandler);
82
+ try {
83
+ while (true) {
84
+ const { done, value } = await reader.read();
85
+ if (done) break;
86
+ buffer += value;
87
+ buffer = buffer.replace(/\r\n?/g, "\n");
88
+ const chunks = buffer.split("\n\n");
89
+ buffer = chunks.pop() ?? "";
90
+ for (const chunk of chunks) {
91
+ const lines = chunk.split("\n");
92
+ const dataLines = [];
93
+ let eventName;
94
+ for (const line of lines) {
95
+ if (line.startsWith("data:")) {
96
+ dataLines.push(line.replace(/^data:\s*/, ""));
97
+ } else if (line.startsWith("event:")) {
98
+ eventName = line.replace(/^event:\s*/, "");
99
+ } else if (line.startsWith("id:")) {
100
+ lastEventId = line.replace(/^id:\s*/, "");
101
+ } else if (line.startsWith("retry:")) {
102
+ const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
103
+ if (!Number.isNaN(parsed)) {
104
+ retryDelay = parsed;
105
+ }
106
+ }
107
+ }
108
+ let data;
109
+ let parsedJson = false;
110
+ if (dataLines.length) {
111
+ const rawData = dataLines.join("\n");
112
+ try {
113
+ data = JSON.parse(rawData);
114
+ parsedJson = true;
115
+ } catch {
116
+ data = rawData;
117
+ }
118
+ }
119
+ if (parsedJson) {
120
+ if (responseValidator) {
121
+ await responseValidator(data);
122
+ }
123
+ if (responseTransformer) {
124
+ data = await responseTransformer(data);
125
+ }
126
+ }
127
+ onSseEvent?.({
128
+ data,
129
+ event: eventName,
130
+ id: lastEventId,
131
+ retry: retryDelay
132
+ });
133
+ if (dataLines.length) {
134
+ yield data;
135
+ }
136
+ }
137
+ }
138
+ } finally {
139
+ signal.removeEventListener("abort", abortHandler);
140
+ reader.releaseLock();
141
+ }
142
+ break;
143
+ } catch (error) {
144
+ onSseError?.(error);
145
+ if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
146
+ break;
147
+ }
148
+ const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
149
+ await sleep(backoff);
150
+ }
151
+ }
152
+ };
153
+ const stream = createStream();
154
+ return { stream };
155
+ }
156
+
157
+ // src/client/core/pathSerializer.gen.ts
158
+ var separatorArrayExplode = (style) => {
159
+ switch (style) {
160
+ case "label":
161
+ return ".";
162
+ case "matrix":
163
+ return ";";
164
+ case "simple":
165
+ return ",";
166
+ default:
167
+ return "&";
168
+ }
169
+ };
170
+ var separatorArrayNoExplode = (style) => {
171
+ switch (style) {
172
+ case "form":
173
+ return ",";
174
+ case "pipeDelimited":
175
+ return "|";
176
+ case "spaceDelimited":
177
+ return "%20";
178
+ default:
179
+ return ",";
180
+ }
181
+ };
182
+ var separatorObjectExplode = (style) => {
183
+ switch (style) {
184
+ case "label":
185
+ return ".";
186
+ case "matrix":
187
+ return ";";
188
+ case "simple":
189
+ return ",";
190
+ default:
191
+ return "&";
192
+ }
193
+ };
194
+ var serializeArrayParam = ({
195
+ allowReserved,
196
+ explode,
197
+ name,
198
+ style,
199
+ value
200
+ }) => {
201
+ if (!explode) {
202
+ const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
203
+ switch (style) {
204
+ case "label":
205
+ return `.${joinedValues2}`;
206
+ case "matrix":
207
+ return `;${name}=${joinedValues2}`;
208
+ case "simple":
209
+ return joinedValues2;
210
+ default:
211
+ return `${name}=${joinedValues2}`;
212
+ }
213
+ }
214
+ const separator = separatorArrayExplode(style);
215
+ const joinedValues = value.map((v) => {
216
+ if (style === "label" || style === "simple") {
217
+ return allowReserved ? v : encodeURIComponent(v);
218
+ }
219
+ return serializePrimitiveParam({
220
+ allowReserved,
221
+ name,
222
+ value: v
223
+ });
224
+ }).join(separator);
225
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
226
+ };
227
+ var serializePrimitiveParam = ({
228
+ allowReserved,
229
+ name,
230
+ value
231
+ }) => {
232
+ if (value === void 0 || value === null) {
233
+ return "";
234
+ }
235
+ if (typeof value === "object") {
236
+ throw new Error(
237
+ "Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
238
+ );
239
+ }
240
+ return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
241
+ };
242
+ var serializeObjectParam = ({
243
+ allowReserved,
244
+ explode,
245
+ name,
246
+ style,
247
+ value,
248
+ valueOnly
249
+ }) => {
250
+ if (value instanceof Date) {
251
+ return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
252
+ }
253
+ if (style !== "deepObject" && !explode) {
254
+ let values = [];
255
+ Object.entries(value).forEach(([key, v]) => {
256
+ values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
257
+ });
258
+ const joinedValues2 = values.join(",");
259
+ switch (style) {
260
+ case "form":
261
+ return `${name}=${joinedValues2}`;
262
+ case "label":
263
+ return `.${joinedValues2}`;
264
+ case "matrix":
265
+ return `;${name}=${joinedValues2}`;
266
+ default:
267
+ return joinedValues2;
268
+ }
269
+ }
270
+ const separator = separatorObjectExplode(style);
271
+ const joinedValues = Object.entries(value).map(
272
+ ([key, v]) => serializePrimitiveParam({
273
+ allowReserved,
274
+ name: style === "deepObject" ? `${name}[${key}]` : key,
275
+ value: v
276
+ })
277
+ ).join(separator);
278
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
279
+ };
280
+
281
+ // src/client/core/utils.gen.ts
282
+ var PATH_PARAM_RE = /\{[^{}]+\}/g;
283
+ var defaultPathSerializer = ({ path, url: _url }) => {
284
+ let url2 = _url;
285
+ const matches = _url.match(PATH_PARAM_RE);
286
+ if (matches) {
287
+ for (const match of matches) {
288
+ let explode = false;
289
+ let name = match.substring(1, match.length - 1);
290
+ let style = "simple";
291
+ if (name.endsWith("*")) {
292
+ explode = true;
293
+ name = name.substring(0, name.length - 1);
294
+ }
295
+ if (name.startsWith(".")) {
296
+ name = name.substring(1);
297
+ style = "label";
298
+ } else if (name.startsWith(";")) {
299
+ name = name.substring(1);
300
+ style = "matrix";
301
+ }
302
+ const value = path[name];
303
+ if (value === void 0 || value === null) {
304
+ continue;
305
+ }
306
+ if (Array.isArray(value)) {
307
+ url2 = url2.replace(match, serializeArrayParam({ explode, name, style, value }));
308
+ continue;
309
+ }
310
+ if (typeof value === "object") {
311
+ url2 = url2.replace(
312
+ match,
313
+ serializeObjectParam({
314
+ explode,
315
+ name,
316
+ style,
317
+ value,
318
+ valueOnly: true
319
+ })
320
+ );
321
+ continue;
322
+ }
323
+ if (style === "matrix") {
324
+ url2 = url2.replace(
325
+ match,
326
+ `;${serializePrimitiveParam({
327
+ name,
328
+ value
329
+ })}`
330
+ );
331
+ continue;
332
+ }
333
+ const replaceValue = encodeURIComponent(
334
+ style === "label" ? `.${value}` : value
335
+ );
336
+ url2 = url2.replace(match, replaceValue);
337
+ }
338
+ }
339
+ return url2;
340
+ };
341
+ var getUrl = ({
342
+ baseUrl,
343
+ path,
344
+ query,
345
+ querySerializer,
346
+ url: _url
347
+ }) => {
348
+ const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
349
+ let url2 = (baseUrl ?? "") + pathUrl;
350
+ if (path) {
351
+ url2 = defaultPathSerializer({ path, url: url2 });
352
+ }
353
+ let search = query ? querySerializer(query) : "";
354
+ if (search.startsWith("?")) {
355
+ search = search.substring(1);
356
+ }
357
+ if (search) {
358
+ url2 += `?${search}`;
359
+ }
360
+ return url2;
361
+ };
362
+ function getValidRequestBody(options) {
363
+ const hasBody = options.body !== void 0;
364
+ const isSerializedBody = hasBody && options.bodySerializer;
365
+ if (isSerializedBody) {
366
+ if ("serializedBody" in options) {
367
+ const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
368
+ return hasSerializedBody ? options.serializedBody : null;
369
+ }
370
+ return options.body !== "" ? options.body : null;
371
+ }
372
+ if (hasBody) {
373
+ return options.body;
374
+ }
375
+ return void 0;
376
+ }
377
+
378
+ // src/client/core/auth.gen.ts
379
+ var getAuthToken = async (auth, callback) => {
380
+ const token = typeof callback === "function" ? await callback(auth) : callback;
381
+ if (!token) {
382
+ return;
383
+ }
384
+ if (auth.scheme === "bearer") {
385
+ return `Bearer ${token}`;
386
+ }
387
+ if (auth.scheme === "basic") {
388
+ return `Basic ${btoa(token)}`;
389
+ }
390
+ return token;
391
+ };
392
+
393
+ // src/client/client/utils.gen.ts
394
+ var createQuerySerializer = ({
395
+ parameters = {},
396
+ ...args
397
+ } = {}) => {
398
+ const querySerializer = (queryParams) => {
399
+ const search = [];
400
+ if (queryParams && typeof queryParams === "object") {
401
+ for (const name in queryParams) {
402
+ const value = queryParams[name];
403
+ if (value === void 0 || value === null) {
404
+ continue;
405
+ }
406
+ const options = parameters[name] || args;
407
+ if (Array.isArray(value)) {
408
+ const serializedArray = serializeArrayParam({
409
+ allowReserved: options.allowReserved,
410
+ explode: true,
411
+ name,
412
+ style: "form",
413
+ value,
414
+ ...options.array
415
+ });
416
+ if (serializedArray) search.push(serializedArray);
417
+ } else if (typeof value === "object") {
418
+ const serializedObject = serializeObjectParam({
419
+ allowReserved: options.allowReserved,
420
+ explode: true,
421
+ name,
422
+ style: "deepObject",
423
+ value,
424
+ ...options.object
425
+ });
426
+ if (serializedObject) search.push(serializedObject);
427
+ } else {
428
+ const serializedPrimitive = serializePrimitiveParam({
429
+ allowReserved: options.allowReserved,
430
+ name,
431
+ value
432
+ });
433
+ if (serializedPrimitive) search.push(serializedPrimitive);
434
+ }
435
+ }
436
+ }
437
+ return search.join("&");
438
+ };
439
+ return querySerializer;
440
+ };
441
+ var getParseAs = (contentType) => {
442
+ if (!contentType) {
443
+ return "stream";
444
+ }
445
+ const cleanContent = contentType.split(";")[0]?.trim();
446
+ if (!cleanContent) {
447
+ return;
448
+ }
449
+ if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
450
+ return "json";
451
+ }
452
+ if (cleanContent === "multipart/form-data") {
453
+ return "formData";
454
+ }
455
+ if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
456
+ return "blob";
457
+ }
458
+ if (cleanContent.startsWith("text/")) {
459
+ return "text";
460
+ }
461
+ return;
462
+ };
463
+ var checkForExistence = (options, name) => {
464
+ if (!name) {
465
+ return false;
466
+ }
467
+ if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
468
+ return true;
469
+ }
470
+ return false;
471
+ };
472
+ async function setAuthParams(options) {
473
+ for (const auth of options.security ?? []) {
474
+ if (checkForExistence(options, auth.name)) {
475
+ continue;
476
+ }
477
+ const token = await getAuthToken(auth, options.auth);
478
+ if (!token) {
479
+ continue;
480
+ }
481
+ const name = auth.name ?? "Authorization";
482
+ switch (auth.in) {
483
+ case "query":
484
+ if (!options.query) {
485
+ options.query = {};
486
+ }
487
+ options.query[name] = token;
488
+ break;
489
+ case "cookie":
490
+ options.headers.append("Cookie", `${name}=${token}`);
491
+ break;
492
+ case "header":
493
+ default:
494
+ options.headers.set(name, token);
495
+ break;
496
+ }
497
+ }
498
+ }
499
+ var buildUrl = (options) => getUrl({
500
+ baseUrl: options.baseUrl,
501
+ path: options.path,
502
+ query: options.query,
503
+ querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
504
+ url: options.url
505
+ });
506
+ var mergeConfigs = (a, b) => {
507
+ const config = { ...a, ...b };
508
+ if (config.baseUrl?.endsWith("/")) {
509
+ config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
510
+ }
511
+ config.headers = mergeHeaders(a.headers, b.headers);
512
+ return config;
513
+ };
514
+ var headersEntries = (headers) => {
515
+ const entries = [];
516
+ headers.forEach((value, key) => {
517
+ entries.push([key, value]);
518
+ });
519
+ return entries;
520
+ };
521
+ var mergeHeaders = (...headers) => {
522
+ const mergedHeaders = new Headers();
523
+ for (const header of headers) {
524
+ if (!header) {
525
+ continue;
526
+ }
527
+ const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
528
+ for (const [key, value] of iterator) {
529
+ if (value === null) {
530
+ mergedHeaders.delete(key);
531
+ } else if (Array.isArray(value)) {
532
+ for (const v of value) {
533
+ mergedHeaders.append(key, v);
534
+ }
535
+ } else if (value !== void 0) {
536
+ mergedHeaders.set(
537
+ key,
538
+ typeof value === "object" ? JSON.stringify(value) : value
539
+ );
540
+ }
541
+ }
542
+ }
543
+ return mergedHeaders;
544
+ };
545
+ var Interceptors = class {
546
+ fns = [];
547
+ clear() {
548
+ this.fns = [];
549
+ }
550
+ eject(id) {
551
+ const index = this.getInterceptorIndex(id);
552
+ if (this.fns[index]) {
553
+ this.fns[index] = null;
554
+ }
555
+ }
556
+ exists(id) {
557
+ const index = this.getInterceptorIndex(id);
558
+ return Boolean(this.fns[index]);
559
+ }
560
+ getInterceptorIndex(id) {
561
+ if (typeof id === "number") {
562
+ return this.fns[id] ? id : -1;
563
+ }
564
+ return this.fns.indexOf(id);
565
+ }
566
+ update(id, fn) {
567
+ const index = this.getInterceptorIndex(id);
568
+ if (this.fns[index]) {
569
+ this.fns[index] = fn;
570
+ return id;
571
+ }
572
+ return false;
573
+ }
574
+ use(fn) {
575
+ this.fns.push(fn);
576
+ return this.fns.length - 1;
577
+ }
578
+ };
579
+ var createInterceptors = () => ({
580
+ error: new Interceptors(),
581
+ request: new Interceptors(),
582
+ response: new Interceptors()
583
+ });
584
+ var defaultQuerySerializer = createQuerySerializer({
585
+ allowReserved: false,
586
+ array: {
587
+ explode: true,
588
+ style: "form"
589
+ },
590
+ object: {
591
+ explode: true,
592
+ style: "deepObject"
593
+ }
594
+ });
595
+ var defaultHeaders = {
596
+ "Content-Type": "application/json"
597
+ };
598
+ var createConfig = (override = {}) => ({
599
+ ...jsonBodySerializer,
600
+ headers: defaultHeaders,
601
+ parseAs: "auto",
602
+ querySerializer: defaultQuerySerializer,
603
+ ...override
604
+ });
605
+
606
+ // src/client/client/client.gen.ts
607
+ var createClient = (config = {}) => {
608
+ let _config = mergeConfigs(createConfig(), config);
609
+ const getConfig = () => ({ ..._config });
610
+ const setConfig = (config2) => {
611
+ _config = mergeConfigs(_config, config2);
612
+ return getConfig();
613
+ };
614
+ const interceptors = createInterceptors();
615
+ const beforeRequest = async (options) => {
616
+ const opts = {
617
+ ..._config,
618
+ ...options,
619
+ fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
620
+ headers: mergeHeaders(_config.headers, options.headers),
621
+ serializedBody: void 0
622
+ };
623
+ if (opts.security) {
624
+ await setAuthParams(opts);
625
+ }
626
+ if (opts.requestValidator) {
627
+ await opts.requestValidator(opts);
628
+ }
629
+ if (opts.body !== void 0 && opts.bodySerializer) {
630
+ opts.serializedBody = opts.bodySerializer(opts.body);
631
+ }
632
+ if (opts.body === void 0 || opts.serializedBody === "") {
633
+ opts.headers.delete("Content-Type");
634
+ }
635
+ const resolvedOpts = opts;
636
+ const url2 = buildUrl(resolvedOpts);
637
+ return { opts: resolvedOpts, url: url2 };
638
+ };
639
+ const request = async (options) => {
640
+ const throwOnError = options.throwOnError ?? _config.throwOnError;
641
+ const responseStyle = options.responseStyle ?? _config.responseStyle;
642
+ let request2;
643
+ let response;
644
+ try {
645
+ const { opts, url: url2 } = await beforeRequest(options);
646
+ const requestInit = {
647
+ redirect: "follow",
648
+ ...opts,
649
+ body: getValidRequestBody(opts)
650
+ };
651
+ request2 = new Request(url2, requestInit);
652
+ for (const fn of interceptors.request.fns) {
653
+ if (fn) {
654
+ request2 = await fn(request2, opts);
655
+ }
656
+ }
657
+ const _fetch = opts.fetch;
658
+ response = await _fetch(request2);
659
+ for (const fn of interceptors.response.fns) {
660
+ if (fn) {
661
+ response = await fn(response, request2, opts);
662
+ }
663
+ }
664
+ const result = {
665
+ request: request2,
666
+ response
667
+ };
668
+ if (response.ok) {
669
+ const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
670
+ if (response.status === 204 || response.headers.get("Content-Length") === "0") {
671
+ let emptyData;
672
+ switch (parseAs) {
673
+ case "arrayBuffer":
674
+ case "blob":
675
+ case "text":
676
+ emptyData = await response[parseAs]();
677
+ break;
678
+ case "formData":
679
+ emptyData = new FormData();
680
+ break;
681
+ case "stream":
682
+ emptyData = response.body;
683
+ break;
684
+ case "json":
685
+ default:
686
+ emptyData = {};
687
+ break;
688
+ }
689
+ return opts.responseStyle === "data" ? emptyData : {
690
+ data: emptyData,
691
+ ...result
692
+ };
693
+ }
694
+ let data;
695
+ switch (parseAs) {
696
+ case "arrayBuffer":
697
+ case "blob":
698
+ case "formData":
699
+ case "text":
700
+ data = await response[parseAs]();
701
+ break;
702
+ case "json": {
703
+ const text = await response.text();
704
+ data = text ? JSON.parse(text) : {};
705
+ break;
706
+ }
707
+ case "stream":
708
+ return opts.responseStyle === "data" ? response.body : {
709
+ data: response.body,
710
+ ...result
711
+ };
712
+ }
713
+ if (parseAs === "json") {
714
+ if (opts.responseValidator) {
715
+ await opts.responseValidator(data);
716
+ }
717
+ if (opts.responseTransformer) {
718
+ data = await opts.responseTransformer(data);
719
+ }
720
+ }
721
+ return opts.responseStyle === "data" ? data : {
722
+ data,
723
+ ...result
724
+ };
725
+ }
726
+ const textError = await response.text();
727
+ let jsonError;
728
+ try {
729
+ jsonError = JSON.parse(textError);
730
+ } catch {
731
+ }
732
+ throw jsonError ?? textError;
733
+ } catch (error) {
734
+ let finalError = error;
735
+ for (const fn of interceptors.error.fns) {
736
+ if (fn) {
737
+ finalError = await fn(finalError, response, request2, options);
738
+ }
739
+ }
740
+ finalError = finalError || {};
741
+ if (throwOnError) {
742
+ throw finalError;
743
+ }
744
+ return responseStyle === "data" ? void 0 : {
745
+ error: finalError,
746
+ request: request2,
747
+ response
748
+ };
749
+ }
750
+ };
751
+ const makeMethodFn = (method) => (options) => request({ ...options, method });
752
+ const makeSseFn = (method) => async (options) => {
753
+ const { opts, url: url2 } = await beforeRequest(options);
754
+ return createSseClient({
755
+ ...opts,
756
+ body: opts.body,
757
+ method,
758
+ onRequest: async (url3, init) => {
759
+ let request2 = new Request(url3, init);
760
+ for (const fn of interceptors.request.fns) {
761
+ if (fn) {
762
+ request2 = await fn(request2, opts);
763
+ }
764
+ }
765
+ return request2;
766
+ },
767
+ serializedBody: getValidRequestBody(opts),
768
+ url: url2
769
+ });
770
+ };
771
+ const _buildUrl = (options) => buildUrl({ ..._config, ...options });
772
+ return {
773
+ buildUrl: _buildUrl,
774
+ connect: makeMethodFn("CONNECT"),
775
+ delete: makeMethodFn("DELETE"),
776
+ get: makeMethodFn("GET"),
777
+ getConfig,
778
+ head: makeMethodFn("HEAD"),
779
+ interceptors,
780
+ options: makeMethodFn("OPTIONS"),
781
+ patch: makeMethodFn("PATCH"),
782
+ post: makeMethodFn("POST"),
783
+ put: makeMethodFn("PUT"),
784
+ request,
785
+ setConfig,
786
+ sse: {
787
+ connect: makeSseFn("CONNECT"),
788
+ delete: makeSseFn("DELETE"),
789
+ get: makeSseFn("GET"),
790
+ head: makeSseFn("HEAD"),
791
+ options: makeSseFn("OPTIONS"),
792
+ patch: makeSseFn("PATCH"),
793
+ post: makeSseFn("POST"),
794
+ put: makeSseFn("PUT"),
795
+ trace: makeSseFn("TRACE")
796
+ },
797
+ trace: makeMethodFn("TRACE")
798
+ };
799
+ };
800
+ var zErrorCode = z__namespace.enum([
801
+ "unauthorized",
802
+ "forbidden",
803
+ "not_found",
804
+ "conflict",
805
+ "validation_failed",
806
+ "rate_limited",
807
+ "internal_error",
808
+ "idempotency_key_invalid",
809
+ "idempotency_key_reused",
810
+ "idempotency_request_in_progress",
811
+ "source_url_unsupported",
812
+ "account_not_available",
813
+ "connection_reauth_required",
814
+ "connection_not_pending",
815
+ "not_implemented",
816
+ "media_processing",
817
+ "not_publishable",
818
+ "media_unprobeable",
819
+ "media_too_large",
820
+ "media_aspect_ratio_unsupported",
821
+ "media_resolution_too_low",
822
+ "media_gif_unsupported",
823
+ "media_format_recompressed",
824
+ "media_resolution_downscaled",
825
+ "video_container_unsupported",
826
+ "video_codec_unsupported",
827
+ "video_audio_codec_unsupported",
828
+ "video_too_large",
829
+ "video_too_small",
830
+ "video_dimensions_unsupported",
831
+ "video_dimensions_too_large",
832
+ "video_fps_unsupported",
833
+ "video_fps_too_low",
834
+ "video_aspect_unsupported",
835
+ "video_duration_too_short",
836
+ "video_duration_exceeds_max",
837
+ "document_format_unsupported",
838
+ "document_too_large",
839
+ "document_too_many_pages",
840
+ "media_count_invalid",
841
+ "body_too_long",
842
+ "content_missing",
843
+ "content_conflict",
844
+ "content_incomplete",
845
+ "content_kind_mismatch",
846
+ "media_type_mismatch",
847
+ "tag_limit_exceeded",
848
+ "reel_field_on_non_reel",
849
+ "media_not_ready",
850
+ "media_failed",
851
+ "media_unsupported",
852
+ "media_kind_mismatch",
853
+ "publishing_unavailable",
854
+ "x_duplicate_content",
855
+ "x_not_authorized",
856
+ "x_rate_limited",
857
+ "x_publish_failed",
858
+ "x_media_upload_failed",
859
+ "linkedin_duplicate_content",
860
+ "linkedin_auth_expired",
861
+ "linkedin_permission_denied",
862
+ "linkedin_media_processing",
863
+ "linkedin_media_upload_failed",
864
+ "linkedin_publish_failed",
865
+ "instagram_media_processing",
866
+ "instagram_container_expired",
867
+ "instagram_container_failed",
868
+ "instagram_rate_limited",
869
+ "instagram_not_authorized",
870
+ "instagram_publish_failed",
871
+ "facebook_reel_processing",
872
+ "facebook_reel_failed",
873
+ "facebook_rate_limited",
874
+ "facebook_not_authorized",
875
+ "facebook_publish_failed",
876
+ "connection_platform_mismatch"
877
+ ]);
878
+ z__namespace.object({
879
+ limit: z__namespace.int().gte(1).lte(100).optional().default(20),
880
+ offset: z__namespace.int().gte(0).lte(9007199254740991).optional().default(0),
881
+ external_id: z__namespace.string().optional(),
882
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
883
+ z__namespace.string().max(500),
884
+ z__namespace.number(),
885
+ z__namespace.boolean()
886
+ ])).optional()
887
+ });
888
+ z__namespace.object({
889
+ object: z__namespace.literal("list"),
890
+ data: z__namespace.array(z__namespace.object({
891
+ id: z__namespace.string(),
892
+ name: z__namespace.string(),
893
+ description: z__namespace.string().nullable(),
894
+ external_id: z__namespace.string().nullable(),
895
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
896
+ z__namespace.string().max(500),
897
+ z__namespace.number(),
898
+ z__namespace.boolean()
899
+ ])),
900
+ created_at: z__namespace.string().nullable(),
901
+ updated_at: z__namespace.string().nullable()
902
+ })),
903
+ total: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
904
+ limit: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
905
+ offset: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
906
+ has_more: z__namespace.boolean()
907
+ });
908
+ z__namespace.object({
909
+ name: z__namespace.string().min(1).max(255),
910
+ description: z__namespace.string().max(280).optional(),
911
+ external_id: z__namespace.string().min(1).max(255).optional(),
912
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
913
+ z__namespace.string().max(500),
914
+ z__namespace.number(),
915
+ z__namespace.boolean()
916
+ ])).optional()
917
+ });
918
+ z__namespace.object({
919
+ id: z__namespace.string(),
920
+ name: z__namespace.string(),
921
+ description: z__namespace.string().nullable(),
922
+ external_id: z__namespace.string().nullable(),
923
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
924
+ z__namespace.string().max(500),
925
+ z__namespace.number(),
926
+ z__namespace.boolean()
927
+ ])),
928
+ created_at: z__namespace.string().nullable(),
929
+ updated_at: z__namespace.string().nullable()
930
+ });
931
+ z__namespace.object({
932
+ id: z__namespace.string()
933
+ });
934
+ z__namespace.object({
935
+ id: z__namespace.string(),
936
+ object: z__namespace.literal("profile"),
937
+ deleted: z__namespace.literal(true)
938
+ });
939
+ z__namespace.object({
940
+ id: z__namespace.string()
941
+ });
942
+ z__namespace.object({
943
+ id: z__namespace.string(),
944
+ name: z__namespace.string(),
945
+ description: z__namespace.string().nullable(),
946
+ external_id: z__namespace.string().nullable(),
947
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
948
+ z__namespace.string().max(500),
949
+ z__namespace.number(),
950
+ z__namespace.boolean()
951
+ ])),
952
+ created_at: z__namespace.string().nullable(),
953
+ updated_at: z__namespace.string().nullable()
954
+ });
955
+ z__namespace.object({
956
+ name: z__namespace.string().min(1).max(255).optional(),
957
+ description: z__namespace.string().max(280).nullish(),
958
+ external_id: z__namespace.string().min(1).max(255).optional(),
959
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
960
+ z__namespace.string().max(500),
961
+ z__namespace.number(),
962
+ z__namespace.boolean()
963
+ ])).optional()
964
+ });
965
+ z__namespace.object({
966
+ id: z__namespace.string()
967
+ });
968
+ z__namespace.object({
969
+ id: z__namespace.string(),
970
+ name: z__namespace.string(),
971
+ description: z__namespace.string().nullable(),
972
+ external_id: z__namespace.string().nullable(),
973
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
974
+ z__namespace.string().max(500),
975
+ z__namespace.number(),
976
+ z__namespace.boolean()
977
+ ])),
978
+ created_at: z__namespace.string().nullable(),
979
+ updated_at: z__namespace.string().nullable()
980
+ });
981
+ z__namespace.object({
982
+ id: z__namespace.string()
983
+ });
984
+ z__namespace.object({
985
+ limit: z__namespace.int().gte(1).lte(100).optional().default(20),
986
+ offset: z__namespace.int().gte(0).lte(9007199254740991).optional().default(0)
987
+ });
988
+ z__namespace.object({
989
+ object: z__namespace.literal("list"),
990
+ data: z__namespace.array(z__namespace.object({
991
+ id: z__namespace.string(),
992
+ profile_id: z__namespace.string(),
993
+ platform: z__namespace.enum([
994
+ "meta_ads",
995
+ "google_ads",
996
+ "tiktok_ads",
997
+ "x",
998
+ "linkedin",
999
+ "facebook_page",
1000
+ "instagram",
1001
+ "tiktok"
1002
+ ]),
1003
+ external_account_id: z__namespace.string().nullable(),
1004
+ external_account_name: z__namespace.string().nullable(),
1005
+ currency: z__namespace.string().nullable(),
1006
+ created_at: z__namespace.string().nullable(),
1007
+ updated_at: z__namespace.string().nullable()
1008
+ })),
1009
+ total: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
1010
+ limit: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
1011
+ offset: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
1012
+ has_more: z__namespace.boolean()
1013
+ });
1014
+ z__namespace.object({
1015
+ id: z__namespace.string()
1016
+ });
1017
+ z__namespace.object({
1018
+ id: z__namespace.string(),
1019
+ object: z__namespace.literal("connection"),
1020
+ deleted: z__namespace.literal(true)
1021
+ });
1022
+ z__namespace.object({
1023
+ id: z__namespace.string()
1024
+ });
1025
+ z__namespace.object({
1026
+ id: z__namespace.string(),
1027
+ profile_id: z__namespace.string(),
1028
+ platform: z__namespace.enum([
1029
+ "meta_ads",
1030
+ "google_ads",
1031
+ "tiktok_ads",
1032
+ "x",
1033
+ "linkedin",
1034
+ "facebook_page",
1035
+ "instagram",
1036
+ "tiktok"
1037
+ ]),
1038
+ external_account_id: z__namespace.string().nullable(),
1039
+ external_account_name: z__namespace.string().nullable(),
1040
+ currency: z__namespace.string().nullable(),
1041
+ created_at: z__namespace.string().nullable(),
1042
+ updated_at: z__namespace.string().nullable()
1043
+ });
1044
+ z__namespace.object({
1045
+ external_account_id: z__namespace.string().min(1)
1046
+ });
1047
+ z__namespace.object({
1048
+ id: z__namespace.string()
1049
+ });
1050
+ z__namespace.object({
1051
+ id: z__namespace.string(),
1052
+ profile_id: z__namespace.string(),
1053
+ platform: z__namespace.enum([
1054
+ "meta_ads",
1055
+ "google_ads",
1056
+ "tiktok_ads",
1057
+ "x",
1058
+ "linkedin",
1059
+ "facebook_page",
1060
+ "instagram",
1061
+ "tiktok"
1062
+ ]),
1063
+ external_account_id: z__namespace.string().nullable(),
1064
+ external_account_name: z__namespace.string().nullable(),
1065
+ currency: z__namespace.string().nullable(),
1066
+ created_at: z__namespace.string().nullable(),
1067
+ updated_at: z__namespace.string().nullable()
1068
+ });
1069
+ z__namespace.object({
1070
+ id: z__namespace.string()
1071
+ });
1072
+ z__namespace.object({
1073
+ object: z__namespace.literal("list"),
1074
+ data: z__namespace.array(z__namespace.object({
1075
+ external_account_id: z__namespace.string(),
1076
+ name: z__namespace.string().nullable(),
1077
+ currency: z__namespace.string().nullable(),
1078
+ instagram: z__namespace.object({
1079
+ external_account_id: z__namespace.string(),
1080
+ name: z__namespace.string().nullable()
1081
+ }).nullish()
1082
+ }))
1083
+ });
1084
+ z__namespace.object({
1085
+ platform: z__namespace.enum([
1086
+ "meta_ads",
1087
+ "google_ads",
1088
+ "tiktok_ads",
1089
+ "x",
1090
+ "linkedin",
1091
+ "facebook_page",
1092
+ "tiktok"
1093
+ ])
1094
+ });
1095
+ z__namespace.object({
1096
+ id: z__namespace.string()
1097
+ });
1098
+ z__namespace.object({
1099
+ connect_session_token: z__namespace.string(),
1100
+ connect_url: z__namespace.string(),
1101
+ expires_at: z__namespace.string()
1102
+ });
1103
+ z__namespace.object({
1104
+ profile_id: z__namespace.string(),
1105
+ kind: z__namespace.enum([
1106
+ "image",
1107
+ "video",
1108
+ "gif",
1109
+ "document"
1110
+ ]),
1111
+ content_type: z__namespace.string().min(1).regex(/^(?:(?:image|video)\/[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*|application\/pdf|application\/msword|application\/vnd\.openxmlformats-officedocument\.wordprocessingml\.document|application\/vnd\.ms-powerpoint|application\/vnd\.openxmlformats-officedocument\.presentationml\.presentation)$/).optional(),
1112
+ source_url: z__namespace.url().optional(),
1113
+ targets: z__namespace.array(z__namespace.enum([
1114
+ "x",
1115
+ "linkedin",
1116
+ "facebook_page",
1117
+ "instagram",
1118
+ "tiktok",
1119
+ "google_ads"
1120
+ ])).min(1).optional(),
1121
+ raw: z__namespace.boolean().optional().default(false),
1122
+ alt_text: z__namespace.string().max(1e3).optional(),
1123
+ external_id: z__namespace.string().min(1).max(255).optional(),
1124
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
1125
+ z__namespace.string().max(500),
1126
+ z__namespace.number(),
1127
+ z__namespace.boolean()
1128
+ ])).optional()
1129
+ });
1130
+ z__namespace.object({
1131
+ id: z__namespace.string(),
1132
+ object: z__namespace.literal("media"),
1133
+ profile_id: z__namespace.string(),
1134
+ kind: z__namespace.enum([
1135
+ "image",
1136
+ "video",
1137
+ "gif",
1138
+ "document"
1139
+ ]),
1140
+ status: z__namespace.enum([
1141
+ "uploading",
1142
+ "processing",
1143
+ "ready",
1144
+ "failed"
1145
+ ]),
1146
+ raw: z__namespace.boolean(),
1147
+ error: z__namespace.object({
1148
+ code: z__namespace.enum([
1149
+ "media_unprobeable",
1150
+ "media_too_large",
1151
+ "media_aspect_ratio_unsupported",
1152
+ "media_resolution_too_low",
1153
+ "media_gif_unsupported",
1154
+ "media_format_recompressed",
1155
+ "media_resolution_downscaled",
1156
+ "video_container_unsupported",
1157
+ "video_codec_unsupported",
1158
+ "video_audio_codec_unsupported",
1159
+ "video_too_large",
1160
+ "video_too_small",
1161
+ "video_dimensions_unsupported",
1162
+ "video_dimensions_too_large",
1163
+ "video_fps_unsupported",
1164
+ "video_fps_too_low",
1165
+ "video_aspect_unsupported",
1166
+ "video_duration_too_short",
1167
+ "video_duration_exceeds_max",
1168
+ "document_format_unsupported",
1169
+ "document_too_large",
1170
+ "document_too_many_pages",
1171
+ "media_unsupported"
1172
+ ]),
1173
+ message: z__namespace.string(),
1174
+ hint: z__namespace.string().optional(),
1175
+ allowed: z__namespace.array(z__namespace.string()).optional(),
1176
+ got: z__namespace.string().optional()
1177
+ }).nullable(),
1178
+ source: z__namespace.object({
1179
+ format: z__namespace.string(),
1180
+ bytes: z__namespace.int().gte(0).lte(9007199254740991),
1181
+ width: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1182
+ height: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1183
+ duration_ms: z__namespace.int().gte(0).lte(9007199254740991).nullable()
1184
+ }).nullable(),
1185
+ alt_text: z__namespace.string().max(1e3).nullable(),
1186
+ per_platform: z__namespace.record(z__namespace.string(), z__namespace.object({
1187
+ status: z__namespace.enum([
1188
+ "processing",
1189
+ "ready",
1190
+ "failed"
1191
+ ]),
1192
+ url: z__namespace.string().nullable(),
1193
+ width: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1194
+ height: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1195
+ bytes: z__namespace.int().gte(0).lte(9007199254740991).nullable(),
1196
+ warnings: z__namespace.array(z__namespace.object({
1197
+ code: z__namespace.enum([
1198
+ "media_unprobeable",
1199
+ "media_too_large",
1200
+ "media_aspect_ratio_unsupported",
1201
+ "media_resolution_too_low",
1202
+ "media_gif_unsupported",
1203
+ "media_format_recompressed",
1204
+ "media_resolution_downscaled",
1205
+ "video_container_unsupported",
1206
+ "video_codec_unsupported",
1207
+ "video_audio_codec_unsupported",
1208
+ "video_too_large",
1209
+ "video_too_small",
1210
+ "video_dimensions_unsupported",
1211
+ "video_dimensions_too_large",
1212
+ "video_fps_unsupported",
1213
+ "video_fps_too_low",
1214
+ "video_aspect_unsupported",
1215
+ "video_duration_too_short",
1216
+ "video_duration_exceeds_max",
1217
+ "document_format_unsupported",
1218
+ "document_too_large",
1219
+ "document_too_many_pages",
1220
+ "media_unsupported"
1221
+ ]),
1222
+ message: z__namespace.string(),
1223
+ hint: z__namespace.string().optional(),
1224
+ allowed: z__namespace.array(z__namespace.string()).optional(),
1225
+ got: z__namespace.string().optional()
1226
+ })),
1227
+ errors: z__namespace.array(z__namespace.object({
1228
+ code: z__namespace.enum([
1229
+ "media_unprobeable",
1230
+ "media_too_large",
1231
+ "media_aspect_ratio_unsupported",
1232
+ "media_resolution_too_low",
1233
+ "media_gif_unsupported",
1234
+ "media_format_recompressed",
1235
+ "media_resolution_downscaled",
1236
+ "video_container_unsupported",
1237
+ "video_codec_unsupported",
1238
+ "video_audio_codec_unsupported",
1239
+ "video_too_large",
1240
+ "video_too_small",
1241
+ "video_dimensions_unsupported",
1242
+ "video_dimensions_too_large",
1243
+ "video_fps_unsupported",
1244
+ "video_fps_too_low",
1245
+ "video_aspect_unsupported",
1246
+ "video_duration_too_short",
1247
+ "video_duration_exceeds_max",
1248
+ "document_format_unsupported",
1249
+ "document_too_large",
1250
+ "document_too_many_pages",
1251
+ "media_unsupported"
1252
+ ]),
1253
+ message: z__namespace.string(),
1254
+ hint: z__namespace.string().optional(),
1255
+ allowed: z__namespace.array(z__namespace.string()).optional(),
1256
+ got: z__namespace.string().optional()
1257
+ }))
1258
+ })),
1259
+ external_id: z__namespace.string().nullable(),
1260
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
1261
+ z__namespace.string().max(500),
1262
+ z__namespace.number(),
1263
+ z__namespace.boolean()
1264
+ ])),
1265
+ created_at: z__namespace.string(),
1266
+ updated_at: z__namespace.string(),
1267
+ upload: z__namespace.object({
1268
+ url: z__namespace.url(),
1269
+ method: z__namespace.literal("PUT"),
1270
+ headers: z__namespace.record(z__namespace.string(), z__namespace.string()),
1271
+ expires_at: z__namespace.string()
1272
+ }).nullable()
1273
+ });
1274
+ z__namespace.object({
1275
+ id: z__namespace.string()
1276
+ });
1277
+ z__namespace.object({
1278
+ id: z__namespace.string(),
1279
+ object: z__namespace.literal("media"),
1280
+ deleted: z__namespace.literal(true)
1281
+ });
1282
+ z__namespace.object({
1283
+ id: z__namespace.string()
1284
+ });
1285
+ z__namespace.object({
1286
+ id: z__namespace.string(),
1287
+ object: z__namespace.literal("media"),
1288
+ profile_id: z__namespace.string(),
1289
+ kind: z__namespace.enum([
1290
+ "image",
1291
+ "video",
1292
+ "gif",
1293
+ "document"
1294
+ ]),
1295
+ status: z__namespace.enum([
1296
+ "uploading",
1297
+ "processing",
1298
+ "ready",
1299
+ "failed"
1300
+ ]),
1301
+ raw: z__namespace.boolean(),
1302
+ error: z__namespace.object({
1303
+ code: z__namespace.enum([
1304
+ "media_unprobeable",
1305
+ "media_too_large",
1306
+ "media_aspect_ratio_unsupported",
1307
+ "media_resolution_too_low",
1308
+ "media_gif_unsupported",
1309
+ "media_format_recompressed",
1310
+ "media_resolution_downscaled",
1311
+ "video_container_unsupported",
1312
+ "video_codec_unsupported",
1313
+ "video_audio_codec_unsupported",
1314
+ "video_too_large",
1315
+ "video_too_small",
1316
+ "video_dimensions_unsupported",
1317
+ "video_dimensions_too_large",
1318
+ "video_fps_unsupported",
1319
+ "video_fps_too_low",
1320
+ "video_aspect_unsupported",
1321
+ "video_duration_too_short",
1322
+ "video_duration_exceeds_max",
1323
+ "document_format_unsupported",
1324
+ "document_too_large",
1325
+ "document_too_many_pages",
1326
+ "media_unsupported"
1327
+ ]),
1328
+ message: z__namespace.string(),
1329
+ hint: z__namespace.string().optional(),
1330
+ allowed: z__namespace.array(z__namespace.string()).optional(),
1331
+ got: z__namespace.string().optional()
1332
+ }).nullable(),
1333
+ source: z__namespace.object({
1334
+ format: z__namespace.string(),
1335
+ bytes: z__namespace.int().gte(0).lte(9007199254740991),
1336
+ width: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1337
+ height: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1338
+ duration_ms: z__namespace.int().gte(0).lte(9007199254740991).nullable()
1339
+ }).nullable(),
1340
+ alt_text: z__namespace.string().max(1e3).nullable(),
1341
+ per_platform: z__namespace.record(z__namespace.string(), z__namespace.object({
1342
+ status: z__namespace.enum([
1343
+ "processing",
1344
+ "ready",
1345
+ "failed"
1346
+ ]),
1347
+ url: z__namespace.string().nullable(),
1348
+ width: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1349
+ height: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1350
+ bytes: z__namespace.int().gte(0).lte(9007199254740991).nullable(),
1351
+ warnings: z__namespace.array(z__namespace.object({
1352
+ code: z__namespace.enum([
1353
+ "media_unprobeable",
1354
+ "media_too_large",
1355
+ "media_aspect_ratio_unsupported",
1356
+ "media_resolution_too_low",
1357
+ "media_gif_unsupported",
1358
+ "media_format_recompressed",
1359
+ "media_resolution_downscaled",
1360
+ "video_container_unsupported",
1361
+ "video_codec_unsupported",
1362
+ "video_audio_codec_unsupported",
1363
+ "video_too_large",
1364
+ "video_too_small",
1365
+ "video_dimensions_unsupported",
1366
+ "video_dimensions_too_large",
1367
+ "video_fps_unsupported",
1368
+ "video_fps_too_low",
1369
+ "video_aspect_unsupported",
1370
+ "video_duration_too_short",
1371
+ "video_duration_exceeds_max",
1372
+ "document_format_unsupported",
1373
+ "document_too_large",
1374
+ "document_too_many_pages",
1375
+ "media_unsupported"
1376
+ ]),
1377
+ message: z__namespace.string(),
1378
+ hint: z__namespace.string().optional(),
1379
+ allowed: z__namespace.array(z__namespace.string()).optional(),
1380
+ got: z__namespace.string().optional()
1381
+ })),
1382
+ errors: z__namespace.array(z__namespace.object({
1383
+ code: z__namespace.enum([
1384
+ "media_unprobeable",
1385
+ "media_too_large",
1386
+ "media_aspect_ratio_unsupported",
1387
+ "media_resolution_too_low",
1388
+ "media_gif_unsupported",
1389
+ "media_format_recompressed",
1390
+ "media_resolution_downscaled",
1391
+ "video_container_unsupported",
1392
+ "video_codec_unsupported",
1393
+ "video_audio_codec_unsupported",
1394
+ "video_too_large",
1395
+ "video_too_small",
1396
+ "video_dimensions_unsupported",
1397
+ "video_dimensions_too_large",
1398
+ "video_fps_unsupported",
1399
+ "video_fps_too_low",
1400
+ "video_aspect_unsupported",
1401
+ "video_duration_too_short",
1402
+ "video_duration_exceeds_max",
1403
+ "document_format_unsupported",
1404
+ "document_too_large",
1405
+ "document_too_many_pages",
1406
+ "media_unsupported"
1407
+ ]),
1408
+ message: z__namespace.string(),
1409
+ hint: z__namespace.string().optional(),
1410
+ allowed: z__namespace.array(z__namespace.string()).optional(),
1411
+ got: z__namespace.string().optional()
1412
+ }))
1413
+ })),
1414
+ external_id: z__namespace.string().nullable(),
1415
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
1416
+ z__namespace.string().max(500),
1417
+ z__namespace.number(),
1418
+ z__namespace.boolean()
1419
+ ])),
1420
+ created_at: z__namespace.string(),
1421
+ updated_at: z__namespace.string()
1422
+ });
1423
+ z__namespace.object({
1424
+ alt_text: z__namespace.string().max(1e3).nullish(),
1425
+ external_id: z__namespace.string().min(1).max(255).nullish(),
1426
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
1427
+ z__namespace.string().max(500),
1428
+ z__namespace.number(),
1429
+ z__namespace.boolean()
1430
+ ])).optional(),
1431
+ targets: z__namespace.array(z__namespace.enum([
1432
+ "x",
1433
+ "linkedin",
1434
+ "facebook_page",
1435
+ "instagram",
1436
+ "tiktok",
1437
+ "google_ads"
1438
+ ])).min(1).optional()
1439
+ });
1440
+ z__namespace.object({
1441
+ id: z__namespace.string()
1442
+ });
1443
+ z__namespace.object({
1444
+ id: z__namespace.string(),
1445
+ object: z__namespace.literal("media"),
1446
+ profile_id: z__namespace.string(),
1447
+ kind: z__namespace.enum([
1448
+ "image",
1449
+ "video",
1450
+ "gif",
1451
+ "document"
1452
+ ]),
1453
+ status: z__namespace.enum([
1454
+ "uploading",
1455
+ "processing",
1456
+ "ready",
1457
+ "failed"
1458
+ ]),
1459
+ raw: z__namespace.boolean(),
1460
+ error: z__namespace.object({
1461
+ code: z__namespace.enum([
1462
+ "media_unprobeable",
1463
+ "media_too_large",
1464
+ "media_aspect_ratio_unsupported",
1465
+ "media_resolution_too_low",
1466
+ "media_gif_unsupported",
1467
+ "media_format_recompressed",
1468
+ "media_resolution_downscaled",
1469
+ "video_container_unsupported",
1470
+ "video_codec_unsupported",
1471
+ "video_audio_codec_unsupported",
1472
+ "video_too_large",
1473
+ "video_too_small",
1474
+ "video_dimensions_unsupported",
1475
+ "video_dimensions_too_large",
1476
+ "video_fps_unsupported",
1477
+ "video_fps_too_low",
1478
+ "video_aspect_unsupported",
1479
+ "video_duration_too_short",
1480
+ "video_duration_exceeds_max",
1481
+ "document_format_unsupported",
1482
+ "document_too_large",
1483
+ "document_too_many_pages",
1484
+ "media_unsupported"
1485
+ ]),
1486
+ message: z__namespace.string(),
1487
+ hint: z__namespace.string().optional(),
1488
+ allowed: z__namespace.array(z__namespace.string()).optional(),
1489
+ got: z__namespace.string().optional()
1490
+ }).nullable(),
1491
+ source: z__namespace.object({
1492
+ format: z__namespace.string(),
1493
+ bytes: z__namespace.int().gte(0).lte(9007199254740991),
1494
+ width: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1495
+ height: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1496
+ duration_ms: z__namespace.int().gte(0).lte(9007199254740991).nullable()
1497
+ }).nullable(),
1498
+ alt_text: z__namespace.string().max(1e3).nullable(),
1499
+ per_platform: z__namespace.record(z__namespace.string(), z__namespace.object({
1500
+ status: z__namespace.enum([
1501
+ "processing",
1502
+ "ready",
1503
+ "failed"
1504
+ ]),
1505
+ url: z__namespace.string().nullable(),
1506
+ width: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1507
+ height: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1508
+ bytes: z__namespace.int().gte(0).lte(9007199254740991).nullable(),
1509
+ warnings: z__namespace.array(z__namespace.object({
1510
+ code: z__namespace.enum([
1511
+ "media_unprobeable",
1512
+ "media_too_large",
1513
+ "media_aspect_ratio_unsupported",
1514
+ "media_resolution_too_low",
1515
+ "media_gif_unsupported",
1516
+ "media_format_recompressed",
1517
+ "media_resolution_downscaled",
1518
+ "video_container_unsupported",
1519
+ "video_codec_unsupported",
1520
+ "video_audio_codec_unsupported",
1521
+ "video_too_large",
1522
+ "video_too_small",
1523
+ "video_dimensions_unsupported",
1524
+ "video_dimensions_too_large",
1525
+ "video_fps_unsupported",
1526
+ "video_fps_too_low",
1527
+ "video_aspect_unsupported",
1528
+ "video_duration_too_short",
1529
+ "video_duration_exceeds_max",
1530
+ "document_format_unsupported",
1531
+ "document_too_large",
1532
+ "document_too_many_pages",
1533
+ "media_unsupported"
1534
+ ]),
1535
+ message: z__namespace.string(),
1536
+ hint: z__namespace.string().optional(),
1537
+ allowed: z__namespace.array(z__namespace.string()).optional(),
1538
+ got: z__namespace.string().optional()
1539
+ })),
1540
+ errors: z__namespace.array(z__namespace.object({
1541
+ code: z__namespace.enum([
1542
+ "media_unprobeable",
1543
+ "media_too_large",
1544
+ "media_aspect_ratio_unsupported",
1545
+ "media_resolution_too_low",
1546
+ "media_gif_unsupported",
1547
+ "media_format_recompressed",
1548
+ "media_resolution_downscaled",
1549
+ "video_container_unsupported",
1550
+ "video_codec_unsupported",
1551
+ "video_audio_codec_unsupported",
1552
+ "video_too_large",
1553
+ "video_too_small",
1554
+ "video_dimensions_unsupported",
1555
+ "video_dimensions_too_large",
1556
+ "video_fps_unsupported",
1557
+ "video_fps_too_low",
1558
+ "video_aspect_unsupported",
1559
+ "video_duration_too_short",
1560
+ "video_duration_exceeds_max",
1561
+ "document_format_unsupported",
1562
+ "document_too_large",
1563
+ "document_too_many_pages",
1564
+ "media_unsupported"
1565
+ ]),
1566
+ message: z__namespace.string(),
1567
+ hint: z__namespace.string().optional(),
1568
+ allowed: z__namespace.array(z__namespace.string()).optional(),
1569
+ got: z__namespace.string().optional()
1570
+ }))
1571
+ })),
1572
+ external_id: z__namespace.string().nullable(),
1573
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
1574
+ z__namespace.string().max(500),
1575
+ z__namespace.number(),
1576
+ z__namespace.boolean()
1577
+ ])),
1578
+ created_at: z__namespace.string(),
1579
+ updated_at: z__namespace.string()
1580
+ });
1581
+ z__namespace.object({
1582
+ limit: z__namespace.int().gte(1).lte(100).optional().default(20),
1583
+ offset: z__namespace.int().gte(0).lte(9007199254740991).optional().default(0),
1584
+ profile_id: z__namespace.string().optional(),
1585
+ external_id: z__namespace.string().optional(),
1586
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
1587
+ z__namespace.string().max(500),
1588
+ z__namespace.number(),
1589
+ z__namespace.boolean()
1590
+ ])).optional(),
1591
+ scheduled_after: z__namespace.iso.datetime().optional(),
1592
+ scheduled_before: z__namespace.iso.datetime().optional(),
1593
+ updated_after: z__namespace.iso.datetime().optional(),
1594
+ status: z__namespace.array(z__namespace.enum([
1595
+ "draft",
1596
+ "scheduled",
1597
+ "publishing",
1598
+ "partially_published",
1599
+ "published",
1600
+ "failed"
1601
+ ])).optional()
1602
+ });
1603
+ z__namespace.object({
1604
+ object: z__namespace.literal("list"),
1605
+ data: z__namespace.array(z__namespace.object({
1606
+ id: z__namespace.string(),
1607
+ object: z__namespace.literal("post"),
1608
+ profile_id: z__namespace.string(),
1609
+ external_id: z__namespace.string().nullable(),
1610
+ status: z__namespace.enum([
1611
+ "draft",
1612
+ "scheduled",
1613
+ "publishing",
1614
+ "partially_published",
1615
+ "published",
1616
+ "failed"
1617
+ ]),
1618
+ schedule_at: z__namespace.string().nullable(),
1619
+ tags: z__namespace.array(z__namespace.string()),
1620
+ notes: z__namespace.string().nullable(),
1621
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
1622
+ z__namespace.string().max(500),
1623
+ z__namespace.number(),
1624
+ z__namespace.boolean()
1625
+ ])),
1626
+ variants: z__namespace.array(z__namespace.object({
1627
+ id: z__namespace.string(),
1628
+ object: z__namespace.literal("post_variant"),
1629
+ connection_id: z__namespace.string(),
1630
+ platform: z__namespace.enum([
1631
+ "x",
1632
+ "linkedin",
1633
+ "facebook_page",
1634
+ "instagram",
1635
+ "tiktok"
1636
+ ]),
1637
+ post_type: z__namespace.enum([
1638
+ "text",
1639
+ "single_image",
1640
+ "multi_image",
1641
+ "video",
1642
+ "reel",
1643
+ "carousel"
1644
+ ]),
1645
+ body: z__namespace.string().nullable(),
1646
+ status: z__namespace.enum([
1647
+ "draft",
1648
+ "scheduled",
1649
+ "publishing",
1650
+ "published",
1651
+ "failed"
1652
+ ]),
1653
+ settings: z__namespace.record(z__namespace.string(), z__namespace.unknown()),
1654
+ schedule_at: z__namespace.string().nullable(),
1655
+ result: z__namespace.object({
1656
+ platform_post_id: z__namespace.string(),
1657
+ permalink: z__namespace.string().nullable(),
1658
+ published_at: z__namespace.string()
1659
+ }).nullable(),
1660
+ error: z__namespace.object({
1661
+ code: z__namespace.string(),
1662
+ message: z__namespace.string()
1663
+ }).nullable(),
1664
+ media: z__namespace.array(z__namespace.object({
1665
+ media_id: z__namespace.string(),
1666
+ position: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
1667
+ crop_box: z__namespace.record(z__namespace.string(), z__namespace.unknown()).nullable(),
1668
+ alt_text_override: z__namespace.string().nullable()
1669
+ }))
1670
+ })),
1671
+ created_at: z__namespace.string(),
1672
+ updated_at: z__namespace.string()
1673
+ })),
1674
+ total: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
1675
+ limit: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
1676
+ offset: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
1677
+ has_more: z__namespace.boolean()
1678
+ });
1679
+ z__namespace.object({
1680
+ profile_id: z__namespace.string(),
1681
+ publish: z__namespace.enum([
1682
+ "now",
1683
+ "schedule",
1684
+ "draft"
1685
+ ]).optional().default("draft"),
1686
+ schedule_at: z__namespace.iso.datetime().optional(),
1687
+ external_id: z__namespace.string().min(1).max(255).optional(),
1688
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
1689
+ z__namespace.string().max(500),
1690
+ z__namespace.number(),
1691
+ z__namespace.boolean()
1692
+ ])).optional(),
1693
+ tags: z__namespace.array(z__namespace.string()).optional(),
1694
+ notes: z__namespace.string().optional(),
1695
+ dry_run: z__namespace.boolean().optional().default(false),
1696
+ variants: z__namespace.array(z__namespace.union([
1697
+ z__namespace.object({
1698
+ platform: z__namespace.literal("x"),
1699
+ post_type: z__namespace.enum([
1700
+ "text",
1701
+ "single_image",
1702
+ "multi_image",
1703
+ "video"
1704
+ ]),
1705
+ connection_id: z__namespace.string(),
1706
+ body: z__namespace.string().optional(),
1707
+ media: z__namespace.array(z__namespace.object({
1708
+ media_id: z__namespace.string(),
1709
+ crop_box: z__namespace.record(z__namespace.string(), z__namespace.unknown()).nullish(),
1710
+ alt_text_override: z__namespace.string().nullish()
1711
+ })).optional().default([]),
1712
+ settings: z__namespace.object({
1713
+ reply_settings: z__namespace.enum([
1714
+ "everyone",
1715
+ "following",
1716
+ "mentionedUsers",
1717
+ "subscribers",
1718
+ "verified"
1719
+ ]).optional(),
1720
+ quote_tweet_id: z__namespace.string().regex(/^[0-9]{1,19}$/).optional(),
1721
+ poll: z__namespace.object({
1722
+ options: z__namespace.array(z__namespace.string().min(1).max(25)).min(2).max(4),
1723
+ duration_minutes: z__namespace.int().gte(5).lte(10080),
1724
+ reply_settings: z__namespace.enum([
1725
+ "following",
1726
+ "mentionedUsers",
1727
+ "subscribers",
1728
+ "verified"
1729
+ ]).optional()
1730
+ }).optional(),
1731
+ reply: z__namespace.object({
1732
+ in_reply_to_tweet_id: z__namespace.string().regex(/^[0-9]{1,19}$/),
1733
+ exclude_reply_user_ids: z__namespace.array(z__namespace.string().regex(/^[0-9]{1,19}$/)).optional(),
1734
+ auto_populate_reply_metadata: z__namespace.boolean().optional()
1735
+ }).optional(),
1736
+ community_id: z__namespace.string().regex(/^[0-9]{1,19}$/).optional(),
1737
+ for_super_followers_only: z__namespace.boolean().optional(),
1738
+ geo: z__namespace.object({
1739
+ place_id: z__namespace.string()
1740
+ }).optional(),
1741
+ card_uri: z__namespace.string().optional(),
1742
+ media_tagged_user_ids: z__namespace.array(z__namespace.string().regex(/^[0-9]{1,19}$/)).max(10).optional()
1743
+ }).optional().default({})
1744
+ }),
1745
+ z__namespace.object({
1746
+ platform: z__namespace.literal("linkedin"),
1747
+ post_type: z__namespace.enum([
1748
+ "text",
1749
+ "single_image",
1750
+ "multi_image",
1751
+ "video"
1752
+ ]),
1753
+ connection_id: z__namespace.string(),
1754
+ body: z__namespace.string().optional(),
1755
+ media: z__namespace.array(z__namespace.object({
1756
+ media_id: z__namespace.string(),
1757
+ crop_box: z__namespace.record(z__namespace.string(), z__namespace.unknown()).nullish(),
1758
+ alt_text_override: z__namespace.string().nullish()
1759
+ })).optional().default([]),
1760
+ settings: z__namespace.object({
1761
+ visibility: z__namespace.enum(["PUBLIC", "CONNECTIONS"]),
1762
+ content_kind: z__namespace.enum([
1763
+ "text",
1764
+ "single_image",
1765
+ "video",
1766
+ "multi_image",
1767
+ "document",
1768
+ "article",
1769
+ "poll"
1770
+ ]),
1771
+ article: z__namespace.object({
1772
+ source: z__namespace.url(),
1773
+ title: z__namespace.string().max(400).optional(),
1774
+ description: z__namespace.string().max(4086).optional(),
1775
+ thumbnail_media_id: z__namespace.string().optional()
1776
+ }).optional(),
1777
+ poll: z__namespace.object({
1778
+ question: z__namespace.string().min(1).max(140),
1779
+ options: z__namespace.array(z__namespace.string().min(1).max(30)).min(2).max(4),
1780
+ duration: z__namespace.enum([
1781
+ "ONE_DAY",
1782
+ "THREE_DAYS",
1783
+ "SEVEN_DAYS",
1784
+ "FOURTEEN_DAYS"
1785
+ ])
1786
+ }).optional(),
1787
+ document: z__namespace.object({
1788
+ title: z__namespace.string().min(1).max(400)
1789
+ }).optional(),
1790
+ disable_reshare: z__namespace.boolean().optional(),
1791
+ mentions: z__namespace.array(z__namespace.object({
1792
+ type: z__namespace.enum(["person", "organization"]),
1793
+ name: z__namespace.string().min(1),
1794
+ urn: z__namespace.string().regex(/^urn:li:(person|organization):/)
1795
+ })).optional()
1796
+ })
1797
+ }),
1798
+ z__namespace.object({
1799
+ platform: z__namespace.literal("instagram"),
1800
+ post_type: z__namespace.enum([
1801
+ "single_image",
1802
+ "carousel",
1803
+ "reel"
1804
+ ]),
1805
+ connection_id: z__namespace.string(),
1806
+ body: z__namespace.string().optional(),
1807
+ media: z__namespace.array(z__namespace.object({
1808
+ media_id: z__namespace.string(),
1809
+ crop_box: z__namespace.record(z__namespace.string(), z__namespace.unknown()).nullish(),
1810
+ alt_text_override: z__namespace.string().nullish()
1811
+ })).optional().default([]),
1812
+ settings: z__namespace.object({
1813
+ media_type: z__namespace.enum([
1814
+ "IMAGE",
1815
+ "CAROUSEL",
1816
+ "REELS"
1817
+ ]).optional(),
1818
+ location_id: z__namespace.string().optional(),
1819
+ user_tags: z__namespace.array(z__namespace.object({
1820
+ username: z__namespace.string().min(1),
1821
+ x: z__namespace.number().gte(0).lte(1),
1822
+ y: z__namespace.number().gte(0).lte(1)
1823
+ })).optional(),
1824
+ collaborators: z__namespace.array(z__namespace.string().min(1)).max(3).optional(),
1825
+ share_to_feed: z__namespace.boolean().optional(),
1826
+ thumb_offset: z__namespace.int().gte(0).lte(9007199254740991).optional(),
1827
+ cover_url: z__namespace.url().optional(),
1828
+ audio_name: z__namespace.string().optional()
1829
+ })
1830
+ }),
1831
+ z__namespace.object({
1832
+ platform: z__namespace.literal("facebook_page"),
1833
+ post_type: z__namespace.enum([
1834
+ "text",
1835
+ "single_image",
1836
+ "multi_image",
1837
+ "reel"
1838
+ ]),
1839
+ connection_id: z__namespace.string(),
1840
+ body: z__namespace.string().optional(),
1841
+ media: z__namespace.array(z__namespace.object({
1842
+ media_id: z__namespace.string(),
1843
+ crop_box: z__namespace.record(z__namespace.string(), z__namespace.unknown()).nullish(),
1844
+ alt_text_override: z__namespace.string().nullish()
1845
+ })).optional().default([]),
1846
+ settings: z__namespace.object({
1847
+ link: z__namespace.url().optional()
1848
+ }).optional().default({})
1849
+ })
1850
+ ])).min(1)
1851
+ });
1852
+ z__namespace.object({
1853
+ id: z__namespace.string(),
1854
+ object: z__namespace.literal("post"),
1855
+ profile_id: z__namespace.string(),
1856
+ external_id: z__namespace.string().nullable(),
1857
+ status: z__namespace.enum([
1858
+ "draft",
1859
+ "scheduled",
1860
+ "publishing",
1861
+ "partially_published",
1862
+ "published",
1863
+ "failed"
1864
+ ]),
1865
+ schedule_at: z__namespace.string().nullable(),
1866
+ tags: z__namespace.array(z__namespace.string()),
1867
+ notes: z__namespace.string().nullable(),
1868
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
1869
+ z__namespace.string().max(500),
1870
+ z__namespace.number(),
1871
+ z__namespace.boolean()
1872
+ ])),
1873
+ variants: z__namespace.array(z__namespace.object({
1874
+ id: z__namespace.string(),
1875
+ object: z__namespace.literal("post_variant"),
1876
+ connection_id: z__namespace.string(),
1877
+ platform: z__namespace.enum([
1878
+ "x",
1879
+ "linkedin",
1880
+ "facebook_page",
1881
+ "instagram",
1882
+ "tiktok"
1883
+ ]),
1884
+ post_type: z__namespace.enum([
1885
+ "text",
1886
+ "single_image",
1887
+ "multi_image",
1888
+ "video",
1889
+ "reel",
1890
+ "carousel"
1891
+ ]),
1892
+ body: z__namespace.string().nullable(),
1893
+ status: z__namespace.enum([
1894
+ "draft",
1895
+ "scheduled",
1896
+ "publishing",
1897
+ "published",
1898
+ "failed"
1899
+ ]),
1900
+ settings: z__namespace.record(z__namespace.string(), z__namespace.unknown()),
1901
+ schedule_at: z__namespace.string().nullable(),
1902
+ result: z__namespace.object({
1903
+ platform_post_id: z__namespace.string(),
1904
+ permalink: z__namespace.string().nullable(),
1905
+ published_at: z__namespace.string()
1906
+ }).nullable(),
1907
+ error: z__namespace.object({
1908
+ code: z__namespace.string(),
1909
+ message: z__namespace.string()
1910
+ }).nullable(),
1911
+ media: z__namespace.array(z__namespace.object({
1912
+ media_id: z__namespace.string(),
1913
+ position: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
1914
+ crop_box: z__namespace.record(z__namespace.string(), z__namespace.unknown()).nullable(),
1915
+ alt_text_override: z__namespace.string().nullable()
1916
+ }))
1917
+ })),
1918
+ created_at: z__namespace.string(),
1919
+ updated_at: z__namespace.string(),
1920
+ dry_run: z__namespace.boolean(),
1921
+ executed: z__namespace.boolean()
1922
+ });
1923
+ z__namespace.object({
1924
+ id: z__namespace.string()
1925
+ });
1926
+ z__namespace.object({
1927
+ id: z__namespace.string(),
1928
+ object: z__namespace.literal("post"),
1929
+ deleted: z__namespace.literal(true)
1930
+ });
1931
+ z__namespace.object({
1932
+ id: z__namespace.string()
1933
+ });
1934
+ z__namespace.object({
1935
+ id: z__namespace.string(),
1936
+ object: z__namespace.literal("post"),
1937
+ profile_id: z__namespace.string(),
1938
+ external_id: z__namespace.string().nullable(),
1939
+ status: z__namespace.enum([
1940
+ "draft",
1941
+ "scheduled",
1942
+ "publishing",
1943
+ "partially_published",
1944
+ "published",
1945
+ "failed"
1946
+ ]),
1947
+ schedule_at: z__namespace.string().nullable(),
1948
+ tags: z__namespace.array(z__namespace.string()),
1949
+ notes: z__namespace.string().nullable(),
1950
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
1951
+ z__namespace.string().max(500),
1952
+ z__namespace.number(),
1953
+ z__namespace.boolean()
1954
+ ])),
1955
+ variants: z__namespace.array(z__namespace.object({
1956
+ id: z__namespace.string(),
1957
+ object: z__namespace.literal("post_variant"),
1958
+ connection_id: z__namespace.string(),
1959
+ platform: z__namespace.enum([
1960
+ "x",
1961
+ "linkedin",
1962
+ "facebook_page",
1963
+ "instagram",
1964
+ "tiktok"
1965
+ ]),
1966
+ post_type: z__namespace.enum([
1967
+ "text",
1968
+ "single_image",
1969
+ "multi_image",
1970
+ "video",
1971
+ "reel",
1972
+ "carousel"
1973
+ ]),
1974
+ body: z__namespace.string().nullable(),
1975
+ status: z__namespace.enum([
1976
+ "draft",
1977
+ "scheduled",
1978
+ "publishing",
1979
+ "published",
1980
+ "failed"
1981
+ ]),
1982
+ settings: z__namespace.record(z__namespace.string(), z__namespace.unknown()),
1983
+ schedule_at: z__namespace.string().nullable(),
1984
+ result: z__namespace.object({
1985
+ platform_post_id: z__namespace.string(),
1986
+ permalink: z__namespace.string().nullable(),
1987
+ published_at: z__namespace.string()
1988
+ }).nullable(),
1989
+ error: z__namespace.object({
1990
+ code: z__namespace.string(),
1991
+ message: z__namespace.string()
1992
+ }).nullable(),
1993
+ media: z__namespace.array(z__namespace.object({
1994
+ media_id: z__namespace.string(),
1995
+ position: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
1996
+ crop_box: z__namespace.record(z__namespace.string(), z__namespace.unknown()).nullable(),
1997
+ alt_text_override: z__namespace.string().nullable()
1998
+ }))
1999
+ })),
2000
+ created_at: z__namespace.string(),
2001
+ updated_at: z__namespace.string()
2002
+ });
2003
+ z__namespace.object({
2004
+ publish: z__namespace.enum([
2005
+ "now",
2006
+ "schedule",
2007
+ "draft"
2008
+ ]).optional(),
2009
+ schedule_at: z__namespace.iso.datetime().nullish(),
2010
+ external_id: z__namespace.string().min(1).max(255).nullish(),
2011
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
2012
+ z__namespace.string().max(500),
2013
+ z__namespace.number(),
2014
+ z__namespace.boolean()
2015
+ ])).optional(),
2016
+ tags: z__namespace.array(z__namespace.string()).optional(),
2017
+ notes: z__namespace.string().nullish(),
2018
+ dry_run: z__namespace.boolean().optional().default(false),
2019
+ variants: z__namespace.array(z__namespace.union([
2020
+ z__namespace.object({
2021
+ platform: z__namespace.literal("x"),
2022
+ post_type: z__namespace.enum([
2023
+ "text",
2024
+ "single_image",
2025
+ "multi_image",
2026
+ "video"
2027
+ ]),
2028
+ connection_id: z__namespace.string(),
2029
+ body: z__namespace.string().optional(),
2030
+ media: z__namespace.array(z__namespace.object({
2031
+ media_id: z__namespace.string(),
2032
+ crop_box: z__namespace.record(z__namespace.string(), z__namespace.unknown()).nullish(),
2033
+ alt_text_override: z__namespace.string().nullish()
2034
+ })).optional().default([]),
2035
+ settings: z__namespace.object({
2036
+ reply_settings: z__namespace.enum([
2037
+ "everyone",
2038
+ "following",
2039
+ "mentionedUsers",
2040
+ "subscribers",
2041
+ "verified"
2042
+ ]).optional(),
2043
+ quote_tweet_id: z__namespace.string().regex(/^[0-9]{1,19}$/).optional(),
2044
+ poll: z__namespace.object({
2045
+ options: z__namespace.array(z__namespace.string().min(1).max(25)).min(2).max(4),
2046
+ duration_minutes: z__namespace.int().gte(5).lte(10080),
2047
+ reply_settings: z__namespace.enum([
2048
+ "following",
2049
+ "mentionedUsers",
2050
+ "subscribers",
2051
+ "verified"
2052
+ ]).optional()
2053
+ }).optional(),
2054
+ reply: z__namespace.object({
2055
+ in_reply_to_tweet_id: z__namespace.string().regex(/^[0-9]{1,19}$/),
2056
+ exclude_reply_user_ids: z__namespace.array(z__namespace.string().regex(/^[0-9]{1,19}$/)).optional(),
2057
+ auto_populate_reply_metadata: z__namespace.boolean().optional()
2058
+ }).optional(),
2059
+ community_id: z__namespace.string().regex(/^[0-9]{1,19}$/).optional(),
2060
+ for_super_followers_only: z__namespace.boolean().optional(),
2061
+ geo: z__namespace.object({
2062
+ place_id: z__namespace.string()
2063
+ }).optional(),
2064
+ card_uri: z__namespace.string().optional(),
2065
+ media_tagged_user_ids: z__namespace.array(z__namespace.string().regex(/^[0-9]{1,19}$/)).max(10).optional()
2066
+ }).optional().default({})
2067
+ }),
2068
+ z__namespace.object({
2069
+ platform: z__namespace.literal("linkedin"),
2070
+ post_type: z__namespace.enum([
2071
+ "text",
2072
+ "single_image",
2073
+ "multi_image",
2074
+ "video"
2075
+ ]),
2076
+ connection_id: z__namespace.string(),
2077
+ body: z__namespace.string().optional(),
2078
+ media: z__namespace.array(z__namespace.object({
2079
+ media_id: z__namespace.string(),
2080
+ crop_box: z__namespace.record(z__namespace.string(), z__namespace.unknown()).nullish(),
2081
+ alt_text_override: z__namespace.string().nullish()
2082
+ })).optional().default([]),
2083
+ settings: z__namespace.object({
2084
+ visibility: z__namespace.enum(["PUBLIC", "CONNECTIONS"]),
2085
+ content_kind: z__namespace.enum([
2086
+ "text",
2087
+ "single_image",
2088
+ "video",
2089
+ "multi_image",
2090
+ "document",
2091
+ "article",
2092
+ "poll"
2093
+ ]),
2094
+ article: z__namespace.object({
2095
+ source: z__namespace.url(),
2096
+ title: z__namespace.string().max(400).optional(),
2097
+ description: z__namespace.string().max(4086).optional(),
2098
+ thumbnail_media_id: z__namespace.string().optional()
2099
+ }).optional(),
2100
+ poll: z__namespace.object({
2101
+ question: z__namespace.string().min(1).max(140),
2102
+ options: z__namespace.array(z__namespace.string().min(1).max(30)).min(2).max(4),
2103
+ duration: z__namespace.enum([
2104
+ "ONE_DAY",
2105
+ "THREE_DAYS",
2106
+ "SEVEN_DAYS",
2107
+ "FOURTEEN_DAYS"
2108
+ ])
2109
+ }).optional(),
2110
+ document: z__namespace.object({
2111
+ title: z__namespace.string().min(1).max(400)
2112
+ }).optional(),
2113
+ disable_reshare: z__namespace.boolean().optional(),
2114
+ mentions: z__namespace.array(z__namespace.object({
2115
+ type: z__namespace.enum(["person", "organization"]),
2116
+ name: z__namespace.string().min(1),
2117
+ urn: z__namespace.string().regex(/^urn:li:(person|organization):/)
2118
+ })).optional()
2119
+ })
2120
+ }),
2121
+ z__namespace.object({
2122
+ platform: z__namespace.literal("instagram"),
2123
+ post_type: z__namespace.enum([
2124
+ "single_image",
2125
+ "carousel",
2126
+ "reel"
2127
+ ]),
2128
+ connection_id: z__namespace.string(),
2129
+ body: z__namespace.string().optional(),
2130
+ media: z__namespace.array(z__namespace.object({
2131
+ media_id: z__namespace.string(),
2132
+ crop_box: z__namespace.record(z__namespace.string(), z__namespace.unknown()).nullish(),
2133
+ alt_text_override: z__namespace.string().nullish()
2134
+ })).optional().default([]),
2135
+ settings: z__namespace.object({
2136
+ media_type: z__namespace.enum([
2137
+ "IMAGE",
2138
+ "CAROUSEL",
2139
+ "REELS"
2140
+ ]).optional(),
2141
+ location_id: z__namespace.string().optional(),
2142
+ user_tags: z__namespace.array(z__namespace.object({
2143
+ username: z__namespace.string().min(1),
2144
+ x: z__namespace.number().gte(0).lte(1),
2145
+ y: z__namespace.number().gte(0).lte(1)
2146
+ })).optional(),
2147
+ collaborators: z__namespace.array(z__namespace.string().min(1)).max(3).optional(),
2148
+ share_to_feed: z__namespace.boolean().optional(),
2149
+ thumb_offset: z__namespace.int().gte(0).lte(9007199254740991).optional(),
2150
+ cover_url: z__namespace.url().optional(),
2151
+ audio_name: z__namespace.string().optional()
2152
+ })
2153
+ }),
2154
+ z__namespace.object({
2155
+ platform: z__namespace.literal("facebook_page"),
2156
+ post_type: z__namespace.enum([
2157
+ "text",
2158
+ "single_image",
2159
+ "multi_image",
2160
+ "reel"
2161
+ ]),
2162
+ connection_id: z__namespace.string(),
2163
+ body: z__namespace.string().optional(),
2164
+ media: z__namespace.array(z__namespace.object({
2165
+ media_id: z__namespace.string(),
2166
+ crop_box: z__namespace.record(z__namespace.string(), z__namespace.unknown()).nullish(),
2167
+ alt_text_override: z__namespace.string().nullish()
2168
+ })).optional().default([]),
2169
+ settings: z__namespace.object({
2170
+ link: z__namespace.url().optional()
2171
+ }).optional().default({})
2172
+ })
2173
+ ])).min(1).optional()
2174
+ });
2175
+ z__namespace.object({
2176
+ id: z__namespace.string()
2177
+ });
2178
+ z__namespace.object({
2179
+ id: z__namespace.string(),
2180
+ object: z__namespace.literal("post"),
2181
+ profile_id: z__namespace.string(),
2182
+ external_id: z__namespace.string().nullable(),
2183
+ status: z__namespace.enum([
2184
+ "draft",
2185
+ "scheduled",
2186
+ "publishing",
2187
+ "partially_published",
2188
+ "published",
2189
+ "failed"
2190
+ ]),
2191
+ schedule_at: z__namespace.string().nullable(),
2192
+ tags: z__namespace.array(z__namespace.string()),
2193
+ notes: z__namespace.string().nullable(),
2194
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
2195
+ z__namespace.string().max(500),
2196
+ z__namespace.number(),
2197
+ z__namespace.boolean()
2198
+ ])),
2199
+ variants: z__namespace.array(z__namespace.object({
2200
+ id: z__namespace.string(),
2201
+ object: z__namespace.literal("post_variant"),
2202
+ connection_id: z__namespace.string(),
2203
+ platform: z__namespace.enum([
2204
+ "x",
2205
+ "linkedin",
2206
+ "facebook_page",
2207
+ "instagram",
2208
+ "tiktok"
2209
+ ]),
2210
+ post_type: z__namespace.enum([
2211
+ "text",
2212
+ "single_image",
2213
+ "multi_image",
2214
+ "video",
2215
+ "reel",
2216
+ "carousel"
2217
+ ]),
2218
+ body: z__namespace.string().nullable(),
2219
+ status: z__namespace.enum([
2220
+ "draft",
2221
+ "scheduled",
2222
+ "publishing",
2223
+ "published",
2224
+ "failed"
2225
+ ]),
2226
+ settings: z__namespace.record(z__namespace.string(), z__namespace.unknown()),
2227
+ schedule_at: z__namespace.string().nullable(),
2228
+ result: z__namespace.object({
2229
+ platform_post_id: z__namespace.string(),
2230
+ permalink: z__namespace.string().nullable(),
2231
+ published_at: z__namespace.string()
2232
+ }).nullable(),
2233
+ error: z__namespace.object({
2234
+ code: z__namespace.string(),
2235
+ message: z__namespace.string()
2236
+ }).nullable(),
2237
+ media: z__namespace.array(z__namespace.object({
2238
+ media_id: z__namespace.string(),
2239
+ position: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
2240
+ crop_box: z__namespace.record(z__namespace.string(), z__namespace.unknown()).nullable(),
2241
+ alt_text_override: z__namespace.string().nullable()
2242
+ }))
2243
+ })),
2244
+ created_at: z__namespace.string(),
2245
+ updated_at: z__namespace.string(),
2246
+ dry_run: z__namespace.boolean(),
2247
+ executed: z__namespace.boolean()
2248
+ });
2249
+ z__namespace.object({
2250
+ connection_id: z__namespace.string()
2251
+ });
2252
+ z__namespace.object({
2253
+ id: z__namespace.string(),
2254
+ account_id: z__namespace.string(),
2255
+ name: z__namespace.string().nullable(),
2256
+ account_status: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
2257
+ currency: z__namespace.string(),
2258
+ timezone_name: z__namespace.string().nullable(),
2259
+ amount_spent: z__namespace.string(),
2260
+ balance: z__namespace.string(),
2261
+ spend_cap: z__namespace.string().nullable()
2262
+ });
2263
+ z__namespace.object({
2264
+ connection_id: z__namespace.string()
2265
+ });
2266
+ z__namespace.object({
2267
+ level: z__namespace.enum([
2268
+ "account",
2269
+ "campaign",
2270
+ "adset",
2271
+ "ad"
2272
+ ]).optional().default("account"),
2273
+ date_preset: z__namespace.enum([
2274
+ "today",
2275
+ "yesterday",
2276
+ "this_month",
2277
+ "last_month",
2278
+ "this_quarter",
2279
+ "maximum",
2280
+ "data_maximum",
2281
+ "last_3d",
2282
+ "last_7d",
2283
+ "last_14d",
2284
+ "last_28d",
2285
+ "last_30d",
2286
+ "last_90d",
2287
+ "last_week_mon_sun",
2288
+ "last_week_sun_sat",
2289
+ "last_quarter",
2290
+ "last_year",
2291
+ "this_week_mon_today",
2292
+ "this_week_sun_today",
2293
+ "this_year"
2294
+ ]).optional().default("last_30d"),
2295
+ time_range: z__namespace.object({
2296
+ since: z__namespace.string().regex(/^\d{4}-\d{2}-\d{2}$/),
2297
+ until: z__namespace.string().regex(/^\d{4}-\d{2}-\d{2}$/)
2298
+ }).optional(),
2299
+ time_increment: z__namespace.union([
2300
+ z__namespace.int().gte(1).lte(90),
2301
+ z__namespace.literal("monthly"),
2302
+ z__namespace.literal("all_days")
2303
+ ]).optional()
2304
+ });
2305
+ z__namespace.object({
2306
+ object: z__namespace.literal("list"),
2307
+ data: z__namespace.array(z__namespace.object({
2308
+ date_start: z__namespace.string(),
2309
+ date_stop: z__namespace.string(),
2310
+ account_id: z__namespace.string().optional(),
2311
+ campaign_id: z__namespace.string().optional(),
2312
+ campaign_name: z__namespace.string().optional(),
2313
+ adset_id: z__namespace.string().optional(),
2314
+ adset_name: z__namespace.string().optional(),
2315
+ ad_id: z__namespace.string().optional(),
2316
+ ad_name: z__namespace.string().optional(),
2317
+ spend: z__namespace.string().optional(),
2318
+ impressions: z__namespace.string().optional(),
2319
+ clicks: z__namespace.string().optional(),
2320
+ ctr: z__namespace.string().optional(),
2321
+ cpc: z__namespace.string().optional(),
2322
+ cpm: z__namespace.string().optional(),
2323
+ cpp: z__namespace.string().optional(),
2324
+ reach: z__namespace.string().optional(),
2325
+ frequency: z__namespace.string().optional()
2326
+ }))
2327
+ });
2328
+ z__namespace.object({
2329
+ connection_id: z__namespace.string()
2330
+ });
2331
+ z__namespace.object({
2332
+ object: z__namespace.literal("list"),
2333
+ data: z__namespace.array(z__namespace.object({
2334
+ id: z__namespace.string(),
2335
+ account_id: z__namespace.string().optional(),
2336
+ name: z__namespace.string().nullable(),
2337
+ status: z__namespace.string().optional(),
2338
+ effective_status: z__namespace.string().optional(),
2339
+ objective: z__namespace.string().optional(),
2340
+ daily_budget: z__namespace.string().optional(),
2341
+ lifetime_budget: z__namespace.string().optional(),
2342
+ budget_remaining: z__namespace.string().optional(),
2343
+ bid_strategy: z__namespace.string().optional(),
2344
+ created_time: z__namespace.string().optional(),
2345
+ start_time: z__namespace.string().optional(),
2346
+ stop_time: z__namespace.string().optional()
2347
+ }))
2348
+ });
2349
+ z__namespace.object({
2350
+ connection_id: z__namespace.string(),
2351
+ campaign_id: z__namespace.string().min(1)
2352
+ });
2353
+ z__namespace.object({
2354
+ id: z__namespace.string(),
2355
+ account_id: z__namespace.string().optional(),
2356
+ name: z__namespace.string().nullable(),
2357
+ status: z__namespace.string().optional(),
2358
+ effective_status: z__namespace.string().optional(),
2359
+ objective: z__namespace.string().optional(),
2360
+ daily_budget: z__namespace.string().optional(),
2361
+ lifetime_budget: z__namespace.string().optional(),
2362
+ budget_remaining: z__namespace.string().optional(),
2363
+ bid_strategy: z__namespace.string().optional(),
2364
+ created_time: z__namespace.string().optional(),
2365
+ start_time: z__namespace.string().optional(),
2366
+ stop_time: z__namespace.string().optional()
2367
+ });
2368
+ z__namespace.object({
2369
+ connection_id: z__namespace.string()
2370
+ });
2371
+ z__namespace.object({
2372
+ object: z__namespace.literal("list"),
2373
+ data: z__namespace.array(z__namespace.object({
2374
+ id: z__namespace.string(),
2375
+ account_id: z__namespace.string().optional(),
2376
+ name: z__namespace.string().nullable(),
2377
+ status: z__namespace.string().optional(),
2378
+ effective_status: z__namespace.string().optional(),
2379
+ campaign_id: z__namespace.string().optional(),
2380
+ daily_budget: z__namespace.string().optional(),
2381
+ lifetime_budget: z__namespace.string().optional(),
2382
+ budget_remaining: z__namespace.string().optional(),
2383
+ bid_amount: z__namespace.string().optional(),
2384
+ billing_event: z__namespace.string().optional(),
2385
+ optimization_goal: z__namespace.string().optional(),
2386
+ start_time: z__namespace.string().optional(),
2387
+ end_time: z__namespace.string().optional()
2388
+ }))
2389
+ });
2390
+ z__namespace.object({
2391
+ connection_id: z__namespace.string(),
2392
+ adset_id: z__namespace.string().min(1)
2393
+ });
2394
+ z__namespace.object({
2395
+ id: z__namespace.string(),
2396
+ account_id: z__namespace.string().optional(),
2397
+ name: z__namespace.string().nullable(),
2398
+ status: z__namespace.string().optional(),
2399
+ effective_status: z__namespace.string().optional(),
2400
+ campaign_id: z__namespace.string().optional(),
2401
+ daily_budget: z__namespace.string().optional(),
2402
+ lifetime_budget: z__namespace.string().optional(),
2403
+ budget_remaining: z__namespace.string().optional(),
2404
+ bid_amount: z__namespace.string().optional(),
2405
+ billing_event: z__namespace.string().optional(),
2406
+ optimization_goal: z__namespace.string().optional(),
2407
+ start_time: z__namespace.string().optional(),
2408
+ end_time: z__namespace.string().optional()
2409
+ });
2410
+ z__namespace.object({
2411
+ connection_id: z__namespace.string()
2412
+ });
2413
+ z__namespace.object({
2414
+ object: z__namespace.literal("list"),
2415
+ data: z__namespace.array(z__namespace.object({
2416
+ id: z__namespace.string(),
2417
+ name: z__namespace.string().nullable(),
2418
+ status: z__namespace.string().optional(),
2419
+ effective_status: z__namespace.string().optional(),
2420
+ adset_id: z__namespace.string().optional(),
2421
+ campaign_id: z__namespace.string().optional(),
2422
+ account_id: z__namespace.string().optional(),
2423
+ created_time: z__namespace.string().optional(),
2424
+ updated_time: z__namespace.string().optional()
2425
+ }))
2426
+ });
2427
+ z__namespace.object({
2428
+ connection_id: z__namespace.string(),
2429
+ ad_id: z__namespace.string().min(1)
2430
+ });
2431
+ z__namespace.object({
2432
+ id: z__namespace.string(),
2433
+ name: z__namespace.string().nullable(),
2434
+ status: z__namespace.string().optional(),
2435
+ effective_status: z__namespace.string().optional(),
2436
+ adset_id: z__namespace.string().optional(),
2437
+ campaign_id: z__namespace.string().optional(),
2438
+ account_id: z__namespace.string().optional(),
2439
+ created_time: z__namespace.string().optional(),
2440
+ updated_time: z__namespace.string().optional()
2441
+ });
2442
+ z__namespace.object({
2443
+ connection_id: z__namespace.string()
2444
+ });
2445
+ z__namespace.object({
2446
+ id: z__namespace.string(),
2447
+ descriptive_name: z__namespace.string().nullable(),
2448
+ currency_code: z__namespace.string().nullable(),
2449
+ time_zone: z__namespace.string().nullable(),
2450
+ status: z__namespace.enum([
2451
+ "UNSPECIFIED",
2452
+ "UNKNOWN",
2453
+ "ENABLED",
2454
+ "CANCELED",
2455
+ "SUSPENDED",
2456
+ "CLOSED"
2457
+ ]),
2458
+ manager: z__namespace.boolean(),
2459
+ test_account: z__namespace.boolean()
2460
+ });
2461
+ z__namespace.object({
2462
+ level: z__namespace.enum([
2463
+ "account",
2464
+ "campaign",
2465
+ "ad_group"
2466
+ ]).optional().default("campaign"),
2467
+ metrics: z__namespace.array(z__namespace.enum([
2468
+ "impressions",
2469
+ "clicks",
2470
+ "ctr",
2471
+ "average_cpc",
2472
+ "cost_micros",
2473
+ "conversions",
2474
+ "conversions_value",
2475
+ "cost_per_conversion"
2476
+ ])).min(1).optional().default([
2477
+ "impressions",
2478
+ "clicks",
2479
+ "cost_micros",
2480
+ "conversions"
2481
+ ]),
2482
+ segments: z__namespace.array(z__namespace.enum(["date", "device"])).optional(),
2483
+ since: z__namespace.string().regex(/^\d{4}-\d{2}-\d{2}$/),
2484
+ until: z__namespace.string().regex(/^\d{4}-\d{2}-\d{2}$/)
2485
+ });
2486
+ z__namespace.object({
2487
+ connection_id: z__namespace.string()
2488
+ });
2489
+ z__namespace.object({
2490
+ object: z__namespace.literal("list"),
2491
+ data: z__namespace.array(z__namespace.object({
2492
+ level: z__namespace.enum([
2493
+ "account",
2494
+ "campaign",
2495
+ "ad_group"
2496
+ ]),
2497
+ id: z__namespace.string(),
2498
+ name: z__namespace.string().nullable(),
2499
+ metrics: z__namespace.record(z__namespace.string(), z__namespace.number().nullable()),
2500
+ segments: z__namespace.record(z__namespace.string(), z__namespace.string()).optional()
2501
+ }))
2502
+ });
2503
+ z__namespace.object({
2504
+ query: z__namespace.string().min(1).max(1e4)
2505
+ });
2506
+ z__namespace.object({
2507
+ connection_id: z__namespace.string()
2508
+ });
2509
+ z__namespace.object({
2510
+ object: z__namespace.literal("list"),
2511
+ data: z__namespace.array(z__namespace.union([z__namespace.unknown(), z__namespace.null()]))
2512
+ });
2513
+ z__namespace.object({
2514
+ name: z__namespace.string().min(1).max(255),
2515
+ amount_micros: z__namespace.int().gt(0).lte(9007199254740991),
2516
+ dry_run: z__namespace.boolean().optional().default(false)
2517
+ });
2518
+ z__namespace.object({
2519
+ connection_id: z__namespace.string()
2520
+ });
2521
+ z__namespace.object({
2522
+ id: z__namespace.string().nullable(),
2523
+ resource_name: z__namespace.string().nullable(),
2524
+ dry_run: z__namespace.boolean(),
2525
+ executed: z__namespace.boolean()
2526
+ });
2527
+ z__namespace.object({
2528
+ dry_run: z__namespace.boolean().optional().default(false)
2529
+ });
2530
+ z__namespace.object({
2531
+ connection_id: z__namespace.string(),
2532
+ id: z__namespace.string().regex(/^\d+$/)
2533
+ });
2534
+ z__namespace.object({
2535
+ id: z__namespace.string(),
2536
+ removed: z__namespace.boolean(),
2537
+ dry_run: z__namespace.boolean(),
2538
+ executed: z__namespace.boolean()
2539
+ });
2540
+ z__namespace.object({
2541
+ amount_micros: z__namespace.int().gt(0).lte(9007199254740991),
2542
+ dry_run: z__namespace.boolean().optional().default(false)
2543
+ });
2544
+ z__namespace.object({
2545
+ connection_id: z__namespace.string(),
2546
+ id: z__namespace.string().regex(/^\d+$/)
2547
+ });
2548
+ z__namespace.object({
2549
+ id: z__namespace.string(),
2550
+ resource_name: z__namespace.string(),
2551
+ dry_run: z__namespace.boolean(),
2552
+ executed: z__namespace.boolean()
2553
+ });
2554
+ z__namespace.object({
2555
+ connection_id: z__namespace.string()
2556
+ });
2557
+ z__namespace.object({
2558
+ object: z__namespace.literal("list"),
2559
+ data: z__namespace.array(z__namespace.object({
2560
+ id: z__namespace.string(),
2561
+ name: z__namespace.string().nullable(),
2562
+ status: z__namespace.enum([
2563
+ "UNSPECIFIED",
2564
+ "UNKNOWN",
2565
+ "ENABLED",
2566
+ "PAUSED",
2567
+ "REMOVED"
2568
+ ]),
2569
+ advertising_channel_type: z__namespace.enum([
2570
+ "UNSPECIFIED",
2571
+ "UNKNOWN",
2572
+ "SEARCH",
2573
+ "DISPLAY",
2574
+ "SHOPPING",
2575
+ "HOTEL",
2576
+ "VIDEO",
2577
+ "MULTI_CHANNEL",
2578
+ "LOCAL",
2579
+ "SMART",
2580
+ "PERFORMANCE_MAX",
2581
+ "LOCAL_SERVICES",
2582
+ "TRAVEL",
2583
+ "DEMAND_GEN"
2584
+ ]),
2585
+ bidding_strategy_type: z__namespace.enum([
2586
+ "UNSPECIFIED",
2587
+ "UNKNOWN",
2588
+ "COMMISSION",
2589
+ "ENHANCED_CPC",
2590
+ "FIXED_CPM",
2591
+ "FIXED_SHARE_OF_VOICE",
2592
+ "INVALID",
2593
+ "MANUAL_CPA",
2594
+ "MANUAL_CPC",
2595
+ "MANUAL_CPM",
2596
+ "MANUAL_CPV",
2597
+ "MAXIMIZE_CONVERSIONS",
2598
+ "MAXIMIZE_CONVERSION_VALUE",
2599
+ "PAGE_ONE_PROMOTED",
2600
+ "PERCENT_CPC",
2601
+ "TARGET_CPA",
2602
+ "TARGET_CPC",
2603
+ "TARGET_CPM",
2604
+ "TARGET_CPV",
2605
+ "TARGET_IMPRESSION_SHARE",
2606
+ "TARGET_OUTRANK_SHARE",
2607
+ "TARGET_ROAS",
2608
+ "TARGET_SPEND"
2609
+ ])
2610
+ }))
2611
+ });
2612
+ z__namespace.object({
2613
+ name: z__namespace.string().min(1).max(255),
2614
+ channel: z__namespace.enum(["SEARCH", "DISPLAY"]),
2615
+ campaign_budget: z__namespace.string().min(1),
2616
+ bidding: z__namespace.enum([
2617
+ "manual_cpc",
2618
+ "maximize_conversions",
2619
+ "target_spend"
2620
+ ]),
2621
+ status: z__namespace.enum(["ENABLED", "PAUSED"]).optional().default("PAUSED"),
2622
+ dry_run: z__namespace.boolean().optional().default(false)
2623
+ });
2624
+ z__namespace.object({
2625
+ connection_id: z__namespace.string()
2626
+ });
2627
+ z__namespace.object({
2628
+ id: z__namespace.string().nullable(),
2629
+ resource_name: z__namespace.string().nullable(),
2630
+ dry_run: z__namespace.boolean(),
2631
+ executed: z__namespace.boolean()
2632
+ });
2633
+ z__namespace.object({
2634
+ dry_run: z__namespace.boolean().optional().default(false)
2635
+ });
2636
+ z__namespace.object({
2637
+ connection_id: z__namespace.string(),
2638
+ id: z__namespace.string().regex(/^\d+$/)
2639
+ });
2640
+ z__namespace.object({
2641
+ id: z__namespace.string(),
2642
+ removed: z__namespace.boolean(),
2643
+ dry_run: z__namespace.boolean(),
2644
+ executed: z__namespace.boolean()
2645
+ });
2646
+ z__namespace.object({
2647
+ connection_id: z__namespace.string(),
2648
+ id: z__namespace.string().regex(/^\d+$/)
2649
+ });
2650
+ z__namespace.object({
2651
+ id: z__namespace.string(),
2652
+ name: z__namespace.string().nullable(),
2653
+ status: z__namespace.enum([
2654
+ "UNSPECIFIED",
2655
+ "UNKNOWN",
2656
+ "ENABLED",
2657
+ "PAUSED",
2658
+ "REMOVED"
2659
+ ]),
2660
+ advertising_channel_type: z__namespace.enum([
2661
+ "UNSPECIFIED",
2662
+ "UNKNOWN",
2663
+ "SEARCH",
2664
+ "DISPLAY",
2665
+ "SHOPPING",
2666
+ "HOTEL",
2667
+ "VIDEO",
2668
+ "MULTI_CHANNEL",
2669
+ "LOCAL",
2670
+ "SMART",
2671
+ "PERFORMANCE_MAX",
2672
+ "LOCAL_SERVICES",
2673
+ "TRAVEL",
2674
+ "DEMAND_GEN"
2675
+ ]),
2676
+ bidding_strategy_type: z__namespace.enum([
2677
+ "UNSPECIFIED",
2678
+ "UNKNOWN",
2679
+ "COMMISSION",
2680
+ "ENHANCED_CPC",
2681
+ "FIXED_CPM",
2682
+ "FIXED_SHARE_OF_VOICE",
2683
+ "INVALID",
2684
+ "MANUAL_CPA",
2685
+ "MANUAL_CPC",
2686
+ "MANUAL_CPM",
2687
+ "MANUAL_CPV",
2688
+ "MAXIMIZE_CONVERSIONS",
2689
+ "MAXIMIZE_CONVERSION_VALUE",
2690
+ "PAGE_ONE_PROMOTED",
2691
+ "PERCENT_CPC",
2692
+ "TARGET_CPA",
2693
+ "TARGET_CPC",
2694
+ "TARGET_CPM",
2695
+ "TARGET_CPV",
2696
+ "TARGET_IMPRESSION_SHARE",
2697
+ "TARGET_OUTRANK_SHARE",
2698
+ "TARGET_ROAS",
2699
+ "TARGET_SPEND"
2700
+ ])
2701
+ });
2702
+ z__namespace.object({
2703
+ name: z__namespace.string().min(1).max(255),
2704
+ dry_run: z__namespace.boolean().optional().default(false)
2705
+ });
2706
+ z__namespace.object({
2707
+ connection_id: z__namespace.string(),
2708
+ id: z__namespace.string().regex(/^\d+$/)
2709
+ });
2710
+ z__namespace.object({
2711
+ id: z__namespace.string(),
2712
+ resource_name: z__namespace.string(),
2713
+ dry_run: z__namespace.boolean(),
2714
+ executed: z__namespace.boolean()
2715
+ });
2716
+ z__namespace.object({
2717
+ dry_run: z__namespace.boolean().optional().default(false)
2718
+ });
2719
+ z__namespace.object({
2720
+ connection_id: z__namespace.string(),
2721
+ id: z__namespace.string().regex(/^\d+$/)
2722
+ });
2723
+ z__namespace.object({
2724
+ id: z__namespace.string(),
2725
+ status: z__namespace.enum(["ENABLED", "PAUSED"]),
2726
+ dry_run: z__namespace.boolean(),
2727
+ executed: z__namespace.boolean()
2728
+ });
2729
+ z__namespace.object({
2730
+ dry_run: z__namespace.boolean().optional().default(false)
2731
+ });
2732
+ z__namespace.object({
2733
+ connection_id: z__namespace.string(),
2734
+ id: z__namespace.string().regex(/^\d+$/)
2735
+ });
2736
+ z__namespace.object({
2737
+ id: z__namespace.string(),
2738
+ status: z__namespace.enum(["ENABLED", "PAUSED"]),
2739
+ dry_run: z__namespace.boolean(),
2740
+ executed: z__namespace.boolean()
2741
+ });
2742
+ z__namespace.object({
2743
+ connection_id: z__namespace.string()
2744
+ });
2745
+ z__namespace.object({
2746
+ object: z__namespace.literal("list"),
2747
+ data: z__namespace.array(z__namespace.object({
2748
+ id: z__namespace.string(),
2749
+ name: z__namespace.string().nullable(),
2750
+ status: z__namespace.enum([
2751
+ "UNSPECIFIED",
2752
+ "UNKNOWN",
2753
+ "ENABLED",
2754
+ "PAUSED",
2755
+ "REMOVED"
2756
+ ]),
2757
+ type: z__namespace.enum([
2758
+ "UNSPECIFIED",
2759
+ "UNKNOWN",
2760
+ "SEARCH_STANDARD",
2761
+ "DISPLAY_STANDARD",
2762
+ "SHOPPING_PRODUCT_ADS",
2763
+ "HOTEL_ADS",
2764
+ "SHOPPING_SMART_ADS",
2765
+ "VIDEO_BUMPER",
2766
+ "VIDEO_TRUE_VIEW_IN_STREAM",
2767
+ "VIDEO_TRUE_VIEW_IN_DISPLAY",
2768
+ "VIDEO_NON_SKIPPABLE_IN_STREAM",
2769
+ "SEARCH_DYNAMIC_ADS",
2770
+ "SHOPPING_COMPARISON_LISTING_ADS",
2771
+ "PROMOTED_HOTEL_ADS",
2772
+ "VIDEO_RESPONSIVE",
2773
+ "VIDEO_EFFICIENT_REACH",
2774
+ "SMART_CAMPAIGN_ADS",
2775
+ "TRAVEL_ADS",
2776
+ "YOUTUBE_AUDIO"
2777
+ ]),
2778
+ campaign: z__namespace.string().nullable()
2779
+ }))
2780
+ });
2781
+ z__namespace.object({
2782
+ name: z__namespace.string().min(1).max(255),
2783
+ campaign: z__namespace.string().min(1),
2784
+ type: z__namespace.enum(["SEARCH_STANDARD", "DISPLAY_STANDARD"]),
2785
+ status: z__namespace.enum(["ENABLED", "PAUSED"]).optional().default("ENABLED"),
2786
+ dry_run: z__namespace.boolean().optional().default(false)
2787
+ });
2788
+ z__namespace.object({
2789
+ connection_id: z__namespace.string()
2790
+ });
2791
+ z__namespace.object({
2792
+ id: z__namespace.string().nullable(),
2793
+ resource_name: z__namespace.string().nullable(),
2794
+ dry_run: z__namespace.boolean(),
2795
+ executed: z__namespace.boolean()
2796
+ });
2797
+ z__namespace.object({
2798
+ dry_run: z__namespace.boolean().optional().default(false)
2799
+ });
2800
+ z__namespace.object({
2801
+ connection_id: z__namespace.string(),
2802
+ id: z__namespace.string().regex(/^\d+$/)
2803
+ });
2804
+ z__namespace.object({
2805
+ id: z__namespace.string(),
2806
+ removed: z__namespace.boolean(),
2807
+ dry_run: z__namespace.boolean(),
2808
+ executed: z__namespace.boolean()
2809
+ });
2810
+ z__namespace.object({
2811
+ connection_id: z__namespace.string(),
2812
+ id: z__namespace.string().regex(/^\d+$/)
2813
+ });
2814
+ z__namespace.object({
2815
+ id: z__namespace.string(),
2816
+ name: z__namespace.string().nullable(),
2817
+ status: z__namespace.enum([
2818
+ "UNSPECIFIED",
2819
+ "UNKNOWN",
2820
+ "ENABLED",
2821
+ "PAUSED",
2822
+ "REMOVED"
2823
+ ]),
2824
+ type: z__namespace.enum([
2825
+ "UNSPECIFIED",
2826
+ "UNKNOWN",
2827
+ "SEARCH_STANDARD",
2828
+ "DISPLAY_STANDARD",
2829
+ "SHOPPING_PRODUCT_ADS",
2830
+ "HOTEL_ADS",
2831
+ "SHOPPING_SMART_ADS",
2832
+ "VIDEO_BUMPER",
2833
+ "VIDEO_TRUE_VIEW_IN_STREAM",
2834
+ "VIDEO_TRUE_VIEW_IN_DISPLAY",
2835
+ "VIDEO_NON_SKIPPABLE_IN_STREAM",
2836
+ "SEARCH_DYNAMIC_ADS",
2837
+ "SHOPPING_COMPARISON_LISTING_ADS",
2838
+ "PROMOTED_HOTEL_ADS",
2839
+ "VIDEO_RESPONSIVE",
2840
+ "VIDEO_EFFICIENT_REACH",
2841
+ "SMART_CAMPAIGN_ADS",
2842
+ "TRAVEL_ADS",
2843
+ "YOUTUBE_AUDIO"
2844
+ ]),
2845
+ campaign: z__namespace.string().nullable()
2846
+ });
2847
+ z__namespace.object({
2848
+ name: z__namespace.string().min(1).max(255),
2849
+ dry_run: z__namespace.boolean().optional().default(false)
2850
+ });
2851
+ z__namespace.object({
2852
+ connection_id: z__namespace.string(),
2853
+ id: z__namespace.string().regex(/^\d+$/)
2854
+ });
2855
+ z__namespace.object({
2856
+ id: z__namespace.string(),
2857
+ resource_name: z__namespace.string(),
2858
+ dry_run: z__namespace.boolean(),
2859
+ executed: z__namespace.boolean()
2860
+ });
2861
+ z__namespace.object({
2862
+ cpc_bid_micros: z__namespace.int().gt(0).lte(9007199254740991).optional(),
2863
+ cpm_bid_micros: z__namespace.int().gt(0).lte(9007199254740991).optional(),
2864
+ target_cpa_micros: z__namespace.int().gt(0).lte(9007199254740991).optional(),
2865
+ target_roas: z__namespace.number().gt(0).optional(),
2866
+ dry_run: z__namespace.boolean().optional().default(false)
2867
+ });
2868
+ z__namespace.object({
2869
+ connection_id: z__namespace.string(),
2870
+ id: z__namespace.string().regex(/^\d+$/)
2871
+ });
2872
+ z__namespace.object({
2873
+ id: z__namespace.string(),
2874
+ resource_name: z__namespace.string(),
2875
+ dry_run: z__namespace.boolean(),
2876
+ executed: z__namespace.boolean()
2877
+ });
2878
+ z__namespace.object({
2879
+ dry_run: z__namespace.boolean().optional().default(false)
2880
+ });
2881
+ z__namespace.object({
2882
+ connection_id: z__namespace.string(),
2883
+ id: z__namespace.string().regex(/^\d+$/)
2884
+ });
2885
+ z__namespace.object({
2886
+ id: z__namespace.string(),
2887
+ status: z__namespace.enum(["ENABLED", "PAUSED"]),
2888
+ dry_run: z__namespace.boolean(),
2889
+ executed: z__namespace.boolean()
2890
+ });
2891
+ z__namespace.object({
2892
+ dry_run: z__namespace.boolean().optional().default(false)
2893
+ });
2894
+ z__namespace.object({
2895
+ connection_id: z__namespace.string(),
2896
+ id: z__namespace.string().regex(/^\d+$/)
2897
+ });
2898
+ z__namespace.object({
2899
+ id: z__namespace.string(),
2900
+ status: z__namespace.enum(["ENABLED", "PAUSED"]),
2901
+ dry_run: z__namespace.boolean(),
2902
+ executed: z__namespace.boolean()
2903
+ });
2904
+ z__namespace.object({
2905
+ connection_id: z__namespace.string()
2906
+ });
2907
+ z__namespace.object({
2908
+ object: z__namespace.literal("list"),
2909
+ data: z__namespace.array(z__namespace.object({
2910
+ id: z__namespace.string(),
2911
+ name: z__namespace.string().nullable(),
2912
+ type: z__namespace.enum([
2913
+ "UNSPECIFIED",
2914
+ "UNKNOWN",
2915
+ "TEXT_AD",
2916
+ "EXPANDED_TEXT_AD",
2917
+ "EXPANDED_DYNAMIC_SEARCH_AD",
2918
+ "HOTEL_AD",
2919
+ "SHOPPING_SMART_AD",
2920
+ "SHOPPING_PRODUCT_AD",
2921
+ "VIDEO_AD",
2922
+ "IMAGE_AD",
2923
+ "RESPONSIVE_SEARCH_AD",
2924
+ "LEGACY_RESPONSIVE_DISPLAY_AD",
2925
+ "APP_AD",
2926
+ "LEGACY_APP_INSTALL_AD",
2927
+ "RESPONSIVE_DISPLAY_AD",
2928
+ "LOCAL_AD",
2929
+ "HTML5_UPLOAD_AD",
2930
+ "DYNAMIC_HTML5_AD",
2931
+ "APP_ENGAGEMENT_AD",
2932
+ "SHOPPING_COMPARISON_LISTING_AD",
2933
+ "VIDEO_BUMPER_AD",
2934
+ "VIDEO_NON_SKIPPABLE_IN_STREAM_AD",
2935
+ "VIDEO_TRUEVIEW_IN_STREAM_AD",
2936
+ "VIDEO_RESPONSIVE_AD",
2937
+ "SMART_CAMPAIGN_AD",
2938
+ "CALL_AD",
2939
+ "APP_PRE_REGISTRATION_AD",
2940
+ "IN_FEED_VIDEO_AD",
2941
+ "DEMAND_GEN_MULTI_ASSET_AD",
2942
+ "DEMAND_GEN_CAROUSEL_AD",
2943
+ "TRAVEL_AD",
2944
+ "DEMAND_GEN_VIDEO_RESPONSIVE_AD",
2945
+ "DEMAND_GEN_PRODUCT_AD",
2946
+ "YOUTUBE_AUDIO_AD"
2947
+ ]),
2948
+ status: z__namespace.enum([
2949
+ "UNSPECIFIED",
2950
+ "UNKNOWN",
2951
+ "ENABLED",
2952
+ "PAUSED",
2953
+ "REMOVED"
2954
+ ]),
2955
+ ad_group: z__namespace.string().nullable()
2956
+ }))
2957
+ });
2958
+ z__namespace.object({
2959
+ ad_group: z__namespace.string().min(1),
2960
+ final_urls: z__namespace.array(z__namespace.url()).min(1),
2961
+ headlines: z__namespace.array(z__namespace.object({
2962
+ text: z__namespace.string().min(1).max(30),
2963
+ pinned_field: z__namespace.enum([
2964
+ "HEADLINE_1",
2965
+ "HEADLINE_2",
2966
+ "HEADLINE_3"
2967
+ ]).optional()
2968
+ })).min(3).max(15),
2969
+ descriptions: z__namespace.array(z__namespace.object({
2970
+ text: z__namespace.string().min(1).max(90)
2971
+ })).min(2).max(4),
2972
+ path1: z__namespace.string().max(15).optional(),
2973
+ path2: z__namespace.string().max(15).optional(),
2974
+ status: z__namespace.enum(["ENABLED", "PAUSED"]).optional().default("PAUSED"),
2975
+ dry_run: z__namespace.boolean().optional().default(false)
2976
+ });
2977
+ z__namespace.object({
2978
+ connection_id: z__namespace.string()
2979
+ });
2980
+ z__namespace.object({
2981
+ id: z__namespace.string().nullable(),
2982
+ resource_name: z__namespace.string().nullable(),
2983
+ dry_run: z__namespace.boolean(),
2984
+ executed: z__namespace.boolean()
2985
+ });
2986
+ z__namespace.object({
2987
+ dry_run: z__namespace.boolean().optional().default(false)
2988
+ });
2989
+ z__namespace.object({
2990
+ connection_id: z__namespace.string(),
2991
+ id: z__namespace.string().regex(/^\d+$/)
2992
+ });
2993
+ z__namespace.object({
2994
+ id: z__namespace.string(),
2995
+ removed: z__namespace.boolean(),
2996
+ dry_run: z__namespace.boolean(),
2997
+ executed: z__namespace.boolean()
2998
+ });
2999
+ z__namespace.object({
3000
+ connection_id: z__namespace.string(),
3001
+ id: z__namespace.string().regex(/^\d+$/)
3002
+ });
3003
+ z__namespace.object({
3004
+ id: z__namespace.string(),
3005
+ name: z__namespace.string().nullable(),
3006
+ type: z__namespace.enum([
3007
+ "UNSPECIFIED",
3008
+ "UNKNOWN",
3009
+ "TEXT_AD",
3010
+ "EXPANDED_TEXT_AD",
3011
+ "EXPANDED_DYNAMIC_SEARCH_AD",
3012
+ "HOTEL_AD",
3013
+ "SHOPPING_SMART_AD",
3014
+ "SHOPPING_PRODUCT_AD",
3015
+ "VIDEO_AD",
3016
+ "IMAGE_AD",
3017
+ "RESPONSIVE_SEARCH_AD",
3018
+ "LEGACY_RESPONSIVE_DISPLAY_AD",
3019
+ "APP_AD",
3020
+ "LEGACY_APP_INSTALL_AD",
3021
+ "RESPONSIVE_DISPLAY_AD",
3022
+ "LOCAL_AD",
3023
+ "HTML5_UPLOAD_AD",
3024
+ "DYNAMIC_HTML5_AD",
3025
+ "APP_ENGAGEMENT_AD",
3026
+ "SHOPPING_COMPARISON_LISTING_AD",
3027
+ "VIDEO_BUMPER_AD",
3028
+ "VIDEO_NON_SKIPPABLE_IN_STREAM_AD",
3029
+ "VIDEO_TRUEVIEW_IN_STREAM_AD",
3030
+ "VIDEO_RESPONSIVE_AD",
3031
+ "SMART_CAMPAIGN_AD",
3032
+ "CALL_AD",
3033
+ "APP_PRE_REGISTRATION_AD",
3034
+ "IN_FEED_VIDEO_AD",
3035
+ "DEMAND_GEN_MULTI_ASSET_AD",
3036
+ "DEMAND_GEN_CAROUSEL_AD",
3037
+ "TRAVEL_AD",
3038
+ "DEMAND_GEN_VIDEO_RESPONSIVE_AD",
3039
+ "DEMAND_GEN_PRODUCT_AD",
3040
+ "YOUTUBE_AUDIO_AD"
3041
+ ]),
3042
+ status: z__namespace.enum([
3043
+ "UNSPECIFIED",
3044
+ "UNKNOWN",
3045
+ "ENABLED",
3046
+ "PAUSED",
3047
+ "REMOVED"
3048
+ ]),
3049
+ ad_group: z__namespace.string().nullable()
3050
+ });
3051
+ z__namespace.object({
3052
+ ad_group: z__namespace.string().min(1),
3053
+ final_urls: z__namespace.array(z__namespace.url()).min(1),
3054
+ marketing_images: z__namespace.array(z__namespace.object({
3055
+ asset: z__namespace.string().min(1)
3056
+ })).max(15).optional().default([]),
3057
+ square_marketing_images: z__namespace.array(z__namespace.object({
3058
+ asset: z__namespace.string().min(1)
3059
+ })).max(15).optional().default([]),
3060
+ logo_images: z__namespace.array(z__namespace.object({
3061
+ asset: z__namespace.string().min(1)
3062
+ })).max(5).optional().default([]),
3063
+ square_logo_images: z__namespace.array(z__namespace.object({
3064
+ asset: z__namespace.string().min(1)
3065
+ })).max(5).optional().default([]),
3066
+ headlines: z__namespace.array(z__namespace.object({
3067
+ text: z__namespace.string().min(1).max(30)
3068
+ })).min(1).max(5),
3069
+ long_headline: z__namespace.object({
3070
+ text: z__namespace.string().min(1).max(90)
3071
+ }),
3072
+ descriptions: z__namespace.array(z__namespace.object({
3073
+ text: z__namespace.string().min(1).max(90)
3074
+ })).min(1).max(5),
3075
+ business_name: z__namespace.string().min(1).max(25).optional(),
3076
+ call_to_action_text: z__namespace.string().min(1).optional(),
3077
+ main_color: z__namespace.string().min(1).optional(),
3078
+ accent_color: z__namespace.string().min(1).optional(),
3079
+ status: z__namespace.enum(["ENABLED", "PAUSED"]).optional().default("PAUSED"),
3080
+ dry_run: z__namespace.boolean().optional().default(false)
3081
+ });
3082
+ z__namespace.object({
3083
+ connection_id: z__namespace.string()
3084
+ });
3085
+ z__namespace.object({
3086
+ id: z__namespace.string().nullable(),
3087
+ resource_name: z__namespace.string().nullable(),
3088
+ dry_run: z__namespace.boolean(),
3089
+ executed: z__namespace.boolean()
3090
+ });
3091
+ z__namespace.object({
3092
+ dry_run: z__namespace.boolean().optional().default(false)
3093
+ });
3094
+ z__namespace.object({
3095
+ connection_id: z__namespace.string(),
3096
+ id: z__namespace.string().regex(/^\d+$/)
3097
+ });
3098
+ z__namespace.object({
3099
+ id: z__namespace.string(),
3100
+ status: z__namespace.enum(["ENABLED", "PAUSED"]),
3101
+ dry_run: z__namespace.boolean(),
3102
+ executed: z__namespace.boolean()
3103
+ });
3104
+ z__namespace.object({
3105
+ dry_run: z__namespace.boolean().optional().default(false)
3106
+ });
3107
+ z__namespace.object({
3108
+ connection_id: z__namespace.string(),
3109
+ id: z__namespace.string().regex(/^\d+$/)
3110
+ });
3111
+ z__namespace.object({
3112
+ id: z__namespace.string(),
3113
+ status: z__namespace.enum(["ENABLED", "PAUSED"]),
3114
+ dry_run: z__namespace.boolean(),
3115
+ executed: z__namespace.boolean()
3116
+ });
3117
+ z__namespace.object({
3118
+ connection_id: z__namespace.string()
3119
+ });
3120
+ z__namespace.object({
3121
+ object: z__namespace.literal("list"),
3122
+ data: z__namespace.array(z__namespace.object({
3123
+ id: z__namespace.string(),
3124
+ text: z__namespace.string().nullable(),
3125
+ match_type: z__namespace.enum([
3126
+ "UNSPECIFIED",
3127
+ "UNKNOWN",
3128
+ "EXACT",
3129
+ "PHRASE",
3130
+ "BROAD"
3131
+ ]),
3132
+ status: z__namespace.enum([
3133
+ "UNSPECIFIED",
3134
+ "UNKNOWN",
3135
+ "ENABLED",
3136
+ "PAUSED",
3137
+ "REMOVED"
3138
+ ]),
3139
+ negative: z__namespace.boolean(),
3140
+ ad_group: z__namespace.string().nullable()
3141
+ }))
3142
+ });
3143
+ z__namespace.object({
3144
+ ad_group: z__namespace.string().min(1),
3145
+ text: z__namespace.string().min(1).max(80),
3146
+ match_type: z__namespace.enum([
3147
+ "EXACT",
3148
+ "PHRASE",
3149
+ "BROAD"
3150
+ ]),
3151
+ negative: z__namespace.boolean().optional().default(false),
3152
+ status: z__namespace.enum(["ENABLED", "PAUSED"]).optional().default("ENABLED"),
3153
+ dry_run: z__namespace.boolean().optional().default(false)
3154
+ });
3155
+ z__namespace.object({
3156
+ connection_id: z__namespace.string()
3157
+ });
3158
+ z__namespace.object({
3159
+ id: z__namespace.string().nullable(),
3160
+ resource_name: z__namespace.string().nullable(),
3161
+ dry_run: z__namespace.boolean(),
3162
+ executed: z__namespace.boolean()
3163
+ });
3164
+ z__namespace.object({
3165
+ dry_run: z__namespace.boolean().optional().default(false)
3166
+ });
3167
+ z__namespace.object({
3168
+ connection_id: z__namespace.string(),
3169
+ id: z__namespace.string().regex(/^\d+$/)
3170
+ });
3171
+ z__namespace.object({
3172
+ id: z__namespace.string(),
3173
+ removed: z__namespace.boolean(),
3174
+ dry_run: z__namespace.boolean(),
3175
+ executed: z__namespace.boolean()
3176
+ });
3177
+ z__namespace.object({
3178
+ connection_id: z__namespace.string(),
3179
+ id: z__namespace.string().regex(/^\d+$/)
3180
+ });
3181
+ z__namespace.object({
3182
+ id: z__namespace.string(),
3183
+ text: z__namespace.string().nullable(),
3184
+ match_type: z__namespace.enum([
3185
+ "UNSPECIFIED",
3186
+ "UNKNOWN",
3187
+ "EXACT",
3188
+ "PHRASE",
3189
+ "BROAD"
3190
+ ]),
3191
+ status: z__namespace.enum([
3192
+ "UNSPECIFIED",
3193
+ "UNKNOWN",
3194
+ "ENABLED",
3195
+ "PAUSED",
3196
+ "REMOVED"
3197
+ ]),
3198
+ negative: z__namespace.boolean(),
3199
+ ad_group: z__namespace.string().nullable()
3200
+ });
3201
+ z__namespace.object({
3202
+ cpc_bid_micros: z__namespace.int().gt(0).lte(9007199254740991),
3203
+ dry_run: z__namespace.boolean().optional().default(false)
3204
+ });
3205
+ z__namespace.object({
3206
+ connection_id: z__namespace.string(),
3207
+ id: z__namespace.string().regex(/^\d+$/)
3208
+ });
3209
+ z__namespace.object({
3210
+ id: z__namespace.string(),
3211
+ resource_name: z__namespace.string(),
3212
+ dry_run: z__namespace.boolean(),
3213
+ executed: z__namespace.boolean()
3214
+ });
3215
+ z__namespace.object({
3216
+ dry_run: z__namespace.boolean().optional().default(false)
3217
+ });
3218
+ z__namespace.object({
3219
+ connection_id: z__namespace.string(),
3220
+ id: z__namespace.string().regex(/^\d+$/)
3221
+ });
3222
+ z__namespace.object({
3223
+ id: z__namespace.string(),
3224
+ status: z__namespace.enum(["ENABLED", "PAUSED"]),
3225
+ dry_run: z__namespace.boolean(),
3226
+ executed: z__namespace.boolean()
3227
+ });
3228
+ z__namespace.object({
3229
+ dry_run: z__namespace.boolean().optional().default(false)
3230
+ });
3231
+ z__namespace.object({
3232
+ connection_id: z__namespace.string(),
3233
+ id: z__namespace.string().regex(/^\d+$/)
3234
+ });
3235
+ z__namespace.object({
3236
+ id: z__namespace.string(),
3237
+ status: z__namespace.enum(["ENABLED", "PAUSED"]),
3238
+ dry_run: z__namespace.boolean(),
3239
+ executed: z__namespace.boolean()
3240
+ });
3241
+ z__namespace.object({
3242
+ connection_id: z__namespace.string()
3243
+ });
3244
+ z__namespace.object({
3245
+ object: z__namespace.literal("list"),
3246
+ data: z__namespace.array(z__namespace.object({
3247
+ id: z__namespace.string(),
3248
+ name: z__namespace.string().nullable(),
3249
+ status: z__namespace.enum([
3250
+ "UNSPECIFIED",
3251
+ "UNKNOWN",
3252
+ "ENABLED",
3253
+ "REMOVED",
3254
+ "HIDDEN"
3255
+ ]),
3256
+ type: z__namespace.enum([
3257
+ "UNSPECIFIED",
3258
+ "UNKNOWN",
3259
+ "AD_CALL",
3260
+ "CLICK_TO_CALL",
3261
+ "GOOGLE_PLAY_DOWNLOAD",
3262
+ "GOOGLE_PLAY_IN_APP_PURCHASE",
3263
+ "UPLOAD_CALLS",
3264
+ "UPLOAD_CLICKS",
3265
+ "WEBPAGE",
3266
+ "WEBSITE_CALL",
3267
+ "STORE_SALES_DIRECT_UPLOAD",
3268
+ "STORE_SALES",
3269
+ "FIREBASE_ANDROID_FIRST_OPEN",
3270
+ "FIREBASE_ANDROID_IN_APP_PURCHASE",
3271
+ "FIREBASE_ANDROID_CUSTOM",
3272
+ "FIREBASE_IOS_FIRST_OPEN",
3273
+ "FIREBASE_IOS_IN_APP_PURCHASE",
3274
+ "FIREBASE_IOS_CUSTOM",
3275
+ "THIRD_PARTY_APP_ANALYTICS_ANDROID_FIRST_OPEN",
3276
+ "THIRD_PARTY_APP_ANALYTICS_ANDROID_IN_APP_PURCHASE",
3277
+ "THIRD_PARTY_APP_ANALYTICS_ANDROID_CUSTOM",
3278
+ "THIRD_PARTY_APP_ANALYTICS_IOS_FIRST_OPEN",
3279
+ "THIRD_PARTY_APP_ANALYTICS_IOS_IN_APP_PURCHASE",
3280
+ "THIRD_PARTY_APP_ANALYTICS_IOS_CUSTOM",
3281
+ "ANDROID_APP_PRE_REGISTRATION",
3282
+ "ANDROID_INSTALLS_ALL_OTHER_APPS",
3283
+ "FLOODLIGHT_ACTION",
3284
+ "FLOODLIGHT_TRANSACTION",
3285
+ "GOOGLE_HOSTED",
3286
+ "LEAD_FORM_SUBMIT",
3287
+ "SALESFORCE",
3288
+ "SEARCH_ADS_360",
3289
+ "SMART_CAMPAIGN_AD_CLICKS_TO_CALL",
3290
+ "SMART_CAMPAIGN_MAP_CLICKS_TO_CALL",
3291
+ "SMART_CAMPAIGN_MAP_DIRECTIONS",
3292
+ "SMART_CAMPAIGN_TRACKED_CALLS",
3293
+ "STORE_VISITS",
3294
+ "WEBPAGE_CODELESS",
3295
+ "UNIVERSAL_ANALYTICS_GOAL",
3296
+ "UNIVERSAL_ANALYTICS_TRANSACTION",
3297
+ "GOOGLE_ANALYTICS_4_CUSTOM",
3298
+ "GOOGLE_ANALYTICS_4_PURCHASE"
3299
+ ]),
3300
+ category: z__namespace.enum([
3301
+ "UNSPECIFIED",
3302
+ "UNKNOWN",
3303
+ "DEFAULT",
3304
+ "PAGE_VIEW",
3305
+ "PURCHASE",
3306
+ "SIGNUP",
3307
+ "DOWNLOAD",
3308
+ "ADD_TO_CART",
3309
+ "BEGIN_CHECKOUT",
3310
+ "SUBSCRIBE_PAID",
3311
+ "PHONE_CALL_LEAD",
3312
+ "IMPORTED_LEAD",
3313
+ "SUBMIT_LEAD_FORM",
3314
+ "BOOK_APPOINTMENT",
3315
+ "REQUEST_QUOTE",
3316
+ "GET_DIRECTIONS",
3317
+ "OUTBOUND_CLICK",
3318
+ "CONTACT",
3319
+ "ENGAGEMENT",
3320
+ "STORE_VISIT",
3321
+ "STORE_SALE",
3322
+ "QUALIFIED_LEAD",
3323
+ "CONVERTED_LEAD"
3324
+ ]),
3325
+ origin: z__namespace.enum([
3326
+ "UNSPECIFIED",
3327
+ "UNKNOWN",
3328
+ "WEBSITE",
3329
+ "GOOGLE_HOSTED",
3330
+ "APP",
3331
+ "CALL_FROM_ADS",
3332
+ "STORE",
3333
+ "YOUTUBE_HOSTED"
3334
+ ]),
3335
+ primary_for_goal: z__namespace.boolean(),
3336
+ counting_type: z__namespace.enum([
3337
+ "UNSPECIFIED",
3338
+ "UNKNOWN",
3339
+ "ONE_PER_CLICK",
3340
+ "MANY_PER_CLICK"
3341
+ ]),
3342
+ value_settings: z__namespace.object({
3343
+ default_value: z__namespace.number().nullable(),
3344
+ default_currency_code: z__namespace.string().nullable(),
3345
+ always_use_default_value: z__namespace.boolean().nullable()
3346
+ }).nullable(),
3347
+ tag_snippets: z__namespace.array(z__namespace.object({
3348
+ type: z__namespace.enum([
3349
+ "UNSPECIFIED",
3350
+ "UNKNOWN",
3351
+ "WEBPAGE",
3352
+ "WEBPAGE_ONCLICK",
3353
+ "CLICK_TO_CALL",
3354
+ "WEBSITE_CALL"
3355
+ ]),
3356
+ page_format: z__namespace.enum([
3357
+ "UNSPECIFIED",
3358
+ "UNKNOWN",
3359
+ "HTML",
3360
+ "AMP"
3361
+ ]),
3362
+ global_site_tag: z__namespace.string().nullable(),
3363
+ event_snippet: z__namespace.string().nullable()
3364
+ }))
3365
+ }))
3366
+ });
3367
+ z__namespace.object({
3368
+ name: z__namespace.string().min(1).max(255),
3369
+ type: z__namespace.enum(["WEBPAGE", "UPLOAD_CLICKS"]),
3370
+ category: z__namespace.enum([
3371
+ "DEFAULT",
3372
+ "PAGE_VIEW",
3373
+ "PURCHASE",
3374
+ "SIGNUP",
3375
+ "DOWNLOAD",
3376
+ "ADD_TO_CART",
3377
+ "BEGIN_CHECKOUT",
3378
+ "SUBSCRIBE_PAID",
3379
+ "PHONE_CALL_LEAD",
3380
+ "IMPORTED_LEAD",
3381
+ "SUBMIT_LEAD_FORM",
3382
+ "BOOK_APPOINTMENT",
3383
+ "REQUEST_QUOTE",
3384
+ "GET_DIRECTIONS",
3385
+ "OUTBOUND_CLICK",
3386
+ "CONTACT",
3387
+ "ENGAGEMENT",
3388
+ "STORE_VISIT",
3389
+ "STORE_SALE",
3390
+ "QUALIFIED_LEAD",
3391
+ "CONVERTED_LEAD"
3392
+ ]),
3393
+ status: z__namespace.enum(["ENABLED"]).optional().default("ENABLED"),
3394
+ value_settings: z__namespace.object({
3395
+ default_value: z__namespace.number().gte(0).optional(),
3396
+ default_currency_code: z__namespace.string().length(3).optional(),
3397
+ always_use_default_value: z__namespace.boolean().optional()
3398
+ }).optional(),
3399
+ counting_type: z__namespace.enum(["ONE_PER_CLICK", "MANY_PER_CLICK"]).optional(),
3400
+ click_through_lookback_window_days: z__namespace.int().gt(0).lte(9007199254740991).optional(),
3401
+ view_through_lookback_window_days: z__namespace.int().gt(0).lte(9007199254740991).optional(),
3402
+ dry_run: z__namespace.boolean().optional().default(false)
3403
+ });
3404
+ z__namespace.object({
3405
+ connection_id: z__namespace.string()
3406
+ });
3407
+ z__namespace.object({
3408
+ id: z__namespace.string().nullable(),
3409
+ resource_name: z__namespace.string().nullable(),
3410
+ dry_run: z__namespace.boolean(),
3411
+ executed: z__namespace.boolean()
3412
+ });
3413
+ z__namespace.object({
3414
+ connection_id: z__namespace.string(),
3415
+ id: z__namespace.string().regex(/^\d+$/)
3416
+ });
3417
+ z__namespace.object({
3418
+ id: z__namespace.string(),
3419
+ name: z__namespace.string().nullable(),
3420
+ status: z__namespace.enum([
3421
+ "UNSPECIFIED",
3422
+ "UNKNOWN",
3423
+ "ENABLED",
3424
+ "REMOVED",
3425
+ "HIDDEN"
3426
+ ]),
3427
+ type: z__namespace.enum([
3428
+ "UNSPECIFIED",
3429
+ "UNKNOWN",
3430
+ "AD_CALL",
3431
+ "CLICK_TO_CALL",
3432
+ "GOOGLE_PLAY_DOWNLOAD",
3433
+ "GOOGLE_PLAY_IN_APP_PURCHASE",
3434
+ "UPLOAD_CALLS",
3435
+ "UPLOAD_CLICKS",
3436
+ "WEBPAGE",
3437
+ "WEBSITE_CALL",
3438
+ "STORE_SALES_DIRECT_UPLOAD",
3439
+ "STORE_SALES",
3440
+ "FIREBASE_ANDROID_FIRST_OPEN",
3441
+ "FIREBASE_ANDROID_IN_APP_PURCHASE",
3442
+ "FIREBASE_ANDROID_CUSTOM",
3443
+ "FIREBASE_IOS_FIRST_OPEN",
3444
+ "FIREBASE_IOS_IN_APP_PURCHASE",
3445
+ "FIREBASE_IOS_CUSTOM",
3446
+ "THIRD_PARTY_APP_ANALYTICS_ANDROID_FIRST_OPEN",
3447
+ "THIRD_PARTY_APP_ANALYTICS_ANDROID_IN_APP_PURCHASE",
3448
+ "THIRD_PARTY_APP_ANALYTICS_ANDROID_CUSTOM",
3449
+ "THIRD_PARTY_APP_ANALYTICS_IOS_FIRST_OPEN",
3450
+ "THIRD_PARTY_APP_ANALYTICS_IOS_IN_APP_PURCHASE",
3451
+ "THIRD_PARTY_APP_ANALYTICS_IOS_CUSTOM",
3452
+ "ANDROID_APP_PRE_REGISTRATION",
3453
+ "ANDROID_INSTALLS_ALL_OTHER_APPS",
3454
+ "FLOODLIGHT_ACTION",
3455
+ "FLOODLIGHT_TRANSACTION",
3456
+ "GOOGLE_HOSTED",
3457
+ "LEAD_FORM_SUBMIT",
3458
+ "SALESFORCE",
3459
+ "SEARCH_ADS_360",
3460
+ "SMART_CAMPAIGN_AD_CLICKS_TO_CALL",
3461
+ "SMART_CAMPAIGN_MAP_CLICKS_TO_CALL",
3462
+ "SMART_CAMPAIGN_MAP_DIRECTIONS",
3463
+ "SMART_CAMPAIGN_TRACKED_CALLS",
3464
+ "STORE_VISITS",
3465
+ "WEBPAGE_CODELESS",
3466
+ "UNIVERSAL_ANALYTICS_GOAL",
3467
+ "UNIVERSAL_ANALYTICS_TRANSACTION",
3468
+ "GOOGLE_ANALYTICS_4_CUSTOM",
3469
+ "GOOGLE_ANALYTICS_4_PURCHASE"
3470
+ ]),
3471
+ category: z__namespace.enum([
3472
+ "UNSPECIFIED",
3473
+ "UNKNOWN",
3474
+ "DEFAULT",
3475
+ "PAGE_VIEW",
3476
+ "PURCHASE",
3477
+ "SIGNUP",
3478
+ "DOWNLOAD",
3479
+ "ADD_TO_CART",
3480
+ "BEGIN_CHECKOUT",
3481
+ "SUBSCRIBE_PAID",
3482
+ "PHONE_CALL_LEAD",
3483
+ "IMPORTED_LEAD",
3484
+ "SUBMIT_LEAD_FORM",
3485
+ "BOOK_APPOINTMENT",
3486
+ "REQUEST_QUOTE",
3487
+ "GET_DIRECTIONS",
3488
+ "OUTBOUND_CLICK",
3489
+ "CONTACT",
3490
+ "ENGAGEMENT",
3491
+ "STORE_VISIT",
3492
+ "STORE_SALE",
3493
+ "QUALIFIED_LEAD",
3494
+ "CONVERTED_LEAD"
3495
+ ]),
3496
+ origin: z__namespace.enum([
3497
+ "UNSPECIFIED",
3498
+ "UNKNOWN",
3499
+ "WEBSITE",
3500
+ "GOOGLE_HOSTED",
3501
+ "APP",
3502
+ "CALL_FROM_ADS",
3503
+ "STORE",
3504
+ "YOUTUBE_HOSTED"
3505
+ ]),
3506
+ primary_for_goal: z__namespace.boolean(),
3507
+ counting_type: z__namespace.enum([
3508
+ "UNSPECIFIED",
3509
+ "UNKNOWN",
3510
+ "ONE_PER_CLICK",
3511
+ "MANY_PER_CLICK"
3512
+ ]),
3513
+ value_settings: z__namespace.object({
3514
+ default_value: z__namespace.number().nullable(),
3515
+ default_currency_code: z__namespace.string().nullable(),
3516
+ always_use_default_value: z__namespace.boolean().nullable()
3517
+ }).nullable(),
3518
+ tag_snippets: z__namespace.array(z__namespace.object({
3519
+ type: z__namespace.enum([
3520
+ "UNSPECIFIED",
3521
+ "UNKNOWN",
3522
+ "WEBPAGE",
3523
+ "WEBPAGE_ONCLICK",
3524
+ "CLICK_TO_CALL",
3525
+ "WEBSITE_CALL"
3526
+ ]),
3527
+ page_format: z__namespace.enum([
3528
+ "UNSPECIFIED",
3529
+ "UNKNOWN",
3530
+ "HTML",
3531
+ "AMP"
3532
+ ]),
3533
+ global_site_tag: z__namespace.string().nullable(),
3534
+ event_snippet: z__namespace.string().nullable()
3535
+ }))
3536
+ });
3537
+ z__namespace.object({
3538
+ connection_id: z__namespace.string()
3539
+ });
3540
+ z__namespace.object({
3541
+ object: z__namespace.literal("list"),
3542
+ data: z__namespace.array(z__namespace.object({
3543
+ category: z__namespace.enum([
3544
+ "UNSPECIFIED",
3545
+ "UNKNOWN",
3546
+ "DEFAULT",
3547
+ "PAGE_VIEW",
3548
+ "PURCHASE",
3549
+ "SIGNUP",
3550
+ "DOWNLOAD",
3551
+ "ADD_TO_CART",
3552
+ "BEGIN_CHECKOUT",
3553
+ "SUBSCRIBE_PAID",
3554
+ "PHONE_CALL_LEAD",
3555
+ "IMPORTED_LEAD",
3556
+ "SUBMIT_LEAD_FORM",
3557
+ "BOOK_APPOINTMENT",
3558
+ "REQUEST_QUOTE",
3559
+ "GET_DIRECTIONS",
3560
+ "OUTBOUND_CLICK",
3561
+ "CONTACT",
3562
+ "ENGAGEMENT",
3563
+ "STORE_VISIT",
3564
+ "STORE_SALE",
3565
+ "QUALIFIED_LEAD",
3566
+ "CONVERTED_LEAD"
3567
+ ]),
3568
+ origin: z__namespace.enum([
3569
+ "UNSPECIFIED",
3570
+ "UNKNOWN",
3571
+ "WEBSITE",
3572
+ "GOOGLE_HOSTED",
3573
+ "APP",
3574
+ "CALL_FROM_ADS",
3575
+ "STORE",
3576
+ "YOUTUBE_HOSTED"
3577
+ ]),
3578
+ biddable: z__namespace.boolean()
3579
+ }))
3580
+ });
3581
+ z__namespace.object({
3582
+ category: z__namespace.enum([
3583
+ "DEFAULT",
3584
+ "PAGE_VIEW",
3585
+ "PURCHASE",
3586
+ "SIGNUP",
3587
+ "DOWNLOAD",
3588
+ "ADD_TO_CART",
3589
+ "BEGIN_CHECKOUT",
3590
+ "SUBSCRIBE_PAID",
3591
+ "PHONE_CALL_LEAD",
3592
+ "IMPORTED_LEAD",
3593
+ "SUBMIT_LEAD_FORM",
3594
+ "BOOK_APPOINTMENT",
3595
+ "REQUEST_QUOTE",
3596
+ "GET_DIRECTIONS",
3597
+ "OUTBOUND_CLICK",
3598
+ "CONTACT",
3599
+ "ENGAGEMENT",
3600
+ "STORE_VISIT",
3601
+ "STORE_SALE",
3602
+ "QUALIFIED_LEAD",
3603
+ "CONVERTED_LEAD"
3604
+ ]),
3605
+ origin: z__namespace.enum([
3606
+ "WEBSITE",
3607
+ "GOOGLE_HOSTED",
3608
+ "APP",
3609
+ "CALL_FROM_ADS",
3610
+ "STORE",
3611
+ "YOUTUBE_HOSTED"
3612
+ ]),
3613
+ biddable: z__namespace.boolean(),
3614
+ dry_run: z__namespace.boolean().optional().default(false)
3615
+ });
3616
+ z__namespace.object({
3617
+ connection_id: z__namespace.string()
3618
+ });
3619
+ z__namespace.object({
3620
+ category: z__namespace.enum([
3621
+ "UNSPECIFIED",
3622
+ "UNKNOWN",
3623
+ "DEFAULT",
3624
+ "PAGE_VIEW",
3625
+ "PURCHASE",
3626
+ "SIGNUP",
3627
+ "DOWNLOAD",
3628
+ "ADD_TO_CART",
3629
+ "BEGIN_CHECKOUT",
3630
+ "SUBSCRIBE_PAID",
3631
+ "PHONE_CALL_LEAD",
3632
+ "IMPORTED_LEAD",
3633
+ "SUBMIT_LEAD_FORM",
3634
+ "BOOK_APPOINTMENT",
3635
+ "REQUEST_QUOTE",
3636
+ "GET_DIRECTIONS",
3637
+ "OUTBOUND_CLICK",
3638
+ "CONTACT",
3639
+ "ENGAGEMENT",
3640
+ "STORE_VISIT",
3641
+ "STORE_SALE",
3642
+ "QUALIFIED_LEAD",
3643
+ "CONVERTED_LEAD"
3644
+ ]),
3645
+ origin: z__namespace.enum([
3646
+ "UNSPECIFIED",
3647
+ "UNKNOWN",
3648
+ "WEBSITE",
3649
+ "GOOGLE_HOSTED",
3650
+ "APP",
3651
+ "CALL_FROM_ADS",
3652
+ "STORE",
3653
+ "YOUTUBE_HOSTED"
3654
+ ]),
3655
+ biddable: z__namespace.boolean(),
3656
+ dry_run: z__namespace.boolean(),
3657
+ executed: z__namespace.boolean()
3658
+ });
3659
+ z__namespace.object({
3660
+ conversions: z__namespace.array(z__namespace.object({
3661
+ conversion_action: z__namespace.string().min(1),
3662
+ conversion_date_time: z__namespace.string().regex(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}[+-]\d{2}:\d{2}$/),
3663
+ conversion_value: z__namespace.number().gte(0).optional(),
3664
+ currency_code: z__namespace.string().length(3).optional(),
3665
+ order_id: z__namespace.string().optional(),
3666
+ gclid: z__namespace.string().optional(),
3667
+ gbraid: z__namespace.string().optional(),
3668
+ wbraid: z__namespace.string().optional(),
3669
+ user_identifiers: z__namespace.array(z__namespace.object({
3670
+ hashed_email: z__namespace.string().regex(/^[a-f0-9]{64}$/).optional(),
3671
+ hashed_phone_number: z__namespace.string().regex(/^[a-f0-9]{64}$/).optional(),
3672
+ user_identifier_source: z__namespace.enum(["FIRST_PARTY", "THIRD_PARTY"]).optional()
3673
+ })).min(1).max(5).optional(),
3674
+ consent: z__namespace.object({
3675
+ ad_user_data: z__namespace.enum(["GRANTED", "DENIED"]).optional(),
3676
+ ad_personalization: z__namespace.enum(["GRANTED", "DENIED"]).optional()
3677
+ }).optional()
3678
+ })).min(1).max(2e3),
3679
+ dry_run: z__namespace.boolean().optional().default(false)
3680
+ });
3681
+ z__namespace.object({
3682
+ connection_id: z__namespace.string()
3683
+ });
3684
+ z__namespace.object({
3685
+ received: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
3686
+ succeeded: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
3687
+ failed: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
3688
+ errors: z__namespace.array(z__namespace.object({
3689
+ index: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
3690
+ error_code: z__namespace.string(),
3691
+ message: z__namespace.string()
3692
+ })),
3693
+ dry_run: z__namespace.boolean()
3694
+ });
3695
+ z__namespace.object({
3696
+ media_id: z__namespace.string(),
3697
+ dry_run: z__namespace.boolean().optional().default(false)
3698
+ });
3699
+ z__namespace.object({
3700
+ connection_id: z__namespace.string()
3701
+ });
3702
+ z__namespace.object({
3703
+ id: z__namespace.string().nullable(),
3704
+ resource_name: z__namespace.string().nullable(),
3705
+ dry_run: z__namespace.boolean(),
3706
+ executed: z__namespace.boolean()
3707
+ });
3708
+ z__namespace.object({
3709
+ limit: z__namespace.int().gte(1).lte(100).optional().default(20),
3710
+ offset: z__namespace.int().gte(0).lte(9007199254740991).optional().default(0),
3711
+ profile_id: z__namespace.string().optional(),
3712
+ connection_id: z__namespace.string().optional(),
3713
+ platform: z__namespace.enum([
3714
+ "meta_ads",
3715
+ "google_ads",
3716
+ "tiktok_ads",
3717
+ "x",
3718
+ "linkedin",
3719
+ "facebook_page",
3720
+ "instagram",
3721
+ "tiktok"
3722
+ ]).optional(),
3723
+ status: z__namespace.enum([
3724
+ "pending",
3725
+ "success",
3726
+ "error"
3727
+ ]).optional(),
3728
+ source: z__namespace.enum([
3729
+ "api",
3730
+ "dashboard",
3731
+ "mcp",
3732
+ "scheduler"
3733
+ ]).optional(),
3734
+ action: z__namespace.string().min(1).optional(),
3735
+ created_after: z__namespace.iso.datetime().optional(),
3736
+ created_before: z__namespace.iso.datetime().optional()
3737
+ });
3738
+ z__namespace.object({
3739
+ object: z__namespace.literal("list"),
3740
+ data: z__namespace.array(z__namespace.object({
3741
+ id: z__namespace.string(),
3742
+ source: z__namespace.enum([
3743
+ "api",
3744
+ "dashboard",
3745
+ "mcp",
3746
+ "scheduler"
3747
+ ]),
3748
+ action: z__namespace.string(),
3749
+ status: z__namespace.enum([
3750
+ "pending",
3751
+ "success",
3752
+ "error"
3753
+ ]),
3754
+ status_code: z__namespace.int().gte(-9007199254740991).lte(9007199254740991).nullable(),
3755
+ platform: z__namespace.enum([
3756
+ "meta_ads",
3757
+ "google_ads",
3758
+ "tiktok_ads",
3759
+ "x",
3760
+ "linkedin",
3761
+ "facebook_page",
3762
+ "instagram",
3763
+ "tiktok"
3764
+ ]).nullable(),
3765
+ request_method: z__namespace.string().nullable(),
3766
+ request_path: z__namespace.string().nullable(),
3767
+ request_body: z__namespace.unknown().nullish(),
3768
+ response_body: z__namespace.unknown().nullish(),
3769
+ error: z__namespace.unknown().nullish(),
3770
+ external_id: z__namespace.string().nullable(),
3771
+ idempotency_key: z__namespace.string().nullable(),
3772
+ request_id: z__namespace.string().nullable(),
3773
+ duration_ms: z__namespace.int().gte(-9007199254740991).lte(9007199254740991).nullable(),
3774
+ profile_id: z__namespace.string().nullable(),
3775
+ connection_id: z__namespace.string().nullable(),
3776
+ api_key_id: z__namespace.string().nullable(),
3777
+ created_at: z__namespace.string().nullable(),
3778
+ updated_at: z__namespace.string().nullable()
3779
+ })),
3780
+ total: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
3781
+ limit: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
3782
+ offset: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
3783
+ has_more: z__namespace.boolean()
3784
+ });
3785
+ z__namespace.object({
3786
+ id: z__namespace.string()
3787
+ });
3788
+ z__namespace.object({
3789
+ id: z__namespace.string(),
3790
+ source: z__namespace.enum([
3791
+ "api",
3792
+ "dashboard",
3793
+ "mcp",
3794
+ "scheduler"
3795
+ ]),
3796
+ action: z__namespace.string(),
3797
+ status: z__namespace.enum([
3798
+ "pending",
3799
+ "success",
3800
+ "error"
3801
+ ]),
3802
+ status_code: z__namespace.int().gte(-9007199254740991).lte(9007199254740991).nullable(),
3803
+ platform: z__namespace.enum([
3804
+ "meta_ads",
3805
+ "google_ads",
3806
+ "tiktok_ads",
3807
+ "x",
3808
+ "linkedin",
3809
+ "facebook_page",
3810
+ "instagram",
3811
+ "tiktok"
3812
+ ]).nullable(),
3813
+ request_method: z__namespace.string().nullable(),
3814
+ request_path: z__namespace.string().nullable(),
3815
+ request_body: z__namespace.unknown().nullish(),
3816
+ response_body: z__namespace.unknown().nullish(),
3817
+ error: z__namespace.unknown().nullish(),
3818
+ external_id: z__namespace.string().nullable(),
3819
+ idempotency_key: z__namespace.string().nullable(),
3820
+ request_id: z__namespace.string().nullable(),
3821
+ duration_ms: z__namespace.int().gte(-9007199254740991).lte(9007199254740991).nullable(),
3822
+ profile_id: z__namespace.string().nullable(),
3823
+ connection_id: z__namespace.string().nullable(),
3824
+ api_key_id: z__namespace.string().nullable(),
3825
+ created_at: z__namespace.string().nullable(),
3826
+ updated_at: z__namespace.string().nullable()
3827
+ });
3828
+ z__namespace.object({
3829
+ limit: z__namespace.int().gte(1).lte(100).optional().default(20),
3830
+ offset: z__namespace.int().gte(0).lte(9007199254740991).optional().default(0)
3831
+ });
3832
+ z__namespace.object({
3833
+ object: z__namespace.literal("list"),
3834
+ data: z__namespace.array(z__namespace.object({
3835
+ id: z__namespace.string(),
3836
+ url: z__namespace.string(),
3837
+ description: z__namespace.string(),
3838
+ event_types: z__namespace.array(z__namespace.string()),
3839
+ disabled: z__namespace.boolean(),
3840
+ created_at: z__namespace.string(),
3841
+ updated_at: z__namespace.string()
3842
+ })),
3843
+ total: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
3844
+ limit: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
3845
+ offset: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
3846
+ has_more: z__namespace.boolean()
3847
+ });
3848
+ z__namespace.object({
3849
+ url: z__namespace.url(),
3850
+ description: z__namespace.string().max(255).optional(),
3851
+ event_types: z__namespace.array(z__namespace.enum([
3852
+ "webhook.ping",
3853
+ "post.published",
3854
+ "post.failed",
3855
+ "post.completed"
3856
+ ]))
3857
+ });
3858
+ z__namespace.object({
3859
+ id: z__namespace.string(),
3860
+ url: z__namespace.string(),
3861
+ description: z__namespace.string(),
3862
+ event_types: z__namespace.array(z__namespace.string()),
3863
+ disabled: z__namespace.boolean(),
3864
+ created_at: z__namespace.string(),
3865
+ updated_at: z__namespace.string()
3866
+ });
3867
+ z__namespace.object({
3868
+ id: z__namespace.string()
3869
+ });
3870
+ z__namespace.object({
3871
+ id: z__namespace.string(),
3872
+ object: z__namespace.literal("webhook_endpoint"),
3873
+ deleted: z__namespace.literal(true)
3874
+ });
3875
+ z__namespace.object({
3876
+ id: z__namespace.string()
3877
+ });
3878
+ z__namespace.object({
3879
+ id: z__namespace.string(),
3880
+ url: z__namespace.string(),
3881
+ description: z__namespace.string(),
3882
+ event_types: z__namespace.array(z__namespace.string()),
3883
+ disabled: z__namespace.boolean(),
3884
+ created_at: z__namespace.string(),
3885
+ updated_at: z__namespace.string()
3886
+ });
3887
+ z__namespace.object({
3888
+ url: z__namespace.url().optional(),
3889
+ description: z__namespace.string().max(255).optional(),
3890
+ disabled: z__namespace.boolean().optional(),
3891
+ event_types: z__namespace.array(z__namespace.enum([
3892
+ "webhook.ping",
3893
+ "post.published",
3894
+ "post.failed",
3895
+ "post.completed"
3896
+ ])).optional()
3897
+ });
3898
+ z__namespace.object({
3899
+ id: z__namespace.string()
3900
+ });
3901
+ z__namespace.object({
3902
+ id: z__namespace.string(),
3903
+ url: z__namespace.string(),
3904
+ description: z__namespace.string(),
3905
+ event_types: z__namespace.array(z__namespace.string()),
3906
+ disabled: z__namespace.boolean(),
3907
+ created_at: z__namespace.string(),
3908
+ updated_at: z__namespace.string()
3909
+ });
3910
+ z__namespace.object({
3911
+ url: z__namespace.string()
3912
+ });
3913
+ z__namespace.array(z__namespace.object({
3914
+ name: z__namespace.string(),
3915
+ group: z__namespace.string(),
3916
+ description: z__namespace.string()
3917
+ }));
3918
+ z__namespace.object({
3919
+ message: z__namespace.string().max(255).optional().default("Hello from Postrun")
3920
+ });
3921
+ z__namespace.object({
3922
+ id: z__namespace.string()
3923
+ });
3924
+ z__namespace.object({
3925
+ profile_scope: z__namespace.union([
3926
+ z__namespace.object({
3927
+ type: z__namespace.literal("ids"),
3928
+ values: z__namespace.array(z__namespace.string()).min(1).max(100)
3929
+ }),
3930
+ z__namespace.object({
3931
+ type: z__namespace.literal("external_id"),
3932
+ values: z__namespace.array(z__namespace.string().min(1).max(255)).min(1).max(50)
3933
+ }),
3934
+ z__namespace.object({
3935
+ type: z__namespace.literal("all")
3936
+ })
3937
+ ]),
3938
+ scopes: z__namespace.array(z__namespace.enum([
3939
+ "profiles:read",
3940
+ "profiles:write",
3941
+ "connections:read",
3942
+ "connections:write",
3943
+ "ads:read",
3944
+ "ads:write",
3945
+ "posts:read",
3946
+ "posts:write",
3947
+ "media:read",
3948
+ "media:write"
3949
+ ])).min(1),
3950
+ ttl_seconds: z__namespace.int().gte(60).lte(1800).optional().default(900)
3951
+ });
3952
+ z__namespace.object({
3953
+ token: z__namespace.string(),
3954
+ expires_at: z__namespace.string()
3955
+ });
3956
+
3957
+ // src/errors.ts
3958
+ var ProblemSchema = z__namespace.object({
3959
+ type: z__namespace.string().optional(),
3960
+ title: z__namespace.string().optional(),
3961
+ status: z__namespace.number().optional(),
3962
+ code: z__namespace.string().optional(),
3963
+ detail: z__namespace.string().optional(),
3964
+ // RFC 9457 calls the occurrence id `instance`; our bodies emit it as
3965
+ // `request_id`. Tolerate both, preferring `request_id`.
3966
+ request_id: z__namespace.string().optional(),
3967
+ instance: z__namespace.string().optional(),
3968
+ errors: z__namespace.array(z__namespace.object({ field: z__namespace.string(), code: z__namespace.string(), detail: z__namespace.string() })).optional()
3969
+ });
3970
+ var PostrunError = class extends Error {
3971
+ status;
3972
+ /** The machine-readable code to branch on (closed union), if the body had one. */
3973
+ code;
3974
+ /** The request id for support/debugging (our `request_id`, or RFC `instance`). */
3975
+ request_id;
3976
+ /** Per-field validation problems on a 422, surfaced for convenience. */
3977
+ fieldErrors;
3978
+ problem;
3979
+ constructor(status, rawProblem) {
3980
+ const problem = ProblemSchema.safeParse(rawProblem).data;
3981
+ super(problem?.detail ?? problem?.title ?? `Postrun API error (${status})`);
3982
+ this.name = "PostrunError";
3983
+ this.status = status;
3984
+ this.code = zErrorCode.safeParse(problem?.code).data;
3985
+ this.request_id = problem?.request_id ?? problem?.instance;
3986
+ this.fieldErrors = problem?.errors ?? [];
3987
+ this.problem = problem;
3988
+ }
3989
+ };
3990
+
3991
+ // src/client.ts
3992
+ var DEFAULT_BASE_URL = "https://api.postrun.ai/v1";
3993
+ function appendScalar(parts, key, value) {
3994
+ parts.push(
3995
+ `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`
3996
+ );
3997
+ }
3998
+ function serializeQuery(query) {
3999
+ const parts = [];
4000
+ for (const [key, value] of Object.entries(query)) {
4001
+ if (value === void 0 || value === null) {
4002
+ continue;
4003
+ }
4004
+ if (Array.isArray(value)) {
4005
+ for (const item of value) {
4006
+ if (item !== void 0 && item !== null) {
4007
+ appendScalar(parts, key, item);
4008
+ }
4009
+ }
4010
+ } else if (typeof value === "object") {
4011
+ appendScalar(parts, key, JSON.stringify(value));
4012
+ } else {
4013
+ appendScalar(parts, key, value);
4014
+ }
4015
+ }
4016
+ return parts.join("&");
4017
+ }
4018
+ function createPostrunClient(options) {
4019
+ const client2 = createClient(
4020
+ createConfig({
4021
+ baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,
4022
+ auth: () => options.getToken(),
4023
+ querySerializer: serializeQuery,
4024
+ throwOnError: true
4025
+ })
4026
+ );
4027
+ client2.interceptors.error.use(
4028
+ (error, response) => error instanceof PostrunError ? error : new PostrunError(response?.status ?? 0, error)
4029
+ );
4030
+ return client2;
4031
+ }
4032
+
4033
+ // src/client/client.gen.ts
4034
+ var client = createClient(createConfig({ baseUrl: "https://api.postrun.ai/v1", throwOnError: true }));
4035
+
4036
+ // src/client/sdk.gen.ts
4037
+ var tokensMint = (options) => (options.client ?? client).post({
4038
+ security: [{
4039
+ key: "secretKey",
4040
+ scheme: "bearer",
4041
+ type: "http"
4042
+ }],
4043
+ url: "/tokens",
4044
+ ...options,
4045
+ headers: {
4046
+ "Content-Type": "application/json",
4047
+ ...options.headers
4048
+ }
4049
+ });
4050
+
4051
+ // src/server.ts
4052
+ function assertServerOnly() {
4053
+ if (typeof window !== "undefined" && typeof window.document !== "undefined") {
4054
+ throw new Error(
4055
+ "createPostrunServer must run only on a server \u2014 it holds your secret pr_ key. In the browser, use createPostrunClient with a minted scoped token instead."
4056
+ );
4057
+ }
4058
+ }
4059
+ function createPostrunServer(options) {
4060
+ assertServerOnly();
4061
+ if (!options.secretKey) {
4062
+ throw new Error("createPostrunServer requires a secret `pr_` key (secretKey).");
4063
+ }
4064
+ const client2 = createPostrunClient({
4065
+ baseUrl: options.baseUrl,
4066
+ getToken: () => options.secretKey
4067
+ });
4068
+ async function mint(input) {
4069
+ const { data } = await tokensMint({ client: client2, body: input });
4070
+ return data;
4071
+ }
4072
+ return { client: client2, tokens: { mint } };
4073
+ }
4074
+
4075
+ exports.createPostrunServer = createPostrunServer;
4076
+ //# sourceMappingURL=server.cjs.map
4077
+ //# sourceMappingURL=server.cjs.map