link-stack/packages/signal-api/apis/ContactsApi.ts

139 lines
4.3 KiB
TypeScript
Raw Permalink Normal View History

/* 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
*
*
* 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";
import type { ApiError, ApiUpdateContactRequest } from "../models/index.js";
import {
2024-06-28 07:49:39 +02:00
ApiErrorFromJSON,
ApiErrorToJSON,
ApiUpdateContactRequestFromJSON,
ApiUpdateContactRequestToJSON,
} from "../models/index.js";
export interface V1ContactsNumberPutRequest {
2024-06-28 07:49:39 +02:00
number: string;
data: ApiUpdateContactRequest;
}
export interface V1ContactsNumberSyncPostRequest {
2024-06-28 07:49:39 +02:00
number: string;
}
/**
2024-06-28 07:49:39 +02:00
*
*/
export class ContactsApi extends runtime.BaseAPI {
2024-06-28 07:49:39 +02:00
/**
* Updates the info associated to a number on the contact list.
* Updates the info associated to a number on the contact list. If the contact doesnt exist yet, it will be added.
*/
async v1ContactsNumberPutRaw(
requestParameters: V1ContactsNumberPutRequest,
initOverrides?: RequestInit | runtime.InitOverrideFunction,
): Promise<runtime.ApiResponse<void>> {
if (requestParameters["number"] == null) {
throw new runtime.RequiredError(
"number",
'Required parameter "number" was null or undefined when calling v1ContactsNumberPut().',
);
}
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 v1ContactsNumberPut().',
);
}
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/contacts/{number}`.replace(
`{${"number"}}`,
encodeURIComponent(String(requestParameters["number"])),
),
method: "PUT",
headers: headerParameters,
query: queryParameters,
body: ApiUpdateContactRequestToJSON(requestParameters["data"]),
},
initOverrides,
);
return new runtime.VoidApiResponse(response);
}
/**
* Updates the info associated to a number on the contact list.
* Updates the info associated to a number on the contact list. If the contact doesnt exist yet, it will be added.
*/
async v1ContactsNumberPut(
requestParameters: V1ContactsNumberPutRequest,
initOverrides?: RequestInit | runtime.InitOverrideFunction,
): Promise<void> {
await this.v1ContactsNumberPutRaw(requestParameters, initOverrides);
}
/**
* Send a synchronization message with the local contacts list to all linked devices. This command should only be used if this is the primary device.
* Send a synchronization message with the local contacts list to all linked devices.
*/
async v1ContactsNumberSyncPostRaw(
requestParameters: V1ContactsNumberSyncPostRequest,
initOverrides?: RequestInit | runtime.InitOverrideFunction,
): Promise<runtime.ApiResponse<void>> {
if (requestParameters["number"] == null) {
throw new runtime.RequiredError(
"number",
'Required parameter "number" was null or undefined when calling v1ContactsNumberSyncPost().',
);
}
2024-06-28 07:49:39 +02:00
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
const response = await this.request(
{
path: `/v1/contacts/{number}/sync`.replace(
`{${"number"}}`,
encodeURIComponent(String(requestParameters["number"])),
),
method: "POST",
headers: headerParameters,
query: queryParameters,
},
initOverrides,
);
return new runtime.VoidApiResponse(response);
}
/**
* Send a synchronization message with the local contacts list to all linked devices. This command should only be used if this is the primary device.
* Send a synchronization message with the local contacts list to all linked devices.
*/
async v1ContactsNumberSyncPost(
requestParameters: V1ContactsNumberSyncPostRequest,
initOverrides?: RequestInit | runtime.InitOverrideFunction,
): Promise<void> {
await this.v1ContactsNumberSyncPostRaw(requestParameters, initOverrides);
}
}