Skip to content

Commit

Permalink
feat: added wrapper method for update nlu metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
zhihil committed Sep 12, 2023
1 parent 3988471 commit 7690b16
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/api-sdk/src/resources/project/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { AnyRecord } from '@voiceflow/common';
import { Fields } from '../base';
import CrudResource from '../crud';
import { ENDPOINT } from './constants';
import { UpdateMetadataBody } from './interface';
import MemberResource from './member';

export const modelIDKey = '_id';
Expand Down Expand Up @@ -126,6 +127,12 @@ class ProjectResource extends CrudResource<BaseModels.Project.Model<AnyRecord, A
return data;
}

public async updateNLUMetadata<P extends BaseModels.Project.Prototype>(id: string, nluMetadata: UpdateMetadataBody): Promise<P> {
const { data } = await this.fetch.patch<P>(`${this._getCRUDEndpoint(id)}/prototype/nlp`, nluMetadata);

return data;
}

public async getCreator<
P extends BaseModels.Project.Model<any, any> = BaseModels.Project.Model<AnyRecord, AnyRecord>,
V extends BaseModels.Version.Model<any, any, string> = BaseModels.Version.Model<BaseModels.Version.PlatformData>,
Expand Down
13 changes: 13 additions & 0 deletions packages/api-sdk/src/resources/project/interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export enum NLUType {
VFNLU = 'vfnlu',
}

interface BaseUpdateNLUMetadataBody {
type: NLUType;
}

interface VFNLUUpdateMetadataBody extends BaseUpdateNLUMetadataBody {
type: NLUType.VFNLU;
}

export type UpdateMetadataBody = VFNLUUpdateMetadataBody;

0 comments on commit 7690b16

Please sign in to comment.