-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29b2ce2
commit e313234
Showing
13 changed files
with
756 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "tarantoolscript", | ||
"version": "0.9.1", | ||
"version": "0.10.0", | ||
"author": "Vitaliy Artemov [email protected]", | ||
"description": "TypeScript definitions for Tarantool Lua API.", | ||
"repository": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,229 @@ | ||
import { ClientStat } from './ClientStat'; | ||
import { HttpMethod } from './HttpMethod'; | ||
import { IoObject } from './IoObject'; | ||
import { RequestOptions } from './RequestOptions'; | ||
import { ResponseObject } from './ResponseObject'; | ||
|
||
export interface Client { | ||
/** | ||
* Make an HTTP request and receive a response. | ||
* @param method A request HTTP method. Possible values: `GET`, `POST`, `PUT`, `PATCH`, `OPTIONS`, `HEAD`, `DELETE`, `TRACE`, `CONNECT`. | ||
* @param url A request URL, for example, `https://httpbin.org/get`. | ||
* @param body A request body. | ||
* @param opts Request options. | ||
* @returns This method returns one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
request(method: HttpMethod, url: string, body?: string, opts: RequestOptions & { chunked: true }): IoObject; | ||
|
||
/** | ||
* Make an HTTP request and receive a response. | ||
* @param method A request HTTP method. Possible values: `GET`, `POST`, `PUT`, `PATCH`, `OPTIONS`, `HEAD`, `DELETE`, `TRACE`, `CONNECT`. | ||
* @param url A request URL, for example, `https://httpbin.org/get`. | ||
* @param body A request body. | ||
* @param opts Request options. | ||
* @returns This method returns one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
request(method: HttpMethod, url: string, body?: string, opts?: RequestOptions): ResponseObject; | ||
|
||
/** | ||
* Make a `GET` request and receive a response. | ||
* @param url A request URL, for example, `https://httpbin.org/get`. | ||
* @param opts Request options. | ||
* @returns This method might return one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
get(url: string, opts: RequestOptions & { chunked: true }): IoObject; | ||
|
||
/** | ||
* Make a `GET` request and receive a response. | ||
* @param url A request URL, for example, `https://httpbin.org/get`. | ||
* @param opts Request options. | ||
* @returns This method might return one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
get(url: string, opts?: RequestOptions): ResponseObject; | ||
|
||
/** | ||
* Make a `POST` request and receive a response. | ||
* @param url A request URL, for example, `https://httpbin.org/post`. | ||
* @param body A request body. | ||
* @param opts Request options. | ||
* @returns This method might return one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
post(url: string, body?: AnyTable, opts: RequestOptions & { chunked: true }): IoObject; | ||
|
||
/** | ||
* Make a `POST` request and receive a response. | ||
* @param url A request URL, for example, `https://httpbin.org/post`. | ||
* @param body A request body. | ||
* @param opts Request options. | ||
* @returns This method might return one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
post(url: string, body?: AnyTable, opts?: RequestOptions): ResponseObject; | ||
|
||
/** | ||
* Make a `PUT` request and receive a response. | ||
* @param url A request URL, for example, `https://httpbin.org/put`. | ||
* @param body A request body. | ||
* @param opts Request options. | ||
* @returns This method might return one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
put(url: string, body?: AnyTable, opts: RequestOptions & { chunked: true }): IoObject; | ||
|
||
/** | ||
* Make a `PUT` request and receive a response. | ||
* @param url A request URL, for example, `https://httpbin.org/put`. | ||
* @param body A request body. | ||
* @param opts Request options. | ||
* @returns This method might return one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
put(url: string, body?: AnyTable, opts?: RequestOptions): ResponseObject; | ||
|
||
/** | ||
* Make a `PATCH` request and receive a response. | ||
* @param url A request URL, for example, `https://httpbin.org/patch`. | ||
* @param body A request body. | ||
* @param opts Request options. | ||
* @returns This method might return one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
patch(url: string, body?: AnyTable, opts: RequestOptions & { chunked: true }): IoObject; | ||
|
||
/** | ||
* Make a `PATCH` request and receive a response. | ||
* @param url A request URL, for example, `https://httpbin.org/patch`. | ||
* @param body A request body. | ||
* @param opts Request options. | ||
* @returns This method might return one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
patch(url: string, body?: AnyTable, opts?: RequestOptions): ResponseObject; | ||
|
||
/** | ||
* Make a `DELETE` request and receive a response. | ||
* @param url A request URL, for example, `https://httpbin.org/delete`. | ||
* @param opts Request options. | ||
* @returns This method might return one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
delete(url: string, opts: RequestOptions & { chunked: true }): IoObject; | ||
|
||
/** | ||
* Make a `DELETE` request and receive a response. | ||
* @param url A request URL, for example, `https://httpbin.org/delete`. | ||
* @param opts Request options. | ||
* @returns This method might return one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
delete(url: string, opts?: RequestOptions): ResponseObject; | ||
|
||
/** | ||
* Make a `HEAD` request and receive a response. | ||
* @param url A request URL, for example, `https://httpbin.org/head`. | ||
* @param opts Request options. | ||
* @returns This method might return one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
head(url: string, opts: RequestOptions & { chunked: true }): IoObject; | ||
|
||
/** | ||
* Make a `HEAD` request and receive a response. | ||
* @param url A request URL, for example, `https://httpbin.org/head`. | ||
* @param opts Request options. | ||
* @returns This method might return one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
head(url: string, opts?: RequestOptions): ResponseObject; | ||
|
||
/** | ||
* Make a `OPTIONS` request and receive a response. | ||
* @param url A request URL, for example, `https://httpbin.org/options`. | ||
* @param opts Request options. | ||
* @returns This method might return one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
options(url: string, opts: RequestOptions & { chunked: true }): IoObject; | ||
|
||
/** | ||
* Make a `OPTIONS` request and receive a response. | ||
* @param url A request URL, for example, `https://httpbin.org/options`. | ||
* @param opts Request options. | ||
* @returns This method might return one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
options(url: string, opts?: RequestOptions): ResponseObject; | ||
|
||
/** | ||
* Make a `TRACE` request and receive a response. | ||
* @param url A request URL, for example, `https://httpbin.org/trace`. | ||
* @param opts Request options. | ||
* @returns This method might return one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
trace(url: string, opts: RequestOptions & { chunked: true }): IoObject; | ||
|
||
/** | ||
* Make a `TRACE` request and receive a response. | ||
* @param url A request URL, for example, `https://httpbin.org/trace`. | ||
* @param opts Request options. | ||
* @returns This method might return one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
trace(url: string, opts?: RequestOptions): ResponseObject; | ||
|
||
/** | ||
* Make a `CONNECT` request and receive a response. | ||
* @param url A request URL, for example, `https://httpbin.org/connect`. | ||
* @param opts Request options. | ||
* @returns This method might return one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
connect(url: string, opts: RequestOptions & { chunked: true }): IoObject; | ||
|
||
/** | ||
* Make a `CONNECT` request and receive a response. | ||
* @param url A request URL, for example, `https://httpbin.org/connect`. | ||
* @param opts Request options. | ||
* @returns This method might return one of the following objects: | ||
* - `response_object`; | ||
* - `io_object` if `request_options.chunked` is set to `true`. | ||
*/ | ||
connect(url: string, opts?: RequestOptions): ResponseObject; | ||
|
||
/** | ||
* Get a table with statistics for the HTTP client. | ||
*/ | ||
stat(): ClientStat; | ||
|
||
/** | ||
* Since: `2.11.0`. | ||
* | ||
* Decoders used to deserialize response data based on the `Content-Type` header value. | ||
*/ | ||
decoders: { [ key: string ]: (this: void) => (body: string, _content_type: unknown) => unknown }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export interface ClientOptions { | ||
/** | ||
* Specifies the maximum number of entries in the cache. This option affects libcurl `CURLMOPT_MAXCONNECTS`. The default is `-1`. | ||
*/ | ||
max_connections?: number; | ||
|
||
/** | ||
* Specifies the maximum number of active connections. This option affects libcurl `CURLMOPT_MAX_TOTAL_CONNECTIONS`. | ||
*/ | ||
max_total_connections?: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
export interface ClientStat { | ||
/** | ||
* The number of currently executing requests. | ||
*/ | ||
active_requests: number; | ||
|
||
/** | ||
* The total number of sockets added into an event loop. | ||
*/ | ||
sockets_added: number; | ||
|
||
/** | ||
* The total number of sockets deleted from an event loop. | ||
*/ | ||
sockets_deleted: number; | ||
|
||
/** | ||
* The total number of requests. | ||
*/ | ||
total_requests: number; | ||
|
||
/** | ||
* The total number of requests that returned HTTP `200 OK` responses. | ||
*/ | ||
http_200_responses: number; | ||
|
||
/** | ||
* The total number of requests that returned non-`200 OK` responses. | ||
*/ | ||
http_other_responses: number; | ||
|
||
/** | ||
* The total number of failed requests, including system, curl, and HTTP errors. | ||
*/ | ||
failed_requests: number; | ||
} |
Oops, something went wrong.