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

Add GET /sessions endpoint for retrieving all active sessions of authenticated user #228

46 changes: 45 additions & 1 deletion code/API_definitions/qod-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,38 @@
- oAuth2ClientCredentials: []
- threeLegged:
- "qod-sessions-write"

get:
tags:
- QoS sessions
summary: Get all active sessions information
description: Get information about all active sessions authorized to be retrieved by the provided access token.
operationId: getSessions
parameters:
Copy link
Collaborator

Choose a reason for hiding this comment

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

It could be interesting to add additional filters, specially to allow filtering sessions for some specific device

- name: phoneNumber
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be better to filter on $ref: "#/components/schemas/Device and not just phone number.

in: query
required: false
description: Allows filtering of sessions by device (phone number).
schema:
$ref: "#/components/schemas/PhoneNumber"

Check failure on line 237 in code/API_definitions/qod-api.yaml

View workflow job for this annotation

GitHub Actions / MegaLinter

237:7 [indentation] wrong indentation: expected 8 but found 6
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add two more spaces to resolve linting issue.

kacper-kicinski marked this conversation as resolved.
Show resolved Hide resolved
responses:
"200":
description: Contains information about the complete list of active sessions
content:
application/json:
schema:
$ref: "#/components/schemas/SessionInfoList"
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"500":
$ref: "#/components/responses/Generic500"
"503":
$ref: "#/components/responses/Generic503"
security:
- oAuth2ClientCredentials: []
- threeLegged:
- "qod-sessions-read"
/sessions/{sessionId}:
get:
tags:
Expand Down Expand Up @@ -433,6 +464,19 @@
- expiresAt
- qosStatus

SessionInfoList:
description: List response of active sessions authorized to be retrieved by the provided access token.
type: object
required:
- sessions
properties:
sessions:
description: Array of sessions to be returned.
type: array
minItems: 0
items:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
items:
minItems: 0
items:

$ref: "#/components/schemas/SessionInfo"

CreateSession:
description: Attributes required to create a session
type: object
Expand Down