maps-service/openapi.yaml

757 lines
19 KiB
YAML

openapi: 3.1.0
info:
title: StrafesNET Submissions - OpenAPI 3.1
description: Browse and manage map submissions.
version: 0.1.0
servers:
- url: https://submissions.strafes.net/v1
tags:
- name: Submissions
description: Submission operations
- name: Scripts
description: Script operations
- name: ScriptPolicy
description: Script policy operations
security:
- cookieAuth: []
paths:
/submissions:
get:
summary: Get list of submissions
operationId: listSubmissions
tags:
- Submissions
requestBody:
required: true
content:
application/json:
schema:
required:
- Page
type: object
properties:
Page:
$ref: "#/components/schemas/Pagination"
Filter:
$ref: "#/components/schemas/SubmissionFilter"
responses:
"200":
description: Successful response
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Submission"
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
post:
summary: Create new submission
operationId: createSubmission
tags:
- Submissions
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SubmissionCreate'
responses:
"201":
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/Id"
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/submissions/{SubmissionID}:
get:
summary: Retrieve map with ID
operationId: getSubmission
tags:
- Submissions
parameters:
- $ref: '#/components/parameters/SubmissionID'
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/Submission"
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/submissions/{SubmissionID}/model:
post:
summary: Update model following role restrictions
operationId: updateSubmissionModel
tags:
- Submissions
parameters:
- $ref: '#/components/parameters/SubmissionID'
- name: ModelID
in: query
required: true
schema:
type: integer
format: int64
- name: VersionID
in: query
required: true
schema:
type: integer
format: int64
responses:
"204":
description: Successful response
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/submissions/{SubmissionID}/completed:
post:
summary: Retrieve map with ID
operationId: setSubmissionCompleted
tags:
- Submissions
parameters:
- $ref: '#/components/parameters/SubmissionID'
responses:
"204":
description: Successful response
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/submissions/{SubmissionID}/status/submit:
post:
summary: Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted
operationId: actionSubmissionSubmit
tags:
- Submissions
parameters:
- $ref: '#/components/parameters/SubmissionID'
responses:
"204":
description: Successful response
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/submissions/{SubmissionID}/status/revoke:
post:
summary: Role Submitter changes status from Submitted|ChangesRequested -> UnderConstruction
operationId: actionSubmissionRevoke
tags:
- Submissions
parameters:
- $ref: '#/components/parameters/SubmissionID'
responses:
"204":
description: Successful response
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/submissions/{SubmissionID}/status/trigger-validate:
post:
summary: Role Reviewer triggers validation and changes status from Submitted|Accepted -> Validating
operationId: actionSubmissionTriggerValidate
tags:
- Submissions
parameters:
- $ref: '#/components/parameters/SubmissionID'
responses:
"204":
description: Successful response
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/submissions/{SubmissionID}/status/reject:
post:
summary: Role Reviewer changes status from Submitted -> Rejected
operationId: actionSubmissionReject
tags:
- Submissions
parameters:
- $ref: '#/components/parameters/SubmissionID'
responses:
"204":
description: Successful response
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/submissions/{SubmissionID}/status/request-changes:
post:
summary: Role Reviewer changes status from Validated|Accepted|Submitted -> ChangesRequested
operationId: actionSubmissionRequestChanges
tags:
- Submissions
parameters:
- $ref: '#/components/parameters/SubmissionID'
responses:
"204":
description: Successful response
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/submissions/{SubmissionID}/status/trigger-upload:
post:
summary: Role Admin changes status from Validated -> Uploading
operationId: actionSubmissionTriggerUpload
tags:
- Submissions
parameters:
- $ref: '#/components/parameters/SubmissionID'
responses:
"204":
description: Successful response
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/script-policy:
get:
summary: Get list of script policies
operationId: listScriptPolicy
tags:
- ScriptPolicy
requestBody:
required: true
content:
application/json:
schema:
required:
- Page
type: object
properties:
Page:
$ref: "#/components/schemas/Pagination"
Filter:
$ref: "#/components/schemas/ScriptPolicyFilter"
responses:
"200":
description: Successful response
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/ScriptPolicy"
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
post:
summary: Create a new script policy
operationId: createScriptPolicy
tags:
- ScriptPolicy
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ScriptPolicyCreate'
responses:
"201":
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/Id"
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/script-policy/hash/{FromScriptHash}:
get:
summary: Get the policy for the given hash of script source code
operationId: getScriptPolicyFromHash
tags:
- ScriptPolicy
parameters:
- name: FromScriptHash
in: path
required: true
schema:
type: string
minLength: 16
maxLength: 16
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/ScriptPolicy"
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/script-policy/id/{ScriptPolicyID}:
get:
summary: Get the specified script policy by ID
operationId: getScriptPolicy
tags:
- ScriptPolicy
parameters:
- $ref: '#/components/parameters/ScriptPolicyID'
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/ScriptPolicy"
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
post:
summary: Update the specified script policy by ID
operationId: updateScriptPolicy
tags:
- ScriptPolicy
parameters:
- $ref: '#/components/parameters/ScriptPolicyID'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ScriptPolicyUpdate'
responses:
"204":
description: Successful response
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
delete:
summary: Delete the specified script policy by ID
operationId: deleteScriptPolicy
tags:
- ScriptPolicy
parameters:
- $ref: '#/components/parameters/ScriptPolicyID'
responses:
"204":
description: Successful response
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/scripts:
post:
summary: Create a new script
operationId: createScript
tags:
- Scripts
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ScriptCreate'
responses:
"201":
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/Id"
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/scripts/{ScriptID}:
get:
summary: Get the specified script by ID
operationId: getScript
tags:
- Scripts
parameters:
- $ref: '#/components/parameters/ScriptID'
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/Script"
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
post:
summary: Update the specified script by ID
operationId: updateScript
tags:
- Scripts
parameters:
- $ref: '#/components/parameters/ScriptID'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ScriptUpdate'
responses:
"204":
description: Successful response
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
delete:
summary: Delete the specified script by ID
operationId: deleteScript
tags:
- Scripts
parameters:
- $ref: '#/components/parameters/ScriptID'
responses:
"204":
description: Successful response
default:
description: General Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
components:
securitySchemes:
cookieAuth:
type: apiKey
in: cookie
name: session_id
parameters:
SubmissionID:
name: SubmissionID
in: path
required: true
description: The unique identifier for a submission.
schema:
type: integer
format: int64
ScriptID:
name: ScriptID
in: path
required: true
description: The unique identifier for a script.
schema:
type: integer
format: int64
ScriptPolicyID:
name: ScriptPolicyID
in: path
required: true
description: The unique identifier for a script policy.
schema:
type: integer
format: int64
schemas:
Id:
required:
- ID
type: object
properties:
ID:
type: integer
format: int64
Submission:
required:
- ID
- DisplayName
- Creator
- GameID
- CreatedAt
- UpdatedAt
- Submitter
- AssetID
- AssetVersion
- Completed
- SubmissionType
# - TargetAssetID
- StatusID
type: object
properties:
ID:
type: integer
format: int64
DisplayName:
type: string
maxLength: 128
Creator:
type: string
maxLength: 128
GameID:
type: integer
format: int32
CreatedAt:
type: integer
format: int64
UpdatedAt:
type: integer
format: int64
Submitter:
type: integer
format: int64
AssetID:
type: integer
format: int64
AssetVersion:
type: integer
format: int64
Completed:
type: boolean
SubmissionType:
type: integer
format: int32
TargetAssetID:
type: integer
format: int64
StatusID:
type: integer
format: int32
SubmissionFilter:
required:
- ID
type: object
properties:
ID:
type: integer
format: int64
DisplayName:
type: string
maxLength: 128
Creator:
type: string
maxLength: 128
GameID:
type: integer
format: int32
SubmissionCreate:
required:
- DisplayName
- Creator
- GameID
- AssetID
- AssetVersion
# - TargetAssetID
type: object
properties:
DisplayName:
type: string
maxLength: 128
Creator:
type: string
maxLength: 128
GameID:
type: integer
format: int32
AssetID:
type: integer
format: int64
AssetVersion:
type: integer
format: int64
TargetAssetID:
type: integer
format: int64
Script:
required:
- ID
- Hash
- Source
- SubmissionID
type: object
properties:
ID:
type: integer
format: int64
Hash:
type: string
minLength: 16
maxLength: 16
Source:
type: string
maxLength: 1048576
SubmissionID:
type: integer
format: int64
ScriptCreate:
required:
- Source
# - SubmissionID
type: object
properties:
Source:
type: string
maxLength: 1048576
SubmissionID:
type: integer
format: int64
ScriptUpdate:
required:
- ID
type: object
properties:
ID:
type: integer
format: int64
Source:
type: string
maxLength: 1048576
SubmissionID:
type: integer
format: int64
ScriptPolicy:
required:
- ID
- FromScriptHash
- ToScriptID
- Policy
type: object
properties:
ID:
type: integer
format: int64
FromScriptHash:
type: string
minLength: 16
maxLength: 16
ToScriptID:
type: integer
format: int64
Policy:
type: integer
format: int32
ScriptPolicyFilter:
type: object
properties:
ID:
type: integer
format: int64
FromScriptHash:
type: string
minLength: 16
maxLength: 16
ToScriptID:
type: integer
format: int64
Policy:
type: integer
format: int32
ScriptPolicyCreate:
required:
- FromScriptID
- ToScriptID
- Policy
type: object
properties:
FromScriptID:
type: integer
format: int64
ToScriptID:
type: integer
format: int64
Policy:
type: integer
format: int32
ScriptPolicyUpdate:
required:
- ID
type: object
properties:
ID:
type: integer
format: int64
FromScriptID:
type: integer
format: int64
ToScriptID:
type: integer
format: int64
Policy:
type: integer
format: int32
Pagination:
type: object
required:
- Page
- Limit
properties:
Page:
type: integer
format: int32
minimum: 1
Limit:
type: integer
format: int32
minimum: 1
maximum: 100
Error:
description: Represents error object
type: object
properties:
code:
type: integer
format: int64
message:
type: string
required:
- code
- message