Skip to content

Instantly share code, notes, and snippets.

@undrcrxwn
Created December 26, 2023 12:52
Show Gist options
  • Save undrcrxwn/ac49862b20c64eb8de4281f728369c8a to your computer and use it in GitHub Desktop.
Save undrcrxwn/ac49862b20c64eb8de4281f728369c8a to your computer and use it in GitHub Desktop.
openapi: 3.0.1
info:
title: Crowd Parlay API
description: Crowd Parlay's RESTful API.
version: '1.0'
servers:
- url: https://crowdparlay
tags:
- name: Users
x-displayName: Users
- name: Authors
x-displayName: Authors
- name: Comments
x-displayName: Comments
- name: Discussions
x-displayName: Discussions
paths:
/api/v1/users/register:
post:
tags:
- Users
summary: Creates a user.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UsersRegisterRequest'
text/json:
schema:
$ref: '#/components/schemas/UsersRegisterRequest'
application/*+json:
schema:
$ref: '#/components/schemas/UsersRegisterRequest'
responses:
'200':
description: Success
content:
text/plain:
schema:
$ref: '#/components/schemas/UsersRegisterResponse'
application/json:
schema:
$ref: '#/components/schemas/UsersRegisterResponse'
text/json:
schema:
$ref: '#/components/schemas/UsersRegisterResponse'
'400':
description: Bad Request
content:
text/plain:
schema:
$ref: '#/components/schemas/ValidationProblem'
application/json:
schema:
$ref: '#/components/schemas/ValidationProblem'
text/json:
schema:
$ref: '#/components/schemas/ValidationProblem'
'403':
description: Forbidden
content:
text/plain:
schema:
$ref: '#/components/schemas/Problem'
application/json:
schema:
$ref: '#/components/schemas/Problem'
text/json:
schema:
$ref: '#/components/schemas/Problem'
'500':
description: Server Error
content:
text/plain:
schema:
$ref: '#/components/schemas/Problem'
application/json:
schema:
$ref: '#/components/schemas/Problem'
text/json:
schema:
$ref: '#/components/schemas/Problem'
/api/v1/users/{userId}:
get:
tags:
- Users
summary: Returns user with the specified ID.
parameters:
- name: userId
in: path
required: true
style: simple
schema:
type: string
format: uuid
responses:
'200':
description: Success
content:
text/plain:
schema:
$ref: '#/components/schemas/UsersGetByIdResponse'
application/json:
schema:
$ref: '#/components/schemas/UsersGetByIdResponse'
text/json:
schema:
$ref: '#/components/schemas/UsersGetByIdResponse'
'404':
description: Not Found
content:
text/plain:
schema:
$ref: '#/components/schemas/Problem'
application/json:
schema:
$ref: '#/components/schemas/Problem'
text/json:
schema:
$ref: '#/components/schemas/Problem'
'500':
description: Server Error
content:
text/plain:
schema:
$ref: '#/components/schemas/Problem'
application/json:
schema:
$ref: '#/components/schemas/Problem'
text/json:
schema:
$ref: '#/components/schemas/Problem'
put:
tags:
- Users
summary: Updates user with the specified ID.
parameters:
- name: userId
in: path
required: true
style: simple
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UsersUpdateRequest'
text/json:
schema:
$ref: '#/components/schemas/UsersUpdateRequest'
application/*+json:
schema:
$ref: '#/components/schemas/UsersUpdateRequest'
responses:
'200':
description: Success
content:
text/plain:
schema:
$ref: '#/components/schemas/UsersUpdateResponse'
application/json:
schema:
$ref: '#/components/schemas/UsersUpdateResponse'
text/json:
schema:
$ref: '#/components/schemas/UsersUpdateResponse'
'400':
description: Bad Request
content:
text/plain:
schema:
$ref: '#/components/schemas/ValidationProblem'
application/json:
schema:
$ref: '#/components/schemas/ValidationProblem'
text/json:
schema:
$ref: '#/components/schemas/ValidationProblem'
'403':
description: Forbidden
content:
text/plain:
schema:
$ref: '#/components/schemas/Problem'
application/json:
schema:
$ref: '#/components/schemas/Problem'
text/json:
schema:
$ref: '#/components/schemas/Problem'
'404':
description: Not Found
content:
text/plain:
schema:
$ref: '#/components/schemas/Problem'
application/json:
schema:
$ref: '#/components/schemas/Problem'
text/json:
schema:
$ref: '#/components/schemas/Problem'
'500':
description: Server Error
content:
text/plain:
schema:
$ref: '#/components/schemas/Problem'
application/json:
schema:
$ref: '#/components/schemas/Problem'
text/json:
schema:
$ref: '#/components/schemas/Problem'
delete:
tags:
- Users
summary: Deletes user with the specified ID.
parameters:
- name: userId
in: path
required: true
style: simple
schema:
type: string
format: uuid
responses:
'200':
description: Success
content:
text/plain:
schema:
$ref: '#/components/schemas/UsersUpdateResponse'
application/json:
schema:
$ref: '#/components/schemas/UsersUpdateResponse'
text/json:
schema:
$ref: '#/components/schemas/UsersUpdateResponse'
'403':
description: Forbidden
content:
text/plain:
schema:
$ref: '#/components/schemas/Problem'
application/json:
schema:
$ref: '#/components/schemas/Problem'
text/json:
schema:
$ref: '#/components/schemas/Problem'
'404':
description: Not Found
content:
text/plain:
schema:
$ref: '#/components/schemas/Problem'
application/json:
schema:
$ref: '#/components/schemas/Problem'
text/json:
schema:
$ref: '#/components/schemas/Problem'
'500':
description: Server Error
content:
text/plain:
schema:
$ref: '#/components/schemas/Problem'
application/json:
schema:
$ref: '#/components/schemas/Problem'
text/json:
schema:
$ref: '#/components/schemas/Problem'
/api/v1/users/resolve:
get:
tags:
- Users
summary: Returns user with the specified username.
parameters:
- name: username
in: query
style: form
schema:
type: string
responses:
'200':
description: Success
content:
text/plain:
schema:
$ref: '#/components/schemas/UsersGetByUsernameResponse'
application/json:
schema:
$ref: '#/components/schemas/UsersGetByUsernameResponse'
text/json:
schema:
$ref: '#/components/schemas/UsersGetByUsernameResponse'
'400':
description: Bad Request
content:
text/plain:
schema:
$ref: '#/components/schemas/ValidationProblem'
application/json:
schema:
$ref: '#/components/schemas/ValidationProblem'
text/json:
schema:
$ref: '#/components/schemas/ValidationProblem'
'404':
description: Not Found
content:
text/plain:
schema:
$ref: '#/components/schemas/Problem'
application/json:
schema:
$ref: '#/components/schemas/Problem'
text/json:
schema:
$ref: '#/components/schemas/Problem'
'500':
description: Server Error
content:
text/plain:
schema:
$ref: '#/components/schemas/Problem'
application/json:
schema:
$ref: '#/components/schemas/Problem'
text/json:
schema:
$ref: '#/components/schemas/Problem'
/api/v1/authors/{authorId}:
get:
tags:
- Authors
summary: Returns author with the specified ID.
parameters:
- name: authorId
in: path
required: true
style: simple
schema:
type: string
format: uuid
responses:
'200':
description: Success
content:
text/plain:
schema:
$ref: '#/components/schemas/AuthorDto'
application/json:
schema:
$ref: '#/components/schemas/AuthorDto'
text/json:
schema:
$ref: '#/components/schemas/AuthorDto'
/api/v1/comments/{commentId}:
get:
tags:
- Comments
summary: Returns comment with the specified ID.
parameters:
- name: commentId
in: path
required: true
style: simple
schema:
type: string
format: uuid
responses:
'200':
description: Success
content:
text/plain:
schema:
$ref: '#/components/schemas/CommentDto'
application/json:
schema:
$ref: '#/components/schemas/CommentDto'
text/json:
schema:
$ref: '#/components/schemas/CommentDto'
/api/v1/comments:
get:
tags:
- Comments
summary: Returns all comments created by author with the specified ID.
parameters:
- name: authorId
in: query
style: form
schema:
type: string
format: uuid
- name: page
in: query
style: form
schema:
type: integer
format: int32
- name: size
in: query
style: form
schema:
type: integer
format: int32
responses:
'200':
description: Success
content:
text/plain:
schema:
type: array
items:
$ref: '#/components/schemas/CommentDto'
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/CommentDto'
text/json:
schema:
type: array
items:
$ref: '#/components/schemas/CommentDto'
post:
tags:
- Comments
summary: Creates a top-level comment in discussion.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CommentRequest'
text/json:
schema:
$ref: '#/components/schemas/CommentRequest'
application/*+json:
schema:
$ref: '#/components/schemas/CommentRequest'
responses:
'200':
description: Success
content:
text/plain:
schema:
$ref: '#/components/schemas/CommentDto'
application/json:
schema:
$ref: '#/components/schemas/CommentDto'
text/json:
schema:
$ref: '#/components/schemas/CommentDto'
/api/v1/comments/{targetCommentId}:
post:
tags:
- Comments
summary: Creates a reply to comment with the specified ID.
parameters:
- name: targetCommentId
in: path
required: true
style: simple
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ReplyRequest'
text/json:
schema:
$ref: '#/components/schemas/ReplyRequest'
application/*+json:
schema:
$ref: '#/components/schemas/ReplyRequest'
responses:
'200':
description: Success
content:
text/plain:
schema:
$ref: '#/components/schemas/CommentDto'
application/json:
schema:
$ref: '#/components/schemas/CommentDto'
text/json:
schema:
$ref: '#/components/schemas/CommentDto'
/api/v1/discussions/{discussionId}:
get:
tags:
- Discussions
summary: Returns discussion with the specified ID.
parameters:
- name: discussionId
in: path
required: true
style: simple
schema:
type: string
format: uuid
responses:
'200':
description: Success
content:
text/plain:
schema:
$ref: '#/components/schemas/DiscussionDto'
application/json:
schema:
$ref: '#/components/schemas/DiscussionDto'
text/json:
schema:
$ref: '#/components/schemas/DiscussionDto'
/api/v1/discussions:
get:
tags:
- Discussions
summary: Returns all discussions.
responses:
'200':
description: Success
content:
text/plain:
schema:
type: array
items:
$ref: '#/components/schemas/DiscussionDto'
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/DiscussionDto'
text/json:
schema:
type: array
items:
$ref: '#/components/schemas/DiscussionDto'
post:
tags:
- Discussions
summary: Creates a discussion.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DiscussionRequest'
text/json:
schema:
$ref: '#/components/schemas/DiscussionRequest'
application/*+json:
schema:
$ref: '#/components/schemas/DiscussionRequest'
responses:
'200':
description: Success
content:
text/plain:
schema:
$ref: '#/components/schemas/DiscussionDto'
application/json:
schema:
$ref: '#/components/schemas/DiscussionDto'
text/json:
schema:
$ref: '#/components/schemas/DiscussionDto'
/api/v1/discussions/{authorId}:
get:
tags:
- Discussions
summary: Returns all discussions created by author with the specified ID.
parameters:
- name: authorId
in: query
style: form
schema:
type: string
format: uuid
- name: authorId
in: path
required: true
style: simple
schema:
type: string
responses:
'200':
description: Success
content:
text/plain:
schema:
type: array
items:
$ref: '#/components/schemas/DiscussionDto'
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/DiscussionDto'
text/json:
schema:
type: array
items:
$ref: '#/components/schemas/DiscussionDto'
components:
schemas:
Problem:
type: object
properties:
error_description:
type: string
additionalProperties: false
UsersGetByIdResponse:
type: object
properties:
id:
type: string
format: uuid
username:
type: string
display_name:
type: string
avatar_url:
type: string
nullable: true
additionalProperties: false
UsersGetByUsernameResponse:
type: object
properties:
id:
type: string
format: uuid
username:
type: string
display_name:
type: string
avatar_url:
type: string
nullable: true
additionalProperties: false
UsersRegisterRequest:
type: object
properties:
username:
type: string
display_name:
type: string
email:
type: string
password:
type: string
avatar_url:
type: string
nullable: true
additionalProperties: false
UsersRegisterResponse:
type: object
properties:
id:
type: string
format: uuid
username:
type: string
email:
type: string
display_name:
type: string
avatar_url:
type: string
nullable: true
additionalProperties: false
UsersUpdateRequest:
type: object
properties:
username:
type: string
nullable: true
display_name:
type: string
nullable: true
email:
type: string
nullable: true
avatar_url:
type: string
nullable: true
old_password:
type: string
nullable: true
new_password:
type: string
nullable: true
additionalProperties: false
UsersUpdateResponse:
type: object
properties:
id:
type: string
format: uuid
username:
type: string
display_name:
type: string
email:
type: string
avatar_url:
type: string
nullable: true
additionalProperties: false
ValidationProblem:
type: object
properties:
error_description:
type: string
validation_errors:
type: object
additionalProperties:
type: array
items:
type: string
additionalProperties: false
AuthorDto:
type: object
properties:
id:
type: string
format: uuid
username:
type: string
display_name:
type: string
avatar_url:
type: string
nullable: true
additionalProperties: false
CommentDto:
type: object
properties:
id:
type: string
format: uuid
content:
type: string
author:
$ref: '#/components/schemas/AuthorDto'
created_at:
type: string
format: date-time
reply_count:
type: integer
format: int32
first_replies_authors:
type: array
items:
$ref: '#/components/schemas/AuthorDto'
additionalProperties: false
CommentRequest:
type: object
properties:
discussion_id:
type: string
format: uuid
content:
type: string
additionalProperties: false
DiscussionDto:
type: object
properties:
id:
type: string
format: uuid
title:
type: string
description:
type: string
author:
$ref: '#/components/schemas/AuthorDto'
additionalProperties: false
DiscussionRequest:
type: object
properties:
title:
type: string
description:
type: string
additionalProperties: false
ReplyRequest:
type: object
properties:
content:
type: string
additionalProperties: false
securitySchemes:
OIDC:
type: openIdConnect
description: OpenID Connect authentication scheme.
openIdConnectUrl: /.well-known/openid-configuration
x-tagGroups:
- name: users
tags:
- Users
- name: social
tags:
- Authors
- Comments
- Discussions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment