tsk-18: Create service user (#22)
Closes #18 Reviewed-on: phoenix/textsender-auth#22 Co-authored-by: phoenix <kundeng00@pm.me> Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
@@ -116,6 +116,57 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/service/register": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Create a service user that can send texts (requires JWT)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"service users"
|
||||
],
|
||||
"summary": "Register service user",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Data to add user",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.ServiceCreationRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.ServiceCreationResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.ServiceCreationResponse"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.ServiceCreationResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
@@ -186,6 +237,31 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"handler.ServiceCreationRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"passphrase": {
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"handler.ServiceCreationResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/user.ServiceUser"
|
||||
}
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"token.Login": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -199,6 +275,23 @@ const docTemplate = `{
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.ServiceUser": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"date_created": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"passphrase": {
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
|
||||
@@ -110,6 +110,57 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/service/register": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Create a service user that can send texts (requires JWT)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"service users"
|
||||
],
|
||||
"summary": "Register service user",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Data to add user",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.ServiceCreationRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.ServiceCreationResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.ServiceCreationResponse"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.ServiceCreationResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
@@ -180,6 +231,31 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"handler.ServiceCreationRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"passphrase": {
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"handler.ServiceCreationResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/user.ServiceUser"
|
||||
}
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"token.Login": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -193,6 +269,23 @@
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.ServiceUser": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"date_created": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"passphrase": {
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
|
||||
@@ -43,6 +43,22 @@ definitions:
|
||||
username:
|
||||
type: string
|
||||
type: object
|
||||
handler.ServiceCreationRequest:
|
||||
properties:
|
||||
passphrase:
|
||||
type: string
|
||||
username:
|
||||
type: string
|
||||
type: object
|
||||
handler.ServiceCreationResponse:
|
||||
properties:
|
||||
data:
|
||||
items:
|
||||
$ref: '#/definitions/user.ServiceUser'
|
||||
type: array
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
token.Login:
|
||||
properties:
|
||||
access_token:
|
||||
@@ -52,6 +68,17 @@ definitions:
|
||||
token_type:
|
||||
type: string
|
||||
type: object
|
||||
user.ServiceUser:
|
||||
properties:
|
||||
date_created:
|
||||
type: string
|
||||
id:
|
||||
type: string
|
||||
passphrase:
|
||||
type: string
|
||||
username:
|
||||
type: string
|
||||
type: object
|
||||
host: localhost:9080
|
||||
info:
|
||||
contact: {}
|
||||
@@ -123,6 +150,38 @@ paths:
|
||||
summary: Register user
|
||||
tags:
|
||||
- users
|
||||
/service/register:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Create a service user that can send texts (requires JWT)
|
||||
parameters:
|
||||
- description: Data to add user
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/handler.ServiceCreationRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/handler.ServiceCreationResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/handler.ServiceCreationResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/handler.ServiceCreationResponse'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Register service user
|
||||
tags:
|
||||
- service users
|
||||
securityDefinitions:
|
||||
BearerAuth:
|
||||
description: JWT Bearer Token
|
||||
|
||||
Reference in New Issue
Block a user