@@ -139,23 +139,26 @@ public function getKeywords(): array
139139 public function getIdentifierOverrides (): array
140140 {
141141 return [
142- 'Jwt ' => 'JWT '
142+ 'Jwt ' => 'JWT ' ,
143+ 'Domain ' => 'XDomain ' ,
143144 ];
144145 }
145146
146147 /**
147- * @param $type
148+ * @param array $parameter
148149 * @return string
149150 */
150151 public function getTypeName (array $ parameter ): string
151152 {
152153 switch ($ parameter ['type ' ]) {
153154 case self ::TYPE_INTEGER :
154- return 'int ' ;
155+ return 'long ' ;
156+ case self ::TYPE_NUMBER :
157+ return 'double ' ;
155158 case self ::TYPE_STRING :
156159 return 'string ' ;
157160 case self ::TYPE_FILE :
158- return 'FileInfo ' ;
161+ return 'InputFile ' ;
159162 case self ::TYPE_BOOLEAN :
160163 return 'bool ' ;
161164 case self ::TYPE_ARRAY :
@@ -233,7 +236,7 @@ public function getParamExample(array $param): string
233236 if (empty ($ example ) && $ example !== 0 && $ example !== false ) {
234237 switch ($ type ) {
235238 case self ::TYPE_FILE :
236- $ output .= 'new File ("./path-to-files/image.jpg") ' ;
239+ $ output .= 'InputFile.FromPath ("./path-to-files/image.jpg") ' ;
237240 break ;
238241 case self ::TYPE_NUMBER :
239242 case self ::TYPE_INTEGER :
@@ -249,7 +252,13 @@ public function getParamExample(array $param): string
249252 $ output .= '[object] ' ;
250253 break ;
251254 case self ::TYPE_ARRAY :
252- $ output .= '[List<object>] ' ;
255+ if (\str_starts_with ($ example , '[ ' )) {
256+ $ example = \substr ($ example , 1 );
257+ }
258+ if (\str_ends_with ($ example , '] ' )) {
259+ $ example = \substr ($ example , 0 , -1 );
260+ }
261+ $ output .= 'new List< ' . $ this ->getTypeName ($ param ['array ' ]) . '> { ' . $ example . '} ' ;
253262 break ;
254263 }
255264 } else {
@@ -283,23 +292,28 @@ public function getFiles(): array
283292 return [
284293 [
285294 'scope ' => 'default ' ,
286- 'destination ' => 'README.md ' ,
287- 'template ' => 'dotnet/README.md .twig ' ,
295+ 'destination ' => '.travis.yml ' ,
296+ 'template ' => 'dotnet/.travis.yml .twig ' ,
288297 ],
289298 [
290299 'scope ' => 'default ' ,
291300 'destination ' => 'CHANGELOG.md ' ,
292301 'template ' => 'dotnet/CHANGELOG.md.twig ' ,
293302 ],
303+ [
304+ 'scope ' => 'copy ' ,
305+ 'destination ' => '/icon.png ' ,
306+ 'template ' => 'dotnet/icon.png ' ,
307+ ],
294308 [
295309 'scope ' => 'default ' ,
296310 'destination ' => 'LICENSE ' ,
297311 'template ' => 'dotnet/LICENSE.twig ' ,
298312 ],
299313 [
300314 'scope ' => 'default ' ,
301- 'destination ' => '.travis.yml ' ,
302- 'template ' => 'dotnet/.travis.yml .twig ' ,
315+ 'destination ' => 'README.md ' ,
316+ 'template ' => 'dotnet/README.md .twig ' ,
303317 ],
304318 [
305319 'scope ' => 'method ' ,
@@ -308,53 +322,78 @@ public function getFiles(): array
308322 ],
309323 [
310324 'scope ' => 'default ' ,
311- 'destination ' => '/src/Appwrite .sln ' ,
325+ 'destination ' => '/src/{{ spec.title | caseUcfirst }} .sln ' ,
312326 'template ' => 'dotnet/src/Appwrite.sln ' ,
313327 ],
314- [
315- 'scope ' => 'copy ' ,
316- 'destination ' => '/icon.png ' ,
317- 'template ' => 'dotnet/icon.png ' ,
318- ],
319328 [
320329 'scope ' => 'default ' ,
321- 'destination ' => '/src/Appwrite/Appwrite .csproj ' ,
330+ 'destination ' => '/src/{{ spec.title | caseUcfirst }}/{{ spec.title | caseUcfirst }} .csproj ' ,
322331 'template ' => 'dotnet/src/Appwrite/Appwrite.csproj.twig ' ,
323332 ],
324333 [
325334 'scope ' => 'default ' ,
326- 'destination ' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite /Client.cs ' ,
335+ 'destination ' => '/src/ {{ spec.title | caseUcfirst }}/Client.cs ' ,
327336 'template ' => 'dotnet/src/Appwrite/Client.cs.twig ' ,
328337 ],
329338 [
330339 'scope ' => 'default ' ,
331- 'destination ' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/Helpers/ExtensionMethods .cs ' ,
332- 'template ' => 'dotnet/src/Appwrite/Helpers/ExtensionMethods .cs ' ,
340+ 'destination ' => '/src/ {{ spec.title | caseUcfirst }}/{{ spec.title | caseUcfirst }}Exception .cs ' ,
341+ 'template ' => 'dotnet/src/Appwrite/Exception .cs.twig ' ,
333342 ],
334343 [
335344 'scope ' => 'default ' ,
336- 'destination ' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/Models/OrderType.cs ' ,
345+ 'destination ' => '/src/{{ spec.title | caseUcfirst }}/ID.cs ' ,
346+ 'template ' => 'dotnet/src/Appwrite/ID.cs.twig ' ,
347+ ],
348+ [
349+ 'scope ' => 'default ' ,
350+ 'destination ' => '/src/{{ spec.title | caseUcfirst }}/Permission.cs ' ,
351+ 'template ' => 'dotnet/src/Appwrite/Permission.cs.twig ' ,
352+ ],
353+ [
354+ 'scope ' => 'default ' ,
355+ 'destination ' => '/src/{{ spec.title | caseUcfirst }}/Query.cs ' ,
356+ 'template ' => 'dotnet/src/Appwrite/Query.cs.twig ' ,
357+ ],
358+ [
359+ 'scope ' => 'default ' ,
360+ 'destination ' => '/src/{{ spec.title | caseUcfirst }}/Role.cs ' ,
361+ 'template ' => 'dotnet/src/Appwrite/Role.cs.twig ' ,
362+ ],
363+ [
364+ 'scope ' => 'default ' ,
365+ 'destination ' => '/src/{{ spec.title | caseUcfirst }}/Extensions/Extensions.cs ' ,
366+ 'template ' => 'dotnet/src/Appwrite/Extensions/Extensions.cs.twig ' ,
367+ ],
368+ [
369+ 'scope ' => 'default ' ,
370+ 'destination ' => '/src/{{ spec.title | caseUcfirst }}/Models/OrderType.cs ' ,
337371 'template ' => 'dotnet/src/Appwrite/Models/OrderType.cs.twig ' ,
338372 ],
339373 [
340374 'scope ' => 'default ' ,
341- 'destination ' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/ Models/Rule .cs ' ,
342- 'template ' => 'dotnet/src/Appwrite/Models/Rule .cs.twig ' ,
375+ 'destination ' => '/src/ {{ spec.title | caseUcfirst }}/Models/UploadProgress .cs ' ,
376+ 'template ' => 'dotnet/src/Appwrite/Models/UploadProgress .cs.twig ' ,
343377 ],
344378 [
345379 'scope ' => 'default ' ,
346- 'destination ' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/ Models/Exception .cs ' ,
347- 'template ' => 'dotnet/src/Appwrite/Models/Exception .cs.twig ' ,
380+ 'destination ' => '/src/ {{ spec.title | caseUcfirst }}/Models/InputFile .cs ' ,
381+ 'template ' => 'dotnet/src/Appwrite/Models/InputFile .cs.twig ' ,
348382 ],
349383 [
350384 'scope ' => 'default ' ,
351- 'destination ' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite /Services/Service.cs ' ,
385+ 'destination ' => '/src/ {{ spec.title | caseUcfirst }}/Services/Service.cs ' ,
352386 'template ' => 'dotnet/src/Appwrite/Services/Service.cs.twig ' ,
353387 ],
354388 [
355389 'scope ' => 'service ' ,
356- 'destination ' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite /Services/{{service.name | caseUcfirst}}.cs ' ,
390+ 'destination ' => '/src/ {{ spec.title | caseUcfirst }}/Services/{{service.name | caseUcfirst}}.cs ' ,
357391 'template ' => 'dotnet/src/Appwrite/Services/ServiceTemplate.cs.twig ' ,
392+ ],
393+ [
394+ 'scope ' => 'definition ' ,
395+ 'destination ' => '/src/{{ spec.title | caseUcfirst }}/Models/{{ definition.name | caseUcfirst | overrideIdentifier }}.cs ' ,
396+ 'template ' => 'dotnet/src/Appwrite/Models/Model.cs.twig ' ,
358397 ]
359398 ];
360399 }
0 commit comments