Skip to content

Commit

Permalink
Update last release and API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinSRG committed Jan 6, 2024
1 parent bbd1878 commit 9517f87
Show file tree
Hide file tree
Showing 2 changed files with 245 additions and 5 deletions.
248 changes: 244 additions & 4 deletions static/apis/en/api-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ swagger: "2.0"
info:
title: PersonalMediaVault Backend API
description: API to access PersonalMediaVault from a web client.
version: 1.14.0
version: 1.15.0

schemes:
- http
Expand Down Expand Up @@ -35,6 +35,8 @@ tags:
description: Tasks API. Allows user to check the progress of running tasks
- name: about
description: Requests information about the server
- name: invites
description: Invite codes API. Manages codes to temporally invite users or devices.


paths:
Expand All @@ -61,6 +63,15 @@ paths:
type: string
description: Media vault password (can't be blank, max 255 chars)
example: password
duration:
type: string
description: "Duration of the session. Note the session can be closed before this or the vault server can restart, clearing all sessions."
enum:
- day
- week
- month
- year

responses:
400:
description: Bad request (if the password given is blank, for example)
Expand Down Expand Up @@ -2354,7 +2365,7 @@ paths:
type: boolean
description: "True if the user has write access to the vault"
post:
summary: Creates account
summary: Create account
description: Creates an account with access to the vault
tags:
- admin
Expand Down Expand Up @@ -2410,8 +2421,8 @@ paths:

"/api/admin/accounts/delete":
post:
summary: Deletes account
description: "Creates an account with access to the vault. Note: Root account cannot be removed"
summary: Delete account
description: "Deletes an account with access to the vault. Note: Root account cannot be removed"
tags:
- admin
consumes:
Expand Down Expand Up @@ -2471,6 +2482,231 @@ paths:
type: string
description: Current FFmpeg version
example: "6.1-full_build-www.gyan.dev"

"/api/invites":
get:
summary: Get invite code status
description: Gets invite code status for the current user
tags:
- invites
consumes:
- application/json
produces:
- application/json
parameters: []
security:
- SessionTokenHeader: []
responses:
401:
description: Unauthorized (No valid session)
403:
description: Access denied (invited users cannot invite)
200:
description: Invite code status
schema:
properties:
has_code:
type: boolean
description: True if the user has a generated invite code
code:
type: string
description: The invite code
example: "012345"
duration:
type: number
format: int64
description: The session duration if the code is used (Milliseconds)
expiration_remaining:
type: number
format: int64
description: Remaining time until code expiration (Milliseconds) (If <=0, the code has expired)

"/api/invites/sessions":
get:
summary: Get list of invited sessions
description: Gets list of invited sessions
tags:
- invites
consumes:
- application/json
produces:
- application/json
parameters: []
security:
- SessionTokenHeader: []
responses:
401:
description: Unauthorized (No valid session)
403:
description: Access denied (invited users cannot invite)
200:
description: Invited sessions
schema:
type: array
items:
properties:
index:
type: number
format: int64
description: Unique session index
timestamp:
type: number
format: int64
description: Session timestamp (Unix milliseconds)
expiration:
type: number
format: int64
description: Expiration timestamp (Unix Milliseconds)

"/api/invites/sessions/{index}":
delete:
summary: Delete an invited session
description: Deletes an invited session
tags:
- invites
consumes:
- application/json
produces:
- application/json
parameters:
- in: path
required: true
name: index
type: number
format: int64
security:
- SessionTokenHeader: []
responses:
401:
description: Unauthorized (No valid session)
403:
description: Access denied (invited users cannot invite)
200:
description: Success

"/api/invites/generate":
post:
summary: Generate an invite code
description: "Generates an invite code. If another code exits, it will be replaced by a new one."
tags:
- invites
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: Invite code parameters
schema:
properties:
duration:
type: string
description: "Duration of the invite session."
enum:
- day
- week
- month
- year
security:
- SessionTokenHeader: []
responses:
400:
description: You reached the limit of invites
401:
description: Unauthorized (No valid session)
403:
description: Access denied (invited users cannot invite)
200:
description: Updated invite code status
schema:
properties:
has_code:
type: boolean
description: True if the user has a generated invite code
code:
type: string
description: The invite code
example: "012345"
duration:
type: number
format: int64
description: The session duration if the code is used (Milliseconds)
expiration_remaining:
type: number
format: int64
description: Remaining time until code expiration (Milliseconds) (If <=0, the code has expired)

"/api/invites/clear":
post:
summary: Clear invite code
description: "Clears the current invite code"
tags:
- invites
consumes:
- application/json
produces:
- application/json
parameters: []
security:
- SessionTokenHeader: []
responses:
401:
description: Unauthorized (No valid session)
403:
description: Access denied (invited users cannot invite)
200:
description: Success

"/api/invites/login":
post:
summary: Login with invite code
description: Creates an active session from an invite code
tags:
- invites
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: Invite code
schema:
properties:
code:
type: string
description: Invite code
example: "012345"
responses:
400:
description: Bad request (if the code given is blank or has an invalid size)
403:
description: Login request denied
schema:
properties:
code:
type: string
description: >
Error code:
* INVALID_CODE - Invalid code
* COOLDOWN - When you fail a login request, there is a cooldown of 5 seconds.
enum:
- INVALID_CODE
- COOLDOWN
message:
type: string
description: "Error message"
example: "Error message"
200:
description: Login request accepted
schema:
properties:
session_id:
type: string
description: "Session ID. Set a cookie named 'x-session-token' with that value. Sessions expire when you log out or after 24 hours."
vault_fingerprint:
type: string
description: "Vault fingerprint"


definitions:
MediaListItem:
Expand Down Expand Up @@ -2535,6 +2771,10 @@ definitions:
type: number
format: int32
description: Video previews interval (seconds)
invite_limit:
type: number
format: int32
description: Max number of invited sessions per user
resolutions:
type: array
description: Extra resolutions to encode videos
Expand Down
2 changes: 1 addition & 1 deletion static/last_release.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.14.0"
"version": "1.15.0"
}

0 comments on commit 9517f87

Please sign in to comment.