mirror of https://github.com/vernonkeenan/lib
711 lines
26 KiB
Go
711 lines
26 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 courses
|
|
|
|
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 courses API client.
|
|
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
|
|
return &Client{transport: transport, formats: formats}
|
|
}
|
|
|
|
// New creates a new courses 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 courses 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 courses 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 {
|
|
|
|
// GetCourseLessons get a list of course lessons.
|
|
GetCourseLessons(params *GetCourseLessonsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCourseLessonsOK, error)
|
|
|
|
// GetCourseLessonsContext get a list of course lessons.
|
|
GetCourseLessonsContext(ctx context.Context, params *GetCourseLessonsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCourseLessonsOK, error)
|
|
|
|
// GetCourseSections get a list of course sections.
|
|
GetCourseSections(params *GetCourseSectionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCourseSectionsOK, error)
|
|
|
|
// GetCourseSectionsContext get a list of course sections.
|
|
GetCourseSectionsContext(ctx context.Context, params *GetCourseSectionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCourseSectionsOK, error)
|
|
|
|
// GetCourses get a list courses.
|
|
GetCourses(params *GetCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCoursesOK, error)
|
|
|
|
// GetCoursesContext get a list courses.
|
|
GetCoursesContext(ctx context.Context, params *GetCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCoursesOK, error)
|
|
|
|
// PostCourseLesson create a new course lesson.
|
|
PostCourseLesson(params *PostCourseLessonParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCourseLessonOK, error)
|
|
|
|
// PostCourseLessonContext create a new course lesson.
|
|
PostCourseLessonContext(ctx context.Context, params *PostCourseLessonParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCourseLessonOK, error)
|
|
|
|
// PostCourseSection create a new course section.
|
|
PostCourseSection(params *PostCourseSectionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCourseSectionOK, error)
|
|
|
|
// PostCourseSectionContext create a new course section.
|
|
PostCourseSectionContext(ctx context.Context, params *PostCourseSectionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCourseSectionOK, error)
|
|
|
|
// PostCourses create new courses.
|
|
PostCourses(params *PostCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCoursesCreated, error)
|
|
|
|
// PostCoursesContext create new courses.
|
|
PostCoursesContext(ctx context.Context, params *PostCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCoursesCreated, error)
|
|
|
|
// PutCourses update courses.
|
|
PutCourses(params *PutCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCoursesOK, error)
|
|
|
|
// PutCoursesContext update courses.
|
|
PutCoursesContext(ctx context.Context, params *PutCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCoursesOK, error)
|
|
|
|
// UpdateCourseLesson update an existing course lesson.
|
|
UpdateCourseLesson(params *UpdateCourseLessonParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCourseLessonOK, error)
|
|
|
|
// UpdateCourseLessonContext update an existing course lesson.
|
|
UpdateCourseLessonContext(ctx context.Context, params *UpdateCourseLessonParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCourseLessonOK, error)
|
|
|
|
// UpdateCourseSection update an existing course section.
|
|
UpdateCourseSection(params *UpdateCourseSectionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCourseSectionOK, error)
|
|
|
|
// UpdateCourseSectionContext update an existing course section.
|
|
UpdateCourseSectionContext(ctx context.Context, params *UpdateCourseSectionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCourseSectionOK, error)
|
|
|
|
SetTransport(transport runtime.ContextualTransport)
|
|
}
|
|
|
|
// GetCourseLessons gets a list of course lessons.
|
|
//
|
|
// 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.GetCourseLessonsContext] instead.
|
|
func (a *Client) GetCourseLessons(params *GetCourseLessonsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCourseLessonsOK, error) {
|
|
var ctx context.Context
|
|
if params.inner.ctx != nil {
|
|
ctx = params.inner.ctx
|
|
} else {
|
|
ctx = context.Background()
|
|
}
|
|
|
|
return a.GetCourseLessonsContext(ctx, params, authInfo, opts...)
|
|
}
|
|
|
|
// GetCourseLessonsContext gets a list of course lessons.
|
|
//
|
|
// Do not use the deprecated [GetCourseLessonsParams.Context] with this method: it would be ignored.
|
|
func (a *Client) GetCourseLessonsContext(ctx context.Context, params *GetCourseLessonsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCourseLessonsOK, error) {
|
|
// NOTE: parameters are not validated before sending
|
|
if params == nil {
|
|
params = NewGetCourseLessonsParams()
|
|
}
|
|
|
|
op := &runtime.ClientOperation{
|
|
ID: "getCourseLessons",
|
|
Method: "GET",
|
|
PathPattern: "/courselessons",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &GetCourseLessonsReader{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.(*GetCourseLessonsOK)
|
|
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 getCourseLessons: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
|
panic(msg)
|
|
}
|
|
|
|
// GetCourseSections gets a list of course sections.
|
|
//
|
|
// 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.GetCourseSectionsContext] instead.
|
|
func (a *Client) GetCourseSections(params *GetCourseSectionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCourseSectionsOK, error) {
|
|
var ctx context.Context
|
|
if params.inner.ctx != nil {
|
|
ctx = params.inner.ctx
|
|
} else {
|
|
ctx = context.Background()
|
|
}
|
|
|
|
return a.GetCourseSectionsContext(ctx, params, authInfo, opts...)
|
|
}
|
|
|
|
// GetCourseSectionsContext gets a list of course sections.
|
|
//
|
|
// Do not use the deprecated [GetCourseSectionsParams.Context] with this method: it would be ignored.
|
|
func (a *Client) GetCourseSectionsContext(ctx context.Context, params *GetCourseSectionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCourseSectionsOK, error) {
|
|
// NOTE: parameters are not validated before sending
|
|
if params == nil {
|
|
params = NewGetCourseSectionsParams()
|
|
}
|
|
|
|
op := &runtime.ClientOperation{
|
|
ID: "getCourseSections",
|
|
Method: "GET",
|
|
PathPattern: "/coursesections",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &GetCourseSectionsReader{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.(*GetCourseSectionsOK)
|
|
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 getCourseSections: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
|
panic(msg)
|
|
}
|
|
|
|
// GetCourses gets a list courses.
|
|
//
|
|
// Return a list of Course records from the datastore.
|
|
//
|
|
// 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.GetCoursesContext] instead.
|
|
func (a *Client) GetCourses(params *GetCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCoursesOK, error) {
|
|
var ctx context.Context
|
|
if params.inner.ctx != nil {
|
|
ctx = params.inner.ctx
|
|
} else {
|
|
ctx = context.Background()
|
|
}
|
|
|
|
return a.GetCoursesContext(ctx, params, authInfo, opts...)
|
|
}
|
|
|
|
// GetCoursesContext gets a list courses.
|
|
//
|
|
// Return a list of Course records from the datastore.
|
|
//
|
|
// Do not use the deprecated [GetCoursesParams.Context] with this method: it would be ignored.
|
|
func (a *Client) GetCoursesContext(ctx context.Context, params *GetCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCoursesOK, error) {
|
|
// NOTE: parameters are not validated before sending
|
|
if params == nil {
|
|
params = NewGetCoursesParams()
|
|
}
|
|
|
|
op := &runtime.ClientOperation{
|
|
ID: "getCourses",
|
|
Method: "GET",
|
|
PathPattern: "/courses",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &GetCoursesReader{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.(*GetCoursesOK)
|
|
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 getCourses: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
|
panic(msg)
|
|
}
|
|
|
|
// PostCourseLesson creates a new course lesson.
|
|
//
|
|
// 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.PostCourseLessonContext] instead.
|
|
func (a *Client) PostCourseLesson(params *PostCourseLessonParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCourseLessonOK, error) {
|
|
var ctx context.Context
|
|
if params.inner.ctx != nil {
|
|
ctx = params.inner.ctx
|
|
} else {
|
|
ctx = context.Background()
|
|
}
|
|
|
|
return a.PostCourseLessonContext(ctx, params, authInfo, opts...)
|
|
}
|
|
|
|
// PostCourseLessonContext creates a new course lesson.
|
|
//
|
|
// Do not use the deprecated [PostCourseLessonParams.Context] with this method: it would be ignored.
|
|
func (a *Client) PostCourseLessonContext(ctx context.Context, params *PostCourseLessonParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCourseLessonOK, error) {
|
|
// NOTE: parameters are not validated before sending
|
|
if params == nil {
|
|
params = NewPostCourseLessonParams()
|
|
}
|
|
|
|
op := &runtime.ClientOperation{
|
|
ID: "postCourseLesson",
|
|
Method: "POST",
|
|
PathPattern: "/courselessons",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &PostCourseLessonReader{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.(*PostCourseLessonOK)
|
|
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 postCourseLesson: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
|
panic(msg)
|
|
}
|
|
|
|
// PostCourseSection creates a new course section.
|
|
//
|
|
// 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.PostCourseSectionContext] instead.
|
|
func (a *Client) PostCourseSection(params *PostCourseSectionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCourseSectionOK, error) {
|
|
var ctx context.Context
|
|
if params.inner.ctx != nil {
|
|
ctx = params.inner.ctx
|
|
} else {
|
|
ctx = context.Background()
|
|
}
|
|
|
|
return a.PostCourseSectionContext(ctx, params, authInfo, opts...)
|
|
}
|
|
|
|
// PostCourseSectionContext creates a new course section.
|
|
//
|
|
// Do not use the deprecated [PostCourseSectionParams.Context] with this method: it would be ignored.
|
|
func (a *Client) PostCourseSectionContext(ctx context.Context, params *PostCourseSectionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCourseSectionOK, error) {
|
|
// NOTE: parameters are not validated before sending
|
|
if params == nil {
|
|
params = NewPostCourseSectionParams()
|
|
}
|
|
|
|
op := &runtime.ClientOperation{
|
|
ID: "postCourseSection",
|
|
Method: "POST",
|
|
PathPattern: "/coursesections",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &PostCourseSectionReader{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.(*PostCourseSectionOK)
|
|
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 postCourseSection: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
|
panic(msg)
|
|
}
|
|
|
|
// PostCourses creates new courses.
|
|
//
|
|
// Create Courses in Salesforce.
|
|
//
|
|
// 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.PostCoursesContext] instead.
|
|
func (a *Client) PostCourses(params *PostCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCoursesCreated, error) {
|
|
var ctx context.Context
|
|
if params.inner.ctx != nil {
|
|
ctx = params.inner.ctx
|
|
} else {
|
|
ctx = context.Background()
|
|
}
|
|
|
|
return a.PostCoursesContext(ctx, params, authInfo, opts...)
|
|
}
|
|
|
|
// PostCoursesContext creates new courses.
|
|
//
|
|
// Create Courses in Salesforce.
|
|
//
|
|
// Do not use the deprecated [PostCoursesParams.Context] with this method: it would be ignored.
|
|
func (a *Client) PostCoursesContext(ctx context.Context, params *PostCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCoursesCreated, error) {
|
|
// NOTE: parameters are not validated before sending
|
|
if params == nil {
|
|
params = NewPostCoursesParams()
|
|
}
|
|
|
|
op := &runtime.ClientOperation{
|
|
ID: "postCourses",
|
|
Method: "POST",
|
|
PathPattern: "/courses",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &PostCoursesReader{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.(*PostCoursesCreated)
|
|
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 postCourses: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
|
panic(msg)
|
|
}
|
|
|
|
// PutCourses updates courses.
|
|
//
|
|
// Update Course in Salesforce.
|
|
//
|
|
// 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.PutCoursesContext] instead.
|
|
func (a *Client) PutCourses(params *PutCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCoursesOK, error) {
|
|
var ctx context.Context
|
|
if params.inner.ctx != nil {
|
|
ctx = params.inner.ctx
|
|
} else {
|
|
ctx = context.Background()
|
|
}
|
|
|
|
return a.PutCoursesContext(ctx, params, authInfo, opts...)
|
|
}
|
|
|
|
// PutCoursesContext updates courses.
|
|
//
|
|
// Update Course in Salesforce.
|
|
//
|
|
// Do not use the deprecated [PutCoursesParams.Context] with this method: it would be ignored.
|
|
func (a *Client) PutCoursesContext(ctx context.Context, params *PutCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCoursesOK, error) {
|
|
// NOTE: parameters are not validated before sending
|
|
if params == nil {
|
|
params = NewPutCoursesParams()
|
|
}
|
|
|
|
op := &runtime.ClientOperation{
|
|
ID: "putCourses",
|
|
Method: "PUT",
|
|
PathPattern: "/courses",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &PutCoursesReader{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.(*PutCoursesOK)
|
|
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 putCourses: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
|
panic(msg)
|
|
}
|
|
|
|
// UpdateCourseLesson updates an existing course lesson.
|
|
//
|
|
// 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.UpdateCourseLessonContext] instead.
|
|
func (a *Client) UpdateCourseLesson(params *UpdateCourseLessonParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCourseLessonOK, error) {
|
|
var ctx context.Context
|
|
if params.inner.ctx != nil {
|
|
ctx = params.inner.ctx
|
|
} else {
|
|
ctx = context.Background()
|
|
}
|
|
|
|
return a.UpdateCourseLessonContext(ctx, params, authInfo, opts...)
|
|
}
|
|
|
|
// UpdateCourseLessonContext updates an existing course lesson.
|
|
//
|
|
// Do not use the deprecated [UpdateCourseLessonParams.Context] with this method: it would be ignored.
|
|
func (a *Client) UpdateCourseLessonContext(ctx context.Context, params *UpdateCourseLessonParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCourseLessonOK, error) {
|
|
// NOTE: parameters are not validated before sending
|
|
if params == nil {
|
|
params = NewUpdateCourseLessonParams()
|
|
}
|
|
|
|
op := &runtime.ClientOperation{
|
|
ID: "updateCourseLesson",
|
|
Method: "PUT",
|
|
PathPattern: "/courselessons",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &UpdateCourseLessonReader{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.(*UpdateCourseLessonOK)
|
|
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 updateCourseLesson: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
|
panic(msg)
|
|
}
|
|
|
|
// UpdateCourseSection updates an existing course section.
|
|
//
|
|
// 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.UpdateCourseSectionContext] instead.
|
|
func (a *Client) UpdateCourseSection(params *UpdateCourseSectionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCourseSectionOK, error) {
|
|
var ctx context.Context
|
|
if params.inner.ctx != nil {
|
|
ctx = params.inner.ctx
|
|
} else {
|
|
ctx = context.Background()
|
|
}
|
|
|
|
return a.UpdateCourseSectionContext(ctx, params, authInfo, opts...)
|
|
}
|
|
|
|
// UpdateCourseSectionContext updates an existing course section.
|
|
//
|
|
// Do not use the deprecated [UpdateCourseSectionParams.Context] with this method: it would be ignored.
|
|
func (a *Client) UpdateCourseSectionContext(ctx context.Context, params *UpdateCourseSectionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCourseSectionOK, error) {
|
|
// NOTE: parameters are not validated before sending
|
|
if params == nil {
|
|
params = NewUpdateCourseSectionParams()
|
|
}
|
|
|
|
op := &runtime.ClientOperation{
|
|
ID: "updateCourseSection",
|
|
Method: "PUT",
|
|
PathPattern: "/coursesections",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &UpdateCourseSectionReader{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.(*UpdateCourseSectionOK)
|
|
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 updateCourseSection: 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 [CoursesParams].
|
|
ctx context.Context
|
|
}
|