|
| 1 | +function Await-Task { |
| 2 | + param ( |
| 3 | + [Parameter(ValueFromPipeline=$true, Mandatory=$true)] |
| 4 | + $task |
| 5 | + ) |
| 6 | + |
| 7 | + process { |
| 8 | + while (-not $task.AsyncWaitHandle.WaitOne(200)) { } |
| 9 | + $task.GetAwaiter().GetResult() |
| 10 | + } |
| 11 | +} |
| 12 | + |
| 13 | +function Print-Response { |
| 14 | + param ( |
| 15 | + $response |
| 16 | + ) |
| 17 | + Write-Host ($response.Content.ReadAsStringAsync().Result | ConvertFrom-Json).result |
| 18 | +} |
| 19 | + |
| 20 | +Add-Type -Path "/app/tests/sdks/csharp/src/test/Appwrite.dll" | Out-Null |
| 21 | + |
| 22 | +$client = New-Object Appwrite.Client |
| 23 | +$foo = New-Object Appwrite.Foo -ArgumentList $client |
| 24 | +$bar = New-Object Appwrite.Bar -ArgumentList $client |
| 25 | +$general = New-Object Appwrite.General -ArgumentList $client |
| 26 | + |
| 27 | +$list = $("string in array") |
| 28 | +$response = $foo.get("string", 123, $list) | Await-Task |
| 29 | +Print-Response $response |
| 30 | + |
| 31 | +$response = $foo.post("string", 123, $list) | Await-Task |
| 32 | +Print-Response $response |
| 33 | + |
| 34 | +$response = $foo.put("string", 123, $list) | Await-Task |
| 35 | +Print-Response $response |
| 36 | + |
| 37 | +$response = $foo.patch("string", 123, $list) | Await-Task |
| 38 | +Print-Response $response |
| 39 | + |
| 40 | +$response = $foo.delete("string", 123, $list) | Await-Task |
| 41 | +Print-Response $response |
| 42 | + |
| 43 | +$response = $bar.get("string", 123, $list) | Await-Task |
| 44 | +Print-Response $response |
| 45 | + |
| 46 | +$response = $bar.post("string", 123, $list) | Await-Task |
| 47 | +Print-Response $response |
| 48 | + |
| 49 | +$response = $bar.put("string", 123, $list) | Await-Task |
| 50 | +Print-Response $response |
| 51 | + |
| 52 | +$response = $bar.patch("string", 123, $list) | Await-Task |
| 53 | +Print-Response $response |
| 54 | + |
| 55 | +$response = $bar.delete("string", 123, $list) | Await-Task |
| 56 | +Print-Response $response |
| 57 | + |
| 58 | +$response = $general.Redirect() | Await-Task |
| 59 | +Print-Response $response |
0 commit comments