Hierarchy

  • ReactQueryNetworkClient
    • WorkspaceSearchClient

Constructors

Properties

clearAllUserHistory: MutationObject<void, unknown> = ...

Clears users history

clearEntryInUserHistory: MutationObject<{ itemId: string }, unknown> = ...

Clears a specific entry in users history

search: InfiniteQueryObject<
    { category?: string; page?: number; q: string },
    SearchResponse,
    "content",
> = ...

Gets search data

searchHistory: QueryObject<void, SearchHistoryResponse> = ...

Gets search history

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