Skip to content

Commit 8b801ef

Browse files
committed
Inital commit
0 parents  commit 8b801ef

File tree

5,844 files changed

+885635
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,844 files changed

+885635
-0
lines changed

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "pip" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"

.github/scripts/generate.ps1

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
2+
# Clean up
3+
4+
$generatedFilesPath = "./.openapi-generator/FILES"
5+
6+
if (Test-Path -Path $generatedFilesPath) {
7+
$generatedFiles = Get-Content -Path $generatedFilesPath
8+
9+
foreach ($generatedFile in $generatedFiles) {
10+
$generatedFile = $generatedFile.Trim()
11+
12+
if ($generatedFile -in '.gitignore', '.openapi-generator-ignore', 'README.md', '.github') {
13+
continue
14+
}
15+
16+
if (Test-Path -Path $generatedFile) {
17+
Remove-Item -Path $generatedFile -Force
18+
}
19+
}
20+
}
21+
22+
# Download generator
23+
24+
if (-Not (Test-Path -Path "./.openapi-generator/openapi-generator-cli.jar")) {
25+
$xmlString = Invoke-WebRequest -Uri "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/maven-metadata.xml" -UseBasicParsing
26+
27+
if (-Not $xmlString) {
28+
Write-Host "Unable to fetch XML metadata."
29+
exit
30+
}
31+
32+
$xml = [xml]$xmlString.Content
33+
$latestVersion = $xml.metadata.versioning.latest
34+
$latestVersionUrl = "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/$latestVersion/openapi-generator-cli-$latestVersion.jar"
35+
36+
Invoke-WebRequest -Uri $latestVersionUrl -OutFile "./.openapi-generator/openapi-generator-cli.jar"
37+
}
38+
39+
# Check Java
40+
41+
$output = & java -version 2>&1
42+
if ($output -match "java version" -or $output -match "openjdk version") {
43+
Write-Host "Java version: $output"
44+
} else {
45+
Write-Host "Java is not found."
46+
exit 1
47+
}
48+
49+
# Check Generator Version
50+
51+
$output = & java -jar .\.openapi-generator\openapi-generator-cli.jar version 2>&1
52+
if ($output -match "$latestVersion") {
53+
Write-Host "OpenAPI Generator version: $output"
54+
} else {
55+
Write-Host "Unable to verify OpenAPI Generator version"
56+
exit 1
57+
}
58+
59+
# Generate
60+
61+
java -jar ./.openapi-generator/openapi-generator-cli.jar generate `
62+
--input-spec "./.github/specs/openapi.yml" `
63+
--generator-name "python" `
64+
--output ./ `
65+
--enable-post-process-file `
66+
--skip-validate-spec `
67+
--git-host "github.com" `
68+
--git-repo-id "cpanel-python" `
69+
--git-user-id "client-api" `
70+
--package-name "clientapi_cpanel" `
71+
--additional-properties "packageName=clientapi_cpanel,packageUrl=https://github.com/client-api/cpanel-python,packageVersion=0.1.1,projectName=clientapi-cpanel,useOneOfDiscriminatorLookup=true"
72+
73+
if ($LASTEXITCODE -eq 0) {
74+
Write-Host "Done"
75+
} else {
76+
Write-Host "Failed"
77+
}

.github/scripts/generate.sh

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/usr/bin/env bash
2+
3+
# Clean up
4+
5+
generated_files_path="./.openapi-generator/FILES"
6+
7+
if [ -f "$generated_files_path" ]; then
8+
while IFS= read -r generated_file; do
9+
10+
generated_file="$(echo "$generated_file" | tr -d '\r\n')"
11+
12+
if [[ "$generated_file" == ".gitignore" || "$generated_file" == ".openapi-generator-ignore" || "$generated_file" == "README.md" || "$generated_file" == ".github" ]]; then
13+
continue
14+
fi
15+
16+
if [ -f "$generated_file" ]; then
17+
rm -f "$generated_file"
18+
fi
19+
done < "$generated_files_path"
20+
fi
21+
22+
# Download generator
23+
24+
if [ ! -f "./.openapi-generator/openapi-generator-cli.jar" ]; then
25+
xml_string=$(curl -s "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/maven-metadata.xml")
26+
27+
if [ -z "$xml_string" ]; then
28+
echo "Unable to fetch XML metadata."
29+
exit 1
30+
fi
31+
32+
latest_version=$(echo "$xml_string" | grep -oPm1 "(?<=<latest>)[^<]+")
33+
latest_version_url="https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/${latest_version}/openapi-generator-cli-${latest_version}.jar"
34+
35+
curl -o "./.openapi-generator/openapi-generator-cli.jar" "$latest_version_url"
36+
fi
37+
38+
# Check Java
39+
40+
output=$(java -version 2>&1)
41+
if [[ "$output" == *"java version"* || "$output" == *"openjdk version"* ]]; then
42+
echo "Java version: $output"
43+
else
44+
echo "Java is not found."
45+
exit 1
46+
fi
47+
48+
# Check Generator Version
49+
50+
output=$(java -jar ./.openapi-generator/openapi-generator-cli.jar version)
51+
if [[ "$output" == "$latest_version" ]]; then
52+
echo "OpenAPI Generator version: $output"
53+
else
54+
echo "Unable to verify OpenAPI Generator version"
55+
exit 1
56+
fi
57+
58+
# Generate
59+
60+
java -jar ./.openapi-generator/openapi-generator-cli.jar generate \
61+
--input-spec "./.github/specs/openapi.yml" \
62+
--generator-name "python" \
63+
--output ./ \
64+
--enable-post-process-file \
65+
--skip-validate-spec \
66+
--git-host "github.com" \
67+
--git-repo-id "cpanel-python" \
68+
--git-user-id "client-api" \
69+
--package-name "clientapi_cpanel" \
70+
--additional-properties "packageName=clientapi_cpanel,packageUrl=https://github.com/client-api/cpanel-python,packageVersion=0.1.0,projectName=clientapi-cpanel"
71+
72+
# Check if the command was successful
73+
if [ $? -eq 0 ]; then
74+
echo "Done"
75+
exit 0
76+
else
77+
echo "Failed"
78+
exit 1
79+
fi

0 commit comments

Comments
 (0)