link-stack/packages/signal-api/apis/AttachmentsApi.ts
2024-06-28 07:49:39 +02:00

173 lines
4.7 KiB
TypeScript

/* tslint:disable */
/* eslint-disable */
/**
* Signal Cli REST API
* This is the Signal Cli REST API documentation.
*
* The version of the OpenAPI document: 1.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import * as runtime from "../runtime.js";
import type { ApiError } from "../models/index.js";
import { ApiErrorFromJSON, ApiErrorToJSON } from "../models/index.js";
export interface V1AttachmentsAttachmentDeleteRequest {
attachment: string;
}
export interface V1AttachmentsAttachmentGetRequest {
attachment: string;
}
/**
*
*/
export class AttachmentsApi extends runtime.BaseAPI {
/**
* Remove the attachment with the given id from filesystem.
* Remove attachment.
*/
async v1AttachmentsAttachmentDeleteRaw(
requestParameters: V1AttachmentsAttachmentDeleteRequest,
initOverrides?: RequestInit | runtime.InitOverrideFunction,
): Promise<runtime.ApiResponse<string>> {
if (requestParameters["attachment"] == null) {
throw new runtime.RequiredError(
"attachment",
'Required parameter "attachment" was null or undefined when calling v1AttachmentsAttachmentDelete().',
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
const response = await this.request(
{
path: `/v1/attachments/{attachment}`.replace(
`{${"attachment"}}`,
encodeURIComponent(String(requestParameters["attachment"])),
),
method: "DELETE",
headers: headerParameters,
query: queryParameters,
},
initOverrides,
);
if (this.isJsonMime(response.headers.get("content-type"))) {
return new runtime.JSONApiResponse<string>(response);
} else {
return new runtime.TextApiResponse(response) as any;
}
}
/**
* Remove the attachment with the given id from filesystem.
* Remove attachment.
*/
async v1AttachmentsAttachmentDelete(
requestParameters: V1AttachmentsAttachmentDeleteRequest,
initOverrides?: RequestInit | runtime.InitOverrideFunction,
): Promise<string> {
const response = await this.v1AttachmentsAttachmentDeleteRaw(
requestParameters,
initOverrides,
);
return await response.value();
}
/**
* Serve the attachment with the given id
* Serve Attachment.
*/
async v1AttachmentsAttachmentGetRaw(
requestParameters: V1AttachmentsAttachmentGetRequest,
initOverrides?: RequestInit | runtime.InitOverrideFunction,
): Promise<runtime.ApiResponse<string>> {
if (requestParameters["attachment"] == null) {
throw new runtime.RequiredError(
"attachment",
'Required parameter "attachment" was null or undefined when calling v1AttachmentsAttachmentGet().',
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
const response = await this.request(
{
path: `/v1/attachments/{attachment}`.replace(
`{${"attachment"}}`,
encodeURIComponent(String(requestParameters["attachment"])),
),
method: "GET",
headers: headerParameters,
query: queryParameters,
},
initOverrides,
);
if (this.isJsonMime(response.headers.get("content-type"))) {
return new runtime.JSONApiResponse<string>(response);
} else {
return new runtime.TextApiResponse(response) as any;
}
}
/**
* Serve the attachment with the given id
* Serve Attachment.
*/
async v1AttachmentsAttachmentGet(
requestParameters: V1AttachmentsAttachmentGetRequest,
initOverrides?: RequestInit | runtime.InitOverrideFunction,
): Promise<string> {
const response = await this.v1AttachmentsAttachmentGetRaw(
requestParameters,
initOverrides,
);
return await response.value();
}
/**
* List all downloaded attachments
* List all attachments.
*/
async v1AttachmentsGetRaw(
initOverrides?: RequestInit | runtime.InitOverrideFunction,
): Promise<runtime.ApiResponse<Array<string>>> {
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
const response = await this.request(
{
path: `/v1/attachments`,
method: "GET",
headers: headerParameters,
query: queryParameters,
},
initOverrides,
);
return new runtime.JSONApiResponse<any>(response);
}
/**
* List all downloaded attachments
* List all attachments.
*/
async v1AttachmentsGet(
initOverrides?: RequestInit | runtime.InitOverrideFunction,
): Promise<Array<string>> {
const response = await this.v1AttachmentsGetRaw(initOverrides);
return await response.value();
}
}