📝 created openapi swagger file

Co-authored-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
haraldnilsen 2023-09-19 13:01:53 +02:00
parent 942154e977
commit d5a587f9bd

196
backend/openapi.yaml Normal file
View file

@ -0,0 +1,196 @@
swagger: '2.0'
info:
description: 'This API is made for our task for WA.works.'
version: '1.0'
title: Cinemateket API
license:
name: Github-repository
url: https://github.com/SindreKjelsrud/Cinemateket/
host: github.com
basePath: '/SindreKjelsrud/Cinemateket/'
tags:
- name: Search Parameter
description: e.g. ?s=title
schemes:
- http
- https
paths:
'/?s':
get:
tags:
- Search Parameter
summary: Returns an array of results for a given title
operationId: titleSearch
parameters:
- name: s
in: query
description: Title of movie or series
required: true
type: string
- name: y
in: query
description: Year of release
required: false
type: integer
- name: type
in: query
description: Return movie or series
required: false
type: string
enum:
- movie
- series
- name: sort
in: query
description: Choose sorted order to return
required: false
type: string
enum:
- titleasc
- titledesc
- yearasc
- yeardesc
- name: pageNumber
in: query
description: Page number to return
required: false
type: integer
- name: pageSize
in: query
description: Size of pages to return
type: integer
responses:
'200':
description: Successful operation
'204':
description: No content
'400':
description: Bad request
'500':
description: Internal server error
post:
tags:
- Search Parameter
summary: Inserts a new movie to the database
operationId: titleSearch
parameters:
- name: s
in: query
description: Title of movie or series
required: true
type: string
- name: y
in: query
description: Year of release
required: false
type: integer
- name: type
in: query
description: Return movie or series
required: false
type: string
enum:
- movie
- series
- name: pageNumber
in: query
description: Page number to return
required: false
type: integer
- name: pageSize
in: query
description: Size of pages to return
type: integer
responses:
'200':
description: Successful operation
'204':
description: No content
'400':
description: Bad request
'500':
description: Internal server error
put:
tags:
- Search Parameter
summary: Make changes to an existing movie
operationId: titleSearch
parameters:
- name: s
in: query
description: Title of movie or series
required: true
type: string
- name: y
in: query
description: Year of release
required: false
type: integer
- name: type
in: query
description: Return movie or series
required: false
type: string
enum:
- movie
- series
- name: pageNumber
in: query
description: Page number to return
required: false
type: integer
- name: pageSize
in: query
description: Size of pages to return
type: integer
responses:
'200':
description: Successful operation
'204':
description: No content
'400':
description: Bad request
'500':
description: Internal server error
delete:
tags:
- Search Parameter
summary: Deletes a movie with a given title or imdbID
operationId: titleSearch
parameters:
- name: s
in: query
description: Title of movie or series
required: true
type: string
- name: y
in: query
description: Year of release
required: false
type: integer
- name: type
in: query
description: Return movie or series
required: false
type: string
enum:
- movie
- series
- name: pageNumber
in: query
description: Page number to return
required: false
type: integer
- name: pageSize
in: query
description: Size of pages to return
type: integer
responses:
'200':
description: Successful operation
'204':
description: No content
'400':
description: Bad request
'500':
description: Internal server error