added endpoints to set/remove a username + change the account settings

This commit is contained in:
Bernhard B
2024-03-06 18:27:17 +01:00
parent 91d7dc0a19
commit f57512216c
6 changed files with 594 additions and 0 deletions

View File

@@ -116,6 +116,127 @@ var doc = `{
}
}
},
"/v1/accounts/{number}/settings": {
"put": {
"description": "Update the account attributes on the signal server.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Accounts"
],
"summary": "Update the account settings.",
"parameters": [
{
"type": "string",
"description": "Registered Phone Number",
"name": "number",
"in": "path",
"required": true
},
{
"description": "Request",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.UpdateAccountSettingsRequest"
}
}
],
"responses": {
"204": {},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
}
},
"/v1/accounts/{number}/username": {
"post": {
"description": "Allows to set the username that should be used for this account. This can either be just the nickname (e.g. test) or the complete username with discriminator (e.g. test.123). Returns the new username with discriminator and the username link.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Accounts"
],
"summary": "Set a username.",
"parameters": [
{
"type": "string",
"description": "Registered Phone Number",
"name": "number",
"in": "path",
"required": true
},
{
"description": "Request",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.SetUsernameRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/client.SetUsernameResponse"
}
},
"204": {},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
},
"delete": {
"description": "Delete the username associated with this account.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Accounts"
],
"summary": "Remove a username.",
"parameters": [
{
"type": "string",
"description": "Registered Phone Number",
"name": "number",
"in": "path",
"required": true
}
],
"responses": {
"204": {},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
}
},
"/v1/attachments": {
"get": {
"description": "List all downloaded attachments",
@@ -1964,6 +2085,14 @@ var doc = `{
}
}
},
"api.SetUsernameRequest": {
"type": "object",
"properties": {
"username": {
"type": "string"
}
}
},
"api.TrustIdentityRequest": {
"type": "object",
"properties": {
@@ -2013,6 +2142,17 @@ var doc = `{
}
}
},
"api.UpdateAccountSettingsRequest": {
"type": "object",
"properties": {
"discoverable_by_number": {
"type": "boolean"
},
"share_number": {
"type": "boolean"
}
}
},
"api.UpdateContactRequest": {
"type": "object",
"properties": {
@@ -2166,6 +2306,17 @@ var doc = `{
"type": "integer"
}
}
},
"client.SetUsernameResponse": {
"type": "object",
"properties": {
"username": {
"type": "string"
},
"username_link": {
"type": "string"
}
}
}
},
"tags": [

View File

@@ -100,6 +100,127 @@
}
}
},
"/v1/accounts/{number}/settings": {
"put": {
"description": "Update the account attributes on the signal server.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Accounts"
],
"summary": "Update the account settings.",
"parameters": [
{
"type": "string",
"description": "Registered Phone Number",
"name": "number",
"in": "path",
"required": true
},
{
"description": "Request",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.UpdateAccountSettingsRequest"
}
}
],
"responses": {
"204": {},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
}
},
"/v1/accounts/{number}/username": {
"post": {
"description": "Allows to set the username that should be used for this account. This can either be just the nickname (e.g. test) or the complete username with discriminator (e.g. test.123). Returns the new username with discriminator and the username link.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Accounts"
],
"summary": "Set a username.",
"parameters": [
{
"type": "string",
"description": "Registered Phone Number",
"name": "number",
"in": "path",
"required": true
},
{
"description": "Request",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.SetUsernameRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/client.SetUsernameResponse"
}
},
"204": {},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
},
"delete": {
"description": "Delete the username associated with this account.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Accounts"
],
"summary": "Remove a username.",
"parameters": [
{
"type": "string",
"description": "Registered Phone Number",
"name": "number",
"in": "path",
"required": true
}
],
"responses": {
"204": {},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
}
},
"/v1/attachments": {
"get": {
"description": "List all downloaded attachments",
@@ -1948,6 +2069,14 @@
}
}
},
"api.SetUsernameRequest": {
"type": "object",
"properties": {
"username": {
"type": "string"
}
}
},
"api.TrustIdentityRequest": {
"type": "object",
"properties": {
@@ -1997,6 +2126,17 @@
}
}
},
"api.UpdateAccountSettingsRequest": {
"type": "object",
"properties": {
"discoverable_by_number": {
"type": "boolean"
},
"share_number": {
"type": "boolean"
}
}
},
"api.UpdateContactRequest": {
"type": "object",
"properties": {
@@ -2150,6 +2290,17 @@
"type": "integer"
}
}
},
"client.SetUsernameResponse": {
"type": "object",
"properties": {
"username": {
"type": "string"
},
"username_link": {
"type": "string"
}
}
}
},
"tags": [

View File

@@ -168,6 +168,11 @@ definitions:
- styled
type: string
type: object
api.SetUsernameRequest:
properties:
username:
type: string
type: object
api.TrustIdentityRequest:
properties:
trust_all_known_keys:
@@ -200,6 +205,13 @@ definitions:
example: false
type: boolean
type: object
api.UpdateAccountSettingsRequest:
properties:
discoverable_by_number:
type: boolean
share_number:
type: boolean
type: object
api.UpdateContactRequest:
properties:
expiration_in_seconds:
@@ -300,6 +312,13 @@ definitions:
start:
type: integer
type: object
client.SetUsernameResponse:
properties:
username:
type: string
username_link:
type: string
type: object
info:
contact: {}
description: This is the Signal Cli REST API documentation.
@@ -367,6 +386,87 @@ paths:
summary: Lift rate limit restrictions by solving a captcha.
tags:
- Accounts
/v1/accounts/{number}/settings:
put:
consumes:
- application/json
description: Update the account attributes on the signal server.
parameters:
- description: Registered Phone Number
in: path
name: number
required: true
type: string
- description: Request
in: body
name: data
required: true
schema:
$ref: '#/definitions/api.UpdateAccountSettingsRequest'
produces:
- application/json
responses:
"204": {}
"400":
description: Bad Request
schema:
$ref: '#/definitions/api.Error'
summary: Update the account settings.
tags:
- Accounts
/v1/accounts/{number}/username:
delete:
consumes:
- application/json
description: Delete the username associated with this account.
parameters:
- description: Registered Phone Number
in: path
name: number
required: true
type: string
produces:
- application/json
responses:
"204": {}
"400":
description: Bad Request
schema:
$ref: '#/definitions/api.Error'
summary: Remove a username.
tags:
- Accounts
post:
consumes:
- application/json
description: Allows to set the username that should be used for this account. This can either be just the nickname (e.g. test) or the complete username with discriminator (e.g. test.123). Returns the new username with discriminator and the username link.
parameters:
- description: Registered Phone Number
in: path
name: number
required: true
type: string
- description: Request
in: body
name: data
required: true
schema:
$ref: '#/definitions/api.SetUsernameRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/client.SetUsernameResponse'
"204": {}
"400":
description: Bad Request
schema:
$ref: '#/definitions/api.Error'
summary: Set a username.
tags:
- Accounts
/v1/attachments:
get:
description: List all downloaded attachments