From deda85fbfcd54cddd68d5d72ad3111225c532d34 Mon Sep 17 00:00:00 2001 From: Maxime Corbin Date: Mon, 11 Mar 2024 15:13:51 +0100 Subject: [PATCH] chore: remove deprecated marketplace/v1 --- packages/clients/src/api/marketplace/index.ts | 1 - .../clients/src/api/marketplace/v1/api.gen.ts | 58 --------- .../src/api/marketplace/v1/index.gen.ts | 13 -- .../src/api/marketplace/v1/marshalling.gen.ts | 111 ------------------ .../src/api/marketplace/v1/types.gen.ts | 82 ------------- 5 files changed, 265 deletions(-) delete mode 100644 packages/clients/src/api/marketplace/v1/api.gen.ts delete mode 100644 packages/clients/src/api/marketplace/v1/index.gen.ts delete mode 100644 packages/clients/src/api/marketplace/v1/marshalling.gen.ts delete mode 100644 packages/clients/src/api/marketplace/v1/types.gen.ts diff --git a/packages/clients/src/api/marketplace/index.ts b/packages/clients/src/api/marketplace/index.ts index cd5521c9c..c399bf084 100644 --- a/packages/clients/src/api/marketplace/index.ts +++ b/packages/clients/src/api/marketplace/index.ts @@ -1,2 +1 @@ -export * as v1 from './v1/index.gen' export * as v2 from './v2/index.gen' diff --git a/packages/clients/src/api/marketplace/v1/api.gen.ts b/packages/clients/src/api/marketplace/v1/api.gen.ts deleted file mode 100644 index 8c1a7a470..000000000 --- a/packages/clients/src/api/marketplace/v1/api.gen.ts +++ /dev/null @@ -1,58 +0,0 @@ -// This file was automatically generated. DO NOT EDIT. -// If you have any remark or suggestion do not hesitate to open an issue. -import { - API as ParentAPI, - enrichForPagination, - urlParams, - validatePathParam, -} from '../../../bridge' -import { - unmarshalGetImageResponse, - unmarshalListImagesResponse, -} from './marshalling.gen' -import type { - GetImageRequest, - GetImageResponse, - ListImagesRequest, - ListImagesResponse, -} from './types.gen' - -/** Marketplace API. */ -export class API extends ParentAPI { - protected pageOfListImages = (request: Readonly = {}) => - this.client.fetch( - { - method: 'GET', - path: `/marketplace/v1/images`, - urlParams: urlParams( - ['page', request.page], - ['per_page', request.perPage ?? this.client.settings.defaultPageSize], - ), - }, - unmarshalListImagesResponse, - ) - - /** - * List marketplace images. - * - * @param request - The request {@link ListImagesRequest} - * @returns A Promise of ListImagesResponse - */ - listImages = (request: Readonly = {}) => - enrichForPagination('images', this.pageOfListImages, request) - - /** - * Get a specific marketplace image. - * - * @param request - The request {@link GetImageRequest} - * @returns A Promise of GetImageResponse - */ - getImage = (request: Readonly) => - this.client.fetch( - { - method: 'GET', - path: `/marketplace/v1/images/${validatePathParam('imageId', request.imageId)}`, - }, - unmarshalGetImageResponse, - ) -} diff --git a/packages/clients/src/api/marketplace/v1/index.gen.ts b/packages/clients/src/api/marketplace/v1/index.gen.ts deleted file mode 100644 index 94fdd5953..000000000 --- a/packages/clients/src/api/marketplace/v1/index.gen.ts +++ /dev/null @@ -1,13 +0,0 @@ -// This file was automatically generated. DO NOT EDIT. -// If you have any remark or suggestion do not hesitate to open an issue. -export { API } from './api.gen' -export type { - GetImageRequest, - GetImageResponse, - Image, - ListImagesRequest, - ListImagesResponse, - LocalImage, - Organization, - Version, -} from './types.gen' diff --git a/packages/clients/src/api/marketplace/v1/marshalling.gen.ts b/packages/clients/src/api/marketplace/v1/marshalling.gen.ts deleted file mode 100644 index 9bd1077e7..000000000 --- a/packages/clients/src/api/marketplace/v1/marshalling.gen.ts +++ /dev/null @@ -1,111 +0,0 @@ -// This file was automatically generated. DO NOT EDIT. -// If you have any remark or suggestion do not hesitate to open an issue. -import { - isJSONObject, - unmarshalArrayOfObject, - unmarshalDate, -} from '../../../bridge' -import type { - GetImageResponse, - Image, - ListImagesResponse, - LocalImage, - Organization, - Version, -} from './types.gen' - -const unmarshalLocalImage = (data: unknown): LocalImage => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'LocalImage' failed as data isn't a dictionary.`, - ) - } - - return { - arch: data.arch, - compatibleCommercialTypes: data.compatible_commercial_types, - id: data.id, - zone: data.zone, - } as LocalImage -} - -const unmarshalOrganization = (data: unknown): Organization => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Organization' failed as data isn't a dictionary.`, - ) - } - - return { - id: data.id, - name: data.name, - } as Organization -} - -const unmarshalVersion = (data: unknown): Version => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Version' failed as data isn't a dictionary.`, - ) - } - - return { - creationDate: unmarshalDate(data.creation_date), - id: data.id, - localImages: unmarshalArrayOfObject(data.local_images, unmarshalLocalImage), - modificationDate: unmarshalDate(data.modification_date), - name: data.name, - } as Version -} - -const unmarshalImage = (data: unknown): Image => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'Image' failed as data isn't a dictionary.`, - ) - } - - return { - categories: data.categories, - creationDate: unmarshalDate(data.creation_date), - currentPublicVersion: data.current_public_version, - description: data.description, - id: data.id, - label: data.label, - logo: data.logo, - modificationDate: unmarshalDate(data.modification_date), - name: data.name, - organization: data.organization - ? unmarshalOrganization(data.organization) - : undefined, - validUntil: unmarshalDate(data.valid_until), - versions: unmarshalArrayOfObject(data.versions, unmarshalVersion), - } as Image -} - -export const unmarshalGetImageResponse = (data: unknown): GetImageResponse => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'GetImageResponse' failed as data isn't a dictionary.`, - ) - } - - return { - image: data.image ? unmarshalImage(data.image) : undefined, - } as GetImageResponse -} - -export const unmarshalListImagesResponse = ( - data: unknown, -): ListImagesResponse => { - if (!isJSONObject(data)) { - throw new TypeError( - `Unmarshalling the type 'ListImagesResponse' failed as data isn't a dictionary.`, - ) - } - - return { - images: unmarshalArrayOfObject(data.images, unmarshalImage), - totalCount: data.total_count, - } as ListImagesResponse -} diff --git a/packages/clients/src/api/marketplace/v1/types.gen.ts b/packages/clients/src/api/marketplace/v1/types.gen.ts deleted file mode 100644 index b2fc1f339..000000000 --- a/packages/clients/src/api/marketplace/v1/types.gen.ts +++ /dev/null @@ -1,82 +0,0 @@ -// This file was automatically generated. DO NOT EDIT. -// If you have any remark or suggestion do not hesitate to open an issue. -import type { Zone } from '../../../bridge' - -export interface LocalImage { - /** Version you will typically use to define an image in an API call. */ - id: string - /** List of all commercial types that are compatible with this local image. */ - compatibleCommercialTypes: string[] - /** Supported architecture for this local image. */ - arch: string - /** Availability Zone where this local image is available. */ - zone: Zone -} - -export interface Organization { - id: string - name: string -} - -export interface Version { - /** UUID of this version. */ - id: string - /** Name of this version. */ - name: string - /** Creation date of this image version. */ - creationDate?: Date - /** Date of the last modification of this version. */ - modificationDate?: Date - /** List of local images available in this version. */ - localImages: LocalImage[] -} - -export interface Image { - /** UUID of this image. */ - id: string - /** Name of the image. */ - name: string - /** Text description of this image. */ - description: string - /** URL of this image's logo. */ - logo: string - /** List of categories this image belongs to. */ - categories: string[] - /** Creation date of this image. */ - creationDate?: Date - /** Date of the last modification of this image. */ - modificationDate?: Date - /** Expiration date of this image. */ - validUntil?: Date - /** Typically an identifier for a distribution (ex. "ubuntu_focal"). */ - label: string - /** List of versions of this image. */ - versions: Version[] - /** Organization this image belongs to. */ - organization?: Organization - currentPublicVersion: string -} - -export type GetImageRequest = { - /** Display the image name. */ - imageId: string -} - -export interface GetImageResponse { - image?: Image -} - -export type ListImagesRequest = { - /** - * A positive integer lower or equal to 100 to select the number of items to - * display. - */ - perPage?: number - /** A positive integer to choose the page to display. */ - page?: number -} - -export interface ListImagesResponse { - images: Image[] - totalCount: number -}