feat(v2): complete v2 reimplementation
This commit is contained in:
@@ -0,0 +1,567 @@
|
||||
/* eslint-disable */
|
||||
/*
|
||||
* Generated by tools/generate_api_client.py from openapi/v2.json.
|
||||
* Do not edit this file directly. Run `npm --prefix frontend run api:generate`.
|
||||
*/
|
||||
|
||||
export interface Components {
|
||||
schemas: {
|
||||
AuditList: { items : Array<Components['schemas']["AuditSummary"]>; next_cursor : string | null };
|
||||
AuditSummary: { action : string; created_at : string; details : Record<string, unknown>; id : string; outcome : string; request_id : string; resource_id : string | null; resource_type : string };
|
||||
AuthenticatedUser: { id : string; username : string };
|
||||
BackupDeletePreview: { backup_id : string; destructive_action : string; eligible : boolean; reason : string | null };
|
||||
BackupList: { items : Array<Components['schemas']["BackupSummary"]> };
|
||||
BackupSummary: { created_at : string; execution_id : string; id : string; integrity : string; logical_bytes : number; manifest_id : string; pinned : boolean; stored_bytes : number; tombstoned_at : string | null };
|
||||
EmailSettingsInput: { host : string; max_attempts?: number; password : string; port?: number; rate_limit_per_minute?: number; sender : string; username : string };
|
||||
ExecutionList: { items : Array<Components['schemas']["ExecutionSummary"]> };
|
||||
ExecutionSummary: { attempt : number; id : string; progress : Record<string, unknown>; reason_code : string | null; revision : number; state : string };
|
||||
HTTPValidationError: { detail?: Array<Components['schemas']["ValidationError"]> };
|
||||
JobInput: { allow_empty?: boolean; enabled?: boolean; exclusions?: Array<string>; name : string; repository_id : string; requested_mode?: string; retention?: Record<string, unknown>; source_id : string };
|
||||
JobList: { items : Array<Components['schemas']["JobSummary"]> };
|
||||
JobSummary: { enabled : boolean; id : string; name : string; repository_id : string; requested_mode : string; schedule : Components['schemas']["ScheduleSummary"] | null; source_id : string; state : string };
|
||||
LocalSourceInput: { kind : string; name : string; public_config : Record<string, unknown> };
|
||||
LoginInput: { password : string; username : string };
|
||||
NotificationAttemptList: { items : Array<Components['schemas']["NotificationAttemptSummary"]> };
|
||||
NotificationAttemptSummary: { completed_at : string | null; diagnostic : string | null; number : number; outcome : string; response_class : string | null; started_at : string };
|
||||
NotificationDeliveryList: { items : Array<Components['schemas']["NotificationDeliverySummary"]> };
|
||||
NotificationDeliverySummary: { attempt_count : number; due_at : string; event_id : string; id : string; response_class : string | null; response_summary : string | null; state : string; subscription_id : string; terminal_reason : string | null };
|
||||
NotificationSubscriptionInput: { channel : "webhook" | "email"; destination : Record<string, unknown>; event_filters : Array<string>; rate_limit_per_minute?: number; signing_secret?: string | null };
|
||||
NotificationSubscriptionList: { items : Array<Components['schemas']["NotificationSubscriptionSummary"]> };
|
||||
NotificationSubscriptionPatch: { destination?: Record<string, unknown> | null; event_filters?: Array<string> | null; rate_limit_per_minute?: number | null; state?: "active" | "disabled" | "archived" | null };
|
||||
NotificationSubscriptionSummary: { channel : string; created_at : string; destination : Record<string, unknown>; event_filters : Array<string>; id : string; rate_limit_per_minute : number; revision : number; state : string; updated_at : string };
|
||||
RecoveryStatus: { encrypted_repository_count : number; recovery_mode : string; runbook : string };
|
||||
RepositoryInput: { compression?: string; encryption?: string; name : string; relative_path : string };
|
||||
RepositoryList: { items : Array<Components['schemas']["RepositorySummary"]> };
|
||||
RepositoryPatch: { compression?: string | null; encryption?: string | null };
|
||||
RepositorySummary: { compression : string; encryption : string; format_version : number; id : string; name : string; state : string };
|
||||
RestoreInput: { destination : string; dry_run?: boolean; overwrite_policy?: string; selection?: Array<string> };
|
||||
SSHSourceInput: { kind : string; name : string; private_key_secret_id : string; public_config : Components['schemas']["SSHSourcePublicConfig"] };
|
||||
SSHSourcePublicConfig: { host_key : string; hostname : string; port : number; root : string; username : string };
|
||||
ScheduleInput: { cron : string; enabled?: boolean; misfire_grace_seconds?: number; timezone : string };
|
||||
ScheduleSummary: { cron : string; enabled : boolean; id : string; last_enqueue_outcome : string | null; next_nominal_at : string | null; timezone : string };
|
||||
SecretInput: { purpose : string; value : string };
|
||||
SessionUser: { id : string; state : string; username : string };
|
||||
SetupInput: { bootstrap_secret?: string | null; password : string; username : string };
|
||||
SigningKeyRotateInput: { overlap_seconds?: number; secret : string };
|
||||
SourceList: { items : Array<Components['schemas']["SourceSummary"]> };
|
||||
SourceSummary: { id : string; kind : string; name : string; public_config : Record<string, unknown>; state : string };
|
||||
TokenInput: { expires_at?: string | null; scopes : Array<string> };
|
||||
UserPatch: { state : string };
|
||||
ValidationError: { ctx?: Record<string, unknown>; input?: unknown; loc : Array<string | number>; msg : string; type : string };
|
||||
};
|
||||
}
|
||||
export type CreateSecretParams = { body : Components['schemas']["SecretInput"] };
|
||||
|
||||
export type GetUserParams = { path: { user_id: string } };
|
||||
|
||||
export type PatchUserParams = { path: { user_id: string }; body : Components['schemas']["UserPatch"] };
|
||||
|
||||
export type ListAuditParams = { query?: { limit?: number; cursor?: string | null } };
|
||||
|
||||
export type LoginParams = { body : Components['schemas']["LoginInput"] };
|
||||
|
||||
export type CreateTokenParams = { body : Components['schemas']["TokenInput"] };
|
||||
|
||||
export type RevokeTokenParams = { path: { token_id: string } };
|
||||
|
||||
export type GetBackupParams = { path: { backup_id: string } };
|
||||
|
||||
export type BackupDeletePreviewParams = { path: { backup_id: string } };
|
||||
|
||||
export type CreateRestoreParams = { path: { backup_id: string }; body : Components['schemas']["RestoreInput"] };
|
||||
|
||||
export type VerifyBackupParams = { path: { backup_id: string } };
|
||||
|
||||
export type GetExecutionParams = { path: { execution_id: string } };
|
||||
|
||||
export type CancelExecutionParams = { path: { execution_id: string } };
|
||||
|
||||
export type ExecutionEventsParams = { path: { execution_id: string } };
|
||||
|
||||
export type RetryExecutionParams = { path: { execution_id: string } };
|
||||
|
||||
export type CreateJobParams = { body : Components['schemas']["JobInput"] };
|
||||
|
||||
export type EnqueueExecutionParams = { path: { job_id: string } };
|
||||
|
||||
export type DeleteScheduleParams = { path: { job_id: string } };
|
||||
|
||||
export type GetScheduleParams = { path: { job_id: string } };
|
||||
|
||||
export type PatchScheduleParams = { path: { job_id: string }; body : Components['schemas']["ScheduleInput"] };
|
||||
|
||||
export type CreateScheduleParams = { path: { job_id: string }; body : Components['schemas']["ScheduleInput"] };
|
||||
|
||||
export type ListNotificationDeliveriesParams = { query?: { limit?: number } };
|
||||
|
||||
export type ListNotificationAttemptsParams = { path: { delivery_id: string } };
|
||||
|
||||
export type RetryNotificationDeliveryParams = { path: { delivery_id: string } };
|
||||
|
||||
export type PutNotificationEmailSettingsParams = { body : Components['schemas']["EmailSettingsInput"] };
|
||||
|
||||
export type CreateNotificationSubscriptionParams = { body : Components['schemas']["NotificationSubscriptionInput"] };
|
||||
|
||||
export type GetNotificationSubscriptionParams = { path: { subscription_id: string } };
|
||||
|
||||
export type PatchNotificationSubscriptionParams = { path: { subscription_id: string }; body : Components['schemas']["NotificationSubscriptionPatch"] };
|
||||
|
||||
export type RotateNotificationSigningKeyParams = { path: { subscription_id: string }; body : Components['schemas']["SigningKeyRotateInput"] };
|
||||
|
||||
export type TestNotificationSubscriptionParams = { path: { subscription_id: string } };
|
||||
|
||||
export type CreateRepositoryParams = { body : Components['schemas']["RepositoryInput"] };
|
||||
|
||||
export type GetRepositoryParams = { path: { repository_id: string } };
|
||||
|
||||
export type PatchRepositoryParams = { path: { repository_id: string }; body : Components['schemas']["RepositoryPatch"] };
|
||||
|
||||
export type InspectRepositoryEndpointParams = { path: { repository_id: string } };
|
||||
|
||||
export type GetRestoreParams = { path: { restore_id: string } };
|
||||
|
||||
export type SetupParams = { body : Components['schemas']["SetupInput"] };
|
||||
|
||||
export type CreateSourceParams = { body : Components['schemas']["LocalSourceInput"] | Components['schemas']["SSHSourceInput"] };
|
||||
|
||||
export type ArchiveSourceParams = { path: { source_id: string } };
|
||||
|
||||
export type ProbeSourceParams = { path: { source_id: string } };
|
||||
|
||||
export type RequestOptions = Omit<RequestInit, "body">;
|
||||
|
||||
export type Problem = {
|
||||
type: string;
|
||||
title: string;
|
||||
status: number;
|
||||
detail: string;
|
||||
instance: string;
|
||||
code: string;
|
||||
};
|
||||
|
||||
export class ApiError extends Error {
|
||||
readonly status: number;
|
||||
readonly problem?: Problem;
|
||||
|
||||
constructor(status: number, problem?: Problem) {
|
||||
super(problem?.detail ?? `Request failed with status ${status}.`);
|
||||
this.name = "ApiError";
|
||||
this.status = status;
|
||||
this.problem = problem;
|
||||
}
|
||||
}
|
||||
|
||||
export function isApiError(error: unknown): error is ApiError {
|
||||
return error instanceof ApiError;
|
||||
}
|
||||
|
||||
function appendQuery(search: URLSearchParams, query: Record<string, unknown> | undefined): void {
|
||||
if (!query) return;
|
||||
for (const [key, value] of Object.entries(query)) {
|
||||
if (value === undefined || value === null) continue;
|
||||
for (const item of Array.isArray(value) ? value : [value]) search.append(key, String(item));
|
||||
}
|
||||
}
|
||||
|
||||
async function request<T>(
|
||||
url: URL,
|
||||
method: string,
|
||||
options: RequestOptions,
|
||||
body?: unknown,
|
||||
): Promise<T> {
|
||||
const headers = new Headers(options.headers);
|
||||
if (body !== undefined && !headers.has("Content-Type")) {
|
||||
headers.set("Content-Type", "application/json");
|
||||
}
|
||||
const response = await fetch(url, {
|
||||
...options,
|
||||
method,
|
||||
headers,
|
||||
credentials: options.credentials ?? "same-origin",
|
||||
body: body === undefined ? undefined : JSON.stringify(body),
|
||||
});
|
||||
if (response.status === 204) return undefined as T;
|
||||
const contentType = response.headers.get("content-type") ?? "";
|
||||
const isJson = contentType.includes("application/json")
|
||||
|| contentType.includes("application/problem+json");
|
||||
const payload: unknown = isJson ? await response.json() : undefined;
|
||||
if (!response.ok) throw new ApiError(response.status, payload as Problem | undefined);
|
||||
return payload as T;
|
||||
}
|
||||
|
||||
export class BackupToolClient {
|
||||
constructor(readonly baseUrl = window.location.origin) {}
|
||||
|
||||
async listSecrets(options: RequestOptions = {}): Promise<Array<Record<string, unknown>>> {
|
||||
const url = new URL("/api/v2/admin/secrets", this.baseUrl);
|
||||
return request<Array<Record<string, unknown>>>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async createSecret(params: CreateSecretParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/admin/secrets", this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "POST", options, params.body
|
||||
);
|
||||
}
|
||||
|
||||
async getUser(params: GetUserParams, options: RequestOptions = {}): Promise<Record<string, string>> {
|
||||
const url = new URL("/api/v2/admin/users/{user_id}".replace("{user_id}", encodeURIComponent(String(params.path.user_id))), this.baseUrl);
|
||||
return request<Record<string, string>>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async patchUser(params: PatchUserParams, options: RequestOptions = {}): Promise<Record<string, string>> {
|
||||
const url = new URL("/api/v2/admin/users/{user_id}".replace("{user_id}", encodeURIComponent(String(params.path.user_id))), this.baseUrl);
|
||||
return request<Record<string, string>>(
|
||||
url, "PATCH", options, params.body
|
||||
);
|
||||
}
|
||||
|
||||
async listAudit(params: ListAuditParams, options: RequestOptions = {}): Promise<Components['schemas']["AuditList"]> {
|
||||
const url = new URL("/api/v2/audit", this.baseUrl);
|
||||
appendQuery(url.searchParams, params.query);
|
||||
return request<Components['schemas']["AuditList"]>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async login(params: LoginParams, options: RequestOptions = {}): Promise<Components['schemas']["AuthenticatedUser"]> {
|
||||
const url = new URL("/api/v2/auth/login", this.baseUrl);
|
||||
return request<Components['schemas']["AuthenticatedUser"]>(
|
||||
url, "POST", options, params.body
|
||||
);
|
||||
}
|
||||
|
||||
async logout(options: RequestOptions = {}): Promise<void> {
|
||||
const url = new URL("/api/v2/auth/logout", this.baseUrl);
|
||||
return request<void>(
|
||||
url, "POST", options
|
||||
);
|
||||
}
|
||||
|
||||
async getSession(options: RequestOptions = {}): Promise<Components['schemas']["SessionUser"]> {
|
||||
const url = new URL("/api/v2/auth/session", this.baseUrl);
|
||||
return request<Components['schemas']["SessionUser"]>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async createToken(params: CreateTokenParams, options: RequestOptions = {}): Promise<unknown> {
|
||||
const url = new URL("/api/v2/auth/tokens", this.baseUrl);
|
||||
return request<unknown>(
|
||||
url, "POST", options, params.body
|
||||
);
|
||||
}
|
||||
|
||||
async revokeToken(params: RevokeTokenParams, options: RequestOptions = {}): Promise<void> {
|
||||
const url = new URL("/api/v2/auth/tokens/{token_id}".replace("{token_id}", encodeURIComponent(String(params.path.token_id))), this.baseUrl);
|
||||
return request<void>(
|
||||
url, "DELETE", options
|
||||
);
|
||||
}
|
||||
|
||||
async listBackups(options: RequestOptions = {}): Promise<Components['schemas']["BackupList"]> {
|
||||
const url = new URL("/api/v2/backups", this.baseUrl);
|
||||
return request<Components['schemas']["BackupList"]>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async getBackup(params: GetBackupParams, options: RequestOptions = {}): Promise<Components['schemas']["BackupSummary"]> {
|
||||
const url = new URL("/api/v2/backups/{backup_id}".replace("{backup_id}", encodeURIComponent(String(params.path.backup_id))), this.baseUrl);
|
||||
return request<Components['schemas']["BackupSummary"]>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async backupDeletePreview(params: BackupDeletePreviewParams, options: RequestOptions = {}): Promise<Components['schemas']["BackupDeletePreview"]> {
|
||||
const url = new URL("/api/v2/backups/{backup_id}/delete-preview".replace("{backup_id}", encodeURIComponent(String(params.path.backup_id))), this.baseUrl);
|
||||
return request<Components['schemas']["BackupDeletePreview"]>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async createRestore(params: CreateRestoreParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/backups/{backup_id}/restores".replace("{backup_id}", encodeURIComponent(String(params.path.backup_id))), this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "POST", options, params.body
|
||||
);
|
||||
}
|
||||
|
||||
async verifyBackup(params: VerifyBackupParams, options: RequestOptions = {}): Promise<Components['schemas']["BackupSummary"]> {
|
||||
const url = new URL("/api/v2/backups/{backup_id}/verify".replace("{backup_id}", encodeURIComponent(String(params.path.backup_id))), this.baseUrl);
|
||||
return request<Components['schemas']["BackupSummary"]>(
|
||||
url, "POST", options
|
||||
);
|
||||
}
|
||||
|
||||
async listExecutions(options: RequestOptions = {}): Promise<Components['schemas']["ExecutionList"]> {
|
||||
const url = new URL("/api/v2/executions", this.baseUrl);
|
||||
return request<Components['schemas']["ExecutionList"]>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async getExecution(params: GetExecutionParams, options: RequestOptions = {}): Promise<Components['schemas']["ExecutionSummary"]> {
|
||||
const url = new URL("/api/v2/executions/{execution_id}".replace("{execution_id}", encodeURIComponent(String(params.path.execution_id))), this.baseUrl);
|
||||
return request<Components['schemas']["ExecutionSummary"]>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async cancelExecution(params: CancelExecutionParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/executions/{execution_id}/cancel".replace("{execution_id}", encodeURIComponent(String(params.path.execution_id))), this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "POST", options
|
||||
);
|
||||
}
|
||||
|
||||
/** EventSource transport; intentionally not a JSON fetch Promise. */
|
||||
executionEventsUrl(params: ExecutionEventsParams): URL {
|
||||
const url = new URL("/api/v2/executions/{execution_id}/events".replace("{execution_id}", encodeURIComponent(String(params.path.execution_id))), this.baseUrl);
|
||||
return url;
|
||||
}
|
||||
|
||||
async retryExecution(params: RetryExecutionParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/executions/{execution_id}/retry".replace("{execution_id}", encodeURIComponent(String(params.path.execution_id))), this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "POST", options
|
||||
);
|
||||
}
|
||||
|
||||
async listJobs(options: RequestOptions = {}): Promise<Components['schemas']["JobList"]> {
|
||||
const url = new URL("/api/v2/jobs", this.baseUrl);
|
||||
return request<Components['schemas']["JobList"]>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async createJob(params: CreateJobParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/jobs", this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "POST", options, params.body
|
||||
);
|
||||
}
|
||||
|
||||
async enqueueExecution(params: EnqueueExecutionParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/jobs/{job_id}/executions".replace("{job_id}", encodeURIComponent(String(params.path.job_id))), this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "POST", options
|
||||
);
|
||||
}
|
||||
|
||||
async deleteSchedule(params: DeleteScheduleParams, options: RequestOptions = {}): Promise<void> {
|
||||
const url = new URL("/api/v2/jobs/{job_id}/schedule".replace("{job_id}", encodeURIComponent(String(params.path.job_id))), this.baseUrl);
|
||||
return request<void>(
|
||||
url, "DELETE", options
|
||||
);
|
||||
}
|
||||
|
||||
async getSchedule(params: GetScheduleParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/jobs/{job_id}/schedule".replace("{job_id}", encodeURIComponent(String(params.path.job_id))), this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async patchSchedule(params: PatchScheduleParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/jobs/{job_id}/schedule".replace("{job_id}", encodeURIComponent(String(params.path.job_id))), this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "PATCH", options, params.body
|
||||
);
|
||||
}
|
||||
|
||||
async createSchedule(params: CreateScheduleParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/jobs/{job_id}/schedule".replace("{job_id}", encodeURIComponent(String(params.path.job_id))), this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "POST", options, params.body
|
||||
);
|
||||
}
|
||||
|
||||
async listNotificationDeliveries(params: ListNotificationDeliveriesParams, options: RequestOptions = {}): Promise<Components['schemas']["NotificationDeliveryList"]> {
|
||||
const url = new URL("/api/v2/notifications/deliveries", this.baseUrl);
|
||||
appendQuery(url.searchParams, params.query);
|
||||
return request<Components['schemas']["NotificationDeliveryList"]>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async listNotificationAttempts(params: ListNotificationAttemptsParams, options: RequestOptions = {}): Promise<Components['schemas']["NotificationAttemptList"]> {
|
||||
const url = new URL("/api/v2/notifications/deliveries/{delivery_id}/attempts".replace("{delivery_id}", encodeURIComponent(String(params.path.delivery_id))), this.baseUrl);
|
||||
return request<Components['schemas']["NotificationAttemptList"]>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async retryNotificationDelivery(params: RetryNotificationDeliveryParams, options: RequestOptions = {}): Promise<Record<string, string>> {
|
||||
const url = new URL("/api/v2/notifications/deliveries/{delivery_id}/retry".replace("{delivery_id}", encodeURIComponent(String(params.path.delivery_id))), this.baseUrl);
|
||||
return request<Record<string, string>>(
|
||||
url, "POST", options
|
||||
);
|
||||
}
|
||||
|
||||
async getNotificationEmailSettings(options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/notifications/email-settings", this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async putNotificationEmailSettings(params: PutNotificationEmailSettingsParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/notifications/email-settings", this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "PUT", options, params.body
|
||||
);
|
||||
}
|
||||
|
||||
async notificationCatalog(options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/notifications/event-catalog", this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async listNotificationSubscriptions(options: RequestOptions = {}): Promise<Components['schemas']["NotificationSubscriptionList"]> {
|
||||
const url = new URL("/api/v2/notifications/subscriptions", this.baseUrl);
|
||||
return request<Components['schemas']["NotificationSubscriptionList"]>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async createNotificationSubscription(params: CreateNotificationSubscriptionParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/notifications/subscriptions", this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "POST", options, params.body
|
||||
);
|
||||
}
|
||||
|
||||
async getNotificationSubscription(params: GetNotificationSubscriptionParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/notifications/subscriptions/{subscription_id}".replace("{subscription_id}", encodeURIComponent(String(params.path.subscription_id))), this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async patchNotificationSubscription(params: PatchNotificationSubscriptionParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/notifications/subscriptions/{subscription_id}".replace("{subscription_id}", encodeURIComponent(String(params.path.subscription_id))), this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "PATCH", options, params.body
|
||||
);
|
||||
}
|
||||
|
||||
async rotateNotificationSigningKey(params: RotateNotificationSigningKeyParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/notifications/subscriptions/{subscription_id}/signing-keys/rotate".replace("{subscription_id}", encodeURIComponent(String(params.path.subscription_id))), this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "POST", options, params.body
|
||||
);
|
||||
}
|
||||
|
||||
async testNotificationSubscription(params: TestNotificationSubscriptionParams, options: RequestOptions = {}): Promise<Record<string, string>> {
|
||||
const url = new URL("/api/v2/notifications/subscriptions/{subscription_id}/test".replace("{subscription_id}", encodeURIComponent(String(params.path.subscription_id))), this.baseUrl);
|
||||
return request<Record<string, string>>(
|
||||
url, "POST", options
|
||||
);
|
||||
}
|
||||
|
||||
async listRepositories(options: RequestOptions = {}): Promise<Components['schemas']["RepositoryList"]> {
|
||||
const url = new URL("/api/v2/repositories", this.baseUrl);
|
||||
return request<Components['schemas']["RepositoryList"]>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async createRepository(params: CreateRepositoryParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/repositories", this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "POST", options, params.body
|
||||
);
|
||||
}
|
||||
|
||||
async getRepository(params: GetRepositoryParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/repositories/{repository_id}".replace("{repository_id}", encodeURIComponent(String(params.path.repository_id))), this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async patchRepository(params: PatchRepositoryParams, options: RequestOptions = {}): Promise<unknown> {
|
||||
const url = new URL("/api/v2/repositories/{repository_id}".replace("{repository_id}", encodeURIComponent(String(params.path.repository_id))), this.baseUrl);
|
||||
return request<unknown>(
|
||||
url, "PATCH", options, params.body
|
||||
);
|
||||
}
|
||||
|
||||
async inspectRepositoryEndpoint(params: InspectRepositoryEndpointParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/repositories/{repository_id}/inspection".replace("{repository_id}", encodeURIComponent(String(params.path.repository_id))), this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async getRestore(params: GetRestoreParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/restores/{restore_id}".replace("{restore_id}", encodeURIComponent(String(params.path.restore_id))), this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async recoveryStatus(options: RequestOptions = {}): Promise<Components['schemas']["RecoveryStatus"]> {
|
||||
const url = new URL("/api/v2/security/recovery/status", this.baseUrl);
|
||||
return request<Components['schemas']["RecoveryStatus"]>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async setup(params: SetupParams, options: RequestOptions = {}): Promise<Components['schemas']["AuthenticatedUser"]> {
|
||||
const url = new URL("/api/v2/setup", this.baseUrl);
|
||||
return request<Components['schemas']["AuthenticatedUser"]>(
|
||||
url, "POST", options, params.body
|
||||
);
|
||||
}
|
||||
|
||||
async listSources(options: RequestOptions = {}): Promise<Components['schemas']["SourceList"]> {
|
||||
const url = new URL("/api/v2/sources", this.baseUrl);
|
||||
return request<Components['schemas']["SourceList"]>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async createSource(params: CreateSourceParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/sources", this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "POST", options, params.body
|
||||
);
|
||||
}
|
||||
|
||||
async archiveSource(params: ArchiveSourceParams, options: RequestOptions = {}): Promise<void> {
|
||||
const url = new URL("/api/v2/sources/{source_id}".replace("{source_id}", encodeURIComponent(String(params.path.source_id))), this.baseUrl);
|
||||
return request<void>(
|
||||
url, "DELETE", options
|
||||
);
|
||||
}
|
||||
|
||||
async probeSource(params: ProbeSourceParams, options: RequestOptions = {}): Promise<Record<string, unknown>> {
|
||||
const url = new URL("/api/v2/sources/{source_id}/probe".replace("{source_id}", encodeURIComponent(String(params.path.source_id))), this.baseUrl);
|
||||
return request<Record<string, unknown>>(
|
||||
url, "POST", options
|
||||
);
|
||||
}
|
||||
|
||||
async livez(options: RequestOptions = {}): Promise<Record<string, string>> {
|
||||
const url = new URL("/livez", this.baseUrl);
|
||||
return request<Record<string, string>>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
async readyz(options: RequestOptions = {}): Promise<Record<string, string>> {
|
||||
const url = new URL("/readyz", this.baseUrl);
|
||||
return request<Record<string, string>>(
|
||||
url, "GET", options
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user