Git Product home page Git Product logo

samacare's Introduction

The test

Here is the description

Setting up the project

  • run docker-compose up --build --force-recreate -d
  • run docker-compose exec app bin/console doctrine:migrations:migrate -n
  • run docker-compose exec app bin/console doctrine:fixtures:load -n

Authorization

Use Bearer token authorization with one onf the following predefined values (users)

  • user 1: Random_Token_For_User_01
  • user 2: Random_Token_For_User_02
  • user 3: Random_Token_For_User_03

Endpoints

Go to http://127.0.0.1:8888/ to check if it works (make sure it is http, not https).
Run docker-compose exec app bin/console debug:route to get the list of endpoints.

Publisher's endpoints

  • Write new tweets
curl --location -i --request POST 'http://127.0.0.1:8888/api/tweets' \
--header 'Authorization: Bearer Random_Token_For_User_01' \
--header 'Content-Type: application/json' \
--data-raw '{
    "message": "message goes here"
}'
  • Reply to existing tweets
curl --location -i --request POST 'http://127.0.0.1:8888/api/tweets/1/replies' \
--header 'Authorization: Bearer Random_Token_For_User_02' \
--header 'Content-Type: application/json' \
--data-raw '{
    "message": "reply goes here"
}'
  • Mark some of their tweets as private, except to their followers
curl --location -i --request PATCH 'http://127.0.0.1:8888/api/tweets/1' \
--header 'Authorization: Bearer Random_Token_For_User_01' \
--header 'Content-Type: application/json' \
--data-raw '{
    "isPrivate": true
}'
  • Remove followers so that they should not be able to re-follow a publisher once removed
curl --location -i --request DELETE 'http://127.0.0.1:8888/api/self/followers/3' \
--header 'Authorization: Bearer Random_Token_For_User_01' \
--header 'Content-Type: application/json' \
--data-raw '{
    "isPrivate": true
}'

Reader's endpoints

  • Query all tweets in the system
curl --location -i --request GET 'http://127.0.0.1:8888/api/tweets' \
--header 'Content-Type: application/json'
  • Query all tweets by a group of publishers
curl --location -i -g --request GET 'http://127.0.0.1:8888/api/tweets?filter[authors]=1,2,3' \
--header 'Content-Type: application/json'
  • Query all tweets in a specific window of time
curl --location -i -g --request GET 'http://127.0.0.1:8888/api/tweets?filter[start]=2021-01-25T14:37:38.669Z&filter[end]=2021-01-26T14:37:38.669Z' \
--header 'Content-Type: application/json'
  • Query a tweet and all the responses to this tweet
curl --location -i --request GET 'http://127.0.0.1:8888/api/tweets/1' \
--header 'Content-Type: application/json'
  • Follow a publisher
curl --location -i --request POST 'http://127.0.0.1:8888/api/authors/1/followers' \
--header 'Authorization: Bearer Random_Token_For_User_03'

samacare's People

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.