Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1 Add more API methods to specification #6

Merged
merged 9 commits into from
Sep 21, 2024
131 changes: 126 additions & 5 deletions matchmaker/api/src/main/resources/static/openapi/api.yml
Original file line number Diff line number Diff line change
@@ -92,6 +92,79 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/GeneralError"
409:
description: Attitude was already taken
content:
application/json:
schema:
$ref: "#/components/schemas/GeneralError"
/people/{target_id}/attitudes/{attitude_kind}:
post:
tags: [SOA]
summary: Like or skip a suggestion
description: |
Does the same as /people/{target_id}/attitudes.
Exists just to defend SOA labs.
Comment on lines +106 to +107
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 😎 👍

parameters:
- name: target_id
in: path
required: true
schema:
$ref: "#/components/schemas/PersonId"
- name: attitude_kind
in: path
required: true
schema:
$ref: "#/components/schemas/AttitudeKind"
responses:
204:
description: Attitude was taken into account
401:
description: No authentication
content:
application/json:
schema:
$ref: "#/components/schemas/GeneralError"
404:
description: Person is not found
content:
application/json:
schema:
$ref: "#/components/schemas/GeneralError"
409:
description: Attitude was already taken
content:
application/json:
schema:
$ref: "#/components/schemas/GeneralError"
/attitudes:
delete:
tags: [SOA]
summary: Reset attitudes
description: Removes attitudes from the given person
security:
- bearerAuth: [ADMIN]
parameters:
- name: source_id
in: query
required: true
schema:
$ref: "#/components/schemas/PersonId"
responses:
204:
description: Attitudes was reset
401:
description: No authentication
content:
application/json:
schema:
$ref: "#/components/schemas/GeneralError"
404:
description: Person is not found
content:
application/json:
schema:
$ref: "#/components/schemas/GeneralError"
/people/{person_id}/matches:
get:
tags: [Suggestions]
@@ -131,6 +204,52 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/GeneralError"
/statistics/attitudes:
get:
tags: [SOA]
summary: Get attitudes statistics
description: Returns like/skip counters for each person
security:
- bearerAuth: [ADMIN]
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
type: object
properties:
person_id:
$ref: "#/components/schemas/PersonId"
likes:
type: integer
description: Count of people liked by the person
format: int32
minimum: 0
skips:
type: integer
description: Count of people skipped by the person
format: int32
minimum: 0
required:
- person_id
- likes
- skips
uniqueItems: true
401:
description: No authentication
content:
application/json:
schema:
$ref: "#/components/schemas/GeneralError"
403:
description: Forbidden
content:
application/json:
schema:
$ref: "#/components/schemas/GeneralError"
components:
securitySchemes:
bearerAuth:
@@ -144,14 +263,16 @@ components:
format: int64
minimum: 1
example: 12345678
AttitudeKind:
type: string
enum:
- like
- skip
Attitude:
type: object
properties:
verdict:
type: string
enum:
- like
- skip
kind:
$ref: "#/components/schemas/AttitudeKind"
required:
- verdict
GeneralError:
47 changes: 42 additions & 5 deletions people/api/src/main/resources/static/openapi/api.yml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ info:
servers:
- url: /api/v1
security:
- bearerAuth: []
- bearerAuth: [USER, ADMIN]
paths:
/monitoring/healthcheck:
get:
@@ -90,14 +90,14 @@ paths:
required: false
schema:
$ref: "#/components/schemas/PersonHeight"
example: 160
example: 160
- name: height_max
in: query
description: Maximum height of a person
required: false
schema:
$ref: "#/components/schemas/PersonHeight"
example: 180
example: 180
- name: birthday_min
in: query
description: Minimum birthday of a person
@@ -164,6 +164,27 @@ paths:
required: false
schema:
$ref: "#/components/schemas/UpdateMoment"
- name: sort_by
in: query
description: Sorting keys
required: false
explode: false
schema:
type: array
items:
type: string
enum:
- first_name
- last_name
- height
- birthday
- updated
- -first_name
- -last_name
- -height
- -birthday
- -updated
uniqueItems: true
responses:
200:
description: OK
@@ -196,15 +217,23 @@ paths:
tags: [People]
summary: Create a person
description: Creates a person with given parameters
parameters:
- name: Idempotency-Key
in: header
required: true
schema:
type: string
format: uuid
example: 550e8400-e29b-41d4-a716-446655440000
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/PersonDraft"
responses:
200:
description: OK
201:
description: Created
content:
application/json:
schema:
@@ -221,6 +250,12 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/GeneralError"
409:
description: If person was already created (Idempotency-Key duplicated)
content:
application/json:
schema:
$ref: "#/components/schemas/GeneralError"
/people/{person_id}:
get:
tags: [People]
@@ -261,6 +296,8 @@ paths:
tags: [People]
summary: Delete person by id
description: Deletes a person with a given id forever?
security:
- bearerAuth: [ADMIN]
parameters:
- name: person_id
in: path
Loading
Oops, something went wrong.