File tree Expand file tree Collapse file tree 2 files changed +205
-216
lines changed Expand file tree Collapse file tree 2 files changed +205
-216
lines changed Original file line number Diff line number Diff line change @@ -45,19 +45,21 @@ export async function getApiManager(): Promise<APIManagerBase> {
45
45
* Call the management API
46
46
*/
47
47
export async function callManagementApi (
48
- method : string = ' POST' ,
49
- uri : string = '' ,
50
- params : Record < string , any > = { }
51
- ) : Promise < Record < string , any > > {
48
+ method : string = " POST" ,
49
+ uri : string = "" ,
50
+ kwargs : Record < string , any > = { }
51
+ ) : Promise < any > {
52
52
const s1cManager = await getApiManager ( ) ;
53
53
const data : Record < string , any > = { } ;
54
54
55
- // Convert snake_case to kebab-case for API parameters
56
- for ( const [ key , value ] of Object . entries ( params ) ) {
57
- if ( value === null || value === '' ) {
55
+ for ( const [ key , value ] of Object . entries ( kwargs ) ) {
56
+ // Skip null, undefined, empty strings, and empty arrays
57
+ if ( value === null || value === undefined || value === "" ||
58
+ ( Array . isArray ( value ) && value . length === 0 ) ) {
58
59
continue ;
59
60
}
60
- const safeKey = key . replace ( / _ / g, '-' ) ;
61
+
62
+ const safeKey = key . replace ( / _ / g, "-" ) ;
61
63
data [ safeKey ] = value ;
62
64
}
63
65
You can’t perform that action at this time.
0 commit comments