UNPKG

@codesandbox/api

Version:
138 lines (137 loc) 4.56 kB
import type * as rest from "./RESTTypes"; import type { RESTRequest } from "./types"; export declare class RESTProjectApi { private request; private baseUrl; constructor(request: RESTRequest); getBranchById(id: string): Promise<rest.BranchWithEnvironment>; /** * @deprecated */ getBranch({ owner, repo, branch, }: { owner: string; repo: string; branch: string; }): Promise<rest.Branch>; /** * @deprecated */ import({ owner, repo, branch, teamId, }: { owner: string; repo: string; branch?: string; teamId?: string; }): Promise<rest.BranchImport>; forkRepository({ owner, repo, branch, teamId, name, organization, }: { owner: string; repo: string; branch?: string; teamId?: string; name?: string; organization?: string; }): Promise<rest.BranchImport>; /** * Creates a branch on a repo. By default it creates * a branch from the default branch, unless `sourceBranch` is passed. * By default it creates the new branch name, unless `newBranch` is passed. */ createBranch({ owner, repo, sourceBranch, newBranch, teamId, }: { owner: string; repo: string; sourceBranch?: string; newBranch?: string; teamId?: string; }): Promise<rest.BranchImport>; /** * Updates details of a branch */ updateBranch(id: string, { name }: { name: string; }): Promise<rest.Branch>; } export declare class RESTSandboxesApi { private request; private baseUrl; constructor(request: RESTRequest); /** * Returns a Sandbox with modules and directories */ get(id: string): Promise<rest.Sandbox>; update(id: string, data: { title: string; }): Promise<unknown>; fork(sandboxUrl: string): Promise<unknown>; getGitHubSandbox(sandboxUrl: string): Promise<unknown>; createDefine(): Promise<unknown>; getDefine(): Promise<unknown>; createMslim(): Promise<unknown>; getPopular(): Promise<unknown>; getPicked(): Promise<unknown>; getLimits(): Promise<unknown>; getExploreTemplates(): Promise<unknown>; getOfficialTemplates(): Promise<unknown>; } export declare class RESTUsersApi { private request; constructor(request: RESTRequest); private baseUrl; createSurveyAnswer(): Promise<unknown>; flagSurveySeen(): Promise<unknown>; createExperiment(): Promise<unknown>; search(): Promise<unknown>; getPending(id: string): Promise<unknown>; getUsernameAvailability(username: string): Promise<unknown>; finalize(): Promise<unknown>; deleteCurator(username: string): Promise<unknown>; createCurator(username: string): Promise<unknown>; getUserSandboxes(id: string): Promise<unknown>; getUserLikedSandboxes(id: string): Promise<unknown>; } export declare class RESTCurrentUserApi { private request; private baseUrl; constructor(request: RESTRequest); getIntegrations(): Promise<unknown>; removeIntegration(integration: "zeit" | "github"): Promise<unknown>; addIntegration(integration: { type: "zeit"; data: Record<string, unknown>; }): Promise<unknown>; getEditorSettings(): Promise<unknown>; setEditorSettings(): Promise<unknown>; unsetEditorSettings(): Promise<unknown>; updateEditorSettings(): Promise<unknown>; cancelSubscription(): Promise<unknown>; updateSubscription(): Promise<unknown>; createSubscription(): Promise<unknown>; createSse(): Promise<unknown>; updateBadge(id: string): Promise<unknown>; getPaymentDetails(): Promise<unknown>; updatePaymentDetails(): Promise<unknown>; getUploads(): Promise<unknown>; upload(): Promise<unknown>; deleteUpload(id: string): Promise<unknown>; getFeatureFlags(): Promise<unknown>; } export declare class RESTApi { private request; sandboxes: RESTSandboxesApi; users: RESTUsersApi; project: RESTProjectApi; currentUser: RESTCurrentUserApi; constructor(request: RESTRequest); /** * Returns the most recent subscription prices from Stripe */ getPrices(): Promise<rest.Prices>; /** * @deprecated * This should really be using the SSE Sandbox endpoint */ feedback(): void; /** * Get the latest version of an NPM dependency by passing * its name and semver. Ex: react@^1.0.1 */ getLatestDependencyVersion(dependency: string): Promise<rest.DependencyVersion>; }