endpoint property
Callback to produce a REST path from a Query. An instance
argument is provided
only when it is available to the invoking repository method (i.e. upsert
or delete
).
This must be a string to maintain const
-ability of the annotation.
It should adhere to the standard of RestEndpointCallback
and include a line
termination (;
or }
).
Example:
({Query query, Model instance}) {
if (query.providerArgs['limit'] == 1) {
return "person/${query.providerArgs['id']}";
}
return "people";
}
Should be included as
endpoint: r"""{
if (query.providerArgs['limit'] == 1) {
return "person/${query.providerArgs['id']}";
}
return "people";
}"""
This function will serve all remote commands from the repository.
To determine which is being invoked, use query.action
.
This field is copied to the Adapter
.
Implementation
final String? endpoint;