add API endpoints to list and add sticker packs

see #398
This commit is contained in:
Bernhard B
2024-03-13 21:10:23 +01:00
parent 9c365e6f84
commit efee49e792
6 changed files with 471 additions and 3 deletions

View File

@@ -1656,6 +1656,88 @@ var doc = `{
}
}
},
"/v1/sticker-packs/{number}": {
"get": {
"description": "List Installed Sticker Packs.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Sticker Packs"
],
"summary": "List Installed Sticker Packs.",
"parameters": [
{
"type": "string",
"description": "Registered Phone Number",
"name": "number",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/client.ListInstalledStickerPacksResponse"
}
}
},
"204": {},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
},
"post": {
"description": "In order to add a sticker pack, browse to https://signalstickers.org/ and select the sticker pack you want to add. Then, press the \"Add to Signal\" button. If you look at the address bar in your browser you should see an URL in this format: https://signal.art/addstickers/#pack_id=XXX\u0026pack_key=YYY, where XXX is the pack_id and YYY is the pack_key.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Sticker Packs"
],
"summary": "Add Sticker Pack.",
"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.AddStickerPackRequest"
}
}
],
"responses": {
"204": {},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
}
},
"/v1/typing-indicator/{number}": {
"put": {
"description": "Show Typing Indicator.",
@@ -1839,6 +1921,19 @@ var doc = `{
}
}
},
"api.AddStickerPackRequest": {
"type": "object",
"properties": {
"pack_id": {
"type": "string",
"example": "9a32eda01a7a28574f2eb48668ae0dc4"
},
"pack_key": {
"type": "string",
"example": "19546e18eba0ff69dea78eb591465289d39e16f35e58389ae779d4f9455aff3a"
}
}
},
"api.ChangeGroupAdminsRequest": {
"type": "object",
"properties": {
@@ -2092,7 +2187,8 @@ var doc = `{
"type": "object",
"properties": {
"username": {
"type": "string"
"type": "string",
"example": "test"
}
}
},
@@ -2296,6 +2392,26 @@ var doc = `{
}
}
},
"client.ListInstalledStickerPacksResponse": {
"type": "object",
"properties": {
"author": {
"type": "string"
},
"installed": {
"type": "boolean"
},
"pack_id": {
"type": "string"
},
"title": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"client.MessageMention": {
"type": "object",
"properties": {
@@ -2362,6 +2478,10 @@ var doc = `{
{
"description": "Search the Signal Service.",
"name": "Search"
},
{
"description": "List and Install Sticker Packs",
"name": "Sticker Packs"
}
]
}`

View File

@@ -1640,6 +1640,88 @@
}
}
},
"/v1/sticker-packs/{number}": {
"get": {
"description": "List Installed Sticker Packs.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Sticker Packs"
],
"summary": "List Installed Sticker Packs.",
"parameters": [
{
"type": "string",
"description": "Registered Phone Number",
"name": "number",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/client.ListInstalledStickerPacksResponse"
}
}
},
"204": {},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
},
"post": {
"description": "In order to add a sticker pack, browse to https://signalstickers.org/ and select the sticker pack you want to add. Then, press the \"Add to Signal\" button. If you look at the address bar in your browser you should see an URL in this format: https://signal.art/addstickers/#pack_id=XXX\u0026pack_key=YYY, where XXX is the pack_id and YYY is the pack_key.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Sticker Packs"
],
"summary": "Add Sticker Pack.",
"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.AddStickerPackRequest"
}
}
],
"responses": {
"204": {},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
}
},
"/v1/typing-indicator/{number}": {
"put": {
"description": "Show Typing Indicator.",
@@ -1823,6 +1905,19 @@
}
}
},
"api.AddStickerPackRequest": {
"type": "object",
"properties": {
"pack_id": {
"type": "string",
"example": "9a32eda01a7a28574f2eb48668ae0dc4"
},
"pack_key": {
"type": "string",
"example": "19546e18eba0ff69dea78eb591465289d39e16f35e58389ae779d4f9455aff3a"
}
}
},
"api.ChangeGroupAdminsRequest": {
"type": "object",
"properties": {
@@ -2076,7 +2171,8 @@
"type": "object",
"properties": {
"username": {
"type": "string"
"type": "string",
"example": "test"
}
}
},
@@ -2280,6 +2376,26 @@
}
}
},
"client.ListInstalledStickerPacksResponse": {
"type": "object",
"properties": {
"author": {
"type": "string"
},
"installed": {
"type": "boolean"
},
"pack_id": {
"type": "string"
},
"title": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"client.MessageMention": {
"type": "object",
"properties": {
@@ -2346,6 +2462,10 @@
{
"description": "Search the Signal Service.",
"name": "Search"
},
{
"description": "List and Install Sticker Packs",
"name": "Sticker Packs"
}
]
}

View File

@@ -5,6 +5,15 @@ definitions:
uri:
type: string
type: object
api.AddStickerPackRequest:
properties:
pack_id:
example: 9a32eda01a7a28574f2eb48668ae0dc4
type: string
pack_key:
example: 19546e18eba0ff69dea78eb591465289d39e16f35e58389ae779d4f9455aff3a
type: string
type: object
api.ChangeGroupAdminsRequest:
properties:
admins:
@@ -173,6 +182,7 @@ definitions:
api.SetUsernameRequest:
properties:
username:
example: test
type: string
type: object
api.TrustIdentityRequest:
@@ -305,6 +315,19 @@ definitions:
status:
type: string
type: object
client.ListInstalledStickerPacksResponse:
properties:
author:
type: string
installed:
type: boolean
pack_id:
type: string
title:
type: string
url:
type: string
type: object
client.MessageMention:
properties:
author:
@@ -1410,6 +1433,61 @@ paths:
summary: Send a signal message.
tags:
- Messages
/v1/sticker-packs/{number}:
get:
consumes:
- application/json
description: List Installed Sticker Packs.
parameters:
- description: Registered Phone Number
in: path
name: number
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/client.ListInstalledStickerPacksResponse'
type: array
"204": {}
"400":
description: Bad Request
schema:
$ref: '#/definitions/api.Error'
summary: List Installed Sticker Packs.
tags:
- Sticker Packs
post:
consumes:
- application/json
description: 'In order to add a sticker pack, browse to https://signalstickers.org/ and select the sticker pack you want to add. Then, press the "Add to Signal" button. If you look at the address bar in your browser you should see an URL in this format: https://signal.art/addstickers/#pack_id=XXX&pack_key=YYY, where XXX is the pack_id and YYY is the pack_key.'
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.AddStickerPackRequest'
produces:
- application/json
responses:
"204": {}
"400":
description: Bad Request
schema:
$ref: '#/definitions/api.Error'
summary: Add Sticker Pack.
tags:
- Sticker Packs
/v1/typing-indicator/{number}:
delete:
consumes:
@@ -1546,3 +1624,5 @@ tags:
name: Reactions
- description: Search the Signal Service.
name: Search
- description: List and Install Sticker Packs
name: Sticker Packs