flagon-io/g1t

public

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t/packages/contracts/src/clients.ts

401 lines23,253 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs1import type { ActionsApi } from "./actions";
Billing accounts, terms and enterprises; g1t is no longer free2import type { BillingAdminApi, BillingApi } from "./billing";
Deployments: a preview for every pull request, production on g1t.page3import type { DeploymentsApi } from "./deployments";
Projects: what a workspace builds and runs, first on every page4import type { ProjectsApi } from "./projects";
Events service in Rust, with RFC 3339 times and accurate push events5import type { EventsApi } from "./events";
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace6import type { IdentityAdminApi, IdentityApi } from "./identity";
Integrations: your own model provider, alerts that open issues, tickets agents read7import type { IntegrationsApi } from "./integrations";
Webhooks: every event, to your own addresses, signed and retried8import type { WebhooksApi } from "./webhooks";
Rust repos service with shipping; pull requests kept in the model9import type { ReposApi } from "./repos";
Work service in Rust, with RFC 3339 timestamps10import type { WorkApi } from "./work";
API and MCP server, Rust identity service, registration, site redesign11
12/** A service binding, as far as these clients need it. */
13export type ServiceBinding = {
14 fetch(input: string, init?: RequestInit): Promise<Response>;
15};
16
17/**
18 * Calls a method on a service that speaks the JSON protocol used by the
19 * Rust services: `POST /rpc/<method>` with the arguments as the body.
20 */
21async function rpc<T>(
22 service: ServiceBinding,
23 method: string,
24 args: object,
25): Promise<T> {
26 // The hostname is ignored; a service binding always reaches its service.
27 const response = await service.fetch(`https://service/rpc/${method}`, {
28 method: "POST",
29 headers: { "content-type": "application/json" },
30 body: JSON.stringify(args),
31 });
32 if (!response.ok) {
33 throw new Error(`${method} failed with status ${response.status}`);
34 }
Agents as a team: lifecycle, merge queue, billing and a new shell35 return (await response.json()) as T;
API and MCP server, Rust identity service, registration, site redesign36}
37
38export function identityClient(service: ServiceBinding): IdentityApi {
39 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
40 return {
41 register: (username, email, password) =>
42 call("register", { username, email, password }),
43 signIn: (username, password) => call("sign_in", { username, password }),
44 signOut: (sessionToken) => call("sign_out", { sessionToken }),
Email verification, password reset, and Git for AI scale positioning45 resendVerification: (user) => call("resend_verification", { user }),
46 verifyEmail: (token) => call("verify_email", { token }),
47 requestPasswordReset: (email) => call("request_password_reset", { email }),
48 resetPassword: (token, password) =>
49 call("reset_password", { token, password }),
Device sign-in replaces registering and minting tokens over the API50 deviceStart: (clientName) => call("device_start", { clientName }),
51 deviceLookup: (userCode) => call("device_lookup", { userCode }),
52 deviceResolve: (userCode, user, approve) =>
53 call("device_resolve", { userCode, user, approve }),
54 deviceClaim: (deviceCode) => call("device_claim", { deviceCode }),
OAuth 2.1 sign-in for MCP clients and other applications55 oauthAuthorize: (user, approval) => call("oauth_authorize", { user, ...approval }),
56 oauthExchange: (code, codeVerifier, clientId, redirectUri) =>
57 call("oauth_exchange", { code, codeVerifier, clientId, redirectUri }),
58 oauthRefresh: (refreshToken, clientId) =>
59 call("oauth_refresh", { refreshToken, clientId }),
60 listOAuthGrants: (user) => call("list_oauth_grants", { user }),
61 revokeOAuthGrant: (user, id) => call("revoke_oauth_grant", { user, id }),
Workspaces own repositories62 createWorkspace: (user, slug, name) => call("create_workspace", { user, slug, name }),
63 getWorkspace: (slug) => call("get_workspace", { slug }),
64 listMembers: (slug, viewer) => call("list_members", { slug, viewer }),
65 addMember: (actor, slug, username) => call("add_member", { actor, slug, username }),
66 removeMember: (actor, slug, username) =>
67 call("remove_member", { actor, slug, username }),
Agents as a team: lifecycle, merge queue, billing and a new shell68 updateWorkspace: (actor, slug, details) =>
69 call("update_workspace", { actor, slug, ...details }),
Agents and memory, checks and conflicts, profiles, slug renames, custom domains70 renameWorkspace: (actor, slug, newSlug) => call("rename_workspace", { actor, slug, newSlug }),
71 checkWorkspaceRename: (actor, slug, newSlug) =>
72 call("check_workspace_rename", { actor, slug, newSlug }),
73 resolveSlug: (slug) => call("resolve_slug", { slug }),
Workspace names and icons, and a component kit for every control74 setWorkspaceAvatar: (actor, slug, image) => call("set_workspace_avatar", { actor, slug, image }),
75 setUserAvatar: (user, image) => call("set_user_avatar", { user, image }),
Agents as a team: lifecycle, merge queue, billing and a new shell76 listWorkspaceTokens: (slug, viewer) => call("list_workspace_tokens", { slug, viewer }),
77 createWorkspaceToken: (actor, slug, name) =>
78 call("create_workspace_token", { actor, slug, name }),
79 removeWorkspaceToken: (actor, slug, id) =>
80 call("remove_workspace_token", { actor, slug, id }),
API and MCP server, Rust identity service, registration, site redesign81 userForSession: (sessionToken) => call("user_for_session", { sessionToken }),
82 userForGitCredentials: (username, secret) =>
83 call("user_for_git_credentials", { username, secret }),
84 userForAccessToken: (token) => call("user_for_access_token", { token }),
85 userForSshKey: (fingerprint) => call("user_for_ssh_key", { fingerprint }),
86 userByUsername: (username) => call("user_by_username", { username }),
What happened across an outcome, as a feed beside its graph87 usernames: (ids) => call("usernames", { ids }),
Agents and memory, checks and conflicts, profiles, slug renames, custom domains88 profile: (username) => call("profile", { username }),
89 updateProfile: (actor, fields) => call("update_profile", { actor, ...fields }),
90 profileWorkspaces: (username, viewer, publicIn) =>
91 call("profile_workspaces", { username, viewer, public: publicIn }),
API and MCP server, Rust identity service, registration, site redesign92 listSshKeys: (user) => call("list_ssh_keys", { user }),
93 addSshKey: (user, title, publicKey) =>
94 call("add_ssh_key", { user, title, publicKey }),
95 removeSshKey: (user, id) => call("remove_ssh_key", { user, id }),
96 listAccessTokens: (user) => call("list_access_tokens", { user }),
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)97 createAccessToken: (user, name, ttlSeconds) =>
98 call("create_access_token", { user, name, ttlSeconds }),
Agents as a team: lifecycle, merge queue, billing and a new shell99 createAgentToken: (onBehalfOf, scope, ttlSeconds) =>
100 call("create_agent_token", { onBehalfOf, scope, ttlSeconds }),
API and MCP server, Rust identity service, registration, site redesign101 removeAccessToken: (user, id) => call("remove_access_token", { user, id }),
Agents get guardrails, run credentials, an audit log, a context hub, repository instructions and mentions; security upkeep; snake_case API102 createRunCredential: (input) => call("create_run_credential", input),
103 bindRunCredentials: (tokenHashes, runId) => call("bind_run_credentials", { tokenHashes, runId }),
104 revokeRunCredentials: (target) => call("revoke_run_credentials", target),
API and MCP server, Rust identity service, registration, site redesign105 };
106}
Rust repos service with shipping; pull requests kept in the model107
Agents and memory, checks and conflicts, profiles, slug renames, custom domains108/**
109 * The slug a renamed workspace has now, for a `workspace.renamed` handler:
110 * asked of identity by the workspace's id, so that renames delivered twice
111 * or out of order converge. Falls back to the event's `to`.
112 */
113export async function currentWorkspaceSlug(
114 identity: ServiceBinding,
115 renamed: { workspaceId: string; to: string },
116): Promise<string> {
117 const names = await identityClient(identity).usernames([renamed.workspaceId]);
118 return names[renamed.workspaceId] ?? renamed.to;
119}
120
121/** The slugs whose rows move to `current`: the two a rename names, less `current`. */
122export function staleSlugs(renamed: { from: string; to: string }, current: string): string[] {
123 return [...new Set([renamed.from, renamed.to])].filter((slug) => slug !== current);
124}
125
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace126/** Staff-only identity. Only sudo binds to it; see `IdentityAdminApi`. */
127export function identityAdminClient(service: ServiceBinding): IdentityAdminApi {
128 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
129 return {
130 workspaces: (query) => call("admin_workspaces", { query: query ?? null }),
131 workspace: (slug) => call("admin_workspace", { slug }),
132 };
133}
134
Rust repos service with shipping; pull requests kept in the model135export function reposClient(service: ServiceBinding): ReposApi {
136 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
137 return {
138 get: (path, viewer) => call("get", { path, viewer }),
139 getById: (id, viewer) => call("get_by_id", { id, viewer }),
Agents and memory, checks and conflicts, profiles, slug renames, custom domains140 publicNamespaces: (ownerId) => call("public_namespaces", { ownerId }),
Rust repos service with shipping; pull requests kept in the model141 list: (viewer, options = {}) => call("list", { viewer, ...options }),
142 create: (owner, input) => call("create", { owner, ...input }),
Agents as a team: lifecycle, merge queue, billing and a new shell143 update: (actor, path, changes) => call("update", { actor, path, ...changes }),
Rust repos service with shipping; pull requests kept in the model144 tree: (path, viewer, ref, treePath) =>
145 call("tree", { path, viewer, ref, treePath }),
146 blob: (path, viewer, ref, filePath) =>
147 call("blob", { path, viewer, ref, filePath }),
148 log: (path, viewer, ref, limit) => call("log", { path, viewer, ref, limit }),
Agents as a team: lifecycle, merge queue, billing and a new shell149 blame: (path, viewer, ref, filePath) => call("blame", { path, viewer, ref, filePath }),
Issues and pull requests replace intents and attempts150 forkForPull: (sourceId, pullId, actor) =>
151 call("fork_for_pull", { sourceId, pullId, actor }),
Rust repos service with shipping; pull requests kept in the model152 gitAccess: (path, viewer, service) =>
153 call("git_access", { path, viewer, service }),
Pull requests from branches154 branches: (path, viewer) => call("branches", { path, viewer }),
155 land: (sourceId, actor, branch) => call("land", { sourceId, actor, branch }),
156 compare: (repoId, viewer, base, head) => call("compare", { repoId, viewer, base, head }),
Rust repos service with shipping; pull requests kept in the model157 };
158}
Work service in Rust, with RFC 3339 timestamps159
160export function workClient(service: ServiceBinding): WorkApi {
161 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
162 return {
Issues and pull requests replace intents and attempts163 openIssue: (actor, repo, input) => call("open_issue", { actor, repo, ...input }),
164 listIssues: (repo, viewer, filter = {}) => call("list_issues", { repo, viewer, ...filter }),
165 getIssue: (repo, number, viewer) => call("get_issue", { repo, number, viewer }),
166 updateIssue: (actor, repo, number, input) =>
167 call("update_issue", { actor, repo, number, ...input }),
168 closeIssue: (actor, repo, number, reason) =>
169 call("close_issue", { actor, repo, number, reason }),
170 reopenIssue: (actor, repo, number) => call("reopen_issue", { actor, repo, number }),
171 listLabels: (repo, viewer) => call("list_labels", { repo, viewer }),
172 counts: (repo, viewer) => call("counts", { repo, viewer }),
Acceptance checks in sandboxes, line comments and review verdicts173 addComment: (actor, repo, number, comment) =>
174 call("add_comment", { actor, repo, number, ...comment }),
175 startChecks: (pullId) => call("start_checks", { pullId }),
176 reportChecks: (runId, token, report) =>
177 call("report_checks", { runId, token, ...report }),
Agents as a team: lifecycle, merge queue, billing and a new shell178 startReview: (pullId) => call("start_review", { pullId }),
179 failReview: (runId, token, error) => call("report_review", { runId, token, error }),
Agents and memory, checks and conflicts, profiles, slug renames, custom domains180 startMergecheck: (pullId) => call("start_mergecheck", { pullId }),
181 failMergecheck: (pullId, token, error) => call("report_mergecheck", { pullId, token, error }),
Agents as a team: lifecycle, merge queue, billing and a new shell182 advance: (pullId) => call("advance", { pullId }),
183 stall: (pullId, reason) => call("stall", { pullId, reason }),
184 managedPulls: (repoId) => call("managed_pulls", { repoId }),
185 queue: (repo, viewer) => call("queue", { repo, viewer }),
186 queueBuild: (repoId) => call("queue_build", { repoId }),
187 failQueue: (entryId, token, error) => call("report_queue", { entryId, token, error }),
188 removeFromQueue: (actor, repo, number) => call("remove_from_queue", { actor, repo, number }),
Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request189 messageAgent: (actor, repo, number, body) => call("message_agent", { actor, repo, number, body }),
Agents as a team: lifecycle, merge queue, billing and a new shell190 catchUpJob: (pullId) => call("catch_up_job", { pullId }),
Agents asked while not at work are woken to answer191 wakeForMessages: (pullId) => call("wake_for_messages", { pullId }),
Agents as a team: lifecycle, merge queue, billing and a new shell192 getSettings: (repo, viewer) => call("get_settings", { repo, viewer }),
193 updateSettings: (actor, repo, settings) =>
194 call("update_settings", { actor, repo, settings }),
Issues and pull requests replace intents and attempts195 openPull: (actor, repo, input) => call("open_pull", { actor, repo, ...input }),
196 listPulls: (repo, viewer, state) => call("list_pulls", { repo, viewer, state }),
197 getPull: (repo, number, viewer) => call("get_pull", { repo, number, viewer }),
Agents as a team: lifecycle, merge queue, billing and a new shell198 updatePull: (actor, repo, number, changes) =>
199 call("update_pull", { actor, repo, number, ...changes }),
Catching up with main takes seconds when the two sides touched different files200 catchUpPull: (actor, repo, number) => call("catch_up_pull", { actor, repo, number }),
Issues and pull requests replace intents and attempts201 readyPull: (actor, repo, number, summary) =>
202 call("ready_pull", { actor, repo, number, summary }),
203 closePull: (actor, repo, number) => call("close_pull", { actor, repo, number }),
Acceptance checks in sandboxes, line comments and review verdicts204 mergePull: (actor, repo, number, options = {}) =>
205 call("merge_pull", { actor, repo, number, ...options }),
Issues and pull requests replace intents and attempts206 listActivePulls: (viewer) => call("list_active_pulls", { viewer }),
Agents and memory, checks and conflicts, profiles, slug renames, custom domains207 byAuthor: (username, viewer, filter = {}) => call("by_author", { username, viewer, ...filter }),
Agents as a team: lifecycle, merge queue, billing and a new shell208 startPlan: (actor, repo, brief) => call("start_plan", { actor, repo, brief }),
209 failPlan: (planId, token, error) => call("report_plan", { planId, token, error }),
210 getPlan: (repo, viewer, id) => call("get_plan", { repo, viewer, id }),
211 listPlans: (repo, viewer) => call("list_plans", { repo, viewer }),
212 applyPlan: (actor, repo, id, options = {}) =>
213 call("apply_plan", { actor, repo, id, ...options }),
214 queueIssue: (actor, repo, number, queued) =>
215 call("queue_issue", { actor, repo, number, queued }),
216 readyIssues: (repoId) => call("ready_issues", { repoId }),
217 listAssignedIssues: (viewer) => call("list_assigned_issues", { viewer }),
Issues and pull requests replace intents and attempts218 appendSession: (actor, repo, number, entries) =>
219 call("append_session", { actor, repo, number, entries }),
220 readSession: (repo, number, viewer, afterSeq = 0) =>
221 call("read_session", { repo, number, viewer, afterSeq }),
Work service in Rust, with RFC 3339 timestamps222 };
223}
Events service in Rust, with RFC 3339 times and accurate push events224
Agents as a team: lifecycle, merge queue, billing and a new shell225export function billingClient(service: ServiceBinding): BillingApi {
226 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
227 return {
228 status: () => call("status", {}),
229 account: (workspace, viewer) => call("account", { workspace, viewer }),
230 ledger: (workspace, viewer) => call("ledger", { workspace, viewer }),
The statement is a month at a time, a line per kind of charge231 statement: (workspace, viewer, month = null, group = "day") => call("statement", { workspace, viewer, month, group }),
232 statementEntries: (workspace, viewer, filter) =>
233 call("statement_entries", {
234 workspace,
235 viewer,
236 month: filter.month,
237 kind: filter.kind,
238 day: filter.day ?? null,
239 project: filter.project ?? null,
240 before: filter.before ?? null,
241 }),
Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request242 usage: (workspace, viewer, since) => call("usage", { workspace, viewer, since }),
Agents as a team: lifecycle, merge queue, billing and a new shell243 checkout: (actor, workspace, amountCents, returnUrl) =>
244 call("checkout", { actor, workspace, amountCents, returnUrl }),
245 confirm: (workspace, viewer, session) => call("confirm", { workspace, viewer, session }),
246 canStart: (workspace) => call("can_start", { workspace }),
A free allowance on g1t's models, so anyone can try its agents247 trial: (workspace, exempt) => call("trial", { workspace, exempt }),
Agents as a team: lifecycle, merge queue, billing and a new shell248 startRun: (run) => call("start_run", run),
Paid features: a workspace turns on Deployments with a monthly plan249 features: (workspace, viewer) => call("features", { workspace, viewer }),
250 subscribe: (actor, workspace, feature, returnUrl) =>
251 call("subscribe", { actor, workspace, feature, returnUrl }),
252 confirmSubscription: (workspace, viewer, session) =>
253 call("confirm_subscription", { workspace, viewer, session }),
254 cancelSubscription: (actor, workspace, feature, resume = false) =>
255 call("cancel_subscription", { actor, workspace, feature, resume }),
256 hasFeature: (workspace, feature) => call("has_feature", { workspace, feature }),
257 chargeFeature: (charge) => call("charge_feature", charge),
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace258 billingPortal: (actor, workspace, returnUrl) => call("billing_portal", { actor, workspace, return_url: returnUrl }),
Every sandbox is metered by the second259 recordSandbox: (usage) => call("record_sandbox", usage),
Usage limits: unpaid usage can only go so far260 limit: (workspace, viewer) => call("limit", { workspace, viewer }),
261 checkLimit: (workspace) => call("check_limit", { workspace }),
Prices keep themselves current with what g1t pays262 prices: () => call("prices", {}),
263 notePending: (workspace, source, costMicros) => call("note_pending", { workspace, source, costMicros }),
Two limits, real invoices, trust that grows by itself, sales signals264 setSpendLimit: (actor, workspace, spendLimitMicros, useFullLimit = false) =>
265 call("set_spend_limit", { actor, workspace, spendLimitMicros, use_full_limit: useFullLimit }),
266 invoices: (workspace, viewer) => call("invoices", { workspace, viewer }),
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put267 entitlements: (workspace) => call("entitlements", { workspace }),
Agents as a team: lifecycle, merge queue, billing and a new shell268 };
269}
270
Billing accounts, terms and enterprises; g1t is no longer free271export function billingAdminClient(service: ServiceBinding): BillingAdminApi {
272 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
273 return {
274 accounts: (query) => call("admin_accounts", { query: query ?? null }),
275 account: (id) => call("admin_account", { id }),
276 setTerms: (id, terms, by) => call("admin_set_terms", { id, terms, by }),
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put277 setAllowances: (id, allowances, note, by) => call("admin_set_allowances", { id, allowances, note, by }),
Billing accounts, terms and enterprises; g1t is no longer free278 createEnterprise: (name, workspaces, by) => call("admin_create_enterprise", { name, workspaces, by }),
279 attach: (workspace, account, by) => call("admin_attach", { workspace, account, by }),
280 credit: (workspace, amountMicros, note, by) => call("admin_credit", { workspace, amount_micros: amountMicros, note, by }),
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace281 billingLink: (workspace, by) => call("admin_billing_link", { workspace, by }),
Stripe webhooks, enterprise invoices, and sudo for both282 stripe: (setup = false, by) => call("admin_stripe", { setup, by: by ?? null }),
283 enterpriseBilling: (id, email, by) => call("admin_enterprise_billing", { id, email, by }),
284 invoiceEnterprise: (id, by) => call("admin_invoice_enterprise", { id, by }),
285 accountsFor: (workspaces) => call("admin_accounts", { query: null, workspaces }),
Two limits, real invoices, trust that grows by itself, sales signals286 signals: () => call("admin_signals", {}),
287 overview: () => call("admin_overview", {}),
288 sales: (workspace) => call("admin_sales", { workspace }),
289 setSales: (workspace, record, by) =>
290 call("admin_set_sales", {
291 workspace,
292 stage: record.stage,
293 owner: record.owner ?? null,
294 next_step: record.nextStep ?? null,
295 next_at: record.nextAt ?? null,
296 by,
297 }),
298 addNote: (workspace, text, by) => call("admin_add_note", { workspace, text, by }),
299 workspaceInvoices: (workspace) => call("admin_workspace_invoices", { workspace }),
Billing lists every invoice and every staff change; signals carry follow-ups300 allInvoices: (filter = {}) => call("admin_invoices", { status: filter.status ?? null, month: filter.month ?? null }),
301 audit: (filter = {}) =>
302 call("admin_audit", { by: filter.by ?? null, action: filter.action ?? null, before: filter.before ?? null }),
Billing accounts, terms and enterprises; g1t is no longer free303 };
304}
305
Events service in Rust, with RFC 3339 times and accurate push events306export function eventsClient(service: ServiceBinding): EventsApi {
307 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
308 return {
309 publish: (events) => call("publish", { events }),
310 list: (query) => call("list", query),
311 };
312}
Integrations: your own model provider, alerts that open issues, tickets agents read313
314export function integrationsClient(service: ServiceBinding): IntegrationsApi {
315 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
316 return {
317 list: (workspace, viewer) => call("list", { workspace, viewer }),
318 connect: (actor, workspace, input) => call("connect", { actor, workspace, ...input }),
319 update: (actor, workspace, id, input) => call("update", { actor, workspace, id, ...input }),
320 disconnect: (actor, workspace, id) => call("disconnect", { actor, workspace, id }),
321 test: (actor, workspace, id) => call("test", { actor, workspace, id }),
322 deliveries: (workspace, viewer, id) => call("deliveries", { workspace, viewer, id }),
323 resolve: (workspace, viewer, reference) => call("resolve", { workspace, viewer, reference }),
324 references: (workspace, text, limit) => call("references", { workspace, text, limit }),
325 import: (actor, repo, reference, assign) => call("import", { actor, repo, reference, assign }),
326 links: (repo, number) => call("links", { repo, number }),
327 modelProvider: (workspace) => call("model_provider", { workspace }),
328 openModelSession: (run) => call("open_model_session", run),
329 modelUpstream: (token) => call("model_upstream", { token }),
Models per workspace: several providers, routed by kind of work330 routes: (workspace, viewer) => call("routes", { workspace, viewer }),
331 setRoutes: (actor, workspace, routes) => call("set_routes", { actor, workspace, routes }),
Integrations: your own model provider, alerts that open issues, tickets agents read332 };
333}
Webhooks: every event, to your own addresses, signed and retried334
335export function webhooksClient(service: ServiceBinding): WebhooksApi {
336 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
337 return {
338 list: (viewer, owner) => call("list", { viewer, ...owner }),
339 create: (actor, owner, input) => call("create", { actor, ...owner, ...input }),
340 update: (actor, owner, id, input) => call("update", { actor, ...owner, id, ...input }),
341 delete: (actor, owner, id) => call("delete", { actor, ...owner, id }),
342 ping: (actor, owner, id) => call("ping", { actor, ...owner, id }),
343 deliveries: (viewer, owner, id) => call("deliveries", { viewer, ...owner, id }),
344 redeliver: (actor, owner, deliveryId) => call("redeliver", { actor, ...owner, deliveryId }),
345 };
346}
Automations: rules in .g1t/automations that act when something happens347
GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs348export function actionsClient(service: ServiceBinding): ActionsApi {
349 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
350 return {
351 workflows: (repo, viewer) => call("workflows", { repo, viewer }),
352 runs: (repo, viewer, filter = {}) => call("runs", { repo, viewer, ...filter }),
353 run: (repo, viewer, id) => call("run", { repo, viewer, id }),
354 logs: (repo, viewer, job, after = 0) => call("logs", { repo, viewer, job, after }),
355 dispatch: (actor, repo, workflow, ref, inputs) => call("dispatch", { actor, repo, workflow, ref, inputs }),
356 cancel: (actor, repo, id) => call("cancel", { actor, repo, id }),
357 rerun: (actor, repo, id, failedOnly = false) => call("rerun", { actor, repo, id, failed_only: failedOnly }),
358 setWorkflowEnabled: (actor, repo, workflow, enabled) =>
359 call("set_workflow_enabled", { actor, repo, workflow, enabled }),
360 settings: (actor, owner, kind) => call("settings", { actor, ...owner, kind }),
Secrets and variables: one list, rows per environment, for workflows and deployments361 setSetting: (actor, owner, kind, name, value, options = {}) =>
362 call("set_setting", { actor, ...owner, kind, name, value, ...options }),
363 deleteSetting: (actor, owner, kind, name, id) => call("delete_setting", { actor, ...owner, kind, name, id }),
GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs364 };
365}
366
Deployments: a preview for every pull request, production on g1t.page367
368export function deploymentsClient(service: ServiceBinding): DeploymentsApi {
369 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
370 return {
Projects: what a workspace builds and runs, first on every page371 settings: (project, viewer) => call("settings", { project, viewer }),
372 updateSettings: (actor, project, changes) => call("update_settings", { actor, project, changes }),
373 list: (project, viewer) => call("list", { project, viewer }),
374 get: (project, id, viewer) => call("get", { project, id, viewer }),
375 redeploy: (actor, project, branch) => call("redeploy", { actor, project, branch }),
376 takeDown: (actor, project, branch) => call("take_down", { actor, project, branch }),
Project dependencies: addresses, preview stacks, Affects, and agents who know377 stack: (actor, project, branch) => call("stack", { actor, project, branch }),
Projects: what a workspace builds and runs, first on every page378 overview: (workspace, viewer) => call("overview", { workspace, viewer }),
Deployments: a preview for every pull request, production on g1t.page379 usage: (workspace, viewer) => call("usage", { workspace, viewer }),
Agents and memory, checks and conflicts, profiles, slug renames, custom domains380 domains: (project, viewer) => call("domains", { project, viewer }),
381 addDomain: (actor, project, hostname, options = {}) =>
382 call("add_domain", { actor, project, hostname, twin: !!options.twin }),
383 removeDomain: (actor, project, id) => call("remove_domain", { actor, project, id }),
384 refreshDomain: (actor, project, id) => call("refresh_domain", { actor, project, id }),
Deployments: a preview for every pull request, production on g1t.page385 };
386}
Projects: what a workspace builds and runs, first on every page387
388export function projectsClient(service: ServiceBinding): ProjectsApi {
389 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
390 return {
391 list: (workspace, viewer) => call("list", { workspace, viewer }),
392 get: (workspace, slug, viewer) => call("get", { workspace, slug, viewer }),
393 byRepo: (repoId) => call("by_repo", { repoId }),
394 create: (actor, workspace, input) => call("create", { actor, workspace, input }),
395 update: (actor, workspace, slug, changes) => call("update", { actor, workspace, slug, changes }),
Project dependencies: addresses, preview stacks, Affects, and agents who know396 dependencies: (workspace, slug, viewer) => call("dependencies", { workspace, slug, viewer }),
397 addDependency: (actor, workspace, slug, on, as) => call("add_dependency", { actor, workspace, slug, on, as }),
398 removeDependency: (actor, workspace, slug, on) => call("remove_dependency", { actor, workspace, slug, on }),
399 graph: (projectId) => call("graph", { projectId }),
Projects: what a workspace builds and runs, first on every page400 };
401}