Git Product home page Git Product logo

shikimori-browser-bundle's Introduction

Shikimori

Latest Stable Version Total Downloads Build Status Coverage Status Scrutinizer Code Quality SensioLabs Insight StyleCI License

Shikimori.org API browser

Read API documentation here: http://shikimori.org/api/doc

Installation

Pretty simple with Composer, run:

composer anime-db/shikimori-browser-bundle

Configuration

anime_db_shikimori_browser:
    # API host
    # As a default used 'https://shikimori.org'
    host: 'https://shikimori.org'

    # Prefix for API resurces
    # As a default used '/api/'
    prefix: '/api/'

    # HTTP User-Agent
    # No default value
    client: 'My Custom Bot 1.0'

Usage

First get browser

$browser = $this->get('anime_db.shikimori.browser');

List animes (docs)

$animes = $browser->get('animes', ['query' => ['limit' => 10]]);

or

$animes = $browser->get('animes?limit=10');

Mark all messages as read (docs)

$response = $browser->post('messages/read_all');

Update a message (docs)

$response = $browser->patch('messages/12', [
    'body' => [
        'message' => [
            'body' => 'blablabla',
        ],
    ],
]);

Update a comment (docs)

$response = $browser->put('comments/8', [
    'body' => [
        'message' => [
            'body' => 'blablabla',
        ],
    ],
]);

Destroy a message (docs)

$browser->delete('messages/12');

Catch exceptions

use AnimeDb\Bundle\ShikimoriBrowserBundle\Exception\NotFoundException;

try {
    $content = $browser->get('animes/1');
} catch (NotFoundException $e) {
    // anime not found
} catch (\Exception $e) {
    // other exceptions
}

You can customize request options. See Guzzle Documentation.

License

This bundle is under the MIT license. See the complete license in the file: LICENSE

shikimori-browser-bundle's People

Contributors

peter-gribanov avatar simbiant 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.