{ "swagger": "2.0", "info": { "description": "Toggo API", "title": "Toggo API", "contact": {}, "version": "1.0" }, "host": "localhost:8000", "basePath": "/", "paths": { "/api/v1/users": { "post": { "description": "Creates a new user with the provided payload", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "users" ], "summary": "Create a new user", "operationId": "createUser", "parameters": [ { "description": "Create user request", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.CreateUserRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/models.User" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/errs.APIError" } }, "422": { "description": "Unprocessable Entity", "schema": { "$ref": "#/definitions/errs.APIError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/errs.APIError" } } } } }, "/api/v1/users/{userID}": { "get": { "description": "Retrieves a user by ID", "produces": [ "application/json" ], "tags": [ "users" ], "summary": "Get a user", "operationId": "getUser", "parameters": [ { "type": "string", "description": "User ID", "name": "userID", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.User" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/errs.APIError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/errs.APIError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/errs.APIError" } } } }, "delete": { "description": "Deletes a user by ID", "tags": [ "users" ], "summary": "Delete a user", "operationId": "deleteUser", "parameters": [ { "type": "string", "description": "User ID", "name": "userID", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/errs.APIError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/errs.APIError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/errs.APIError" } } } }, "patch": { "description": "Updates an existing user by ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "users" ], "summary": "Update a user", "operationId": "updateUser", "parameters": [ { "type": "string", "description": "User ID", "name": "userID", "in": "path", "required": true }, { "description": "Update user request", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.UpdateUserRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.User" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/errs.APIError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/errs.APIError" } }, "422": { "description": "Unprocessable Entity", "schema": { "$ref": "#/definitions/errs.APIError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/errs.APIError" } } } } }, "/healthcheck": { "get": { "description": "Returns OK if the server is running", "produces": [ "application/json" ], "tags": [ "example" ], "summary": "Healthcheck endpoint", "responses": { "200": { "description": "ok", "schema": { "type": "string" } } } } } }, "definitions": { "errs.APIError": { "type": "object", "properties": { "message": {}, "statusCode": { "type": "integer" } } }, "models.CreateUserRequest": { "type": "object", "required": [ "email", "name" ], "properties": { "email": { "type": "string" }, "name": { "type": "string" } } }, "models.UpdateUserRequest": { "type": "object", "properties": { "email": { "type": "string" }, "name": { "type": "string", "minLength": 1 } } }, "models.User": { "type": "object", "properties": { "email": { "type": "string" }, "id": { "type": "string" }, "name": { "type": "string" } } } } }