-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate-client.ps1
26 lines (25 loc) · 1.1 KB
/
generate-client.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright Laserfiche.
# Licensed under the MIT License. See LICENSE in the project root for license information.
# Generate the client
nswag run apiserver-nswag.json
nswag run oauth-nswag.json
# Remove long namespaces from class names in the generated client
$client_filepaths = @("./src/APIServer/TokenClient.cs", "./src/OAuth/OAuthClient.cs")
foreach ( $client_filepath in $client_filepaths )
{
(Get-Content $client_filepath) `
-replace "System\.CodeDom\.Compiler\.","" `
-replace "System\.Collections\.Generic\.","" `
-replace "System\.Globalization\.","" `
-replace "System\.IO\.","" `
-replace "System\.Linq\.","" `
-replace "System\.Net\.Http\.Headers\.","" `
-replace "System\.Net\.Http\.(?![\w\.]+;)","" `
-replace "System\.Runtime\.Serialization\.","" `
-replace "System\.Reflection\.","" `
-replace "System\.Text\.","" `
-replace "System\.Threading\.Tasks\.","" `
-replace "System\.Threading\.CancellationToken","CancellationToken" `
-replace "System\.(?![\w\.]+;)","" `
| Out-File $client_filepath
}