Skip to content

Commit

Permalink
Add AdminServiceConstructor
Browse files Browse the repository at this point in the history
  • Loading branch information
amvanbaren committed Oct 9, 2024
1 parent 6d2b61d commit 94189ad
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions webui/src/extension-registry-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export class ExtensionRegistryService {

readonly admin: AdminService;

constructor(readonly serverUrl: string = '', admin?: AdminService) {
this.admin = admin ?? new AdminService(this);
constructor(readonly serverUrl: string = '', AdminConstructor: AdminServiceConstructor = AdminServiceImpl) {
this.admin = new AdminConstructor(this);
}

getLoginUrl(): string {
Expand Down Expand Up @@ -402,9 +402,23 @@ export class ExtensionRegistryService {
}
}

export class AdminService {
export interface AdminService {
getExtension(abortController: AbortController, namespace: string, extension: string): Promise<Readonly<Extension>>
deleteExtensions(abortController: AbortController, req: { namespace: string, extension: string, targetPlatformVersions?: object[] }): Promise<Readonly<SuccessResult | ErrorResult>>
getNamespace(abortController: AbortController, name: string): Promise<Readonly<Namespace>>
createNamespace(abortController: AbortController, namespace: { name: string }): Promise<Readonly<SuccessResult | ErrorResult>>
changeNamespace(abortController: AbortController, req: {oldNamespace: string, newNamespace: string, removeOldNamespace: boolean, mergeIfNewNamespaceAlreadyExists: boolean}): Promise<Readonly<SuccessResult | ErrorResult>>
getPublisherInfo(abortController: AbortController, provider: string, login: string): Promise<Readonly<PublisherInfo>>
revokePublisherContributions(abortController: AbortController, provider: string, login: string): Promise<Readonly<SuccessResult | ErrorResult>>
}

export interface AdminServiceConstructor {
new (registry: ExtensionRegistryService): AdminService
}

export class AdminServiceImpl implements AdminService {

constructor(readonly registry: ExtensionRegistryService) { }
constructor(readonly registry: ExtensionRegistryService) {}

getExtension(abortController: AbortController, namespace: string, extension: string): Promise<Readonly<Extension>> {
return sendRequest({
Expand Down

0 comments on commit 94189ad

Please sign in to comment.