Options
All
  • Public
  • Public/Protected
  • All
Menu

JS SDK for building backends with Foxy Hypermedia API. Hypermedia API is designed to give you complete control over all aspects of your Foxy accounts, whether working with a single store or automating the provisioning of thousands. Anything you can do within the Foxy administration, you can also do through the API. This means that you can embed Foxy into any application (CMS, LMS, CRM, etc.) and expose as much or as little of Foxy's functionality as desired.

Hierarchy

Index

Constructors

Properties

_cache: Storage

Resolver cache implementing Web Storage API.

_console: Consola

Shared Consola instance.

_fetch: ((input: RequestInfo, init?: RequestInit) => Promise<Response>)

Custom Fetch API implementation for making authenticated requests.

Type declaration

_path: CurieChain

Path to this resource node as base URL followed by a list of curies.

base: URL

Bookmark URL for this API. This is where the tree traversal begins. We also use this URL as a base for relative paths.

cache: Storage

Resolver cache implementing Web Storage API. Every resolved path will be stored here for future use. You can clear this cache by calling clear().

clientId: string
clientSecret: string
console: Consola

Consola instance. If you extend this class and add logging in your code, use this instead of native console.

refreshToken: string
storage: Storage

Credentials storage implementing Web Storage API. Access tokens and other related info will be stored here. Clearing this storage will log you out.

version: "1"
ACCESS_TOKEN: "access_token" = 'access_token'
AuthError: typeof AuthError = AuthError
BASE_URL: URL = ...
Node: typeof Node = Node
REFRESH_THRESHOLD: number = ...
ResolutionError: typeof ResolutionError = ResolutionError
Response: typeof Response = Response
VERSION: "1" = '1'
WHATWGHeaders: { prototype: Headers } = Headers

Polyfilled version of the built-in Headers class. If you need to pass an instance of Headers to .fetch(), use this class instead of the built-in one to avoid this issue.

Type declaration

  • prototype: Headers
WHATWGRequest: { prototype: Request } = Request

Polyfilled version of the built-in Request class. If you need to pass an instance of Request to .fetch(), use this class instead of the built-in one to avoid this issue.

Type declaration

WHATWGResponse: { prototype: Response; error: any; redirect: any } = Response

Polyfilled version of the built-in Response class. If you need to check the return value of .fetch(), use this class instead of the built-in one to avoid this issue.

Type declaration

  • prototype: Response
  • error:function
    • Returns Response

  • redirect:function
    • redirect(url: string, status?: number): Response
    • Parameters

      • url: string
      • Optional status: number

      Returns Response

v8n: { classConstructor: any; getAccessToken: any } = ...

Type declaration

  • classConstructor: any
  • getAccessToken: any
whatwgFetch: ((input: RequestInfo, init?: RequestInit) => Promise<Response>) = fetch

Type declaration

Methods

  • _resolve(): Promise<URL>
  • Resolves resource URL from a curie chain. The first element in the path must be a URL.

    throws

    Throws {@link APIResolutionError} when once of the resources can't be reached.

    Returns Promise<URL>

    Resolved URL.

  • Resource path builder. Calling this method instructs our SDK to find the provided curie in this resource's links and navigate to its location on request.

    Type Parameters

    • C extends "self" | "fx:property_helpers" | "fx:reporting" | "fx:encode" | "fx:stores" | "fx:store" | "fx:token" | "fx:user"

    Parameters

    • curie: C

      Curie to follow.

    Returns Node<{ fx:encode: Encode; fx:property_helpers: PropertyHelpers; fx:reporting: Reporting; fx:store: Backend.Rels.Store; fx:stores: Stores; fx:token: never; fx:user: User; self: Backend.Graph }[C]>

    Instance of {@link APINode} representing the resource at curie location.

  • Resolves the URL of this node and sends a GET request using provided parameters.

    Returns Promise<Response<Backend.Graph, undefined>>

    Instance of {@link APIResponse} representing this resource.

  • Resolves the URL of this node and sends a GET request using provided parameters.

    Type Parameters

    Parameters

    • query: Q

      Query parameters such as zoom, fields etc.

    Returns Promise<Response<Backend.Graph, Q>>

    Instance of {@link APIResponse} representing this resource.

  • Resolves the URL of this node and sends a PATCH request with provided properties, updating this resource.

    Parameters

    • Optional body: Partial<{ message: string }>

      Partial resource object.

    Returns Promise<Response<Backend.Graph, undefined>>

    Instance of {@link APIResponse} representing this resource.

  • Resolves the URL of this node and sends a POST request with provided properties, creating a resource or triggering an action.

    Parameters

    • Optional body: { message: string }

      Complete resource object.

      • message: string

        A small, human readable explanation of this resource.

    Returns Promise<Response<Backend.Graph, undefined>>

    Instance of {@link APIResponse} representing this resource.

  • Resolves the URL of this node and sends a PUT request with provided properties, replacing the existing resource.

    Parameters

    • Optional body: { message: string }

      Complete resource object.

      • message: string

        A small, human readable explanation of this resource.

    Returns Promise<Response<Backend.Graph, undefined>>

    Instance of {@link APIResponse} representing this resource.

Generated using TypeDoc