@@ -25,6 +25,7 @@ export interface UseFmeServiceInputs {
25
25
| "notifications/topics"
26
26
| "repositories"
27
27
| "resources/connections"
28
+ | "resources/types"
28
29
| "schedules"
29
30
| "schedules/categories"
30
31
| string ;
@@ -35,7 +36,10 @@ export interface UseFmeServiceInputs {
35
36
/**
36
37
* @description The content type of the request. This is required when the method is POST or PUT.
37
38
*/
38
- contentType ?: "application/x-www-form-urlencoded" | "application/json" ;
39
+ contentType ?:
40
+ | "application/x-www-form-urlencoded"
41
+ | "application/json"
42
+ | "multipart/form-data" ;
39
43
/**
40
44
* @description The body parameters to pass to the service operation when the method is POST or PUT.
41
45
*/
@@ -68,15 +72,21 @@ export class UseFmeService implements IActivityHandler {
68
72
throw new Error ( "path is required" ) ;
69
73
}
70
74
71
- let body : string | undefined ;
75
+ let params : string | FormData | undefined ;
72
76
if ( typeof parameters === "object" ) {
73
77
if ( contentType === "application/json" ) {
74
- body = JSON . stringify ( parameters ) ;
78
+ params = JSON . stringify ( parameters ) ;
75
79
} else if ( contentType === "application/x-www-form-urlencoded" ) {
76
- body = objectToQueryString ( parameters ) ;
80
+ params = objectToQueryString ( parameters ) ;
81
+ } else if ( contentType === "multipart/form-data" ) {
82
+ const formData = new FormData ( ) ;
83
+ for ( const name in parameters ) {
84
+ formData . append ( name , parameters [ name ] ) ;
85
+ }
86
+ params = formData ;
77
87
}
78
88
} else {
79
- body = parameters ;
89
+ params = parameters ;
80
90
}
81
91
82
92
/* eslint-disable @typescript-eslint/no-non-null-assertion */
@@ -89,7 +99,7 @@ export class UseFmeService implements IActivityHandler {
89
99
result,
90
100
} ) ;
91
101
} ,
92
- body ! ,
102
+ params as any , // FormData is accepted and used internally by the API.
93
103
contentType !
94
104
) ;
95
105
} ) ;
0 commit comments