Skip to content

Commit

Permalink
delete unneccesary interface
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed Jan 9, 2025
1 parent 8df64fa commit 540e7f3
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions packages/editor-ui/src/api/tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,23 @@ import type { CreateOrUpdateTagRequestDto, RetrieveTagQueryDto } from '@n8n/api-

type TagsApiEndpoint = '/tags' | '/annotation-tags';

export interface ITagsApi {
getTags: (context: IRestApiContext, params: RetrieveTagQueryDto) => Promise<ITag[]>;
createTag: (context: IRestApiContext, params: CreateOrUpdateTagRequestDto) => Promise<ITag>;
updateTag: (
context: IRestApiContext,
id: string,
params: CreateOrUpdateTagRequestDto,
) => Promise<ITag>;
deleteTag: (context: IRestApiContext, id: string) => Promise<boolean>;
}

export function createTagsApi(endpoint: TagsApiEndpoint): ITagsApi {
export function createTagsApi(endpoint: TagsApiEndpoint) {
return {
getTags: async (context: IRestApiContext, { withUsageCount = false }): Promise<ITag[]> => {
return await makeRestApiRequest(context, 'GET', endpoint, { withUsageCount });
getTags: async (context: IRestApiContext, data: RetrieveTagQueryDto): Promise<ITag[]> => {
return await makeRestApiRequest(context, 'GET', endpoint, data);
},
createTag: async (context: IRestApiContext, params: { name: string }): Promise<ITag> => {
return await makeRestApiRequest(context, 'POST', endpoint, params);
createTag: async (
context: IRestApiContext,
data: CreateOrUpdateTagRequestDto,
): Promise<ITag> => {
return await makeRestApiRequest(context, 'POST', endpoint, data);
},
updateTag: async (
context: IRestApiContext,
id: string,
params: { name: string },
data: CreateOrUpdateTagRequestDto,
): Promise<ITag> => {
return await makeRestApiRequest(context, 'PATCH', `${endpoint}/${id}`, params);
return await makeRestApiRequest(context, 'PATCH', `${endpoint}/${id}`, data);
},
deleteTag: async (context: IRestApiContext, id: string): Promise<boolean> => {
return await makeRestApiRequest(context, 'DELETE', `${endpoint}/${id}`);
Expand Down

0 comments on commit 540e7f3

Please sign in to comment.