{ "swagger": "2.0", "info": { "description": "API Server for Course Platform", "title": "Course Platform API", "contact": {}, "version": "1.0" }, "host": "localhost:8000", "basePath": "/api/v1/", "paths": { "/admins/auth/refresh": { "post": { "description": "admin refresh tokens", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admins" ], "summary": "Admin Refresh Tokens", "parameters": [ { "description": "refresh info", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/v1.refreshInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.tokenResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "404": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/v1.response" } }, "default": { "description": "", "schema": { "$ref": "#/definitions/v1.response" } } } } }, "/admins/courses": { "get": { "security": [ { "AdminAuth": [] } ], "description": "admin get all courses", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admins" ], "summary": "Admin Get All Courses", "operationId": "adminGetAllCourses", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Course" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "404": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/v1.response" } }, "default": { "description": "", "schema": { "$ref": "#/definitions/v1.response" } } } }, "post": { "security": [ { "AdminAuth": [] } ], "description": "admin create new course", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admins" ], "summary": "Admin Create New Courses", "operationId": "adminCreateCourse", "parameters": [ { "description": "course info", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/v1.createCourseInput" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Course" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "404": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/v1.response" } }, "default": { "description": "", "schema": { "$ref": "#/definitions/v1.response" } } } } }, "/admins/courses/{id}": { "get": { "security": [ { "AdminAuth": [] } ], "description": "admin get course by id", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admins" ], "summary": "Admin Get Course By ID", "operationId": "adminGetCourseById", "parameters": [ { "type": "string", "description": "course id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.Course" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "404": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/v1.response" } }, "default": { "description": "", "schema": { "$ref": "#/definitions/v1.response" } } } } }, "/admins/sign-in": { "post": { "description": "admin sign in", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admins" ], "summary": "Admin SignIn", "operationId": "adminSignIn", "parameters": [ { "description": "sign up info", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/v1.signInInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.tokenResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "404": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/v1.response" } }, "default": { "description": "", "schema": { "$ref": "#/definitions/v1.response" } } } } }, "/students/auth/refresh": { "post": { "description": "student refresh tokens", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "students" ], "summary": "Student Refresh Tokens", "parameters": [ { "description": "sign up info", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/v1.refreshInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.tokenResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "404": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/v1.response" } }, "default": { "description": "", "schema": { "$ref": "#/definitions/v1.response" } } } } }, "/students/courses": { "get": { "description": "student get all courses", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "students" ], "summary": "Student Get All Courses", "operationId": "studentGetAllCourses", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Course" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "404": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/v1.response" } }, "default": { "description": "", "schema": { "$ref": "#/definitions/v1.response" } } } } }, "/students/courses/{id}": { "get": { "description": "student get course by id", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "students" ], "summary": "Student Get Course By ID", "operationId": "studentGetCourseById", "parameters": [ { "type": "string", "description": "course id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.Course" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "404": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/v1.response" } }, "default": { "description": "", "schema": { "$ref": "#/definitions/v1.response" } } } } }, "/students/modules/{id}/lessons": { "get": { "security": [ { "StudentsAuth": [] } ], "description": "student get lessons by module id", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "students" ], "summary": "Student Get Lessons By Module ID", "operationId": "studentGetModuleLessons", "parameters": [ { "type": "string", "description": "module id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.studentGetModuleLessonsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "404": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/v1.response" } }, "default": { "description": "", "schema": { "$ref": "#/definitions/v1.response" } } } } }, "/students/modules/{id}/offers": { "get": { "security": [ { "StudentsAuth": [] } ], "description": "student get offers by module id", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "students" ], "summary": "Student Get Offers By Module ID", "operationId": "studentGetModuleOffers", "parameters": [ { "type": "string", "description": "module id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "ok", "schema": { "type": "string" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "404": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/v1.response" } }, "default": { "description": "", "schema": { "$ref": "#/definitions/v1.response" } } } } }, "/students/order": { "post": { "security": [ { "StudentsAuth": [] } ], "description": "student create order", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "students" ], "summary": "Student CreateOrder", "operationId": "studentCreateOrder", "parameters": [ { "description": "order info", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/v1.createOrderInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.createOrderResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "404": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/v1.response" } }, "default": { "description": "", "schema": { "$ref": "#/definitions/v1.response" } } } } }, "/students/promocodes/{code}": { "get": { "security": [ { "StudentsAuth": [] } ], "description": "student get promocode by code", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "students" ], "summary": "Student Get Promocode By Code", "operationId": "studentGetPromocode", "parameters": [ { "type": "string", "description": "code", "name": "code", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.Promocode" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "404": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/v1.response" } }, "default": { "description": "", "schema": { "$ref": "#/definitions/v1.response" } } } } }, "/students/sign-in": { "post": { "description": "student sign in", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "students" ], "summary": "Student SignIn", "operationId": "studentSignIn", "parameters": [ { "description": "sign up info", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/v1.signInInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.tokenResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "404": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/v1.response" } }, "default": { "description": "", "schema": { "$ref": "#/definitions/v1.response" } } } } }, "/students/sign-up": { "post": { "description": "create student account", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "students" ], "summary": "Student SignUp", "operationId": "studentSignUp", "parameters": [ { "description": "sign up info", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/v1.studentSignUpInput" } } ], "responses": { "201": { "description": "ok", "schema": { "type": "string" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "404": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/v1.response" } }, "default": { "description": "", "schema": { "$ref": "#/definitions/v1.response" } } } } }, "/students/verify/{code}": { "post": { "description": "student verify registration", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "students" ], "summary": "Student Verify Registration", "operationId": "studentVerify", "parameters": [ { "type": "string", "description": "verification code", "name": "code", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.tokenResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "404": { "description": "Bad Request", "schema": { "$ref": "#/definitions/v1.response" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/v1.response" } }, "default": { "description": "", "schema": { "$ref": "#/definitions/v1.response" } } } } } }, "definitions": { "domain.Course": { "type": "object", "properties": { "code": { "type": "string" }, "createdAt": { "type": "string" }, "description": { "type": "string" }, "id": { "type": "string" }, "imageUrl": { "type": "string" }, "name": { "type": "string" }, "published": { "type": "boolean" }, "updatedAt": { "type": "string" } } }, "domain.Lesson": { "type": "object", "properties": { "content": { "type": "string" }, "id": { "type": "string" }, "name": { "type": "string" }, "position": { "type": "integer" }, "published": { "type": "boolean" } } }, "domain.Promocode": { "type": "object", "properties": { "code": { "type": "string" }, "discountPercentage": { "type": "integer" }, "expiresAt": { "type": "string" }, "id": { "type": "string" }, "offerIds": { "type": "array", "items": { "type": "string" } } } }, "v1.createCourseInput": { "type": "object", "properties": { "name": { "type": "string" } } }, "v1.createOrderInput": { "type": "object", "required": [ "offerId" ], "properties": { "offerId": { "type": "string" }, "promoId": { "type": "string" } } }, "v1.createOrderResponse": { "type": "object", "properties": { "paymentLink": { "type": "string" } } }, "v1.refreshInput": { "type": "object", "required": [ "token" ], "properties": { "token": { "type": "string" } } }, "v1.response": { "type": "object", "properties": { "message": { "type": "string" } } }, "v1.signInInput": { "type": "object", "required": [ "email", "password" ], "properties": { "email": { "type": "string" }, "password": { "type": "string" } } }, "v1.studentGetModuleLessonsResponse": { "type": "object", "properties": { "lessons": { "type": "array", "items": { "$ref": "#/definitions/domain.Lesson" } } } }, "v1.studentSignUpInput": { "type": "object", "required": [ "email", "name", "password", "registerSource" ], "properties": { "email": { "type": "string" }, "name": { "type": "string" }, "password": { "type": "string" }, "registerSource": { "type": "string" } } }, "v1.tokenResponse": { "type": "object", "properties": { "accessToken": { "type": "string" }, "refreshToken": { "type": "string" } } } }, "securityDefinitions": { "AdminAuth": { "type": "apiKey", "name": "Authorization", "in": "header" }, "StudentsAuth": { "type": "apiKey", "name": "Authorization", "in": "header" } } }