Files
music-index/api/docs/swagger.yaml
T
2026-03-14 20:00:36 +01:00

188 lines
4.3 KiB
YAML

basePath: /api/v1/
definitions:
handlers.CreateUserRequest:
properties:
password:
minLength: 12
type: string
user_mail:
type: string
user_name:
type: string
required:
- password
- user_mail
- user_name
type: object
handlers.CreateUserResponse:
properties:
id:
type: string
message:
type: string
type: object
handlers.ErrorResponse:
properties:
error:
type: string
type: object
handlers.LoginRequest:
properties:
password:
type: string
user_mail:
type: string
required:
- password
- user_mail
type: object
handlers.LoginResponse:
properties:
token:
type: string
type: object
handlers.UsernameResponse:
properties:
user_name:
type: string
type: object
info:
contact: {}
description: API for managing users and artists in Music Index.
title: Music Index API
version: "1.0"
paths:
/artists:
get:
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
additionalProperties: true
type: object
type: array
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: List all artists
tags:
- artist
/artists/:id:
get:
parameters:
- description: Artist ID (UUID)
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
additionalProperties: true
type: object
type: array
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: List artist by ID
tags:
- artist
/users/{id}:
get:
parameters:
- description: User ID (UUID)
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.UsernameResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: Get username by user ID
tags:
- user
/users/create:
post:
consumes:
- application/json
parameters:
- description: User payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/handlers.CreateUserRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/handlers.CreateUserResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: Create a user
tags:
- user
/users/login:
post:
consumes:
- application/json
parameters:
- description: Login payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/handlers.LoginRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.LoginResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: Log in with email and password
tags:
- user
swagger: "2.0"