Skip to content

Commit ca24837

Browse files
authored
Go SDK (#4134)
* [WIP] Kiota Go SDK * somehow working * cleaning up * just comments * fmt * Add a validation CI * added the release pipeline * add a minimal readme * minor * leftover * remove go and Python repo notifications
1 parent 9ccf356 commit ca24837

File tree

188 files changed

+22073
-1
lines changed

Some content is hidden

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

188 files changed

+22073
-1
lines changed

.github/workflows/release.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,23 @@ jobs:
140140
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
141141
if: github.event.inputs.skip-python-sdk == 'false'
142142

143+
- name: Go - Setup Go
144+
uses: actions/setup-go@v5
145+
if: github.event.inputs.skip-go-sdk == 'false'
146+
with:
147+
go-version: '1.20'
148+
149+
# Needs special tagging to use submodules: https://stackoverflow.com/a/64705638/7898052
150+
- name: Release Go SDK
151+
run: |
152+
cd registry
153+
git tag "v${{ github.event.inputs.release-version }}"
154+
git tag "go-sdk/v${{ github.event.inputs.release-version }}"
155+
git push origin "v${{ github.event.inputs.release-version }}"
156+
git push origin "go-sdk/v${{ github.event.inputs.release-version }}"
157+
GOPROXY=proxy.golang.org go list -m "github.com/apicurio/apicurio-registry@v${{ github.event.inputs.release-version }}"
158+
if: github.event.inputs.skip-go-sdk == 'false'
159+
143160
- name: Commit Release Version Change
144161
run: |
145162
cd registry

.github/workflows/verify.yaml

+27-1
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,39 @@ jobs:
340340
working-directory: python-sdk
341341
run: make test
342342

343+
build-verify-go-sdk:
344+
name: Verify Go SDK
345+
runs-on: ubuntu-20.04
346+
# if: github.repository_owner == 'Apicurio' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
347+
steps:
348+
- name: Checkout Code with Ref '${{ github.ref }}'
349+
uses: actions/checkout@v3
350+
351+
- name: Set up JDK 17
352+
uses: actions/setup-java@v3
353+
with:
354+
java-version: 17
355+
distribution: 'temurin'
356+
cache: 'maven'
357+
358+
- name: Go - Setup Go
359+
uses: actions/setup-go@v5
360+
with:
361+
go-version: '1.20'
362+
363+
- name: Build Registry
364+
run: mvn clean install -am -pl app -Dskip.npm -DskipTests=true --no-transfer-progress
365+
366+
- name: Run the tests
367+
working-directory: go-sdk
368+
run: make test
343369

344370
notify-sdk:
345371
if: github.repository_owner == 'Apicurio' && github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
346372
runs-on: ubuntu-20.04
347373
strategy:
348374
matrix:
349-
language: [ go, js, python ]
375+
language: [ js ]
350376
steps:
351377
- uses: actions/checkout@v3
352378

go-sdk/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kiota_tmp
2+
v2.json
3+
v3.json

go-sdk/Makefile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
.PHONY: clean
3+
clean:
4+
rm -rf kiota_tmp v2.json v3.json
5+
6+
.PHONY: generate
7+
generate:
8+
./generate.sh
9+
10+
.PHONY: test
11+
test:
12+
go test ./... -count=1
13+
14+
.PHONY: test
15+
format:
16+
go fmt ./...

go-sdk/Readme.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Apicurio Registry Go SDK
2+
3+
This is a generated SDK for easily interacting with Registry from a Go program.
4+
5+
## Install
6+
7+
You can install this package using `go get`:
8+
9+
```
10+
go get github.com/apicurio/apicurio-registry/go-sdk
11+
```
12+
13+
## Requirements
14+
15+
This package is built with [Go](https://go.dev/) `1.20+`.
16+
17+
## Generate
18+
19+
```
20+
make generate
21+
```
22+
23+
## Test
24+
25+
```
26+
make test
27+
```

go-sdk/generate.sh

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env bash
2+
3+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
4+
5+
SED_NAME="sed"
6+
PACKAGE_NAME="linux-x64"
7+
if [[ $OSTYPE == 'darwin'* ]]; then
8+
SED_NAME="gsed"
9+
PACKAGE_NAME="osx-x64"
10+
fi
11+
12+
# TODO move the kiota-version.csproj to it's own folder?
13+
VERSION=$(cat $SCRIPT_DIR/kiota-version.csproj | grep Version | sed -n 's/.*Version="\([^"]*\)".*/\1/p')
14+
URL="https://github.com/microsoft/kiota/releases/download/v${VERSION}/${PACKAGE_NAME}.zip"
15+
16+
# COMMAND="kiota"
17+
# if ! command -v $COMMAND &> /dev/null
18+
# then
19+
echo "System wide kiota could not be found, using local version"
20+
if [[ ! -f $SCRIPT_DIR/kiota_tmp/kiota ]]
21+
then
22+
echo "Local kiota could not be found, downloading"
23+
rm -rf $SCRIPT_DIR/kiota_tmp
24+
mkdir -p $SCRIPT_DIR/kiota_tmp
25+
curl -sL $URL > $SCRIPT_DIR/kiota_tmp/kiota.zip
26+
unzip $SCRIPT_DIR/kiota_tmp/kiota.zip -d $SCRIPT_DIR/kiota_tmp
27+
28+
chmod a+x $SCRIPT_DIR/kiota_tmp/kiota
29+
fi
30+
COMMAND="$SCRIPT_DIR/kiota_tmp/kiota"
31+
# fi
32+
33+
rm -rf $SCRIPT_DIR/pkg/registryclient-v2
34+
mkdir -p $SCRIPT_DIR/pkg/registryclient-v2
35+
rm -rf $SCRIPT_DIR/pkg/registryclient-v3
36+
mkdir -p $SCRIPT_DIR/pkg/registryclient-v3
37+
38+
cp $SCRIPT_DIR/../common/src/main/resources/META-INF/openapi-v2.json $SCRIPT_DIR/v2.json
39+
cp $SCRIPT_DIR/../common/src/main/resources/META-INF/openapi.json $SCRIPT_DIR/v3.json
40+
41+
# Hask to overcome https://github.com/microsoft/kiota/issues/3920
42+
$SED_NAME -i 's/NewComment/DTONewComment/' v2.json
43+
$SED_NAME -i 's/NewComment/DTONewComment/' v3.json
44+
45+
$COMMAND generate \
46+
--language go \
47+
--openapi $SCRIPT_DIR/v2.json \
48+
--clean-output \
49+
-o $SCRIPT_DIR/pkg/registryclient-v2 \
50+
--namespace-name github.com/apicurio/apicurio-registry/go-sdk/pkg/registryclient-v2
51+
52+
$COMMAND generate \
53+
--language go \
54+
--openapi $SCRIPT_DIR/v3.json \
55+
--clean-output \
56+
-o $SCRIPT_DIR/pkg/registryclient-v3 \
57+
--namespace-name github.com/apicurio/apicurio-registry/go-sdk/pkg/registryclient-v3

go-sdk/go.mod

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module github.com/apicurio/apicurio-registry/go-sdk
2+
3+
go 1.20
4+
5+
require (
6+
github.com/microsoft/kiota-abstractions-go v1.5.3
7+
github.com/microsoft/kiota-http-go v1.1.1
8+
github.com/microsoft/kiota-serialization-form-go v1.0.0
9+
github.com/microsoft/kiota-serialization-json-go v1.0.4
10+
github.com/microsoft/kiota-serialization-multipart-go v1.0.0
11+
github.com/microsoft/kiota-serialization-text-go v1.0.0
12+
github.com/stretchr/testify v1.8.4
13+
)
14+
15+
require (
16+
github.com/cjlapao/common-go v0.0.39 // indirect
17+
github.com/davecgh/go-spew v1.1.1 // indirect
18+
github.com/go-logr/logr v1.3.0 // indirect
19+
github.com/go-logr/stdr v1.2.2 // indirect
20+
github.com/google/uuid v1.4.0 // indirect
21+
github.com/pmezard/go-difflib v1.0.0 // indirect
22+
github.com/std-uritemplate/std-uritemplate/go v0.0.47 // indirect
23+
go.opentelemetry.io/otel v1.21.0 // indirect
24+
go.opentelemetry.io/otel/metric v1.21.0 // indirect
25+
go.opentelemetry.io/otel/trace v1.21.0 // indirect
26+
gopkg.in/yaml.v3 v3.0.1 // indirect
27+
)

go-sdk/go.sum

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
github.com/cjlapao/common-go v0.0.39 h1:bAAUrj2B9v0kMzbAOhzjSmiyDy+rd56r2sy7oEiQLlA=
2+
github.com/cjlapao/common-go v0.0.39/go.mod h1:M3dzazLjTjEtZJbbxoA5ZDiGCiHmpwqW9l4UWaddwOA=
3+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
4+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5+
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
6+
github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY=
7+
github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
8+
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
9+
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
10+
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
11+
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
12+
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
13+
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
14+
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
15+
github.com/microsoft/kiota-abstractions-go v1.5.3 h1:qUTwuXCbMi99EkHaTh5NGMK5MOKxJn7u/M2FbYcesLY=
16+
github.com/microsoft/kiota-abstractions-go v1.5.3/go.mod h1:xyBzTVCYrp7QBW4/p+RFi44PHwp/IPn2dZepuV4nF80=
17+
github.com/microsoft/kiota-http-go v1.1.1 h1:W4Olo7Z/MwNZCfkcvH/5eLhnn7koRBMMRhLEnf5MPKo=
18+
github.com/microsoft/kiota-http-go v1.1.1/go.mod h1:QzhhfW5xkoUuT+/ohflpHJvumWeXIxa/Xl0GmQ2M6mY=
19+
github.com/microsoft/kiota-serialization-form-go v1.0.0 h1:UNdrkMnLFqUCccQZerKjblsyVgifS11b3WCx+eFEsAI=
20+
github.com/microsoft/kiota-serialization-form-go v1.0.0/go.mod h1:h4mQOO6KVTNciMF6azi1J9QB19ujSw3ULKcSNyXXOMA=
21+
github.com/microsoft/kiota-serialization-json-go v1.0.4 h1:5TaISWwd2Me8clrK7SqNATo0tv9seOq59y4I5953egQ=
22+
github.com/microsoft/kiota-serialization-json-go v1.0.4/go.mod h1:rM4+FsAY+9AEpBsBzkFFis+b/LZLlNKKewuLwK9Q6Mg=
23+
github.com/microsoft/kiota-serialization-multipart-go v1.0.0 h1:3O5sb5Zj+moLBiJympbXNaeV07K0d46IfuEd5v9+pBs=
24+
github.com/microsoft/kiota-serialization-multipart-go v1.0.0/go.mod h1:yauLeBTpANk4L03XD985akNysG24SnRJGaveZf+p4so=
25+
github.com/microsoft/kiota-serialization-text-go v1.0.0 h1:XOaRhAXy+g8ZVpcq7x7a0jlETWnWrEum0RhmbYrTFnA=
26+
github.com/microsoft/kiota-serialization-text-go v1.0.0/go.mod h1:sM1/C6ecnQ7IquQOGUrUldaO5wj+9+v7G2W3sQ3fy6M=
27+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
28+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
29+
github.com/std-uritemplate/std-uritemplate/go v0.0.47 h1:erzz/DR4sOzWr0ca2MgSTkMckpLEsDySaTZwVFQq9zw=
30+
github.com/std-uritemplate/std-uritemplate/go v0.0.47/go.mod h1:Qov4Ay4U83j37XjgxMYevGJFLbnZ2o9cEOhGufBKgKY=
31+
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
32+
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
33+
go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc=
34+
go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo=
35+
go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4=
36+
go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM=
37+
go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc=
38+
go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ=
39+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
40+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
41+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
42+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

go-sdk/kiota-version.csproj

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<ItemGroup>
3+
<PackageReference Include="Microsoft.OpenApi.Kiota.Builder" Version="1.9.1" />
4+
</ItemGroup>
5+
</Project>
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Warning: KiotaBuilder OpenAPI warning: #/ - A servers entry (v3) or host + basePath + schemes properties (v2) was not present in the OpenAPI description. The root URL will need to be set manually with the request adapter.
2+
Warning: KiotaBuilder OpenAPI warning: #/paths/~1groups~1{groupId}~1artifacts~1{artifactId}/put/requestBody/content/*~1*/examples/OpenAPI Example/value - Data and type mismatch found.
3+
Warning: KiotaBuilder OpenAPI warning: #/paths/~1groups~1{groupId}~1artifacts/post/requestBody/content/*~1*/examples/OpenAPI Example/value - Data and type mismatch found.
4+
Warning: KiotaBuilder OpenAPI warning: #/paths/~1groups~1{groupId}~1artifacts~1{artifactId}~1versions/get/responses/200/content/application~1json/examples/All Versions/value - Data and type mismatch found.
5+
Warning: KiotaBuilder OpenAPI warning: #/paths/~1groups~1{groupId}~1artifacts~1{artifactId}~1versions/post/requestBody/content/*~1*/examples/OpenAPI Example/value - Data and type mismatch found.
6+
Warning: KiotaBuilder OpenAPI warning: #/paths/~1groups~1{groupId}~1artifacts~1{artifactId}~1meta/post/requestBody/content/*~1*/examples/OpenAPI/value - Data and type mismatch found.
7+
Warning: KiotaBuilder OpenAPI warning: #/components/schemas/ArtifactMetaData/example/references/0/version - Data and type mismatch found.
8+
Warning: KiotaBuilder OpenAPI warning: #/components/schemas/SearchedVersion/example/references - Data and type mismatch found.
9+
Warning: KiotaBuilder OpenAPI warning: #/components/responses/ArtifactContent/content/*~1*/examples/OpenAPI/value - Data and type mismatch found.
10+
Warning: KiotaBuilder No server url found in the OpenAPI document. The base url will need to be set when using the client.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package admin
2+
3+
import (
4+
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
5+
)
6+
7+
// AdminRequestBuilder builds and executes requests for operations under \admin
8+
type AdminRequestBuilder struct {
9+
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder
10+
}
11+
12+
// ArtifactTypes the list of artifact types supported by this instance of Registry.
13+
func (m *AdminRequestBuilder) ArtifactTypes() *ArtifactTypesRequestBuilder {
14+
return NewArtifactTypesRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)
15+
}
16+
17+
// Config the config property
18+
func (m *AdminRequestBuilder) Config() *ConfigRequestBuilder {
19+
return NewConfigRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)
20+
}
21+
22+
// NewAdminRequestBuilderInternal instantiates a new AdminRequestBuilder and sets the default values.
23+
func NewAdminRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *AdminRequestBuilder {
24+
m := &AdminRequestBuilder{
25+
BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/admin", pathParameters),
26+
}
27+
return m
28+
}
29+
30+
// NewAdminRequestBuilder instantiates a new AdminRequestBuilder and sets the default values.
31+
func NewAdminRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *AdminRequestBuilder {
32+
urlParams := make(map[string]string)
33+
urlParams["request-raw-url"] = rawUrl
34+
return NewAdminRequestBuilderInternal(urlParams, requestAdapter)
35+
}
36+
37+
// Export provides a way to export registry data.
38+
func (m *AdminRequestBuilder) Export() *ExportRequestBuilder {
39+
return NewExportRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)
40+
}
41+
42+
// ImportEscaped provides a way to import data into the registry.
43+
func (m *AdminRequestBuilder) ImportEscaped() *ImportRequestBuilder {
44+
return NewImportRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)
45+
}
46+
47+
// RoleMappings collection to manage role mappings for authenticated principals
48+
func (m *AdminRequestBuilder) RoleMappings() *RoleMappingsRequestBuilder {
49+
return NewRoleMappingsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)
50+
}
51+
52+
// Rules manage the global rules that apply to all artifacts if not otherwise configured.
53+
func (m *AdminRequestBuilder) Rules() *RulesRequestBuilder {
54+
return NewRulesRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)
55+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package admin
2+
3+
import (
4+
"context"
5+
i80228d093fd3b582ec81b86f113cc707692a60cdd08bae7a390086a8438c7543 "github.com/apicurio/apicurio-registry/go-sdk/pkg/registryclient-v2/models"
6+
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
7+
)
8+
9+
// ArtifactTypesRequestBuilder the list of artifact types supported by this instance of Registry.
10+
type ArtifactTypesRequestBuilder struct {
11+
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder
12+
}
13+
14+
// ArtifactTypesRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options.
15+
type ArtifactTypesRequestBuilderGetRequestConfiguration struct {
16+
// Request headers
17+
Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders
18+
// Request options
19+
Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption
20+
}
21+
22+
// NewArtifactTypesRequestBuilderInternal instantiates a new ArtifactTypesRequestBuilder and sets the default values.
23+
func NewArtifactTypesRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ArtifactTypesRequestBuilder {
24+
m := &ArtifactTypesRequestBuilder{
25+
BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/admin/artifactTypes", pathParameters),
26+
}
27+
return m
28+
}
29+
30+
// NewArtifactTypesRequestBuilder instantiates a new ArtifactTypesRequestBuilder and sets the default values.
31+
func NewArtifactTypesRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ArtifactTypesRequestBuilder {
32+
urlParams := make(map[string]string)
33+
urlParams["request-raw-url"] = rawUrl
34+
return NewArtifactTypesRequestBuilderInternal(urlParams, requestAdapter)
35+
}
36+
37+
// Get gets a list of all the configured artifact types.This operation can fail for the following reasons:* A server error occurred (HTTP error `500`)
38+
func (m *ArtifactTypesRequestBuilder) Get(ctx context.Context, requestConfiguration *ArtifactTypesRequestBuilderGetRequestConfiguration) ([]i80228d093fd3b582ec81b86f113cc707692a60cdd08bae7a390086a8438c7543.ArtifactTypeInfoable, error) {
39+
requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration)
40+
if err != nil {
41+
return nil, err
42+
}
43+
errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{
44+
"500": i80228d093fd3b582ec81b86f113cc707692a60cdd08bae7a390086a8438c7543.CreateErrorFromDiscriminatorValue,
45+
}
46+
res, err := m.BaseRequestBuilder.RequestAdapter.SendCollection(ctx, requestInfo, i80228d093fd3b582ec81b86f113cc707692a60cdd08bae7a390086a8438c7543.CreateArtifactTypeInfoFromDiscriminatorValue, errorMapping)
47+
if err != nil {
48+
return nil, err
49+
}
50+
val := make([]i80228d093fd3b582ec81b86f113cc707692a60cdd08bae7a390086a8438c7543.ArtifactTypeInfoable, len(res))
51+
for i, v := range res {
52+
if v != nil {
53+
val[i] = v.(i80228d093fd3b582ec81b86f113cc707692a60cdd08bae7a390086a8438c7543.ArtifactTypeInfoable)
54+
}
55+
}
56+
return val, nil
57+
}
58+
59+
// ToGetRequestInformation gets a list of all the configured artifact types.This operation can fail for the following reasons:* A server error occurred (HTTP error `500`)
60+
func (m *ArtifactTypesRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *ArtifactTypesRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {
61+
requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters)
62+
if requestConfiguration != nil {
63+
requestInfo.Headers.AddAll(requestConfiguration.Headers)
64+
requestInfo.AddRequestOptions(requestConfiguration.Options)
65+
}
66+
requestInfo.Headers.TryAdd("Accept", "application/json")
67+
return requestInfo, nil
68+
}
69+
70+
// WithUrl returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.
71+
func (m *ArtifactTypesRequestBuilder) WithUrl(rawUrl string) *ArtifactTypesRequestBuilder {
72+
return NewArtifactTypesRequestBuilder(rawUrl, m.BaseRequestBuilder.RequestAdapter)
73+
}

0 commit comments

Comments
 (0)