diff --git a/src/endpoints/flows.js b/src/endpoints/flows.js index 6834df7e8..78eb402e3 100644 --- a/src/endpoints/flows.js +++ b/src/endpoints/flows.js @@ -121,6 +121,35 @@ class FlowsEndpoint extends CRUDExtend { token ) } + + CreateFlowRelationship(endpoint, srcId, flowSlug, targetType, targetId) { + return this.request.send( + `${endpoint}/${srcId}/relationships/${flowSlug}`, + 'POST', + { + type: targetType, + id: targetId + } + ) + } + + DeleteFlowRelationship(endpoint, srcId, flowSlug) { + return this.request.send( + `${endpoint}/${srcId}/relationships/${flowSlug}`, + 'DELETE' + ) + } + + UpdateFlowRelationship(endpoint, srcId, flowSlug, targetType, targetId) { + return this.request.send( + `${endpoint}/${srcId}/relationships/${flowSlug}`, + 'PUT', + { + type: targetType, + id: targetId + } + ) + } } export default FlowsEndpoint diff --git a/src/types/flow.d.ts b/src/types/flow.d.ts index 20bc4d863..f80f4168f 100644 --- a/src/types/flow.d.ts +++ b/src/types/flow.d.ts @@ -98,4 +98,11 @@ export interface FlowEndpoint { Attributes(token?: string): Promise GetFlowTypeAttributes(flowType: string, token?: string): Promise + + + CreateFlowRelationship(endpoint: string, srcId: string, flowSlug: string, targetType: string, targetId: string) + + DeleteFlowRelationship(endpoint: string, srcId: string, flowSlug: string) + + UpdateFlowRelationship(endpoint: string, srcId: string, flowSlug: string, targetType: string, targetId: string) }