Skip to content

Instantly share code, notes, and snippets.

@pjmagee
Created May 1, 2024 07:46
Show Gist options
  • Save pjmagee/bb9bb0c561dab5a0a2e02833e3d36ba0 to your computer and use it in GitHub Desktop.
Save pjmagee/bb9bb0c561dab5a0a2e02833e3d36ba0 to your computer and use it in GitHub Desktop.
class Spec {
[string]$url
[string]$product
Spec([string]$url, [string]$product) {
$this.url = $url
$this.product = $product
}
}
$languages = @{
"CSharp" = "Api.Icis.Com";
"Go" = "api.icis.com";
"Java" = "com.icis.api";
"Python" = "api_icis_com";
}
$specs = @(
[Spec]::new("https://developer.icis.com/portals/api/sites/icis-live-portal/liveportal/apis/energyapi/download_spec", "energy"),
[Spec]::new("https://developer.icis.com/portals/api/sites/icis-live-portal/liveportal/apis/energyforesightapi/download_spec", "energyforesight"),
[Spec]::new("https://developer.icis.com/portals/api/sites/icis-live-portal/liveportal/apis/lnganalyticsapi/download_spec", "lnganalytics")
)
foreach ($spec in $specs) {
foreach ($language in $languages.Keys) {
$namespace = "$($languages[$language]).$($spec.product)"
Write-host "Generating $language client for $($spec.product) with namespace $namespace"
docker run -v ${PWD}:/app/output mcr.microsoft.com/openapi/kiota generate --language $language -n $namespace --openapi $($spec.url) --co --output /app/output/$language/$($spec.product)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment