Git Product home page Git Product logo

thetale_api_dart's Introduction

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.

thetale_api_dart's People

Contributors

ariedov avatar

Stargazers

Aliaksei Yaletski avatar dev avatar  avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.