thetale_api 1.0.5 copy "thetale_api: ^1.0.5" to clipboard
thetale_api: ^1.0.5 copied to clipboard

An implementation of https://the-tale.org api in Dart.

The Tale API #

Build Status codecov pub package

This is an unofficial way to create a basic API for the ZPG https://the-tale.org

Usage #

There are two classes to use TheTaleApi and TheTaleApiWrapper. The only difference between these two are that TheTaleApiWrapper handles the session storing using SessionStorage.

If you don't want any code to handle the session stuff, just use TheTaleApi.

To create TheTaleApiWrapper use the WrapperBuilder.

final wrapper = WrapperBuilder().build(apiUrl, applicationId, appVersion);
wrapper.setStorage(LocalSessionStorage());

You have to set the SessionStorage to make sure the session with preserve between method calls. There is no SessionStorage implementations available, a basic in-memory example would look like this:

class LocalSessionStorage implements SessionStorage {
  SessionInfo _sessionInfo;

  @override
  Future<void> addSession(SessionInfo sessionInfo) async {
    _sessionInfo = sessionInfo;
  }

  @override
  Future<SessionInfo> readSession() async {
    return _sessionInfo;
  }

  @override
  Future<void> updateSession(SessionInfo sessionInfo) async {
    _sessionInfo = sessionInfo;
  }
}

Specifics #

Only a few methods will actually set the session: apiInfo() and authStatus(). This means that the session will be empty if you don't call apiInfo() before any other call.

Please, refer to the example for more details.

0
likes
30
pub points
0%
popularity

Publisher

unverified uploader

An implementation of https://the-tale.org api in Dart.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

http

More

Packages that depend on thetale_api