diff --git a/api.yaml b/api.yaml new file mode 100644 index 0000000..a36b05b --- /dev/null +++ b/api.yaml @@ -0,0 +1,444 @@ +openapi: 3.0.0 +info: + description: "This is a sample/Proof of concept OmegaV v2 server API specification." + version: 0.0.1 + title: OmegaV v2 API demo + contact: + email: edb@omegav.no + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html +servers: + - url: "api.omegav.no" + description: "OmegaV API server" + - url: "http://127.0.0.1:8000" + description: "Local test" +tags: + - name: member + description: "Operations about a member" + +paths: + /members: + get: + tags: + - member + summary: "Get a list of all members" + description: "Get a list of all members" + operationId: getMembers + responses: + '200': + description: "Success" + content: + application/json: + schema: + $ref: '#/components/schemas/members' + + /member: + post: + tags: + - member + summary: "Add a new member" + description: "Add a new member" + operationId: addMember + requestBody: + description: "Create a new member" + content: + application/json: + schema: + $ref: "#/components/schemas/minimalMemberWithoutId" + required: true + responses: + '200': + description: "Success" + content: + application/json: + schema: + $ref: '#/components/schemas/minimalMember' + + /member/{memberId}: + get: + tags: + - member + summary: "Get a member" + description: "Get a single member" + operationId: getMember + parameters: + - name: memberId + in: path + description: "ID of the user's who's balance will be fetched" + required: true + schema: + type: integer + format: uint64 + + responses: + '200': + description: "Success" + content: + application/json: + schema: + $ref: '#/components/schemas/member' + '404': + description: "Member not found" + + put: + tags: + - member + summary: "Update a member's details" + description: "Update a member's details" + operationId: updateMember + parameters: + - name: memberId + in: path + description: "ID of the user's who's info that will be updated" + required: true + schema: + type: integer + format: uint64 + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/minimalMemberWithoutId' + responses: + '200': + description: "Success" + content: + application/json: + schema: + $ref: '#/components/schemas/member' + '404': + description: "Member not found" + + + + /member/{memberId}/balance: + get: + tags: + - member + summary: "Get a member's balance" + description: "Get a member's balance" + operationId: getBalance + parameters: + - name: memberId + in: path + description: "ID of the user's who's balance will be fetched" + required: true + schema: + type: integer + format: uint64 + + responses: + '200': + description: "Success" + content: + application/json: + schema: + $ref: '#/components/schemas/balance' + '404': + description: "Member not found" + + put: + tags: + - member + summary: "Change a member's balance" + description: "Add to a member's balance" + operationId: putBalance + parameters: + - name: memberId + in: path + description: "ID of the user's who's balance will be added to" + required: true + schema: + type: integer + format: uint64 + requestBody: + description: "The values to be added to the member's balance" + content: + application/json: + schema: + $ref: '#/components/schemas/balance' + + responses: + '200': + description: "Success, returnes the new balance" + content: + application/json: + schema: + $ref: '#/components/schemas/balance' + '400': + description: "Malformed request" + '404': + description: "Member not found" + + /member/{memberId}/imagePreference: + get: + tags: + - member + summary: "Get a member's image preference" + description: "Get a member's image preference" + operationId: getImagePreference + parameters: + - name: memberId + in: path + description: "ID of the user's who's info will be fetched" + required: true + schema: + type: integer + format: uint64 + + responses: + '200': + description: "Success" + content: + application/json: + schema: + $ref: '#/components/schemas/imagePreference' + '404': + description: "Member not found" + + put: + tags: + - member + summary: "Change a member's image preference" + description: "Add to a member's image preference" + operationId: changeImagePreference + parameters: + - name: memberId + in: path + description: "ID of the user's who's info will be changed" + required: true + schema: + type: integer + format: uint64 + requestBody: + description: "The image preference to set for the member" + content: + application/json: + schema: + $ref: '#/components/schemas/imagePreference' + + responses: + '200': + description: "Success, returnes the new image preference" + content: + application/json: + schema: + $ref: '#/components/schemas/imagePreference' + '400': + description: "Malformed request" + '404': + description: "Member not found" + + /member/{memberId}/rfid: + get: + tags: + - member + summary: "Get a member's RFID cards" + description: "Get all of a member's RFID cards" + operationId: getRfids + parameters: + - name: memberId + in: path + description: "ID of the user's who's info will be fetched" + required: true + schema: + type: integer + format: uint64 + + responses: + '200': + description: "Success" + content: + application/json: + schema: + $ref: '#/components/schemas/rfidCards' + '404': + description: "Member not found" + + post: + tags: + - member + summary: "Add RFID card" + description: "Add an RFID card to a member" + operationId: addRfid + parameters: + - name: memberId + in: path + description: "ID of the user's who's info will be added to" + required: true + schema: + type: integer + format: uint64 + requestBody: + description: "Info about the RFID card to add" + content: + application/json: + schema: + $ref: '#/components/schemas/rfidCard' + + responses: + '200': + description: "Success, returns the new RFID card info" + content: + application/json: + schema: + $ref: '#/components/schemas/rfidCard' + '400': + description: "Malformed request" + '404': + description: "Member not found" + + +components: + schemas: + members: + type: object + description: "An array containing multimple `member` objects" + properties: + members: + type: array + items: + $ref: '#/components/schemas/member' + + minimalMemberWithoutId: + type: object + description: "The minimal values needed to create a member" + properties: + ntnuUsername: + type: string + description: "The NTNU username of the member" + example: "sebasthg" + firstName: + type: string + description: "First name of the member" + example: "Sebastian" + lastName: + type: string + description: "Last name of the member" + example: "Gabrielli" + email: + type: string + description: "The member's non-ntnu e-mail" + example: "sebastian@fastmail.mx" + + + minimalMember: + type: object + description: "The minimal values returned when createing a member" + properties: + id: + type: integer + description: "The internal member ID of the user" + format: uint64 + example: 1337 + ntnuUsername: + type: string + description: "The NTNU username of the member" + example: "sebasthg" + firstName: + type: string + description: "First name of the member" + example: "Sebastian" + lastName: + type: string + description: "Last name of the member" + example: "Gabrielli" + email: + type: string + description: "The member's non-ntnu e-mail" + example: "sebastian@fastmail.mx" + + member: + type: object + description: "A collection of all the values associated with a member" + properties: + id: + type: integer + description: "The internal member ID of the user" + format: uint64 + example: 1337 + ntnuUsername: + type: string + description: "The NTNU username of the member" + example: "sebasthg" + firstName: + type: string + description: "First name of the member" + example: "Sebastian" + lastName: + type: string + description: "Last name of the member" + example: "Gabrielli" + email: + type: string + description: "The member's non-ntnu e-mail" + example: "sebastian@fastmail.mx" + balance: + type: integer + description: "The balance on the member's OBS account" + format: int64 + example: 1337 + imagePreference: + type: string + description: "The image series shown upon an OBS purchase" + example: "Sexy stallman" + enum: + - "Sexy stallman" + - "Propaganda" + - "Money" + rfidCards: + type: array + items: + $ref: '#/components/schemas/rfidCard' + + rfidCards: + type: object + description: "An array of rfidCard objects" + properties: + rfidCards: + type: array + items: + $ref: '#/components/schemas/rfidCard' + + rfidCard: + type: object + description: "An RFID card" + properties: + cardId: + type: string + example: "0364249683" + cardComment: + type: string + example: "Studentkort" + + imagePreference: + type: object + description: "A member's image preference" + properties: + imagePreference: + type: string + description: "The image series shown upon an OBS purchase" + example: "Sexy stallman" + enum: + - "Sexy stallman" + - "Propaganda" + - "Money" + + balance: + type: object + description: "A member's balance" + properties: + balance: + type: integer + format: int64 + example: 1337 + + requestBodies: + minimalMember: + description: "Add a member" + content: + application/json: + schema: + $ref: '#/components/schemas/minimalMember' + \ No newline at end of file