forked from Apicurio/apicurio-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [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
- Loading branch information
Showing
188 changed files
with
22,073 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
kiota_tmp | ||
v2.json | ||
v3.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf kiota_tmp v2.json v3.json | ||
|
||
.PHONY: generate | ||
generate: | ||
./generate.sh | ||
|
||
.PHONY: test | ||
test: | ||
go test ./... -count=1 | ||
|
||
.PHONY: test | ||
format: | ||
go fmt ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Apicurio Registry Go SDK | ||
|
||
This is a generated SDK for easily interacting with Registry from a Go program. | ||
|
||
## Install | ||
|
||
You can install this package using `go get`: | ||
|
||
``` | ||
go get github.com/apicurio/apicurio-registry/go-sdk | ||
``` | ||
|
||
## Requirements | ||
|
||
This package is built with [Go](https://go.dev/) `1.20+`. | ||
|
||
## Generate | ||
|
||
``` | ||
make generate | ||
``` | ||
|
||
## Test | ||
|
||
``` | ||
make test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
SED_NAME="sed" | ||
PACKAGE_NAME="linux-x64" | ||
if [[ $OSTYPE == 'darwin'* ]]; then | ||
SED_NAME="gsed" | ||
PACKAGE_NAME="osx-x64" | ||
fi | ||
|
||
# TODO move the kiota-version.csproj to it's own folder? | ||
VERSION=$(cat $SCRIPT_DIR/kiota-version.csproj | grep Version | sed -n 's/.*Version="\([^"]*\)".*/\1/p') | ||
URL="https://github.com/microsoft/kiota/releases/download/v${VERSION}/${PACKAGE_NAME}.zip" | ||
|
||
# COMMAND="kiota" | ||
# if ! command -v $COMMAND &> /dev/null | ||
# then | ||
echo "System wide kiota could not be found, using local version" | ||
if [[ ! -f $SCRIPT_DIR/kiota_tmp/kiota ]] | ||
then | ||
echo "Local kiota could not be found, downloading" | ||
rm -rf $SCRIPT_DIR/kiota_tmp | ||
mkdir -p $SCRIPT_DIR/kiota_tmp | ||
curl -sL $URL > $SCRIPT_DIR/kiota_tmp/kiota.zip | ||
unzip $SCRIPT_DIR/kiota_tmp/kiota.zip -d $SCRIPT_DIR/kiota_tmp | ||
|
||
chmod a+x $SCRIPT_DIR/kiota_tmp/kiota | ||
fi | ||
COMMAND="$SCRIPT_DIR/kiota_tmp/kiota" | ||
# fi | ||
|
||
rm -rf $SCRIPT_DIR/pkg/registryclient-v2 | ||
mkdir -p $SCRIPT_DIR/pkg/registryclient-v2 | ||
rm -rf $SCRIPT_DIR/pkg/registryclient-v3 | ||
mkdir -p $SCRIPT_DIR/pkg/registryclient-v3 | ||
|
||
cp $SCRIPT_DIR/../common/src/main/resources/META-INF/openapi-v2.json $SCRIPT_DIR/v2.json | ||
cp $SCRIPT_DIR/../common/src/main/resources/META-INF/openapi.json $SCRIPT_DIR/v3.json | ||
|
||
# Hask to overcome https://github.com/microsoft/kiota/issues/3920 | ||
$SED_NAME -i 's/NewComment/DTONewComment/' v2.json | ||
$SED_NAME -i 's/NewComment/DTONewComment/' v3.json | ||
|
||
$COMMAND generate \ | ||
--language go \ | ||
--openapi $SCRIPT_DIR/v2.json \ | ||
--clean-output \ | ||
-o $SCRIPT_DIR/pkg/registryclient-v2 \ | ||
--namespace-name github.com/apicurio/apicurio-registry/go-sdk/pkg/registryclient-v2 | ||
|
||
$COMMAND generate \ | ||
--language go \ | ||
--openapi $SCRIPT_DIR/v3.json \ | ||
--clean-output \ | ||
-o $SCRIPT_DIR/pkg/registryclient-v3 \ | ||
--namespace-name github.com/apicurio/apicurio-registry/go-sdk/pkg/registryclient-v3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module github.com/apicurio/apicurio-registry/go-sdk | ||
|
||
go 1.20 | ||
|
||
require ( | ||
github.com/microsoft/kiota-abstractions-go v1.5.3 | ||
github.com/microsoft/kiota-http-go v1.1.1 | ||
github.com/microsoft/kiota-serialization-form-go v1.0.0 | ||
github.com/microsoft/kiota-serialization-json-go v1.0.4 | ||
github.com/microsoft/kiota-serialization-multipart-go v1.0.0 | ||
github.com/microsoft/kiota-serialization-text-go v1.0.0 | ||
github.com/stretchr/testify v1.8.4 | ||
) | ||
|
||
require ( | ||
github.com/cjlapao/common-go v0.0.39 // indirect | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/go-logr/logr v1.3.0 // indirect | ||
github.com/go-logr/stdr v1.2.2 // indirect | ||
github.com/google/uuid v1.4.0 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
github.com/std-uritemplate/std-uritemplate/go v0.0.47 // indirect | ||
go.opentelemetry.io/otel v1.21.0 // indirect | ||
go.opentelemetry.io/otel/metric v1.21.0 // indirect | ||
go.opentelemetry.io/otel/trace v1.21.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
github.com/cjlapao/common-go v0.0.39 h1:bAAUrj2B9v0kMzbAOhzjSmiyDy+rd56r2sy7oEiQLlA= | ||
github.com/cjlapao/common-go v0.0.39/go.mod h1:M3dzazLjTjEtZJbbxoA5ZDiGCiHmpwqW9l4UWaddwOA= | ||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= | ||
github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= | ||
github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= | ||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= | ||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= | ||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= | ||
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= | ||
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= | ||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= | ||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= | ||
github.com/microsoft/kiota-abstractions-go v1.5.3 h1:qUTwuXCbMi99EkHaTh5NGMK5MOKxJn7u/M2FbYcesLY= | ||
github.com/microsoft/kiota-abstractions-go v1.5.3/go.mod h1:xyBzTVCYrp7QBW4/p+RFi44PHwp/IPn2dZepuV4nF80= | ||
github.com/microsoft/kiota-http-go v1.1.1 h1:W4Olo7Z/MwNZCfkcvH/5eLhnn7koRBMMRhLEnf5MPKo= | ||
github.com/microsoft/kiota-http-go v1.1.1/go.mod h1:QzhhfW5xkoUuT+/ohflpHJvumWeXIxa/Xl0GmQ2M6mY= | ||
github.com/microsoft/kiota-serialization-form-go v1.0.0 h1:UNdrkMnLFqUCccQZerKjblsyVgifS11b3WCx+eFEsAI= | ||
github.com/microsoft/kiota-serialization-form-go v1.0.0/go.mod h1:h4mQOO6KVTNciMF6azi1J9QB19ujSw3ULKcSNyXXOMA= | ||
github.com/microsoft/kiota-serialization-json-go v1.0.4 h1:5TaISWwd2Me8clrK7SqNATo0tv9seOq59y4I5953egQ= | ||
github.com/microsoft/kiota-serialization-json-go v1.0.4/go.mod h1:rM4+FsAY+9AEpBsBzkFFis+b/LZLlNKKewuLwK9Q6Mg= | ||
github.com/microsoft/kiota-serialization-multipart-go v1.0.0 h1:3O5sb5Zj+moLBiJympbXNaeV07K0d46IfuEd5v9+pBs= | ||
github.com/microsoft/kiota-serialization-multipart-go v1.0.0/go.mod h1:yauLeBTpANk4L03XD985akNysG24SnRJGaveZf+p4so= | ||
github.com/microsoft/kiota-serialization-text-go v1.0.0 h1:XOaRhAXy+g8ZVpcq7x7a0jlETWnWrEum0RhmbYrTFnA= | ||
github.com/microsoft/kiota-serialization-text-go v1.0.0/go.mod h1:sM1/C6ecnQ7IquQOGUrUldaO5wj+9+v7G2W3sQ3fy6M= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/std-uritemplate/std-uritemplate/go v0.0.47 h1:erzz/DR4sOzWr0ca2MgSTkMckpLEsDySaTZwVFQq9zw= | ||
github.com/std-uritemplate/std-uritemplate/go v0.0.47/go.mod h1:Qov4Ay4U83j37XjgxMYevGJFLbnZ2o9cEOhGufBKgKY= | ||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= | ||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= | ||
go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= | ||
go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= | ||
go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= | ||
go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= | ||
go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= | ||
go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= | ||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= | ||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.OpenApi.Kiota.Builder" Version="1.9.1" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
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. | ||
Warning: KiotaBuilder OpenAPI warning: #/paths/~1groups~1{groupId}~1artifacts~1{artifactId}/put/requestBody/content/*~1*/examples/OpenAPI Example/value - Data and type mismatch found. | ||
Warning: KiotaBuilder OpenAPI warning: #/paths/~1groups~1{groupId}~1artifacts/post/requestBody/content/*~1*/examples/OpenAPI Example/value - Data and type mismatch found. | ||
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. | ||
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. | ||
Warning: KiotaBuilder OpenAPI warning: #/paths/~1groups~1{groupId}~1artifacts~1{artifactId}~1meta/post/requestBody/content/*~1*/examples/OpenAPI/value - Data and type mismatch found. | ||
Warning: KiotaBuilder OpenAPI warning: #/components/schemas/ArtifactMetaData/example/references/0/version - Data and type mismatch found. | ||
Warning: KiotaBuilder OpenAPI warning: #/components/schemas/SearchedVersion/example/references - Data and type mismatch found. | ||
Warning: KiotaBuilder OpenAPI warning: #/components/responses/ArtifactContent/content/*~1*/examples/OpenAPI/value - Data and type mismatch found. | ||
Warning: KiotaBuilder No server url found in the OpenAPI document. The base url will need to be set when using the client. |
55 changes: 55 additions & 0 deletions
55
go-sdk/pkg/registryclient-v2/admin/admin_request_builder.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package admin | ||
|
||
import ( | ||
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" | ||
) | ||
|
||
// AdminRequestBuilder builds and executes requests for operations under \admin | ||
type AdminRequestBuilder struct { | ||
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder | ||
} | ||
|
||
// ArtifactTypes the list of artifact types supported by this instance of Registry. | ||
func (m *AdminRequestBuilder) ArtifactTypes() *ArtifactTypesRequestBuilder { | ||
return NewArtifactTypesRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) | ||
} | ||
|
||
// Config the config property | ||
func (m *AdminRequestBuilder) Config() *ConfigRequestBuilder { | ||
return NewConfigRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) | ||
} | ||
|
||
// NewAdminRequestBuilderInternal instantiates a new AdminRequestBuilder and sets the default values. | ||
func NewAdminRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *AdminRequestBuilder { | ||
m := &AdminRequestBuilder{ | ||
BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/admin", pathParameters), | ||
} | ||
return m | ||
} | ||
|
||
// NewAdminRequestBuilder instantiates a new AdminRequestBuilder and sets the default values. | ||
func NewAdminRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *AdminRequestBuilder { | ||
urlParams := make(map[string]string) | ||
urlParams["request-raw-url"] = rawUrl | ||
return NewAdminRequestBuilderInternal(urlParams, requestAdapter) | ||
} | ||
|
||
// Export provides a way to export registry data. | ||
func (m *AdminRequestBuilder) Export() *ExportRequestBuilder { | ||
return NewExportRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) | ||
} | ||
|
||
// ImportEscaped provides a way to import data into the registry. | ||
func (m *AdminRequestBuilder) ImportEscaped() *ImportRequestBuilder { | ||
return NewImportRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) | ||
} | ||
|
||
// RoleMappings collection to manage role mappings for authenticated principals | ||
func (m *AdminRequestBuilder) RoleMappings() *RoleMappingsRequestBuilder { | ||
return NewRoleMappingsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) | ||
} | ||
|
||
// Rules manage the global rules that apply to all artifacts if not otherwise configured. | ||
func (m *AdminRequestBuilder) Rules() *RulesRequestBuilder { | ||
return NewRulesRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) | ||
} |
73 changes: 73 additions & 0 deletions
73
go-sdk/pkg/registryclient-v2/admin/artifact_types_request_builder.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package admin | ||
|
||
import ( | ||
"context" | ||
i80228d093fd3b582ec81b86f113cc707692a60cdd08bae7a390086a8438c7543 "github.com/apicurio/apicurio-registry/go-sdk/pkg/registryclient-v2/models" | ||
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" | ||
) | ||
|
||
// ArtifactTypesRequestBuilder the list of artifact types supported by this instance of Registry. | ||
type ArtifactTypesRequestBuilder struct { | ||
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder | ||
} | ||
|
||
// ArtifactTypesRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. | ||
type ArtifactTypesRequestBuilderGetRequestConfiguration struct { | ||
// Request headers | ||
Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders | ||
// Request options | ||
Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption | ||
} | ||
|
||
// NewArtifactTypesRequestBuilderInternal instantiates a new ArtifactTypesRequestBuilder and sets the default values. | ||
func NewArtifactTypesRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ArtifactTypesRequestBuilder { | ||
m := &ArtifactTypesRequestBuilder{ | ||
BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/admin/artifactTypes", pathParameters), | ||
} | ||
return m | ||
} | ||
|
||
// NewArtifactTypesRequestBuilder instantiates a new ArtifactTypesRequestBuilder and sets the default values. | ||
func NewArtifactTypesRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ArtifactTypesRequestBuilder { | ||
urlParams := make(map[string]string) | ||
urlParams["request-raw-url"] = rawUrl | ||
return NewArtifactTypesRequestBuilderInternal(urlParams, requestAdapter) | ||
} | ||
|
||
// 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`) | ||
func (m *ArtifactTypesRequestBuilder) Get(ctx context.Context, requestConfiguration *ArtifactTypesRequestBuilderGetRequestConfiguration) ([]i80228d093fd3b582ec81b86f113cc707692a60cdd08bae7a390086a8438c7543.ArtifactTypeInfoable, error) { | ||
requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration) | ||
if err != nil { | ||
return nil, err | ||
} | ||
errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ | ||
"500": i80228d093fd3b582ec81b86f113cc707692a60cdd08bae7a390086a8438c7543.CreateErrorFromDiscriminatorValue, | ||
} | ||
res, err := m.BaseRequestBuilder.RequestAdapter.SendCollection(ctx, requestInfo, i80228d093fd3b582ec81b86f113cc707692a60cdd08bae7a390086a8438c7543.CreateArtifactTypeInfoFromDiscriminatorValue, errorMapping) | ||
if err != nil { | ||
return nil, err | ||
} | ||
val := make([]i80228d093fd3b582ec81b86f113cc707692a60cdd08bae7a390086a8438c7543.ArtifactTypeInfoable, len(res)) | ||
for i, v := range res { | ||
if v != nil { | ||
val[i] = v.(i80228d093fd3b582ec81b86f113cc707692a60cdd08bae7a390086a8438c7543.ArtifactTypeInfoable) | ||
} | ||
} | ||
return val, nil | ||
} | ||
|
||
// 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`) | ||
func (m *ArtifactTypesRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *ArtifactTypesRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { | ||
requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) | ||
if requestConfiguration != nil { | ||
requestInfo.Headers.AddAll(requestConfiguration.Headers) | ||
requestInfo.AddRequestOptions(requestConfiguration.Options) | ||
} | ||
requestInfo.Headers.TryAdd("Accept", "application/json") | ||
return requestInfo, nil | ||
} | ||
|
||
// WithUrl returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. | ||
func (m *ArtifactTypesRequestBuilder) WithUrl(rawUrl string) *ArtifactTypesRequestBuilder { | ||
return NewArtifactTypesRequestBuilder(rawUrl, m.BaseRequestBuilder.RequestAdapter) | ||
} |
Oops, something went wrong.