Options
All
  • Public
  • Public/Protected
  • All
Menu

Root object used for interacting with the "Simple Blog Example" API. Client has query and mutation functions for executing raw GraphQL queries and mutations, as well as ModelManager objects for manipulating models with a JavaScript API. Client alo wraps a connection, which implements the transport layer if you need access to that.

Hierarchy

  • Client

Implements

  • AnyClient

Index

Constructors

Properties

apiRoot: string = "https://simple-blog-example.gadget.app/"
applicationId: string = "2757"
connection: GadgetConnection
currentSession: CurrentSessionManager
internal: InternalModelManagers

Namespaced object for accessing models via the Gadget internal APIs, which provide lower level and higher privileged operations directly against the database. Useful for maintenance operations like migrations or correcting broken data, and for implementing the high level actions.

Returns an object of model API identifiers to InternalModelManager objects.

Example: api.internal.user.findOne(...)

post: PostManager
session: SessionManager
user: UserManager

Methods

  • getDirectUploadToken(): Promise<{ token: string; url: string }>
  • mutate(graphQL: string | DocumentNode, variables?: Record<string, any>): Promise<any>
  • Run an arbitrary GraphQL mutation.

    Parameters

    • graphQL: string | DocumentNode
    • Optional variables: Record<string, any>

    Returns Promise<any>

  • query(graphQL: string | DocumentNode, variables?: Record<string, any>): Promise<any>
  • Run an arbitrary GraphQL query.

    Parameters

    • graphQL: string | DocumentNode
    • Optional variables: Record<string, any>

    Returns Promise<any>

  • toJSON(): string
  • Returns string

  • toString(): string
  • Returns string

  • transaction<T>(callback: ((transaction: GadgetTransaction) => Promise<T>)): Promise<T>
  • Start a transaction against the Gadget backend which will atomically commit (or rollback).

    Type Parameters

    • T

    Parameters

    • callback: ((transaction: GadgetTransaction) => Promise<T>)
        • (transaction: GadgetTransaction): Promise<T>
        • Parameters

          • transaction: GadgetTransaction

          Returns Promise<T>

    Returns Promise<T>

Generated using TypeDoc