WebRADDocumentationExplore WebRAD ↗
WEBRAD / TECHNICAL REFERENCE

RestGO SDK

Login, sessions, accounts, Storage, APIs, videos, and payments through the shared client RestGO.

Configuration

Open RestGo integration → Connection → Application SDK in the sidebar.

  1. Enable Enable native RestGO integration and enter RestGO instance URL.
  2. Enter Default database slug for a default database. Application API token is optional and takes the token without Bearer.
  3. Configure Persist the user session, Session storage, and Session storage key. Options are local storage, the current tab, or memory.
  4. Click Save changes and save the project.

The RestGO object is available in pages and reusable components. Disabled integration raises RestGoNotConfiguredError. The application token is included in Preview and Build; use a token suitable for the browser.

Login and current user

TypeScript · contextual example
const result = await RestGO.login('ana@example.com', 'user-password', true);
if (!result.sucess) { Message(result.error.message); return; }
Message(result.data.user.fullName);
Navigate('PageHome');

The third argument, remember, is optional. Browser persistence follows integration settings. The public result field is named sucess.

TypeScript · contextual example
await RestGO.auth.ready;
const user = RestGO.CurrentUser;
if (user) Message(user.nome);
// user.email, user.id, user.emailconfirmed, and user.ativo are also read-only.

CurrentUser reads the last confirmed identity without a request. To fetch current data and validate the session, use getUser(); its result contains fullName, email, id, avatarUrl, active, and emailConfirmed. With no user, data is null.

Sign-up, recovery, and avatar

ActionMethod
Sign-upauth.signUp({ email, password, fullName })
Sign in with an objectauth.signInWithPassword({ email, password, remember })
Request password recoveryauth.resetPasswordForEmail(email, { url })
Confirm a new passwordauth.confirmPasswordReset({ token, password })
Confirm emailauth.confirmEmail(token)
Upload or remove an avatarauth.uploadAvatar(file), auth.deleteAvatar()
Sign outlogout() or auth.signOut()

Sign-up does not log in automatically. The RestGO instance must allow public sign-up. Recovery and confirmation depend on links sent by the server. Avatar upload uses the session and updates the SDK identity.

Sessions and events

  • auth.ready waits for initial restoration. getSession() validates the session; refreshSession() renews credentials; logout() ends the session.
  • Automatic renewal uses the refresh token received at login. A network failure does not confirm logout.
  • onAuthStateChange() receives INITIAL_SESSION, SIGNED_IN, SIGNED_OUT, SESSION_VALIDATED, TOKEN_REFRESHED, or USER_UPDATED. Keep the subscription and call unsubscribe() when observation ends.
  • In Interaction, pages and reusable components offer OnLogin and OnLogout with detail.user. OnUnauthenticated allows redirection after the absence of a session is confirmed.
TypeScript · contextual example
const subscription = RestGO.onAuthStateChange((event, session) => {
  console.log(event, session?.user.fullName);
});
// When observation ends: subscription.unsubscribe();

Dynamic APIs

TypeScript · contextual example
const endpoint = RestGO.from<{ id: number; name: string }[]>('customers', {
  database: 'main', version: 1,
});
const result = await endpoint.get({ auth: 'session', page: 1, pagination: 'simple' });
if (result.error) { Message(result.error.message); return; }
console.log(result.data, result.has_more);

Use get, post, put, patch, delete, head, options, or request. query, headers, and signal are call options. Pagination accepts exact, simple, and cursor; in cursor mode, set cursorColumn and reuse next_cursor.

authCredential
sessionUser JWT; requires a session
apiTokenApplication token, without Bearer
nonePublic access, without Authorization
autoCurrent session; otherwise, the configured token

The mode must match the endpoint’s publication settings. Login, sign-up, recovery, and confirmation use their public routes. Storage, videos, avatars, and payments use the user session.

Payments

Use the Payments component for the standard frontend flow. Configure its Gateway slug, sign in as the customer, and call one action from the button's async OnClick handler:

TypeScript · contextual example
await Payments1.Pay(Edit1.value);

For a subscription, use Subscribe(Edit1.value); Checkout(Edit1.value) uses the Inspector's Mode. These component actions recover/persist the attempt, wait for checkout and open the provider automatically. Resume(), Refresh(), WaitForConfirmation(), CancelSubscription(), LoadHistory() and LoadMore() simplify management and return flows. Confirm financial success through RestGo rather than trusting a redirect.

Direct SDK code uses RestGO.payments.gateway(slug), with createCheckout, getOperation, listOperations, and cancelSubscription. The four routes use the customer's Authentication JWT exclusively; there is no application-token fallback. SDK methods return RestGoResult and do not automatically navigate. Direct createCheckout callers must durably save and reuse the original sourceKey, mode and idempotencyKey before POST, then save the returned operation ID before navigation. HTTP 202 is a successful pending operation.

TypeScript · contextual example
const gateway = RestGO.payments.gateway('customer-payments');
const result = await gateway.listOperations();
if (result.error) Message(result.error.message);
else console.log(result.data.data, result.data.nextCursor);

Price, currency, ownership, recurrence, provider credentials and webhooks remain on RestGo. Choose the high-level Payments component unless transport-level control is required.

APIs in the IDE

  • In RestGo integration → Connection, the administrative connection manages endpoints. Its credential stays in the IDE, separate from the application token.
  • In Endpoints, configure and publish the API. Published APIs lists available routes.
  • In API Client, Import from RestGo imports operations; Refresh synchronizes previously imported clients.
  • Development login authenticates JWT API tests in the editor. This session is separate from Preview or generated application login.

Storage and videos

Use File Upload and Video Upload to select files and track uploads through the interface. The same operations are available in RestGO.storage and RestGO.videos.

  • Storage: list, upload, get, update, remove, download, getPublicUrl, and usage. download returns a Blob. isPublic controls privacy; getPublicUrl only constructs the URL.
  • Videos: upload, resumeUpload, list, get, update, and remove. Save resumeToken and select the same file to resume.
  • Processing: process, reprocess, cancelProcessing, and waitUntilReady. Waiting observes conversion without starting it.
  • Media: getHls, getThumbnail, and getMedia. For playback with controls and quality selection, use Video Player.
  • Manual chunks: videos.uploads offers create, get, sendChunk, complete, and cancel. Prefer upload/resumeUpload when individual chunk control is not needed.

Results and failures

SDK operations return { data, error }; login also returns sucess. Check error before using data. Errors include message, code, and status when available. Component methods such as ApiClient1.execute() and FileUpload1.SendToRestGO() reject their Promise on failure: use try/catch.

SDK API

Service signatures. Expand an example to see the call.

RestGO RestGoClient

auth

readonly auth: RestGoAuthClient;

storage

readonly storage: RestGoStorageClient;

videos

readonly videos: RestGoVideosClient;

payments

readonly payments: RestGoPaymentsClient;

api

readonly api: RestGoApiClient;

baseUrl

readonly baseUrl: string;

from

from<T = unknown>(endpoint: string, options?: RestGoEndpointOptions): RestGoEndpoint<T>;
Example
RestGO.from
const endpoint = RestGO.from<{ id: number; name: string }[]>('customers', { database: 'main', version: 1 });
const result = await endpoint.get({ auth: 'session', query: { page: 1 } });
if (result.error) Message(result.error.message);
else console.log(result.data, result.page, result.has_more);

login

login(email: string, password: string, remember?: boolean): Promise<RestGoLoginResult>;

Sign in with positional parameters and report whether this login succeeded.

Example
RestGO.login
const result = await RestGO.login('ana@example.com', 'user-password', true);
if (!result.sucess) { Message(result.error.message); return; }
Message(result.data.user.fullName);

logout

logout(): Promise<RestGoResult<RestGoSuccess>>;
Example
RestGO.logout
const result = await RestGO.logout();
if (result.error) Message(result.error.message);
else console.log(result.data);

getSession

getSession(): Promise<RestGoResult<RestGoSession | null>>;
Example
RestGO.getSession
const result = await RestGO.getSession();
if (result.error) Message(result.error.message);
else console.log(result.data);

getUser

getUser(): Promise<RestGoResult<RestGoUser | null>>;
Example
RestGO.getUser
const result = await RestGO.getUser();
if (result.error) Message(result.error.message);
else console.log(result.data);

CurrentUser

get CurrentUser(): RestGoCurrentUser | null;

Last server-confirmed identity, or null before authentication/restoration.

refreshSession

refreshSession(): Promise<RestGoResult<RestGoSession>>;
Example
RestGO.refreshSession
const result = await RestGO.refreshSession();
if (result.error) Message(result.error.message);
else console.log(result.data);

onAuthStateChange

onAuthStateChange(callback: (event: RestGoAuthEvent, session: RestGoSession | null) => void): {
    unsubscribe: () => void;
};
Example
RestGO.onAuthStateChange
const subscription = RestGO.onAuthStateChange((event, session) => {
  console.log(event, session?.user.fullName);
});
subscription.unsubscribe();

dispose

dispose(): void;

Release browser listeners and automatic renewal without logging the user out.

Example
RestGO.dispose
// Do not dispose of the application’s shared client during navigation.
// Use dispose when closing an independent client created by createClient.
RestGO.dispose();

RestGO.auth RestGoAuthClient

ready

readonly ready: Promise<RestGoResult<RestGoSession | null>>;

Startup checks persisted credentials with GET /auth/session.

dispose

dispose(): void;

Stop timers/listeners without revoking or deleting persisted credentials.

Example
RestGO.auth.dispose
// Do not dispose of the application’s shared client during navigation.
// Use dispose when closing an independent client created by createClient.
RestGO.auth.dispose();

CurrentUser

get CurrentUser(): RestGoCurrentUser | null;

Local snapshot; reading it does not issue a request or validate the session.

refreshSession

refreshSession(): Promise<RestGoResult<RestGoSession>>;

POST /auth/refresh, with single-use rotation serialized across callers and tabs.

Example
RestGO.auth.refreshSession
const result = await RestGO.auth.refreshSession();
if (result.error) Message(result.error.message);
else console.log(result.data);

onAuthStateChange

onAuthStateChange(callback: AuthListener): {
    unsubscribe: () => void;
};
Example
RestGO.auth.onAuthStateChange
const subscription = RestGO.auth.onAuthStateChange((event, session) => {
  console.log(event, session?.user.fullName);
});
subscription.unsubscribe();

signInWithPassword

signInWithPassword(input: RestGoSignInInput): Promise<RestGoResult<RestGoSession>>;
Example
RestGO.auth.signInWithPassword
const result = await RestGO.auth.signInWithPassword({ email: 'ana@example.com', password: 'user-password', remember: true });
if (result.error) Message(result.error.message);

signUp

signUp(input: RestGoSignUpInput): Promise<RestGoResult<RestGoManagedUser>>;

Public registration. The server must allow anonymous signup. Does not start a session.

Example
RestGO.auth.signUp
const result = await RestGO.auth.signUp({ email: 'ana@example.com', password: 'user-password', fullName: 'Ana Silva' });
if (result.error) Message(result.error.message);
// Sign-up does not log in automatically.

signOut

signOut(): Promise<RestGoResult<RestGoSuccess>>;
Example
RestGO.auth.signOut
const result = await RestGO.auth.signOut();
if (result.error) Message(result.error.message);
else console.log(result.data);

getSession

getSession(): Promise<RestGoResult<RestGoSession | null>>;

Always asks the server; JWT expiry metadata is not proof of an active session.

Example
RestGO.auth.getSession
const result = await RestGO.auth.getSession();
if (result.error) Message(result.error.message);
else console.log(result.data);

getUser

getUser(): Promise<RestGoResult<RestGoUser | null>>;
Example
RestGO.auth.getUser
const result = await RestGO.auth.getUser();
if (result.error) Message(result.error.message);
else console.log(result.data);

setSession

setSession(input: StoredSession): Promise<RestGoResult<RestGoSession>>;
Example
RestGO.auth.setSession
// Replace placeholders with values returned by your server.
const result = await RestGO.auth.setSession({
  token: 'RECEIVED-JWT',
  expiresAt: 'JWT-EXPIRY-IN-ISO-8601',
  refreshToken: 'RECEIVED-REFRESH-TOKEN',
  refreshExpiresAt: 'REFRESH-EXPIRY-IN-ISO-8601',
});
if (result.error) Message(result.error.message);

resetPasswordForEmail

resetPasswordForEmail(email: string, options?: {
    url?: string;
}): Promise<RestGoResult<RestGoSuccess>>;
Example
RestGO.auth.resetPasswordForEmail
const result = await RestGO.auth.resetPasswordForEmail('ana@example.com', { url: 'https://app.example.com/reset-password' });
if (result.error) Message(result.error.message);

confirmPasswordReset

confirmPasswordReset(input: {
    token: string;
    password: string;
}): Promise<RestGoResult<RestGoSuccess>>;
Example
RestGO.auth.confirmPasswordReset
const result = await RestGO.auth.confirmPasswordReset({ token: 'TOKEN-FROM-LINK', password: 'new-password' });
if (result.error) Message(result.error.message);

confirmEmail

confirmEmail(token: string): Promise<RestGoResult<RestGoSuccess>>;
Example
RestGO.auth.confirmEmail
const result = await RestGO.auth.confirmEmail('TOKEN-FROM-LINK');
if (result.error) Message(result.error.message);

updateUser

updateUser(input: RestGoUpdateUserInput, options?: RestGoRequestOptions): Promise<RestGoResult<RestGoUpdateUserResult>>;
Example
RestGO.auth.updateUser
const result = await RestGO.auth.updateUser({ fullName: 'Ana Silva' });
if (result.error) Message(result.error.message);
else console.log(result.data.user.fullName, result.data.sessionRevoked);

resendEmailConfirmation

resendEmailConfirmation(options?: RestGoRequestOptions & {
    url?: string;
}): Promise<RestGoResult<RestGoSuccess>>;
Example
RestGO.auth.resendEmailConfirmation
const result = await RestGO.auth.resendEmailConfirmation();
if (result.error) Message(result.error.message);
else console.log(result.data);

uploadAvatar

uploadAvatar(file: Blob, options?: {
    name?: string;
    signal?: AbortSignal;
}): Promise<RestGoResult<{
    avatarUrl: string | null;
}>>;
Example
RestGO.auth.uploadAvatar
const file = FileUpload1.selectedFile;
if (!file) return;
const result = await RestGO.auth.uploadAvatar(file, { name: file.name });
if (result.error) Message(result.error.message);
else console.log(result.data.avatarUrl);

deleteAvatar

deleteAvatar(options?: RestGoRequestOptions): Promise<RestGoResult<{
    avatarUrl: string | null;
}>>;
Example
RestGO.auth.deleteAvatar
const result = await RestGO.auth.deleteAvatar();
if (result.error) Message(result.error.message);
else console.log(result.data.avatarUrl);

RestGO.storage RestGoStorageClient

list

list(options?: RestGoListOptions): Promise<RestGoResult<RestGoList<RestGoStoredFile>>>;
Example
RestGO.storage.list
const result = await RestGO.storage.list({ page: 1, pageSize: 20, q: 'report' });
if (result.error) Message(result.error.message);
else console.log(result.data);

upload

upload(file: Blob, options?: RestGoFileOptions): Promise<RestGoResult<RestGoStoredFile>>;
Example
RestGO.storage.upload
const file = FileUpload1.selectedFile;
if (!file) return;
const result = await RestGO.storage.upload(file, { name: file.name, isPublic: false, onUploadProgress: p => console.log(p.percentage) });
if (result.error) Message(result.error.message);

get

get(id: string, options?: {
    signal?: AbortSignal;
}): Promise<RestGoResult<RestGoStoredFile>>;
Example
RestGO.storage.get
const result = await RestGO.storage.get('FILE-ID');
if (result.error) Message(result.error.message);
else console.log(result.data);

update

update(id: string, input: RestGoFileUpdate): Promise<RestGoResult<RestGoStoredFile>>;
Example
RestGO.storage.update
const result = await RestGO.storage.update('FILE-ID', { name: 'new-name.pdf', isPublic: false });
if (result.error) Message(result.error.message);

remove

remove(id: string, options?: {
    signal?: AbortSignal;
}): Promise<RestGoResult<null>>;
Example
RestGO.storage.remove
const result = await RestGO.storage.remove('FILE-ID');
if (result.error) Message(result.error.message);
else console.log(result.data);

download

download(id: string, options?: {
    range?: string;
    public?: boolean;
    signal?: AbortSignal;
}): Promise<RestGoResult<Blob>>;
Example
RestGO.storage.download
const result = await RestGO.storage.download('FILE-ID', { public: false });
if (result.error) { Message(result.error.message); return; }
const blob = result.data;
console.log(blob.size, blob.type);

getPublicUrl

getPublicUrl(id: string): RestGoResult<{
    publicUrl: string;
}>;

Constructs a URL; public access still depends on the file's isPublic metadata.

Example
RestGO.storage.getPublicUrl
const result = RestGO.storage.getPublicUrl('FILE-ID');
if (!result.error) console.log(result.data.publicUrl);
// The URL does not grant public access to a private file.

usage

usage(options?: {
    signal?: AbortSignal;
}): Promise<RestGoResult<RestGoStorageUsage>>;
Example
RestGO.storage.usage
const result = await RestGO.storage.usage();
if (result.error) Message(result.error.message);
else console.log(result.data);

RestGO.videos RestGoVideosClient

uploads

readonly uploads: RestGoVideoUploadsClient;

upload

upload(file: File, options?: RestGoVideoUploadOptions): Promise<RestGoResult<RestGoVideo>>;
Example
RestGO.videos.upload
const file = VideoUpload1.selectedFile;
if (!file) return;
const result = await RestGO.videos.upload(file, { title: 'Presentation', isPublic: false, onProgress: p => console.log(p) });
if (result.error) Message(result.error.message);

resumeUpload

resumeUpload(id: string, file: File, options: RestGoVideoResumeOptions): Promise<RestGoResult<RestGoVideo>>;
Example
RestGO.videos.resumeUpload
const file = VideoUpload1.selectedFile;
const resumeToken = VideoUpload1.resumeToken;
if (!file || !resumeToken) return;
const result = await RestGO.videos.resumeUpload(resumeToken.uploadId, file, { resumeToken });
if (result.error) Message(result.error.message);

list

list(options?: RestGoVideoListOptions): Promise<RestGoResult<RestGoVideoList>>;
Example
RestGO.videos.list
const result = await RestGO.videos.list({ limit: 20, offset: 0, q: 'presentation' });
if (result.error) Message(result.error.message);
else console.log(result.data);

get

get(id: string, options?: RestGoVideoRequestOptions): Promise<RestGoResult<RestGoVideoDetails>>;
Example
RestGO.videos.get
const result = await RestGO.videos.get('VIDEO-OR-UPLOAD-ID');
if (result.error) Message(result.error.message);
else console.log(result.data);

update

update(id: string, input: RestGoVideoUpdate, options?: RestGoVideoRequestOptions): Promise<RestGoResult<RestGoVideo>>;
Example
RestGO.videos.update
const result = await RestGO.videos.update('VIDEO-ID', { title: 'New title', descri: 'Description', isPublic: false });
if (result.error) Message(result.error.message);

remove

remove(id: string, options?: RestGoVideoRequestOptions): Promise<RestGoResult<{
    id: string;
    status: 'deleting';
}>>;
Example
RestGO.videos.remove
const result = await RestGO.videos.remove('VIDEO-OR-UPLOAD-ID');
if (result.error) Message(result.error.message);
else console.log(result.data);

process

process(id: string, options?: RestGoVideoRequestOptions): Promise<RestGoResult<{
    id: string;
    jobId: string;
    status: 'pending';
}>>;
Example
RestGO.videos.process
const result = await RestGO.videos.process('VIDEO-OR-UPLOAD-ID');
if (result.error) Message(result.error.message);
else console.log(result.data);

reprocess

reprocess(id: string, options?: RestGoVideoRequestOptions): Promise<RestGoResult<{
    id: string;
    jobId: string;
    status: 'pending';
}>>;
Example
RestGO.videos.reprocess
const result = await RestGO.videos.reprocess('VIDEO-OR-UPLOAD-ID');
if (result.error) Message(result.error.message);
else console.log(result.data);

cancelProcessing

cancelProcessing(id: string, options?: RestGoVideoRequestOptions): Promise<RestGoResult<{
    id: string;
    state: 'cancelled';
}>>;
Example
RestGO.videos.cancelProcessing
const result = await RestGO.videos.cancelProcessing('VIDEO-OR-UPLOAD-ID');
if (result.error) Message(result.error.message);
else console.log(result.data);

getHls

getHls(id: string, options?: RestGoVideoRequestOptions & {
    public?: boolean;
}): Promise<RestGoResult<RestGoVideoHlsDescriptor>>;
Example
RestGO.videos.getHls
const result = await RestGO.videos.getHls('VIDEO-ID', { public: false });
if (result.error) Message(result.error.message);
else console.log(result.data);

getThumbnail

getThumbnail(id: string, options?: RestGoVideoRequestOptions & {
    public?: boolean;
}): Promise<RestGoResult<Blob>>;
Example
RestGO.videos.getThumbnail
const result = await RestGO.videos.getThumbnail('VIDEO-ID', { public: false });
if (result.error) Message(result.error.message);
else console.log(result.data.size);

getMedia

getMedia(id: string, uri: string, options?: RestGoVideoRequestOptions & {
    public?: boolean;
    range?: string;
    method?: 'GET' | 'HEAD';
}): Promise<RestGoResult<Response>>;

Browser media bridge: current shared session, one 401 renewal, no cookies or redirects.

Example
RestGO.videos.getMedia
const result = await RestGO.videos.getMedia('VIDEO-ID', '/videos/VIDEO-ID/hls/master.m3u8', { public: false, method: 'GET' });
if (result.error) Message(result.error.message);
// Use a valid URI from this same video’s descriptor.

waitUntilReady

waitUntilReady(id: string, options?: RestGoVideoWaitOptions): Promise<RestGoResult<RestGoVideo>>;
Example
RestGO.videos.waitUntilReady
const result = await RestGO.videos.waitUntilReady('VIDEO-ID', { intervalMs: 2000, timeoutMs: 600_000, onProgress: details => console.log(details) });
if (result.error) Message(result.error.message);

RestGO.videos.uploads RestGoVideoUploadsClient

create

create(input: RestGoVideoCreateInput, options?: RestGoVideoRequestOptions): Promise<RestGoResult<RestGoVideoUploadSession>>;
Example
RestGO.videos.uploads.create
const file = VideoUpload1.selectedFile;
if (!file) return;
const result = await RestGO.videos.uploads.create({ filename: file.name, sizeBytes: file.size, title: 'Presentation', isPublic: false });
if (result.error) Message(result.error.message);

get

get(id: string, options?: RestGoVideoRequestOptions): Promise<RestGoResult<RestGoVideoUploadSession>>;
Example
RestGO.videos.uploads.get
const result = await RestGO.videos.uploads.get('VIDEO-OR-UPLOAD-ID');
if (result.error) Message(result.error.message);
else console.log(result.data);

sendChunk

sendChunk(id: string, chunk: Blob, options: RestGoVideoChunkOptions): Promise<RestGoResult<RestGoVideoUploadSession>>;
Example
RestGO.videos.uploads.sendChunk
const file = VideoUpload1.selectedFile;
const session = VideoUpload1.uploadSession;
if (!file || !session) return;
const offset = session.offset;
const chunk = file.slice(offset, offset + 1024 * 1024);
const digest = await crypto.subtle.digest('SHA-256', await chunk.arrayBuffer());
const checksum = Array.from(new Uint8Array(digest), b => b.toString(16).padStart(2, '0')).join('');
const result = await RestGO.videos.uploads.sendChunk(session.id, chunk, { offset, checksum });
if (result.error) Message(result.error.message);
// Check the confirmed offset before sending the next chunk.

complete

complete(id: string, options?: RestGoVideoRequestOptions): Promise<RestGoResult<RestGoVideo>>;
Example
RestGO.videos.uploads.complete
const result = await RestGO.videos.uploads.complete('VIDEO-OR-UPLOAD-ID');
if (result.error) Message(result.error.message);
else console.log(result.data);

cancel

cancel(id: string, options?: RestGoVideoRequestOptions): Promise<RestGoResult<{
    status: 'deleting';
}>>;
Example
RestGO.videos.uploads.cancel
const result = await RestGO.videos.uploads.cancel('VIDEO-OR-UPLOAD-ID');
if (result.error) Message(result.error.message);
else console.log(result.data);

RestGO.payments RestGoPaymentsClient

gateway

gateway(slug: string): RestGoPaymentGatewayClient;
Example
RestGO.payments.gateway
const gateway = RestGO.payments.gateway('customer-payments');
const result = await gateway.listOperations();
if (result.error) Message(result.error.message);
else console.log(result.data.data);

RestGO.payments.gateway('customer-payments') RestGoPaymentGatewayClient

slug

readonly slug: string;

createCheckout

createCheckout(input: RestGoCheckoutInput, options?: RestGoPaymentRequestOptions): Promise<RestGoResult<RestGoPaymentOperation>>;
Example
RestGO.payments.gateway('customer-payments').createCheckout
// Direct SDK control: persist before the first POST and reuse this saved attempt.
const session = await RestGO.getSession();
if (session.error) throw session.error;
if (!session.data) throw new Error('Sign in before starting checkout.');
const sourceKey = '123';
const storageKey = JSON.stringify(['sdk-checkout', RestGO.baseUrl, session.data.user.id, 'customer-payments', sourceKey, 'payment']);
const saved = localStorage.getItem(storageKey);
const attempt = saved === null ? { sourceKey, mode: 'payment' as const, idempotencyKey: crypto.randomUUID() }
  : JSON.parse(saved) as import('@webrad/restgo-sdk').RestGoCheckoutInput;
localStorage.setItem(storageKey, JSON.stringify(attempt));
const result = await RestGO.payments.gateway('customer-payments').createCheckout(attempt);
if (result.error) throw result.error;
localStorage.setItem(storageKey + ':operation', result.data.id);
console.log(result.data.status, result.data.checkoutState);
// Prefer Payments1.Pay(sourceKey) for automatic storage/locking, readiness and opening.

getOperation

getOperation(id: string, options?: RestGoPaymentRequestOptions): Promise<RestGoResult<RestGoPaymentOperation>>;
Example
RestGO.payments.gateway('customer-payments').getOperation
const result = await RestGO.payments.gateway('customer-payments').getOperation('00000000-0000-4000-8000-000000000001');
if (result.error) Message(result.error.message);
else console.log(result.data.status, result.data.synchronizationPending);

listOperations

listOperations(options?: RestGoPaymentListOptions): Promise<RestGoResult<RestGoPaymentOperationList>>;
Example
RestGO.payments.gateway('customer-payments').listOperations
const gateway = RestGO.payments.gateway('customer-payments');
const first = await gateway.listOperations();
if (first.error) throw first.error;
console.log(first.data.data);
if (first.data.nextCursor) {
  const next = await gateway.listOperations({ before: first.data.nextCursor });
  if (next.error) throw next.error;
  console.log(next.data.data);
}

cancelSubscription

cancelSubscription(id: string, options?: RestGoPaymentRequestOptions): Promise<RestGoResult<RestGoPaymentOperation>>;
Example
RestGO.payments.gateway('customer-payments').cancelSubscription
// Call after the customer chooses to cancel their subscription.
const result = await RestGO.payments.gateway('customer-payments').cancelSubscription('00000000-0000-4000-8000-000000000001');
if (result.error) Message(result.error.message);
else console.log(result.data.provider.periodEnd, result.data.provider.cancelAtPeriodEnd);

RestGO.api RestGoApiClient

from

from(database?: string): RestGoDatabase;
Example
RestGO.api.from
const database = RestGO.api.from('main');
const result = await database.endpoint('customers', { version: 1 }).get({ auth: 'session' });
if (result.error) Message(result.error.message);

endpoint

endpoint<T = unknown>(name: string, options?: RestGoEndpointOptions): RestGoEndpoint<T>;
Example
RestGO.api.endpoint
const endpoint = RestGO.api.endpoint('customers', { database: 'main', version: 1 });
const result = await endpoint.get({ auth: 'session' });
if (result.error) Message(result.error.message);

RestGO.api.from('main') RestGoDatabase

endpoint

endpoint<T = unknown>(name: string, options?: {
    version?: number;
}): RestGoEndpoint<T>;
Example
RestGO.api.from('main').endpoint
const endpoint = RestGO.api.from('main').endpoint('customers', { version: 1 });
const result = await endpoint.get();
if (result.error) Message(result.error.message);

RestGO.from('customers') RestGoEndpoint

get

get<U = T>(options?: RestGoDynamicOptions): Promise<RestGoDynamicResult<U>>;
Example
RestGO.from('customers').get
const result = await RestGO.from('customers').get({ auth: 'session', query: { page: 1 } });
if (result.error) Message(result.error.message);
else console.log(result.data);

post

post<U = T>(body?: unknown, options?: RestGoDynamicOptions): Promise<RestGoDynamicResult<U>>;
Example
RestGO.from('customers').post
const result = await RestGO.from('customers').post({ id: 42, name: 'Ana' }, { auth: 'session' });
if (result.error) Message(result.error.message);
else console.log(result.data);

put

put<U = T>(body?: unknown, options?: RestGoDynamicOptions): Promise<RestGoDynamicResult<U>>;
Example
RestGO.from('customers').put
const result = await RestGO.from('customers').put({ id: 42, name: 'Ana' }, { auth: 'session' });
if (result.error) Message(result.error.message);
else console.log(result.data);

patch

patch<U = T>(body?: unknown, options?: RestGoDynamicOptions): Promise<RestGoDynamicResult<U>>;
Example
RestGO.from('customers').patch
const result = await RestGO.from('customers').patch({ id: 42, name: 'Ana' }, { auth: 'session' });
if (result.error) Message(result.error.message);
else console.log(result.data);

delete

delete<U = T>(body?: unknown, options?: RestGoDynamicOptions): Promise<RestGoDynamicResult<U>>;
Example
RestGO.from('customers').delete
const result = await RestGO.from('customers').delete({ id: 42, name: 'Ana' }, { auth: 'session' });
if (result.error) Message(result.error.message);
else console.log(result.data);

head

head(options?: RestGoDynamicOptions): Promise<RestGoDynamicResult<null>>;
Example
RestGO.from('customers').head
const result = await RestGO.from('customers').head({ auth: 'session', query: { page: 1 } });
if (result.error) Message(result.error.message);
else console.log(result.data);

options

options<U = T>(options?: RestGoDynamicOptions): Promise<RestGoDynamicResult<U>>;
Example
RestGO.from('customers').options
const result = await RestGO.from('customers').options({ auth: 'session', query: { page: 1 } });
if (result.error) Message(result.error.message);
else console.log(result.data);

request

request<U = T>(method: RestGoHttpMethod, body?: unknown, options?: RestGoDynamicOptions): Promise<RestGoDynamicResult<U>>;
Example
RestGO.from('customers').request
const result = await RestGO.from('customers').request('GET', undefined, { auth: 'session', query: { page: 1 } });
if (result.error) Message(result.error.message);
else console.log(result.data);
WebRAD · Atentor · Read in Markdown
Source code: 6a562bda75a0 (with local changes) · November 7, 2026

Search documentation

Type to search APIs, components, and events.