Hierarchy

  • ReactQueryNetworkClient
    • WorkspaceClient

Constructors

Properties

accountVariables accountVariableUsage accountWorkflows addLinkInApplication addLinkInInfra addLinkInWorkspace addStackInWorkspace allConnectionInterfaces allEmbeddedLinksInApplication allEmbeddedLinksInWorkspace allSharedInfra application applicationAvailableConnInterface applicationDependencies applicationDetail applications checkConnectionInterfaceAvailability connectionInterface createAccountVariable createEmbeddedLinkInApplication createEmbeddedLinkInWorkspace createEnvironment createWorkspace deleteAccountVariable deleteAccountWorkflow deleteApplication deleteConnectionInterface deleteConnectionInterfaceAttributesFromEnvironment deleteEmbeddedLinkFromApplication deleteEmbeddedLinkFromWorkspace deleteInfra deleteWorkspace embeddedLinkInApplication embeddedLinkInWorkspace environment environments getAccountVariable getWorkspacesWithoutStackFilter getWorkspaceVariable infraDetail linkInApplication linkInInfra linksInWorkspace listConsolidatedContext listConsolidatedWorkspaceContext removeLinkFromApplication removeLinkFromInfra removeLinkFromWorkspace removeStackFromWorkspace saveContextInAccount saveContextInWorkspace sharedInfra sharedInfraDependencies stackInWorkspace stacks stackWorkflows updateAccountVariable updateAllEmbeddedLinksInApplication updateAllEmbeddedLinksInWorkspace updateApplication updateConnectionInterfaceAttributes updateConnectionInterfaceVisibility updateEmbeddedLinkInApplication updateEmbeddedLinkInWorkspace updateEnvironment updateInfra updateLinkInApplication updateLinkInInfra updateLinkVisibilityInApplication updateLinkVisibilityInInfra updateWorkspace updateWorkspaceVariable workflowsByStackId workspace workspaceAvailableConnInterfaceBySlug workspaces workspacesFromUserPermission workspaceVariables

Methods

Constructors

Properties

accountVariables: QueryObject<
    {
        accountId?: string;
        name?: string;
        page?: number;
        size?: number;
        sortBy?: "NAME"
        | "CREATED_AT"
        | "VALUE";
        sortDir?: "ASC" | "DESC";
    },
    PaginatedAccountVariableResponse,
> = ...

Find all account variables

accountVariableUsage: QueryObject<
    { accountId?: string; name: string },
    AccountVariableUsageResponse,
> = ...

Get account variable usage

accountWorkflows: QueryObject<
    { $type?: "CREATE_API"
    | "CREATE_APP"
    | "CREATE_INFRA"; name?: string },
    WorkflowResponse[],
> = ...

Gets account workflows

addLinkInApplication: MutationObject<
    {
        applicationId: string;
        createApplicationLinkRequest: CreateApplicationLinkRequest;
        workspaceId: string;
    },
    IdResponse,
> = ...

Adds a link to an application

addLinkInInfra: MutationObject<
    {
        createSharedInfraLinkRequest: CreateSharedInfraLinkRequest;
        sharedInfraId: string;
        workspaceId: string;
    },
    IdResponse,
> = ...

Adds a link to an infra

addLinkInWorkspace: MutationObject<
    {
        createWorkspaceLinkRequest: CreateWorkspaceLinkRequest;
        workspaceId: string;
    },
    IdResponse,
> = ...

Adds a link to a workspace

addStackInWorkspace: OperationObject<
    {
        addStackInWorkspaceRequest: AddStackInWorkspaceRequest;
        workspaceId: string;
    },
> = ...

Add stack to workspace. This fn is only used for permission purposes.

allConnectionInterfaces: QueryObject<
    { typeId?: string; workspaceId: string },
    ConnectionInterfaceSummaryResponse[],
> = ...

Gets all connection interfaces from a workspace

allEmbeddedLinksInApplication: QueryObject<
    { applicationId: string; name?: string; workspaceId: string },
    ApplicationEmbeddedLinkReadResponse[],
> = ...

Gets all embedded links from an application

allEmbeddedLinksInWorkspace: QueryObject<
    { name?: string; workspaceId: string },
    WorkspaceEmbeddedLinkReadResponse[],
> = ...

Gets all embedded links from a workspace

allSharedInfra: QueryObject<
    { name?: string; stackVersionId?: string; workspaceId: string },
    SharedInfraDetailsResponse[],
> = ...

Gets all shared infra in a Workspace

application: QueryObject<
    { applicationId: string; workspaceId: string },
    ApplicationReadResponse,
> = ...

Gets an application

applicationAvailableConnInterface: QueryObject<
    { applicationId: string; environmentId?: string; slug: string },
    ConnectionInterfaceDetailsV2Response,
> = ...

Get available connection interface for an application by connection interface slug

applicationDependencies: QueryObject<
    { applicationId: string; workspaceId: string },
    AppAndInfraDependencyResponse,
> = ...

Gets the dependencies of an application

applicationDetail: OperationObject<
    { applicationId: string; workspaceId: string },
> = ...

Gets the detail of an application. This fn is only used for permission purposes.

applications: QueryObject<
    { name?: string; stackVersionId?: string; workspaceId: string },
    ApplicationReadResponse[],
> = ...

Gets all applications in a Workspace

checkConnectionInterfaceAvailability: QueryObject<
    { applicationId?: string; sharedInfraId?: string; slug: string },
    CheckConnectionSlugAvailabilityResponse,
> = ...

Checks the availability of a connection interface slug.

connectionInterface: QueryObject<
    {
        connectionInterfaceId: string;
        environmentId?: string;
        workspaceId: string;
    },
    ConnectionInterfaceDetailsResponse,
> = ...

Gets a connection interface from a workspace

createAccountVariable: MutationObject<
    { createAccountVariableRequest: CreateAccountVariableRequest },
    unknown,
> = ...

Create account variable

createEmbeddedLinkInApplication: MutationObject<
    {
        applicationId: string;
        createApplicationEmbeddedLinkRequest: CreateApplicationEmbeddedLinkRequest;
        workspaceId: string;
    },
    IdResponse,
> = ...

Creates an embedded link in an application

createEmbeddedLinkInWorkspace: MutationObject<
    {
        createWorkspaceEmbeddedLinkRequest: CreateWorkspaceEmbeddedLinkRequest;
        workspaceId: string;
    },
    IdResponse,
> = ...

Creates an embedded link in a workspace

createEnvironment: MutationObject<
    { environmentSaveRequest: EnvironmentSaveRequest },
    IdResponse,
> = ...

Creates an environment

createWorkspace: MutationObject<
    { newWorkspaceRequest: NewWorkspaceRequest },
    IdResponse,
> = ...

Creates a workspace

deleteAccountVariable: MutationObject<{ name: string }, unknown> = ...

Delete account variable

deleteAccountWorkflow: MutationObject<{ workflowId: string }, unknown> = ...

Removes account workflow

deleteApplication: OperationObject<
    { accountId?: string; applicationId: string; workspaceId: string },
> = ...

Deletes an application. This fn is only used for permission purposes.

deleteConnectionInterface: MutationObject<
    { slug: string; workspaceId: string },
    unknown,
> = ...

Removes a connection interface

deleteConnectionInterfaceAttributesFromEnvironment: MutationObject<
    { environmentId: string; slug: string; workspaceId: string },
    unknown,
> = ...

Removes connection interface attributes by environment

deleteEmbeddedLinkFromApplication: MutationObject<
    { applicationId: string; embeddedLinkId: string; workspaceId: string },
    unknown,
> = ...

Deletes an embedded link from an application

deleteEmbeddedLinkFromWorkspace: MutationObject<
    { embeddedLinkId: string; workspaceId: string },
    unknown,
> = ...

Deletes an embedded link from a workspace

deleteInfra: OperationObject<{ sharedInfraId: string; workspaceId: string }> = ...

Deletes an infra. This fn is only used for permission purposes.

deleteWorkspace: OperationObject<{ workspaceId: string }> = ...

Deletes a workspace . This fn is only used for permission purposes.

embeddedLinkInApplication: QueryObject<
    { applicationId: string; embeddedLinkId: string; workspaceId: string },
    ApplicationEmbeddedLinkReadResponse,
> = ...

Gets an embedded link from an application

embeddedLinkInWorkspace: QueryObject<
    { embeddedLinkId: string; workspaceId: string },
    WorkspaceEmbeddedLinkReadResponse,
> = ...

Gets embedded link by id

environment: QueryObject<{ id: string }, EnvironmentReadResponse> = ...

Gets environment by Id

environments: QueryObject<{ accountId?: string }, EnvironmentReadResponse[]> = ...

Gets all environments

getAccountVariable: QueryObject<
    { accountId?: string; name: string },
    AccountVariableResponse,
> = ...

Get an account variable by name

getWorkspacesWithoutStackFilter: QueryObject<
    {
        accountId?: string;
        aclOnly?: boolean;
        name?: string;
        page?: number;
        size?: number;
        sortBy?: "NAME"
        | "DESCRIPTION";
        sortDir?: "ASC" | "DESC";
    },
    WorkspacePageResponse,
> = ...

Get all workspaces without stack version and favorites filter

getWorkspaceVariable: QueryObject<
    { accountId?: string; name: string; workspaceId: string },
    WorkspaceVariableResponse,
> = ...

Get a workspace variable by name

infraDetail: OperationObject<{ sharedInfraId: string; workspaceId: string }> = ...

Gets the detail of an infra. This fn is only used for permission purposes.

linkInApplication: QueryObject<
    { applicationId: string; linkId: string; workspaceId: string },
    ApplicationLinkReadResponse,
> = ...

Gets application link

linkInInfra: QueryObject<
    { linkId: string; sharedInfraId: string; workspaceId: string },
    SharedInfraLinkReadResponse,
> = ...

Gets shared infra link

linksInWorkspace: QueryObject<
    { name?: string; workspaceId: string },
    WorkspaceLinkReadResponse[],
> = ...

Gets shared infra links

listConsolidatedContext: OperationObject<
    {
        $type: "action"
        | "plugin";
        envName?: string;
        externalId?: string;
        stackVersionId: string;
    },
> = ...

List account context inputs for a plugin or action in a stack. This fn is only used for permission purposes.

listConsolidatedWorkspaceContext: OperationObject<
    {
        $type: "action"
        | "plugin";
        envName?: string;
        externalId?: string;
        stackVersionId: string;
        workspaceId: string;
    },
> = ...

List workspace context inputs for a plugin or action in a stack. This fn is only used for permission purposes.

removeLinkFromApplication: MutationObject<
    { applicationId: string; linkId: string; workspaceId: string },
    unknown,
> = ...

Deletes a link from an application

removeLinkFromInfra: MutationObject<
    { linkId: string; sharedInfraId: string; workspaceId: string },
    unknown,
> = ...

Deletes a link from an infra

removeLinkFromWorkspace: MutationObject<
    { linkId: string; workspaceId: string },
    unknown,
> = ...

Deletes a link from a workspace

removeStackFromWorkspace: OperationObject<
    { stackVersionId: string; workspaceId: string },
> = ...

Removes a stack from a workspace. This fn is only used for permission purposes.

saveContextInAccount: OperationObject<
    {
        $type: "action"
        | "plugin";
        contextValuesRequest: ContextValuesRequest;
        externalId: string;
        stackVersionId: string;
    },
> = ...

Save workspace context inputs for a plugin or action in the account. This fn is only used for permission purposes.

saveContextInWorkspace: OperationObject<
    {
        $type: "action"
        | "plugin";
        contextValuesRequest: ContextValuesRequest;
        externalId: string;
        stackVersionId: string;
        workspaceId: string;
    },
> = ...

Save workspace context inputs for a plugin or action in a stack. This fn is only used for permission purposes.

sharedInfra: QueryObject<
    { sharedInfraId: string; workspaceId: string },
    SharedInfraDetailsResponse,
> = ...

Gets a shared infra

sharedInfraDependencies: QueryObject<
    { sharedInfraId: string; workspaceId: string },
    AppAndInfraDependencyResponse,
> = ...

Gets the dependencies of a shared infra

stackInWorkspace: OperationObject<
    { stackVersionId: string; workspaceId: string },
> = ...

Gets a stack in a workspace . This fn is only used for permission purposes.

stacks: OperationObject<{ workspaceId: string }> = ...

Gets stacks in a workspace. This fn is only used for permission purposes.

stackWorkflows: QueryObject<
    {
        stackId: string;
        workflowType: "CREATE_API"
        | "CREATE_APP"
        | "CREATE_INFRA";
        workspaceId: string;
    },
    AccountWorkflowResponse,
> = ...

Gets workflows from a stack

updateAccountVariable: MutationObject<
    {
        name: string;
        updateAccountVariableRequest: UpdateAccountVariableRequest;
    },
    unknown,
> = ...

Update account variable

updateAllEmbeddedLinksInApplication: MutationObject<
    {
        applicationId: string;
        body: UpsertApplicationEmbeddedLinkRequest[];
        workspaceId: string;
    },
    unknown,
> = ...

Updates all embedded links in an application

updateAllEmbeddedLinksInWorkspace: MutationObject<
    { body: UpsertWorkspaceEmbeddedLinkRequest[]; workspaceId: string },
    unknown,
> = ...

Updates all embedded links from a workspace

updateApplication: MutationObject<
    {
        applicationId: string;
        updateApplicationRequest: UpdateApplicationRequest;
        workspaceId: string;
    },
    IdResponse,
> = ...

Updates an application

updateConnectionInterfaceAttributes: MutationObject<
    {
        connectionInterfaceId: string;
        updateConnectionInterfaceAttributesRequest: UpdateConnectionInterfaceAttributesRequest;
        workspaceId: string;
    },
    unknown,
> = ...

Updates the attributes of a connection interface

updateConnectionInterfaceVisibility: MutationObject<
    {
        connectionInterfaceId: string;
        updateConnectionInterfaceVisibilityRequest: UpdateConnectionInterfaceVisibilityRequest;
        workspaceId: string;
    },
    unknown,
> = ...

Updates the visibility of a connection interface

updateEmbeddedLinkInApplication: MutationObject<
    {
        applicationId: string;
        embeddedLinkId: string;
        updateApplicationEmbeddedLinkRequest: UpdateApplicationEmbeddedLinkRequest;
        workspaceId: string;
    },
    IdResponse,
> = ...

Updates an embedded link in an application

updateEmbeddedLinkInWorkspace: MutationObject<
    {
        embeddedLinkId: string;
        updateWorkspaceEmbeddedLinkRequest: UpdateWorkspaceEmbeddedLinkRequest;
        workspaceId: string;
    },
    IdResponse,
> = ...

Updates an embedded link from a workspace

updateEnvironment: MutationObject<
    { environmentUpdateRequest: EnvironmentUpdateRequest; id: string },
    IdResponse,
> = ...

Updates environment data

updateInfra: MutationObject<
    {
        sharedInfraId: string;
        updateSharedInfraRequest: UpdateSharedInfraRequest;
        workspaceId: string;
    },
    IdResponse,
> = ...

Updates a shared infra

updateLinkInApplication: MutationObject<
    {
        applicationId: string;
        linkId: string;
        updateApplicationLinkRequest: UpdateApplicationLinkRequest;
        workspaceId: string;
    },
    IdResponse,
> = ...

Updates a link from an application

updateLinkInInfra: MutationObject<
    {
        linkId: string;
        sharedInfraId: string;
        updateSharedInfraLinkRequest: UpdateSharedInfraLinkRequest;
        workspaceId: string;
    },
    IdResponse,
> = ...

Updates a link from an infra

updateLinkVisibilityInApplication: MutationObject<
    {
        applicationId: string;
        body: UpdateApplicationLinkVisibilityRequest[];
        workspaceId: string;
    },
    unknown,
> = ...

Updates application links visibility

updateLinkVisibilityInInfra: MutationObject<
    {
        body: UpdateSharedInfraLinkVisibilityRequest[];
        sharedInfraId: string;
        workspaceId: string;
    },
    unknown,
> = ...

Updates infra links visibility

updateWorkspace: MutationObject<
    { updateWorkspaceRequest: UpdateWorkspaceRequest; workspaceId: string },
    IdResponse,
> = ...

Updates a workspace

updateWorkspaceVariable: MutationObject<
    {
        name: string;
        upsertWorkspaceVariableRequest: UpsertWorkspaceVariableRequest;
        workspaceId: string;
    },
    unknown,
> = ...

Updates workspace variable based on existing account variable

workflowsByStackId: QueryObject<
    {
        stackId: string;
        workflowType: "CREATE_API"
        | "CREATE_APP"
        | "CREATE_INFRA";
        workspaceId: string;
    },
    AccountWorkflowResponse,
> = ...

Gets a workflow by stack id

workspace: QueryObject<{ workspaceId: string }, WorkspaceReadResponse> = ...

Gets a workspace

workspaceAvailableConnInterfaceBySlug: QueryObject<
    {
        accountId?: string;
        environmentId?: string;
        slug: string;
        workspaceId: string;
    },
    ConnectionInterfaceDetailsV2Response,
> = ...

Get available connection interface for a workspace by connection interface slug

workspaces: QueryObject<
    { accountId?: string; aclOnly?: boolean; name?: string },
    WorkspaceReadResponse[],
> = ...

Gets all workspaces

workspacesFromUserPermission: QueryObject<
    { action: string; resource: string },
    WorkspaceReadResponse[],
> = ...

Get workspaces within user permission

workspaceVariables: QueryObject<
    {
        accountId?: string;
        mandate?: boolean;
        name?: string;
        page?: number;
        showEmptyValues?: boolean;
        size?: number;
        sortBy?: "NAME"
        | "CREATED_AT"
        | "VALUE";
        sortDir?: "ASC" | "DESC";
        workspaceId: string;
    },
    PaginatedWorkspaceVariableResponse,
> = ...

Find all workspace variables

Methods

  • Receives an HttpError and returns a StackspotAPIError.

    Parameters

    • error: HttpError

      the original HttpError created by oazapfts.

    Returns StackspotAPIError

  • Creates a function that checks the permission for a request generated by an oazapfts function.

    This is intended to help creating a manual operation.

    Type Parameters

    • Args extends [variables: Record<string, any>, opts?: RequestOpts] | [opts?: RequestOpts]

    Parameters

    • fn: (...args: Args) => Promise<any>

      the function generated by oazapfts.

    Returns (
        ...args: Args extends [opts?: RequestOpts]
            ? []
            : [variables?: Partial<Args[0]>],
    ) => Promise<boolean>

    a function that receives the variables of fn (if any) and returns a promise that resolves to true if the request is allowed and false otherwise.

    myOperation = this.mutation({
    // ...
    permission: this.createPermissionFunctionFor(oazapftsFnForMyOperation)
    })
  • Creates a function that runs a oazapfts function with an abort signal.

    This is intended to help creating a manual operation.

    Type Parameters

    • Args extends [variables: Record<string, any>, opts?: RequestOpts] | [opts?: RequestOpts]
    • Result

    Parameters

    • fn: (...args: Args) => Promise<Result>

      the function generated by oazapfts.

    Returns (
        ...args: Args extends [opts?: RequestOpts]
            ? [signal: AbortSignal]
            : [signal: AbortSignal, variables: Args[0]],
    ) => Promise<Result>

    a function that receives a signal and the variables of fn (if any) and returns the same as fn.

    myOperation = this.mutation({
    // ...
    request: this.createRequestFunctionFor(oazapftsFnForMyOperation)
    })
  • Makes a request (same signature as globalThis.fetch). This request will prepend the base url to the url and, if there's an active session, include authentication headers.

    Parameters

    • input: string | URL | Request

      the url or request object.

    • Optionalinit: RequestInit

      the fetch options.

    Returns Promise<Response>

    a promise with the Response.

  • Checks whether or not the current account is freemium.

    Returns boolean

    true if it's a freemium account, false otherwise.

  • Builds a mutation manually by using a configuration object.

    Type Parameters

    • Args extends [AbortSignal, Record<string, any>] | [AbortSignal]
    • Result

    Parameters

    • config: OperationConfig<Args, Result>

      the configuration object containing the name, a request function and a permission function.

    Returns MutationObject<Args extends [AbortSignal] ? void : Args[1], Result>

  • Builds a mutation manually by using a configuration object.

    Type Parameters

    • Args extends [AbortSignal, Record<string, any>] | [AbortSignal]
    • Result

    Parameters

    • config: Omit<OperationConfig<Args, Result>, "permission">

      the configuration object containing the name and a request function.

    Returns Omit<
        MutationObject<Args extends [AbortSignal] ? void : Args[1], Result>,
        keyof OperationObject<any>,
    >

  • Builds a mutation automatically by using a function generated by oazapfts.

    Type Parameters

    • Args extends [opts?: RequestOpts] | [variables: Record<string, any>, opts?: RequestOpts]
    • Result

    Parameters

    • fn: (...args: Args) => Promise<Result>

      the oazapfts function.

    Returns Args extends [variables: Variables, opts?: RequestOpts]
        ? MutationObject<Variables, Result>
        : MutationObject<void, Result>

  • Builds a query manually by using a configuration object.

    Type Parameters

    • Args extends [AbortSignal, Record<string, any>] | [AbortSignal]
    • Result

    Parameters

    • config: OperationConfig<Args, Result>

      the configuration object containing the name, a request function and a permission function.

    Returns QueryObject<Args extends [AbortSignal] ? void : Args[1], Result>

  • Builds a query manually by using a configuration object.

    Type Parameters

    • Args extends [AbortSignal, Record<string, any>] | [AbortSignal]
    • Result

    Parameters

    • config: Omit<OperationConfig<Args, Result>, "permission">

      the configuration object containing the name and a request function.

    Returns Omit<
        QueryObject<Args extends [AbortSignal] ? void : Args[1], Result>,
        "isAllowed" | "useAllowed" | "getPermissionKey",
    >

  • Builds a query automatically by using a function generated by oazapfts.

    Type Parameters

    • Args extends [opts?: RequestOpts] | [variables: Record<string, any>, opts?: RequestOpts]
    • Result

    Parameters

    • fn: (...args: Args) => Promise<Result>

      the oazapfts function.

    Returns Args extends [variables: Variables, opts?: RequestOpts]
        ? QueryObject<Variables, Result>
        : QueryObject<void, Result>

  • Verifies if the current user is allowed to send the given request.

    Parameters

    • method: HTTPMethod

      the request's method.

    • path: string

      the path to the resource.

    • Optionalbody: string | object

      the request's body.

    Returns Promise<boolean>

    a promise that resolves to true if it's allowed or false otherwise.

  • Builds a URL with the baseUrl of this network client and the path passed as parameter.

    Parameters

    • path: string

      the path to the resource.

    Returns URL

    a full URL.

  • Reads an EventSource from the endpoint. Differently than the original specification, this allows common HTTP requests with method and body to be made.

    Parameters

    • input: string | URL | Request

      the url or request object.

    • Optionalinit: RequestInit

      the fetch options.

    Returns Promise<FetchEventStream>

    a promise with a FetchEventStream, which is an AsyncGenerator.

    let events = this.stream('url', options)
    for await (let event of events) {
    console.log('<<', event.data)
    }
  • Sets up all network clients. Must be called before attempting to make any request.

    Parameters

    • sessionManager: SessionManager

      An object with functions capable of checking, retrieving and ending the current session.

    • env: Env

      The environment to send the requests to.

    Returns void