furo-collection-agent

furo-collection-agent #

@furo/data v2.18.0
import '@furo/data/src/furo-collection-agent.js';
exports FuroCollectionAgent js
exports <furo-collection-agent> custom-element-definition
superclass LitElement
mixes FBP

summary interface component to handle collection requests

furo-collection-agent is an interface component to handle collection requests.

1
2
3
4
5
6
7
<furo-collection-agent
   service="Servicename"
   fn-hts-in="--hts"></furo-collection-agent>

<!-- produces a hateoas link array -->
<furo-deep-link
    service="Servicename" at-hts-out="--hts"></furo-deep-link>

before you can do any requests, the service and the HATEOAS must be defined

Attributes and Properties #

view #

view String

Parameter for contextual representations

To reduce network traffic, it is sometimes useful to allow the client to limit which parts of the resource the server should return in its responses, returning a view of the resource (i.e. specialized version for dropdowns ) instead of the full resource representation.

https://cloud.google.com/apis/design/design_patterns#resource_view

view=smallcards

Only useable if your service has implemented this feature.

filter #

filter String

Set the filter.

Hint: use the FieldNode._base64 property to send complex objects as a filter and decode it on the server side.

Only useable if your service has implemented this feature.

service #

service String

Setze den Service

pageSize #

page-size Number

Sets pagination size in the List request.

Only useful if your service supports pagination.

fields #

fields String

Comma separated list of fields (like a fieldmask) used for partial representation / partial responses.

If your services supports this feature, you will receive a subset of the fields.

orderBy #

order-by String

Sorting order

order-by=“foo,-bar” means foo asc and bar desc

https://cloud.google.com/apis/design/design_patterns#sorting_order

To avoid sql injection errors we do not send any sql like syntax!

Only useable if your service has implemented this feature.

listOnHtsIn #

list-on-hts-in Boolean

Executes a list when a rel=“list” is injected.

loadRelOnHtsIn #

load-rel-on-hts-in Boolean

Executes a loadRel when a rel=“XXXX” is injected.

You have to set the attributes rel and method to have this working.

This is useful for getting “custom” collections.

rel #

rel String

rel which should be used on load rel

method #

method String

for compatibility reasons you have to specify the method inside of the service.

This attribute should not be needed in future versions, because the rel already contains all relevant information.

Events #

request-aborted #

at-request-abortedRequest

Fired if the request was successfully cancelled

request-started #

at-request-startedRequest

Fired when a request is sent.

response-raw #

at-response-rawObject

Fired when a response is received.

response-error #

at-response-errorObject

Fired when an error has occoured. This is a general error event. The specific error events are fired additionally.

response-error-[status-code] #

at-response-error-[status-code]Object

Fired when an error has occoured. This is a specific error event.

fatal-error #

at-fatal-errorRequest

Requests are made via the Fetch API if possible.Fallback XMLHttpRequest

response-error-4xx #

at-response-error-4xxObject

Fired when an error has occoured. This is a group error event. E.g. response-error-5xx, response-error-4xx

response-error-5xx #

at-response-error-5xxObject

Fired when an error has occoured. This is a group error event. E.g. response-error-5xx, response-error-4xx

response-error-raw #

at-response-error-rawObject

Fired when a error has occoured.

response #

at-responseObject

Fired when a response is received.

response-hts-updated #

at-response-hts-updatedhts

Fired when the hts was updated by the received response.

filter-changed #

at-filter-changed``

Fired when filter was updated with fn-set-filter.

hts-updated #

at-hts-updatedArray|HATEOAS

Fired when hateoas was updated from response.

hts-injected #

at-hts-injectedHateoas links

Fired when hateoas was updated

Methods #

setFields #

setFields(fields String ) ⟹ void

String fn-set-fields

Comma separated list of fields (like a fieldmask) used for partial representation / partial responses.

If your services supports this feature, you will receive a subset of the fields.

  • fields Comma separated list of fields

bindRequestData #

bindRequestData(dataObject `` ) ⟹ void

`` fn-bind-request-data

Binds a furo-data-object type. Use this if you want save data.

  • dataObject

setOrderBy #

setOrderBy(order String ) ⟹ void

String fn-set-order-by

Sorting order

order-by=“foo,-bar” means foo asc and bar desc

https://cloud.google.com/apis/design/design_patterns#sorting_order

To avoid sql injection errors we do not send any sql like syntax!

Only useable if your service has implemented this feature.

  • order Comma separated list of sort orders

clearFilter #

clearFilter() ⟹ void

*fn-clear-filter

clear the setted filter



setFilter #

setFilter(filterstring String ) ⟹ void

String fn-set-filter

Set the filter.

Hint: use the FieldNode._base64 property to send complex objects as a filter and decode it on the server side.

Only useable if your service has implemented this feature.

  • filterstring String for your filter.

setPageSize #

setPageSize(size Number ) ⟹ void

Number fn-set-page-size

Sets pagination size in the List request.

Only useful if your service supports pagination.

  • size requested size of a page.

updateQp #

updateQp(qp `` key Object ) ⟹ void

`` Object fn-update-qp

Update query params a qp like {“active”:true} will just update the qp active

If the current value of the qp is not the same like the injected value, a qp-changed event will be fired

  • qp
  • key value pairs

setQp #

setQp(qp `` key Object ) ⟹ void

`` Object fn-set-qp

Set query params All existing query params are replaced by the transferred parameters If the transferred object is empty, all the values will be removed! The AgentHelper fires a qp-set event after the query params are replaced.

  • qp
  • key value pairs

clearQp #

clearQp() ⟹ void

*fn-clear-qp

clear the query params that you have setted before



list #

list() ⟹ void

*fn-list

loads the entity if hts is available



load #

load() ⟹ void

*fn-load

loads the entity if hts is available



loadRel #

loadRel() ⟹ void

*fn-load-rel

loads the entity following the link which is specified on the attribute rel if it is available.



searchRel #

searchRel(term `` ) ⟹ void

`` fn-search-rel

search for a term following the link which is specified on the attribute rel

This will set the query param q and execute the query.

  • term

search(term `` ) ⟹ void

`` fn-search

search for a term.

This will set the query param q and triggers a list()

  • term

first #

first() ⟹ void

*fn-first

loads the entity if hts is available



prev #

prev() ⟹ void

*fn-prev

loads the entity if hts is available



next #

next() ⟹ void

*fn-next

loads the entity if hts is available



last #

last() ⟹ void

*fn-last

loads the entity if hts is available



htsIn #

htsIn(hts `` ) ⟹ void

`` fn-hts-in

Inject HATEOAS links.

  • hts

abortPendingRequest #

abortPendingRequest() ⟹ void

*fn-abort-pending-request

Aborts a pending request