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
127 changes: 122 additions & 5 deletions matchmaker/api/src/main/resources/static/openapi/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,77 @@ 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
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]
Expand Down Expand Up @@ -131,6 +202,50 @@ 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
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:
Expand All @@ -144,14 +259,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:
Expand Down
18 changes: 16 additions & 2 deletions people/api/src/main/resources/static/openapi/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,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:
Expand All @@ -221,6 +229,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]
Expand Down
Loading