-
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.
- Loading branch information
1 parent
5c96bd1
commit 5929914
Showing
5 changed files
with
94 additions
and
18 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
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 |
---|---|---|
@@ -1,14 +1,49 @@ | ||
import { CONTENT_TYPES } from '../constants/Events'; | ||
import { ClientConnection } from 'message-event-channel'; | ||
import { ContentTypeModel } from '../models/ContentType'; | ||
|
||
export class ContentTypes { | ||
constructor(private connection: ClientConnection) {} | ||
|
||
async getByUri(uri: string) { | ||
/** | ||
* | ||
* @param uri schema id / content type uri | ||
* | ||
* Used to get content type settings for a schema | ||
* | ||
* @returns [[Promise<ContentTypeModel>]] | ||
* | ||
* ### Example | ||
* | ||
* ```typescript | ||
* const contentType = sdk.contentTypes.getByUri('https://example-schema.com/blog.json') | ||
* | ||
* console.log(contentType) | ||
* ``` | ||
* @returns | ||
*/ | ||
async getByUri(uri: string): Promise<ContentTypeModel> { | ||
return this.connection.request(CONTENT_TYPES.GET_BY_URI, { uri }); | ||
} | ||
|
||
async getByUris(uris: string[]) { | ||
/** | ||
* | ||
* @param uri list of schema id / content type uri | ||
* | ||
* Used to get content type settings for a schema | ||
* | ||
* @returns [[Promise<ContentTypeModel[]>]] | ||
* | ||
* ### Example | ||
* | ||
* ```typescript | ||
* const contentTypes = sdk.contentTypes.getByUri(['https://example-schema.com/blog.json', 'https://example-schema.com/user.json']) | ||
* | ||
* console.log(contentTypes) | ||
* ``` | ||
* @returns | ||
*/ | ||
async getByUris(uris: string[]): Promise<ContentTypeModel[]> { | ||
return this.connection.request(CONTENT_TYPES.GET_BY_URIS, { uris }); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,10 +1,26 @@ | ||
import { WORKFLOWS } from '../constants/Events'; | ||
import { WorkflowModel } from '../models/Workflow'; | ||
import { ClientConnection } from 'message-event-channel'; | ||
|
||
export class Workflows { | ||
constructor(private connection: ClientConnection) {} | ||
|
||
async getAll() { | ||
/** | ||
* | ||
* @returns Workflow | ||
* | ||
* Used to fetch all workflows for a given hub. Returns a promise which will resolve to a [[WorkflowModel[]]] | ||
* | ||
* ### Example | ||
* | ||
* ```typescript | ||
* const workflows = await sdk.workflows.getAll() | ||
* | ||
* console.log(workflows) | ||
* ``` | ||
* | ||
*/ | ||
async getAll(): Promise<WorkflowModel[]> { | ||
return this.connection.request(WORKFLOWS.GET_ALL_WORKFLOWS); | ||
} | ||
} |
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,24 @@ | ||
export interface Visualization { | ||
label: string; | ||
templatedUri: string; | ||
default: boolean; | ||
} | ||
|
||
export interface ContentTypeCard { | ||
templatedUri: string; | ||
} | ||
|
||
export interface ContentTypeIcon { | ||
size: number; | ||
url: string; | ||
} | ||
|
||
export interface ContentTypeModel { | ||
id: string; | ||
label: string; | ||
status: string; | ||
contentTypeUri: string; | ||
cards: ContentTypeCard[]; | ||
icons: ContentTypeIcon[]; | ||
visualizations: Visualization[]; | ||
} |
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,7 @@ | ||
export interface WorkflowModel { | ||
id: string; | ||
color: string; | ||
label: string; | ||
lastModifiedBy: string; | ||
lastModifiedDate: string; | ||
} |