@ptkl/sdk - v1.7.1
    Preparing search index...

    Base client for the platform API Classes that extend PlatformBaseClient have intentins of only working in platform context

    PlatformBaseClient

    The axios instance to use for the client

    // if sdk is used in the forge app that is running in the platform context
    const utils = new ComponentUtils()
    // this won't work outside of platform context because client needs authtorization to communicate with the API.

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • Optionaloptions: { env?: string; host?: string; token?: string }

      Returns default

    Properties

    client: AxiosInstance
    env: null | string = null
    host: null | string = null
    token: null | string = null

    Methods

    • Parameters

      • ref: string
      • env: string

      Returns Promise<AxiosResponse<any, any>>

    • Parameters

      • ref: string

      Returns Promise<any>

    • Returns Promise<any>

    • Run a platform function.

      When the function name is registered in PlatformFunctions, input and output types are inferred automatically from the IDL signature. Register signatures by running ptkl generate-types in your project.

      Type Parameters

      • K extends never

      Parameters

      • id: K
      • d: {
            headers?: Record<string, string>;
            input?: FunctionInput<K>;
            query?: Record<string, string>;
        }

      Returns Promise<FunctionOutput<K>>

      // Typed — "send_email" is registered in PlatformFunctions
      const result = await fn.run("send_email", { input: { body: "hi", to: "a@b.com" } })
      // result: { status: boolean }
      // Untyped fallback for unregistered names
      const result = await fn.run("unknown_func", { input: { foo: "bar" } })
    • Run a platform function.

      When the function name is registered in PlatformFunctions, input and output types are inferred automatically from the IDL signature. Register signatures by running ptkl generate-types in your project.

      Parameters

      • id: string
      • d: {
            headers?: Record<string, string>;
            input?: Record<string, any>;
            query?: Record<string, string>;
        }

      Returns Promise<any>

      // Typed — "send_email" is registered in PlatformFunctions
      const result = await fn.run("send_email", { input: { body: "hi", to: "a@b.com" } })
      // result: { status: boolean }
      // Untyped fallback for unregistered names
      const result = await fn.run("unknown_func", { input: { foo: "bar" } })
    • Parameters

      • client: AxiosInstance

      Returns default

    • Parameters

      • uuid: string
      • update: any

      Returns Promise<any>