@integration-app/sdk
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -15,8 +15,8 @@ export interface IntegrationAppClientOptions { | ||
findConnections(): Promise<any>; | ||
findFlowInstances(options: FindFlowInstancesOptions): Promise<any>; | ||
findFlows(options: FindFlowsOptions): Promise<any>; | ||
deleteConnection(id: string): Promise<any>; | ||
createFlowInstance(options: NewFlowInstanceOptions): Promise<any>; | ||
createFlow(options: NewFlowOptions): Promise<any>; | ||
openNewConnection(options: NewConnectionOptions): Promise<void>; | ||
openFlowInstance(options: OpenFlowInstanceOptions): Promise<void>; | ||
openNewFlowInstance(options: NewFlowInstanceOptions): Promise<void>; | ||
openFlow(flowId: string, options?: OpenFlowOptions): Promise<void>; | ||
openNewFlow(options: NewFlowOptions): Promise<void>; | ||
private getEmbedUri; | ||
@@ -35,5 +35,4 @@ get(uri: string): Promise<any>; | ||
} | ||
export interface NewFlowInstanceOptions { | ||
blueprintKey?: string; | ||
flowKey: string; | ||
export interface NewFlowOptions { | ||
blueprintKey: string; | ||
parameters: any; | ||
@@ -49,10 +48,9 @@ onFlowRunComplete?: (...args: any) => void; | ||
} | ||
export interface OpenFlowInstanceOptions { | ||
id: string; | ||
export interface OpenFlowOptions { | ||
onFlowRunComplete?: (...args: any) => void; | ||
onClose?: (...args: any) => void; | ||
} | ||
export interface FindFlowInstancesOptions { | ||
flowKey: string; | ||
export interface FindFlowsOptions { | ||
blueprintKey: string; | ||
parameters?: Record<string, any>; | ||
} |
@@ -42,6 +42,6 @@ "use strict"; | ||
} | ||
findFlowInstances(options) { | ||
findFlows(options) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const queryParams = { | ||
flowKey: options.flowKey, | ||
bluepritnKey: options.blueprintKey, | ||
}; | ||
@@ -52,3 +52,3 @@ if (options.parameters) { | ||
const queryString = new URLSearchParams(queryParams).toString(); | ||
return this.get(`flow-instances?${queryString}`); | ||
return this.get(`flows?${queryString}`); | ||
}); | ||
@@ -61,6 +61,6 @@ } | ||
} | ||
createFlowInstance(options) { | ||
createFlow(options) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.post('flow-instances', { | ||
blueprintKey: options.flowKey, | ||
return this.post('flows', { | ||
blueprintKey: options.blueprintKey, | ||
parameters: options.parameters, | ||
@@ -106,5 +106,5 @@ }); | ||
} | ||
openFlowInstance(options) { | ||
openFlow(flowId, options = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const uri = this.getEmbedUri(`flows/${options.id}`, options); | ||
const uri = this.getEmbedUri(`flows/${flowId}`); | ||
iframe_1.openIframe(uri, { | ||
@@ -116,6 +116,6 @@ onFlowRunComplete: options.onFlowRunComplete, | ||
} | ||
openNewFlowInstance(options) { | ||
openNewFlow(options) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const uri = this.getEmbedUri('flows/new', { | ||
blueprintKey: options.flowKey || options.blueprintKey, | ||
blueprintKey: options.blueprintKey || options.blueprintKey, | ||
parameters: JSON.stringify(options.parameters), | ||
@@ -122,0 +122,0 @@ }); |
{ | ||
"name": "@integration-app/sdk", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "JavaScript SDK for Integration.app", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -40,5 +40,5 @@ import Axios, { AxiosRequestConfig } from 'axios' | ||
public async findFlowInstances(options: FindFlowInstancesOptions) { | ||
public async findFlows(options: FindFlowsOptions) { | ||
const queryParams: Record<string, string> = { | ||
flowKey: options.flowKey, | ||
bluepritnKey: options.blueprintKey, | ||
} | ||
@@ -49,3 +49,3 @@ if (options.parameters) { | ||
const queryString = new URLSearchParams(queryParams).toString() | ||
return this.get(`flow-instances?${queryString}`) | ||
return this.get(`flows?${queryString}`) | ||
} | ||
@@ -57,5 +57,5 @@ | ||
public async createFlowInstance(options: NewFlowInstanceOptions) { | ||
return this.post('flow-instances', { | ||
blueprintKey: options.flowKey, | ||
public async createFlow(options: NewFlowOptions) { | ||
return this.post('flows', { | ||
blueprintKey: options.blueprintKey, | ||
parameters: options.parameters, | ||
@@ -105,4 +105,4 @@ }) | ||
public async openFlowInstance(options: OpenFlowInstanceOptions) { | ||
const uri = this.getEmbedUri(`flows/${options.id}`, options) | ||
public async openFlow(flowId: string, options: OpenFlowOptions = {}) { | ||
const uri = this.getEmbedUri(`flows/${flowId}`) | ||
openIframe(uri, { | ||
@@ -114,5 +114,5 @@ onFlowRunComplete: options.onFlowRunComplete, | ||
public async openNewFlowInstance(options: NewFlowInstanceOptions) { | ||
public async openNewFlow(options: NewFlowOptions) { | ||
const uri = this.getEmbedUri('flows/new', { | ||
blueprintKey: options.flowKey || options.blueprintKey, | ||
blueprintKey: options.blueprintKey || options.blueprintKey, | ||
parameters: JSON.stringify(options.parameters), | ||
@@ -183,5 +183,4 @@ }) | ||
export interface NewFlowInstanceOptions { | ||
blueprintKey?: string | ||
flowKey: string | ||
export interface NewFlowOptions { | ||
blueprintKey: string | ||
parameters: any | ||
@@ -199,4 +198,3 @@ onFlowRunComplete?: (...args: any) => void | ||
export interface OpenFlowInstanceOptions { | ||
id: string | ||
export interface OpenFlowOptions { | ||
onFlowRunComplete?: (...args: any) => void | ||
@@ -206,5 +204,5 @@ onClose?: (...args: any) => void | ||
export interface FindFlowInstancesOptions { | ||
flowKey: string | ||
export interface FindFlowsOptions { | ||
blueprintKey: string | ||
parameters?: Record<string, any> | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
276911
3179