2024-06-05 10:06:41 +02:00
|
|
|
/* tslint:disable */
|
|
|
|
|
/* eslint-disable */
|
|
|
|
|
/**
|
|
|
|
|
* Signal Cli REST API
|
|
|
|
|
* This is the Signal Cli REST API documentation.
|
|
|
|
|
*
|
|
|
|
|
* The version of the OpenAPI document: 1.0
|
2024-06-28 07:49:39 +02:00
|
|
|
*
|
2024-06-05 10:06:41 +02:00
|
|
|
*
|
|
|
|
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
|
|
|
* https://openapi-generator.tech
|
|
|
|
|
* Do not edit the class manually.
|
|
|
|
|
*/
|
|
|
|
|
|
2024-06-28 07:49:39 +02:00
|
|
|
import * as runtime from "../runtime.js";
|
2024-06-05 10:06:41 +02:00
|
|
|
import type {
|
|
|
|
|
ApiError,
|
|
|
|
|
ApiSendMessageError,
|
|
|
|
|
ApiSendMessageResponse,
|
|
|
|
|
ApiSendMessageV1,
|
|
|
|
|
ApiSendMessageV2,
|
|
|
|
|
ApiTypingIndicatorRequest,
|
2024-06-28 07:49:39 +02:00
|
|
|
} from "../models/index.js";
|
2024-06-05 10:06:41 +02:00
|
|
|
import {
|
2024-06-28 07:49:39 +02:00
|
|
|
ApiErrorFromJSON,
|
|
|
|
|
ApiErrorToJSON,
|
|
|
|
|
ApiSendMessageErrorFromJSON,
|
|
|
|
|
ApiSendMessageErrorToJSON,
|
|
|
|
|
ApiSendMessageResponseFromJSON,
|
|
|
|
|
ApiSendMessageResponseToJSON,
|
|
|
|
|
ApiSendMessageV1FromJSON,
|
|
|
|
|
ApiSendMessageV1ToJSON,
|
|
|
|
|
ApiSendMessageV2FromJSON,
|
|
|
|
|
ApiSendMessageV2ToJSON,
|
|
|
|
|
ApiTypingIndicatorRequestFromJSON,
|
|
|
|
|
ApiTypingIndicatorRequestToJSON,
|
|
|
|
|
} from "../models/index.js";
|
2024-06-05 10:06:41 +02:00
|
|
|
|
|
|
|
|
export interface V1ReceiveNumberGetRequest {
|
2024-06-28 07:49:39 +02:00
|
|
|
number: string;
|
|
|
|
|
timeout?: string;
|
|
|
|
|
ignoreAttachments?: string;
|
|
|
|
|
ignoreStories?: string;
|
|
|
|
|
maxMessages?: string;
|
|
|
|
|
sendReadReceipts?: string;
|
2024-06-05 10:06:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface V1SendPostRequest {
|
2024-06-28 07:49:39 +02:00
|
|
|
data: ApiSendMessageV1;
|
2024-06-05 10:06:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface V1TypingIndicatorNumberDeleteRequest {
|
2024-06-28 07:49:39 +02:00
|
|
|
number: string;
|
|
|
|
|
data: ApiTypingIndicatorRequest;
|
2024-06-05 10:06:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface V1TypingIndicatorNumberPutRequest {
|
2024-06-28 07:49:39 +02:00
|
|
|
number: string;
|
|
|
|
|
data: ApiTypingIndicatorRequest;
|
2024-06-05 10:06:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface V2SendPostRequest {
|
2024-06-28 07:49:39 +02:00
|
|
|
data: ApiSendMessageV2;
|
2024-06-05 10:06:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2024-06-28 07:49:39 +02:00
|
|
|
*
|
2024-06-05 10:06:41 +02:00
|
|
|
*/
|
|
|
|
|
export class MessagesApi extends runtime.BaseAPI {
|
2024-06-28 07:49:39 +02:00
|
|
|
/**
|
|
|
|
|
* Receives Signal Messages from the Signal Network. If you are running the docker container in normal/native mode, this is a GET endpoint. In json-rpc mode this is a websocket endpoint.
|
|
|
|
|
* Receive Signal Messages.
|
|
|
|
|
*/
|
|
|
|
|
async v1ReceiveNumberGetRaw(
|
|
|
|
|
requestParameters: V1ReceiveNumberGetRequest,
|
|
|
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
|
|
|
): Promise<runtime.ApiResponse<Array<string>>> {
|
|
|
|
|
if (requestParameters["number"] == null) {
|
|
|
|
|
throw new runtime.RequiredError(
|
|
|
|
|
"number",
|
|
|
|
|
'Required parameter "number" was null or undefined when calling v1ReceiveNumberGet().',
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const queryParameters: any = {};
|
|
|
|
|
|
|
|
|
|
if (requestParameters["timeout"] != null) {
|
|
|
|
|
queryParameters["timeout"] = requestParameters["timeout"];
|
|
|
|
|
}
|
2024-06-05 10:06:41 +02:00
|
|
|
|
2024-06-28 07:49:39 +02:00
|
|
|
if (requestParameters["ignoreAttachments"] != null) {
|
|
|
|
|
queryParameters["ignore_attachments"] =
|
|
|
|
|
requestParameters["ignoreAttachments"];
|
2024-06-05 10:06:41 +02:00
|
|
|
}
|
|
|
|
|
|
2024-06-28 07:49:39 +02:00
|
|
|
if (requestParameters["ignoreStories"] != null) {
|
|
|
|
|
queryParameters["ignore_stories"] = requestParameters["ignoreStories"];
|
2024-06-05 10:06:41 +02:00
|
|
|
}
|
|
|
|
|
|
2024-06-28 07:49:39 +02:00
|
|
|
if (requestParameters["maxMessages"] != null) {
|
|
|
|
|
queryParameters["max_messages"] = requestParameters["maxMessages"];
|
2024-06-05 10:06:41 +02:00
|
|
|
}
|
|
|
|
|
|
2024-06-28 07:49:39 +02:00
|
|
|
if (requestParameters["sendReadReceipts"] != null) {
|
|
|
|
|
queryParameters["send_read_receipts"] =
|
|
|
|
|
requestParameters["sendReadReceipts"];
|
2024-06-05 10:06:41 +02:00
|
|
|
}
|
|
|
|
|
|
2024-06-28 07:49:39 +02:00
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
|
|
|
|
|
|
const response = await this.request(
|
|
|
|
|
{
|
|
|
|
|
path: `/v1/receive/{number}`.replace(
|
|
|
|
|
`{${"number"}}`,
|
|
|
|
|
encodeURIComponent(String(requestParameters["number"])),
|
|
|
|
|
),
|
|
|
|
|
method: "GET",
|
|
|
|
|
headers: headerParameters,
|
|
|
|
|
query: queryParameters,
|
|
|
|
|
},
|
|
|
|
|
initOverrides,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return new runtime.JSONApiResponse<any>(response);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Receives Signal Messages from the Signal Network. If you are running the docker container in normal/native mode, this is a GET endpoint. In json-rpc mode this is a websocket endpoint.
|
|
|
|
|
* Receive Signal Messages.
|
|
|
|
|
*/
|
|
|
|
|
async v1ReceiveNumberGet(
|
|
|
|
|
requestParameters: V1ReceiveNumberGetRequest,
|
|
|
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
|
|
|
): Promise<Array<string>> {
|
|
|
|
|
const response = await this.v1ReceiveNumberGetRaw(
|
|
|
|
|
requestParameters,
|
|
|
|
|
initOverrides,
|
|
|
|
|
);
|
|
|
|
|
return await response.value();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Send a signal message
|
|
|
|
|
* Send a signal message.
|
|
|
|
|
* @deprecated
|
|
|
|
|
*/
|
|
|
|
|
async v1SendPostRaw(
|
|
|
|
|
requestParameters: V1SendPostRequest,
|
|
|
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
|
|
|
): Promise<runtime.ApiResponse<string>> {
|
|
|
|
|
if (requestParameters["data"] == null) {
|
|
|
|
|
throw new runtime.RequiredError(
|
|
|
|
|
"data",
|
|
|
|
|
'Required parameter "data" was null or undefined when calling v1SendPost().',
|
|
|
|
|
);
|
2024-06-05 10:06:41 +02:00
|
|
|
}
|
|
|
|
|
|
2024-06-28 07:49:39 +02:00
|
|
|
const queryParameters: any = {};
|
|
|
|
|
|
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
|
|
|
|
|
|
headerParameters["Content-Type"] = "application/json";
|
|
|
|
|
|
|
|
|
|
const response = await this.request(
|
|
|
|
|
{
|
|
|
|
|
path: `/v1/send`,
|
|
|
|
|
method: "POST",
|
|
|
|
|
headers: headerParameters,
|
|
|
|
|
query: queryParameters,
|
|
|
|
|
body: ApiSendMessageV1ToJSON(requestParameters["data"]),
|
|
|
|
|
},
|
|
|
|
|
initOverrides,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (this.isJsonMime(response.headers.get("content-type"))) {
|
|
|
|
|
return new runtime.JSONApiResponse<string>(response);
|
|
|
|
|
} else {
|
|
|
|
|
return new runtime.TextApiResponse(response) as any;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Send a signal message
|
|
|
|
|
* Send a signal message.
|
|
|
|
|
* @deprecated
|
|
|
|
|
*/
|
|
|
|
|
async v1SendPost(
|
|
|
|
|
requestParameters: V1SendPostRequest,
|
|
|
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
|
|
|
): Promise<string> {
|
|
|
|
|
const response = await this.v1SendPostRaw(requestParameters, initOverrides);
|
|
|
|
|
return await response.value();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Hide Typing Indicator.
|
|
|
|
|
* Hide Typing Indicator.
|
|
|
|
|
*/
|
|
|
|
|
async v1TypingIndicatorNumberDeleteRaw(
|
|
|
|
|
requestParameters: V1TypingIndicatorNumberDeleteRequest,
|
|
|
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
|
|
|
): Promise<runtime.ApiResponse<string>> {
|
|
|
|
|
if (requestParameters["number"] == null) {
|
|
|
|
|
throw new runtime.RequiredError(
|
|
|
|
|
"number",
|
|
|
|
|
'Required parameter "number" was null or undefined when calling v1TypingIndicatorNumberDelete().',
|
|
|
|
|
);
|
2024-06-05 10:06:41 +02:00
|
|
|
}
|
|
|
|
|
|
2024-06-28 07:49:39 +02:00
|
|
|
if (requestParameters["data"] == null) {
|
|
|
|
|
throw new runtime.RequiredError(
|
|
|
|
|
"data",
|
|
|
|
|
'Required parameter "data" was null or undefined when calling v1TypingIndicatorNumberDelete().',
|
|
|
|
|
);
|
2024-06-05 10:06:41 +02:00
|
|
|
}
|
|
|
|
|
|
2024-06-28 07:49:39 +02:00
|
|
|
const queryParameters: any = {};
|
|
|
|
|
|
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
|
|
|
|
|
|
headerParameters["Content-Type"] = "application/json";
|
|
|
|
|
|
|
|
|
|
const response = await this.request(
|
|
|
|
|
{
|
|
|
|
|
path: `/v1/typing-indicator/{number}`.replace(
|
|
|
|
|
`{${"number"}}`,
|
|
|
|
|
encodeURIComponent(String(requestParameters["number"])),
|
|
|
|
|
),
|
|
|
|
|
method: "DELETE",
|
|
|
|
|
headers: headerParameters,
|
|
|
|
|
query: queryParameters,
|
|
|
|
|
body: ApiTypingIndicatorRequestToJSON(requestParameters["data"]),
|
|
|
|
|
},
|
|
|
|
|
initOverrides,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (this.isJsonMime(response.headers.get("content-type"))) {
|
|
|
|
|
return new runtime.JSONApiResponse<string>(response);
|
|
|
|
|
} else {
|
|
|
|
|
return new runtime.TextApiResponse(response) as any;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Hide Typing Indicator.
|
|
|
|
|
* Hide Typing Indicator.
|
|
|
|
|
*/
|
|
|
|
|
async v1TypingIndicatorNumberDelete(
|
|
|
|
|
requestParameters: V1TypingIndicatorNumberDeleteRequest,
|
|
|
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
|
|
|
): Promise<string> {
|
|
|
|
|
const response = await this.v1TypingIndicatorNumberDeleteRaw(
|
|
|
|
|
requestParameters,
|
|
|
|
|
initOverrides,
|
|
|
|
|
);
|
|
|
|
|
return await response.value();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Show Typing Indicator.
|
|
|
|
|
* Show Typing Indicator.
|
|
|
|
|
*/
|
|
|
|
|
async v1TypingIndicatorNumberPutRaw(
|
|
|
|
|
requestParameters: V1TypingIndicatorNumberPutRequest,
|
|
|
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
|
|
|
): Promise<runtime.ApiResponse<string>> {
|
|
|
|
|
if (requestParameters["number"] == null) {
|
|
|
|
|
throw new runtime.RequiredError(
|
|
|
|
|
"number",
|
|
|
|
|
'Required parameter "number" was null or undefined when calling v1TypingIndicatorNumberPut().',
|
|
|
|
|
);
|
2024-06-05 10:06:41 +02:00
|
|
|
}
|
|
|
|
|
|
2024-06-28 07:49:39 +02:00
|
|
|
if (requestParameters["data"] == null) {
|
|
|
|
|
throw new runtime.RequiredError(
|
|
|
|
|
"data",
|
|
|
|
|
'Required parameter "data" was null or undefined when calling v1TypingIndicatorNumberPut().',
|
|
|
|
|
);
|
2024-06-05 10:06:41 +02:00
|
|
|
}
|
|
|
|
|
|
2024-06-28 07:49:39 +02:00
|
|
|
const queryParameters: any = {};
|
|
|
|
|
|
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
|
|
|
|
|
|
headerParameters["Content-Type"] = "application/json";
|
|
|
|
|
|
|
|
|
|
const response = await this.request(
|
|
|
|
|
{
|
|
|
|
|
path: `/v1/typing-indicator/{number}`.replace(
|
|
|
|
|
`{${"number"}}`,
|
|
|
|
|
encodeURIComponent(String(requestParameters["number"])),
|
|
|
|
|
),
|
|
|
|
|
method: "PUT",
|
|
|
|
|
headers: headerParameters,
|
|
|
|
|
query: queryParameters,
|
|
|
|
|
body: ApiTypingIndicatorRequestToJSON(requestParameters["data"]),
|
|
|
|
|
},
|
|
|
|
|
initOverrides,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (this.isJsonMime(response.headers.get("content-type"))) {
|
|
|
|
|
return new runtime.JSONApiResponse<string>(response);
|
|
|
|
|
} else {
|
|
|
|
|
return new runtime.TextApiResponse(response) as any;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Show Typing Indicator.
|
|
|
|
|
* Show Typing Indicator.
|
|
|
|
|
*/
|
|
|
|
|
async v1TypingIndicatorNumberPut(
|
|
|
|
|
requestParameters: V1TypingIndicatorNumberPutRequest,
|
|
|
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
|
|
|
): Promise<string> {
|
|
|
|
|
const response = await this.v1TypingIndicatorNumberPutRaw(
|
|
|
|
|
requestParameters,
|
|
|
|
|
initOverrides,
|
|
|
|
|
);
|
|
|
|
|
return await response.value();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Send a signal message. Set the text_mode to \'styled\' in case you want to add formatting to your text message. Styling Options: *italic text*, **bold text**, ~strikethrough text~.
|
|
|
|
|
* Send a signal message.
|
|
|
|
|
*/
|
|
|
|
|
async v2SendPostRaw(
|
|
|
|
|
requestParameters: V2SendPostRequest,
|
|
|
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
|
|
|
): Promise<runtime.ApiResponse<ApiSendMessageResponse>> {
|
|
|
|
|
if (requestParameters["data"] == null) {
|
|
|
|
|
throw new runtime.RequiredError(
|
|
|
|
|
"data",
|
|
|
|
|
'Required parameter "data" was null or undefined when calling v2SendPost().',
|
|
|
|
|
);
|
2024-06-05 10:06:41 +02:00
|
|
|
}
|
|
|
|
|
|
2024-06-28 07:49:39 +02:00
|
|
|
const queryParameters: any = {};
|
|
|
|
|
|
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
|
|
|
|
|
|
headerParameters["Content-Type"] = "application/json";
|
|
|
|
|
|
|
|
|
|
const response = await this.request(
|
|
|
|
|
{
|
|
|
|
|
path: `/v2/send`,
|
|
|
|
|
method: "POST",
|
|
|
|
|
headers: headerParameters,
|
|
|
|
|
query: queryParameters,
|
|
|
|
|
body: ApiSendMessageV2ToJSON(requestParameters["data"]),
|
|
|
|
|
},
|
|
|
|
|
initOverrides,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
|
|
|
|
ApiSendMessageResponseFromJSON(jsonValue),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Send a signal message. Set the text_mode to \'styled\' in case you want to add formatting to your text message. Styling Options: *italic text*, **bold text**, ~strikethrough text~.
|
|
|
|
|
* Send a signal message.
|
|
|
|
|
*/
|
|
|
|
|
async v2SendPost(
|
|
|
|
|
requestParameters: V2SendPostRequest,
|
|
|
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
|
|
|
): Promise<ApiSendMessageResponse> {
|
|
|
|
|
const response = await this.v2SendPostRaw(requestParameters, initOverrides);
|
|
|
|
|
return await response.value();
|
|
|
|
|
}
|
2024-06-05 10:06:41 +02:00
|
|
|
}
|