Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Base class in Coolio http package, which allows to perform API calls.
▪ T
HttpClient
+ new HttpClient(config
: HttpClientConfig‹T›): HttpClient
Defined in packages/http/src/httpClient.ts:122
Parameters:
Name
Type
config
Returns: HttpClient
▸ addInterceptor(interceptor
: HttpInterceptor): this
Defined in packages/http/src/httpClient.ts:148
Adds an interceptor to the client. Interceptor can be written either as class or as a function, which may mutate request options and post-process response from server. Multiple interceptors can be added to a single HttpClient. They can perform as:
cache
error handler
authorizer
logger
auto-retry
redirection handler
Parameters:
Name
Type
Description
interceptor
Interceptor that will process every request/response in this HttpClient.
Returns: this
▸ delete<Body>(uri
: string, options?
: HttpOptions): Promise‹HttpResponse‹Body››
Defined in packages/http/src/httpClient.ts:212
Performs a DELETE request.
Type parameters:
▪ Body: T
Parameters:
Name
Type
Description
uri
string
Address of HTTP endpoint
options?
Returns: Promise‹HttpResponse‹Body››
▸ get<Body>(uri
: string, options?
: HttpOptions): Promise‹HttpResponse‹Body››
Defined in packages/http/src/httpClient.ts:159
Performs a GET request.
Type parameters:
▪ Body: T
Parameters:
Name
Type
Description
uri
string
Address of HTTP endpoint
options?
Returns: Promise‹HttpResponse‹Body››
▸ patch<Body>(uri
: string, options?
: HttpOptions): Promise‹HttpResponse‹Body››
Defined in packages/http/src/httpClient.ts:199
Performs a PATCH request.
Type parameters:
▪ Body: T
Parameters:
Name
Type
Description
uri
string
Address of HTTP endpoint
options?
Returns: Promise‹HttpResponse‹Body››
▸ post<Body>(uri
: string, options?
: HttpOptions): Promise‹HttpResponse‹Body››
Defined in packages/http/src/httpClient.ts:173
Performs a POST request.
Type parameters:
▪ Body: T
Parameters:
Name
Type
Description
uri
string
Address of HTTP endpoint
options?
Returns: Promise‹HttpResponse‹Body››
▸ put<Body>(uri
: string, options?
: HttpOptions): Promise‹HttpResponse‹Body››
Defined in packages/http/src/httpClient.ts:186
Performs a PUT request.
Type parameters:
▪ Body: T
Parameters:
Name
Type
Description
uri
string
Address of HTTP endpoint
options?
Returns: Promise‹HttpResponse‹Body››
▸ remove<Body>(uri
: string, options?
: HttpOptions): Promise‹HttpResponse‹any››
Defined in packages/http/src/httpClient.ts:227
Performs a DELETE request.
Type parameters:
▪ Body: T
Parameters:
Name
Type
Description
uri
string
Address of HTTP endpoint
options?
Returns: Promise‹HttpResponse‹any››
▸ request<Body>(url
: string, options
: HttpRequestOptions): Promise‹HttpResponse‹Body››
Defined in packages/http/src/httpClient.ts:229
Type parameters:
▪ Body: T
Parameters:
Name
Type
url
string
options
Returns: Promise‹HttpResponse‹Body››
▪ T
↳ HttpRequestError
+ new HttpRequestError(options
: NormalizedHttpOptions, message?
: undefined | string): HttpRequestError
Defined in packages/http/src/httpRequestError.ts:6
Parameters:
Name
Type
options
message?
undefined | string
Returns: HttpRequestError
• message: string
Inherited from HttpRequestError.message
Defined in node_modules/typescript/lib/lib.es5.d.ts:974
• name: string
Inherited from HttpRequestError.name
Defined in node_modules/typescript/lib/lib.es5.d.ts:973
• options: NormalizedHttpOptions
Defined in packages/http/src/httpRequestError.ts:8
Optional
stack• stack? : undefined | string
Inherited from HttpRequestError.stack
Overrides HttpRequestError.stack
Defined in node_modules/typescript/lib/lib.es5.d.ts:975
Static
Error▪ Error: ErrorConstructor
Defined in node_modules/typescript/lib/lib.es5.d.ts:984
Networking client for Node.js, React Native & browser web apps
Coolio is an environment-agnostic networking client for Node.js, React Native & browser web apps. The aim of Coolio is to abstract out the technical stuff and let developers query APIs in DRY manner. Usually such approach makes simple things easier while making complex use-cases impossible. Coolio gives users more control over networking, allowing to customize almost every step of it's networking pipeline:
sending and handling requests,
body normalization,
pre and postprocessing.
This is achieved by using interceptors concept and providing pluggable interfaces whenever possible.
Coolio is broken down into several packages, allowing you to pick what's really needed.
Package
Description
Auth Interceptor with OAuth2 refresh token support for @coolio/http
HTTP networking client
JSON API client
Most important yarn
scripts during development:
start
- runs builds for all packages in watch mode
verify
- runs lint & tests
Interceptors allow us to perform actions before request happens, after it happens, retry the request multiple times or even totally ignore it and serve content in a different way (i.e. serve content from in-memory cache).
The concept of interceptors should sound familiar to you if you ever used or .
A simple HTTP client for web apps. Supports interceptors & global configuration.
Installation:
Initialize a HttpClient and configure it as below:
Use the client in repositories containing API bindings:
After doing the following, you can simply call UserRepository.getProfile()
to receive the Promise returning User
object.
Quite often we need to do something "in-between" while our API requests are running. This is why we have a built-in interceptors mechanism. They can:
throw errors if response status code indicates that request failed,
automagically retry request up to X times if it failed,
transparently reauthorize if your access token has been revoked
The first case is described below:
As you can see, interceptors accept two arguments:
HttpFetch
- a function that returns a Promise that performs http request. It allows to queue or delay multiple requests, retry them etc.
NormalizedHttpOptions
- options that can be modified before request is made, i.e. you can add Authorization
header in your authInterceptor
.
If you happen to use JSON API, you may benefit from using a wrapper library that handles most of it's specs:
All notable changes to this project will be documented in this file. See for commit guidelines.
Note: Version bump only for package coolio
oauth2interceptor: token-type can be optional ()
Note: Version bump only for package coolio
timeout support: full timeout support for all request handlers ()
url-encoding: url string has now bigger priority than query passed in object, which results in better composability (parameters from url are always merged into object)
Note: Version bump only for package coolio
Note: Version bump only for package coolio
▪ T
↳ HttpResponseError
Parameters:
• message: string
Defined in node_modules/typescript/lib/lib.es5.d.ts:974
• name: string
Defined in node_modules/typescript/lib/lib.es5.d.ts:973
Optional
stack• stack? : undefined | string
Defined in node_modules/typescript/lib/lib.es5.d.ts:975
Static
Error▪ Error: ErrorConstructor
Defined in node_modules/typescript/lib/lib.es5.d.ts:984
‹T›
Additional passed with request
Additional passed with request
Additional passed with request
Additional passed with request
Additional passed with request
Additional passed with request
See for details.
+ new HttpResponseHeaders(headers
: IncomingHttpHeaders | | Headers | string):
Defined in
Returns:
Defined in
Defined in
Defined in
types: properly arranged types for typescript<3.7 ()
clean: clean should not remove node_modules ()
typings: using downlevel-dts to bring back TS<3.7 support ()
build: removed redundant setup file ()
request-handlers: all request handlers are available from bindings ()
url-encoding: url string should override query passed in object ()
case-conversion: body casing enum has now string names ()
http-module: exposed request-handlers separately ()
query-string-options: one can configure query string options ()
redirection-interceptor: built-in support for redirections ()
redirections: redirection support ()
encoding: fix for invalid body encoding issue ()
http-request-handler: removed duplicated helpers ()
http-request-handler: moved to a separate package ()
json-api: added withId functionality to post builder ()
http: fix for headers being overwritten ()
http: body cache fix ()
http-request-handler: fix for node.js path/query support ()
http: native request handler for node.js ()
auth-interceptor: class-based queue & auth-interceptor ()
auth-interceptor: initial implementation of auth interceptor ()
http-interceptors: built-in error interceptor ()
http-interceptors: built-in logging interceptor ()
github actions: fixed invalid path ()
action: workspace fix ()
release: retry npm publish ()
token: use regular token ()
release: combine publishing in one flow ()
release: separate tag from publish ()
build: build & vulnerability fix ()
release: added git credentials ()
release: invalid command args ()
workflow: yet another release fix ()
workflows: run release with yarn, but use npm underneath ()
build: build & vulnerability fix ()
dependencies: dependency update ()
dependency: dependency fixes ()
json-api: new syntax for passing multiple square-bracketed keys to filter in json api ()
+ new HttpResponseError(response
: ‹T›, message?
: undefined | string):
Defined in
Returns:
Inherited from .
Inherited from .
• response: ‹T›
Defined in
Inherited from .
Overrides .
• status:
Defined in
Parameter
Required
Description
baseUrl
no
Base path for making all relative requests.
requestHandler
yes
Abstraction layer for the standard fetch
mechanism or any other transport you can think of. By default you can use fetchRequestHandler
, which uses fetch
underneath. You can also use built-in mockRequestHandler
for testing purposes or httpRequestHandler
from @coolio/http-request-handler
.
defaultHeadersProvider
no
Function returning common headers for all request sent by your client. Host argument can be used to pass authorization data, but only for specific domain.
bodyParser
no
Adds a custom parser that processes the response body. Parsed body can be always accessed via parsedBody
Promise in HttpResponse
. By default it returns an ArrayBuffer
. If you pass the standard bodyParser
, it will decode JSON, URL-encoded body and plain text responses. It also supports case conversion, which is useful if your API returns responses in a convention that doesn't match your needs.
bodySerializer
no
Adds a custom serializer that can process body before sending. It supports case conversion.
Name
Type
Default
headers
IncomingHttpHeaders | HttpHeaders | Headers | string
{}
Name
Type
key
string
Name
Type
key
string
value
any
Name
Type
response
HttpResponse‹T›
message?
undefined | string
• JSON: = "application/json"
Defined in packages/http/src/contentType.ts:3
• TEXT: = "text/plain"
Defined in packages/http/src/contentType.ts:2
• URL_ENCODED: = "application/x-www-form-urlencoded"
Defined in packages/http/src/contentType.ts:5
• VND_JSON: = "application/vnd.api+json"
Defined in packages/http/src/contentType.ts:4
• CAMEL_CASE: = "CAMEL_CASE"
Defined in packages/http/src/helpers/caseConversion.helper.ts:5
• KEBAB_CASE: = "KEBAB_CASE"
Defined in packages/http/src/helpers/caseConversion.helper.ts:8
• PASCAL_CASE: = "PASCAL_CASE"
Defined in packages/http/src/helpers/caseConversion.helper.ts:7
• SNAKE_CASE: = "SNAKE_CASE"
Defined in packages/http/src/helpers/caseConversion.helper.ts:6
CreateSimpleServerParams
• endpoints: SimpleEndpoint[]
Defined in packages/http/src/testing/createSimpleServer.helper.ts:15
• headers: OutgoingHttpHeaders
Defined in packages/http/src/testing/createSimpleServer.helper.ts:14
• status: number
Defined in packages/http/src/testing/createSimpleServer.helper.ts:13
BodySerializerOptions
Optional
bodyCasing• bodyCasing? : BodyCasing
Defined in packages/http/src/bodySerializer.ts:10
BodyParserOptions
Optional
bodyCasing• bodyCasing? : BodyCasing
Defined in packages/http/src/bodyParser.ts:9
Optional
defaultParser• defaultParser? : BodyParserImplementation
Defined in packages/http/src/bodyParser.ts:10
• ACCEPTED: = 202
Defined in packages/http/src/httpCodes.ts:6
• BAD_GATEWAY: = 502
Defined in packages/http/src/httpCodes.ts:45
• BAD_REQUEST: = 400
Defined in packages/http/src/httpCodes.ts:18
• CONFLICT: = 409
Defined in packages/http/src/httpCodes.ts:26
• CONTINUE: = 100
Defined in packages/http/src/httpCodes.ts:2
• CREATED: = 201
Defined in packages/http/src/httpCodes.ts:5
• EXPECTATION_FAILED: = 417
Defined in packages/http/src/httpCodes.ts:34
• FORBIDDEN: = 403
Defined in packages/http/src/httpCodes.ts:20
• FOUND: = 302
Defined in packages/http/src/httpCodes.ts:13
• GATEWAY_TIMEOUT: = 504
Defined in packages/http/src/httpCodes.ts:47
• GONE: = 410
Defined in packages/http/src/httpCodes.ts:27
• HTTP_VERSION_NOT_SUPPORTED: = 505
Defined in packages/http/src/httpCodes.ts:48
• IM_A_TEAPOT: = 418
Defined in packages/http/src/httpCodes.ts:35
• INTERNAL_SERVER_ERROR: = 500
Defined in packages/http/src/httpCodes.ts:43
• LENGTH_REQUIRED: = 411
Defined in packages/http/src/httpCodes.ts:28
• METHOD_NOT_ALLOWED: = 405
Defined in packages/http/src/httpCodes.ts:22
• MOVED_PERMANENTLY: = 301
Defined in packages/http/src/httpCodes.ts:12
• MULTIPLE_CHOICES: = 300
Defined in packages/http/src/httpCodes.ts:11
• NETWORK_AUTHENTICATION_REQUIRED: = 511
Defined in packages/http/src/httpCodes.ts:49
• NONAUTHORITATIVE_INFORMATION: = 203
Defined in packages/http/src/httpCodes.ts:7
• NOT_ACCEPTABLE: = 406
Defined in packages/http/src/httpCodes.ts:23
• NOT_FOUND: = 404
Defined in packages/http/src/httpCodes.ts:21
• NOT_IMPLEMENTED: = 501
Defined in packages/http/src/httpCodes.ts:44
• NOT_MODIFIED: = 304
Defined in packages/http/src/httpCodes.ts:15
• NO_CONTENT: = 204
Defined in packages/http/src/httpCodes.ts:8
• OK: = 200
Defined in packages/http/src/httpCodes.ts:4
• PARTIAL_CONTENT: = 206
Defined in packages/http/src/httpCodes.ts:10
• PAYLOAD_TOO_LARGE: = 413
Defined in packages/http/src/httpCodes.ts:30
• PERMANENT_REDIRECT: = 308
Defined in packages/http/src/httpCodes.ts:17
• PRECONDITION_FAILED: = 412
Defined in packages/http/src/httpCodes.ts:29
• PRECONDITION_REQUIRED: = 428
Defined in packages/http/src/httpCodes.ts:39
• PROXY_AUTHENTICATION_REQUIRED: = 407
Defined in packages/http/src/httpCodes.ts:24
• RANGE_NOT_SATISFIABLE: = 416
Defined in packages/http/src/httpCodes.ts:33
• REQUEST_HEADER_FIELDS_TOO_LARGE: = 431
Defined in packages/http/src/httpCodes.ts:41
• REQUEST_TIMEOUT: = 408
Defined in packages/http/src/httpCodes.ts:25
• RESET_CONTENT: = 205
Defined in packages/http/src/httpCodes.ts:9
• SEE_OTHER: = 303
Defined in packages/http/src/httpCodes.ts:14
• SERVICE_UNAVAILABLE: = 503
Defined in packages/http/src/httpCodes.ts:46
• SWITCHING_PROTOCOLS: = 101
Defined in packages/http/src/httpCodes.ts:3
• TEMPORARY_REDIRECT: = 307
Defined in packages/http/src/httpCodes.ts:16
• TOO_EARLY: = 425
Defined in packages/http/src/httpCodes.ts:37
• TOO_MANY_REQUESTS: = 429
Defined in packages/http/src/httpCodes.ts:40
• UNAUTHORIZED: = 401
Defined in packages/http/src/httpCodes.ts:19
• UNAVAILABLE_FOR_LEGAL_REASONS: = 451
Defined in packages/http/src/httpCodes.ts:42
• UNPROCESSABLE_ENTITY: = 422
Defined in packages/http/src/httpCodes.ts:36
• UNSUPPORTED_MEDIA_TYPE: = 415
Defined in packages/http/src/httpCodes.ts:32
• UPGRADE_REQUIRED: = 426
Defined in packages/http/src/httpCodes.ts:38
• URI_TOO_LONG: = 414
Defined in packages/http/src/httpCodes.ts:31
FetchRequestHandlerOptions
Optional
defaultRequestOptions• defaultRequestOptions? : RequestInit
Defined in packages/http/src/requestHandlers/fetch.requestHandler.ts:7
• FINISHED:
Defined in packages/http/src/helpers/parsedBodyCache.helper.ts:6
• STARTED:
Defined in packages/http/src/helpers/parsedBodyCache.helper.ts:5
• UNINITIALIZED:
Defined in packages/http/src/helpers/parsedBodyCache.helper.ts:4
• DELETE: = "DELETE"
Defined in packages/http/src/httpClient.types.ts:49
• GET: = "GET"
Defined in packages/http/src/httpClient.types.ts:46
• PATCH: = "PATCH"
Defined in packages/http/src/httpClient.types.ts:48
• POST: = "POST"
Defined in packages/http/src/httpClient.types.ts:45
• PUT: = "PUT"
Defined in packages/http/src/httpClient.types.ts:47
HttpInterceptorInterface
▸ onIntercept<Body>(request
: HttpFetch‹Body›, options
: NormalizedHttpOptions): HttpFetch‹Body›
Defined in packages/http/src/httpClient.types.ts:34
Type parameters:
▪ Body
Parameters:
Name
Type
request
options
Returns: HttpFetch‹Body›
Endpoint
• handler: function
Defined in packages/http/src/requestHandlers/mock.requestHandler.ts:29
▸ (request
: NormalizedHttpOptions): Promise‹RawHttpResponse›
Parameters:
Name
Type
request
• match: string | RegExp
Defined in packages/http/src/requestHandlers/mock.requestHandler.ts:28
Ƭ BodyParser: function
Defined in packages/http/src/httpClient.types.ts:23
▸ (response
: RawHttpResponse): HttpResponse‹T›
Parameters:
Name
Type
response
Ƭ BodyParserImplementation: function
Defined in packages/http/src/bodyParser.ts:6
▸ (rawResponse
: RawHttpResponse): Promise‹any›
Parameters:
Name
Type
rawResponse
Ƭ BodySerializer: function
Defined in packages/http/src/httpClient.types.ts:25
▸ (request
: HttpOptions): NormalizedHttpBody
Parameters:
Name
Type
request
Ƭ BufferEncoding: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex"
Defined in packages/http/src/helpers/encoder.helper.ts:5
Ƭ ContentTypeMap: Record‹keyof typeof ContentTypeRegex, T›
Defined in packages/http/src/contentType.ts:14
Ƭ HeadersProvider: function
Defined in packages/http/src/httpClient.ts:27
▸ (host
: string): Promise‹HttpHeaders› | HttpHeaders
Parameters:
Name
Type
host
string
Ƭ HttpBody: object | TypedArray | string
Defined in packages/http/src/httpClient.types.ts:29
Ƭ HttpFetch: function
Defined in packages/http/src/httpClient.types.ts:27
▸ (): Promise‹HttpResponse‹Body››
Ƭ HttpHeaders: Record‹string, string | number | boolean | undefined | null›
Defined in packages/http/src/httpClient.types.ts:31
Ƭ HttpInterceptor: HttpInterceptorFunction | HttpInterceptorInterface
Defined in packages/http/src/httpClient.types.ts:42
Ƭ HttpInterceptorFunction: function
Defined in packages/http/src/httpClient.types.ts:37
▸ <Body>(request
: HttpFetch‹Body›, options
: NormalizedHttpOptions): HttpFetch‹Body›
Type parameters:
▪ Body
Parameters:
Name
Type
request
options
Ƭ HttpOptions: Partial‹HttpRequestOptions›
Defined in packages/http/src/httpClient.types.ts:64
Ƭ HttpRequestHandler: function
Defined in packages/http/src/httpClient.types.ts:79
▸ (requestOptions
: NormalizedHttpOptions): Promise‹RawHttpResponse›
Parameters:
Name
Type
requestOptions
Ƭ MockHttpRequestHandler: HttpRequestHandler & object
Defined in packages/http/src/requestHandlers/mock.requestHandler.ts:36
Ƭ NormalizedHttpBody: string | TypedArray | undefined
Defined in packages/http/src/httpClient.types.ts:66
Ƭ PromiseFunction: function
Defined in packages/http/src/helpers/parsedBodyCache.helper.ts:1
▸ (): Promise‹T›
Ƭ RequestMode: "navigate" | "same-origin" | "no-cors" | "cors"
Defined in packages/http/src/httpClient.types.ts:52
Const
DEFAULT_REQUEST_TIMEOUT_MS• DEFAULT_REQUEST_TIMEOUT_MS: number = 5 60 1000
Defined in packages/http/src/httpClient.ts:25
Default request timeout - 5 minutes.
Const
DONE• DONE: 4 = 4
Defined in packages/http/src/requestHandlers/xhr.requestHandler.ts:7
Const
HEADERS_RECEIVED• HEADERS_RECEIVED: 2 = 2
Defined in packages/http/src/requestHandlers/xhr.requestHandler.ts:6
• TypedArray: any
Defined in packages/http/src/httpClient.types.ts:2
Defined in packages/http/src/helpers/encoder.helper.ts:1
Const
symbol• symbol: unique symbol = Symbol('HttpResponseError')
Defined in packages/http/src/httpRequestError.ts:3
Defined in packages/http/src/httpResponseError.ts:4
Const
bodyParser▸ bodyParser(__namedParameters
: object): (Anonymous function)
Defined in packages/http/src/bodyParser.ts:13
Parameters:
▪Default value
__namedParameters: object= {}
Name
Type
bodyCasing
defaultParser
Returns: (Anonymous function)
Const
bodySerializer▸ bodySerializer(__namedParameters
: object): BodySerializer
Defined in packages/http/src/bodySerializer.ts:13
Parameters:
▪Default value
__namedParameters: object= {}
Name
Type
bodyCasing
Returns: BodySerializer
Const
cacheParsedBody▸ cacheParsedBody<T>(parsedBody
: PromiseFunction‹T›): PromiseFunction‹T›
Defined in packages/http/src/helpers/parsedBodyCache.helper.ts:9
Type parameters:
▪ T
Parameters:
Name
Type
parsedBody
Returns: PromiseFunction‹T›
Const
createAsyncBodyHandler▸ createAsyncBodyHandler<T>(): object
Defined in packages/http/src/requestHandlers/xhr.requestHandler.ts:9
Type parameters:
▪ T
Returns: object
call(): Promise‹T›
onBodyFailure(failer
: function): void
onBodyReceived(getter
: function): void
Const
createErrorInterceptor▸ createErrorInterceptor(): HttpInterceptorFunction
Defined in packages/http/src/interceptors/errorInterceptor.ts:4
Returns: HttpInterceptorFunction
Const
createHttpResponse▸ createHttpResponse(__namedParameters
: object): HttpResponse
Defined in packages/http/src/httpResponse.ts:14
Parameters:
▪ __namedParameters: object
Name
Type
Default
body
undefined | string | Uint8Array‹› | Uint8ClampedArray‹› | Uint16Array‹› | Uint32Array‹› | Int8Array‹› | Int16Array‹› | Int32Array‹› | Float32Array‹› | Float64Array‹›
-
headers
undefined | object
-
status
number
-
url
string
""
Returns: HttpResponse
Const
createLoggingInterceptor▸ createLoggingInterceptor(__namedParameters
: object): HttpInterceptorFunction
Defined in packages/http/src/interceptors/loggingInterceptor.ts:14
Parameters:
▪ __namedParameters: object
Name
Type
logger
function
Returns: HttpInterceptorFunction
Const
createRedirectionInterceptor▸ createRedirectionInterceptor(__namedParameters
: object): HttpInterceptorFunction
Defined in packages/http/src/interceptors/redirectionInterceptor.ts:8
Parameters:
▪Default value
__namedParameters: object= {}
Name
Type
Default
redirectionLimit
number
30
Returns: HttpInterceptorFunction
Const
createSimpleServer▸ createSimpleServer(__namedParameters
: object): SimpleServer
Defined in packages/http/src/testing/createSimpleServer.helper.ts:26
Parameters:
▪ __namedParameters: object
Name
Type
endpoints
headers
OutgoingHttpHeaders
status
number
Returns: SimpleServer
Const
deepKeyMap▸ deepKeyMap(object
: any, mapper
: function): any
Defined in packages/http/src/helpers/caseConversion.helper.ts:15
Parameters:
▪ object: any
▪ mapper: function
▸ (key
: string): string
Parameters:
Name
Type
key
string
Returns: any
Const
defaultHeaders▸ defaultHeaders(_host
: string): object
Defined in packages/http/src/helpers/httpClient.helper.ts:4
Parameters:
Name
Type
Default
_host
string
""
Returns: object
Accept: string = "application/json,application/vnd.api+json"
Content-Type: ContentType = ContentType.JSON
Const
encodeArrayBuffer▸ encodeArrayBuffer(data
: TypedArray | string | undefined, encoding
: BufferEncoding): Uint8Array‹›
Defined in packages/http/src/helpers/encoder.helper.ts:31
Parameters:
Name
Type
Default
data
""
encoding
"utf8"
Returns: Uint8Array‹›
Const
encodeText▸ encodeText(buffer
: ArrayBuffer, encoding
: string): string
Defined in packages/http/src/helpers/encoder.helper.ts:36
Parameters:
Name
Type
Default
buffer
ArrayBuffer
-
encoding
string
"utf8"
Returns: string
Const
fetchRequestHandler▸ fetchRequestHandler(fetchRequestHandlerOptions
: FetchRequestHandlerOptions): HttpRequestHandler
Defined in packages/http/src/requestHandlers/fetch.requestHandler.ts:17
Creates a new HttpRequestHandler that uses Fetch API underneath. Does not support timeout property. Abort is possible only after headers were received.
Parameters:
Name
Type
Default
Description
fetchRequestHandlerOptions
{}
default Fetch API options attached to all requests
Returns: HttpRequestHandler
Const
getCaseConverter▸ getCaseConverter(bodyCasing?
: BodyCasing): toCamelCase
Defined in packages/http/src/helpers/caseConversion.helper.ts:51
Parameters:
Name
Type
bodyCasing?
Returns: toCamelCase
Const
getEncodingFromHeaders▸ getEncodingFromHeaders(headers
: HttpResponseHeaders | undefined, fallback
: string): string
Defined in packages/http/src/helpers/encoder.helper.ts:23
Parameters:
Name
Type
Default
headers
-
fallback
string
"utf8"
Returns: string
Const
getHeader▸ getHeader(headers
: HttpHeaders | undefined, header
: string): string | undefined
Defined in packages/http/src/helpers/headers.helper.ts:3
Parameters:
Name
Type
headers
header
string
Returns: string | undefined
Const
getHostname▸ getHostname(url
: string): string
Defined in packages/http/src/helpers/httpClient.helper.ts:29
Parameters:
Name
Type
url
string
Returns: string
Const
handleRequest▸ handleRequest(code
: number, body
: any, contentType
: string): Promise‹HttpResponse›
Defined in packages/http/src/requestHandlers/mock.requestHandler.ts:8
Parameters:
Name
Type
Default
code
number
-
body
any
-
contentType
string
ContentType.TEXT
Returns: Promise‹HttpResponse›
Const
httpRequestHandler▸ httpRequestHandler(requestHandlerOptions
: HttpRequestHandlerOptions): HttpRequestHandler
Defined in packages/http/src/requestHandlers/http.requestHandler.ts:19
Creates a new HttpRequestHandler that uses native Node.js HTTP & HTTPS modules underneath. Does not support mode property.
Parameters:
Name
Type
Default
Description
requestHandlerOptions
{}
default native options attached to all requests
Returns: HttpRequestHandler
Const
isHttpInterceptorInterface▸ isHttpInterceptorInterface(interceptor
: HttpInterceptor): interceptor is HttpInterceptorInterface
Defined in packages/http/src/httpClient.ts:89
Parameters:
Name
Type
interceptor
Returns: interceptor is HttpInterceptorInterface
Const
isHttpRequestError▸ isHttpRequestError(error
: any): error is HttpRequestError
Defined in packages/http/src/httpRequestError.ts:14
Parameters:
Name
Type
error
any
Returns: error is HttpRequestError
Const
isHttpResponseError▸ isHttpResponseError(error
: any): error is HttpResponseError
Defined in packages/http/src/httpResponseError.ts:17
Parameters:
Name
Type
error
any
Returns: error is HttpResponseError
Const
mergeRequestOptions▸ mergeRequestOptions(defaultRequestOptions
: RequestInit | undefined, requestOptions
: NormalizedHttpOptions): RequestInit & NormalizedHttpOptions
Defined in packages/http/src/requestHandlers/fetch.requestHandler.ts:62
Parameters:
Name
Type
defaultRequestOptions
RequestInit | undefined
requestOptions
Returns: RequestInit & NormalizedHttpOptions
Const
mockRequestHandler▸ mockRequestHandler(mockOptions
: MockOptions): MockHttpRequestHandler
Defined in packages/http/src/requestHandlers/mock.requestHandler.ts:40
Parameters:
Name
Type
mockOptions
Returns: MockHttpRequestHandler
Const
noConversion▸ noConversion(object
: any): any
Defined in packages/http/src/helpers/caseConversion.helper.ts:49
Parameters:
Name
Type
object
any
Returns: any
Const
parseHeaders▸ parseHeaders(headers
: Headers): Record‹string, string›
Defined in packages/http/src/helpers/headers.helper.ts:12
Parameters:
Name
Type
headers
Headers
Returns: Record‹string, string›
Const
passthroughParser▸ passthroughParser(response
: RawHttpResponse): object
Defined in packages/http/src/httpClient.ts:104
Parameters:
Name
Type
response
Returns: object
parsedBody: any = (response as any).parsedBody || (() => response.arrayBuffer())
Const
sanitizeHeaders▸ sanitizeHeaders(headers
: Record‹string, any›): Record‹string, string›
Defined in packages/http/src/helpers/httpClient.helper.ts:19
Parameters:
Name
Type
headers
Record‹string, any›
Returns: Record‹string, string›
Const
sleep▸ sleep(ms
: number): Promise‹unknown›
Defined in packages/http/src/helpers/sleep.helper.ts:1
Parameters:
Name
Type
ms
number
Returns: Promise‹unknown›
Const
splitWords▸ splitWords(text
: string): string[]
Defined in packages/http/src/helpers/caseConversion.helper.ts:11
Parameters:
Name
Type
text
string
Returns: string[]
▸ switchContentType<T>(contentType
: string, map
: ContentTypeMap‹T›, defaultResult
: T): T
Defined in packages/http/src/contentType.ts:16
Type parameters:
▪ T
Parameters:
Name
Type
contentType
string
map
defaultResult
T
Returns: T
▸ switchContentType<T>(contentType
: string, map
: ContentTypeMap‹T›): T | undefined
Defined in packages/http/src/contentType.ts:17
Type parameters:
▪ T
Parameters:
Name
Type
contentType
string
map
Returns: T | undefined
Const
toCamelCase▸ toCamelCase(object
: any): any
Defined in packages/http/src/helpers/caseConversion.helper.ts:31
Parameters:
Name
Type
object
any
Returns: any
Const
toKebabCase▸ toKebabCase(object
: any): any
Defined in packages/http/src/helpers/caseConversion.helper.ts:45
Parameters:
Name
Type
object
any
Returns: any
Const
toPascalCase▸ toPascalCase(object
: any): any
Defined in packages/http/src/helpers/caseConversion.helper.ts:37
Parameters:
Name
Type
object
any
Returns: any
Const
toSnakeCase▸ toSnakeCase(object
: any): any
Defined in packages/http/src/helpers/caseConversion.helper.ts:41
Parameters:
Name
Type
object
any
Returns: any
Const
toUrlEncoded▸ toUrlEncoded(obj
: object): string
Defined in packages/http/src/helpers/httpClient.helper.ts:9
Parameters:
Name
Type
obj
object
Returns: string
Const
urlCombine▸ urlCombine(sourceUrl
: string, sourceQuery?
: undefined | object, options?
: qs.IStringifyOptions): string
Defined in packages/http/src/helpers/urlEncoding.helper.ts:15
Parameters:
Name
Type
sourceUrl
string
sourceQuery?
undefined | object
options?
qs.IStringifyOptions
Returns: string
Const
urlDecode▸ urlDecode<T>(value
: string, options?
: qs.IParseOptions): T
Defined in packages/http/src/helpers/urlEncoding.helper.ts:28
Type parameters:
▪ T
Parameters:
Name
Type
value
string
options?
qs.IParseOptions
Returns: T
Const
urlDestruct▸ urlDestruct(url
: string, options?
: qs.IParseOptions): object
Defined in packages/http/src/helpers/urlEncoding.helper.ts:4
Parameters:
Name
Type
url
string
options?
qs.IParseOptions
Returns: object
query: any
url: string
Const
urlEncode▸ urlEncode(value
: any, options?
: qs.IStringifyOptions): string
Defined in packages/http/src/helpers/urlEncoding.helper.ts:24
Parameters:
Name
Type
value
any
options?
qs.IStringifyOptions
Returns: string
Const
useInterceptor▸ useInterceptor(normalizedOptions
: NormalizedHttpOptions): (Anonymous function)
Defined in packages/http/src/httpClient.ts:94
Parameters:
Name
Type
normalizedOptions
Returns: (Anonymous function)
Const
xhrRequestHandler▸ xhrRequestHandler(): HttpRequestHandler
Defined in packages/http/src/requestHandlers/xhr.requestHandler.ts:51
Returns: HttpRequestHandler
Const
ContentTypeRegexDefined in packages/http/src/contentType.ts:8
• JSON: RegExp‹› = /^application\/(json|.++json)$/
Defined in packages/http/src/contentType.ts:10
• TEXT: RegExp‹› = /^text\//
Defined in packages/http/src/contentType.ts:9
• URL_ENCODED: RegExp‹› = /^application\/x-www-form-urlencoded$/
Defined in packages/http/src/contentType.ts:11
Const
HttpClientHelperDefined in packages/http/src/helpers/httpClient.helper.ts:34
• defaultHeaders: defaultHeaders
Defined in packages/http/src/helpers/httpClient.helper.ts:35
• getHostname: getHostname
Defined in packages/http/src/helpers/httpClient.helper.ts:38
• sanitizeHeaders: sanitizeHeaders
Defined in packages/http/src/helpers/httpClient.helper.ts:37
• toUrlEncoded: toUrlEncoded
Defined in packages/http/src/helpers/httpClient.helper.ts:36
Const
HttpStatusTextDefined in packages/http/src/httpCodes.ts:52
• __computed: string = "Network Authentication Required"
Defined in packages/http/src/httpCodes.ts:53
Defined in packages/http/src/httpCodes.ts:54
Defined in packages/http/src/httpCodes.ts:55
Defined in packages/http/src/httpCodes.ts:56
Defined in packages/http/src/httpCodes.ts:57
Defined in packages/http/src/httpCodes.ts:58
Defined in packages/http/src/httpCodes.ts:59
Defined in packages/http/src/httpCodes.ts:60
Defined in packages/http/src/httpCodes.ts:61
Defined in packages/http/src/httpCodes.ts:62
Defined in packages/http/src/httpCodes.ts:63
Defined in packages/http/src/httpCodes.ts:64
Defined in packages/http/src/httpCodes.ts:65
Defined in packages/http/src/httpCodes.ts:66
Defined in packages/http/src/httpCodes.ts:67
Defined in packages/http/src/httpCodes.ts:68
Defined in packages/http/src/httpCodes.ts:69
Defined in packages/http/src/httpCodes.ts:70
Defined in packages/http/src/httpCodes.ts:71
Defined in packages/http/src/httpCodes.ts:72
Defined in packages/http/src/httpCodes.ts:73
Defined in packages/http/src/httpCodes.ts:74
Defined in packages/http/src/httpCodes.ts:75
Defined in packages/http/src/httpCodes.ts:76
Defined in packages/http/src/httpCodes.ts:77
Defined in packages/http/src/httpCodes.ts:78
Defined in packages/http/src/httpCodes.ts:79
Defined in packages/http/src/httpCodes.ts:80
Defined in packages/http/src/httpCodes.ts:81
Defined in packages/http/src/httpCodes.ts:82
Defined in packages/http/src/httpCodes.ts:83
Defined in packages/http/src/httpCodes.ts:84
Defined in packages/http/src/httpCodes.ts:85
Defined in packages/http/src/httpCodes.ts:86
Defined in packages/http/src/httpCodes.ts:87
Defined in packages/http/src/httpCodes.ts:88
Defined in packages/http/src/httpCodes.ts:89
Defined in packages/http/src/httpCodes.ts:90
Defined in packages/http/src/httpCodes.ts:91
Defined in packages/http/src/httpCodes.ts:92
Defined in packages/http/src/httpCodes.ts:93
Defined in packages/http/src/httpCodes.ts:94
Defined in packages/http/src/httpCodes.ts:95
Defined in packages/http/src/httpCodes.ts:96
Defined in packages/http/src/httpCodes.ts:97
Defined in packages/http/src/httpCodes.ts:98
Defined in packages/http/src/httpCodes.ts:99
Defined in packages/http/src/httpCodes.ts:100
Const
InterceptorsDefined in packages/http/src/interceptors/index.ts:5
• createErrorInterceptor: createErrorInterceptor
Defined in packages/http/src/interceptors/index.ts:6
• createLoggingInterceptor: createLoggingInterceptor
Defined in packages/http/src/interceptors/index.ts:7
• createRedirectionInterceptor: createRedirectionInterceptor
Defined in packages/http/src/interceptors/index.ts:8
▪ T
↳ HttpResponse
• ok: boolean
• redirected: boolean
• status: number
• statusText: string
• url: string
▸ abort(): void
Returns: void
▸ arrayBuffer(): Promise‹ArrayBuffer›
Returns: Promise‹ArrayBuffer›
▸ parsedBody(): Promise‹T›
Returns: Promise‹T›
▸ text(): Promise‹string›
Returns: Promise‹string›
RawHttpResponse
↳
• ok: boolean
• redirected: boolean
• status: number
• statusText: string
• url: string
▸ abort(): void
Returns: void
▸ arrayBuffer(): Promise‹ArrayBuffer›
Returns: Promise‹ArrayBuffer›
▸ text(): Promise‹string›
Returns: Promise‹string›
Ƭ Promisable: T | Promise‹T›
Ƭ QueueItem: object
fail(): function
(reason
: any): void
run(): function
(): Promise‹void›
Const
createAuthInterceptorParameters:
Const
createOAuth2InterceptorParameters:
▪ __namedParameters: object
Const
hasUnauthorizedResponseCode▸ hasUnauthorizedResponseCode(response
: HttpResponse): boolean
Parameters:
Returns: boolean
Const
isUnauthorizedError▸ isUnauthorizedError(error
: any): boolean
Parameters:
Returns: boolean
↳ AuthError
Parameters:
Optional
cause• message: string
Defined in node_modules/typescript/lib/lib.es5.d.ts:974
• name: string
Defined in node_modules/typescript/lib/lib.es5.d.ts:973
Optional
stack• stack? : undefined | string
Defined in node_modules/typescript/lib/lib.es5.d.ts:975
Static
Error▪ Error: ErrorConstructor
Defined in node_modules/typescript/lib/lib.es5.d.ts:984
AuthInterceptor
HttpInterceptorInterface
Parameters:
• get pendingRequestCount(): number
Returns: number
▸ onIntercept<Body>(request
: HttpFetch‹Body›, options
: NormalizedHttpOptions): HttpFetch‹Body›
Type parameters:
▪ Body
Parameters:
Returns: HttpFetch‹Body›
Simple queue that executes Promises one by one.
SimpleQueue
• get length(): number
Returns: number
▸ clean(reason
: any): void
Parameters:
Returns: void
▸ put<T>(item
: function): Promise‹T›
Queues specified promise and returns when it's done
Type parameters:
▪ T
Parameters:
▪ item: function
▸ (): Promise‹T›
Returns: Promise‹T›
Auth interceptor can be plugged in to a HttpClient to ensure passing proper authorization data to all requests and automatically refresh the tokens when they expire. You can configure whether authorization is done by body, header or query param, you can define your own refresh mechanism or use some ready-made, commonly used options.
Add the Auth Interceptor package, assuming that you already have @coolio/http
installed:
Declare httpClient
as described in and then use createAuthInterceptor
, passing all parameters required by options
object. authInterceptor
itself may also make it's own calls (via reauthorize
function), so you may need to create another HttpClient
, which won't interfere with your basic HttpClient
's interceptors. See the Usage section for complete example.
Now each request directed to my-domain.org
has a proper Authorization
header. In case of 401
response, all requests are paused and token refresh happens. When token is fresh, all requests are resumed. The whole process is transparent and doesn't affect calls.
If you're using OAuth2 authentication mechanisms, you can use an interceptor pre-made specifically for that case. See an example below:
OAuth2InterceptorOptions
• authStorage: ‹›
Defined in
Data storage for OAuth credentials. Uses InMemoryAuthStorage by default. One can implement their own storage, i.e. backed by Redux or LocalStorage.
• canAuthorize: function
Determine if request should be processed, by checking request's options (i.e. check for a domain match)
param
Request options
▸ (options
: NormalizedHttpOptions): boolean
Parameters:
• oauth: object
clientId: string
clientSecret? : undefined | string
contentType? : ContentType
httpClientOptions: HttpClientConfig
refreshTokenUrl: string
• onAuthorizationFailure: function
This function is called when:
authorize() function throws an error,
a second call to an api endpoint results in 401.
Parameters:
JSON API Client Wrapper
Add the JSON API package, assuming that you already have @coolio/http
installed:
Declare httpClient
as described in and then build JSON API Client:
Make sure that httpClient uses standard bodyParser
or a parser that returns complete body of server's response (an object including at least data
property).
An instance of JsonApiClient
exposes a collection of get()
, getList()
, post()
, remove()
, put()
and patch()
methods. Each method returns a request builder. For example:
UsersRepository.getUsers()
method presented above returns a Promise<JsonListResponse<UserAttributes, UserRelationships>>
. @coolio/json-api
merges attributes and relationships automatically.
Ƭ AttributesOf: D extends object ? D["attributes"] : EmptyRecord
Ƭ EmptyRecord: object
[ key: string]: never
Ƭ IncludedGroups: object
Ƭ IncludedRelationships: D[]
Ƭ MergedData:
This sophisticated type allows to correctly infer nicely formatted data from JSON API format. id
, type
, attributes
and relationships
suddenly become a single, combined object with easy access to it. Same is applied to arrays.
Ƭ MergedIncludedGroups: object
Ƭ RawRelationship: object
data: T
links? : undefined | object
related? : undefined | string
Ƭ RelationshipData: object
id: string
type: Type
Ƭ RelationshipsOf: D extends object ? D["relationships"] : EmptyRecord
Const
DEFAULT_RESOURCE_LIMIT• DEFAULT_RESOURCE_LIMIT: 10 = 10
Const
findIncludedRelationshipParameters:
Const
includedGroupType parameters:
Parameters:
Const
isDataType parameters:
Parameters:
Returns: data is D
Const
mergeElementDataType parameters:
Parameters:
Type parameters:
Parameters:
Returns: D
Parameters:
Parameters:
Const
Headers• Accept: ContentType = ContentType.VND_JSON
• Content-Type: ContentType = ContentType.VND_JSON
‹Body›
‹Body›
undefined | | | |
undefined | | | |
‹T›
[]
| string | undefined
| undefined
| undefined
‹T›
‹T›
• headers:
Inherited from .
Defined in
Inherited from .
Defined in
Inherited from .
Defined in
Inherited from .
Defined in
Inherited from .
Defined in
Inherited from .
Defined in
Inherited from .
Defined in
Inherited from .
Defined in
Defined in
Inherited from .
Defined in
• body? :
Defined in
Defined in
• headers? :
Defined in
• method:
Defined in
• mode? :
Defined in
Defined in
Defined in
• headers:
Defined in
Defined in
Defined in
Defined in
Defined in
Defined in
Defined in
Defined in
Defined in
Defined in
• request:
Defined in
• response? :
Defined in
• headers? :
Defined in
Defined in
Defined in
• body? :
Defined in
Defined in
Defined in
• method:
Defined in
• mode? :
Defined in
Defined in
Defined in
Defined in
Defined in
Defined in
Defined in
Defined in
Defined in
▸ createAuthInterceptor(options
: ): ‹›
Defined in
Returns: ‹›
▸ createOAuth2Interceptor(__namedParameters
: object): ‹›
Defined in
Returns: ‹›
Defined in
Defined in
+ new AuthError(message
: string, cause?
: ):
Defined in
Returns:
• cause? :
Defined in
Inherited from .
Inherited from .
Inherited from .
Overrides .
Implementation of
Defined in
Implementation of
Defined in
+ new AuthInterceptor(options
: ):
Defined in
Returns:
Defined in
Defined in
Defined in
Defined in
Defined in
Defined in
Defined in
Defined in
Defined in
Defined in
▸ (err
: ):
Ƭ AnyData: ‹any, any›
Defined in
Defined in
Defined in
Defined in
Ƭ IncludedGroupsSchema: Record‹string, ›
Defined in
Defined in
Defined in
Defined in
Ƭ OptionalRels: | undefined
Defined in
Defined in
Ƭ Relationship: ‹›
Defined in
Ƭ RelationshipArray: ‹[]›
Defined in
Defined in
Ƭ RelationshipType: ‹Type› | ‹Type›[]
Defined in
Ƭ Relationships: Record‹string, ‹› | undefined›
Defined in
Defined in
Ƭ ResolvedRelationship: ‹D›
Defined in
Ƭ ResolvedRelationshipArray: ‹D[]›
Defined in
Ƭ ResolvedRelationships: Record‹string, | | undefined›
Defined in
Ƭ UnresolvedRelationships: Record‹string, | ›
Defined in
Defined in
▸ findIncludedRelationship(relationship
: , included
: ): | undefined
Defined in
Returns: | undefined
▸ includedGroup<D>(type
: string): ‹D›
Defined in
▪ D:
Returns: ‹D›
▸ isData<D>(data
: | D): data is D
Defined in
▪ D:
▸ mergeElementData<D>(data
: D): ‹D›
Defined in
▪ D:
Returns: ‹D›
▸ resolveRelationships<D>(data
: D, included
: ): D
Defined in
▪ D: | []
▸ resolveRelationships(data
: [], included
: ): object | ‹any, any›[]
Defined in
Returns: object | ‹any, any›[]
▸ resolveRelationships(data
: , included
: ): |
Defined in
Returns: |
Defined in
Defined in
Defined in
Name
Type
options
Name
Type
authStorage
canAuthorize
function
oauth
object
onAuthorizationFailure
function
Name
Type
response
HttpResponse
Name
Type
error
any
Name
Type
message
string
cause?
Name
Type
data
T
Name
Type
options
Name
Type
request
HttpFetch‹Body›
options
NormalizedHttpOptions
Name
Type
reason
any
Name
Type
options
NormalizedHttpOptions
Name
Type
err
Name
Type
relationship
included
Name
Type
type
string
Name
Type
data
RelationshipData | D
Name
Type
data
D
Name
Type
data
D
included
Name
Type
data
included
Name
Type
data
included
▪ Raw: RawListResponse‹any, any›
▪ I: IncludedGroups
JsonListResponse
+ new JsonListResponse(raw
: Raw, limit
: number, offset
: number | undefined, rawIncludedGroups
: I, response
: HttpResponse‹Raw›): JsonListResponse
Defined in jsonApi.getList.ts:8
Parameters:
Name
Type
raw
Raw
limit
number
offset
number | undefined
rawIncludedGroups
I
response
HttpResponse‹Raw›
Returns: JsonListResponse
• limit: number
Defined in jsonApi.getList.ts:12
• offset: number | undefined
Defined in jsonApi.getList.ts:13
• raw: Raw
Defined in jsonApi.getList.ts:11
• response: HttpResponse‹Raw›
Defined in jsonApi.getList.ts:15
• get elements(): MergedData‹Raw["data"]›
Defined in jsonApi.getList.ts:19
Returns: MergedData‹Raw["data"]›
• get included(): object
Defined in jsonApi.getList.ts:27
Returns: object
• get meta(): Raw["meta"]
Defined in jsonApi.getList.ts:23
Returns: Raw["meta"]
▪ Raw: RawResponse‹any, any›
JsonResponse
+ new JsonResponse(raw
: Raw, response
: HttpResponse‹Raw›): JsonResponse
Defined in jsonApi.response.ts:5
Parameters:
Name
Type
raw
Raw
response
HttpResponse‹Raw›
Returns: JsonResponse
• raw: Raw
Defined in jsonApi.response.ts:7
• response: HttpResponse‹Raw›
Defined in jsonApi.response.ts:7
• get element(): MergedData‹Raw["data"]›
Defined in jsonApi.response.ts:10
Returns: MergedData‹Raw["data"]›
• get meta(): Raw["meta"]
Defined in jsonApi.response.ts:14
Returns: Raw["meta"]
▪ T
AuthStorage
▸ getData(): Promisable‹T | undefined›
Defined in packages/auth-interceptor/src/storage/authStorage.types.ts:4
Returns: Promisable‹T | undefined›
▸ setData(t
: T): Promisable
Defined in packages/auth-interceptor/src/storage/authStorage.types.ts:6
Parameters:
Name
Type
t
T
Returns: Promisable
OAuth2TokenResponse
• accessToken: string
Defined in packages/auth-interceptor/src/oauth2Interceptor.types.ts:7
Optional
expires• expires? : undefined | string
Defined in packages/auth-interceptor/src/oauth2Interceptor.types.ts:10
Optional
expiresIn• expiresIn? : undefined | string
Defined in packages/auth-interceptor/src/oauth2Interceptor.types.ts:11
Optional
idToken• idToken? : undefined | string
Defined in packages/auth-interceptor/src/oauth2Interceptor.types.ts:9
• refreshToken: string
Defined in packages/auth-interceptor/src/oauth2Interceptor.types.ts:12
Optional
scope• scope? : undefined | string
Defined in packages/auth-interceptor/src/oauth2Interceptor.types.ts:13
Optional
tokenType• tokenType? : undefined | string
Defined in packages/auth-interceptor/src/oauth2Interceptor.types.ts:8
JsonApiClient
+ new JsonApiClient(httpClient
: HttpClient): JsonApiClient
Defined in jsonApi.client.ts:9
Parameters:
Name
Type
httpClient
HttpClient
Returns: JsonApiClient
• httpClient: HttpClient
Defined in jsonApi.client.ts:10
▸ get<D, M>(uri
: string): GetBuilder‹RawResponse‹D, M››
Defined in jsonApi.client.ts:13
Type parameters:
▪ D: AnyData
▪ M: object
Parameters:
Name
Type
uri
string
Returns: GetBuilder‹RawResponse‹D, M››
▸ getList<D, M>(uri
: string): GetListBuilder‹RawListResponse‹D, M›, object›
Defined in jsonApi.client.ts:17
Type parameters:
▪ D: AnyData
▪ M: ListMetaData
Parameters:
Name
Type
uri
string
Returns: GetListBuilder‹RawListResponse‹D, M›, object›
▸ patch<D, M>(uri
: string): UpdateBuilder‹RawResponse‹D, M››
Defined in jsonApi.client.ts:33
Type parameters:
▪ D: AnyData
▪ M: object
Parameters:
Name
Type
uri
string
Returns: UpdateBuilder‹RawResponse‹D, M››
▸ post<D, M>(uri
: string): PostBuilder‹RawResponse‹D, M››
Defined in jsonApi.client.ts:21
Type parameters:
▪ D: AnyData
▪ M: object
Parameters:
Name
Type
uri
string
Returns: PostBuilder‹RawResponse‹D, M››
▸ put<D, M>(uri
: string): UpdateBuilder‹RawResponse‹D, M››
Defined in jsonApi.client.ts:29
Type parameters:
▪ D: AnyData
▪ M: object
Parameters:
Name
Type
uri
string
Returns: UpdateBuilder‹RawResponse‹D, M››
▸ remove<D, M>(uri
: string): RemoveBuilder‹RawResponse‹D, M››
Defined in jsonApi.client.ts:25
Type parameters:
▪ D: AnyData
▪ M: object
Parameters:
Name
Type
uri
string
Returns: RemoveBuilder‹RawResponse‹D, M››
deprecated
It is not part of JSON API and is not supported in when array of keys is passed
• EQUALS: = "EQ"
Defined in jsonApi.interface.ts:146
• GREATER: = "GT"
Defined in jsonApi.interface.ts:149
• GREATER_OR_EQUAL: = "GE"
Defined in jsonApi.interface.ts:151
• LIKE: = "LIKE"
Defined in jsonApi.interface.ts:148
• LOWER: = "LT"
Defined in jsonApi.interface.ts:150
• LOWER_OR_EQUAL: = "LE"
Defined in jsonApi.interface.ts:152
• NOT_EQUALS: = "NEQ"
Defined in jsonApi.interface.ts:147
Included groups allow you to extract stuff from 'included' JSON API field basing on specified name-type pairs, and add proper types to it.
▪ D: AnyData
IncludedGroup
• __d: D
Defined in jsonApi.interface.ts:103
• type: string
Defined in jsonApi.interface.ts:102
▪ Attrs: Attributes
▪ Rels: OptionalRels
Data
• attributes: Attrs
Defined in jsonApi.interface.ts:39
• id: string
Defined in jsonApi.interface.ts:37
• links: object
Defined in jsonApi.interface.ts:41
self: string
• relationships: Rels
Defined in jsonApi.interface.ts:40
• type: string
Defined in jsonApi.interface.ts:38
• ASCENDING: = ""
Defined in jsonApi.interface.ts:156
• DESCENDING: = "-"
Defined in jsonApi.interface.ts:157
▪ Raw: RawResponse‹any, any›
RequestBuilder‹JsonResponse‹Raw››
↳ PostBuilder
+ new PostBuilder(httpClient
: HttpClient, uri
: string): PostBuilder
Overrides RequestBuilder.constructor
Defined in jsonApi.post.ts:10
Parameters:
Name
Type
httpClient
HttpClient
uri
string
Returns: PostBuilder
Optional
attributes• attributes? : undefined | object
Defined in jsonApi.post.ts:9
Optional
id• id? : undefined | string
Defined in jsonApi.post.ts:8
Protected
limit• limit: number = DEFAULT_RESOURCE_LIMIT
Inherited from RequestBuilder.limit
Defined in jsonApi.builder.ts:19
Protected
offset• offset: undefined | number
Inherited from RequestBuilder.offset
Defined in jsonApi.builder.ts:20
Protected
options• options: Options
Inherited from RequestBuilder.options
Defined in jsonApi.builder.ts:23
Protected
page• page: number = 1
Inherited from RequestBuilder.page
Defined in jsonApi.builder.ts:21
Protected
queryParams• queryParams: Record‹string, string›
Inherited from RequestBuilder.queryParams
Defined in jsonApi.builder.ts:17
Optional
relationships• relationships? : Record‹string, object›
Defined in jsonApi.post.ts:10
Protected
resolveIncludedRelationships• resolveIncludedRelationships: boolean = false
Inherited from RequestBuilder.resolveIncludedRelationships
Defined in jsonApi.builder.ts:16
Protected
sortParams• sortParams: string[] = []
Inherited from RequestBuilder.sortParams
Defined in jsonApi.builder.ts:18
Optional
type• type? : undefined | string
Defined in jsonApi.post.ts:7
• uri: string
Inherited from RequestBuilder.uri
Defined in jsonApi.builder.ts:15
• get parameters(): Record‹string, string›
Inherited from RequestBuilder.parameters
Defined in jsonApi.builder.ts:50
Returns: Record‹string, string›
▸ filter(key
: string | string[] | undefined, value
: string | number | boolean | undefined, operator?
: FilterOperator): this
Inherited from RequestBuilder.filter
Defined in jsonApi.builder.ts:84
Parameters:
Name
Type
key
string | string[] | undefined
value
string | number | boolean | undefined
operator?
Returns: this
▸ ofType(type
: string): this
Defined in jsonApi.post.ts:16
Parameters:
Name
Type
type
string
Returns: this
▸ pageLimit(limit
: number): this
Inherited from RequestBuilder.pageLimit
Defined in jsonApi.builder.ts:102
Parameters:
Name
Type
limit
number
Returns: this
▸ pageNumber(page
: number | string | undefined): this
Inherited from RequestBuilder.pageNumber
Defined in jsonApi.builder.ts:112
Parameters:
Name
Type
page
number | string | undefined
Returns: this
▸ pageOffset(offset
: number): this
Inherited from RequestBuilder.pageOffset
Defined in jsonApi.builder.ts:107
Parameters:
Name
Type
offset
number
Returns: this
▸ parameter(key
: string, value
: string | number | boolean | undefined): this
Inherited from RequestBuilder.parameter
Defined in jsonApi.builder.ts:74
Parameters:
Name
Type
key
string
value
string | number | boolean | undefined
Returns: this
Protected
parseResponse▸ parseResponse<Raw>(response
: HttpResponse): Promise‹JsonResponse‹Raw››
Inherited from RequestBuilder.parseResponse
Defined in jsonApi.builder.ts:117
Type parameters:
▪ Raw: RawResponse‹any, any›
Parameters:
Name
Type
response
HttpResponse
Returns: Promise‹JsonResponse‹Raw››
▸ resolveIncluded(resolveIncluded?
: undefined | false | true): this
Inherited from RequestBuilder.resolveIncluded
Defined in jsonApi.builder.ts:69
Parameters:
Name
Type
resolveIncluded?
undefined | false | true
Returns: this
▸ send(options
: HttpOptions): Promise‹JsonResponse‹Raw››
Overrides RequestBuilder.send
Defined in jsonApi.post.ts:43
Parameters:
Name
Type
Default
options
HttpOptions
{}
Returns: Promise‹JsonResponse‹Raw››
▸ sort(key
: string | undefined, order
: SortOrder): this
Inherited from RequestBuilder.sort
Defined in jsonApi.builder.ts:95
Parameters:
Name
Type
key
string | undefined
order
Returns: this
▸ withAttributes(attributes
: object): this
Defined in jsonApi.post.ts:26
Parameters:
Name
Type
attributes
object
Returns: this
▸ withId(id
: string): this
Defined in jsonApi.post.ts:21
Parameters:
Name
Type
id
string
Returns: this
▸ withRelationship(rel?
: undefined | object): this
Defined in jsonApi.post.ts:31
Parameters:
Name
Type
rel?
undefined | object
Returns: this
▪ ResponseType
Protected
constructor+ new RequestBuilder(uri
: string, options
: Options): RequestBuilder
Defined in jsonApi.builder.ts:21
Parameters:
Name
Type
uri
string
options
Returns: RequestBuilder
Protected
limit• limit: number = DEFAULT_RESOURCE_LIMIT
Defined in jsonApi.builder.ts:19
Protected
offset• offset: undefined | number
Defined in jsonApi.builder.ts:20
Protected
options• options: Options
Defined in jsonApi.builder.ts:23
Protected
page• page: number = 1
Defined in jsonApi.builder.ts:21
Protected
queryParams• queryParams: Record‹string, string›
Defined in jsonApi.builder.ts:17
Protected
resolveIncludedRelationships• resolveIncludedRelationships: boolean = false
Defined in jsonApi.builder.ts:16
Protected
sortParams• sortParams: string[] = []
Defined in jsonApi.builder.ts:18
• uri: string
Defined in jsonApi.builder.ts:15
• get parameters(): Record‹string, string›
Defined in jsonApi.builder.ts:50
Returns: Record‹string, string›
▸ filter(key
: string | string[] | undefined, value
: string | number | boolean | undefined, operator?
: FilterOperator): this
Defined in jsonApi.builder.ts:84
Parameters:
Name
Type
key
string | string[] | undefined
value
string | number | boolean | undefined
operator?
Returns: this
▸ pageLimit(limit
: number): this
Defined in jsonApi.builder.ts:102
Parameters:
Name
Type
limit
number
Returns: this
▸ pageNumber(page
: number | string | undefined): this
Defined in jsonApi.builder.ts:112
Parameters:
Name
Type
page
number | string | undefined
Returns: this
▸ pageOffset(offset
: number): this
Defined in jsonApi.builder.ts:107
Parameters:
Name
Type
offset
number
Returns: this
▸ parameter(key
: string, value
: string | number | boolean | undefined): this
Defined in jsonApi.builder.ts:74
Parameters:
Name
Type
key
string
value
string | number | boolean | undefined
Returns: this
Protected
parseResponse▸ parseResponse<Raw>(response
: HttpResponse): Promise‹JsonResponse‹Raw››
Defined in jsonApi.builder.ts:117
Type parameters:
▪ Raw: RawResponse‹any, any›
Parameters:
Name
Type
response
HttpResponse
Returns: Promise‹JsonResponse‹Raw››
▸ resolveIncluded(resolveIncluded?
: undefined | false | true): this
Defined in jsonApi.builder.ts:69
Parameters:
Name
Type
resolveIncluded?
undefined | false | true
Returns: this
Abstract
send▸ send(options?
: HttpOptions): Promise‹ResponseType›
Defined in jsonApi.builder.ts:67
Parameters:
Name
Type
options?
HttpOptions
Returns: Promise‹ResponseType›
▸ sort(key
: string | undefined, order
: SortOrder): this
Defined in jsonApi.builder.ts:95
Parameters:
Name
Type
key
string | undefined
order
Returns: this
▪ Raw: RawListResponse‹any, any›
▪ I: IncludedGroups
RequestBuilder‹JsonListResponse‹Raw, I››
↳ GetListBuilder
+ new GetListBuilder(httpClient
: HttpClient, uri
: string): GetListBuilder
Overrides RequestBuilder.constructor
Defined in jsonApi.getList.ts:36
Parameters:
Name
Type
httpClient
HttpClient
uri
string
Returns: GetListBuilder
Protected
limit• limit: number = DEFAULT_RESOURCE_LIMIT
Inherited from RequestBuilder.limit
Defined in jsonApi.builder.ts:19
Protected
offset• offset: undefined | number
Inherited from RequestBuilder.offset
Defined in jsonApi.builder.ts:20
Protected
options• options: Options
Inherited from RequestBuilder.options
Defined in jsonApi.builder.ts:23
Protected
page• page: number = 1
Inherited from RequestBuilder.page
Defined in jsonApi.builder.ts:21
Protected
queryParams• queryParams: Record‹string, string›
Inherited from RequestBuilder.queryParams
Defined in jsonApi.builder.ts:17
Protected
resolveIncludedRelationships• resolveIncludedRelationships: boolean = false
Inherited from RequestBuilder.resolveIncludedRelationships
Defined in jsonApi.builder.ts:16
Protected
sortParams• sortParams: string[] = []
Inherited from RequestBuilder.sortParams
Defined in jsonApi.builder.ts:18
• uri: string
Inherited from RequestBuilder.uri
Defined in jsonApi.builder.ts:15
• get parameters(): Record‹string, string›
Inherited from RequestBuilder.parameters
Defined in jsonApi.builder.ts:50
Returns: Record‹string, string›
▸ addToResponse(response
: JsonListResponse‹Raw, I› | undefined): this
Defined in jsonApi.getList.ts:42
Parameters:
Name
Type
response
Returns: this
▸ filter(key
: string | string[] | undefined, value
: string | number | boolean | undefined, operator?
: FilterOperator): this
Inherited from RequestBuilder.filter
Defined in jsonApi.builder.ts:84
Parameters:
Name
Type
key
string | string[] | undefined
value
string | number | boolean | undefined
operator?
Returns: this
▸ groupIncluded<Groups>(groups
: Groups): GetListBuilder‹Raw, IncludedGroups‹Groups››
Defined in jsonApi.getList.ts:47
Type parameters:
▪ Groups: IncludedGroupsSchema
Parameters:
Name
Type
groups
Groups
Returns: GetListBuilder‹Raw, IncludedGroups‹Groups››
▸ pageLimit(limit
: number): this
Inherited from RequestBuilder.pageLimit
Defined in jsonApi.builder.ts:102
Parameters:
Name
Type
limit
number
Returns: this
▸ pageNumber(page
: number | string | undefined): this
Inherited from RequestBuilder.pageNumber
Defined in jsonApi.builder.ts:112
Parameters:
Name
Type
page
number | string | undefined
Returns: this
▸ pageOffset(offset
: number): this
Inherited from RequestBuilder.pageOffset
Defined in jsonApi.builder.ts:107
Parameters:
Name
Type
offset
number
Returns: this
▸ parameter(key
: string, value
: string | number | boolean | undefined): this
Inherited from RequestBuilder.parameter
Defined in jsonApi.builder.ts:74
Parameters:
Name
Type
key
string
value
string | number | boolean | undefined
Returns: this
Protected
parseResponse▸ parseResponse<Raw>(response
: HttpResponse): Promise‹JsonResponse‹Raw››
Inherited from RequestBuilder.parseResponse
Defined in jsonApi.builder.ts:117
Type parameters:
▪ Raw: RawResponse‹any, any›
Parameters:
Name
Type
response
HttpResponse
Returns: Promise‹JsonResponse‹Raw››
▸ resolveIncluded(resolveIncluded?
: undefined | false | true): this
Overrides RequestBuilder.resolveIncluded
Defined in jsonApi.getList.ts:54
Parameters:
Name
Type
resolveIncluded?
undefined | false | true
Returns: this
▸ send(options?
: HttpOptions): Promise‹JsonListResponse‹Raw, I››
Overrides RequestBuilder.send
Defined in jsonApi.getList.ts:59
Parameters:
Name
Type
options?
HttpOptions
Returns: Promise‹JsonListResponse‹Raw, I››
▸ sort(key
: string | undefined, order
: SortOrder): this
Inherited from RequestBuilder.sort
Defined in jsonApi.builder.ts:95
Parameters:
Name
Type
key
string | undefined
order
Returns: this
▪ Raw: RawResponse‹any, any›
RequestBuilder‹JsonResponse‹Raw››
↳ UpdateBuilder
+ new UpdateBuilder(httpClient
: HttpClient, uri
: string, method
: "PATCH" | "PUT"): UpdateBuilder
Overrides RequestBuilder.constructor
Defined in jsonApi.update.ts:10
Parameters:
Name
Type
httpClient
HttpClient
uri
string
method
"PATCH" | "PUT"
Returns: UpdateBuilder
Optional
attributes• attributes? : undefined | object
Defined in jsonApi.update.ts:9
Optional
id• id? : undefined | string
Defined in jsonApi.update.ts:7
Protected
limit• limit: number = DEFAULT_RESOURCE_LIMIT
Inherited from RequestBuilder.limit
Defined in jsonApi.builder.ts:19
Protected
offset• offset: undefined | number
Inherited from RequestBuilder.offset
Defined in jsonApi.builder.ts:20
Protected
options• options: Options
Inherited from RequestBuilder.options
Defined in jsonApi.builder.ts:23
Protected
page• page: number = 1
Inherited from RequestBuilder.page
Defined in jsonApi.builder.ts:21
Protected
queryParams• queryParams: Record‹string, string›
Inherited from RequestBuilder.queryParams
Defined in jsonApi.builder.ts:17
Optional
relationships• relationships? : Record‹string, object›
Defined in jsonApi.update.ts:10
Protected
resolveIncludedRelationships• resolveIncludedRelationships: boolean = false
Inherited from RequestBuilder.resolveIncludedRelationships
Defined in jsonApi.builder.ts:16
Protected
sortParams• sortParams: string[] = []
Inherited from RequestBuilder.sortParams
Defined in jsonApi.builder.ts:18
Optional
type• type? : undefined | string
Defined in jsonApi.update.ts:8
• uri: string
Inherited from RequestBuilder.uri
Defined in jsonApi.builder.ts:15
• get parameters(): Record‹string, string›
Inherited from RequestBuilder.parameters
Defined in jsonApi.builder.ts:50
Returns: Record‹string, string›
▸ filter(key
: string | string[] | undefined, value
: string | number | boolean | undefined, operator?
: FilterOperator): this
Inherited from RequestBuilder.filter
Defined in jsonApi.builder.ts:84
Parameters:
Name
Type
key
string | string[] | undefined
value
string | number | boolean | undefined
operator?
Returns: this
▸ ofType(type
: string): this
Defined in jsonApi.update.ts:20
Parameters:
Name
Type
type
string
Returns: this
▸ pageLimit(limit
: number): this
Inherited from RequestBuilder.pageLimit
Defined in jsonApi.builder.ts:102
Parameters:
Name
Type
limit
number
Returns: this
▸ pageNumber(page
: number | string | undefined): this
Inherited from RequestBuilder.pageNumber
Defined in jsonApi.builder.ts:112
Parameters:
Name
Type
page
number | string | undefined
Returns: this
▸ pageOffset(offset
: number): this
Inherited from RequestBuilder.pageOffset
Defined in jsonApi.builder.ts:107
Parameters:
Name
Type
offset
number
Returns: this
▸ parameter(key
: string, value
: string | number | boolean | undefined): this
Inherited from RequestBuilder.parameter
Defined in jsonApi.builder.ts:74
Parameters:
Name
Type
key
string
value
string | number | boolean | undefined
Returns: this
Protected
parseResponse▸ parseResponse<Raw>(response
: HttpResponse): Promise‹JsonResponse‹Raw››
Inherited from RequestBuilder.parseResponse
Defined in jsonApi.builder.ts:117
Type parameters:
▪ Raw: RawResponse‹any, any›
Parameters:
Name
Type
response
HttpResponse
Returns: Promise‹JsonResponse‹Raw››
▸ resolveIncluded(resolveIncluded?
: undefined | false | true): this
Inherited from RequestBuilder.resolveIncluded
Defined in jsonApi.builder.ts:69
Parameters:
Name
Type
resolveIncluded?
undefined | false | true
Returns: this
▸ send(options
: HttpOptions): Promise‹JsonResponse‹Raw››
Overrides RequestBuilder.send
Defined in jsonApi.update.ts:43
Parameters:
Name
Type
Default
options
HttpOptions
{}
Returns: Promise‹JsonResponse‹Raw››
▸ sort(key
: string | undefined, order
: SortOrder): this
Inherited from RequestBuilder.sort
Defined in jsonApi.builder.ts:95
Parameters:
Name
Type
key
string | undefined
order
Returns: this
▸ withAttributes(attributes
: object): this
Defined in jsonApi.update.ts:30
Parameters:
Name
Type
attributes
object
Returns: this
▸ withId(id
: string): this
Defined in jsonApi.update.ts:25
Parameters:
Name
Type
id
string
Returns: this
▸ withRelationship(__namedParameters
: object): this
Defined in jsonApi.update.ts:35
Parameters:
▪ __namedParameters: object
Name
Type
name
string
type
string
uuid
string
Returns: this
‹Raw, I› | undefined
Defined in
Defined in
• included? :
Defined in
Defined in
Defined in
Defined in
• included? :
Defined in
Defined in
LoggingInterceptorOptions
• logger: function
Defined in packages/http/src/interceptors/loggingInterceptor.ts:11
▸ (log
: Log): void
Parameters:
Name
Type
log
A set of configuration options, which allows to perform
▪ T
HttpClientConfig
Optional
baseUrl• baseUrl? : undefined | string
URL that is applied to all requests without specified protocol and domain.
Optional
bodyParserOptional
bodySerializerOptional
defaultHeadersProviderOld way of passing global headers to requests. To add headers dynamically, you can use an interceptor instead. To add a set of static headers, pass them to request handler options directly.
deprecated
Optional
queryParserOptions• queryParserOptions? : qs.IParseOptions
Allow to parse query options in a different way than the standard one.
Optional
querySerializerOptions• querySerializerOptions? : qs.IStringifyOptions
Allow to serialize query options in a different way than the standard one.
An implementation of request handler, which handles "low-level" HTTP communication. Result of executing a request via RequestHandler is a normalized object, which can be further processed by interceptors and HttpClient.
Optional
requestTimeout• requestTimeout? : undefined | number
Standard timeout, triggered when server does not respond with headers within specified period of time.
Defined in
• bodyParser? : ‹T›
Defined in
A utility that parses and normalizes body of a response received from server. Can be used to decode JSON object, URL-encoded body or plain text. Built-in supports case-conversion.
• bodySerializer? :
Defined in
A utility that parses and normalizes body of a request sent to server. Can be used to encode JSON object, URL-encoded body or plain text. Built-in supports case-conversion.
• defaultHeadersProvider? :
Defined in
Defined in
Defined in
• requestHandler:
Defined in
For Node.js environment, use
For browser environments, use
For React Native and any other environment, use
Defined in
default
AuthInterceptorOptions
• canAuthorize: function
Defined in packages/auth-interceptor/src/authInterceptor.types.ts:30
Determine if request should be processed, by checking request's options (i.e. check for a domain match)
param
Request options
▸ (options
: NormalizedHttpOptions): boolean
Parameters:
Name
Type
options
NormalizedHttpOptions
• onAuthorizationFailure: function
Defined in packages/auth-interceptor/src/authInterceptor.types.ts:24
This function is called when:
authorize() function throws an error,
a second call to an api endpoint results in 401.
▸ (err
: AuthError): Promisable
Parameters:
Name
Type
err
• reauthorize: function
Defined in packages/auth-interceptor/src/authInterceptor.types.ts:10
Obtain authorization data. At this point previous token has expired or Unauthorized response status code has been received. You can call refresh token endpoint.
▸ (): Promisable
• setAuthorizationData: function
Defined in packages/auth-interceptor/src/authInterceptor.types.ts:17
Insert authorization data to the request.
param
Authorization data obtained earlier by {#authorize}
param
Request options
▸ (options
: NormalizedHttpOptions): Promisable
Parameters:
Name
Type
options
NormalizedHttpOptions
▪ Raw: RawResponse‹any, any›
RequestBuilder‹JsonResponse‹Raw››
↳ GetBuilder
+ new GetBuilder(httpClient
: HttpClient, uri
: string): GetBuilder
Overrides RequestBuilder.constructor
Defined in jsonApi.get.ts:6
Parameters:
Name
Type
httpClient
HttpClient
uri
string
Returns: GetBuilder
Protected
limit• limit: number = DEFAULT_RESOURCE_LIMIT
Inherited from RequestBuilder.limit
Defined in jsonApi.builder.ts:19
Protected
offset• offset: undefined | number
Inherited from RequestBuilder.offset
Defined in jsonApi.builder.ts:20
Protected
options• options: Options
Inherited from RequestBuilder.options
Defined in jsonApi.builder.ts:23
Protected
page• page: number = 1
Inherited from RequestBuilder.page
Defined in jsonApi.builder.ts:21
Protected
queryParams• queryParams: Record‹string, string›
Inherited from RequestBuilder.queryParams
Defined in jsonApi.builder.ts:17
Protected
resolveIncludedRelationships• resolveIncludedRelationships: boolean = false
Inherited from RequestBuilder.resolveIncludedRelationships
Defined in jsonApi.builder.ts:16
Protected
sortParams• sortParams: string[] = []
Inherited from RequestBuilder.sortParams
Defined in jsonApi.builder.ts:18
• uri: string
Inherited from RequestBuilder.uri
Defined in jsonApi.builder.ts:15
• get parameters(): Record‹string, string›
Inherited from RequestBuilder.parameters
Defined in jsonApi.builder.ts:50
Returns: Record‹string, string›
▸ filter(key
: string | string[] | undefined, value
: string | number | boolean | undefined, operator?
: FilterOperator): this
Inherited from RequestBuilder.filter
Defined in jsonApi.builder.ts:84
Parameters:
Name
Type
key
string | string[] | undefined
value
string | number | boolean | undefined
operator?
Returns: this
▸ pageLimit(limit
: number): this
Inherited from RequestBuilder.pageLimit
Defined in jsonApi.builder.ts:102
Parameters:
Name
Type
limit
number
Returns: this
▸ pageNumber(page
: number | string | undefined): this
Inherited from RequestBuilder.pageNumber
Defined in jsonApi.builder.ts:112
Parameters:
Name
Type
page
number | string | undefined
Returns: this
▸ pageOffset(offset
: number): this
Inherited from RequestBuilder.pageOffset
Defined in jsonApi.builder.ts:107
Parameters:
Name
Type
offset
number
Returns: this
▸ parameter(key
: string, value
: string | number | boolean | undefined): this
Inherited from RequestBuilder.parameter
Defined in jsonApi.builder.ts:74
Parameters:
Name
Type
key
string
value
string | number | boolean | undefined
Returns: this
Protected
parseResponse▸ parseResponse<Raw>(response
: HttpResponse): Promise‹JsonResponse‹Raw››
Inherited from RequestBuilder.parseResponse
Defined in jsonApi.builder.ts:117
Type parameters:
▪ Raw: RawResponse‹any, any›
Parameters:
Name
Type
response
HttpResponse
Returns: Promise‹JsonResponse‹Raw››
▸ resolveIncluded(resolveIncluded?
: undefined | false | true): this
Inherited from RequestBuilder.resolveIncluded
Defined in jsonApi.builder.ts:69
Parameters:
Name
Type
resolveIncluded?
undefined | false | true
Returns: this
▸ send(options?
: HttpOptions): Promise‹JsonResponse‹Raw››
Overrides RequestBuilder.send
Defined in jsonApi.get.ts:12
Parameters:
Name
Type
options?
HttpOptions
Returns: Promise‹JsonResponse‹Raw››
▸ sort(key
: string | undefined, order
: SortOrder): this
Inherited from RequestBuilder.sort
Defined in jsonApi.builder.ts:95
Parameters:
Name
Type
key
string | undefined
order
Returns: this
▪ Raw: RawResponse‹any, any›
RequestBuilder‹JsonResponse‹Raw››
↳ RemoveBuilder
+ new RemoveBuilder(httpClient
: HttpClient, uri
: string): RemoveBuilder
Overrides RequestBuilder.constructor
Defined in jsonApi.remove.ts:6
Parameters:
Name
Type
httpClient
HttpClient
uri
string
Returns: RemoveBuilder
Protected
limit• limit: number = DEFAULT_RESOURCE_LIMIT
Inherited from RequestBuilder.limit
Defined in jsonApi.builder.ts:19
Protected
offset• offset: undefined | number
Inherited from RequestBuilder.offset
Defined in jsonApi.builder.ts:20
Protected
options• options: Options
Inherited from RequestBuilder.options
Defined in jsonApi.builder.ts:23
Protected
page• page: number = 1
Inherited from RequestBuilder.page
Defined in jsonApi.builder.ts:21
Protected
queryParams• queryParams: Record‹string, string›
Inherited from RequestBuilder.queryParams
Defined in jsonApi.builder.ts:17
Protected
resolveIncludedRelationships• resolveIncludedRelationships: boolean = false
Inherited from RequestBuilder.resolveIncludedRelationships
Defined in jsonApi.builder.ts:16
Protected
sortParams• sortParams: string[] = []
Inherited from RequestBuilder.sortParams
Defined in jsonApi.builder.ts:18
• uri: string
Inherited from RequestBuilder.uri
Defined in jsonApi.builder.ts:15
• get parameters(): Record‹string, string›
Inherited from RequestBuilder.parameters
Defined in jsonApi.builder.ts:50
Returns: Record‹string, string›
▸ filter(key
: string | string[] | undefined, value
: string | number | boolean | undefined, operator?
: FilterOperator): this
Inherited from RequestBuilder.filter
Defined in jsonApi.builder.ts:84
Parameters:
Name
Type
key
string | string[] | undefined
value
string | number | boolean | undefined
operator?
Returns: this
▸ pageLimit(limit
: number): this
Inherited from RequestBuilder.pageLimit
Defined in jsonApi.builder.ts:102
Parameters:
Name
Type
limit
number
Returns: this
▸ pageNumber(page
: number | string | undefined): this
Inherited from RequestBuilder.pageNumber
Defined in jsonApi.builder.ts:112
Parameters:
Name
Type
page
number | string | undefined
Returns: this
▸ pageOffset(offset
: number): this
Inherited from RequestBuilder.pageOffset
Defined in jsonApi.builder.ts:107
Parameters:
Name
Type
offset
number
Returns: this
▸ parameter(key
: string, value
: string | number | boolean | undefined): this
Inherited from RequestBuilder.parameter
Defined in jsonApi.builder.ts:74
Parameters:
Name
Type
key
string
value
string | number | boolean | undefined
Returns: this
Protected
parseResponse▸ parseResponse<Raw>(response
: HttpResponse): Promise‹JsonResponse‹Raw››
Inherited from RequestBuilder.parseResponse
Defined in jsonApi.builder.ts:117
Type parameters:
▪ Raw: RawResponse‹any, any›
Parameters:
Name
Type
response
HttpResponse
Returns: Promise‹JsonResponse‹Raw››
▸ resolveIncluded(resolveIncluded?
: undefined | false | true): this
Inherited from RequestBuilder.resolveIncluded
Defined in jsonApi.builder.ts:69
Parameters:
Name
Type
resolveIncluded?
undefined | false | true
Returns: this
▸ send(options
: HttpOptions): Promise‹JsonResponse‹Raw››
Overrides RequestBuilder.send
Defined in jsonApi.remove.ts:12
Parameters:
Name
Type
Default
options
HttpOptions
{}
Returns: Promise‹JsonResponse‹Raw››
▸ sort(key
: string | undefined, order
: SortOrder): this
Inherited from RequestBuilder.sort
Defined in jsonApi.builder.ts:95
Parameters:
Name
Type
key
string | undefined
order
Returns: this