Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Node<TGraph>

Base class representing a resource node that can be fetched, created, updated or deleted. You shouldn't need to create instances of this class unless you're building a custom API client with our SDK.

Type Parameters

Hierarchy

Index

Constructors

Properties

_cache: Storage

Resolver cache implementing Web Storage API.

_console: Consola

Shared Consola instance.

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

Type declaration

_path: CurieChain

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

ResolutionError: typeof ResolutionError = ResolutionError
Response: typeof Response = Response
v8n: Record<string, V8N> = ...

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.

  • delete(): Promise<Response<TGraph, undefined>>
  • Resolves the URL of this node and sends a DELETE request, removing this resource.

    Returns Promise<Response<TGraph, undefined>>

    Instance of {@link APIResponse} representing this resource.

  • follow<C>(curie: C): Node<TGraph["links"][C]>
  • 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 string | number | symbol

    Parameters

    • curie: C

      Curie to follow.

    Returns Node<TGraph["links"][C]>

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

  • get(): Promise<Response<TGraph, undefined>>
  • get<Q>(query: Q): Promise<Response<TGraph, Q>>
  • Resolves the URL of this node and sends a GET request using provided parameters.

    Returns Promise<Response<TGraph, undefined>>

    Instance of {@link APIResponse} representing this resource.

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

    Type Parameters

    • Q extends Query<TGraph, Q>

    Parameters

    • query: Q

      Query parameters such as zoom, fields etc.

    Returns Promise<Response<TGraph, Q>>

    Instance of {@link APIResponse} representing this resource.

  • patch(body?: Partial<TGraph["props"]>): Promise<Response<TGraph, undefined>>
  • Resolves the URL of this node and sends a PATCH request with provided properties, updating this resource.

    Parameters

    • Optional body: Partial<TGraph["props"]>

      Partial resource object.

    Returns Promise<Response<TGraph, undefined>>

    Instance of {@link APIResponse} representing this resource.

  • post(body?: TGraph["props"]): Promise<Response<TGraph, undefined>>
  • Resolves the URL of this node and sends a POST request with provided properties, creating a resource or triggering an action.

    Parameters

    • Optional body: TGraph["props"]

      Complete resource object.

    Returns Promise<Response<TGraph, undefined>>

    Instance of {@link APIResponse} representing this resource.

  • put(body?: TGraph["props"]): Promise<Response<TGraph, undefined>>
  • Resolves the URL of this node and sends a PUT request with provided properties, replacing the existing resource.

    Parameters

    • Optional body: TGraph["props"]

      Complete resource object.

    Returns Promise<Response<TGraph, undefined>>

    Instance of {@link APIResponse} representing this resource.

Generated using TypeDoc