-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: replace programIDs with diagramID (CV3-364)
- Loading branch information
1 parent
9058e8f
commit e9bb4f5
Showing
6 changed files
with
89 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import Fetch from '@api-sdk/fetch'; | ||
import { BaseModels } from '@voiceflow/base-types'; | ||
|
||
import CrudNestedResource from '../crudNested'; | ||
|
||
const ENDPOINT = 'diagrams'; | ||
|
||
export type ModelKey = 'diagramID'; | ||
|
||
class DiagramResource extends CrudNestedResource<string, BaseModels.Diagram.Model, ModelKey, DiagramResource> { | ||
constructor(fetch: Fetch, { parentEndpoint }: { parentEndpoint: string }) { | ||
super({ | ||
fetch, | ||
clazz: DiagramResource, | ||
endpoint: ENDPOINT, | ||
clazzOptions: { parentEndpoint }, | ||
}); | ||
} | ||
|
||
public async get(versionID: string, diagramID: string): Promise<BaseModels.Diagram.Model> { | ||
return this._getByID<BaseModels.Diagram.Model>(versionID, diagramID); | ||
} | ||
} | ||
|
||
export default DiagramResource; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import Fetch from '@api-sdk/fetch'; | ||
import { BaseModels } from '@voiceflow/base-types'; | ||
|
||
import CrudNestedResource from '../crudNested'; | ||
|
||
const ENDPOINT = 'programs'; | ||
|
||
export type ModelKey = 'diagramID'; | ||
|
||
class ProgramResource extends CrudNestedResource<string, BaseModels.Program.Model, ModelKey, ProgramResource> { | ||
constructor(fetch: Fetch, { parentEndpoint }: { parentEndpoint: string }) { | ||
super({ | ||
fetch, | ||
clazz: ProgramResource, | ||
endpoint: ENDPOINT, | ||
clazzOptions: { parentEndpoint }, | ||
}); | ||
} | ||
|
||
public async get(versionID: string, diagramID: string): Promise<BaseModels.Program.Model> { | ||
return this._getByID<BaseModels.Program.Model>(versionID, diagramID); | ||
} | ||
} | ||
|
||
export default ProgramResource; |
25 changes: 25 additions & 0 deletions
25
packages/api-sdk/src/resources/version/prototypeProgram.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import Fetch from '@api-sdk/fetch'; | ||
import { BaseModels } from '@voiceflow/base-types'; | ||
|
||
import CrudNestedResource from '../crudNested'; | ||
|
||
const ENDPOINT = 'prototype-programs'; | ||
|
||
export type ModelKey = 'diagramID'; | ||
|
||
class PrototypeProgramResource extends CrudNestedResource<string, BaseModels.Program.Model, ModelKey, PrototypeProgramResource> { | ||
constructor(fetch: Fetch, { parentEndpoint }: { parentEndpoint: string }) { | ||
super({ | ||
fetch, | ||
clazz: PrototypeProgramResource, | ||
endpoint: ENDPOINT, | ||
clazzOptions: { parentEndpoint }, | ||
}); | ||
} | ||
|
||
public async get(versionID: string, diagramID: string): Promise<BaseModels.Program.Model> { | ||
return this._getByID<BaseModels.Program.Model>(versionID, diagramID); | ||
} | ||
} | ||
|
||
export default PrototypeProgramResource; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters