glitch-javascript-sdk 3.2.9 → 3.2.12
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/cjs/index.js +310 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Agents.d.ts +4 -0
- package/dist/esm/api/Mcp.d.ts +73 -0
- package/dist/esm/api/PrDirectory.d.ts +386 -0
- package/dist/esm/api/Users.d.ts +8 -0
- package/dist/esm/api/index.d.ts +4 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +310 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/models/user.d.ts +10 -0
- package/dist/esm/routes/McpRoute.d.ts +15 -0
- package/dist/esm/routes/PrDirectoryRoutes.d.ts +15 -0
- package/dist/esm/util/Requests.d.ts +7 -0
- package/dist/index.d.ts +476 -0
- package/package.json +1 -1
- package/src/api/Agents.ts +7 -0
- package/src/api/Mcp.ts +150 -0
- package/src/api/PrDirectory.ts +440 -0
- package/src/api/Users.ts +13 -1
- package/src/api/index.ts +4 -0
- package/src/index.ts +4 -0
- package/src/models/user.ts +10 -1
- package/src/routes/AgentsRoute.ts +1 -0
- package/src/routes/McpRoute.ts +38 -0
- package/src/routes/PrDirectoryRoutes.ts +25 -0
- package/src/routes/UserRoutes.ts +2 -1
- package/src/util/Requests.ts +29 -0
package/src/api/Mcp.ts
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import McpRoute from "../routes/McpRoute";
|
|
2
|
+
import Requests from "../util/Requests";
|
|
3
|
+
import Response from "../util/Response";
|
|
4
|
+
import { AxiosPromise, AxiosProgressEvent } from "axios";
|
|
5
|
+
|
|
6
|
+
export interface McpStartRunRequest {
|
|
7
|
+
agent_id?: string | null;
|
|
8
|
+
initial_message?: string | null;
|
|
9
|
+
prompt?: string | null;
|
|
10
|
+
run_type?: string;
|
|
11
|
+
trigger_source?: string;
|
|
12
|
+
background?: boolean;
|
|
13
|
+
live_mode?: boolean;
|
|
14
|
+
attachment_ids?: string[];
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Client for the Glitch MCP paid facade (/mcp/v1).
|
|
20
|
+
*
|
|
21
|
+
* Authenticate with a Glitch user JWT or a title-scoped MCP token. The facade
|
|
22
|
+
* enforces subscription, title permissions, scope, and approval guardrails on
|
|
23
|
+
* every call; this client only forwards requests.
|
|
24
|
+
*/
|
|
25
|
+
class Mcp {
|
|
26
|
+
/** Health/auth probe. Returns authenticated=false (200) when no credential is set. */
|
|
27
|
+
public static authStatus<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
28
|
+
return Requests.processRoute(McpRoute.routes.authStatus, {}, {}, params);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** List titles visible to the current user token or title-scoped MCP token. */
|
|
32
|
+
public static listTitles<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
33
|
+
return Requests.processRoute(McpRoute.routes.listTitles, {}, {}, params);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Fetch safe, subscription-gated workspace context for a title. */
|
|
37
|
+
public static titleContext<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
38
|
+
return Requests.processRoute(McpRoute.routes.titleContext, {}, { title_id }, params);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Check subscription, trial, plan, and credit state for a title. */
|
|
42
|
+
public static billing<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
43
|
+
return Requests.processRoute(McpRoute.routes.billing, {}, { title_id }, params);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Start a paid Glitch Agent run for a title. */
|
|
47
|
+
public static startRun<T>(title_id: string, data?: McpStartRunRequest, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
48
|
+
return Requests.processRoute(McpRoute.routes.startRun, data ?? {}, { title_id }, params);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Fetch a durable run with status, actions, guidance, events, files, and report. */
|
|
52
|
+
public static viewRun<T>(title_id: string, run_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
53
|
+
return Requests.processRoute(McpRoute.routes.viewRun, {}, { title_id, run_id }, params);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** List user-visible timeline events for a run. */
|
|
57
|
+
public static runEvents<T>(title_id: string, run_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
58
|
+
return Requests.processRoute(McpRoute.routes.runEvents, {}, { title_id, run_id }, params);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Fetch the human-friendly final or partial report for a run. */
|
|
62
|
+
public static finalReport<T>(title_id: string, run_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
63
|
+
return Requests.processRoute(McpRoute.routes.finalReport, {}, { title_id, run_id }, params);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Server-Sent Events URL for a run's live event stream.
|
|
68
|
+
*
|
|
69
|
+
* Returns the absolute URL to open with an EventSource/fetch reader; the
|
|
70
|
+
* endpoint emits `status`, `run_event`, and a terminal `settled`/`timeout` event.
|
|
71
|
+
*/
|
|
72
|
+
public static runStreamUrl(title_id: string, run_id: string, params?: Record<string, any>): string {
|
|
73
|
+
const url = McpRoute.routes.streamRun.url
|
|
74
|
+
.replace("{title_id}", encodeURIComponent(title_id))
|
|
75
|
+
.replace("{run_id}", encodeURIComponent(run_id));
|
|
76
|
+
return Requests.buildUrl(url, params);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** List downloadable files and hosted report artifacts for a run. */
|
|
80
|
+
public static artifacts<T>(title_id: string, run_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
81
|
+
return Requests.processRoute(McpRoute.routes.artifacts, {}, { title_id, run_id }, params);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** List proposed/guidance/approval/executed actions for a title. */
|
|
85
|
+
public static listActions<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
86
|
+
return Requests.processRoute(McpRoute.routes.listActions, {}, { title_id }, params);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Approve a reviewable action. Execution remains guarded server-side. */
|
|
90
|
+
public static approveAction<T>(title_id: string, action_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
91
|
+
return Requests.processRoute(McpRoute.routes.approveAction, data ?? {}, { title_id, action_id }, params);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Reject a proposed or approval-needed action. */
|
|
95
|
+
public static rejectAction<T>(title_id: string, action_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
96
|
+
return Requests.processRoute(McpRoute.routes.rejectAction, data ?? {}, { title_id, action_id }, params);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Execute an approved action. Public/paid/creator-facing work stays guarded. */
|
|
100
|
+
public static executeAction<T>(title_id: string, action_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
101
|
+
return Requests.processRoute(McpRoute.routes.executeAction, data ?? {}, { title_id, action_id }, params);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** List open or answered guidance requests for a title or run. */
|
|
105
|
+
public static listGuidance<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
106
|
+
return Requests.processRoute(McpRoute.routes.listGuidance, {}, { title_id }, params);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Answer a guidance request and resume the server-side workflow when possible. */
|
|
110
|
+
public static answerGuidance<T>(title_id: string, guidance_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
111
|
+
return Requests.processRoute(McpRoute.routes.answerGuidance, data ?? {}, { title_id, guidance_id }, params);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Get instructions for uploading a file (points at uploadFile below). */
|
|
115
|
+
public static createUpload<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
116
|
+
return Requests.processRoute(McpRoute.routes.createUpload, data ?? {}, { title_id }, params);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Upload a file (image, video, or document) to a title or run as multipart/form-data.
|
|
121
|
+
* The facade re-checks the title scope, subscription, and allowed mime types.
|
|
122
|
+
*/
|
|
123
|
+
public static uploadFile<T>(
|
|
124
|
+
title_id: string,
|
|
125
|
+
file: File | Blob,
|
|
126
|
+
data?: object,
|
|
127
|
+
params?: Record<string, any>,
|
|
128
|
+
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void
|
|
129
|
+
): AxiosPromise<Response<T>> {
|
|
130
|
+
const url = McpRoute.routes.uploadFile.url.replace("{title_id}", title_id);
|
|
131
|
+
return Requests.uploadFile(url, "file", file, data, params, onUploadProgress);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** List MCP title tokens (user JWT only). */
|
|
135
|
+
public static listTokens<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
136
|
+
return Requests.processRoute(McpRoute.routes.listTokens, {}, { title_id }, params);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Create a revocable title-scoped MCP token (user JWT only). */
|
|
140
|
+
public static createToken<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
141
|
+
return Requests.processRoute(McpRoute.routes.createToken, data ?? {}, { title_id }, params);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Revoke a title-scoped MCP token (user JWT only). */
|
|
145
|
+
public static revokeToken<T>(title_id: string, token_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
146
|
+
return Requests.processRoute(McpRoute.routes.revokeToken, {}, { title_id, token_id }, params);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export default Mcp;
|
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import PrDirectoryRoutes from "../routes/PrDirectoryRoutes";
|
|
2
|
+
import Requests from "../util/Requests";
|
|
3
|
+
import Response from "../util/Response";
|
|
4
|
+
import { AxiosPromise } from "axios";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Allowed outlet types in the PR directory.
|
|
8
|
+
*/
|
|
9
|
+
export type PrPublicationType = "blog" | "podcast" | "publication";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Eligibility state for a PR outlet.
|
|
13
|
+
*/
|
|
14
|
+
export type PrEligibilityStatus = "eligible" | "ineligible" | "needs_review" | "duplicate" | "archived";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Verification state used by PR outlets, people, links, and contact points.
|
|
18
|
+
*/
|
|
19
|
+
export type PrVerificationStatus = "unverified" | "verified" | "stale" | "blocked" | "failed" | "needs_review";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Email health status stored on the outlet-level PR email field.
|
|
23
|
+
*/
|
|
24
|
+
export type PrEmailStatus = "unknown" | "verified" | "bounced" | "missing" | "needs_review";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Contact verification state for normalized contact points.
|
|
28
|
+
*/
|
|
29
|
+
export type PrContactVerificationStatus =
|
|
30
|
+
| "unverified"
|
|
31
|
+
| "verified"
|
|
32
|
+
| "stale"
|
|
33
|
+
| "bounced"
|
|
34
|
+
| "invalid"
|
|
35
|
+
| "blocked"
|
|
36
|
+
| "needs_review";
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Link refresh status for evidence URLs.
|
|
40
|
+
*/
|
|
41
|
+
export type PrLinkStatus = "unverified" | "ok" | "redirected" | "broken" | "blocked" | "failed" | "stale";
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Filters accepted by `/pr/publications` and `/pr/report`.
|
|
45
|
+
*
|
|
46
|
+
* Tag filters are human-readable slugs from `/pr/tags`. The backend accepts
|
|
47
|
+
* format, genre, platform, and audience as namespace-specific tag filters so
|
|
48
|
+
* frontend screens can expose simple controls without knowing pivot table
|
|
49
|
+
* details.
|
|
50
|
+
*/
|
|
51
|
+
export interface PrPublicationSearchParams {
|
|
52
|
+
q?: string;
|
|
53
|
+
type?: PrPublicationType;
|
|
54
|
+
eligibility_status?: PrEligibilityStatus;
|
|
55
|
+
verification_status?: PrVerificationStatus;
|
|
56
|
+
dedicated_to_gaming?: boolean;
|
|
57
|
+
has_email?: boolean;
|
|
58
|
+
country?: string;
|
|
59
|
+
language?: string;
|
|
60
|
+
canonical_domain?: string;
|
|
61
|
+
tag?: string;
|
|
62
|
+
format?: string;
|
|
63
|
+
genre?: string;
|
|
64
|
+
platform?: string;
|
|
65
|
+
audience?: string;
|
|
66
|
+
sort?: "name" | "-name" | "type" | "-type" | "eligibility_status" | "-eligibility_status" | "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
|
+
/**
|
|
72
|
+
* Filters accepted by `/pr/people`.
|
|
73
|
+
*/
|
|
74
|
+
export interface PrPeopleSearchParams {
|
|
75
|
+
q?: string;
|
|
76
|
+
publication_id?: string;
|
|
77
|
+
role_category?: string;
|
|
78
|
+
is_active?: boolean;
|
|
79
|
+
verification_status?: PrVerificationStatus;
|
|
80
|
+
has_email?: boolean;
|
|
81
|
+
tag?: string;
|
|
82
|
+
role?: string;
|
|
83
|
+
sort?: "name" | "-name" | "verification_status" | "-verification_status" | "last_verified_at" | "-last_verified_at" | "updated_at" | "-updated_at" | string;
|
|
84
|
+
page?: number;
|
|
85
|
+
per_page?: number;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Filters accepted by `/pr/tags`.
|
|
90
|
+
*/
|
|
91
|
+
export interface PrTagSearchParams {
|
|
92
|
+
namespace?: string;
|
|
93
|
+
q?: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Query parameters accepted by `/titles/{title_id}/pr/matches`.
|
|
98
|
+
*
|
|
99
|
+
* The title matcher uses the title profile plus optional human-readable search
|
|
100
|
+
* context to rank eligible outlets and explain why each outlet is a fit.
|
|
101
|
+
*/
|
|
102
|
+
export interface PrTitleMatchParams extends PrPublicationSearchParams {
|
|
103
|
+
genres?: string[];
|
|
104
|
+
platforms?: string[];
|
|
105
|
+
audiences?: string[];
|
|
106
|
+
limit?: number;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Request body accepted by `/admin/pr/verification/queue`.
|
|
111
|
+
*/
|
|
112
|
+
export interface PrQueueVerificationRequest {
|
|
113
|
+
due?: boolean;
|
|
114
|
+
limit?: number;
|
|
115
|
+
link_ids?: string[];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* A normalized metadata tag used to filter and match PR outlets, people, and
|
|
120
|
+
* roles.
|
|
121
|
+
*/
|
|
122
|
+
export interface PrTag {
|
|
123
|
+
id: string;
|
|
124
|
+
namespace: string;
|
|
125
|
+
slug: string;
|
|
126
|
+
label: string;
|
|
127
|
+
description?: string | null;
|
|
128
|
+
pivot?: {
|
|
129
|
+
confidence?: number | null;
|
|
130
|
+
source?: string | null;
|
|
131
|
+
source_link_id?: string | null;
|
|
132
|
+
verified_at?: string | null;
|
|
133
|
+
metadata?: Record<string, any> | null;
|
|
134
|
+
};
|
|
135
|
+
metadata?: Record<string, any>;
|
|
136
|
+
created_at?: string | null;
|
|
137
|
+
updated_at?: string | null;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* A refreshable evidence URL that supports an outlet, person, role, or contact
|
|
142
|
+
* point.
|
|
143
|
+
*/
|
|
144
|
+
export interface PrLink {
|
|
145
|
+
id: string;
|
|
146
|
+
linkable_type?: string | null;
|
|
147
|
+
linkable_id?: string | null;
|
|
148
|
+
link_type: string;
|
|
149
|
+
url: string;
|
|
150
|
+
canonical_url?: string | null;
|
|
151
|
+
final_url?: string | null;
|
|
152
|
+
domain?: string | null;
|
|
153
|
+
priority: number;
|
|
154
|
+
http_status?: number | null;
|
|
155
|
+
status: PrLinkStatus;
|
|
156
|
+
content_type?: string | null;
|
|
157
|
+
content_hash?: string | null;
|
|
158
|
+
etag?: string | null;
|
|
159
|
+
last_modified_at?: string | null;
|
|
160
|
+
last_checked_at?: string | null;
|
|
161
|
+
next_check_at?: string | null;
|
|
162
|
+
last_error?: string | null;
|
|
163
|
+
is_source_of_truth: boolean;
|
|
164
|
+
metadata?: Record<string, any>;
|
|
165
|
+
created_at?: string | null;
|
|
166
|
+
updated_at?: string | null;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* A normalized way to reach an outlet, person, or publication role.
|
|
171
|
+
*/
|
|
172
|
+
export interface PrContactPoint {
|
|
173
|
+
id: string;
|
|
174
|
+
contactable_type: string;
|
|
175
|
+
contactable_id: string;
|
|
176
|
+
pr_link_id?: string | null;
|
|
177
|
+
contact_type: "email" | "linkedin" | "x" | "bluesky" | "contact_form" | string;
|
|
178
|
+
label?: string | null;
|
|
179
|
+
value: string;
|
|
180
|
+
normalized_value: string;
|
|
181
|
+
verification_status: PrContactVerificationStatus;
|
|
182
|
+
confidence?: number | null;
|
|
183
|
+
is_primary: boolean;
|
|
184
|
+
first_seen_at?: string | null;
|
|
185
|
+
last_seen_at?: string | null;
|
|
186
|
+
source_link?: PrLink | null;
|
|
187
|
+
metadata?: Record<string, any>;
|
|
188
|
+
created_at?: string | null;
|
|
189
|
+
updated_at?: string | null;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The role a PR person has at one publication, blog, or podcast.
|
|
194
|
+
*/
|
|
195
|
+
export interface PublicationPerson {
|
|
196
|
+
id: string;
|
|
197
|
+
publication_id: string;
|
|
198
|
+
pr_person_id: string;
|
|
199
|
+
source_link_id?: string | null;
|
|
200
|
+
role_title?: string | null;
|
|
201
|
+
role_category?: string | null;
|
|
202
|
+
email?: string | null;
|
|
203
|
+
email_status: "unknown" | "verified" | "bounced" | "invalid" | "needs_review";
|
|
204
|
+
is_primary_contact: boolean;
|
|
205
|
+
is_current: boolean;
|
|
206
|
+
confidence?: number | null;
|
|
207
|
+
started_at?: string | null;
|
|
208
|
+
ended_at?: string | null;
|
|
209
|
+
last_verified_at?: string | null;
|
|
210
|
+
source_notes?: string | null;
|
|
211
|
+
person?: PrPerson | null;
|
|
212
|
+
publication?: PrPublication | null;
|
|
213
|
+
source_link?: PrLink | null;
|
|
214
|
+
contact_points?: PrContactPoint[];
|
|
215
|
+
tags?: PrTag[];
|
|
216
|
+
metadata?: Record<string, any>;
|
|
217
|
+
created_at?: string | null;
|
|
218
|
+
updated_at?: string | null;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* A gaming-focused publication, independent blog, or podcast in the PR
|
|
223
|
+
* directory.
|
|
224
|
+
*/
|
|
225
|
+
export interface PrPublication {
|
|
226
|
+
id: string;
|
|
227
|
+
name: string;
|
|
228
|
+
slug?: string | null;
|
|
229
|
+
type: PrPublicationType;
|
|
230
|
+
url?: string | null;
|
|
231
|
+
canonical_domain?: string | null;
|
|
232
|
+
description?: string | null;
|
|
233
|
+
main_pr_email?: string | null;
|
|
234
|
+
main_pr_email_status: PrEmailStatus;
|
|
235
|
+
dedicated_to_gaming: boolean;
|
|
236
|
+
eligibility_status: PrEligibilityStatus;
|
|
237
|
+
exclusion_reason?: string | null;
|
|
238
|
+
language?: string | null;
|
|
239
|
+
country?: string | null;
|
|
240
|
+
network_or_owner?: string | null;
|
|
241
|
+
verification_status: PrVerificationStatus;
|
|
242
|
+
last_verified_at?: string | null;
|
|
243
|
+
next_verification_at?: string | null;
|
|
244
|
+
source_imported_at?: string | null;
|
|
245
|
+
people_count?: number;
|
|
246
|
+
contact_points_count?: number;
|
|
247
|
+
links_count?: number;
|
|
248
|
+
people?: PublicationPerson[];
|
|
249
|
+
contact_points?: PrContactPoint[];
|
|
250
|
+
links?: PrLink[];
|
|
251
|
+
tags?: PrTag[];
|
|
252
|
+
metadata?: Record<string, any>;
|
|
253
|
+
created_at?: string | null;
|
|
254
|
+
updated_at?: string | null;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* A journalist, editor, podcast host, producer, contributor, or other PR
|
|
259
|
+
* contact associated with one or more gaming-focused outlets.
|
|
260
|
+
*/
|
|
261
|
+
export interface PrPerson {
|
|
262
|
+
id: string;
|
|
263
|
+
name: string;
|
|
264
|
+
slug?: string | null;
|
|
265
|
+
bio?: string | null;
|
|
266
|
+
location?: string | null;
|
|
267
|
+
linkedin_url?: string | null;
|
|
268
|
+
x_url?: string | null;
|
|
269
|
+
bluesky_url?: string | null;
|
|
270
|
+
website_url?: string | null;
|
|
271
|
+
is_active: boolean;
|
|
272
|
+
verification_status: PrVerificationStatus;
|
|
273
|
+
last_verified_at?: string | null;
|
|
274
|
+
next_verification_at?: string | null;
|
|
275
|
+
roles_count?: number;
|
|
276
|
+
contact_points_count?: number;
|
|
277
|
+
links_count?: number;
|
|
278
|
+
roles?: PublicationPerson[];
|
|
279
|
+
contact_points?: PrContactPoint[];
|
|
280
|
+
links?: PrLink[];
|
|
281
|
+
tags?: PrTag[];
|
|
282
|
+
metadata?: Record<string, any>;
|
|
283
|
+
created_at?: string | null;
|
|
284
|
+
updated_at?: string | null;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Aggregate PR directory health metrics returned by `/pr/report`.
|
|
289
|
+
*/
|
|
290
|
+
export interface PrDirectoryReport {
|
|
291
|
+
generated_at: string;
|
|
292
|
+
publications: {
|
|
293
|
+
total: number;
|
|
294
|
+
by_type: Record<string, number>;
|
|
295
|
+
by_eligibility_status: Record<string, number>;
|
|
296
|
+
by_verification_status: Record<string, number>;
|
|
297
|
+
dedicated_to_gaming: number;
|
|
298
|
+
with_email: number;
|
|
299
|
+
due_for_verification: number;
|
|
300
|
+
};
|
|
301
|
+
people: {
|
|
302
|
+
total: number;
|
|
303
|
+
active: number;
|
|
304
|
+
with_email: number;
|
|
305
|
+
by_verification_status: Record<string, number>;
|
|
306
|
+
};
|
|
307
|
+
links: {
|
|
308
|
+
total: number;
|
|
309
|
+
by_type: Record<string, number>;
|
|
310
|
+
by_status: Record<string, number>;
|
|
311
|
+
due_for_check: number;
|
|
312
|
+
};
|
|
313
|
+
contacts: {
|
|
314
|
+
total: number;
|
|
315
|
+
by_type: Record<string, number>;
|
|
316
|
+
by_status: Record<string, number>;
|
|
317
|
+
};
|
|
318
|
+
tags: {
|
|
319
|
+
total: number;
|
|
320
|
+
by_namespace: Record<string, number>;
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* A ranked title-to-outlet match with evidence, contact route, and plain-English
|
|
326
|
+
* explanation.
|
|
327
|
+
*/
|
|
328
|
+
export interface PrTitleMatch {
|
|
329
|
+
publication: PrPublication;
|
|
330
|
+
score: number;
|
|
331
|
+
matched_tags: string[];
|
|
332
|
+
best_contact_path?: Record<string, any> | null;
|
|
333
|
+
why: string[];
|
|
334
|
+
risks: string[];
|
|
335
|
+
evidence_links: PrLink[];
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Response body returned after queueing PR verification jobs.
|
|
340
|
+
*/
|
|
341
|
+
export interface PrQueueVerificationResponse {
|
|
342
|
+
queued: number;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* SDK wrapper for the PR Directory API.
|
|
347
|
+
*
|
|
348
|
+
* The PR directory is read-friendly by default: public endpoints expose
|
|
349
|
+
* searchable publications, people, tags, and reporting metrics. Authenticated
|
|
350
|
+
* title admins can request title-specific PR matches, and site admins can queue
|
|
351
|
+
* monthly-style verification jobs.
|
|
352
|
+
*/
|
|
353
|
+
class PrDirectory {
|
|
354
|
+
/**
|
|
355
|
+
* Search gaming-focused PR publications, independent blogs, and podcasts.
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* ```ts
|
|
359
|
+
* Glitch.api.PrDirectory.listPublications({
|
|
360
|
+
* q: "indie RPG",
|
|
361
|
+
* has_email: true,
|
|
362
|
+
* eligibility_status: "eligible",
|
|
363
|
+
* sort: "-last_verified_at",
|
|
364
|
+
* });
|
|
365
|
+
* ```
|
|
366
|
+
*/
|
|
367
|
+
public static listPublications<T = PrPublication[]>(params?: PrPublicationSearchParams): AxiosPromise<Response<T>> {
|
|
368
|
+
return Requests.processRoute(PrDirectoryRoutes.routes.listPublications, {}, {}, params);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Retrieve one PR publication profile with loaded people, contact points,
|
|
373
|
+
* evidence links, and tags.
|
|
374
|
+
*/
|
|
375
|
+
public static viewPublication<T = PrPublication>(publication_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
376
|
+
return Requests.processRoute(PrDirectoryRoutes.routes.viewPublication, {}, { publication_id }, params);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Search PR people and roles across all known publications.
|
|
381
|
+
*
|
|
382
|
+
* @example
|
|
383
|
+
* ```ts
|
|
384
|
+
* Glitch.api.PrDirectory.listPeople({
|
|
385
|
+
* q: "reviews editor",
|
|
386
|
+
* has_email: true,
|
|
387
|
+
* role_category: "editor",
|
|
388
|
+
* });
|
|
389
|
+
* ```
|
|
390
|
+
*/
|
|
391
|
+
public static listPeople<T = PrPerson[]>(params?: PrPeopleSearchParams): AxiosPromise<Response<T>> {
|
|
392
|
+
return Requests.processRoute(PrDirectoryRoutes.routes.listPeople, {}, {}, params);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Retrieve one PR person profile with their outlet roles, profile links,
|
|
397
|
+
* contact points, and metadata tags.
|
|
398
|
+
*/
|
|
399
|
+
public static viewPerson<T = PrPerson>(person_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
400
|
+
return Requests.processRoute(PrDirectoryRoutes.routes.viewPerson, {}, { person_id }, params);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* List the normalized tag vocabulary used for PR search, filters, matching,
|
|
405
|
+
* and reporting.
|
|
406
|
+
*/
|
|
407
|
+
public static listTags<T = PrTag[]>(params?: PrTagSearchParams): AxiosPromise<Response<T>> {
|
|
408
|
+
return Requests.processRoute(PrDirectoryRoutes.routes.listTags, {}, {}, params);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Get aggregate PR directory reporting metrics. Publication filters can be
|
|
413
|
+
* supplied to scope the outlet portion of the report.
|
|
414
|
+
*/
|
|
415
|
+
public static report<T = PrDirectoryReport>(params?: PrPublicationSearchParams): AxiosPromise<Response<T>> {
|
|
416
|
+
return Requests.processRoute(PrDirectoryRoutes.routes.report, {}, {}, params);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Match a registered game title to PR outlets. Requires an auth token for a
|
|
421
|
+
* user who can administer the requested title.
|
|
422
|
+
*/
|
|
423
|
+
public static titleMatches<T = PrTitleMatch[]>(title_id: string, params?: PrTitleMatchParams): AxiosPromise<Response<T>> {
|
|
424
|
+
return Requests.processRoute(PrDirectoryRoutes.routes.titleMatches, {}, { title_id }, params);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Queue PR verification jobs. Requires a site-admin auth token.
|
|
429
|
+
*
|
|
430
|
+
* @example
|
|
431
|
+
* ```ts
|
|
432
|
+
* Glitch.api.PrDirectory.queueVerification({ due: true, limit: 250 });
|
|
433
|
+
* ```
|
|
434
|
+
*/
|
|
435
|
+
public static queueVerification<T = PrQueueVerificationResponse>(data?: PrQueueVerificationRequest, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
436
|
+
return Requests.processRoute(PrDirectoryRoutes.routes.queueVerification, data || {}, {}, params);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
export default PrDirectory;
|
package/src/api/Users.ts
CHANGED
|
@@ -256,6 +256,18 @@ class Users {
|
|
|
256
256
|
return Requests.processRoute(UserRoutes.routes.clearGoogleAuth, {});
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
+
/**
|
|
260
|
+
* Clear Gmail Workspace authentication information from the current user.
|
|
261
|
+
*
|
|
262
|
+
* @see https://api.glitch.fun/api/documentation#/Users%20Route/clearGmailAuth
|
|
263
|
+
*
|
|
264
|
+
* @returns promise
|
|
265
|
+
*/
|
|
266
|
+
public static clearGmailAuth<T>(): AxiosPromise<Response<T>> {
|
|
267
|
+
|
|
268
|
+
return Requests.processRoute(UserRoutes.routes.clearGmailAuth, {});
|
|
269
|
+
}
|
|
270
|
+
|
|
259
271
|
/**
|
|
260
272
|
* Clear Stripe authentication information from the current user.
|
|
261
273
|
*
|
|
@@ -699,4 +711,4 @@ class Users {
|
|
|
699
711
|
|
|
700
712
|
}
|
|
701
713
|
|
|
702
|
-
export default Users;
|
|
714
|
+
export default Users;
|
package/src/api/index.ts
CHANGED
|
@@ -46,6 +46,8 @@ import Crm from "./Crm";
|
|
|
46
46
|
import Multiplayer from "./Multiplayer";
|
|
47
47
|
import ServerOperations from "./ServerOperations";
|
|
48
48
|
import Agents from "./Agents";
|
|
49
|
+
import Mcp from "./Mcp";
|
|
50
|
+
import PrDirectory from "./PrDirectory";
|
|
49
51
|
|
|
50
52
|
export {Ads};
|
|
51
53
|
export {AccessKeys};
|
|
@@ -95,3 +97,5 @@ export {Crm};
|
|
|
95
97
|
export {Multiplayer};
|
|
96
98
|
export {ServerOperations};
|
|
97
99
|
export {Agents};
|
|
100
|
+
export {Mcp};
|
|
101
|
+
export {PrDirectory};
|
package/src/index.ts
CHANGED
|
@@ -50,6 +50,8 @@ import {Crm} from './api';
|
|
|
50
50
|
import {Multiplayer} from './api';
|
|
51
51
|
import {ServerOperations} from './api';
|
|
52
52
|
import {Agents} from './api';
|
|
53
|
+
import {Mcp} from './api';
|
|
54
|
+
import {PrDirectory} from './api';
|
|
53
55
|
|
|
54
56
|
import Requests from "./util/Requests";
|
|
55
57
|
import Parser from "./util/Parser";
|
|
@@ -129,6 +131,8 @@ class Glitch {
|
|
|
129
131
|
Multiplayer : Multiplayer,
|
|
130
132
|
ServerOperations : ServerOperations,
|
|
131
133
|
Agents : Agents,
|
|
134
|
+
Mcp : Mcp,
|
|
135
|
+
PrDirectory : PrDirectory,
|
|
132
136
|
}
|
|
133
137
|
|
|
134
138
|
public static util = {
|
package/src/models/user.ts
CHANGED
|
@@ -23,9 +23,18 @@ interface User {
|
|
|
23
23
|
twitch_handle?: string;
|
|
24
24
|
youtube_handle?: string;
|
|
25
25
|
paetron_handle?: string;
|
|
26
|
+
gmail_oauth_token?: string;
|
|
27
|
+
gmail_refresh_token?: string;
|
|
28
|
+
gmail_token_expiration?: number;
|
|
29
|
+
gmail_token_expires_at?: string;
|
|
30
|
+
gmail_id?: string;
|
|
31
|
+
gmail_name?: string;
|
|
32
|
+
gmail_email?: string;
|
|
33
|
+
gmail_avatar?: string;
|
|
34
|
+
gmail_scopes?: string[];
|
|
35
|
+
gmail_connected_at?: string;
|
|
26
36
|
created_at?: string;
|
|
27
37
|
updated_at?: string;
|
|
28
38
|
}
|
|
29
39
|
|
|
30
40
|
export default User;
|
|
31
|
-
|
|
@@ -25,6 +25,7 @@ class AgentsRoute {
|
|
|
25
25
|
executeAction: { url: "/agents/titles/{title_id}/actions/{action_id}/execute", method: HTTP_METHODS.POST },
|
|
26
26
|
listGuidance: { url: "/agents/titles/{title_id}/guidance", method: HTTP_METHODS.GET },
|
|
27
27
|
answerGuidance: { url: "/agents/titles/{title_id}/guidance/{guidance_id}/answer", method: HTTP_METHODS.POST },
|
|
28
|
+
rewriteAgentDraft: { url: "/agents/titles/{title_id}/drafts/rewrite", method: HTTP_METHODS.POST },
|
|
28
29
|
listMemories: { url: "/agents/titles/{title_id}/memories", method: HTTP_METHODS.GET },
|
|
29
30
|
results: { url: "/agents/titles/{title_id}/results", method: HTTP_METHODS.GET },
|
|
30
31
|
usage: { url: "/agents/titles/{title_id}/usage", method: HTTP_METHODS.GET },
|