added API endpoints to set/remove a pin

see #660
This commit is contained in:
Bernhard B
2025-02-26 22:26:13 +01:00
parent 46bd47fc04
commit 4404929c90
6 changed files with 295 additions and 2 deletions

View File

@@ -64,6 +64,68 @@ const docTemplate = `{
}
}
},
"/v1/accounts/{number}/pin": {
"get": {
"description": "Sets a new Signal Pin",
"produces": [
"application/json"
],
"tags": [
"Accounts"
],
"summary": "Set Pin",
"parameters": [
{
"type": "string",
"description": "Registered Phone Number",
"name": "number",
"in": "path",
"required": true
}
],
"responses": {
"201": {
"description": "Created"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
},
"delete": {
"description": "Removes a Signal Pin",
"produces": [
"application/json"
],
"tags": [
"Accounts"
],
"summary": "Remove Pin",
"parameters": [
{
"type": "string",
"description": "Registered Phone Number",
"name": "number",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
}
},
"/v1/accounts/{number}/rate-limit-challenge": {
"post": {
"description": "When running into rate limits, sometimes the limit can be lifted, by solving a CAPTCHA. To get the captcha token, go to https://signalcaptchas.org/challenge/generate.html For the staging environment, use: https://signalcaptchas.org/staging/registration/generate.html. The \"challenge_token\" is the token from the failed send attempt. The \"captcha\" is the captcha result, starting with signalcaptcha://",
@@ -1717,7 +1779,8 @@ const docTemplate = `{
"type": "string",
"description": "Registered Phone Number",
"name": "number",
"in": "path"
"in": "path",
"required": true
},
{
"type": "array",
@@ -2526,6 +2589,9 @@ const docTemplate = `{
"blocked": {
"type": "boolean"
},
"description": {
"type": "string"
},
"id": {
"type": "string"
},

View File

@@ -61,6 +61,68 @@
}
}
},
"/v1/accounts/{number}/pin": {
"get": {
"description": "Sets a new Signal Pin",
"produces": [
"application/json"
],
"tags": [
"Accounts"
],
"summary": "Set Pin",
"parameters": [
{
"type": "string",
"description": "Registered Phone Number",
"name": "number",
"in": "path",
"required": true
}
],
"responses": {
"201": {
"description": "Created"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
},
"delete": {
"description": "Removes a Signal Pin",
"produces": [
"application/json"
],
"tags": [
"Accounts"
],
"summary": "Remove Pin",
"parameters": [
{
"type": "string",
"description": "Registered Phone Number",
"name": "number",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
}
},
"/v1/accounts/{number}/rate-limit-challenge": {
"post": {
"description": "When running into rate limits, sometimes the limit can be lifted, by solving a CAPTCHA. To get the captcha token, go to https://signalcaptchas.org/challenge/generate.html For the staging environment, use: https://signalcaptchas.org/staging/registration/generate.html. The \"challenge_token\" is the token from the failed send attempt. The \"captcha\" is the captcha result, starting with signalcaptcha://",
@@ -1714,7 +1776,8 @@
"type": "string",
"description": "Registered Phone Number",
"name": "number",
"in": "path"
"in": "path",
"required": true
},
{
"type": "array",
@@ -2523,6 +2586,9 @@
"blocked": {
"type": "boolean"
},
"description": {
"type": "string"
},
"id": {
"type": "string"
},

View File

@@ -312,6 +312,8 @@ definitions:
type: array
blocked:
type: boolean
description:
type: string
id:
type: string
internal_id:
@@ -433,6 +435,47 @@ paths:
summary: List all accounts
tags:
- Accounts
/v1/accounts/{number}/pin:
delete:
description: Removes a Signal Pin
parameters:
- description: Registered Phone Number
in: path
name: number
required: true
type: string
produces:
- application/json
responses:
"204":
description: No Content
"400":
description: Bad Request
schema:
$ref: '#/definitions/api.Error'
summary: Remove Pin
tags:
- Accounts
get:
description: Sets a new Signal Pin
parameters:
- description: Registered Phone Number
in: path
name: number
required: true
type: string
produces:
- application/json
responses:
"201":
description: Created
"400":
description: Bad Request
schema:
$ref: '#/definitions/api.Error'
summary: Set Pin
tags:
- Accounts
/v1/accounts/{number}/rate-limit-challenge:
post:
consumes:
@@ -1544,6 +1587,7 @@ paths:
- description: Registered Phone Number
in: path
name: number
required: true
type: string
- collectionFormat: multi
description: Numbers to check