codestage_requester 1.0.13 copy "codestage_requester: ^1.0.13" to clipboard
codestage_requester: ^1.0.13 copied to clipboard

Codestage Requester that contains API and Service interfaces

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);
  }
}

Additional information #

Copyright Codestage.ro | TasteDaBomb

0
likes
110
pub points
0%
popularity

Publisher

unverified uploader

Codestage Requester that contains API and Service interfaces

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

camera, flutter, http

More

Packages that depend on codestage_requester