Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion packages/clients/src/api/ipfs/v1alpha1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export class API extends ParentAPI {
)

/**
* List all pins within a volume. Retrieve information about all pins into a
* List all pins within a volume. Retrieve information about all pins within a
* volume.
*
* @param request - The request {@link ListPinsRequest}
Expand All @@ -344,6 +344,13 @@ export class API extends ParentAPI {
urlParams: urlParams(['volume_id', request.volumeId]),
})

/**
* Create a new name. You can use the `ipfs key` command to list and generate
* more names and their respective keys.
*
* @param request - The request {@link CreateNameRequest}
* @returns A Promise of Name
*/
createName = (request: Readonly<CreateNameRequest>) =>
this.client.fetch<Name>(
{
Expand All @@ -360,6 +367,12 @@ export class API extends ParentAPI {
unmarshalName,
)

/**
* Get information about a name. Retrieve information about a specific name.
*
* @param request - The request {@link GetNameRequest}
* @returns A Promise of Name
*/
getName = (request: Readonly<GetNameRequest>) =>
this.client.fetch<Name>(
{
Expand Down Expand Up @@ -391,6 +404,11 @@ export class API extends ParentAPI {
options,
)

/**
* Delete an existing name. Delete a name by its ID.
*
* @param request - The request {@link DeleteNameRequest}
*/
deleteName = (request: Readonly<DeleteNameRequest>) =>
this.client.fetch<void>({
method: 'DELETE',
Expand Down Expand Up @@ -422,9 +440,22 @@ export class API extends ParentAPI {
unmarshalListNamesResponse,
)

/**
* List all names by a Project ID. Retrieve information about all names from a
* Project ID.
*
* @param request - The request {@link ListNamesRequest}
* @returns A Promise of ListNamesResponse
*/
listNames = (request: Readonly<ListNamesRequest> = {}) =>
enrichForPagination('names', this.pageOfListNames, request)

/**
* Update name information. Update name information (CID, tag, name...).
*
* @param request - The request {@link UpdateNameRequest}
* @returns A Promise of Name
*/
updateName = (request: Readonly<UpdateNameRequest>) =>
this.client.fetch<Name>(
{
Expand All @@ -441,6 +472,12 @@ export class API extends ParentAPI {
unmarshalName,
)

/**
* Export your private key. Export a private key by its ID.
*
* @param request - The request {@link ExportKeyNameRequest}
* @returns A Promise of ExportKeyNameResponse
*/
exportKeyName = (request: Readonly<ExportKeyNameRequest>) =>
this.client.fetch<ExportKeyNameResponse>(
{
Expand All @@ -453,6 +490,12 @@ export class API extends ParentAPI {
unmarshalExportKeyNameResponse,
)

/**
* Import your private key. Import a private key.
*
* @param request - The request {@link ImportKeyNameRequest}
* @returns A Promise of Name
*/
importKeyName = (request: Readonly<ImportKeyNameRequest>) =>
this.client.fetch<Name>(
{
Expand Down
7 changes: 4 additions & 3 deletions packages/clients/src/api/ipfs/v1alpha1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export const unmarshalName = (data: unknown) => {
}

return {
cid: data.cid,
createdAt: unmarshalDate(data.created_at),
key: data.key,
name: data.name,
Expand All @@ -87,6 +86,7 @@ export const unmarshalName = (data: unknown) => {
status: data.status,
tags: data.tags,
updatedAt: unmarshalDate(data.updated_at),
value: data.value,
} as Name
}

Expand Down Expand Up @@ -207,9 +207,9 @@ export const marshalCreateNameRequest = (
request: CreateNameRequest,
defaults: DefaultValues,
): Record<string, unknown> => ({
cid: request.cid,
name: request.name,
project_id: request.projectId ?? defaults.defaultProjectId,
value: request.value,
})

export const marshalCreatePinByCIDRequest = (
Expand Down Expand Up @@ -252,6 +252,7 @@ export const marshalImportKeyNameRequest = (
name: request.name,
private_key: request.privateKey,
project_id: request.projectId ?? defaults.defaultProjectId,
value: request.value,
})

export const marshalReplacePinRequest = (
Expand All @@ -271,9 +272,9 @@ export const marshalUpdateNameRequest = (
request: UpdateNameRequest,
defaults: DefaultValues,
): Record<string, unknown> => ({
cid: request.cid,
name: request.name,
tags: request.tags,
value: request.value,
})

export const marshalUpdateVolumeRequest = (
Expand Down
7 changes: 4 additions & 3 deletions packages/clients/src/api/ipfs/v1alpha1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export interface Name {
tags: string[]
name: string
key: string
cid: string
status: NameStatus
value: string
}

export interface Pin {
Expand Down Expand Up @@ -263,7 +263,7 @@ export type CreateNameRequest = {
region?: Region
projectId?: string
name: string
cid: string
value: string
}

export type GetNameRequest = {
Expand Down Expand Up @@ -306,7 +306,7 @@ export type UpdateNameRequest = {
nameId: string
name?: string
tags?: string[]
cid?: string
value?: string
}

export type ExportKeyNameRequest = {
Expand All @@ -327,4 +327,5 @@ export type ImportKeyNameRequest = {
projectId?: string
name: string
privateKey: string
value: string
}