@adport/provider-snapchat 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AdProvider, StandardActions, Account, NormalizedQuery, Report, WriteOperation, WriteGuard, WritePreview, WriteResult, AnyToolDefinition, CredentialStore, ProviderModule } from '@adport/core';
1
+ import { MediaResolver, WriteOperation, WriteGuard, WritePreview, WriteResult, AdProvider, StandardActions, Account, NormalizedQuery, Report, AnyToolDefinition, CredentialStore, ProviderModule } from '@adport/core';
2
2
  import { z } from 'zod';
3
3
 
4
4
  declare const SNAPCHAT_API_BASE = "https://adsapi.snapchat.com/v1/";
@@ -25,18 +25,212 @@ declare class SnapchatAdsClient {
25
25
  private refreshing?;
26
26
  constructor(credentials: SnapchatCredentials, fetchImpl?: typeof fetch);
27
27
  collection<T>(path: string, plural: string, singular: string, schema: z.ZodType<T>, params?: Record<string, string>): Promise<T[]>;
28
- mutate<T>(path: string, method: 'POST' | 'PATCH', body: unknown, plural: string, singular: string, schema: z.ZodType<T>): Promise<T[]>;
28
+ mutate<T>(path: string, method: 'POST' | 'PATCH' | 'PUT', body: unknown, plural: string, singular: string, schema: z.ZodType<T>): Promise<T[]>;
29
+ mutation<T>(path: string, method: 'POST' | 'PATCH' | 'PUT' | 'DELETE', body: unknown, plural: string, singular: string, schema: z.ZodType<T>): Promise<{
30
+ items: T[];
31
+ warnings: string[];
32
+ }>;
33
+ page<T>(path: string, plural: string, singular: string, schema: z.ZodType<T>, params: Record<string, string>): Promise<{
34
+ warnings: string[];
35
+ next_cursor?: string | undefined;
36
+ items: T[];
37
+ truncated: boolean;
38
+ }>;
39
+ request<T>(path: string, method: 'GET' | 'POST' | 'DELETE', schema: z.ZodType<T>, body?: unknown): Promise<T>;
40
+ /** A read-only, account-bound Public Profile API call, never a caller-supplied URL. */
41
+ sharingPolicies(accountId: string, resourceType: 'public_profiles' | 'pixels' | 'mobile_apps' | 'catalogs'): Promise<{
42
+ sharing_policy_id: string;
43
+ source: {
44
+ resource_type: string;
45
+ resource_id: string;
46
+ };
47
+ }[]>;
48
+ /** Only INIT-provided paths for the exact media and action may carry authorization. */
49
+ uploadPart<T>(path: string, mediaId: string, action: 'ADD' | 'FINALIZE', form: FormData, schema: z.ZodType<T>): Promise<T>;
29
50
  private items;
51
+ private redact;
52
+ private errorDetails;
53
+ private warnings;
30
54
  private url;
31
55
  private send;
32
56
  private accessToken;
33
57
  private refresh;
34
58
  }
35
59
 
60
+ type Row = Record<string, unknown>;
61
+ type Entity = 'campaigns' | 'adsquads' | 'ads' | 'creatives' | 'media';
62
+ interface SnapchatPlan extends Omit<WritePreview, 'serverValidated'> {
63
+ execute: () => Promise<WriteResult>;
64
+ }
65
+ /** Snap-owned v1 docs reviewed 2026-11-03; no SDK defaults or full-object PUTs. */
66
+ declare class SnapchatCreativeService {
67
+ private readonly client;
68
+ private readonly media;
69
+ constructor(client: SnapchatAdsClient, media?: MediaResolver);
70
+ owned(account: string, entity: Entity, resourceId: string): Promise<Row>;
71
+ shared(account: string, type: 'public_profiles' | 'pixels' | 'mobile_apps'): Promise<{
72
+ items: {
73
+ sharing_policy_id: string;
74
+ source: {
75
+ resource_type: string;
76
+ resource_id: string;
77
+ };
78
+ }[];
79
+ truncated: boolean;
80
+ }>;
81
+ private available;
82
+ page(input: {
83
+ account_id: string;
84
+ limit: number;
85
+ cursor?: string;
86
+ campaign_id?: string;
87
+ ad_squad_id?: string;
88
+ }, entity: Entity): Promise<{
89
+ warnings: string[];
90
+ next_cursor?: string | undefined;
91
+ items: {
92
+ [x: string]: unknown;
93
+ id: string;
94
+ }[];
95
+ truncated: boolean;
96
+ }>;
97
+ targetingOptions(input: {
98
+ account_id: string;
99
+ dimension: string;
100
+ country_code?: string;
101
+ is_hec?: boolean;
102
+ os_type?: string;
103
+ limit: number;
104
+ cursor?: string;
105
+ }): Promise<{
106
+ next_cursor?: string | undefined;
107
+ items: {
108
+ [x: string]: unknown;
109
+ sub_request_status: string;
110
+ }[];
111
+ truncated: boolean;
112
+ }>;
113
+ gallery(input: {
114
+ account_id: string;
115
+ limit: number;
116
+ cursor?: string;
117
+ }): Promise<{
118
+ creatives: {
119
+ id: string;
120
+ provider: string;
121
+ account_id: string;
122
+ name: string;
123
+ type: string;
124
+ headlines: string[];
125
+ descriptions: string[];
126
+ landing_urls: string[];
127
+ media: {
128
+ type: "image" | "video" | "audio";
129
+ url: string;
130
+ alt?: string | undefined;
131
+ poster_url?: string | undefined;
132
+ open_url?: string | undefined;
133
+ }[];
134
+ actions: {
135
+ label: string;
136
+ tool: string;
137
+ arguments: Record<string, unknown>;
138
+ fields: {
139
+ key: string;
140
+ label: string;
141
+ type: "text" | "text_list" | "url_list" | "select";
142
+ value: string | string[];
143
+ options?: {
144
+ label: string;
145
+ value: string;
146
+ }[] | undefined;
147
+ max_length?: number | undefined;
148
+ }[];
149
+ }[];
150
+ status?: string | undefined;
151
+ campaign_id?: string | undefined;
152
+ ad_group_id?: string | undefined;
153
+ }[];
154
+ warnings: {
155
+ provider: string;
156
+ message: string;
157
+ }[];
158
+ next_cursor?: string | undefined;
159
+ items: {
160
+ [x: string]: unknown;
161
+ id: string;
162
+ }[];
163
+ truncated: boolean;
164
+ }>;
165
+ private readyMedia;
166
+ private topMedia;
167
+ private checkTargeting;
168
+ private mutate;
169
+ plan(op: WriteOperation, guard: WriteGuard): Promise<SnapchatPlan>;
170
+ }
171
+
172
+ declare class SnapchatManagementService {
173
+ private readonly client;
174
+ private readonly creatives;
175
+ constructor(client: SnapchatAdsClient, creatives: SnapchatCreativeService);
176
+ audience(account: string, segment: string): Promise<{
177
+ [x: string]: unknown;
178
+ id: string;
179
+ }>;
180
+ audiences(input: {
181
+ account_id: string;
182
+ limit: number;
183
+ cursor?: string;
184
+ }): Promise<{
185
+ warnings: string[];
186
+ next_cursor?: string | undefined;
187
+ items: {
188
+ [x: string]: unknown;
189
+ id: string;
190
+ }[];
191
+ truncated: boolean;
192
+ }>;
193
+ pixels(account: string): Promise<{
194
+ items: {
195
+ [x: string]: unknown;
196
+ id: string;
197
+ }[];
198
+ truncated: boolean;
199
+ setup_note: string;
200
+ }>;
201
+ private source;
202
+ conversions(input: {
203
+ account_id: string;
204
+ source_type: 'PIXEL' | 'MOBILE_APP';
205
+ source_id: string;
206
+ limit: number;
207
+ cursor?: string;
208
+ }): Promise<{
209
+ warnings: string[];
210
+ next_cursor?: string | undefined;
211
+ items: {
212
+ [x: string]: unknown;
213
+ id: string;
214
+ }[];
215
+ truncated: boolean;
216
+ }>;
217
+ audienceSize(account: string, group: string): Promise<{
218
+ [x: string]: unknown;
219
+ audience_size_minimum: number;
220
+ audience_size_maximum: number;
221
+ ad_squad_id?: string | undefined;
222
+ }>;
223
+ private mutate;
224
+ plan(op: WriteOperation, _guard: WriteGuard): Promise<SnapchatPlan>;
225
+ private deletion;
226
+ }
227
+
36
228
  declare class SnapchatAdsProvider implements AdProvider {
37
229
  private readonly client;
38
230
  readonly id = "snapchat";
39
- constructor(client: SnapchatAdsClient);
231
+ readonly creatives: SnapchatCreativeService;
232
+ readonly management: SnapchatManagementService;
233
+ constructor(client: SnapchatAdsClient, media?: MediaResolver);
40
234
  capabilities(): {
41
235
  serverDryRun: boolean;
42
236
  };