2017 © Pedro Peláez
 

library naija-emoji

image

ibonly/naija-emoji

  • Thursday, December 3, 2015
  • by andela-iadeniyi
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

emojinaija

Build Status License Quality Score Scrutinizer Code Quality Code Climate Test Coverage, (*1)

Emojinaija is a restful API service that provide access for emoji management. Just link to the emojinaija., (*2)

Installation

PHP 5.5+ and Composer are required., (*3)

Via Composer, (*4)

``` bash $ composer require ibonly/naija-emoji $ composer install, (*5)


## Usage ### API ENDPOINT
    EndPoint                        Public Access
POST /auth/Login                        TRUE
GET /auth/Logout                        FALSE
POST /emojis                            FALSE
GET /emojis/                            TRUE
GET /emojis/{id}                        TRUE
POST /emojis/{id}                       FALSE
PATCH /emojis/{id}                      FALSE
PUT /emojis/{id}                        FALSE
DELETE /emojis/{id}                      FALSE

### API FUNCTIONALITY
    EndPoint                            Functionality
POST /auth/login                   Logs a user in
GET /auth/logout                   Logs a user out
GET /emojis                        List all the created emojis.
GET /emojis/{id}                   Gets a single emoji
POST /emojis                       Create a new emoji
PUT /emojis/{id}                   Updates an emoji
PATCH /emojis/{id}                 Partially updates an emoji
DELETE /emojis/{id}                Deletes a single emoji


## Methods accessible to the public ####Single emoji retrieval REQUEST: ``` bash GET https://emojinaija.herokuapp.com/emoji/1 HEADER: {"Content-Type": "application/json"}

RESPONSE MESSAGE: If emoji with id of 1 exist: ``` bash HEADER: {"status": 200} BODY: [ { "id": 1, "name": "lips", "char": "�" "keyword": [ "lips", "parts", "body", "kiss" ], "category": "human", "date_created": "2015-11-19 22:37:08", "date_modified": "2015-10-19 22:37:08", "created_by": "foo" } ], (*6)

RESPONSE MESSAGE: If emoji of id 1 is not found
``` bash
    HEADER: {"status": 404}
    BODY:
    {
      "message": "Not Found"
    }
  • Retrieve all emoji

REQUEST: ``` bash HEADER: GET https://emojinaija.herokuapp.com/emojis HEADER: {"Content-Type": "application/json"}, (*7)

RESPONSE MESSAGE: Get all emoji:
``` php
    HEADER: {"status": 200}
    BODY: If there are saved resources
    [
        {
            "id": 3,
            "name": "Olopa",
            "char": "👮",
            "keywords": [
              "man",
              "police",
              "human"
            ],
            "category": "Peoples",
            "date_created": "2015-11-25 09:30:19",
            "date_modified": "2015-11-25 09:35:00",
            "created_by": "foo"
          },
          {
            "id": 4,
            "name": "nose",
            "char": "👃",
            "keywords": [
              "human parts",
              "nose",
              "body"
            ],
            "category": "human",
            "date_created": "2015-11-26 09:09:46",
            "date_modified": "2015-11-26 09:09:46",
            "created_by": "foo"
          },
          {
            "id": 5,
            "name": "Prof",
            "char": "👴",
            "keywords": [
              "Human",
              "People"
            ],
            "category": "Human",
            "date_created": "2015-11-26 15:32:19",
            "date_modified": "2015-11-26 15:32:19",
            "created_by": "foo"
        }
    ]

RESPONSE MESSAGE: If no emoji found: ``` bash HEADER: {"status": 404} BODY: { "message": "Not Found" }, (*8)

* In order to access private methods, Registration is required and a token will be generated for the registered user when logged in. The token generated will be used to access private API.

* Registration

REQUEST:
``` bash
    POST https://emojinaija.herokuapp.com/register
    HEADER: {"Content-Type": "application/json"}
    BODY:
    {
      "username": your_preferred_username,
      "password": your_preferred_password
    }

RESPONSE MESSAGE: ``` bash HEADER: {"status": 200} BODY: { "username": "ogeni", "message": "Registration Successful. Please Login to generate your token" }, (*9)


* Login authentication REQUEST: ``` bash POST https://emojinaija.herokuapp.com/auth/login HEADER: {"Content-Type": "application/json"} BODY: { "username": your_username, "password": your_password }

RESPONSE MESSAGE: ``` bash HEADER: {"status": 200} BODY: { "username": "user", "Authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9eyJpc3" }, (*10)


* Logout REQUEST: ``` bash GET https://emojinaija.herokuapp.com/auth/logout HEADER: { "Content-Type": "application/json", "Authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9eyJpc3" }

RESPONSE MESSAGE: ``` bash HEADER: {"status": 200} BODY: { "message": "Logged out Successfully" }, (*11)


* Creating new emoji REQUEST: ``` bash POST https://emojinaija.herokuapp.com/emojis HEADER: { "Content-Type": "application/json", "Authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9eyJpc3" } BODY: { "name": "Horse", "char" : "🐎" "keyword": "Animal, Horse, Farm, Esin", "category": "Animal" }

RESPONSE MESSAGE:, (*12)

    HEADER: {"status": 200}
    BODY:
    {
      "id": 9,
      "name": "Horse",
      "char" : "🐎"
      "keyword": [
        "Animal",
        "Horse",
        "Farm",
        "Esin"
      ],
      "category": "Animal",
      "date_created": "2015-11-26 15:32:19",
      "date_modified": "2015-11-26 15:32:19",
      "created_by": "foo"
    }
  • Updating emojis

REQUEST: ``` bash PUT https://emojinaija.herokuapp.com/emojis/9 PATCH https://emojinaija.herokuapp.com/emojis/9 HEADER: { "Content-Type": "application/json", "Authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9eyJpc3" } BODY: { "keyword": "Animal, Horse, Farm, Esin, Zoo", }, (*13)

RESPONSE MESSAGE:
```bash
    HEADER: {"status": 200}
    BODY:
    {
      "Message" => "Emoji Updated Successfully"
    }
  • Delete an emojis

REQUEST:, (*14)

    DELETE https://emojinaija.herokuapp.com/emojis/9
    HEADER:
    {
      "Content-Type": "application/json",
      "Authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9eyJpc3"
    }

RESPONSE MESSAGE: ``` bash HEADER: {"status": 200} BODY: { "Message" => "Emoji Deleted" }, (*15)


## Testing

$ vendor/bin/phpunit test ```, (*16)

Contributing

To contribute and extend the scope of this package, Please check out CONTRIBUTING file for detailed contribution guidelines., (*17)

Credits

Emojinaija is created and maintained by Ibraheem ADENIYI., (*18)

The Versions