mirror of https://github.com/vernonkeenan/lib
297 lines
12 KiB
Go
297 lines
12 KiB
Go
|
|
// Code generated by go-swagger; DO NOT EDIT.
|
||
|
|
|
||
|
|
// (c) 2012-2020 by Taxnexus, Inc.
|
||
|
|
// All rights reserved worldwide.
|
||
|
|
// Proprietary product; unlicensed use is not allowed
|
||
|
|
|
||
|
|
package track_users
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
"fmt"
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"github.com/go-openapi/runtime"
|
||
|
|
httptransport "github.com/go-openapi/runtime/client"
|
||
|
|
"github.com/go-openapi/strfmt"
|
||
|
|
)
|
||
|
|
|
||
|
|
// New creates a new track users API client.
|
||
|
|
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
|
||
|
|
return &Client{transport: transport, formats: formats}
|
||
|
|
}
|
||
|
|
|
||
|
|
// New creates a new track users API client with basic auth credentials.
|
||
|
|
//
|
||
|
|
// It takes the following parameters:
|
||
|
|
// - host: http host (github.com).
|
||
|
|
// - basePath: any base path for the API client ("/v1", "/v3").
|
||
|
|
// - scheme: http scheme ("http", "https").
|
||
|
|
// - user: user for basic authentication header.
|
||
|
|
// - password: password for basic authentication header.
|
||
|
|
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
|
||
|
|
transport := httptransport.New(host, basePath, []string{scheme})
|
||
|
|
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
|
||
|
|
return &Client{transport: transport, formats: strfmt.Default}
|
||
|
|
}
|
||
|
|
|
||
|
|
// New creates a new track users API client with a bearer token for authentication.
|
||
|
|
//
|
||
|
|
// It takes the following parameters:
|
||
|
|
// - host: http host (github.com).
|
||
|
|
// - basePath: any base path for the API client ("/v1", "/v3").
|
||
|
|
// - scheme: http scheme ("http", "https").
|
||
|
|
// - bearerToken: bearer token for Bearer authentication header.
|
||
|
|
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
|
||
|
|
transport := httptransport.New(host, basePath, []string{scheme})
|
||
|
|
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
|
||
|
|
return &Client{transport: transport, formats: strfmt.Default}
|
||
|
|
}
|
||
|
|
|
||
|
|
// Client for track users API.
|
||
|
|
type Client struct {
|
||
|
|
transport runtime.ContextualTransport
|
||
|
|
formats strfmt.Registry
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClientOption may be used to customize the behavior of Client methods.
|
||
|
|
type ClientOption func(*runtime.ClientOperation)
|
||
|
|
|
||
|
|
// ClientService is the interface for Client methods.
|
||
|
|
type ClientService interface {
|
||
|
|
|
||
|
|
// GetTrackUsers get governed track to user associations.
|
||
|
|
GetTrackUsers(params *GetTrackUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTrackUsersOK, error)
|
||
|
|
|
||
|
|
// GetTrackUsersContext get governed track to user associations.
|
||
|
|
GetTrackUsersContext(ctx context.Context, params *GetTrackUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTrackUsersOK, error)
|
||
|
|
|
||
|
|
// PostTrackUsers create a governed track to user association.
|
||
|
|
PostTrackUsers(params *PostTrackUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTrackUsersOK, error)
|
||
|
|
|
||
|
|
// PostTrackUsersContext create a governed track to user association.
|
||
|
|
PostTrackUsersContext(ctx context.Context, params *PostTrackUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTrackUsersOK, error)
|
||
|
|
|
||
|
|
// PutTrackUsers update a governed track to user role.
|
||
|
|
PutTrackUsers(params *PutTrackUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTrackUsersOK, error)
|
||
|
|
|
||
|
|
// PutTrackUsersContext update a governed track to user role.
|
||
|
|
PutTrackUsersContext(ctx context.Context, params *PutTrackUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTrackUsersOK, error)
|
||
|
|
|
||
|
|
SetTransport(transport runtime.ContextualTransport)
|
||
|
|
}
|
||
|
|
|
||
|
|
// GetTrackUsers gets governed track to user associations.
|
||
|
|
//
|
||
|
|
// Reads Track-to-User associations through the configured tenant's governed Track boundary and only for active referenced Users with an active membership in that tenant and an allowed role. Owners and Managers may read all bounded associations; Contributors may read associations for Tracks they created. Requires members:track-user:read and an active native member session..
|
||
|
|
//
|
||
|
|
// This method does not support injected context.
|
||
|
|
// However, timeout and opentracing contexts are honored whenever enabled.
|
||
|
|
//
|
||
|
|
// If you need to pass a specific context, use [Client.GetTrackUsersContext] instead.
|
||
|
|
func (a *Client) GetTrackUsers(params *GetTrackUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTrackUsersOK, error) {
|
||
|
|
var ctx context.Context
|
||
|
|
if params.inner.ctx != nil {
|
||
|
|
ctx = params.inner.ctx
|
||
|
|
} else {
|
||
|
|
ctx = context.Background()
|
||
|
|
}
|
||
|
|
|
||
|
|
return a.GetTrackUsersContext(ctx, params, authInfo, opts...)
|
||
|
|
}
|
||
|
|
|
||
|
|
// GetTrackUsersContext gets governed track to user associations.
|
||
|
|
//
|
||
|
|
// Reads Track-to-User associations through the configured tenant's governed Track boundary and only for active referenced Users with an active membership in that tenant and an allowed role. Owners and Managers may read all bounded associations; Contributors may read associations for Tracks they created. Requires members:track-user:read and an active native member session..
|
||
|
|
//
|
||
|
|
// Do not use the deprecated [GetTrackUsersParams.Context] with this method: it would be ignored.
|
||
|
|
func (a *Client) GetTrackUsersContext(ctx context.Context, params *GetTrackUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTrackUsersOK, error) {
|
||
|
|
// NOTE: parameters are not validated before sending
|
||
|
|
if params == nil {
|
||
|
|
params = NewGetTrackUsersParams()
|
||
|
|
}
|
||
|
|
|
||
|
|
op := &runtime.ClientOperation{
|
||
|
|
ID: "getTrackUsers",
|
||
|
|
Method: "GET",
|
||
|
|
PathPattern: "/trackusers",
|
||
|
|
ProducesMediaTypes: []string{"application/json"},
|
||
|
|
ConsumesMediaTypes: []string{"application/json"},
|
||
|
|
Schemes: []string{"http"},
|
||
|
|
Params: params,
|
||
|
|
Reader: &GetTrackUsersReader{formats: a.formats},
|
||
|
|
AuthInfo: authInfo,
|
||
|
|
Client: params.HTTPClient,
|
||
|
|
}
|
||
|
|
|
||
|
|
for _, opt := range opts {
|
||
|
|
opt(op)
|
||
|
|
}
|
||
|
|
|
||
|
|
result, err := a.transport.SubmitContext(ctx, op)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
|
||
|
|
// only one success response has to be checked
|
||
|
|
success, ok := result.(*GetTrackUsersOK)
|
||
|
|
if ok {
|
||
|
|
return success, nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// unexpected success response.
|
||
|
|
|
||
|
|
// no default response is defined.
|
||
|
|
//
|
||
|
|
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
|
||
|
|
msg := fmt.Sprintf("unexpected success response for getTrackUsers: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||
|
|
panic(msg)
|
||
|
|
}
|
||
|
|
|
||
|
|
// PostTrackUsers creates a governed track to user association.
|
||
|
|
//
|
||
|
|
// Creates one Track-to-User association after proving the Track and active referenced User belong to the configured tenant and the role is Attendee, Moderator, or Presenter. Requires members:track-user:create and an active native Owner or Manager session. Identity, TrackID, UserID, and audit fields are server-owned or immutable..
|
||
|
|
//
|
||
|
|
// This method does not support injected context.
|
||
|
|
// However, timeout and opentracing contexts are honored whenever enabled.
|
||
|
|
//
|
||
|
|
// If you need to pass a specific context, use [Client.PostTrackUsersContext] instead.
|
||
|
|
func (a *Client) PostTrackUsers(params *PostTrackUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTrackUsersOK, error) {
|
||
|
|
var ctx context.Context
|
||
|
|
if params.inner.ctx != nil {
|
||
|
|
ctx = params.inner.ctx
|
||
|
|
} else {
|
||
|
|
ctx = context.Background()
|
||
|
|
}
|
||
|
|
|
||
|
|
return a.PostTrackUsersContext(ctx, params, authInfo, opts...)
|
||
|
|
}
|
||
|
|
|
||
|
|
// PostTrackUsersContext creates a governed track to user association.
|
||
|
|
//
|
||
|
|
// Creates one Track-to-User association after proving the Track and active referenced User belong to the configured tenant and the role is Attendee, Moderator, or Presenter. Requires members:track-user:create and an active native Owner or Manager session. Identity, TrackID, UserID, and audit fields are server-owned or immutable..
|
||
|
|
//
|
||
|
|
// Do not use the deprecated [PostTrackUsersParams.Context] with this method: it would be ignored.
|
||
|
|
func (a *Client) PostTrackUsersContext(ctx context.Context, params *PostTrackUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTrackUsersOK, error) {
|
||
|
|
// NOTE: parameters are not validated before sending
|
||
|
|
if params == nil {
|
||
|
|
params = NewPostTrackUsersParams()
|
||
|
|
}
|
||
|
|
|
||
|
|
op := &runtime.ClientOperation{
|
||
|
|
ID: "postTrackUsers",
|
||
|
|
Method: "POST",
|
||
|
|
PathPattern: "/trackusers",
|
||
|
|
ProducesMediaTypes: []string{"application/json"},
|
||
|
|
ConsumesMediaTypes: []string{"application/json"},
|
||
|
|
Schemes: []string{"http"},
|
||
|
|
Params: params,
|
||
|
|
Reader: &PostTrackUsersReader{formats: a.formats},
|
||
|
|
AuthInfo: authInfo,
|
||
|
|
Client: params.HTTPClient,
|
||
|
|
}
|
||
|
|
|
||
|
|
for _, opt := range opts {
|
||
|
|
opt(op)
|
||
|
|
}
|
||
|
|
|
||
|
|
result, err := a.transport.SubmitContext(ctx, op)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
|
||
|
|
// only one success response has to be checked
|
||
|
|
success, ok := result.(*PostTrackUsersOK)
|
||
|
|
if ok {
|
||
|
|
return success, nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// unexpected success response.
|
||
|
|
|
||
|
|
// no default response is defined.
|
||
|
|
//
|
||
|
|
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
|
||
|
|
msg := fmt.Sprintf("unexpected success response for postTrackUsers: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||
|
|
panic(msg)
|
||
|
|
}
|
||
|
|
|
||
|
|
// PutTrackUsers updates a governed track to user role.
|
||
|
|
//
|
||
|
|
// CAS-updates only the allowed role of one bounded Track-to-User association. Requires members:track-user:update, an active native Owner or Manager session, and the current LastModifiedDate. TrackID, UserID, identity, and creator fields remain immutable. Delete is unsupported because recovery-safe removal semantics are not governed..
|
||
|
|
//
|
||
|
|
// This method does not support injected context.
|
||
|
|
// However, timeout and opentracing contexts are honored whenever enabled.
|
||
|
|
//
|
||
|
|
// If you need to pass a specific context, use [Client.PutTrackUsersContext] instead.
|
||
|
|
func (a *Client) PutTrackUsers(params *PutTrackUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTrackUsersOK, error) {
|
||
|
|
var ctx context.Context
|
||
|
|
if params.inner.ctx != nil {
|
||
|
|
ctx = params.inner.ctx
|
||
|
|
} else {
|
||
|
|
ctx = context.Background()
|
||
|
|
}
|
||
|
|
|
||
|
|
return a.PutTrackUsersContext(ctx, params, authInfo, opts...)
|
||
|
|
}
|
||
|
|
|
||
|
|
// PutTrackUsersContext updates a governed track to user role.
|
||
|
|
//
|
||
|
|
// CAS-updates only the allowed role of one bounded Track-to-User association. Requires members:track-user:update, an active native Owner or Manager session, and the current LastModifiedDate. TrackID, UserID, identity, and creator fields remain immutable. Delete is unsupported because recovery-safe removal semantics are not governed..
|
||
|
|
//
|
||
|
|
// Do not use the deprecated [PutTrackUsersParams.Context] with this method: it would be ignored.
|
||
|
|
func (a *Client) PutTrackUsersContext(ctx context.Context, params *PutTrackUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTrackUsersOK, error) {
|
||
|
|
// NOTE: parameters are not validated before sending
|
||
|
|
if params == nil {
|
||
|
|
params = NewPutTrackUsersParams()
|
||
|
|
}
|
||
|
|
|
||
|
|
op := &runtime.ClientOperation{
|
||
|
|
ID: "putTrackUsers",
|
||
|
|
Method: "PUT",
|
||
|
|
PathPattern: "/trackusers",
|
||
|
|
ProducesMediaTypes: []string{"application/json"},
|
||
|
|
ConsumesMediaTypes: []string{"application/json"},
|
||
|
|
Schemes: []string{"http"},
|
||
|
|
Params: params,
|
||
|
|
Reader: &PutTrackUsersReader{formats: a.formats},
|
||
|
|
AuthInfo: authInfo,
|
||
|
|
Client: params.HTTPClient,
|
||
|
|
}
|
||
|
|
|
||
|
|
for _, opt := range opts {
|
||
|
|
opt(op)
|
||
|
|
}
|
||
|
|
|
||
|
|
result, err := a.transport.SubmitContext(ctx, op)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
|
||
|
|
// only one success response has to be checked
|
||
|
|
success, ok := result.(*PutTrackUsersOK)
|
||
|
|
if ok {
|
||
|
|
return success, nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// unexpected success response.
|
||
|
|
|
||
|
|
// no default response is defined.
|
||
|
|
//
|
||
|
|
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
|
||
|
|
msg := fmt.Sprintf("unexpected success response for putTrackUsers: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||
|
|
panic(msg)
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetTransport changes the transport on the client
|
||
|
|
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
|
||
|
|
a.transport = transport
|
||
|
|
}
|
||
|
|
|
||
|
|
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
|
||
|
|
type innerParams struct {
|
||
|
|
timeout time.Duration
|
||
|
|
|
||
|
|
// Deprecated: use the operation call with context to pass the context instead of [TrackUsersParams].
|
||
|
|
ctx context.Context
|
||
|
|
}
|