<commit_before># Naemoji 💪
### Simple API for emojis.
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/andela-cvundi/Na-Emoji/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/andela-cvundi/Na-Emoji/?branch=master)
[![Build Status](https://scrutinizer-ci.com/g/andela-cvundi/Na-Emoji/badges/build.png?b=master)](https://scrutinizer-ci.com/g/andela-cvundi/Na-Emoji/build-status/master)
[![Software License][ico-license]](LICENSE.md)

Naemoji is a simple to use API for emojis.

##Usage
First register as a user by sending a POST request to `https://naemoji-staging.herokuapp.com/auth/register` and pass in a username and a password

### Login
Some api routes require authentication, so once you have registered, you can send a `POST` request to `https://emoji-api.herokuapp.com/auth/login` to receive an authentication token.

The response for a successful login is:
```json
{
    "username":"vundi",
    "token": "5e4aed96bb11d49269e7e7908baee2b4"
}
```
Otherwise you will get differnt responses based on what it is you are not doing right

### Get All Emojis
To get all emojis send a `GET` request to `https://naemoji-staging.herokuapp.com/emojis`. The response is a json with all the emojis from the API.

```json
[
  {
    "id": 1,
    "name": "jason",
    "char": "🤖",
    "keywords": "['machete ', 'fierce',]",
    "category": "Danger",
    "date_created": "2016-01-17 12:24:59",
    "date_modified": "2016-01-17 12:24:59",
    "created_by": "vundi"
  },
  {
    "id": 2,
    "name": "cool",
    "char": "😎",
    "keywords": "['Cool ', 'gangsta']",
    "category": "Fun",
    "date_created": "2016-01-17 12:27:04",
    "date_modified": "2016-01-17 12:27:04",
    "created_by": "vundi"
  }
]
```

### Get One Emoji
If you know the id of an emoji, send a `GET` request to `https://naemoji-staging.herokuapp.com/emoji/{id}` , with the id of the emoji you want to retrieve. The response is in JSON.
```json
{
    "id": 2,
    "name": "cool",
    "char": "😎",
    "keywords": "['Cool ', 'gangsta']",
    "category": "Fun",
    "date_created": "2016-01-17 12:27:04",
    "date_modified": "2016-01-17 12:27:04",
    "created_by": "vundi"
}
```

### Add new Emoji
This is one of the routes that requires authentication. Send a `POST` request to `https://naemoji-staging.herokuapp.com/emoji` with the following object as a parameter,
```javascript
{
    name: "cool",
    char: "😎",
    keywords: "['cool ', 'smiley']",
    category: "dope"
}
```
and pass in a token field and the value in the header like this `token = {tokenvalue}`

### Update/Patch an Emoji
These also require authentication. So **make sure** you have passed in `token = {tokenvalue}` in the requst header. Make a `PUT` or `PATCH` request to `https://naemoji-staging.herokuapp.com/emoji/{id}` with the correct id of the emoji you want to update/patch. Include an object in your request, with the updated details of the emoji.
```javascript
{
    name: "cool",
    char: "😎",
    keywords: "['cool ', 'smiley']",
    category: "woooah"
}
```

### Delete an Emoji
You can delete an emoji from Naija Emoji Api by sending a `DELETE` request to `https://naemoji-staging.herokuapp.com/emoji/{id}` , Make sure you have passed in the token in the requst header like this `token = {tokenvalue}` since delete also requires authorization.

### Logout
You can destroy your token access to EmojiApi by simply making a `GET` request to `https://naemoji-staging.herokuapp.com/auth/logout`. Pass in a token value in the header the same way you would pass when performing operations which require authorization.

## Credits
[<NAME>](https://github.com/andela-cvundi)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

[ico-version]: https://img.shields.io/badge/packagist-v1.0.1-brightgreen.svg
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square<commit_msg>(fix) Convert markdown to rst in the README.rst file<commit_after>Naemoji 💪
=========

Simple API for emojis.
~~~~~~~~~~~~~~~~~~~~~~

|Scrutinizer Code Quality| |Build Status| `[Software
License][ico-license]`_

Naemoji is a simple to use API for emojis.

Usage
-----

First register as a user by sending a POST request to
``https://naemoji-staging.herokuapp.com/auth/register`` and pass in a
username and a password

Login
~~~~~

Some api routes require authentication, so once you have registered, you
can send a ``POST`` request to
``https://emoji-api.herokuapp.com/auth/login`` to receive an
authentication token.

The response for a successful login is:

.. code:: json

    {
        "username":"vundi",
        "token": "5e4aed96bb11d49269e7e7908baee2b4"
    }

Otherwise you will get differnt responses based on what it is you are
not doing right

Get All Emojis
~~~~~~~~~~~~~~

To get all emojis send a ``GET`` request to
``https://naemoji-staging.herokuapp.com/emojis``. The response is a json
with all the emojis from the API.

.. code:: json

    [
      {
        "id": 1,
        "name": "jason",
        "char": "🤖",
        "keywords": "['machete ', 'fierce',]",
        "category": "Danger",
        "date_created": "2016-01-17 12:24:59",
        "date_modified": "2016-01-17 12:24:59",
        "created_by": "vundi"
      },
      {
        "id": 2,
        "name": "cool",
        "char": "😎",
        "keywords": "['Cool ', 'gangsta']",
        "category": "Fun",
        "date_created": "2016-01-17 12:27:04",
        "date_modified": "2016-01-17 12:27:04",
        "created_by": "vundi"
      }
    ]

Get One Emoji
~~~~~~~~~~~~~

If you know the id of an emoji, send a ``GET`` request to
``https://naemoji-staging.herokuapp.com/emoji/{id}`` , with the id of
the emoji you want to retrieve. The response is in JSON.

.. code:: json

    {
        "id": 2,
        "name": "cool",
        "char": "😎",
        "keywords": "['Cool ', 'gangsta']",
        "category": "Fun",
        "date_created": "2016-01-17 12:27:04",
        "date_modified": "2016-01-17 12:27:04",
        "created_by": "vundi"
    }

Add new Emoji
~~~~~~~~~~~~~

This is one of the routes that requires authentication. Send a ``POST``
request to ``https://naemoji-staging.herokuapp.com/emoji`` with the
following object as a parameter,

.. code:: javascript

    {
        name: "cool",
        char: "😎",
        keywords: "['cool ', 'smiley']",
        category: "dope"
    }

and pass in a token field and the value in the header like this
``token = {tokenvalue}``

Update/Patch an Emoji
~~~~~~~~~~~~~~~~~~~~~

These also require authentication. So **make sure** you have passed in
``token = {tokenvalue}`` in the requst header. Make a ``PUT`` or
``PATCH`` request to
``https://naemoji-staging.herokuapp.com/emoji/{id}`` with the correct id
of the emoji you want to update/patch. Include an object in your
request, with the updated details of the emoji. \`\`\`javascript { name:
“cool”, char: “😎”, keywords: “[‘cool’, ‘smiley’]”, cat

.. _[Software License][ico-license]: LICENSE.md

.. |Scrutinizer Code Quality| image:: https://scrutinizer-ci.com/g/andela-cvundi/Na-Emoji/badges/quality-score.png?b=master
   :target: https://scrutinizer-ci.com/g/andela-cvundi/Na-Emoji/?branch=master
.. |Build Status| image:: https://scrutinizer-ci.com/g/andela-cvundi/Na-Emoji/badges/build.png?b=master
   :target: https://scrutinizer-ci.com/g/andela-cvundi/Na-Emoji/build-status/master
{'fraction_non_alphanumeric': 0.16495124593716143, 'fraction_numerical': 0.028846153846153848, 'mean_word_length': 3.522351500306185, 'pattern_counts': {'":': 52, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 25, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6902139', 'n_tokens_mistral': 2721, 'n_tokens_neox': 2575, 'n_words': 768}