SimpleCloudNotifier/server/swagger/swagger.yaml
2022-11-19 12:47:23 +01:00

642 lines
15 KiB
YAML

basePath: /
definitions:
ginresp.apiError:
properties:
errhighlight:
type: integer
error:
type: integer
errorObject: {}
message:
type: string
success:
type: boolean
type: object
handler.Ack.response:
properties:
message:
type: string
new_ack:
type: integer
prev_ack:
type: integer
success:
type: string
type: object
handler.CreateUser.body:
properties:
agent_model:
type: string
agent_version:
type: string
client_type:
type: string
fcm_token:
type: string
pro_token:
type: string
username:
type: string
type: object
handler.DatabaseTest.response:
properties:
libVersion:
type: string
libVersionNumber:
type: integer
sourceID:
type: string
success:
type: boolean
type: object
handler.Expand.response:
properties:
data:
$ref: '#/definitions/models.ShortCompatMessage'
message:
type: string
success:
type: string
type: object
handler.Health.response:
properties:
status:
type: string
type: object
handler.Info.response:
properties:
fcm_token_set:
type: boolean
is_pro:
type: string
message:
type: string
quota:
type: string
quota_max:
type: string
success:
type: string
unack_count:
type: integer
user_id:
type: string
user_key:
type: string
type: object
handler.ListClients.result:
properties:
clients:
items:
$ref: '#/definitions/models.ClientJSON'
type: array
type: object
handler.Register.response:
properties:
is_pro:
type: integer
message:
type: string
quota:
type: integer
quota_max:
type: integer
success:
type: boolean
user_id:
type: string
user_key:
type: string
type: object
handler.Requery.response:
properties:
count:
type: integer
data:
items:
$ref: '#/definitions/models.CompatMessage'
type: array
message:
type: string
success:
type: string
type: object
handler.Update.response:
properties:
is_pro:
type: string
message:
type: string
quota:
type: string
quota_max:
type: string
success:
type: string
user_id:
type: string
user_key:
type: string
type: object
handler.UpdateUser.body:
properties:
pro_token:
type: string
username:
type: string
type: object
handler.Upgrade.response:
properties:
data:
$ref: '#/definitions/models.ShortCompatMessage'
message:
type: string
success:
type: string
type: object
handler.pingResponse:
properties:
info:
$ref: '#/definitions/handler.pingResponseInfo'
message:
type: string
type: object
handler.pingResponseInfo:
properties:
addr:
type: string
headers:
additionalProperties:
items:
type: string
type: array
type: object
method:
type: string
request:
type: string
uri:
type: string
type: object
models.ClientJSON:
properties:
agent_model:
type: string
agent_version:
type: string
client_id:
type: integer
fcm_token:
type: string
timestamp_created:
type: string
type:
type: string
user_id:
type: integer
type: object
models.CompatMessage:
properties:
body:
type: string
priority:
type: integer
scn_msg_id:
type: string
timestamp:
type: integer
title:
type: string
usr_msg_id:
type: string
type: object
models.ShortCompatMessage:
properties:
body:
type: string
priority:
type: integer
scn_msg_id:
type: string
timestamp:
type: integer
title:
type: string
trimmed:
type: boolean
usr_msg_id:
type: string
type: object
models.UserJSON:
properties:
admin_key:
type: string
is_pro:
type: boolean
messages_sent:
type: integer
quota_day:
type: string
quota_today:
type: integer
read_key:
type: string
send_key:
type: string
timestamp_created:
type: string
timestamp_last_read:
type: string
timestamp_last_sent:
type: string
user_id:
type: integer
username:
type: string
type: object
host: scn.blackforestbytes.com
info:
contact: {}
description: API for SCN
title: SimpleCloudNotifier API
version: "2.0"
paths:
/api-v2/user/:
post:
operationId: api-user-create
parameters:
- description: ' '
in: body
name: post_body
schema:
$ref: '#/definitions/handler.CreateUser.body'
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.UserJSON'
"400":
description: Bad Request
schema:
$ref: '#/definitions/ginresp.apiError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: Create a new user
/api-v2/user/{uid}:
get:
operationId: api-user-get
parameters:
- description: UserID
in: path
name: uid
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.UserJSON'
"400":
description: Bad Request
schema:
$ref: '#/definitions/ginresp.apiError'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/ginresp.apiError'
"404":
description: Not Found
schema:
$ref: '#/definitions/ginresp.apiError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: Get a user
patch:
description: The body-values are optional, only send the ones you want to update
operationId: api-user-update
parameters:
- description: ' '
in: body
name: post_body
schema:
$ref: '#/definitions/handler.UpdateUser.body'
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.UserJSON'
"400":
description: Bad Request
schema:
$ref: '#/definitions/ginresp.apiError'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/ginresp.apiError'
"404":
description: Not Found
schema:
$ref: '#/definitions/ginresp.apiError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: (Partially) update a user
/api-v2/user/{uid}/clients:
get:
operationId: api-clients-list
parameters:
- description: UserID
in: path
name: uid
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.ListClients.result'
"400":
description: Bad Request
schema:
$ref: '#/definitions/ginresp.apiError'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/ginresp.apiError'
"404":
description: Not Found
schema:
$ref: '#/definitions/ginresp.apiError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: List all clients
/api/ack.php:
get:
operationId: compat-ack
parameters:
- description: the user_id
in: query
name: user_id
required: true
type: string
- description: the user_key
in: query
name: user_key
required: true
type: string
- description: the message id
in: query
name: scn_msg_id
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.Ack.response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: Acknowledge that a message was received
/api/expand.php:
get:
operationId: compat-expand
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.Expand.response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: Get a whole (potentially truncated) message
/api/info.php:
get:
operationId: compat-info
parameters:
- description: the user_id
in: query
name: user_id
required: true
type: string
- description: the user_key
in: query
name: user_key
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.Info.response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: Get information about the current user
/api/register.php:
get:
operationId: compat-register
parameters:
- description: the (android) fcm token
in: query
name: fcm_token
required: true
type: string
- description: if the user is a paid account
enum:
- "true"
- "false"
in: query
name: pro
required: true
type: string
- description: the (android) IAP token
in: query
name: pro_token
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.Register.response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: Register a new account
/api/requery.php:
get:
operationId: compat-requery
parameters:
- description: the user_id
in: query
name: user_id
required: true
type: string
- description: the user_key
in: query
name: user_key
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.Requery.response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: Return all not-acknowledged messages
/api/update.php:
get:
operationId: compat-update
parameters:
- description: the user_id
in: query
name: user_id
required: true
type: string
- description: the user_key
in: query
name: user_key
required: true
type: string
- description: the (android) fcm token
in: query
name: fcm_token
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.Update.response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: Set the fcm-token (android)
/api/upgrade.php:
get:
operationId: compat-upgrade
parameters:
- description: the user_id
in: query
name: user_id
required: true
type: string
- description: the user_key
in: query
name: user_key
required: true
type: string
- description: if the user is a paid account
enum:
- "true"
- "false"
in: query
name: pro
required: true
type: string
- description: the (android) IAP token
in: query
name: pro_token
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.Upgrade.response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: Upgrade a free account to a paid account
/db-test:
get:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.DatabaseTest.response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
/health:
get:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.Health.response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
/ping:
delete:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.pingResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
get:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.pingResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
patch:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.pingResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
post:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.pingResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
put:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.pingResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
swagger: "2.0"