diff --git a/docs/public/api/schema.yaml b/docs/public/api/schema.yaml index c540041..450b7c1 100644 --- a/docs/public/api/schema.yaml +++ b/docs/public/api/schema.yaml @@ -16,13 +16,15 @@ externalDocs: tags: - name: User description: Endpoints related to the user, his account and other personal configurations - - name: Datasource - description: Thirdparty data sources, like FitBit + - name: Activity + description: Activities of the current user + - name: Achievements + - name: Datasources - name: Leaderboard - - name: Goal - description: User and system defined Goals + - name: Shop + - name: Order paths: - '/user/me': + '/users/me': get: summary: Displays the current users settings operationId: getUser @@ -47,10 +49,10 @@ paths: application/json: schema: type: object - properties: + parameters: email: type: string - displayName: + name: type: string example: name: Ingolf Neiße @@ -63,78 +65,128 @@ paths: description: Invalid content '403': description: Not allowed to change attribute - '/datasource': + '/activities': get: - summary: Get a list of all connected data sources for the current user - operationId: getDatasources + summary: Get a list of activities of the current user + operationId: listActivities tags: - - Datasource + - Activity responses: '200': - description: List of connected data sources of the current user + description: List of activities content: application/json: schema: - $ref: '#/components/schemas/Datasource' - '/datasource/{id}': + type: array + items: + $ref: '#/components/schemas/Activity' + post: + summary: Create an activity as manual record (limits may apply) + operationId: recordActivity + tags: + - Activity + requestBody: + content: + application/json: + schema: + type: object + properties: + type: + type: integer + begin: + type: string + format: date-time + end: + type: string + format: date-time + value: + type: number + metric: + type: integer + points: + type: integer + responses: + '201': + description: The activity was created successfully + content: + 'application/json': + schema: + $ref: '#/components/schemas/Activity' + '400': + description: Invalid properties / activity type not supported + '401': + description: User is not authenticated + '/activities/{id}': get: - summary: Return information about this specific datasource - operationId: getDatasource + summary: Returns a single activity + operationId: getActivity tags: - - Datasource + - Activity + parameters: + - in: path + name: id + schema: + type: string + required: true responses: '200': - description: Datasource information + description: Activity content: application/json: schema: - $ref: '#/components/schemas/Datasource' + $ref: '#/components/schemas/Activity' + '404': + description: Activity not found + '401': + description: User is not authenticated delete: - summary: Removes the connection to a specific datasource. The datasource will be still available after that. - operationId: deleteDatasource + summary: Delete an activity + operationId: deleteActivity tags: - - Datasource + - Activity + parameters: + - in: path + name: id + schema: + type: string + required: true responses: '204': - description: 'Datasource removed' - '400': - description: 'Datasource does not exists or removal is not possible at this time.' - '/datasource/{id}/authorize': + description: Activity deleted successfully + '403': + description: Not allowed to delete activity + '401': + description: User not authenticated + '/achievements': get: - summary: Returns the authorize URL used to authorize a datasource. - operationId: authorizeDatasource + summary: Get a list of all achievements for the current user + operationId: getAchievements tags: - - Datasource + - Achievements responses: '200': - description: Authorize URL + description: List of Achievements content: application/json: schema: - type: object - properties: - authorizeURL: - type: string - - '/leaderboard/global': + $ref: '#/components/schemas/Achievement' + '/datasources': get: - summary: Get the global leaderboard - operationId: getPublicLeaderboard + summary: Get a list of all connected data sources + operationId: getDatasources tags: - - Leaderboard + - Datasources responses: '200': - description: List of users + description: List of connected data sources of the current user content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/Leaderboard' - '/leaderboard/friends': + $ref: '#/components/schemas/Datasource' + '/leaderboard': get: - summary: Get the private leaderboard which only contains friends - operationId: getPrivateLeaderboard + summary: Get the general leaderboard + operationId: getGeneralLeaderb tags: - Leaderboard responses: @@ -146,157 +198,96 @@ paths: type: array items: $ref: '#/components/schemas/Leaderboard' - '/friend': + '/leaderboards': get: - summary: Returns a list of all friends of the current user - operationId: getFriends + summary: Get a list of private leaderboards the user can access + operationId: getLeaderboards tags: - - Friend + - Leaderboard responses: '200': - description: List of friends + description: Return a single leaderboard content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/Friend' + $ref: '#/components/schemas/Leaderboard' post: - summary: Creates a new friend request - operationId: addFriend + summary: Create a private leaderboard + operationId: createLeaderboard tags: - - Friend + - Leaderboard requestBody: content: application/json: schema: type: object properties: - friend: + name: type: string - default: user id + public: + type: boolean responses: '201': - description: Friend request created - '400': - description: Friend request not possible - '/friend/{id}': - put: - summary: Accept / Reject a friend request - operationId: editFriendRequest + description: Leaderboard created + '/leaderboards/join': + post: + summary: Join a private / public leaderboard + operationId: joinLeaderboard tags: - - Friend - description: > - This endpoint allows editing a friend request, both the requests created by - the current user and also requests to the current user. - - - The following options can be used for requests owned by the authenticated user: - - accept - - reject - - For own requests only the "delete" operation can be used. + - Leaderboard requestBody: content: application/json: schema: type: object properties: - action: + id: type: string - enum: [accept, reject, delete] - responses: - '200': - description: 'Modification was successful' - '400': - description: 'Request not found / not successful' - - delete: - summary: Removes a friend from the friendlist - operationId: deleteFriend - tags: - - Friend - parameters: - - in: path - name: id - schema: - type: string - required: true responses: '204': - description: Friend was removed - '400': - description: User has not been a friend or cannot be removed - '/goal': - get: - summary: All user and system defined goals for the current user - operationId: getGoals - tags: - - Goal - responses: - '200': - description: List of all goals - content: - application/json: - schema: - $ref: '#/components/schemas/Goal' - '/task': - get: - summary: A list of available tasks - operationId: getTasks - tags: - - Task - responses: - '200': - description: A list of available tasks - content: - application/json: - schema: - $ref: '#/components/schemas/Task' - '/task/{id}': + description: Joined leaderboard successfully + '404': + description: Leaderboard does not exists + '401': + description: User not authorized + '/leaderboards/{id}': get: - summary: A list of available tasks - operationId: getTask + summary: Get a list of private leaderboards the user can access + operationId: getPrivateLeaderboard tags: - - Task + - Leaderboard parameters: - in: path name: id + required: true schema: type: string - required: true responses: '200': - description: A list of available tasks + description: Return a single leaderboard content: application/json: schema: - $ref: '#/components/schemas/Task' - put: - summary: Begin / Stop a task - operationId: modifyTask + $ref: '#/components/schemas/Leaderboard' + delete: + summary: Leave a leaderboard. If the user is the only user left, delete the leaderboard + operationId: leaveOrDeleteLeaderboard tags: - - Task + - Leaderboard parameters: - in: path - name: id + required: true schema: type: string - required: true - requestBody: - content: - application/json: - schema: - type: object - properties: - action: - type: string - enum: [start, stop, reset] + name: id responses: '204': - description: Activity was modified - '400': - description: Modification not allowed / not possible + description: Left the leaderboard / deleted the leaderboard + '404': + description: Leaderboard not found / user not member + '401': + description: Unauthorized + components: schemas: User: @@ -308,55 +299,43 @@ components: email: type: string format: email - displayName: + name: type: string verified: type: boolean - Goal: + Activity: type: object properties: id: type: string + format: uuid type: + type: integer + begin: type: string - enum: [steps, distance] - creator: + format: date-time + end: type: string - enum: [system, user] - target: - type: number + format: date-time value: type: number metric: + type: integer + datasource: type: string - enum: [count, kilometers] - Task: + format: uuid + points: + type: integer + Achievement: type: object properties: id: type: string - level: - type: number - title: - type: string - description: - type: string - condtions: - type: array - items: - type: object - properties: - name: - type: string - description: - type: string - color: - type: string - icon: - type: string - status: - type: string - enum: [available, unavailable, fulfilled, started] + format: uuid + type: + type: integer + achieved: + type: boolean Datasource: type: object ShopItem: @@ -365,16 +344,6 @@ components: type: object Order: type: object - Friend: - type: object - properties: - id: - type: string - displayName: - type: string - state: - type: string - enum: [request, friend, pending] Leaderboard: type: object properties: @@ -385,4 +354,15 @@ components: displayname: type: string points: - type: integer \ No newline at end of file + type: integer + PrivateLeaderboard: + type: object + properties: + id: + type: string + name: + type: string + creator: + type: string + public: + type: boolean