import { BaseResource } from '@gitbeaker/requester-utils'; import { RequestHelper, endpoint } from '../infrastructure'; import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; export interface PagesDomainSchema extends Record { domain: string; url: string; project_id: number; auto_ssl_enabled?: boolean; certificate?: { expired: boolean; expiration: string; certificate: string; certificate_text: string; }; } export class PagesDomains extends BaseResource { all({ projectId, ...options }: { projectId?: string | number } & Sudo & ShowExpanded = {}): Promise< GitlabAPIResponse > { const prefix = projectId ? endpoint`projects/${projectId}/` : ''; return RequestHelper.get()(this, `${prefix}pages/domains`, options); } create( projectId: string | number, domain: string, options?: { autoSslEnabled?: string; certificate?: string; key?: string } & Sudo & ShowExpanded, ): Promise> { return RequestHelper.post()( this, endpoint`projects/${projectId}/pages/domains`, { domain, ...options, }, ); } edit( projectId: string | number, domain: string, options?: { autoSslEnabled?: string; certificate?: string; key?: string } & Sudo & ShowExpanded, ): Promise> { return RequestHelper.put()( this, endpoint`projects/${projectId}/pages/domains/${domain}`, options, ); } show( projectId: string | number, domain: string, options?: { autoSslEnabled?: string; certificate?: string; key?: string } & Sudo & ShowExpanded, ): Promise> { return RequestHelper.get()( this, endpoint`projects/${projectId}/pages/domains/${domain}`, options, ); } remove( projectId: string | number, domain: string, options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.del()( this, endpoint`projects/${projectId}/pages/domains/${domain}`, options, ); } }