@@ -88,7 +88,7 @@ class Client {
8888 if (contentType.startsWith('multipart/form-data')) {
8989 const form = new FormData();
9090
91- let flatParams = this .flatten(params);
91+ let flatParams = Client .flatten(params);
9292
9393 for (const key in flatParams) {
9494 form.append(key, flatParams[key])
@@ -122,26 +122,25 @@ class Client {
122122 } else {
123123 throw new {{spec .title | caseUcfirst }}Exception(error.response.data.message, error.response.status, error.response.data);
124124 }
125- }else{
125+ } else {
126126 throw new {{spec .title | caseUcfirst }}Exception(error.response.statusText, error.response.status, error.response.data);
127127 }
128- }else{
128+ } else {
129129 throw new {{spec .title | caseUcfirst }}Exception(error.message);
130130 }
131131 }
132132 }
133133
134- flatten(data, prefix = '') {
134+ static flatten(data, prefix = '') {
135135 let output = {};
136136
137137 for (const key in data) {
138138 let value = data[key];
139139 let finalKey = prefix ? prefix + '[' + key +']' : key;
140140
141141 if (Array.isArray(value)) {
142- output = Object.assign(output, this.flatten(value, finalKey)); // @todo: handle name collision here if needed
143- }
144- else {
142+ output = Object.assign(output, Client.flatten(value, finalKey)); // @todo: handle name collision here if needed
143+ } else {
145144 output[finalKey] = value;
146145 }
147146 }
@@ -150,4 +149,4 @@ class Client {
150149 }
151150}
152151
153- module.exports = Client;
152+ module.exports = Client;
0 commit comments