|
| 1 | +package ids |
| 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 | + i53ac87e8cb3cc9276228f74d38694a208cacb99bb8ceb705eeae99fb88d4d274 "strconv" |
| 8 | +) |
| 9 | + |
| 10 | +// ContentIdsItemWithContentIdRequestBuilder access artifact content utilizing the unique content identifier for that content. |
| 11 | +type ContentIdsItemWithContentIdRequestBuilder struct { |
| 12 | + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder |
| 13 | +} |
| 14 | + |
| 15 | +// ContentIdsItemWithContentIdRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. |
| 16 | +type ContentIdsItemWithContentIdRequestBuilderGetRequestConfiguration struct { |
| 17 | + // Request headers |
| 18 | + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders |
| 19 | + // Request options |
| 20 | + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption |
| 21 | +} |
| 22 | + |
| 23 | +// NewContentIdsItemWithContentIdRequestBuilderInternal instantiates a new ContentIdsItemWithContentIdRequestBuilder and sets the default values. |
| 24 | +func NewContentIdsItemWithContentIdRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter, contentId *int64) *ContentIdsItemWithContentIdRequestBuilder { |
| 25 | + m := &ContentIdsItemWithContentIdRequestBuilder{ |
| 26 | + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/ids/contentIds/{contentId}/", pathParameters), |
| 27 | + } |
| 28 | + if contentId != nil { |
| 29 | + m.BaseRequestBuilder.PathParameters["contentId"] = i53ac87e8cb3cc9276228f74d38694a208cacb99bb8ceb705eeae99fb88d4d274.FormatInt(*contentId, 10) |
| 30 | + } |
| 31 | + return m |
| 32 | +} |
| 33 | + |
| 34 | +// NewContentIdsItemWithContentIdRequestBuilder instantiates a new ContentIdsItemWithContentIdRequestBuilder and sets the default values. |
| 35 | +func NewContentIdsItemWithContentIdRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ContentIdsItemWithContentIdRequestBuilder { |
| 36 | + urlParams := make(map[string]string) |
| 37 | + urlParams["request-raw-url"] = rawUrl |
| 38 | + return NewContentIdsItemWithContentIdRequestBuilderInternal(urlParams, requestAdapter, nil) |
| 39 | +} |
| 40 | + |
| 41 | +// Get gets the content for an artifact version in the registry using the unique contentidentifier for that content. This content ID may be shared by multiple artifactversions in the case where the artifact versions are identical.This operation may fail for one of the following reasons:* No content with this `contentId` exists (HTTP error `404`)* A server error occurred (HTTP error `500`) |
| 42 | +// returns a []byte when successful |
| 43 | +// returns a Error error when the service returns a 404 status code |
| 44 | +// returns a Error error when the service returns a 500 status code |
| 45 | +func (m *ContentIdsItemWithContentIdRequestBuilder) Get(ctx context.Context, requestConfiguration *ContentIdsItemWithContentIdRequestBuilderGetRequestConfiguration) ([]byte, error) { |
| 46 | + requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration) |
| 47 | + if err != nil { |
| 48 | + return nil, err |
| 49 | + } |
| 50 | + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ |
| 51 | + "404": i80228d093fd3b582ec81b86f113cc707692a60cdd08bae7a390086a8438c7543.CreateErrorFromDiscriminatorValue, |
| 52 | + "500": i80228d093fd3b582ec81b86f113cc707692a60cdd08bae7a390086a8438c7543.CreateErrorFromDiscriminatorValue, |
| 53 | + } |
| 54 | + res, err := m.BaseRequestBuilder.RequestAdapter.SendPrimitive(ctx, requestInfo, "[]byte", errorMapping) |
| 55 | + if err != nil { |
| 56 | + return nil, err |
| 57 | + } |
| 58 | + if res == nil { |
| 59 | + return nil, nil |
| 60 | + } |
| 61 | + return res.([]byte), nil |
| 62 | +} |
| 63 | + |
| 64 | +// ToGetRequestInformation gets the content for an artifact version in the registry using the unique contentidentifier for that content. This content ID may be shared by multiple artifactversions in the case where the artifact versions are identical.This operation may fail for one of the following reasons:* No content with this `contentId` exists (HTTP error `404`)* A server error occurred (HTTP error `500`) |
| 65 | +// returns a *RequestInformation when successful |
| 66 | +func (m *ContentIdsItemWithContentIdRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *ContentIdsItemWithContentIdRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { |
| 67 | + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) |
| 68 | + if requestConfiguration != nil { |
| 69 | + requestInfo.Headers.AddAll(requestConfiguration.Headers) |
| 70 | + requestInfo.AddRequestOptions(requestConfiguration.Options) |
| 71 | + } |
| 72 | + requestInfo.Headers.TryAdd("Accept", "*/*, application/json") |
| 73 | + return requestInfo, nil |
| 74 | +} |
| 75 | + |
| 76 | +// WithUrl returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. |
| 77 | +// returns a *ContentIdsItemWithContentIdRequestBuilder when successful |
| 78 | +func (m *ContentIdsItemWithContentIdRequestBuilder) WithUrl(rawUrl string) *ContentIdsItemWithContentIdRequestBuilder { |
| 79 | + return NewContentIdsItemWithContentIdRequestBuilder(rawUrl, m.BaseRequestBuilder.RequestAdapter) |
| 80 | +} |
0 commit comments