Add KeyToken authorization
This commit is contained in:
@@ -17,12 +17,6 @@
|
||||
],
|
||||
"summary": "Send a new message",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"example": "qhnUbKcLgp6tg",
|
||||
"name": "chan_key",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"example": "test",
|
||||
@@ -35,6 +29,12 @@
|
||||
"name": "content",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"example": "P3TNH8mvv14fm",
|
||||
"name": "key",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"example": "db8b0e6a-a08c-4646",
|
||||
@@ -76,12 +76,6 @@
|
||||
"name": "user_id",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"example": "P3TNH8mvv14fm",
|
||||
"name": "user_key",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"description": " ",
|
||||
"name": "post_body",
|
||||
@@ -90,12 +84,6 @@
|
||||
"$ref": "#/definitions/handler.SendMessage.combined"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"example": "qhnUbKcLgp6tg",
|
||||
"name": "chan_key",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"example": "test",
|
||||
@@ -108,6 +96,12 @@
|
||||
"name": "content",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"example": "P3TNH8mvv14fm",
|
||||
"name": "key",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"example": "db8b0e6a-a08c-4646",
|
||||
@@ -148,12 +142,6 @@
|
||||
"example": "7725",
|
||||
"name": "user_id",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"example": "P3TNH8mvv14fm",
|
||||
"name": "user_key",
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -1034,7 +1022,7 @@
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.UserJSONWithClients"
|
||||
"$ref": "#/definitions/models.UserJSONWithClientsAndKeys"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
@@ -1052,6 +1040,282 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v2/users/:uid/keys": {
|
||||
"get": {
|
||||
"description": "The request must be done with an ADMIN key, the returned keys are without their token.",
|
||||
"tags": [
|
||||
"API-v2"
|
||||
],
|
||||
"summary": "List keys of the user",
|
||||
"operationId": "api-tokenkeys-list",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "UserID",
|
||||
"name": "uid",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.ListUserKeys.response"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "supplied values/parameters cannot be parsed / are invalid",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "user is not authorized / has missing permissions",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "message not found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"tags": [
|
||||
"API-v2"
|
||||
],
|
||||
"summary": "Create a new key",
|
||||
"operationId": "api-tokenkeys-create",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "UserID",
|
||||
"name": "uid",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": " ",
|
||||
"name": "post_body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.CreateUserKey.body"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.KeyTokenJSON"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "supplied values/parameters cannot be parsed / are invalid",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "user is not authorized / has missing permissions",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "message not found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v2/users/:uid/keys/:kid": {
|
||||
"get": {
|
||||
"description": "The request must be done with an ADMIN key, the returned key does not include its token.",
|
||||
"tags": [
|
||||
"API-v2"
|
||||
],
|
||||
"summary": "Get a single key",
|
||||
"operationId": "api-tokenkeys-get",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "UserID",
|
||||
"name": "uid",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "TokenKeyID",
|
||||
"name": "kid",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.KeyTokenJSON"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "supplied values/parameters cannot be parsed / are invalid",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "user is not authorized / has missing permissions",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "message not found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"description": "Cannot be used to delete the key used in the request itself",
|
||||
"tags": [
|
||||
"API-v2"
|
||||
],
|
||||
"summary": "Delete a key",
|
||||
"operationId": "api-tokenkeys-delete",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "UserID",
|
||||
"name": "uid",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "TokenKeyID",
|
||||
"name": "kid",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.KeyTokenJSON"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "supplied values/parameters cannot be parsed / are invalid",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "user is not authorized / has missing permissions",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "message not found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"tags": [
|
||||
"API-v2"
|
||||
],
|
||||
"summary": "Update a key",
|
||||
"operationId": "api-tokenkeys-update",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "UserID",
|
||||
"name": "uid",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "TokenKeyID",
|
||||
"name": "kid",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.KeyTokenJSON"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "supplied values/parameters cannot be parsed / are invalid",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "user is not authorized / has missing permissions",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "message not found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v2/users/{uid}": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -2081,12 +2345,6 @@
|
||||
],
|
||||
"summary": "Send a new message",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"example": "qhnUbKcLgp6tg",
|
||||
"name": "chan_key",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"example": "test",
|
||||
@@ -2099,6 +2357,12 @@
|
||||
"name": "content",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"example": "P3TNH8mvv14fm",
|
||||
"name": "key",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"example": "db8b0e6a-a08c-4646",
|
||||
@@ -2140,12 +2404,6 @@
|
||||
"name": "user_id",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"example": "P3TNH8mvv14fm",
|
||||
"name": "user_key",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"description": " ",
|
||||
"name": "post_body",
|
||||
@@ -2154,12 +2412,6 @@
|
||||
"$ref": "#/definitions/handler.SendMessage.combined"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"example": "qhnUbKcLgp6tg",
|
||||
"name": "chan_key",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"example": "test",
|
||||
@@ -2172,6 +2424,12 @@
|
||||
"name": "content",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"example": "P3TNH8mvv14fm",
|
||||
"name": "key",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"example": "db8b0e6a-a08c-4646",
|
||||
@@ -2212,12 +2470,6 @@
|
||||
"example": "7725",
|
||||
"name": "user_id",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"example": "P3TNH8mvv14fm",
|
||||
"name": "user_key",
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -2370,6 +2622,97 @@
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"apierr.APIError": {
|
||||
"type": "integer",
|
||||
"enum": [
|
||||
-1,
|
||||
0,
|
||||
1101,
|
||||
1102,
|
||||
1103,
|
||||
1104,
|
||||
1105,
|
||||
1106,
|
||||
1121,
|
||||
1151,
|
||||
1152,
|
||||
1153,
|
||||
1161,
|
||||
1171,
|
||||
1201,
|
||||
1202,
|
||||
1203,
|
||||
1204,
|
||||
1205,
|
||||
1206,
|
||||
1207,
|
||||
1208,
|
||||
1251,
|
||||
1301,
|
||||
1302,
|
||||
1303,
|
||||
1304,
|
||||
1305,
|
||||
1306,
|
||||
1307,
|
||||
1311,
|
||||
1401,
|
||||
1501,
|
||||
1511,
|
||||
2101,
|
||||
3001,
|
||||
3002,
|
||||
9901,
|
||||
9902,
|
||||
9903,
|
||||
9904,
|
||||
9905
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"UNDEFINED",
|
||||
"NO_ERROR",
|
||||
"MISSING_UID",
|
||||
"MISSING_TOK",
|
||||
"MISSING_TITLE",
|
||||
"INVALID_PRIO",
|
||||
"REQ_METHOD",
|
||||
"INVALID_CLIENTTYPE",
|
||||
"PAGETOKEN_ERROR",
|
||||
"BINDFAIL_QUERY_PARAM",
|
||||
"BINDFAIL_BODY_PARAM",
|
||||
"BINDFAIL_URI_PARAM",
|
||||
"INVALID_BODY_PARAM",
|
||||
"INVALID_ENUM_VALUE",
|
||||
"NO_TITLE",
|
||||
"TITLE_TOO_LONG",
|
||||
"CONTENT_TOO_LONG",
|
||||
"USR_MSG_ID_TOO_LONG",
|
||||
"TIMESTAMP_OUT_OF_RANGE",
|
||||
"SENDERNAME_TOO_LONG",
|
||||
"CHANNEL_TOO_LONG",
|
||||
"CHANNEL_DESCRIPTION_TOO_LONG",
|
||||
"CHANNEL_NAME_WOULD_CHANGE",
|
||||
"USER_NOT_FOUND",
|
||||
"CLIENT_NOT_FOUND",
|
||||
"CHANNEL_NOT_FOUND",
|
||||
"SUBSCRIPTION_NOT_FOUND",
|
||||
"MESSAGE_NOT_FOUND",
|
||||
"SUBSCRIPTION_USER_MISMATCH",
|
||||
"KEY_NOT_FOUND",
|
||||
"USER_AUTH_FAILED",
|
||||
"NO_DEVICE_LINKED",
|
||||
"CHANNEL_ALREADY_EXISTS",
|
||||
"CANNOT_SELFDELETE_KEY",
|
||||
"QUOTA_REACHED",
|
||||
"FAILED_VERIFY_PRO_TOKEN",
|
||||
"INVALID_PRO_TOKEN",
|
||||
"FIREBASE_COM_FAILED",
|
||||
"FIREBASE_COM_ERRORED",
|
||||
"INTERNAL_EXCEPTION",
|
||||
"PANIC",
|
||||
"NOT_IMPLEMENTED"
|
||||
]
|
||||
},
|
||||
"ginresp.apiError": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -2492,6 +2835,32 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"handler.CreateUserKey.body": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"all_channels",
|
||||
"channels",
|
||||
"name",
|
||||
"permissions"
|
||||
],
|
||||
"properties": {
|
||||
"all_channels": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"channels": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"permissions": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"handler.DatabaseTest.response": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -2630,6 +2999,17 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"handler.ListUserKeys.response": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"tokens": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.KeyTokenJSON"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"handler.ListUserSubscriptions.response": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -2690,10 +3070,6 @@
|
||||
"handler.SendMessage.combined": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"chan_key": {
|
||||
"type": "string",
|
||||
"example": "qhnUbKcLgp6tg"
|
||||
},
|
||||
"channel": {
|
||||
"type": "string",
|
||||
"example": "test"
|
||||
@@ -2702,6 +3078,10 @@
|
||||
"type": "string",
|
||||
"example": "This is a message"
|
||||
},
|
||||
"key": {
|
||||
"type": "string",
|
||||
"example": "P3TNH8mvv14fm"
|
||||
},
|
||||
"msg_id": {
|
||||
"type": "string",
|
||||
"example": "db8b0e6a-a08c-4646"
|
||||
@@ -2730,10 +3110,6 @@
|
||||
"user_id": {
|
||||
"type": "string",
|
||||
"example": "7725"
|
||||
},
|
||||
"user_key": {
|
||||
"type": "string",
|
||||
"example": "P3TNH8mvv14fm"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -2744,7 +3120,7 @@
|
||||
"type": "integer"
|
||||
},
|
||||
"error": {
|
||||
"type": "integer"
|
||||
"$ref": "#/definitions/apierr.APIError"
|
||||
},
|
||||
"is_pro": {
|
||||
"type": "boolean"
|
||||
@@ -2779,7 +3155,7 @@
|
||||
"type": "integer"
|
||||
},
|
||||
"error": {
|
||||
"type": "integer"
|
||||
"$ref": "#/definitions/apierr.APIError"
|
||||
},
|
||||
"is_pro": {
|
||||
"type": "boolean"
|
||||
@@ -2936,10 +3312,6 @@
|
||||
"owner_user_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"send_key": {
|
||||
"description": "can be nil, depending on endpoint",
|
||||
"type": "string"
|
||||
},
|
||||
"subscribe_key": {
|
||||
"description": "can be nil, depending on endpoint",
|
||||
"type": "string"
|
||||
@@ -2974,13 +3346,24 @@
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
"$ref": "#/definitions/models.ClientType"
|
||||
},
|
||||
"user_id": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ClientType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"ANDROID",
|
||||
"IOS"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"ClientTypeAndroid",
|
||||
"ClientTypeIOS"
|
||||
]
|
||||
},
|
||||
"models.CompatMessage": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3007,6 +3390,41 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.KeyTokenJSON": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"all_channels": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"channels": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"keytoken_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"messages_sent": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"owner_user_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"permissions": {
|
||||
"type": "string"
|
||||
},
|
||||
"timestamp_created": {
|
||||
"type": "string"
|
||||
},
|
||||
"timestamp_lastused": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.MessageJSON": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3080,9 +3498,6 @@
|
||||
"models.UserJSON": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"admin_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"default_channel": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -3101,12 +3516,6 @@
|
||||
"quota_used": {
|
||||
"type": "integer"
|
||||
},
|
||||
"read_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"send_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"timestamp_created": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -3124,7 +3533,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.UserJSONWithClients": {
|
||||
"models.UserJSONWithClientsAndKeys": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"admin_key": {
|
||||
|
@@ -1,5 +1,93 @@
|
||||
basePath: /
|
||||
definitions:
|
||||
apierr.APIError:
|
||||
enum:
|
||||
- -1
|
||||
- 0
|
||||
- 1101
|
||||
- 1102
|
||||
- 1103
|
||||
- 1104
|
||||
- 1105
|
||||
- 1106
|
||||
- 1121
|
||||
- 1151
|
||||
- 1152
|
||||
- 1153
|
||||
- 1161
|
||||
- 1171
|
||||
- 1201
|
||||
- 1202
|
||||
- 1203
|
||||
- 1204
|
||||
- 1205
|
||||
- 1206
|
||||
- 1207
|
||||
- 1208
|
||||
- 1251
|
||||
- 1301
|
||||
- 1302
|
||||
- 1303
|
||||
- 1304
|
||||
- 1305
|
||||
- 1306
|
||||
- 1307
|
||||
- 1311
|
||||
- 1401
|
||||
- 1501
|
||||
- 1511
|
||||
- 2101
|
||||
- 3001
|
||||
- 3002
|
||||
- 9901
|
||||
- 9902
|
||||
- 9903
|
||||
- 9904
|
||||
- 9905
|
||||
type: integer
|
||||
x-enum-varnames:
|
||||
- UNDEFINED
|
||||
- NO_ERROR
|
||||
- MISSING_UID
|
||||
- MISSING_TOK
|
||||
- MISSING_TITLE
|
||||
- INVALID_PRIO
|
||||
- REQ_METHOD
|
||||
- INVALID_CLIENTTYPE
|
||||
- PAGETOKEN_ERROR
|
||||
- BINDFAIL_QUERY_PARAM
|
||||
- BINDFAIL_BODY_PARAM
|
||||
- BINDFAIL_URI_PARAM
|
||||
- INVALID_BODY_PARAM
|
||||
- INVALID_ENUM_VALUE
|
||||
- NO_TITLE
|
||||
- TITLE_TOO_LONG
|
||||
- CONTENT_TOO_LONG
|
||||
- USR_MSG_ID_TOO_LONG
|
||||
- TIMESTAMP_OUT_OF_RANGE
|
||||
- SENDERNAME_TOO_LONG
|
||||
- CHANNEL_TOO_LONG
|
||||
- CHANNEL_DESCRIPTION_TOO_LONG
|
||||
- CHANNEL_NAME_WOULD_CHANGE
|
||||
- USER_NOT_FOUND
|
||||
- CLIENT_NOT_FOUND
|
||||
- CHANNEL_NOT_FOUND
|
||||
- SUBSCRIPTION_NOT_FOUND
|
||||
- MESSAGE_NOT_FOUND
|
||||
- SUBSCRIPTION_USER_MISMATCH
|
||||
- KEY_NOT_FOUND
|
||||
- USER_AUTH_FAILED
|
||||
- NO_DEVICE_LINKED
|
||||
- CHANNEL_ALREADY_EXISTS
|
||||
- CANNOT_SELFDELETE_KEY
|
||||
- QUOTA_REACHED
|
||||
- FAILED_VERIFY_PRO_TOKEN
|
||||
- INVALID_PRO_TOKEN
|
||||
- FIREBASE_COM_FAILED
|
||||
- FIREBASE_COM_ERRORED
|
||||
- INTERNAL_EXCEPTION
|
||||
- PANIC
|
||||
- NOT_IMPLEMENTED
|
||||
ginresp.apiError:
|
||||
properties:
|
||||
errhighlight:
|
||||
@@ -80,6 +168,24 @@ definitions:
|
||||
username:
|
||||
type: string
|
||||
type: object
|
||||
handler.CreateUserKey.body:
|
||||
properties:
|
||||
all_channels:
|
||||
type: boolean
|
||||
channels:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
name:
|
||||
type: string
|
||||
permissions:
|
||||
type: string
|
||||
required:
|
||||
- all_channels
|
||||
- channels
|
||||
- name
|
||||
- permissions
|
||||
type: object
|
||||
handler.DatabaseTest.response:
|
||||
properties:
|
||||
libVersion:
|
||||
@@ -169,6 +275,13 @@ definitions:
|
||||
page_size:
|
||||
type: integer
|
||||
type: object
|
||||
handler.ListUserKeys.response:
|
||||
properties:
|
||||
tokens:
|
||||
items:
|
||||
$ref: '#/definitions/models.KeyTokenJSON'
|
||||
type: array
|
||||
type: object
|
||||
handler.ListUserSubscriptions.response:
|
||||
properties:
|
||||
subscriptions:
|
||||
@@ -208,15 +321,15 @@ definitions:
|
||||
type: object
|
||||
handler.SendMessage.combined:
|
||||
properties:
|
||||
chan_key:
|
||||
example: qhnUbKcLgp6tg
|
||||
type: string
|
||||
channel:
|
||||
example: test
|
||||
type: string
|
||||
content:
|
||||
example: This is a message
|
||||
type: string
|
||||
key:
|
||||
example: P3TNH8mvv14fm
|
||||
type: string
|
||||
msg_id:
|
||||
example: db8b0e6a-a08c-4646
|
||||
type: string
|
||||
@@ -239,16 +352,13 @@ definitions:
|
||||
user_id:
|
||||
example: "7725"
|
||||
type: string
|
||||
user_key:
|
||||
example: P3TNH8mvv14fm
|
||||
type: string
|
||||
type: object
|
||||
handler.SendMessage.response:
|
||||
properties:
|
||||
errhighlight:
|
||||
type: integer
|
||||
error:
|
||||
type: integer
|
||||
$ref: '#/definitions/apierr.APIError'
|
||||
is_pro:
|
||||
type: boolean
|
||||
message:
|
||||
@@ -271,7 +381,7 @@ definitions:
|
||||
errhighlight:
|
||||
type: integer
|
||||
error:
|
||||
type: integer
|
||||
$ref: '#/definitions/apierr.APIError'
|
||||
is_pro:
|
||||
type: boolean
|
||||
message:
|
||||
@@ -373,9 +483,6 @@ definitions:
|
||||
type: integer
|
||||
owner_user_id:
|
||||
type: string
|
||||
send_key:
|
||||
description: can be nil, depending on endpoint
|
||||
type: string
|
||||
subscribe_key:
|
||||
description: can be nil, depending on endpoint
|
||||
type: string
|
||||
@@ -399,10 +506,18 @@ definitions:
|
||||
timestamp_created:
|
||||
type: string
|
||||
type:
|
||||
type: string
|
||||
$ref: '#/definitions/models.ClientType'
|
||||
user_id:
|
||||
type: string
|
||||
type: object
|
||||
models.ClientType:
|
||||
enum:
|
||||
- ANDROID
|
||||
- IOS
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- ClientTypeAndroid
|
||||
- ClientTypeIOS
|
||||
models.CompatMessage:
|
||||
properties:
|
||||
body:
|
||||
@@ -420,6 +535,29 @@ definitions:
|
||||
usr_msg_id:
|
||||
type: string
|
||||
type: object
|
||||
models.KeyTokenJSON:
|
||||
properties:
|
||||
all_channels:
|
||||
type: boolean
|
||||
channels:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
keytoken_id:
|
||||
type: string
|
||||
messages_sent:
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
owner_user_id:
|
||||
type: string
|
||||
permissions:
|
||||
type: string
|
||||
timestamp_created:
|
||||
type: string
|
||||
timestamp_lastused:
|
||||
type: string
|
||||
type: object
|
||||
models.MessageJSON:
|
||||
properties:
|
||||
channel_id:
|
||||
@@ -468,8 +606,6 @@ definitions:
|
||||
type: object
|
||||
models.UserJSON:
|
||||
properties:
|
||||
admin_key:
|
||||
type: string
|
||||
default_channel:
|
||||
type: string
|
||||
is_pro:
|
||||
@@ -482,10 +618,6 @@ definitions:
|
||||
type: integer
|
||||
quota_used:
|
||||
type: integer
|
||||
read_key:
|
||||
type: string
|
||||
send_key:
|
||||
type: string
|
||||
timestamp_created:
|
||||
type: string
|
||||
timestamp_lastread:
|
||||
@@ -497,7 +629,7 @@ definitions:
|
||||
username:
|
||||
type: string
|
||||
type: object
|
||||
models.UserJSONWithClients:
|
||||
models.UserJSONWithClientsAndKeys:
|
||||
properties:
|
||||
admin_key:
|
||||
type: string
|
||||
@@ -544,10 +676,6 @@ paths:
|
||||
description: All parameter can be set via query-parameter or the json body.
|
||||
Only UserID, UserKey and Title are required
|
||||
parameters:
|
||||
- example: qhnUbKcLgp6tg
|
||||
in: query
|
||||
name: chan_key
|
||||
type: string
|
||||
- example: test
|
||||
in: query
|
||||
name: channel
|
||||
@@ -556,6 +684,10 @@ paths:
|
||||
in: query
|
||||
name: content
|
||||
type: string
|
||||
- example: P3TNH8mvv14fm
|
||||
in: query
|
||||
name: key
|
||||
type: string
|
||||
- example: db8b0e6a-a08c-4646
|
||||
in: query
|
||||
name: msg_id
|
||||
@@ -584,19 +716,11 @@ paths:
|
||||
in: query
|
||||
name: user_id
|
||||
type: string
|
||||
- example: P3TNH8mvv14fm
|
||||
in: query
|
||||
name: user_key
|
||||
type: string
|
||||
- description: ' '
|
||||
in: body
|
||||
name: post_body
|
||||
schema:
|
||||
$ref: '#/definitions/handler.SendMessage.combined'
|
||||
- example: qhnUbKcLgp6tg
|
||||
in: formData
|
||||
name: chan_key
|
||||
type: string
|
||||
- example: test
|
||||
in: formData
|
||||
name: channel
|
||||
@@ -605,6 +729,10 @@ paths:
|
||||
in: formData
|
||||
name: content
|
||||
type: string
|
||||
- example: P3TNH8mvv14fm
|
||||
in: formData
|
||||
name: key
|
||||
type: string
|
||||
- example: db8b0e6a-a08c-4646
|
||||
in: formData
|
||||
name: msg_id
|
||||
@@ -633,10 +761,6 @@ paths:
|
||||
in: formData
|
||||
name: user_id
|
||||
type: string
|
||||
- example: P3TNH8mvv14fm
|
||||
in: formData
|
||||
name: user_key
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
@@ -1240,7 +1364,7 @@ paths:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.UserJSONWithClients'
|
||||
$ref: '#/definitions/models.UserJSONWithClientsAndKeys'
|
||||
"400":
|
||||
description: supplied values/parameters cannot be parsed / are invalid
|
||||
schema:
|
||||
@@ -1252,6 +1376,193 @@ paths:
|
||||
summary: Create a new user
|
||||
tags:
|
||||
- API-v2
|
||||
/api/v2/users/:uid/keys:
|
||||
get:
|
||||
description: The request must be done with an ADMIN key, the returned keys are
|
||||
without their token.
|
||||
operationId: api-tokenkeys-list
|
||||
parameters:
|
||||
- description: UserID
|
||||
in: path
|
||||
name: uid
|
||||
required: true
|
||||
type: integer
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/handler.ListUserKeys.response'
|
||||
"400":
|
||||
description: supplied values/parameters cannot be parsed / are invalid
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"401":
|
||||
description: user is not authorized / has missing permissions
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"404":
|
||||
description: message not found
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"500":
|
||||
description: internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
summary: List keys of the user
|
||||
tags:
|
||||
- API-v2
|
||||
post:
|
||||
operationId: api-tokenkeys-create
|
||||
parameters:
|
||||
- description: UserID
|
||||
in: path
|
||||
name: uid
|
||||
required: true
|
||||
type: integer
|
||||
- description: ' '
|
||||
in: body
|
||||
name: post_body
|
||||
schema:
|
||||
$ref: '#/definitions/handler.CreateUserKey.body'
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.KeyTokenJSON'
|
||||
"400":
|
||||
description: supplied values/parameters cannot be parsed / are invalid
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"401":
|
||||
description: user is not authorized / has missing permissions
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"404":
|
||||
description: message not found
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"500":
|
||||
description: internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
summary: Create a new key
|
||||
tags:
|
||||
- API-v2
|
||||
/api/v2/users/:uid/keys/:kid:
|
||||
delete:
|
||||
description: Cannot be used to delete the key used in the request itself
|
||||
operationId: api-tokenkeys-delete
|
||||
parameters:
|
||||
- description: UserID
|
||||
in: path
|
||||
name: uid
|
||||
required: true
|
||||
type: integer
|
||||
- description: TokenKeyID
|
||||
in: path
|
||||
name: kid
|
||||
required: true
|
||||
type: integer
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.KeyTokenJSON'
|
||||
"400":
|
||||
description: supplied values/parameters cannot be parsed / are invalid
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"401":
|
||||
description: user is not authorized / has missing permissions
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"404":
|
||||
description: message not found
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"500":
|
||||
description: internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
summary: Delete a key
|
||||
tags:
|
||||
- API-v2
|
||||
get:
|
||||
description: The request must be done with an ADMIN key, the returned key does
|
||||
not include its token.
|
||||
operationId: api-tokenkeys-get
|
||||
parameters:
|
||||
- description: UserID
|
||||
in: path
|
||||
name: uid
|
||||
required: true
|
||||
type: integer
|
||||
- description: TokenKeyID
|
||||
in: path
|
||||
name: kid
|
||||
required: true
|
||||
type: integer
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.KeyTokenJSON'
|
||||
"400":
|
||||
description: supplied values/parameters cannot be parsed / are invalid
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"401":
|
||||
description: user is not authorized / has missing permissions
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"404":
|
||||
description: message not found
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"500":
|
||||
description: internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
summary: Get a single key
|
||||
tags:
|
||||
- API-v2
|
||||
patch:
|
||||
operationId: api-tokenkeys-update
|
||||
parameters:
|
||||
- description: UserID
|
||||
in: path
|
||||
name: uid
|
||||
required: true
|
||||
type: integer
|
||||
- description: TokenKeyID
|
||||
in: path
|
||||
name: kid
|
||||
required: true
|
||||
type: integer
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.KeyTokenJSON'
|
||||
"400":
|
||||
description: supplied values/parameters cannot be parsed / are invalid
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"401":
|
||||
description: user is not authorized / has missing permissions
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"404":
|
||||
description: message not found
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"500":
|
||||
description: internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
summary: Update a key
|
||||
tags:
|
||||
- API-v2
|
||||
/api/v2/users/{uid}:
|
||||
get:
|
||||
operationId: api-user-get
|
||||
@@ -1956,10 +2267,6 @@ paths:
|
||||
description: All parameter can be set via query-parameter or the json body.
|
||||
Only UserID, UserKey and Title are required
|
||||
parameters:
|
||||
- example: qhnUbKcLgp6tg
|
||||
in: query
|
||||
name: chan_key
|
||||
type: string
|
||||
- example: test
|
||||
in: query
|
||||
name: channel
|
||||
@@ -1968,6 +2275,10 @@ paths:
|
||||
in: query
|
||||
name: content
|
||||
type: string
|
||||
- example: P3TNH8mvv14fm
|
||||
in: query
|
||||
name: key
|
||||
type: string
|
||||
- example: db8b0e6a-a08c-4646
|
||||
in: query
|
||||
name: msg_id
|
||||
@@ -1996,19 +2307,11 @@ paths:
|
||||
in: query
|
||||
name: user_id
|
||||
type: string
|
||||
- example: P3TNH8mvv14fm
|
||||
in: query
|
||||
name: user_key
|
||||
type: string
|
||||
- description: ' '
|
||||
in: body
|
||||
name: post_body
|
||||
schema:
|
||||
$ref: '#/definitions/handler.SendMessage.combined'
|
||||
- example: qhnUbKcLgp6tg
|
||||
in: formData
|
||||
name: chan_key
|
||||
type: string
|
||||
- example: test
|
||||
in: formData
|
||||
name: channel
|
||||
@@ -2017,6 +2320,10 @@ paths:
|
||||
in: formData
|
||||
name: content
|
||||
type: string
|
||||
- example: P3TNH8mvv14fm
|
||||
in: formData
|
||||
name: key
|
||||
type: string
|
||||
- example: db8b0e6a-a08c-4646
|
||||
in: formData
|
||||
name: msg_id
|
||||
@@ -2045,10 +2352,6 @@ paths:
|
||||
in: formData
|
||||
name: user_id
|
||||
type: string
|
||||
- example: P3TNH8mvv14fm
|
||||
in: formData
|
||||
name: user_key
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
|
Reference in New Issue
Block a user