Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/endpoints/flows.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions src/types/flow.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,11 @@ export interface FlowEndpoint {
Attributes(token?: string): Promise<Attributes>

GetFlowTypeAttributes(flowType: string, token?: string): Promise<Attributes>


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)
}