Skip to content
Snippets Groups Projects

swagger: update and add new apis

Merged Mingrui Zhang requested to merge SwaggerUpdate into main
1 file
+ 182
43
Compare changes
  • Side-by-side
  • Inline
+ 182
43
{
"swagger": "2.0",
"info": {
"description": "This the swagger doc for `Studentcare` server.",
"description": "This the swagger doc for `Studentcare` server. <br /> Note that the lock icon on each API represents `Authorization: Bearer <access_token>` header required.",
"version": "1.0.0",
"title": "Swagger Studentcare",
"license": {
@@ -17,15 +17,120 @@
{
"name": "user",
"description": "Operations about user"
},
{
"name": "register",
"description": "User registration"
},
{
"name": "claim",
"description": "Operations about claim"
},
{
"name": "claimHistory",
"description": "View claim history"
}
],
"paths": {
"/user/create": {
"/claimHistory": {
"post": {
"tags": [
"user"
"claimHistory"
],
"summary": "Creates a user with given input array",
"summary": "Get claim history with repect to a user",
"description": "This can only be done by the logged-in users and get their own info.",
"operationId": "getClaimHistoryByName",
"produces": [
"application/json"
],
"security": [
{
"bearerAuth": []
}
],
"responses": {
"200": {
"description": "Successful operation",
"schema": {
"$ref": "#/definitions/ClaimHistoryInfoBody"
}
},
"400": {
"description": "Error specified by \"error\"",
"schema": {
"$ref": "#/definitions/GeneralFailureBody"
}
},
"401": {
"description": "Authentication failure",
"schema": {
"$ref": "#/definitions/GeneralFailureBody"
}
},
"500": {
"description": "Server Issues"
}
}
}
},
"/claim": {
"post": {
"tags": [
"claim"
],
"summary": "Create a claim with given input array",
"description": "",
"operationId": "createClaimArrayInput",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"in": "body",
"name": "body",
"description": "List of claim creation needed info",
"required": true,
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/ClaimRequestBody"
}
}
}
],
"security": [
{
"bearerAuth": []
}
],
"responses": {
"200": {
"description": "Successful operation"
},
"400": {
"description": "Error specified by \"error\"",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/GeneralFailureBody"
}
}
},
"500": {
"description": "Server Issues"
}
}
}
},
"/register": {
"post": {
"tags": [
"register"
],
"summary": "Create a user with given input array",
"description": "",
"operationId": "createUserArrayInput",
"consumes": [
@@ -63,7 +168,7 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/UserFailureBody"
"$ref": "#/definitions/GeneralFailureBody"
}
}
},
@@ -73,26 +178,17 @@
}
}
},
"/user/{username}": {
"get": {
"/user": {
"post": {
"tags": [
"user"
],
"summary": "Get user by user name",
"summary": "Get user profile",
"description": "This can only be done by the logged-in users and get their own info.",
"operationId": "getUserByName",
"produces": [
"application/json"
],
"parameters": [
{
"name": "username",
"in": "path",
"description": "The name that needs to be fetched.",
"required": true,
"type": "string"
}
],
"security": [
{
"bearerAuth": []
@@ -108,13 +204,13 @@
"400": {
"description": "Error specified by \"error\"",
"schema": {
"$ref": "#/definitions/UserFailureBody"
"$ref": "#/definitions/GeneralFailureBody"
}
},
"401": {
"description": "Authentication failure",
"schema": {
"$ref": "#/definitions/UserFailureBody"
"$ref": "#/definitions/GeneralFailureBody"
}
},
"500": {
@@ -126,7 +222,7 @@
"tags": [
"user"
],
"summary": "Updated user",
"summary": "Updated user profile",
"description": "This can only be done by the logged-in users and update their own info.",
"operationId": "updateUser",
"consumes": [
@@ -136,13 +232,6 @@
"application/json"
],
"parameters": [
{
"name": "username",
"in": "path",
"description": "Name that need to be updated",
"required": true,
"type": "string"
},
{
"in": "body",
"name": "body",
@@ -165,13 +254,13 @@
"400": {
"description": "Error specified by \"error\"",
"schema": {
"$ref": "#/definitions/UserFailureBody"
"$ref": "#/definitions/GeneralFailureBody"
}
},
"401": {
"description": "Authentication failure",
"schema": {
"$ref": "#/definitions/UserFailureBody"
"$ref": "#/definitions/GeneralFailureBody"
}
},
"500": {
@@ -218,7 +307,7 @@
"400": {
"description": "Error specified by \"error\"",
"schema": {
"$ref": "#/definitions/UserFailureBody"
"$ref": "#/definitions/GeneralFailureBody"
}
},
"500": {
@@ -251,7 +340,7 @@
"400": {
"description": "Error specified by \"error\"",
"schema": {
"$ref": "#/definitions/UserFailureBody"
"$ref": "#/definitions/GeneralFailureBody"
}
},
"500": {
@@ -273,19 +362,22 @@
"UserProfile": {
"type": "object",
"properties": {
"username": {
"user_id": {
"type": "string"
},
"user_name": {
"type": "string"
},
"email": {
"type": "string"
},
"studentID": {
"student_id": {
"type": "string"
},
"firstName": {
"first_name": {
"type": "string"
},
"lastName": {
"last_name": {
"type": "string"
},
"sex": {
@@ -299,16 +391,19 @@
"UserProfileUpdate": {
"type": "object",
"properties": {
"user_name": {
"type": "string"
},
"email": {
"type": "string"
},
"studentID": {
"student_id": {
"type": "string"
},
"firstName": {
"first_name": {
"type": "string"
},
"lastName": {
"last_name": {
"type": "string"
},
"sex": {
@@ -322,7 +417,7 @@
"UserCreationBody": {
"type": "object",
"properties": {
"username": {
"user_name": {
"type": "string"
},
"email": {
@@ -348,7 +443,7 @@
"UserLoginBody": {
"type": "object",
"properties": {
"username": {
"user_name": {
"type": "string"
},
"password": {
@@ -356,6 +451,50 @@
}
}
},
"ClaimHistoryInfoBody": {
"type": "object",
"properties": {
"claim_x": {
"$ref": "#/definitions/ClaimInfoBody"
}
}
},
"ClaimInfoBody": {
"type": "object",
"properties": {
"claim_id": {
"type": "string"
},
"date": {
"type": "string"
},
"amount": {
"type": "integer",
"format": "int64"
},
"type": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"ClaimRequestBody": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"comment": {
"type": "string"
},
"image": {
"type": "string",
"format": "base64"
}
}
},
"UserFailureErrors": {
"type": "object",
"properties": {
@@ -367,9 +506,9 @@
"type": "string",
"description": "Unauthorized"
},
"UsernameUnauthSession": {
"MissingRequiredField": {
"type": "string",
"description": "Username does not match with the logged-in session"
"description": "Missing required field when registering"
},
"InvalidUsernamePassSupplied": {
"type": "string",
@@ -381,7 +520,7 @@
}
}
},
"UserFailureBody": {
"GeneralFailureBody": {
"type": "object",
"properties": {
"error": {
Loading