StApps-API client

### Hierarchy

- Client
  - ConnectorClient

## Index

### Constructors

- constructor

### Properties

- feedbackRoute
- headers
- httpClient
- indexRoute
- multiSearchRoute
- searchRoute
- url
- version

### Methods

- feedback
- getThing
- handshake
- invokeRoute
- multiSearch
- search
- searchNext
- nextWindow

## Constructors

### constructor

- new Client(httpClient: HttpClientInterface, url: string, version?: undefined | string): Client

- - Defined in src/client.ts:89

  Instantiate a new StApps-API client to communicate with a StApps-backend.

  #### Parameters

  - ##### httpClient: HttpClientInterface

    HTTP client to use

  - ##### url: string

    URL of the backend

  - ##### Optional version: undefined | string

    App version to use when requesting data (only necessary if URL is ambiguous)

    TODO: remove headers/version

  #### Returns Client

## Properties

### Private feedbackRoute

feedbackRoute: SCFeedbackRoute = new SCFeedbackRoute()

- Defined in src/client.ts:44

Instance of feedback request route

### Protected headers

headers: HttpClientHeaders

- Defined in src/client.ts:66

Default headers

TODO: remove headers

### Protected httpClient

httpClient: HttpClientInterface

- Defined in src/client.ts:100

HTTP client to use

### Private indexRoute

indexRoute: SCIndexRoute = new SCIndexRoute()

- Defined in src/client.ts:49

Instance of index route

### Private multiSearchRoute

multiSearchRoute: SCMultiSearchRoute = new SCMultiSearchRoute()

- Defined in src/client.ts:54

Instance of multi search request route

### Private searchRoute

searchRoute: SCSearchRoute = new SCSearchRoute()

- Defined in src/client.ts:59

Instance of search request route

### Protected url

url: string

- Defined in src/client.ts:100

URL of the backend

### Protected Optional version

version: undefined | string

- Defined in src/client.ts:100

App version to use when requesting data (only necessary if URL is ambiguous)

TODO: remove headers/version

## Methods

### feedback

- feedback(feedback: SCFeedbackRequest): Promise<SCFeedbackResponse>

- - Defined in src/client.ts:117

  Send feedback

  #### Parameters

  - ##### feedback: SCFeedbackRequest

    Feedback to send

  #### Returns Promise<SCFeedbackResponse>

### getThing

- getThing(uid: string): Promise<SCThings>

- - Defined in src/client.ts:126

  Get a thing by its UID

  #### Parameters

  - ##### uid: string

    UID of the thing to fetch

  #### Returns Promise<SCThings>

### handshake

- handshake(coreVersion: string): Promise<SCIndexResponse>

- - Defined in src/client.ts:150

  Make a handshake with the backend and check StAppsCore version

  #### Parameters

  - ##### coreVersion: string

    StAppsCore version to check

  #### Returns Promise<SCIndexResponse>

### invokeRoute

- invokeRoute<T>(route: SCAbstractRoute, parameters?: undefined | object, body?: SCRequests): Promise<T>

- - Defined in src/client.ts:169

  Invoke a route

  #### Type parameters

  - #### T

  #### Parameters

  - ##### route: SCAbstractRoute

    Route to invoke

  - ##### Optional parameters: undefined | object

    Parameters for the URL fragment

  - ##### Optional body: SCRequests

    Body for the request

  #### Returns Promise<T>

### multiSearch

- multiSearch(multiSearchRequest: SCMultiSearchRequest): Promise<SCMultiSearchResponse>

- - Defined in src/client.ts:195

  Send a multi search request to the backend

  All results will be returned for requests where no size is set.

  #### Parameters

  - ##### multiSearchRequest: SCMultiSearchRequest

    Multi search request

  #### Returns Promise<SCMultiSearchResponse>

### search

- search(searchRequest: SCSearchRequest): Promise<SCSearchResponse>

- - Defined in src/client.ts:242

  Send a search request to the backend

  All results will be returned if no size is set in the request.

  #### Parameters

  - ##### searchRequest: SCSearchRequest

    Search request

  #### Returns Promise<SCSearchResponse>

### searchNext

- searchNext(searchRequest: SCSearchRequest, searchResponse: SCSearchResponse): Promise<object>

- - Defined in src/client.ts:266

  Get the next search results

  #### Parameters

  - ##### searchRequest: SCSearchRequest

    Last search request

  - ##### searchResponse: SCSearchResponse

    Search response for supplied search request

  #### Returns Promise<object>

### Static nextWindow

- nextWindow(searchRequest: SCSearchRequest, searchResponse: SCSearchResponse): SCSearchRequest

- - Defined in src/client.ts:75

  Create a new search request with altered pagination parameters to move to the next result window

  throws

    OutOfRangeError Throws an error if the next window is beyond the total number of results

  #### Parameters

  - ##### searchRequest: SCSearchRequest

    Last search request

  - ##### searchResponse: SCSearchResponse

    Search response for supplied search request

  #### Returns SCSearchRequest

Generated using TypeDoc