0 purchases
codestage requester
Features #
This is a the service package that codestage.ro uses for its cross platform apps.
It has a simple service interface that can be extended and a requester which binds all parameters
Usage #
Create a service that extends the CdsService class and make sure to add in its baseUrl super constructor the base url for that service.
Then, add a function with 2 super calls. The first one is to initialise the call with all the headers and parameters and the second one is to make the call.
To collect the data after the response you can simply add a .then clause. A more recommended way is to make the function in the requester to return the http.Response class from the http package. Then you can manipulate however you want the state of the app, without parsing functions as parameters.
Example #
class Service extends CdsService {
Service() : super(baseUrl: 'https://simple.api.to.add');
http.Response getAllNonPaginatedAuthenticated() {
// The first parameter [] is a list of only parameters that the API should have to filter the response parameters
super.configureServiceForRequest([], 'path/to/call', token: 'generatedTokenFromApiIfNeeded');
return super.request(CrudOperationType.getAll);
}
}
copied to clipboard
Additional information #
Copyright Codestage.ro | TasteDaBomb
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.