@@ -129,7 +129,8 @@ public function getKeywords(): array
129129 'when ' ,
130130 'where ' ,
131131 'while ' ,
132- 'yield '
132+ 'yield ' ,
133+ 'path '
133134 ];
134135 }
135136
@@ -139,23 +140,26 @@ public function getKeywords(): array
139140 public function getIdentifierOverrides (): array
140141 {
141142 return [
142- 'Jwt ' => 'JWT '
143+ 'Jwt ' => 'JWT ' ,
144+ 'Domain ' => 'XDomain ' ,
143145 ];
144146 }
145147
146148 /**
147- * @param $type
149+ * @param array $parameter
148150 * @return string
149151 */
150152 public function getTypeName (array $ parameter ): string
151153 {
152154 switch ($ parameter ['type ' ]) {
153155 case self ::TYPE_INTEGER :
154- return 'int ' ;
156+ return 'long ' ;
157+ case self ::TYPE_NUMBER :
158+ return 'double ' ;
155159 case self ::TYPE_STRING :
156160 return 'string ' ;
157161 case self ::TYPE_FILE :
158- return 'FileInfo ' ;
162+ return 'InputFile ' ;
159163 case self ::TYPE_BOOLEAN :
160164 return 'bool ' ;
161165 case self ::TYPE_ARRAY :
@@ -233,7 +237,7 @@ public function getParamExample(array $param): string
233237 if (empty ($ example ) && $ example !== 0 && $ example !== false ) {
234238 switch ($ type ) {
235239 case self ::TYPE_FILE :
236- $ output .= 'new File ("./path-to-files/image.jpg") ' ;
240+ $ output .= 'InputFile.FromPath ("./path-to-files/image.jpg") ' ;
237241 break ;
238242 case self ::TYPE_NUMBER :
239243 case self ::TYPE_INTEGER :
@@ -249,7 +253,13 @@ public function getParamExample(array $param): string
249253 $ output .= '[object] ' ;
250254 break ;
251255 case self ::TYPE_ARRAY :
252- $ output .= '[List<object>] ' ;
256+ if (\str_starts_with ($ example , '[ ' )) {
257+ $ example = \substr ($ example , 1 );
258+ }
259+ if (\str_ends_with ($ example , '] ' )) {
260+ $ example = \substr ($ example , 0 , -1 );
261+ }
262+ $ output .= 'new List< ' . $ this ->getTypeName ($ param ['array ' ]) . '> { ' . $ example . '} ' ;
253263 break ;
254264 }
255265 } else {
@@ -283,23 +293,28 @@ public function getFiles(): array
283293 return [
284294 [
285295 'scope ' => 'default ' ,
286- 'destination ' => 'README.md ' ,
287- 'template ' => 'dotnet/README.md .twig ' ,
296+ 'destination ' => '.travis.yml ' ,
297+ 'template ' => 'dotnet/.travis.yml .twig ' ,
288298 ],
289299 [
290300 'scope ' => 'default ' ,
291301 'destination ' => 'CHANGELOG.md ' ,
292302 'template ' => 'dotnet/CHANGELOG.md.twig ' ,
293303 ],
304+ [
305+ 'scope ' => 'copy ' ,
306+ 'destination ' => '/icon.png ' ,
307+ 'template ' => 'dotnet/icon.png ' ,
308+ ],
294309 [
295310 'scope ' => 'default ' ,
296311 'destination ' => 'LICENSE ' ,
297312 'template ' => 'dotnet/LICENSE.twig ' ,
298313 ],
299314 [
300315 'scope ' => 'default ' ,
301- 'destination ' => '.travis.yml ' ,
302- 'template ' => 'dotnet/.travis.yml .twig ' ,
316+ 'destination ' => 'README.md ' ,
317+ 'template ' => 'dotnet/README.md .twig ' ,
303318 ],
304319 [
305320 'scope ' => 'method ' ,
@@ -308,53 +323,78 @@ public function getFiles(): array
308323 ],
309324 [
310325 'scope ' => 'default ' ,
311- 'destination ' => '/src/Appwrite .sln ' ,
326+ 'destination ' => '/src/{{ spec.title | caseUcfirst }} .sln ' ,
312327 'template ' => 'dotnet/src/Appwrite.sln ' ,
313328 ],
314- [
315- 'scope ' => 'copy ' ,
316- 'destination ' => '/icon.png ' ,
317- 'template ' => 'dotnet/icon.png ' ,
318- ],
319329 [
320330 'scope ' => 'default ' ,
321- 'destination ' => '/src/Appwrite/Appwrite .csproj ' ,
331+ 'destination ' => '/src/{{ spec.title | caseUcfirst }}/{{ spec.title | caseUcfirst }} .csproj ' ,
322332 'template ' => 'dotnet/src/Appwrite/Appwrite.csproj.twig ' ,
323333 ],
324334 [
325335 'scope ' => 'default ' ,
326- 'destination ' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite /Client.cs ' ,
336+ 'destination ' => '/src/ {{ spec.title | caseUcfirst }}/Client.cs ' ,
327337 'template ' => 'dotnet/src/Appwrite/Client.cs.twig ' ,
328338 ],
329339 [
330340 'scope ' => 'default ' ,
331- 'destination ' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/Helpers/ExtensionMethods .cs ' ,
332- 'template ' => 'dotnet/src/Appwrite/Helpers/ExtensionMethods .cs ' ,
341+ 'destination ' => '/src/ {{ spec.title | caseUcfirst }}/{{ spec.title | caseUcfirst }}Exception .cs ' ,
342+ 'template ' => 'dotnet/src/Appwrite/Exception .cs.twig ' ,
333343 ],
334344 [
335345 'scope ' => 'default ' ,
336- 'destination ' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/Models/OrderType.cs ' ,
346+ 'destination ' => '/src/{{ spec.title | caseUcfirst }}/ID.cs ' ,
347+ 'template ' => 'dotnet/src/Appwrite/ID.cs.twig ' ,
348+ ],
349+ [
350+ 'scope ' => 'default ' ,
351+ 'destination ' => '/src/{{ spec.title | caseUcfirst }}/Permission.cs ' ,
352+ 'template ' => 'dotnet/src/Appwrite/Permission.cs.twig ' ,
353+ ],
354+ [
355+ 'scope ' => 'default ' ,
356+ 'destination ' => '/src/{{ spec.title | caseUcfirst }}/Query.cs ' ,
357+ 'template ' => 'dotnet/src/Appwrite/Query.cs.twig ' ,
358+ ],
359+ [
360+ 'scope ' => 'default ' ,
361+ 'destination ' => '/src/{{ spec.title | caseUcfirst }}/Role.cs ' ,
362+ 'template ' => 'dotnet/src/Appwrite/Role.cs.twig ' ,
363+ ],
364+ [
365+ 'scope ' => 'default ' ,
366+ 'destination ' => '/src/{{ spec.title | caseUcfirst }}/Extensions/Extensions.cs ' ,
367+ 'template ' => 'dotnet/src/Appwrite/Extensions/Extensions.cs.twig ' ,
368+ ],
369+ [
370+ 'scope ' => 'default ' ,
371+ 'destination ' => '/src/{{ spec.title | caseUcfirst }}/Models/OrderType.cs ' ,
337372 'template ' => 'dotnet/src/Appwrite/Models/OrderType.cs.twig ' ,
338373 ],
339374 [
340375 'scope ' => 'default ' ,
341- 'destination ' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/ Models/Rule .cs ' ,
342- 'template ' => 'dotnet/src/Appwrite/Models/Rule .cs.twig ' ,
376+ 'destination ' => '/src/ {{ spec.title | caseUcfirst }}/Models/UploadProgress .cs ' ,
377+ 'template ' => 'dotnet/src/Appwrite/Models/UploadProgress .cs.twig ' ,
343378 ],
344379 [
345380 'scope ' => 'default ' ,
346- 'destination ' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/ Models/Exception .cs ' ,
347- 'template ' => 'dotnet/src/Appwrite/Models/Exception .cs.twig ' ,
381+ 'destination ' => '/src/ {{ spec.title | caseUcfirst }}/Models/InputFile .cs ' ,
382+ 'template ' => 'dotnet/src/Appwrite/Models/InputFile .cs.twig ' ,
348383 ],
349384 [
350385 'scope ' => 'default ' ,
351- 'destination ' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite /Services/Service.cs ' ,
386+ 'destination ' => '/src/ {{ spec.title | caseUcfirst }}/Services/Service.cs ' ,
352387 'template ' => 'dotnet/src/Appwrite/Services/Service.cs.twig ' ,
353388 ],
354389 [
355390 'scope ' => 'service ' ,
356- 'destination ' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite /Services/{{service.name | caseUcfirst}}.cs ' ,
391+ 'destination ' => '/src/ {{ spec.title | caseUcfirst }}/Services/{{service.name | caseUcfirst}}.cs ' ,
357392 'template ' => 'dotnet/src/Appwrite/Services/ServiceTemplate.cs.twig ' ,
393+ ],
394+ [
395+ 'scope ' => 'definition ' ,
396+ 'destination ' => '/src/{{ spec.title | caseUcfirst }}/Models/{{ definition.name | caseUcfirst | overrideIdentifier }}.cs ' ,
397+ 'template ' => 'dotnet/src/Appwrite/Models/Model.cs.twig ' ,
358398 ]
359399 ];
360400 }
0 commit comments