Namespace: Requests

Requests

Source:

Type Definitions

CssFetchRequest

Type:
  • Object
Properties:
Name Type Description
url String

the request URL

options Object

the options with which the request has been created

Properties
Name Type Attributes Default Description
method String

the request method

headers Object <nullable>

the set headers for the request

credentials String <nullable>

the credentials setting for the request

body String <nullable>

the provided request body of the request

timeout Number <optional>
<nullable>
10000

milliseconds until the request fails due to a timeout

execute Requests.CssFetchRequestExecuteFunction

call this to execute the request

Source:

CssFetchRequestExecuteFunction(resolveToopt, nullable, insertTargetopt, dataIdopt, nullable, mediaopt, nullable, resolveSourcedOnInsertopt, nullable) → {Basic.Deferred.<Requests.CssFetchResponse>}

Parameters:
Name Type Attributes Default Description
resolveTo String <optional>
<nullable>
'element'

defines what the response should resolve to, may either be "element", "raw" or "sourced-element" (which is the special case to insert a link with a href instead of doing a real request)

insertTarget HTMLElement | Object <optional>
null

defines if the retrieved value should be inserted as a dom element and if so where; if this is an element, the value gets appended into that as a style/link tag, otherwise the properties below apply

Properties
Name Type Attributes Description
element HTMLElement <optional>
<nullable>

target element in relation to which the resolved value should be inserted into the dom

position String <optional>
<nullable>

defines where, in relation to the target element, the resolved value will be inserted, see insertNode for more details

dataId String <optional>
<nullable>
null

if you need an identifier, to find inserted elements again after they are inserted into dom, you can define an id here, which will be set as the "data-id" attribute on the created node

media String <optional>
<nullable>
'all'

define the style's media attribute here to target the output device(s), could be "screen" or "print" for example

resolveSourcedOnInsert Boolean <optional>
<nullable>
false

normally sourced elements resolve on load to work with the request as far as possible, but if you want to ignore the request after insertion, you may set this parameter to "true", resulting in immediate resolution after insertion

Source:
See:
Returns:
Type
Basic.Deferred.<Requests.CssFetchResponse>

CssFetchResponse

Type:
  • HTMLElement | String
Source:

FetchRequest

Type:
  • Object
Properties:
Name Type Description
url String

the request URL

options Object

the options with which the request has been created

Properties
Name Type Attributes Default Description
method String

the request method

headers Object <nullable>

the set headers for the request

credentials String <nullable>

the credentials setting for the request

body String <nullable>

the provided request body of the request

timeout Number <optional>
<nullable>
10000

milliseconds until the request fails due to a timeout

execute Requests.FetchRequestExecuteFunction

call this to execute the request

Source:

FetchRequestExecuteFunction() → {Basic.Deferred.<Requests.FetchResponse>}

Source:
Returns:
Type
Basic.Deferred.<Requests.FetchResponse>

FetchResponse

Type:
  • Object
Properties:
Name Type Description
ok Boolean

returns true if the request received a status in the OK range (200-299)

status Number

contains the status code of the response, e.g. 404 for a not found resource, 200 for a success

statusText String

a message related to the status attribute, e.g. OK for a status 200

clone function

will return another object with the same shape and content as response

text function

will return the response content as plain text

json function

will return the response content as JSON

blob function

will return the response content as a (binary) blob

headers Object

we do not implement a full spec-compliant Headers class, but emulate some of the functionality

Properties
Name Type Description
keys function

returns an Iterable containing the key for every header in the response, transform to array with Array.from

entries function

returns an Iterable containing the [key, value] pairs for every header in the response, transform to array with Array.from

get function

returns the value associated with the given key

has function

returns a boolean asserting the existence of a value for the given key among the response headers

Source:

HtmlFetchRequest

Type:
  • Object
Properties:
Name Type Description
url String

the request URL

options Object

the options with which the request has been created

Properties
Name Type Attributes Default Description
method String

the request method

headers Object <nullable>

the set headers for the request

credentials String <nullable>

the credentials setting for the request

body String <nullable>

the provided request body of the request

timeout Number <optional>
<nullable>
10000

milliseconds until the request fails due to a timeout

execute Requests.HtmlFetchRequestExecuteFunction

call this to execute the request

Source:

HtmlFetchRequestExecuteFunction(resolveToopt, nullable, insertTargetopt, dataIdopt, nullable, selectoropt, nullable, selectAllopt, nullable) → {Basic.Deferred.<Requests.HtmlFetchResponse>}

Parameters:
Name Type Attributes Default Description
resolveTo String <optional>
<nullable>
'element'

defines what the response should resolve to, may either be "element" or "raw"

insertTarget HTMLElement | Object <optional>
null

defines if the retrieved value should be inserted as a dom element and if so where; if this is an element, the value gets appended into that as (a) node(s), otherwise the properties below apply

Properties
Name Type Attributes Description
element HTMLElement <optional>
<nullable>

target element in relation to which the resolved value should be inserted into the dom

position String <optional>
<nullable>

defines where, in relation to the target element, the resolved value will be inserted, see insertNode for more details

dataId String <optional>
<nullable>
null

if you need an identifier, to find inserted elements again after they are inserted into dom, you can define an id here, which will be set as the "data-id" attribute on the created node(s)

selector String <optional>
<nullable>
null

if you'd like to preselect something from the result, you may define a regular query selector to find matching elements in the result

selectAll Boolean <optional>
<nullable>
false

usually, if a selector is defined, we select a single element, if you need to select a list, set this to true

Source:
See:
Returns:
Type
Basic.Deferred.<Requests.HtmlFetchResponse>

HtmlFetchResponse

Type:
  • HTMLElement | Array.<HTMLElement> | String
Source:

JsFetchRequest

Type:
  • Object
Properties:
Name Type Description
url String

the request URL

options Object

the options with which the request has been created

Properties
Name Type Attributes Default Description
method String

the request method

headers Object <nullable>

the set headers for the request

credentials String <nullable>

the credentials setting for the request

body String <nullable>

the provided request body of the request

timeout Number <optional>
<nullable>
10000

milliseconds until the request fails due to a timeout

execute Requests.JsFetchRequestExecuteFunction

call this to execute the request

Source:

JsFetchRequestExecuteFunction(resolveToopt, nullable, insertTargetopt, dataIdopt, nullable, resolveSourcedOnInsertopt, nullable) → {Basic.Deferred.<Requests.JsFetchResponse>}

Parameters:
Name Type Attributes Default Description
resolveTo String <optional>
<nullable>
'element'

defines what the response should resolve to, may either be "element", "raw" or "sourced-element" (which is the special case to insert a script with a src instead of doing a real request)

insertTarget HTMLElement | Object <optional>
null

defines if the retrieved value should be inserted as a dom element and if so where; if this is an element, the value gets appended into that as a script tag, otherwise the properties below apply

Properties
Name Type Attributes Description
element HTMLElement <optional>
<nullable>

target element in relation to which the resolved value should be inserted into the dom

position String <optional>
<nullable>

defines where, in relation to the target element, the resolved value will be inserted, see insertNode for more details

dataId String <optional>
<nullable>
null

if you need an identifier, to find inserted elements again after they are inserted into dom, you can define an id here, which will be set as the "data-id" attribute on the created node

resolveSourcedOnInsert Boolean <optional>
<nullable>
false

normally sourced elements resolve on load to work with the request as far as possible, but if you want to ignore the request after insertion, you may set this parameter to "true", resulting in immediate resolution after insertion

Source:
See:
Returns:
Type
Basic.Deferred.<Requests.JsFetchResponse>

JsFetchResponse

Type:
  • HTMLElement | String
Source:

JsonFetchRequest

Type:
  • Object
Properties:
Name Type Description
url String

the request URL

options Object

the options with which the request has been created

Properties
Name Type Attributes Default Description
method String

the request method

headers Object <nullable>

the set headers for the request

credentials String <nullable>

the credentials setting for the request

body String <nullable>

the provided request body of the request

timeout Number <optional>
<nullable>
10000

milliseconds until the request fails due to a timeout

execute Requests.JsonFetchRequestExecuteFunction

call this to execute the request

Source:

JsonFetchRequestExecuteFunction(resolveToopt, nullable, insertTargetopt, dataIdopt, nullable) → {Basic.Deferred.<Requests.JsonFetchResponse>}

Parameters:
Name Type Attributes Default Description
resolveTo String <optional>
<nullable>
'object'

defines what the response should resolve to, may either be "object", "element" or "raw"

insertTarget HTMLElement | Object <optional>
null

defines if the retrieved value should be inserted as a dom element and if so where; if this is an element, the value gets appended into that as a script tag, otherwise the properties below apply

Properties
Name Type Attributes Description
element HTMLElement <optional>
<nullable>

target element in relation to which the resolved value should be inserted into the dom

position String <optional>
<nullable>

defines where, in relation to the target element, the resolved value will be inserted, see insertNode for more details

dataId String <optional>
<nullable>
null

if you need an identifier, to find inserted elements again after they are inserted into dom, you can define an id here, which will be set as the "data-id" attribute on the created node

Source:
See:
Returns:
Type
Basic.Deferred.<Requests.JsonFetchResponse>

JsonFetchResponse

Type:
  • Object | HTMLElement | String
Source:

RestfulJsonClientConfig

Type:
  • Object
Properties:
Name Type Description
url URL

the current request URL, build from baseUrl and path

options Object

the current options with which requests are been created, build from baseOptions and options, see createFetchRequest for details

params URLSearchParams

the current URL params

data Object

the current payload to be sent with requests like POST and PUT

Source:
See: