Hierarchy

  • ReactQueryNetworkClient
    • CloudAccountClient

Constructors

Properties

cloudAccountByWorkspace: QueryObject<
    Omit<
        { accountId?: string; id: string; jwtToken: JwtToken },
        "authorization" | "jwtToken",
    > & {},
    CloudAccountDetails[],
> = ...

Gets a list of cloud accounts connected to a workspace

cloudAccounts: InfiniteQueryObject<
    Omit<
        {
            $type?: "CustomCloud"
            | "CloudServices";
            environment?: string;
            filter?: string;
            jwtToken: JwtToken;
            page?: number;
            pageSize?: number;
            sortBy?: string;
            sortOrder?: string;
            status?:
                | "Connecting"
                | "Connected"
                | "Disconnected"
                | "Failed"
                | "Unknown";
        },
        "authorization"
        | "jwtToken",
    > & {},
    PaginatedResourceCloudAccountResponse,
    "data",
> = ...

Lists all cloud accounts according to the parameters (paginated).

createCloudAccount: MutationObject<
    Omit<
        {
            connectAccountRequestV2: ConnectAccountRequestV2;
            jwtToken: JwtToken;
            stackspotCustomerIp?: string;
        },
        "jwtToken"
        | "connectAccountRequestV2",
    > & { connectAccountRequestV2: FixedConnectAccountRequestV2 },
    CloudAccountDetails,
> = ...

Creates a cloud account.

createCloudServicesAccount: MutationObject<
    Omit<
        {
            jwtToken: JwtToken;
            managedAccountProvisionRequest: ManagedAccountProvisionRequest;
            stackspotCustomerIp?: string;
        },
        "jwtToken"
        | "managedAccountProvisionRequest",
    > & { managedAccountProvisionRequest: FixedManagedAccountProvisionRequest },

        | "100 CONTINUE"
        | "101 SWITCHING_PROTOCOLS"
        | "102 PROCESSING"
        | "103 EARLY_HINTS"
        | "103 CHECKPOINT"
        | "200 OK"
        | "201 CREATED"
        | "202 ACCEPTED"
        | "203 NON_AUTHORITATIVE_INFORMATION"
        | "204 NO_CONTENT"
        | "205 RESET_CONTENT"
        | "206 PARTIAL_CONTENT"
        | "207 MULTI_STATUS"
        | "208 ALREADY_REPORTED"
        | "226 IM_USED"
        | "300 MULTIPLE_CHOICES"
        | "301 MOVED_PERMANENTLY"
        | "302 FOUND"
        | "302 MOVED_TEMPORARILY"
        | "303 SEE_OTHER"
        | "304 NOT_MODIFIED"
        | "305 USE_PROXY"
        | "307 TEMPORARY_REDIRECT"
        | "308 PERMANENT_REDIRECT"
        | "400 BAD_REQUEST"
        | "401 UNAUTHORIZED"
        | "402 PAYMENT_REQUIRED"
        | "403 FORBIDDEN"
        | "404 NOT_FOUND"
        | "405 METHOD_NOT_ALLOWED"
        | "406 NOT_ACCEPTABLE"
        | "407 PROXY_AUTHENTICATION_REQUIRED"
        | "408 REQUEST_TIMEOUT"
        | "409 CONFLICT"
        | "410 GONE"
        | "411 LENGTH_REQUIRED"
        | "412 PRECONDITION_FAILED"
        | "413 PAYLOAD_TOO_LARGE"
        | "413 REQUEST_ENTITY_TOO_LARGE"
        | "414 URI_TOO_LONG"
        | "414 REQUEST_URI_TOO_LONG"
        | "415 UNSUPPORTED_MEDIA_TYPE"
        | "416 REQUESTED_RANGE_NOT_SATISFIABLE"
        | "417 EXPECTATION_FAILED"
        | "418 I_AM_A_TEAPOT"
        | "419 INSUFFICIENT_SPACE_ON_RESOURCE"
        | "420 METHOD_FAILURE"
        | "421 DESTINATION_LOCKED"
        | "422 UNPROCESSABLE_ENTITY"
        | "423 LOCKED"
        | "424 FAILED_DEPENDENCY"
        | "425 TOO_EARLY"
        | "426 UPGRADE_REQUIRED"
        | "428 PRECONDITION_REQUIRED"
        | "429 TOO_MANY_REQUESTS"
        | "431 REQUEST_HEADER_FIELDS_TOO_LARGE"
        | "451 UNAVAILABLE_FOR_LEGAL_REASONS"
        | "500 INTERNAL_SERVER_ERROR"
        | "501 NOT_IMPLEMENTED"
        | "502 BAD_GATEWAY"
        | "503 SERVICE_UNAVAILABLE"
        | "504 GATEWAY_TIMEOUT"
        | "505 HTTP_VERSION_NOT_SUPPORTED"
        | "506 VARIANT_ALSO_NEGOTIATES"
        | "507 INSUFFICIENT_STORAGE"
        | "508 LOOP_DETECTED"
        | "509 BANDWIDTH_LIMIT_EXCEEDED"
        | "510 NOT_EXTENDED"
        | "511 NETWORK_AUTHENTICATION_REQUIRED",
> = ...

Provisions managed accounts in a workspace.

deleteAllCloudAccounts: MutationObject<
    Omit<
        {
            jwtToken: JwtToken;
            stackspotCustomerIp?: string;
            workspaceId: string;
        },
        "authorization"
        | "jwtToken",
    > & {},
    DeleteCloudAccountResponse,
> = ...

Deletes all accounts in a workspace.

deleteCloudAccount: MutationObject<
    Omit<
        { id: string; jwtToken: JwtToken; stackspotCustomerIp?: string },
        "authorization" | "jwtToken",
    > & {},
    DeleteCloudAccountResponse,
> = ...

Deletes a cloud account.

managedAccountTemplates: QueryObject<void, ManagedAccountTemplateResponse[]> = ...

Gets all available templates for the managed Cloud Account.

managesAccountRegions: QueryObject<void, ManagedAccountRegionResponse[]> = ...

Gets all the available regions for the managed Cloud Account.

workflowByWorkspace: QueryObject<
    Omit<
        { jwtToken: JwtToken; workspaceId: string },
        "authorization" | "jwtToken",
    > & {},
    Workflow,
> = ...

Gets the cloud account workflow of a workspace environment

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