@@ -122,38 +122,34 @@ class FlowsEndpoint extends CRUDExtend {
122122 )
123123 }
124124
125- CreateFlowRelationship ( flowSlug , fieldSlug , srcId , targetType , targetId ) {
125+ CreateFlowRelationship ( endpoint , srcId , flowSlug , targetType , targetId ) {
126126 return this . request . send (
127- `v2/flows/ ${ flowSlug } /entries/ ${ srcId } /relationships/${ fieldSlug } ` ,
127+ `${ endpoint } / ${ srcId } /relationships/${ flowSlug } ` ,
128128 'POST' ,
129129 {
130- type : targetType ,
131- id : targetId ,
132- } ,
130+ type : targetType ,
131+ id : targetId
132+ }
133+ )
134+ }
135+
136+ DeleteFlowRelationship ( endpoint , srcId , flowSlug ) {
137+ return this . request . send (
138+ `${ endpoint } /${ srcId } /relationships/${ flowSlug } ` ,
139+ 'DELETE'
133140 )
134141 }
135142
136- // DeleteFlowRelationships(srcType, srcId, targetType) {
137- // const srcEndpoint = getEndpoint(srcType);
138- // const parsedType = formatUrlResource(targetType)
139-
140- // return this.request.send(
141- // `${srcEndpoint}/${srcId}/relationships/${parsedType}`,
142- // 'DELETE'
143- // )
144- // }
145-
146- // UpdateRelationships(srcType, srcId, targetType, resources = null) {
147- // const srcEndpoint = getEndpoint(srcType);
148- // const body = buildRelationshipData(targetType, resources)
149- // const parsedType = formatUrlResource(targetType)
150-
151- // return this.request.send(
152- // `${srcEndpoint}/${srcId}/relationships/${parsedType}`,
153- // 'PUT',
154- // body
155- // )
156- // }
143+ UpdateFlowRelationship ( endpoint , srcId , flowSlug , targetType , targetId ) {
144+ return this . request . send (
145+ `${ endpoint } /${ srcId } /relationships/${ flowSlug } ` ,
146+ 'PUT' ,
147+ {
148+ type : targetType ,
149+ id : targetId
150+ }
151+ )
152+ }
157153}
158154
159155export default FlowsEndpoint
0 commit comments