types urlTokenBaseHTTPClient.URLTokenBaseHTTPClient
@algorandfoundation/algokit-utils / types/urlTokenBaseHTTPClient / URLTokenBaseHTTPClient
Class: URLTokenBaseHTTPClient¶
types/urlTokenBaseHTTPClient.URLTokenBaseHTTPClient
Implementation of BaseHTTPClient that uses a URL and a token and make the REST queries using fetch. This is the default implementation of BaseHTTPClient.
Hierarchy¶
URLTokenBaseHTTPClient
Implements¶
BaseHTTPClient
Table of contents¶
Constructors¶
Properties¶
Methods¶
Constructors¶
constructor¶
• new URLTokenBaseHTTPClient(tokenHeader
, baseServer
, port?
, defaultHeaders?
): URLTokenBaseHTTPClient
Parameters¶
Name | Type |
---|---|
tokenHeader |
TokenHeader |
baseServer |
string |
port? |
string | number |
defaultHeaders |
Record \<string , any > |
Returns¶
Defined in¶
src/types/urlTokenBaseHTTPClient.ts:47
Properties¶
baseURL¶
• Private
Readonly
baseURL: URL
Defined in¶
src/types/urlTokenBaseHTTPClient.ts:43
defaultHeaders¶
• Private
defaultHeaders: Record
\<string
, any
> = {}
Defined in¶
src/types/urlTokenBaseHTTPClient.ts:52
tokenHeader¶
• Private
Readonly
tokenHeader: TokenHeader
Defined in¶
src/types/urlTokenBaseHTTPClient.ts:44
Methods¶
delete¶
▸ delete(relativePath
, data
, query?
, requestHeaders?
): Promise
\<BaseHTTPClientResponse
>
Parameters¶
Name | Type |
---|---|
relativePath |
string |
data |
Uint8Array |
query? |
Query \<string > |
requestHeaders |
Record \<string , string > |
Returns¶
Promise
\<BaseHTTPClientResponse
>
Implementation of¶
BaseHTTPClient.delete
Defined in¶
src/types/urlTokenBaseHTTPClient.ts:184
get¶
▸ get(relativePath
, query?
, requestHeaders?
): Promise
\<BaseHTTPClientResponse
>
Parameters¶
Name | Type |
---|---|
relativePath |
string |
query? |
Query \<string > |
requestHeaders |
Record \<string , string > |
Returns¶
Promise
\<BaseHTTPClientResponse
>
Implementation of¶
BaseHTTPClient.get
Defined in¶
src/types/urlTokenBaseHTTPClient.ts:145
getURL¶
▸ getURL(relativePath
, query?
): string
Compute the URL for a path relative to the instance's address
Parameters¶
Name | Type | Description |
---|---|---|
relativePath |
string |
A path string |
query? |
Query \<string > |
An optional key-value object of query parameters to add to the URL. If the relativePath already has query parameters on it, the additional parameters defined here will be added to the URL without modifying those (unless a key collision occurs). |
Returns¶
string
A URL string
Defined in¶
src/types/urlTokenBaseHTTPClient.ts:79
post¶
▸ post(relativePath
, data
, query?
, requestHeaders?
): Promise
\<BaseHTTPClientResponse
>
Parameters¶
Name | Type |
---|---|
relativePath |
string |
data |
Uint8Array |
query? |
Query \<string > |
requestHeaders |
Record \<string , string > |
Returns¶
Promise
\<BaseHTTPClientResponse
>
Implementation of¶
BaseHTTPClient.post
Defined in¶
src/types/urlTokenBaseHTTPClient.ts:161
checkHttpError¶
▸ checkHttpError(res
): Promise
\<void
>
Parameters¶
Name | Type |
---|---|
res |
Response |
Returns¶
Promise
\<void
>
Defined in¶
src/types/urlTokenBaseHTTPClient.ts:105
formatFetchResponse¶
▸ formatFetchResponse(res
): Promise
\<BaseHTTPClientResponse
>
Parameters¶
Name | Type |
---|---|
res |
Response |
Returns¶
Promise
\<BaseHTTPClientResponse
>
Defined in¶
src/types/urlTokenBaseHTTPClient.ts:136
formatFetchResponseHeaders¶
▸ formatFetchResponseHeaders(headers
): Record
\<string
, string
>
Parameters¶
Name | Type |
---|---|
headers |
Headers |
Returns¶
Record
\<string
, string
>