This is the request handler for Bruce Api, it should be passed to any method that wants to communicate with this particular api.

Hierarchy

Constructors

  • Parameters

    • params: {
          accountId: string;
          env?: string;
          guardian?: GuardianApi.Api;
          loadConfig?: boolean;
          loadRegionalBaseUrl?: boolean;
          loadWebSocket?: boolean;
      }
      • accountId: string
      • Optional env?: string
      • Optional guardian?: GuardianApi.Api
      • Optional loadConfig?: boolean
      • Optional loadRegionalBaseUrl?: boolean
      • Optional loadWebSocket?: boolean

    Returns BruceApi.Api

Properties

Cache: CacheControl<any>
EntityCdnUrl: string
LegacyTilesetCdnUrl: string
TilesetCdnUrl: string
accountId: string
baseUrl: string = ""
cdnBaseUrl: string
env: string
loadCancelled: boolean = false
loadProm: Promise<void>
messageBroker: IBroker

Accessors

Methods

  • Returns a url routed through the API's CDN. If the CDN is not enabled for the account, this will return null.

    Parameters

    • url: string

      suffix to append to the base url.

    • Optional urlParams: URLSearchParams

    Returns string

  • Performs an HTTP DELETE request. This will prepend the base url to the url.

    Parameters

    Returns Promise<any>

  • Performs an HTTP GET request. This will prepend the base url to the url.

    Parameters

    Returns Promise<any>

  • Warning: This method does not wait for init to finish loading. This means the url could be changed once fully initialized. The url will be valid either way, but the loaded one may be faster as it is region specific. Await the "Loading" promise if you care about this.

    Returns string

  • Returns a cache item matching the provided key. If the reqParams specify that caching is disabled, null is returned.

    Parameters

    Returns {
        data: any;
        found: boolean;
    }

    • data: any
    • found: boolean
  • Warning: Wait the "Loading" promise before using this url.

    Returns string

  • Performs an HTTP POST request. This will prepend the base url to the url.

    Parameters

    • url: string
    • data: any
    • Optional params: IReqParams

    Returns Promise<any>

  • Performs an HTTP PUT request. This will prepend the base url to the url.

    Parameters

    • url: string
    • data: any
    • Optional params: IReqParams

    Returns Promise<any>

  • Warning: This will cancel the init process. The init process loads a region specific endpoint. Setting a base url will stop that process from completing.

    Parameters

    • url: string

    Returns void

  • Sets a cache item matching the provided key. If the reqParams specify that caching is disabled, then no action is taken.

    Parameters

    • params: {
          duration?: number;
          key: string;
          req?: IReqParams;
          value: any;
      }
      • Optional duration?: number
      • key: string
      • Optional req?: IReqParams
      • value: any

    Returns void

  • Performs a file upload request (HTTP POST). This will prepend the base url to the url.

    Parameters

    Returns Promise<any>

  • Performs a DELETE request. This will NOT prepend the base URL to the provided URL.

    Parameters

    Returns Promise<any>

  • Performs a GET request. This will NOT prepend the base URL to the provided URL.

    Parameters

    Returns Promise<any>

  • Loads regional base url and sets up message broker.

    Parameters

    • Optional guardian: GuardianApi.Api

      Required for loading regional base url.

    • Optional loadConfig: boolean
    • Optional loadWebSocket: boolean

    Returns Promise<void>

  • post(url, data, params?): Promise<any>
  • Performs a POST request. This will NOT prepend the base URL to the provided URL.

    Parameters

    • url: string
    • data: any
    • Optional params: IReqParams

    Returns Promise<any>

  • Performs a PUT request. This will NOT prepend the base URL to the provided URL.

    Parameters

    • url: string
    • data: any
    • Optional params: IReqParams

    Returns Promise<any>

  • Performs a file upload (POST) request. This will NOT prepend the base URL to the provided URL.

    Parameters

    Returns Promise<any>

Generated using TypeDoc