3720 lines
86 KiB
Go
3720 lines
86 KiB
Go
// Code generated by ogen, DO NOT EDIT.
|
|
|
|
package ogent
|
|
|
|
import (
|
|
"context"
|
|
"net/url"
|
|
"time"
|
|
|
|
"github.com/go-faster/errors"
|
|
"go.opentelemetry.io/otel/attribute"
|
|
"go.opentelemetry.io/otel/codes"
|
|
"go.opentelemetry.io/otel/trace"
|
|
|
|
"github.com/ogen-go/ogen/conv"
|
|
ht "github.com/ogen-go/ogen/http"
|
|
"github.com/ogen-go/ogen/otelogen"
|
|
"github.com/ogen-go/ogen/uri"
|
|
)
|
|
|
|
// Client implements OAS client.
|
|
type Client struct {
|
|
serverURL *url.URL
|
|
baseClient
|
|
}
|
|
|
|
var _ Handler = struct {
|
|
*Client
|
|
}{}
|
|
|
|
// NewClient initializes new Client defined by OAS.
|
|
func NewClient(serverURL string, opts ...ClientOption) (*Client, error) {
|
|
u, err := url.Parse(serverURL)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
c, err := newClientConfig(opts...).baseClient()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &Client{
|
|
serverURL: u,
|
|
baseClient: c,
|
|
}, nil
|
|
}
|
|
|
|
type serverURLKey struct{}
|
|
|
|
// WithServerURL sets context key to override server URL.
|
|
func WithServerURL(ctx context.Context, u *url.URL) context.Context {
|
|
return context.WithValue(ctx, serverURLKey{}, u)
|
|
}
|
|
|
|
func (c *Client) requestURL(ctx context.Context) *url.URL {
|
|
u, ok := ctx.Value(serverURLKey{}).(*url.URL)
|
|
if !ok {
|
|
return c.serverURL
|
|
}
|
|
return u
|
|
}
|
|
|
|
// CreateCard invokes createCard operation.
|
|
//
|
|
// Creates a new Card and persists it to storage.
|
|
//
|
|
// POST /cards
|
|
func (c *Client) CreateCard(ctx context.Context, request *CreateCardReq) (CreateCardRes, error) {
|
|
res, err := c.sendCreateCard(ctx, request)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendCreateCard(ctx context.Context, request *CreateCardReq) (res CreateCardRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("createCard"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "CreateCard",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/cards"
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "POST", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
if err := encodeCreateCardRequest(request, r); err != nil {
|
|
return res, errors.Wrap(err, "encode request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeCreateCardResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// CreateGroup invokes createGroup operation.
|
|
//
|
|
// Creates a new Group and persists it to storage.
|
|
//
|
|
// POST /groups
|
|
func (c *Client) CreateGroup(ctx context.Context, request *CreateGroupReq) (CreateGroupRes, error) {
|
|
res, err := c.sendCreateGroup(ctx, request)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendCreateGroup(ctx context.Context, request *CreateGroupReq) (res CreateGroupRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("createGroup"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "CreateGroup",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/groups"
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "POST", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
if err := encodeCreateGroupRequest(request, r); err != nil {
|
|
return res, errors.Wrap(err, "encode request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeCreateGroupResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// CreateMa invokes createMa operation.
|
|
//
|
|
// Creates a new Ma and persists it to storage.
|
|
//
|
|
// POST /mas
|
|
func (c *Client) CreateMa(ctx context.Context, request *CreateMaReq) (CreateMaRes, error) {
|
|
res, err := c.sendCreateMa(ctx, request)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendCreateMa(ctx context.Context, request *CreateMaReq) (res CreateMaRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("createMa"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "CreateMa",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/mas"
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "POST", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
if err := encodeCreateMaRequest(request, r); err != nil {
|
|
return res, errors.Wrap(err, "encode request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeCreateMaResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// CreateSev invokes createSev operation.
|
|
//
|
|
// Creates a new Sev and persists it to storage.
|
|
//
|
|
// POST /sevs
|
|
func (c *Client) CreateSev(ctx context.Context, request *CreateSevReq) (CreateSevRes, error) {
|
|
res, err := c.sendCreateSev(ctx, request)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendCreateSev(ctx context.Context, request *CreateSevReq) (res CreateSevRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("createSev"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "CreateSev",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/sevs"
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "POST", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
if err := encodeCreateSevRequest(request, r); err != nil {
|
|
return res, errors.Wrap(err, "encode request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeCreateSevResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// CreateUe invokes createUe operation.
|
|
//
|
|
// Creates a new Ue and persists it to storage.
|
|
//
|
|
// POST /ues
|
|
func (c *Client) CreateUe(ctx context.Context, request *CreateUeReq) (CreateUeRes, error) {
|
|
res, err := c.sendCreateUe(ctx, request)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendCreateUe(ctx context.Context, request *CreateUeReq) (res CreateUeRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("createUe"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "CreateUe",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/ues"
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "POST", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
if err := encodeCreateUeRequest(request, r); err != nil {
|
|
return res, errors.Wrap(err, "encode request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeCreateUeResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// CreateUser invokes createUser operation.
|
|
//
|
|
// Creates a new User and persists it to storage.
|
|
//
|
|
// POST /users
|
|
func (c *Client) CreateUser(ctx context.Context, request *CreateUserReq) (CreateUserRes, error) {
|
|
res, err := c.sendCreateUser(ctx, request)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendCreateUser(ctx context.Context, request *CreateUserReq) (res CreateUserRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("createUser"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "CreateUser",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/users"
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "POST", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
if err := encodeCreateUserRequest(request, r); err != nil {
|
|
return res, errors.Wrap(err, "encode request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeCreateUserResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// DeleteCard invokes deleteCard operation.
|
|
//
|
|
// Deletes the Card with the requested ID.
|
|
//
|
|
// DELETE /cards/{id}
|
|
func (c *Client) DeleteCard(ctx context.Context, params DeleteCardParams) (DeleteCardRes, error) {
|
|
res, err := c.sendDeleteCard(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendDeleteCard(ctx context.Context, params DeleteCardParams) (res DeleteCardRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("deleteCard"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "DeleteCard",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/cards/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "DELETE", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeDeleteCardResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// DeleteGroup invokes deleteGroup operation.
|
|
//
|
|
// Deletes the Group with the requested ID.
|
|
//
|
|
// DELETE /groups/{id}
|
|
func (c *Client) DeleteGroup(ctx context.Context, params DeleteGroupParams) (DeleteGroupRes, error) {
|
|
res, err := c.sendDeleteGroup(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendDeleteGroup(ctx context.Context, params DeleteGroupParams) (res DeleteGroupRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("deleteGroup"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "DeleteGroup",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/groups/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "DELETE", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeDeleteGroupResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// DeleteMa invokes deleteMa operation.
|
|
//
|
|
// Deletes the Ma with the requested ID.
|
|
//
|
|
// DELETE /mas/{id}
|
|
func (c *Client) DeleteMa(ctx context.Context, params DeleteMaParams) (DeleteMaRes, error) {
|
|
res, err := c.sendDeleteMa(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendDeleteMa(ctx context.Context, params DeleteMaParams) (res DeleteMaRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("deleteMa"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "DeleteMa",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/mas/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "DELETE", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeDeleteMaResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// DeleteSev invokes deleteSev operation.
|
|
//
|
|
// Deletes the Sev with the requested ID.
|
|
//
|
|
// DELETE /sevs/{id}
|
|
func (c *Client) DeleteSev(ctx context.Context, params DeleteSevParams) (DeleteSevRes, error) {
|
|
res, err := c.sendDeleteSev(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendDeleteSev(ctx context.Context, params DeleteSevParams) (res DeleteSevRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("deleteSev"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "DeleteSev",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/sevs/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "DELETE", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeDeleteSevResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// DeleteUe invokes deleteUe operation.
|
|
//
|
|
// Deletes the Ue with the requested ID.
|
|
//
|
|
// DELETE /ues/{id}
|
|
func (c *Client) DeleteUe(ctx context.Context, params DeleteUeParams) (DeleteUeRes, error) {
|
|
res, err := c.sendDeleteUe(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendDeleteUe(ctx context.Context, params DeleteUeParams) (res DeleteUeRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("deleteUe"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "DeleteUe",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/ues/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "DELETE", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeDeleteUeResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// DeleteUser invokes deleteUser operation.
|
|
//
|
|
// Deletes the User with the requested ID.
|
|
//
|
|
// DELETE /users/{id}
|
|
func (c *Client) DeleteUser(ctx context.Context, params DeleteUserParams) (DeleteUserRes, error) {
|
|
res, err := c.sendDeleteUser(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendDeleteUser(ctx context.Context, params DeleteUserParams) (res DeleteUserRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("deleteUser"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "DeleteUser",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/users/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "DELETE", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeDeleteUserResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// DrawDone invokes drawDone operation.
|
|
//
|
|
// Draws a card item as done.
|
|
//
|
|
// PUT /cards/{id}/d
|
|
func (c *Client) DrawDone(ctx context.Context, params DrawDoneParams) error {
|
|
res, err := c.sendDrawDone(ctx, params)
|
|
_ = res
|
|
return err
|
|
}
|
|
|
|
func (c *Client) sendDrawDone(ctx context.Context, params DrawDoneParams) (res *DrawDoneNoContent, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("drawDone"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "DrawDone",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/cards/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
u.Path += "/d"
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "PUT", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeDrawDoneResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// DrawStart invokes drawStart operation.
|
|
//
|
|
// Draws a card item as done.
|
|
//
|
|
// PATCH /users/{id}/card/start
|
|
func (c *Client) DrawStart(ctx context.Context, params DrawStartParams) error {
|
|
res, err := c.sendDrawStart(ctx, params)
|
|
_ = res
|
|
return err
|
|
}
|
|
|
|
func (c *Client) sendDrawStart(ctx context.Context, params DrawStartParams) (res *DrawStartNoContent, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("drawStart"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "DrawStart",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/users/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
u.Path += "/card/start"
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "PATCH", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeDrawStartResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ListCard invokes listCard operation.
|
|
//
|
|
// List Cards.
|
|
//
|
|
// GET /cards
|
|
func (c *Client) ListCard(ctx context.Context, params ListCardParams) (ListCardRes, error) {
|
|
res, err := c.sendListCard(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendListCard(ctx context.Context, params ListCardParams) (res ListCardRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("listCard"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ListCard",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/cards"
|
|
|
|
stage = "EncodeQueryParams"
|
|
q := uri.NewQueryEncoder()
|
|
{
|
|
// Encode "page" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "page",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.Page.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
{
|
|
// Encode "itemsPerPage" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "itemsPerPage",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.ItemsPerPage.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
u.RawQuery = q.Values().Encode()
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeListCardResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ListGroup invokes listGroup operation.
|
|
//
|
|
// List Groups.
|
|
//
|
|
// GET /groups
|
|
func (c *Client) ListGroup(ctx context.Context, params ListGroupParams) (ListGroupRes, error) {
|
|
res, err := c.sendListGroup(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendListGroup(ctx context.Context, params ListGroupParams) (res ListGroupRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("listGroup"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ListGroup",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/groups"
|
|
|
|
stage = "EncodeQueryParams"
|
|
q := uri.NewQueryEncoder()
|
|
{
|
|
// Encode "page" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "page",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.Page.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
{
|
|
// Encode "itemsPerPage" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "itemsPerPage",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.ItemsPerPage.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
u.RawQuery = q.Values().Encode()
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeListGroupResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ListGroupUsers invokes listGroupUsers operation.
|
|
//
|
|
// List attached Users.
|
|
//
|
|
// GET /groups/{id}/users
|
|
func (c *Client) ListGroupUsers(ctx context.Context, params ListGroupUsersParams) (ListGroupUsersRes, error) {
|
|
res, err := c.sendListGroupUsers(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendListGroupUsers(ctx context.Context, params ListGroupUsersParams) (res ListGroupUsersRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("listGroupUsers"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ListGroupUsers",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/groups/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
u.Path += "/users"
|
|
|
|
stage = "EncodeQueryParams"
|
|
q := uri.NewQueryEncoder()
|
|
{
|
|
// Encode "page" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "page",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.Page.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
{
|
|
// Encode "itemsPerPage" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "itemsPerPage",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.ItemsPerPage.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
u.RawQuery = q.Values().Encode()
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeListGroupUsersResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ListMa invokes listMa operation.
|
|
//
|
|
// List Mas.
|
|
//
|
|
// GET /mas
|
|
func (c *Client) ListMa(ctx context.Context, params ListMaParams) (ListMaRes, error) {
|
|
res, err := c.sendListMa(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendListMa(ctx context.Context, params ListMaParams) (res ListMaRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("listMa"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ListMa",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/mas"
|
|
|
|
stage = "EncodeQueryParams"
|
|
q := uri.NewQueryEncoder()
|
|
{
|
|
// Encode "page" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "page",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.Page.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
{
|
|
// Encode "itemsPerPage" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "itemsPerPage",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.ItemsPerPage.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
u.RawQuery = q.Values().Encode()
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeListMaResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ListSev invokes listSev operation.
|
|
//
|
|
// List Sevs.
|
|
//
|
|
// GET /sevs
|
|
func (c *Client) ListSev(ctx context.Context, params ListSevParams) (ListSevRes, error) {
|
|
res, err := c.sendListSev(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendListSev(ctx context.Context, params ListSevParams) (res ListSevRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("listSev"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ListSev",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/sevs"
|
|
|
|
stage = "EncodeQueryParams"
|
|
q := uri.NewQueryEncoder()
|
|
{
|
|
// Encode "page" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "page",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.Page.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
{
|
|
// Encode "itemsPerPage" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "itemsPerPage",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.ItemsPerPage.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
u.RawQuery = q.Values().Encode()
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeListSevResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ListUe invokes listUe operation.
|
|
//
|
|
// List Ues.
|
|
//
|
|
// GET /ues
|
|
func (c *Client) ListUe(ctx context.Context, params ListUeParams) (ListUeRes, error) {
|
|
res, err := c.sendListUe(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendListUe(ctx context.Context, params ListUeParams) (res ListUeRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("listUe"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ListUe",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/ues"
|
|
|
|
stage = "EncodeQueryParams"
|
|
q := uri.NewQueryEncoder()
|
|
{
|
|
// Encode "page" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "page",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.Page.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
{
|
|
// Encode "itemsPerPage" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "itemsPerPage",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.ItemsPerPage.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
u.RawQuery = q.Values().Encode()
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeListUeResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ListUser invokes listUser operation.
|
|
//
|
|
// List Users.
|
|
//
|
|
// GET /users
|
|
func (c *Client) ListUser(ctx context.Context, params ListUserParams) (ListUserRes, error) {
|
|
res, err := c.sendListUser(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendListUser(ctx context.Context, params ListUserParams) (res ListUserRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("listUser"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ListUser",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/users"
|
|
|
|
stage = "EncodeQueryParams"
|
|
q := uri.NewQueryEncoder()
|
|
{
|
|
// Encode "page" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "page",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.Page.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
{
|
|
// Encode "itemsPerPage" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "itemsPerPage",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.ItemsPerPage.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
u.RawQuery = q.Values().Encode()
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeListUserResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ListUserCard invokes listUserCard operation.
|
|
//
|
|
// List attached Cards.
|
|
//
|
|
// GET /users/{id}/card
|
|
func (c *Client) ListUserCard(ctx context.Context, params ListUserCardParams) (ListUserCardRes, error) {
|
|
res, err := c.sendListUserCard(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendListUserCard(ctx context.Context, params ListUserCardParams) (res ListUserCardRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("listUserCard"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ListUserCard",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/users/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
u.Path += "/card"
|
|
|
|
stage = "EncodeQueryParams"
|
|
q := uri.NewQueryEncoder()
|
|
{
|
|
// Encode "page" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "page",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.Page.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
{
|
|
// Encode "itemsPerPage" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "itemsPerPage",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.ItemsPerPage.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
u.RawQuery = q.Values().Encode()
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeListUserCardResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ListUserMa invokes listUserMa operation.
|
|
//
|
|
// List attached Mas.
|
|
//
|
|
// GET /users/{id}/ma
|
|
func (c *Client) ListUserMa(ctx context.Context, params ListUserMaParams) (ListUserMaRes, error) {
|
|
res, err := c.sendListUserMa(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendListUserMa(ctx context.Context, params ListUserMaParams) (res ListUserMaRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("listUserMa"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ListUserMa",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/users/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
u.Path += "/ma"
|
|
|
|
stage = "EncodeQueryParams"
|
|
q := uri.NewQueryEncoder()
|
|
{
|
|
// Encode "page" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "page",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.Page.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
{
|
|
// Encode "itemsPerPage" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "itemsPerPage",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.ItemsPerPage.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
u.RawQuery = q.Values().Encode()
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeListUserMaResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ListUserSev invokes listUserSev operation.
|
|
//
|
|
// List attached Sevs.
|
|
//
|
|
// GET /users/{id}/sev
|
|
func (c *Client) ListUserSev(ctx context.Context, params ListUserSevParams) (ListUserSevRes, error) {
|
|
res, err := c.sendListUserSev(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendListUserSev(ctx context.Context, params ListUserSevParams) (res ListUserSevRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("listUserSev"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ListUserSev",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/users/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
u.Path += "/sev"
|
|
|
|
stage = "EncodeQueryParams"
|
|
q := uri.NewQueryEncoder()
|
|
{
|
|
// Encode "page" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "page",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.Page.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
{
|
|
// Encode "itemsPerPage" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "itemsPerPage",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.ItemsPerPage.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
u.RawQuery = q.Values().Encode()
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeListUserSevResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ListUserUe invokes listUserUe operation.
|
|
//
|
|
// List attached Ues.
|
|
//
|
|
// GET /users/{id}/ue
|
|
func (c *Client) ListUserUe(ctx context.Context, params ListUserUeParams) (ListUserUeRes, error) {
|
|
res, err := c.sendListUserUe(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendListUserUe(ctx context.Context, params ListUserUeParams) (res ListUserUeRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("listUserUe"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ListUserUe",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/users/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
u.Path += "/ue"
|
|
|
|
stage = "EncodeQueryParams"
|
|
q := uri.NewQueryEncoder()
|
|
{
|
|
// Encode "page" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "page",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.Page.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
{
|
|
// Encode "itemsPerPage" parameter.
|
|
cfg := uri.QueryParameterEncodingConfig{
|
|
Name: "itemsPerPage",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
|
if val, ok := params.ItemsPerPage.Get(); ok {
|
|
return e.EncodeValue(conv.IntToString(val))
|
|
}
|
|
return nil
|
|
}); err != nil {
|
|
return res, errors.Wrap(err, "encode query")
|
|
}
|
|
}
|
|
u.RawQuery = q.Values().Encode()
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeListUserUeResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ReadCard invokes readCard operation.
|
|
//
|
|
// Finds the Card with the requested ID and returns it.
|
|
//
|
|
// GET /cards/{id}
|
|
func (c *Client) ReadCard(ctx context.Context, params ReadCardParams) (ReadCardRes, error) {
|
|
res, err := c.sendReadCard(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendReadCard(ctx context.Context, params ReadCardParams) (res ReadCardRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("readCard"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ReadCard",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/cards/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeReadCardResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ReadCardOwner invokes readCardOwner operation.
|
|
//
|
|
// Find the attached User of the Card with the given ID.
|
|
//
|
|
// GET /cards/{id}/owner
|
|
func (c *Client) ReadCardOwner(ctx context.Context, params ReadCardOwnerParams) (ReadCardOwnerRes, error) {
|
|
res, err := c.sendReadCardOwner(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendReadCardOwner(ctx context.Context, params ReadCardOwnerParams) (res ReadCardOwnerRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("readCardOwner"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ReadCardOwner",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/cards/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
u.Path += "/owner"
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeReadCardOwnerResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ReadGroup invokes readGroup operation.
|
|
//
|
|
// Finds the Group with the requested ID and returns it.
|
|
//
|
|
// GET /groups/{id}
|
|
func (c *Client) ReadGroup(ctx context.Context, params ReadGroupParams) (ReadGroupRes, error) {
|
|
res, err := c.sendReadGroup(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendReadGroup(ctx context.Context, params ReadGroupParams) (res ReadGroupRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("readGroup"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ReadGroup",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/groups/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeReadGroupResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ReadMa invokes readMa operation.
|
|
//
|
|
// Finds the Ma with the requested ID and returns it.
|
|
//
|
|
// GET /mas/{id}
|
|
func (c *Client) ReadMa(ctx context.Context, params ReadMaParams) (ReadMaRes, error) {
|
|
res, err := c.sendReadMa(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendReadMa(ctx context.Context, params ReadMaParams) (res ReadMaRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("readMa"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ReadMa",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/mas/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeReadMaResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ReadMaOwner invokes readMaOwner operation.
|
|
//
|
|
// Find the attached User of the Ma with the given ID.
|
|
//
|
|
// GET /mas/{id}/owner
|
|
func (c *Client) ReadMaOwner(ctx context.Context, params ReadMaOwnerParams) (ReadMaOwnerRes, error) {
|
|
res, err := c.sendReadMaOwner(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendReadMaOwner(ctx context.Context, params ReadMaOwnerParams) (res ReadMaOwnerRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("readMaOwner"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ReadMaOwner",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/mas/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
u.Path += "/owner"
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeReadMaOwnerResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ReadSev invokes readSev operation.
|
|
//
|
|
// Finds the Sev with the requested ID and returns it.
|
|
//
|
|
// GET /sevs/{id}
|
|
func (c *Client) ReadSev(ctx context.Context, params ReadSevParams) (ReadSevRes, error) {
|
|
res, err := c.sendReadSev(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendReadSev(ctx context.Context, params ReadSevParams) (res ReadSevRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("readSev"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ReadSev",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/sevs/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeReadSevResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ReadSevOwner invokes readSevOwner operation.
|
|
//
|
|
// Find the attached User of the Sev with the given ID.
|
|
//
|
|
// GET /sevs/{id}/owner
|
|
func (c *Client) ReadSevOwner(ctx context.Context, params ReadSevOwnerParams) (ReadSevOwnerRes, error) {
|
|
res, err := c.sendReadSevOwner(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendReadSevOwner(ctx context.Context, params ReadSevOwnerParams) (res ReadSevOwnerRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("readSevOwner"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ReadSevOwner",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/sevs/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
u.Path += "/owner"
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeReadSevOwnerResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ReadUe invokes readUe operation.
|
|
//
|
|
// Finds the Ue with the requested ID and returns it.
|
|
//
|
|
// GET /ues/{id}
|
|
func (c *Client) ReadUe(ctx context.Context, params ReadUeParams) (ReadUeRes, error) {
|
|
res, err := c.sendReadUe(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendReadUe(ctx context.Context, params ReadUeParams) (res ReadUeRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("readUe"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ReadUe",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/ues/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeReadUeResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ReadUeOwner invokes readUeOwner operation.
|
|
//
|
|
// Find the attached User of the Ue with the given ID.
|
|
//
|
|
// GET /ues/{id}/owner
|
|
func (c *Client) ReadUeOwner(ctx context.Context, params ReadUeOwnerParams) (ReadUeOwnerRes, error) {
|
|
res, err := c.sendReadUeOwner(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendReadUeOwner(ctx context.Context, params ReadUeOwnerParams) (res ReadUeOwnerRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("readUeOwner"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ReadUeOwner",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/ues/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
u.Path += "/owner"
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeReadUeOwnerResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// ReadUser invokes readUser operation.
|
|
//
|
|
// Finds the User with the requested ID and returns it.
|
|
//
|
|
// GET /users/{id}
|
|
func (c *Client) ReadUser(ctx context.Context, params ReadUserParams) (ReadUserRes, error) {
|
|
res, err := c.sendReadUser(ctx, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendReadUser(ctx context.Context, params ReadUserParams) (res ReadUserRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("readUser"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "ReadUser",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/users/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "GET", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeReadUserResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// UpdateCard invokes updateCard operation.
|
|
//
|
|
// Updates a Card and persists changes to storage.
|
|
//
|
|
// PATCH /cards/{id}
|
|
func (c *Client) UpdateCard(ctx context.Context, request *UpdateCardReq, params UpdateCardParams) (UpdateCardRes, error) {
|
|
res, err := c.sendUpdateCard(ctx, request, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendUpdateCard(ctx context.Context, request *UpdateCardReq, params UpdateCardParams) (res UpdateCardRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("updateCard"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "UpdateCard",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/cards/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "PATCH", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
if err := encodeUpdateCardRequest(request, r); err != nil {
|
|
return res, errors.Wrap(err, "encode request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeUpdateCardResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// UpdateGroup invokes updateGroup operation.
|
|
//
|
|
// Updates a Group and persists changes to storage.
|
|
//
|
|
// PATCH /groups/{id}
|
|
func (c *Client) UpdateGroup(ctx context.Context, request *UpdateGroupReq, params UpdateGroupParams) (UpdateGroupRes, error) {
|
|
res, err := c.sendUpdateGroup(ctx, request, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendUpdateGroup(ctx context.Context, request *UpdateGroupReq, params UpdateGroupParams) (res UpdateGroupRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("updateGroup"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "UpdateGroup",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/groups/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "PATCH", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
if err := encodeUpdateGroupRequest(request, r); err != nil {
|
|
return res, errors.Wrap(err, "encode request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeUpdateGroupResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// UpdateMa invokes updateMa operation.
|
|
//
|
|
// Updates a Ma and persists changes to storage.
|
|
//
|
|
// PATCH /mas/{id}
|
|
func (c *Client) UpdateMa(ctx context.Context, request *UpdateMaReq, params UpdateMaParams) (UpdateMaRes, error) {
|
|
res, err := c.sendUpdateMa(ctx, request, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendUpdateMa(ctx context.Context, request *UpdateMaReq, params UpdateMaParams) (res UpdateMaRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("updateMa"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "UpdateMa",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/mas/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "PATCH", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
if err := encodeUpdateMaRequest(request, r); err != nil {
|
|
return res, errors.Wrap(err, "encode request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeUpdateMaResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// UpdateSev invokes updateSev operation.
|
|
//
|
|
// Updates a Sev and persists changes to storage.
|
|
//
|
|
// PATCH /sevs/{id}
|
|
func (c *Client) UpdateSev(ctx context.Context, request *UpdateSevReq, params UpdateSevParams) (UpdateSevRes, error) {
|
|
res, err := c.sendUpdateSev(ctx, request, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendUpdateSev(ctx context.Context, request *UpdateSevReq, params UpdateSevParams) (res UpdateSevRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("updateSev"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "UpdateSev",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/sevs/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "PATCH", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
if err := encodeUpdateSevRequest(request, r); err != nil {
|
|
return res, errors.Wrap(err, "encode request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeUpdateSevResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// UpdateUe invokes updateUe operation.
|
|
//
|
|
// Updates a Ue and persists changes to storage.
|
|
//
|
|
// PATCH /ues/{id}
|
|
func (c *Client) UpdateUe(ctx context.Context, request *UpdateUeReq, params UpdateUeParams) (UpdateUeRes, error) {
|
|
res, err := c.sendUpdateUe(ctx, request, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendUpdateUe(ctx context.Context, request *UpdateUeReq, params UpdateUeParams) (res UpdateUeRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("updateUe"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "UpdateUe",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/ues/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "PATCH", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
if err := encodeUpdateUeRequest(request, r); err != nil {
|
|
return res, errors.Wrap(err, "encode request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeUpdateUeResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// UpdateUser invokes updateUser operation.
|
|
//
|
|
// Updates a User and persists changes to storage.
|
|
//
|
|
// PATCH /users/{id}
|
|
func (c *Client) UpdateUser(ctx context.Context, request *UpdateUserReq, params UpdateUserParams) (UpdateUserRes, error) {
|
|
res, err := c.sendUpdateUser(ctx, request, params)
|
|
_ = res
|
|
return res, err
|
|
}
|
|
|
|
func (c *Client) sendUpdateUser(ctx context.Context, request *UpdateUserReq, params UpdateUserParams) (res UpdateUserRes, err error) {
|
|
otelAttrs := []attribute.KeyValue{
|
|
otelogen.OperationID("updateUser"),
|
|
}
|
|
|
|
// Run stopwatch.
|
|
startTime := time.Now()
|
|
defer func() {
|
|
elapsedDuration := time.Since(startTime)
|
|
c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...)
|
|
}()
|
|
|
|
// Increment request counter.
|
|
c.requests.Add(ctx, 1, otelAttrs...)
|
|
|
|
// Start a span for this request.
|
|
ctx, span := c.cfg.Tracer.Start(ctx, "UpdateUser",
|
|
trace.WithAttributes(otelAttrs...),
|
|
clientSpanKind,
|
|
)
|
|
// Track stage for error reporting.
|
|
var stage string
|
|
defer func() {
|
|
if err != nil {
|
|
span.RecordError(err)
|
|
span.SetStatus(codes.Error, stage)
|
|
c.errors.Add(ctx, 1, otelAttrs...)
|
|
}
|
|
span.End()
|
|
}()
|
|
|
|
stage = "BuildURL"
|
|
u := uri.Clone(c.requestURL(ctx))
|
|
u.Path += "/users/"
|
|
{
|
|
// Encode "id" parameter.
|
|
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
Param: "id",
|
|
Style: uri.PathStyleSimple,
|
|
Explode: false,
|
|
})
|
|
if err := func() error {
|
|
return e.EncodeValue(conv.IntToString(params.ID))
|
|
}(); err != nil {
|
|
return res, errors.Wrap(err, "encode path")
|
|
}
|
|
u.Path += e.Result()
|
|
}
|
|
|
|
stage = "EncodeRequest"
|
|
r, err := ht.NewRequest(ctx, "PATCH", u, nil)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "create request")
|
|
}
|
|
if err := encodeUpdateUserRequest(request, r); err != nil {
|
|
return res, errors.Wrap(err, "encode request")
|
|
}
|
|
|
|
stage = "SendRequest"
|
|
resp, err := c.cfg.Client.Do(r)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "do request")
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
stage = "DecodeResponse"
|
|
result, err := decodeUpdateUserResponse(resp)
|
|
if err != nil {
|
|
return res, errors.Wrap(err, "decode response")
|
|
}
|
|
|
|
return result, nil
|
|
}
|