// 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 of courses.
	GetCourses(params *GetCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCoursesOK, error)

	// GetCoursesContext get a list of courses.
	GetCoursesContext(ctx context.Context, params *GetCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCoursesOK, error)

	// PostCourseLessons create a new course lesson.
	PostCourseLessons(params *PostCourseLessonsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCourseLessonsOK, error)

	// PostCourseLessonsContext create a new course lesson.
	PostCourseLessonsContext(ctx context.Context, params *PostCourseLessonsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCourseLessonsOK, error)

	// PostCourseSections create a new course section.
	PostCourseSections(params *PostCourseSectionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCourseSectionsOK, error)

	// PostCourseSectionsContext create a new course section.
	PostCourseSectionsContext(ctx context.Context, params *PostCourseSectionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCourseSectionsOK, error)

	// PostCourses create a new course.
	PostCourses(params *PostCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCoursesOK, error)

	// PostCoursesContext create a new course.
	PostCoursesContext(ctx context.Context, params *PostCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCoursesOK, error)

	// UpdateCourseLessons update an existing course lesson.
	UpdateCourseLessons(params *UpdateCourseLessonsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCourseLessonsOK, error)

	// UpdateCourseLessonsContext update an existing course lesson.
	UpdateCourseLessonsContext(ctx context.Context, params *UpdateCourseLessonsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCourseLessonsOK, error)

	// UpdateCourseSections update an existing course section.
	UpdateCourseSections(params *UpdateCourseSectionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCourseSectionsOK, error)

	// UpdateCourseSectionsContext update an existing course section.
	UpdateCourseSectionsContext(ctx context.Context, params *UpdateCourseSectionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCourseSectionsOK, error)

	// UpdateCourses update an existing course.
	UpdateCourses(params *UpdateCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCoursesOK, error)

	// UpdateCoursesContext update an existing course.
	UpdateCoursesContext(ctx context.Context, params *UpdateCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCoursesOK, error)

	SetTransport(transport runtime.ContextualTransport)
}

// GetCourseLessons gets a list of course lessons.
//
// Estate-global learning catalog read. Requires members:course-lesson:read and an active human 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.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.
//
// Estate-global learning catalog read. Requires members:course-lesson:read and an active human session..
//
// 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.
//
// Estate-global course-section read. Requires members:course-section:read and an active human 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.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.
//
// Estate-global course-section read. Requires members:course-section:read and an active human session..
//
// 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 of courses.
//
// Estate-global learning catalog read. Requires members:course:read and an active human 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.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 of courses.
//
// Estate-global learning catalog read. Requires members:course:read and an active human session..
//
// 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)
}

// PostCourseLessons creates a new course lesson.
//
// Estate-global lesson create. Requires members:course-lesson:create, an active human session, and tenant-independent Administrator/Admin authority. IDs and audit fields are server-owned..
//
// 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.PostCourseLessonsContext] instead.
func (a *Client) PostCourseLessons(params *PostCourseLessonsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCourseLessonsOK, error) {
	var ctx context.Context
	if params.inner.ctx != nil {
		ctx = params.inner.ctx
	} else {
		ctx = context.Background()
	}

	return a.PostCourseLessonsContext(ctx, params, authInfo, opts...)
}

// PostCourseLessonsContext creates a new course lesson.
//
// Estate-global lesson create. Requires members:course-lesson:create, an active human session, and tenant-independent Administrator/Admin authority. IDs and audit fields are server-owned..
//
// Do not use the deprecated [PostCourseLessonsParams.Context] with this method: it would be ignored.
func (a *Client) PostCourseLessonsContext(ctx context.Context, params *PostCourseLessonsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCourseLessonsOK, error) {
	// NOTE: parameters are not validated before sending
	if params == nil {
		params = NewPostCourseLessonsParams()
	}

	op := &runtime.ClientOperation{
		ID:                 "postCourseLessons",
		Method:             "POST",
		PathPattern:        "/courselessons",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &PostCourseLessonsReader{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.(*PostCourseLessonsOK)
	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 postCourseLessons: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

// PostCourseSections creates a new course section.
//
// Estate-global course-section create. Requires members:course-section:create, an active human session, and tenant-independent Administrator/Admin authority. CourseID is required and validated..
//
// 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.PostCourseSectionsContext] instead.
func (a *Client) PostCourseSections(params *PostCourseSectionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCourseSectionsOK, error) {
	var ctx context.Context
	if params.inner.ctx != nil {
		ctx = params.inner.ctx
	} else {
		ctx = context.Background()
	}

	return a.PostCourseSectionsContext(ctx, params, authInfo, opts...)
}

// PostCourseSectionsContext creates a new course section.
//
// Estate-global course-section create. Requires members:course-section:create, an active human session, and tenant-independent Administrator/Admin authority. CourseID is required and validated..
//
// Do not use the deprecated [PostCourseSectionsParams.Context] with this method: it would be ignored.
func (a *Client) PostCourseSectionsContext(ctx context.Context, params *PostCourseSectionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCourseSectionsOK, error) {
	// NOTE: parameters are not validated before sending
	if params == nil {
		params = NewPostCourseSectionsParams()
	}

	op := &runtime.ClientOperation{
		ID:                 "postCourseSections",
		Method:             "POST",
		PathPattern:        "/coursesections",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &PostCourseSectionsReader{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.(*PostCourseSectionsOK)
	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 postCourseSections: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

// PostCourses creates a new course.
//
// Estate-global course create. Requires members:course:create, an active human session, and tenant-independent Administrator/Admin authority. IDs and audit fields are server-owned..
//
// 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) (*PostCoursesOK, 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 a new course.
//
// Estate-global course create. Requires members:course:create, an active human session, and tenant-independent Administrator/Admin authority. IDs and audit fields are server-owned..
//
// 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) (*PostCoursesOK, 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.(*PostCoursesOK)
	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)
}

// UpdateCourseLessons updates an existing course lesson.
//
// Estate-global lesson CAS update. Requires members:course-lesson:update, an active human session, and tenant-independent Administrator/Admin authority. SectionID is 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.UpdateCourseLessonsContext] instead.
func (a *Client) UpdateCourseLessons(params *UpdateCourseLessonsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCourseLessonsOK, error) {
	var ctx context.Context
	if params.inner.ctx != nil {
		ctx = params.inner.ctx
	} else {
		ctx = context.Background()
	}

	return a.UpdateCourseLessonsContext(ctx, params, authInfo, opts...)
}

// UpdateCourseLessonsContext updates an existing course lesson.
//
// Estate-global lesson CAS update. Requires members:course-lesson:update, an active human session, and tenant-independent Administrator/Admin authority. SectionID is immutable..
//
// Do not use the deprecated [UpdateCourseLessonsParams.Context] with this method: it would be ignored.
func (a *Client) UpdateCourseLessonsContext(ctx context.Context, params *UpdateCourseLessonsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCourseLessonsOK, error) {
	// NOTE: parameters are not validated before sending
	if params == nil {
		params = NewUpdateCourseLessonsParams()
	}

	op := &runtime.ClientOperation{
		ID:                 "updateCourseLessons",
		Method:             "PUT",
		PathPattern:        "/courselessons",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &UpdateCourseLessonsReader{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.(*UpdateCourseLessonsOK)
	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 updateCourseLessons: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

// UpdateCourseSections updates an existing course section.
//
// Estate-global course-section CAS update. Requires members:course-section:update, an active human session, and tenant-independent Administrator/Admin authority. CourseID is 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.UpdateCourseSectionsContext] instead.
func (a *Client) UpdateCourseSections(params *UpdateCourseSectionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCourseSectionsOK, error) {
	var ctx context.Context
	if params.inner.ctx != nil {
		ctx = params.inner.ctx
	} else {
		ctx = context.Background()
	}

	return a.UpdateCourseSectionsContext(ctx, params, authInfo, opts...)
}

// UpdateCourseSectionsContext updates an existing course section.
//
// Estate-global course-section CAS update. Requires members:course-section:update, an active human session, and tenant-independent Administrator/Admin authority. CourseID is immutable..
//
// Do not use the deprecated [UpdateCourseSectionsParams.Context] with this method: it would be ignored.
func (a *Client) UpdateCourseSectionsContext(ctx context.Context, params *UpdateCourseSectionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCourseSectionsOK, error) {
	// NOTE: parameters are not validated before sending
	if params == nil {
		params = NewUpdateCourseSectionsParams()
	}

	op := &runtime.ClientOperation{
		ID:                 "updateCourseSections",
		Method:             "PUT",
		PathPattern:        "/coursesections",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &UpdateCourseSectionsReader{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.(*UpdateCourseSectionsOK)
	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 updateCourseSections: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

// UpdateCourses updates an existing course.
//
// Estate-global course CAS update. Requires members:course:update, an active human session, and tenant-independent Administrator/Admin authority..
//
// 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.UpdateCoursesContext] instead.
func (a *Client) UpdateCourses(params *UpdateCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCoursesOK, error) {
	var ctx context.Context
	if params.inner.ctx != nil {
		ctx = params.inner.ctx
	} else {
		ctx = context.Background()
	}

	return a.UpdateCoursesContext(ctx, params, authInfo, opts...)
}

// UpdateCoursesContext updates an existing course.
//
// Estate-global course CAS update. Requires members:course:update, an active human session, and tenant-independent Administrator/Admin authority..
//
// Do not use the deprecated [UpdateCoursesParams.Context] with this method: it would be ignored.
func (a *Client) UpdateCoursesContext(ctx context.Context, params *UpdateCoursesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCoursesOK, error) {
	// NOTE: parameters are not validated before sending
	if params == nil {
		params = NewUpdateCoursesParams()
	}

	op := &runtime.ClientOperation{
		ID:                 "updateCourses",
		Method:             "PUT",
		PathPattern:        "/courses",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &UpdateCoursesReader{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.(*UpdateCoursesOK)
	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 updateCourses: 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
}
