glitch-javascript-sdk 3.2.9 → 3.2.10

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,386 @@
1
+ import Response from "../util/Response";
2
+ import { AxiosPromise } from "axios";
3
+ /**
4
+ * Allowed outlet types in the PR directory.
5
+ */
6
+ export type PrPublicationType = "blog" | "podcast" | "publication";
7
+ /**
8
+ * Eligibility state for a PR outlet.
9
+ */
10
+ export type PrEligibilityStatus = "eligible" | "ineligible" | "needs_review" | "duplicate" | "archived";
11
+ /**
12
+ * Verification state used by PR outlets, people, links, and contact points.
13
+ */
14
+ export type PrVerificationStatus = "unverified" | "verified" | "stale" | "blocked" | "failed" | "needs_review";
15
+ /**
16
+ * Email health status stored on the outlet-level PR email field.
17
+ */
18
+ export type PrEmailStatus = "unknown" | "verified" | "bounced" | "missing" | "needs_review";
19
+ /**
20
+ * Contact verification state for normalized contact points.
21
+ */
22
+ export type PrContactVerificationStatus = "unverified" | "verified" | "stale" | "bounced" | "invalid" | "blocked" | "needs_review";
23
+ /**
24
+ * Link refresh status for evidence URLs.
25
+ */
26
+ export type PrLinkStatus = "unverified" | "ok" | "redirected" | "broken" | "blocked" | "failed" | "stale";
27
+ /**
28
+ * Filters accepted by `/pr/publications` and `/pr/report`.
29
+ *
30
+ * Tag filters are human-readable slugs from `/pr/tags`. The backend accepts
31
+ * format, genre, platform, and audience as namespace-specific tag filters so
32
+ * frontend screens can expose simple controls without knowing pivot table
33
+ * details.
34
+ */
35
+ export interface PrPublicationSearchParams {
36
+ q?: string;
37
+ type?: PrPublicationType;
38
+ eligibility_status?: PrEligibilityStatus;
39
+ verification_status?: PrVerificationStatus;
40
+ dedicated_to_gaming?: boolean;
41
+ has_email?: boolean;
42
+ country?: string;
43
+ language?: string;
44
+ canonical_domain?: string;
45
+ tag?: string;
46
+ format?: string;
47
+ genre?: string;
48
+ platform?: string;
49
+ audience?: string;
50
+ sort?: "name" | "-name" | "type" | "-type" | "eligibility_status" | "-eligibility_status" | "verification_status" | "-verification_status" | "last_verified_at" | "-last_verified_at" | "updated_at" | "-updated_at" | string;
51
+ page?: number;
52
+ per_page?: number;
53
+ }
54
+ /**
55
+ * Filters accepted by `/pr/people`.
56
+ */
57
+ export interface PrPeopleSearchParams {
58
+ q?: string;
59
+ publication_id?: string;
60
+ role_category?: string;
61
+ is_active?: boolean;
62
+ verification_status?: PrVerificationStatus;
63
+ has_email?: boolean;
64
+ tag?: string;
65
+ role?: string;
66
+ sort?: "name" | "-name" | "verification_status" | "-verification_status" | "last_verified_at" | "-last_verified_at" | "updated_at" | "-updated_at" | string;
67
+ page?: number;
68
+ per_page?: number;
69
+ }
70
+ /**
71
+ * Filters accepted by `/pr/tags`.
72
+ */
73
+ export interface PrTagSearchParams {
74
+ namespace?: string;
75
+ q?: string;
76
+ }
77
+ /**
78
+ * Query parameters accepted by `/titles/{title_id}/pr/matches`.
79
+ *
80
+ * The title matcher uses the title profile plus optional human-readable search
81
+ * context to rank eligible outlets and explain why each outlet is a fit.
82
+ */
83
+ export interface PrTitleMatchParams extends PrPublicationSearchParams {
84
+ genres?: string[];
85
+ platforms?: string[];
86
+ audiences?: string[];
87
+ limit?: number;
88
+ }
89
+ /**
90
+ * Request body accepted by `/admin/pr/verification/queue`.
91
+ */
92
+ export interface PrQueueVerificationRequest {
93
+ due?: boolean;
94
+ limit?: number;
95
+ link_ids?: string[];
96
+ }
97
+ /**
98
+ * A normalized metadata tag used to filter and match PR outlets, people, and
99
+ * roles.
100
+ */
101
+ export interface PrTag {
102
+ id: string;
103
+ namespace: string;
104
+ slug: string;
105
+ label: string;
106
+ description?: string | null;
107
+ pivot?: {
108
+ confidence?: number | null;
109
+ source?: string | null;
110
+ source_link_id?: string | null;
111
+ verified_at?: string | null;
112
+ metadata?: Record<string, any> | null;
113
+ };
114
+ metadata?: Record<string, any>;
115
+ created_at?: string | null;
116
+ updated_at?: string | null;
117
+ }
118
+ /**
119
+ * A refreshable evidence URL that supports an outlet, person, role, or contact
120
+ * point.
121
+ */
122
+ export interface PrLink {
123
+ id: string;
124
+ linkable_type?: string | null;
125
+ linkable_id?: string | null;
126
+ link_type: string;
127
+ url: string;
128
+ canonical_url?: string | null;
129
+ final_url?: string | null;
130
+ domain?: string | null;
131
+ priority: number;
132
+ http_status?: number | null;
133
+ status: PrLinkStatus;
134
+ content_type?: string | null;
135
+ content_hash?: string | null;
136
+ etag?: string | null;
137
+ last_modified_at?: string | null;
138
+ last_checked_at?: string | null;
139
+ next_check_at?: string | null;
140
+ last_error?: string | null;
141
+ is_source_of_truth: boolean;
142
+ metadata?: Record<string, any>;
143
+ created_at?: string | null;
144
+ updated_at?: string | null;
145
+ }
146
+ /**
147
+ * A normalized way to reach an outlet, person, or publication role.
148
+ */
149
+ export interface PrContactPoint {
150
+ id: string;
151
+ contactable_type: string;
152
+ contactable_id: string;
153
+ pr_link_id?: string | null;
154
+ contact_type: "email" | "linkedin" | "x" | "bluesky" | "contact_form" | string;
155
+ label?: string | null;
156
+ value: string;
157
+ normalized_value: string;
158
+ verification_status: PrContactVerificationStatus;
159
+ confidence?: number | null;
160
+ is_primary: boolean;
161
+ first_seen_at?: string | null;
162
+ last_seen_at?: string | null;
163
+ source_link?: PrLink | null;
164
+ metadata?: Record<string, any>;
165
+ created_at?: string | null;
166
+ updated_at?: string | null;
167
+ }
168
+ /**
169
+ * The role a PR person has at one publication, blog, or podcast.
170
+ */
171
+ export interface PublicationPerson {
172
+ id: string;
173
+ publication_id: string;
174
+ pr_person_id: string;
175
+ source_link_id?: string | null;
176
+ role_title?: string | null;
177
+ role_category?: string | null;
178
+ email?: string | null;
179
+ email_status: "unknown" | "verified" | "bounced" | "invalid" | "needs_review";
180
+ is_primary_contact: boolean;
181
+ is_current: boolean;
182
+ confidence?: number | null;
183
+ started_at?: string | null;
184
+ ended_at?: string | null;
185
+ last_verified_at?: string | null;
186
+ source_notes?: string | null;
187
+ person?: PrPerson | null;
188
+ publication?: PrPublication | null;
189
+ source_link?: PrLink | null;
190
+ contact_points?: PrContactPoint[];
191
+ tags?: PrTag[];
192
+ metadata?: Record<string, any>;
193
+ created_at?: string | null;
194
+ updated_at?: string | null;
195
+ }
196
+ /**
197
+ * A gaming-focused publication, independent blog, or podcast in the PR
198
+ * directory.
199
+ */
200
+ export interface PrPublication {
201
+ id: string;
202
+ name: string;
203
+ slug?: string | null;
204
+ type: PrPublicationType;
205
+ url?: string | null;
206
+ canonical_domain?: string | null;
207
+ description?: string | null;
208
+ main_pr_email?: string | null;
209
+ main_pr_email_status: PrEmailStatus;
210
+ dedicated_to_gaming: boolean;
211
+ eligibility_status: PrEligibilityStatus;
212
+ exclusion_reason?: string | null;
213
+ language?: string | null;
214
+ country?: string | null;
215
+ network_or_owner?: string | null;
216
+ verification_status: PrVerificationStatus;
217
+ last_verified_at?: string | null;
218
+ next_verification_at?: string | null;
219
+ source_imported_at?: string | null;
220
+ people_count?: number;
221
+ contact_points_count?: number;
222
+ links_count?: number;
223
+ people?: PublicationPerson[];
224
+ contact_points?: PrContactPoint[];
225
+ links?: PrLink[];
226
+ tags?: PrTag[];
227
+ metadata?: Record<string, any>;
228
+ created_at?: string | null;
229
+ updated_at?: string | null;
230
+ }
231
+ /**
232
+ * A journalist, editor, podcast host, producer, contributor, or other PR
233
+ * contact associated with one or more gaming-focused outlets.
234
+ */
235
+ export interface PrPerson {
236
+ id: string;
237
+ name: string;
238
+ slug?: string | null;
239
+ bio?: string | null;
240
+ location?: string | null;
241
+ linkedin_url?: string | null;
242
+ x_url?: string | null;
243
+ bluesky_url?: string | null;
244
+ website_url?: string | null;
245
+ is_active: boolean;
246
+ verification_status: PrVerificationStatus;
247
+ last_verified_at?: string | null;
248
+ next_verification_at?: string | null;
249
+ roles_count?: number;
250
+ contact_points_count?: number;
251
+ links_count?: number;
252
+ roles?: PublicationPerson[];
253
+ contact_points?: PrContactPoint[];
254
+ links?: PrLink[];
255
+ tags?: PrTag[];
256
+ metadata?: Record<string, any>;
257
+ created_at?: string | null;
258
+ updated_at?: string | null;
259
+ }
260
+ /**
261
+ * Aggregate PR directory health metrics returned by `/pr/report`.
262
+ */
263
+ export interface PrDirectoryReport {
264
+ generated_at: string;
265
+ publications: {
266
+ total: number;
267
+ by_type: Record<string, number>;
268
+ by_eligibility_status: Record<string, number>;
269
+ by_verification_status: Record<string, number>;
270
+ dedicated_to_gaming: number;
271
+ with_email: number;
272
+ due_for_verification: number;
273
+ };
274
+ people: {
275
+ total: number;
276
+ active: number;
277
+ with_email: number;
278
+ by_verification_status: Record<string, number>;
279
+ };
280
+ links: {
281
+ total: number;
282
+ by_type: Record<string, number>;
283
+ by_status: Record<string, number>;
284
+ due_for_check: number;
285
+ };
286
+ contacts: {
287
+ total: number;
288
+ by_type: Record<string, number>;
289
+ by_status: Record<string, number>;
290
+ };
291
+ tags: {
292
+ total: number;
293
+ by_namespace: Record<string, number>;
294
+ };
295
+ }
296
+ /**
297
+ * A ranked title-to-outlet match with evidence, contact route, and plain-English
298
+ * explanation.
299
+ */
300
+ export interface PrTitleMatch {
301
+ publication: PrPublication;
302
+ score: number;
303
+ matched_tags: string[];
304
+ best_contact_path?: Record<string, any> | null;
305
+ why: string[];
306
+ risks: string[];
307
+ evidence_links: PrLink[];
308
+ }
309
+ /**
310
+ * Response body returned after queueing PR verification jobs.
311
+ */
312
+ export interface PrQueueVerificationResponse {
313
+ queued: number;
314
+ }
315
+ /**
316
+ * SDK wrapper for the PR Directory API.
317
+ *
318
+ * The PR directory is read-friendly by default: public endpoints expose
319
+ * searchable publications, people, tags, and reporting metrics. Authenticated
320
+ * title admins can request title-specific PR matches, and site admins can queue
321
+ * monthly-style verification jobs.
322
+ */
323
+ declare class PrDirectory {
324
+ /**
325
+ * Search gaming-focused PR publications, independent blogs, and podcasts.
326
+ *
327
+ * @example
328
+ * ```ts
329
+ * Glitch.api.PrDirectory.listPublications({
330
+ * q: "indie RPG",
331
+ * has_email: true,
332
+ * eligibility_status: "eligible",
333
+ * sort: "-last_verified_at",
334
+ * });
335
+ * ```
336
+ */
337
+ static listPublications<T = PrPublication[]>(params?: PrPublicationSearchParams): AxiosPromise<Response<T>>;
338
+ /**
339
+ * Retrieve one PR publication profile with loaded people, contact points,
340
+ * evidence links, and tags.
341
+ */
342
+ static viewPublication<T = PrPublication>(publication_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
343
+ /**
344
+ * Search PR people and roles across all known publications.
345
+ *
346
+ * @example
347
+ * ```ts
348
+ * Glitch.api.PrDirectory.listPeople({
349
+ * q: "reviews editor",
350
+ * has_email: true,
351
+ * role_category: "editor",
352
+ * });
353
+ * ```
354
+ */
355
+ static listPeople<T = PrPerson[]>(params?: PrPeopleSearchParams): AxiosPromise<Response<T>>;
356
+ /**
357
+ * Retrieve one PR person profile with their outlet roles, profile links,
358
+ * contact points, and metadata tags.
359
+ */
360
+ static viewPerson<T = PrPerson>(person_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
361
+ /**
362
+ * List the normalized tag vocabulary used for PR search, filters, matching,
363
+ * and reporting.
364
+ */
365
+ static listTags<T = PrTag[]>(params?: PrTagSearchParams): AxiosPromise<Response<T>>;
366
+ /**
367
+ * Get aggregate PR directory reporting metrics. Publication filters can be
368
+ * supplied to scope the outlet portion of the report.
369
+ */
370
+ static report<T = PrDirectoryReport>(params?: PrPublicationSearchParams): AxiosPromise<Response<T>>;
371
+ /**
372
+ * Match a registered game title to PR outlets. Requires an auth token for a
373
+ * user who can administer the requested title.
374
+ */
375
+ static titleMatches<T = PrTitleMatch[]>(title_id: string, params?: PrTitleMatchParams): AxiosPromise<Response<T>>;
376
+ /**
377
+ * Queue PR verification jobs. Requires a site-admin auth token.
378
+ *
379
+ * @example
380
+ * ```ts
381
+ * Glitch.api.PrDirectory.queueVerification({ due: true, limit: 250 });
382
+ * ```
383
+ */
384
+ static queueVerification<T = PrQueueVerificationResponse>(data?: PrQueueVerificationRequest, params?: Record<string, any>): AxiosPromise<Response<T>>;
385
+ }
386
+ export default PrDirectory;
@@ -46,6 +46,7 @@ import Crm from "./Crm";
46
46
  import Multiplayer from "./Multiplayer";
47
47
  import ServerOperations from "./ServerOperations";
48
48
  import Agents from "./Agents";
49
+ import PrDirectory from "./PrDirectory";
49
50
  export { Ads };
50
51
  export { AccessKeys };
51
52
  export { Auth };
@@ -94,3 +95,4 @@ export { Crm };
94
95
  export { Multiplayer };
95
96
  export { ServerOperations };
96
97
  export { Agents };
98
+ export { PrDirectory };
@@ -46,6 +46,7 @@ import { Crm } from './api';
46
46
  import { Multiplayer } from './api';
47
47
  import { ServerOperations } from './api';
48
48
  import { Agents } from './api';
49
+ import { PrDirectory } from './api';
49
50
  import Requests from "./util/Requests";
50
51
  import Parser from "./util/Parser";
51
52
  import Session from "./util/Session";
@@ -113,6 +114,7 @@ declare class Glitch {
113
114
  Multiplayer: typeof Multiplayer;
114
115
  ServerOperations: typeof ServerOperations;
115
116
  Agents: typeof Agents;
117
+ PrDirectory: typeof PrDirectory;
116
118
  };
117
119
  static util: {
118
120
  Requests: typeof Requests;
package/dist/esm/index.js CHANGED
@@ -19290,6 +19290,121 @@ var Agents = /** @class */ (function () {
19290
19290
  return Agents;
19291
19291
  }());
19292
19292
 
19293
+ /**
19294
+ * Route declarations for the PR Directory API.
19295
+ *
19296
+ * These mirror the Laravel routes under `/api/pr/*` and the title-scoped
19297
+ * matcher route under `/api/titles/{title_id}/pr/matches`. Keeping the URL
19298
+ * templates in one place lets the SDK methods stay small and consistent with
19299
+ * the rest of the package's route-wrapper pattern.
19300
+ */
19301
+ var PrDirectoryRoutes = /** @class */ (function () {
19302
+ function PrDirectoryRoutes() {
19303
+ }
19304
+ PrDirectoryRoutes.routes = {
19305
+ listPublications: { url: "/pr/publications", method: HTTP_METHODS.GET },
19306
+ viewPublication: { url: "/pr/publications/{publication_id}", method: HTTP_METHODS.GET },
19307
+ listPeople: { url: "/pr/people", method: HTTP_METHODS.GET },
19308
+ viewPerson: { url: "/pr/people/{person_id}", method: HTTP_METHODS.GET },
19309
+ listTags: { url: "/pr/tags", method: HTTP_METHODS.GET },
19310
+ report: { url: "/pr/report", method: HTTP_METHODS.GET },
19311
+ titleMatches: { url: "/titles/{title_id}/pr/matches", method: HTTP_METHODS.GET },
19312
+ queueVerification: { url: "/admin/pr/verification/queue", method: HTTP_METHODS.POST },
19313
+ };
19314
+ return PrDirectoryRoutes;
19315
+ }());
19316
+
19317
+ /**
19318
+ * SDK wrapper for the PR Directory API.
19319
+ *
19320
+ * The PR directory is read-friendly by default: public endpoints expose
19321
+ * searchable publications, people, tags, and reporting metrics. Authenticated
19322
+ * title admins can request title-specific PR matches, and site admins can queue
19323
+ * monthly-style verification jobs.
19324
+ */
19325
+ var PrDirectory = /** @class */ (function () {
19326
+ function PrDirectory() {
19327
+ }
19328
+ /**
19329
+ * Search gaming-focused PR publications, independent blogs, and podcasts.
19330
+ *
19331
+ * @example
19332
+ * ```ts
19333
+ * Glitch.api.PrDirectory.listPublications({
19334
+ * q: "indie RPG",
19335
+ * has_email: true,
19336
+ * eligibility_status: "eligible",
19337
+ * sort: "-last_verified_at",
19338
+ * });
19339
+ * ```
19340
+ */
19341
+ PrDirectory.listPublications = function (params) {
19342
+ return Requests.processRoute(PrDirectoryRoutes.routes.listPublications, {}, {}, params);
19343
+ };
19344
+ /**
19345
+ * Retrieve one PR publication profile with loaded people, contact points,
19346
+ * evidence links, and tags.
19347
+ */
19348
+ PrDirectory.viewPublication = function (publication_id, params) {
19349
+ return Requests.processRoute(PrDirectoryRoutes.routes.viewPublication, {}, { publication_id: publication_id }, params);
19350
+ };
19351
+ /**
19352
+ * Search PR people and roles across all known publications.
19353
+ *
19354
+ * @example
19355
+ * ```ts
19356
+ * Glitch.api.PrDirectory.listPeople({
19357
+ * q: "reviews editor",
19358
+ * has_email: true,
19359
+ * role_category: "editor",
19360
+ * });
19361
+ * ```
19362
+ */
19363
+ PrDirectory.listPeople = function (params) {
19364
+ return Requests.processRoute(PrDirectoryRoutes.routes.listPeople, {}, {}, params);
19365
+ };
19366
+ /**
19367
+ * Retrieve one PR person profile with their outlet roles, profile links,
19368
+ * contact points, and metadata tags.
19369
+ */
19370
+ PrDirectory.viewPerson = function (person_id, params) {
19371
+ return Requests.processRoute(PrDirectoryRoutes.routes.viewPerson, {}, { person_id: person_id }, params);
19372
+ };
19373
+ /**
19374
+ * List the normalized tag vocabulary used for PR search, filters, matching,
19375
+ * and reporting.
19376
+ */
19377
+ PrDirectory.listTags = function (params) {
19378
+ return Requests.processRoute(PrDirectoryRoutes.routes.listTags, {}, {}, params);
19379
+ };
19380
+ /**
19381
+ * Get aggregate PR directory reporting metrics. Publication filters can be
19382
+ * supplied to scope the outlet portion of the report.
19383
+ */
19384
+ PrDirectory.report = function (params) {
19385
+ return Requests.processRoute(PrDirectoryRoutes.routes.report, {}, {}, params);
19386
+ };
19387
+ /**
19388
+ * Match a registered game title to PR outlets. Requires an auth token for a
19389
+ * user who can administer the requested title.
19390
+ */
19391
+ PrDirectory.titleMatches = function (title_id, params) {
19392
+ return Requests.processRoute(PrDirectoryRoutes.routes.titleMatches, {}, { title_id: title_id }, params);
19393
+ };
19394
+ /**
19395
+ * Queue PR verification jobs. Requires a site-admin auth token.
19396
+ *
19397
+ * @example
19398
+ * ```ts
19399
+ * Glitch.api.PrDirectory.queueVerification({ due: true, limit: 250 });
19400
+ * ```
19401
+ */
19402
+ PrDirectory.queueVerification = function (data, params) {
19403
+ return Requests.processRoute(PrDirectoryRoutes.routes.queueVerification, data || {}, {}, params);
19404
+ };
19405
+ return PrDirectory;
19406
+ }());
19407
+
19293
19408
  var Parser = /** @class */ (function () {
19294
19409
  function Parser() {
19295
19410
  }
@@ -19834,6 +19949,7 @@ var Glitch = /** @class */ (function () {
19834
19949
  Multiplayer: Multiplayer,
19835
19950
  ServerOperations: ServerOperations,
19836
19951
  Agents: Agents,
19952
+ PrDirectory: PrDirectory,
19837
19953
  };
19838
19954
  Glitch.util = {
19839
19955
  Requests: Requests,