WebServiceConnector
@nevermined-io/sdk - v3.0.32 / WebServiceConnector
Class: WebServiceConnector
Provides a common interface to web services.
Table of contents
Constructors
Properties
Methods
- _sleep
- delete
- downloadFile
- downloadUrl
- fetch
- fetchCID
- fetchToken
- get
- getFileResponse
- post
- put
- uploadFile
- uploadMessage
- getIPFSAuthToken
Constructors
constructor
• new WebServiceConnector(config
): WebServiceConnector
Parameters
Name | Type |
---|---|
config | InstantiableConfig |
Returns
Defined in
src/nevermined/utils/WebServiceConnector.ts:26
Properties
config
• config: InstantiableConfig
Defined in
src/nevermined/utils/WebServiceConnector.ts:24
Methods
_sleep
▸ _sleep(ms
): Promise
\<unknown
>
Parameters
Name | Type |
---|---|
ms | number |
Returns
Promise
\<unknown
>
Defined in
src/nevermined/utils/WebServiceConnector.ts:238
delete
▸ delete(url
, payload?
, headers?
): Promise
\<Response
>
Parameters
Name | Type |
---|---|
url | string |
payload? | BodyInit |
headers | Object |
Returns
Promise
\<Response
>
Defined in
src/nevermined/utils/WebServiceConnector.ts:71
downloadFile
▸ downloadFile(url
, destination?
, index?
, headers?
): Promise
\<string
>
Parameters
Name | Type |
---|---|
url | string |
destination? | string |
index? | number |
headers? | Object |
Returns
Promise
\<string
>
Defined in
src/nevermined/utils/WebServiceConnector.ts:86
downloadUrl
▸ downloadUrl(url
, headers?
): Promise
\<string
>
Parameters
Name | Type |
---|---|
url | string |
headers? | any |
Returns
Promise
\<string
>
Defined in
src/nevermined/utils/WebServiceConnector.ts:139
fetch
▸ fetch(url
, opts
, numberTries?
): Promise
\<Response
>
Parameters
Name | Type | Default value |
---|---|---|
url | any | undefined |
opts | RequestInit | undefined |
numberTries | number | 1 |
Returns
Promise
\<Response
>
Defined in
src/nevermined/utils/WebServiceConnector.ts:221
fetchCID
▸ fetchCID(cid
): Promise
\<string
>
Parameters
Name | Type |
---|---|
cid | string |
Returns
Promise
\<string
>
Defined in
src/nevermined/utils/WebServiceConnector.ts:193
fetchToken
▸ fetchToken(url
, grantToken
, numberTries?
, apiKeyHash?
): Promise
\<Response
>
Parameters
Name | Type | Default value |
---|---|---|
url | string | undefined |
grantToken | string | undefined |
numberTries | number | 1 |
apiKeyHash? | string | undefined |
Returns
Promise
\<Response
>
Defined in
src/nevermined/utils/WebServiceConnector.ts:165
get
▸ get(url
, headers?
): Promise
\<Response
>
Parameters
Name | Type |
---|---|
url | any |
headers | Object |
Returns
Promise
\<Response
>
Defined in
src/nevermined/utils/WebServiceConnector.ts:47
getFileResponse
▸ getFileResponse(url
, index?
, headers?
): Promise
\<{ name
: string
; response
: Response
}>
Parameters
Name | Type |
---|---|
url | string |
index? | number |
headers? | Object |
Returns
Promise
\<{ name
: string
; response
: Response
}>
Defined in
src/nevermined/utils/WebServiceConnector.ts:113
post
▸ post(url
, payload
, headers?
): Promise
\<Response
>
Parameters
Name | Type |
---|---|
url | string |
payload | BodyInit |
headers | Object |
Returns
Promise
\<Response
>
Defined in
src/nevermined/utils/WebServiceConnector.ts:32
put
▸ put(url
, payload
, headers?
): Promise
\<Response
>
Parameters
Name | Type |
---|---|
url | string |
payload | BodyInit |
headers | Object |
Returns
Promise
\<Response
>
Defined in
src/nevermined/utils/WebServiceConnector.ts:56
uploadFile
▸ uploadFile(url
, data
, encrypt?
): Promise
\<any
>
Parameters
Name | Type |
---|---|
url | string |
data | ReadStream |
encrypt? | boolean |
Returns
Promise
\<any
>
Defined in
src/nevermined/utils/WebServiceConnector.ts:156
uploadMessage
▸ uploadMessage(url
, data
, encrypt?
): Promise
\<any
>
Parameters
Name | Type |
---|---|
url | string |
data | string |
encrypt? | boolean |
Returns
Promise
\<any
>
Defined in
src/nevermined/utils/WebServiceConnector.ts:147
getIPFSAuthToken
▸ getIPFSAuthToken(): undefined
| string
Returns
undefined
| string