Skip to content

CitizenMedia-TW/story-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

story-service

  • RESTful APIs running on localhost:50051

MyStory

GET /mystory (Get stories written by the user)
Headers
key value description
Authorization Bearer token The jwt token
Responses
http code content-type response
200 application/json {"message": "Success", "storyIdList": string[]}
401, 500 text/plain N/A

Story

POST /story (Create a story)
Headers
key value description
Authorization Bearer token The jwt token
Body (application/json)
key required data type description
authorId true string ObjectId of the author
content true string Content of the story
title true string Title of the story
subtitle true string Subtitle of the story
tags true string[] Tags of the story
Responses
http code content-type response
200 application/json {"message": "Success", "storyId": "ObjectId of the new story"}
401, 400, 500 text/plain N/A
GET /story (Get a story by given id)
Query Parameters
key required data type description
storyId true string ObjectId of the story
Responses
type story = {
  author: string
  authorId: string
  content: string
  title: string
  subTitle: string
  createdAt: google.protobuf.Timestamp
  comments: Comment
  tags: string[]
}
http code content-type response
200 application/json {"message": "Success", "story": story}
400, 404, 500 text/plain N/A
DELETE /story (Delete a story by given id)
Headers
key value description
Authorization Bearer token The jwt token
Body (application/json)
key required data type description
storyId true string ObjectId of the story
deleterId true string ObjectId of the deleter
Responses
http code content-type response
200 application/json {"message": "Success"}
400, 500 text/plain N/A

Recommend

GET /recommend (Get resommended stories, WIP)
Headers
key value description
Authorization Bearer token The jwt token
Query Parameters
key required data type description
userId true string ObjectId of the user
count true int Number of story to retrieve
skip true int --
Responses
http code content-type response
200 application/json {"message": "Success", "storyIdList": string[]}
400, 500 text/plain N/A

Comment

POST /comment (Add a new comment to the story)
Headers
key value description
Authorization Bearer token The jwt token
Body (application/json)
key required data type description
comment true string The content of the comment
commenterId true string The id of the commenter
commentedStoryId true string The story to comment on
Responses
http code content-type response
200 application/json {"message": "Success", "commentId: "id of the comment"}
400, 401, 500 text/plain N/A
DELETE /comment (Delete a comment of a story)
Headers
key value description
Authorization Bearer token The jwt token
Body (application/json)
key required data type description
commentId true string The id of the comment
deleterId true string The id of the deleter
Responses
http code content-type response
200 application/json {"message": "Success"}
400, 401, 500 text/plain N/A
GET /comment (Get comments from specific story)
Query Parameters
key required data type description
storyId true string N/A
Responses
http code content-type response
200 application/json {"message": "Success", "comments": list of comments}
500 text/plain N/A

SubComment

POST /subComment (Add a new subComment to the comment)
Headers
key value description
Authorization Bearer token The jwt token
Body (application/json)
key required data type description
content true string The content of the comment
commenterId false string The id of the commenter
repliedCommentId true string The comment to comment on
storyId true string The storyid of the comment
Responses
http code content-type response
200 application/json {"message": "Success", "subCommentId: "id of the subComment"}
401, 500 text/plain N/A
DELETE /comment (Delete a subComment of a comment)
Headers
key value description
Authorization Bearer token The jwt token
Body (application/json)
key required data type description
commentId true string The id of the comment
deleterId true string The id of the deleter
Responses
http code content-type response
200 application/json {"message": "Success"}
400, 401, 500` text/plain N/A

Search

GET /search (Search for the stories)
Query Parameters
key required data type description
tag true string Tag for searching
count true int Number of story to retrieve
skip true int --
Responses
http code content-type response
200 application/json {"message": "Success", "storyIdList: string list of ids}
500 text/plain N/A

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published