From e771f8ac659c7d04f0a763081b45cfacf66e6bf4 Mon Sep 17 00:00:00 2001 From: Vernon Keenan Date: Thu, 23 Jul 2026 22:36:20 -0700 Subject: [PATCH] feat(research): add governed Learning clients --- .../certificates/certificates_client.go | 296 -------- .../get_certificates_parameters.go | 241 ------- .../get_certificates_responses.go | 484 ------------- .../post_certificates_parameters.go | 159 ----- .../post_certificates_responses.go | 484 ------------- .../put_certificates_parameters.go | 159 ----- .../put_certificates_responses.go | 484 ------------- .../members_client/courses/courses_client.go | 36 + .../update_course_lessons_responses.go | 74 ++ .../update_course_sections_responses.go | 74 ++ .../courses/update_courses_responses.go | 74 ++ .../enrollments/enrollments_client.go | 12 +- .../enrollments/put_enrollments_responses.go | 74 ++ .../issued_certificates_client.go | 150 +--- .../post_issued_certificates_parameters.go | 159 ----- .../post_issued_certificates_responses.go | 484 ------------- .../put_issued_certificates_parameters.go | 159 ----- .../put_issued_certificates_responses.go | 484 ------------- .../members_client/learning_contract_test.go | 652 ++++++++++++++++++ .../lesson_progress/lesson_progress_client.go | 12 +- .../put_lesson_progresses_responses.go | 74 ++ api/members/members_client/members_client.go | 5 - .../members_client/prompt_contract_test.go | 10 +- api/members/members_models/certificate.go | 75 -- .../members_models/certificate_request.go | 132 ---- .../members_models/certificate_response.go | 132 ---- api/members/members_models/course.go | 117 ++-- api/members/members_models/course_lesson.go | 51 +- .../members_models/course_lesson_request.go | 15 +- api/members/members_models/course_request.go | 15 +- api/members/members_models/course_section.go | 96 +-- .../members_models/course_section_request.go | 15 +- api/members/members_models/enrollment.go | 33 +- .../members_models/enrollment_request.go | 15 +- .../members_models/issued_certificate.go | 14 +- .../issued_certificate_request.go | 132 ---- api/members/members_models/lesson_progress.go | 13 +- .../members_models/lesson_progress_request.go | 15 +- swagger/external/members-vernonkeenan.yaml | 497 ++++++++----- swagger/members-vernonkeenan.yaml | 497 ++++++++----- 40 files changed, 1935 insertions(+), 4769 deletions(-) delete mode 100644 api/members/members_client/certificates/certificates_client.go delete mode 100644 api/members/members_client/certificates/get_certificates_parameters.go delete mode 100644 api/members/members_client/certificates/get_certificates_responses.go delete mode 100644 api/members/members_client/certificates/post_certificates_parameters.go delete mode 100644 api/members/members_client/certificates/post_certificates_responses.go delete mode 100644 api/members/members_client/certificates/put_certificates_parameters.go delete mode 100644 api/members/members_client/certificates/put_certificates_responses.go delete mode 100644 api/members/members_client/issued_certificates/post_issued_certificates_parameters.go delete mode 100644 api/members/members_client/issued_certificates/post_issued_certificates_responses.go delete mode 100644 api/members/members_client/issued_certificates/put_issued_certificates_parameters.go delete mode 100644 api/members/members_client/issued_certificates/put_issued_certificates_responses.go create mode 100644 api/members/members_client/learning_contract_test.go delete mode 100644 api/members/members_models/certificate.go delete mode 100644 api/members/members_models/certificate_request.go delete mode 100644 api/members/members_models/certificate_response.go delete mode 100644 api/members/members_models/issued_certificate_request.go diff --git a/api/members/members_client/certificates/certificates_client.go b/api/members/members_client/certificates/certificates_client.go deleted file mode 100644 index 7152ed1..0000000 --- a/api/members/members_client/certificates/certificates_client.go +++ /dev/null @@ -1,296 +0,0 @@ -// 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 certificates - -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 certificates API client. -func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService { - return &Client{transport: transport, formats: formats} -} - -// New creates a new certificates 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 certificates 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 certificates 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 { - - // GetCertificates get a list certificates. - GetCertificates(params *GetCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCertificatesOK, error) - - // GetCertificatesContext get a list certificates. - GetCertificatesContext(ctx context.Context, params *GetCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCertificatesOK, error) - - // PostCertificates create new certificates. - PostCertificates(params *PostCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCertificatesOK, error) - - // PostCertificatesContext create new certificates. - PostCertificatesContext(ctx context.Context, params *PostCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCertificatesOK, error) - - // PutCertificates update certificate. - PutCertificates(params *PutCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCertificatesOK, error) - - // PutCertificatesContext update certificate. - PutCertificatesContext(ctx context.Context, params *PutCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCertificatesOK, error) - - SetTransport(transport runtime.ContextualTransport) -} - -// GetCertificates gets a list certificates. -// -// Return a list of Certificate 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.GetCertificatesContext] instead. -func (a *Client) GetCertificates(params *GetCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCertificatesOK, error) { - var ctx context.Context - if params.inner.ctx != nil { - ctx = params.inner.ctx - } else { - ctx = context.Background() - } - - return a.GetCertificatesContext(ctx, params, authInfo, opts...) -} - -// GetCertificatesContext gets a list certificates. -// -// Return a list of Certificate records from the datastore. -// -// Do not use the deprecated [GetCertificatesParams.Context] with this method: it would be ignored. -func (a *Client) GetCertificatesContext(ctx context.Context, params *GetCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCertificatesOK, error) { - // NOTE: parameters are not validated before sending - if params == nil { - params = NewGetCertificatesParams() - } - - op := &runtime.ClientOperation{ - ID: "getCertificates", - Method: "GET", - PathPattern: "/certificates", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetCertificatesReader{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.(*GetCertificatesOK) - 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 getCertificates: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -// PostCertificates creates new certificates. -// -// Create Certificates. -// -// 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.PostCertificatesContext] instead. -func (a *Client) PostCertificates(params *PostCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCertificatesOK, error) { - var ctx context.Context - if params.inner.ctx != nil { - ctx = params.inner.ctx - } else { - ctx = context.Background() - } - - return a.PostCertificatesContext(ctx, params, authInfo, opts...) -} - -// PostCertificatesContext creates new certificates. -// -// Create Certificates. -// -// Do not use the deprecated [PostCertificatesParams.Context] with this method: it would be ignored. -func (a *Client) PostCertificatesContext(ctx context.Context, params *PostCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCertificatesOK, error) { - // NOTE: parameters are not validated before sending - if params == nil { - params = NewPostCertificatesParams() - } - - op := &runtime.ClientOperation{ - ID: "postCertificates", - Method: "POST", - PathPattern: "/certificates", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PostCertificatesReader{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.(*PostCertificatesOK) - 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 postCertificates: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -// PutCertificates updates certificate. -// -// Update Certificate. -// -// 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.PutCertificatesContext] instead. -func (a *Client) PutCertificates(params *PutCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCertificatesOK, error) { - var ctx context.Context - if params.inner.ctx != nil { - ctx = params.inner.ctx - } else { - ctx = context.Background() - } - - return a.PutCertificatesContext(ctx, params, authInfo, opts...) -} - -// PutCertificatesContext updates certificate. -// -// Update Certificate. -// -// Do not use the deprecated [PutCertificatesParams.Context] with this method: it would be ignored. -func (a *Client) PutCertificatesContext(ctx context.Context, params *PutCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCertificatesOK, error) { - // NOTE: parameters are not validated before sending - if params == nil { - params = NewPutCertificatesParams() - } - - op := &runtime.ClientOperation{ - ID: "putCertificates", - Method: "PUT", - PathPattern: "/certificates", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PutCertificatesReader{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.(*PutCertificatesOK) - 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 putCertificates: 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 [CertificatesParams]. - ctx context.Context -} diff --git a/api/members/members_client/certificates/get_certificates_parameters.go b/api/members/members_client/certificates/get_certificates_parameters.go deleted file mode 100644 index 3c4c284..0000000 --- a/api/members/members_client/certificates/get_certificates_parameters.go +++ /dev/null @@ -1,241 +0,0 @@ -// 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 certificates - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag/conv" -) - -// NewGetCertificatesParams creates a new GetCertificatesParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetCertificatesParams() *GetCertificatesParams { - return NewGetCertificatesParamsWithTimeout(cr.DefaultTimeout) -} - -// NewGetCertificatesParamsWithTimeout creates a new GetCertificatesParams object -// with the ability to set a timeout on a request. -func NewGetCertificatesParamsWithTimeout(timeout time.Duration) *GetCertificatesParams { - return &GetCertificatesParams{ - inner: innerParams{ - timeout: timeout, - }, - } -} - -// NewGetCertificatesParamsWithContext creates a new GetCertificatesParams object -// with the ability to set a context for a request. -// -// Deprecated: use the operation call with context to pass the context instead of [GetCertificatesParams]. -func NewGetCertificatesParamsWithContext(ctx context.Context) *GetCertificatesParams { - return &GetCertificatesParams{ - inner: innerParams{ - ctx: ctx, - }, - } -} - -// NewGetCertificatesParamsWithHTTPClient creates a new GetCertificatesParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetCertificatesParamsWithHTTPClient(client *http.Client) *GetCertificatesParams { - return &GetCertificatesParams{ - HTTPClient: client, - } -} - -/* -GetCertificatesParams contains all the parameters to send to the API endpoint - - for the get certificates operation. - - Typically these are written to a http.Request. -*/ -type GetCertificatesParams struct { - - // ID. - // - // Unique Record ID - ID *string - - // Limit. - // - // How many objects to return at one time - // - // Format: int64 - Limit *int64 - - // Offset. - // - // How many objects to skip? - // - // Format: int64 - Offset *int64 - - HTTPClient *http.Client - - inner innerParams -} - -// WithDefaults hydrates default values in the get certificates params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetCertificatesParams) WithDefaults() *GetCertificatesParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get certificates params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetCertificatesParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get certificates params. -func (o *GetCertificatesParams) WithTimeout(timeout time.Duration) *GetCertificatesParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get certificates params. -func (o *GetCertificatesParams) SetTimeout(timeout time.Duration) { - o.inner.timeout = timeout -} - -// WithContext adds the context to the get certificates params. -// -// Deprecated: use the operation call with context to pass the context instead of [GetCertificatesParams]. -func (o *GetCertificatesParams) WithContext(ctx context.Context) *GetCertificatesParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get certificates params. -// -// Deprecated: use the operation call with context to pass the context instead of [GetCertificatesParams]. -func (o *GetCertificatesParams) SetContext(ctx context.Context) { - o.inner.ctx = ctx -} - -// WithHTTPClient adds the HTTPClient to the get certificates params. -func (o *GetCertificatesParams) WithHTTPClient(client *http.Client) *GetCertificatesParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get certificates params. -func (o *GetCertificatesParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithID adds the id to the get certificates params. -func (o *GetCertificatesParams) WithID(id *string) *GetCertificatesParams { - o.SetID(id) - return o -} - -// SetID adds the id to the get certificates params. -func (o *GetCertificatesParams) SetID(id *string) { - o.ID = id -} - -// WithLimit adds the limit to the get certificates params. -func (o *GetCertificatesParams) WithLimit(limit *int64) *GetCertificatesParams { - o.SetLimit(limit) - return o -} - -// SetLimit adds the limit to the get certificates params. -func (o *GetCertificatesParams) SetLimit(limit *int64) { - o.Limit = limit -} - -// WithOffset adds the offset to the get certificates params. -func (o *GetCertificatesParams) WithOffset(offset *int64) *GetCertificatesParams { - o.SetOffset(offset) - return o -} - -// SetOffset adds the offset to the get certificates params. -func (o *GetCertificatesParams) SetOffset(offset *int64) { - o.Offset = offset -} - -// WriteToRequest writes these params to a [runtime.ClientRequest]. -func (o *GetCertificatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.inner.timeout); err != nil { - return err - } - var res []error - - if o.ID != nil { - - // query param id - var qrID string - - if o.ID != nil { - qrID = *o.ID - } - qID := qrID - if qID != "" { - - if err := r.SetQueryParam("id", qID); err != nil { - return err - } - } - } - - if o.Limit != nil { - - // query param limit - var qrLimit int64 - - if o.Limit != nil { - qrLimit = *o.Limit - } - qLimit := conv.FormatInteger(qrLimit) - if qLimit != "" { - - if err := r.SetQueryParam("limit", qLimit); err != nil { - return err - } - } - } - - if o.Offset != nil { - - // query param offset - var qrOffset int64 - - if o.Offset != nil { - qrOffset = *o.Offset - } - qOffset := conv.FormatInteger(qrOffset) - if qOffset != "" { - - if err := r.SetQueryParam("offset", qOffset); err != nil { - return err - } - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/members/members_client/certificates/get_certificates_responses.go b/api/members/members_client/certificates/get_certificates_responses.go deleted file mode 100644 index 572dda7..0000000 --- a/api/members/members_client/certificates/get_certificates_responses.go +++ /dev/null @@ -1,484 +0,0 @@ -// 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 certificates - -import ( - "encoding/json" - stderrors "errors" - "fmt" - "io" - - "code.tnxs.net/vernonkeenan/lib/api/members/members_models" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// GetCertificatesReader is a Reader for the GetCertificates structure. -type GetCertificatesReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) { - switch response.Code() { - case 200: - result := NewGetCertificatesOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 401: - result := NewGetCertificatesUnauthorized() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewGetCertificatesForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewGetCertificatesNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 422: - result := NewGetCertificatesUnprocessableEntity() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewGetCertificatesInternalServerError() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /certificates] getCertificates", response, response.Code()) - } -} - -// NewGetCertificatesOK creates a GetCertificatesOK with default headers values -func NewGetCertificatesOK() *GetCertificatesOK { - return &GetCertificatesOK{} -} - -// GetCertificatesOK describes a response with status code 200, with default header values. -// -// Certificate Response Object -type GetCertificatesOK struct { - Payload *members_models.CertificateResponse -} - -// IsSuccess returns true when this get certificates o k response has a 2xx status code -func (o *GetCertificatesOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get certificates o k response has a 3xx status code -func (o *GetCertificatesOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get certificates o k response has a 4xx status code -func (o *GetCertificatesOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get certificates o k response has a 5xx status code -func (o *GetCertificatesOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get certificates o k response a status code equal to that given -func (o *GetCertificatesOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get certificates o k response -func (o *GetCertificatesOK) Code() int { - return 200 -} - -func (o *GetCertificatesOK) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[GET /certificates][%d] getCertificatesOK %s", 200, payload) -} - -func (o *GetCertificatesOK) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[GET /certificates][%d] getCertificatesOK %s", 200, payload) -} - -func (o *GetCertificatesOK) GetPayload() *members_models.CertificateResponse { - return o.Payload -} - -func (o *GetCertificatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.CertificateResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewGetCertificatesUnauthorized creates a GetCertificatesUnauthorized with default headers values -func NewGetCertificatesUnauthorized() *GetCertificatesUnauthorized { - return &GetCertificatesUnauthorized{} -} - -// GetCertificatesUnauthorized describes a response with status code 401, with default header values. -// -// Access Unauthorized, invalid API-KEY was used -type GetCertificatesUnauthorized struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this get certificates unauthorized response has a 2xx status code -func (o *GetCertificatesUnauthorized) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get certificates unauthorized response has a 3xx status code -func (o *GetCertificatesUnauthorized) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get certificates unauthorized response has a 4xx status code -func (o *GetCertificatesUnauthorized) IsClientError() bool { - return true -} - -// IsServerError returns true when this get certificates unauthorized response has a 5xx status code -func (o *GetCertificatesUnauthorized) IsServerError() bool { - return false -} - -// IsCode returns true when this get certificates unauthorized response a status code equal to that given -func (o *GetCertificatesUnauthorized) IsCode(code int) bool { - return code == 401 -} - -// Code gets the status code for the get certificates unauthorized response -func (o *GetCertificatesUnauthorized) Code() int { - return 401 -} - -func (o *GetCertificatesUnauthorized) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnauthorized %s", 401, payload) -} - -func (o *GetCertificatesUnauthorized) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnauthorized %s", 401, payload) -} - -func (o *GetCertificatesUnauthorized) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *GetCertificatesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewGetCertificatesForbidden creates a GetCertificatesForbidden with default headers values -func NewGetCertificatesForbidden() *GetCertificatesForbidden { - return &GetCertificatesForbidden{} -} - -// GetCertificatesForbidden describes a response with status code 403, with default header values. -// -// Access forbidden, account lacks access -type GetCertificatesForbidden struct { - AccessControlAllowOrigin string - - Payload *members_models.Error -} - -// IsSuccess returns true when this get certificates forbidden response has a 2xx status code -func (o *GetCertificatesForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get certificates forbidden response has a 3xx status code -func (o *GetCertificatesForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get certificates forbidden response has a 4xx status code -func (o *GetCertificatesForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this get certificates forbidden response has a 5xx status code -func (o *GetCertificatesForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this get certificates forbidden response a status code equal to that given -func (o *GetCertificatesForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the get certificates forbidden response -func (o *GetCertificatesForbidden) Code() int { - return 403 -} - -func (o *GetCertificatesForbidden) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[GET /certificates][%d] getCertificatesForbidden %s", 403, payload) -} - -func (o *GetCertificatesForbidden) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[GET /certificates][%d] getCertificatesForbidden %s", 403, payload) -} - -func (o *GetCertificatesForbidden) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *GetCertificatesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewGetCertificatesNotFound creates a GetCertificatesNotFound with default headers values -func NewGetCertificatesNotFound() *GetCertificatesNotFound { - return &GetCertificatesNotFound{} -} - -// GetCertificatesNotFound describes a response with status code 404, with default header values. -// -// Resource was not found -type GetCertificatesNotFound struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this get certificates not found response has a 2xx status code -func (o *GetCertificatesNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get certificates not found response has a 3xx status code -func (o *GetCertificatesNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get certificates not found response has a 4xx status code -func (o *GetCertificatesNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this get certificates not found response has a 5xx status code -func (o *GetCertificatesNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this get certificates not found response a status code equal to that given -func (o *GetCertificatesNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the get certificates not found response -func (o *GetCertificatesNotFound) Code() int { - return 404 -} - -func (o *GetCertificatesNotFound) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[GET /certificates][%d] getCertificatesNotFound %s", 404, payload) -} - -func (o *GetCertificatesNotFound) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[GET /certificates][%d] getCertificatesNotFound %s", 404, payload) -} - -func (o *GetCertificatesNotFound) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *GetCertificatesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewGetCertificatesUnprocessableEntity creates a GetCertificatesUnprocessableEntity with default headers values -func NewGetCertificatesUnprocessableEntity() *GetCertificatesUnprocessableEntity { - return &GetCertificatesUnprocessableEntity{} -} - -// GetCertificatesUnprocessableEntity describes a response with status code 422, with default header values. -// -// Unprocessable Entity, likely a bad parameter -type GetCertificatesUnprocessableEntity struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this get certificates unprocessable entity response has a 2xx status code -func (o *GetCertificatesUnprocessableEntity) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get certificates unprocessable entity response has a 3xx status code -func (o *GetCertificatesUnprocessableEntity) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get certificates unprocessable entity response has a 4xx status code -func (o *GetCertificatesUnprocessableEntity) IsClientError() bool { - return true -} - -// IsServerError returns true when this get certificates unprocessable entity response has a 5xx status code -func (o *GetCertificatesUnprocessableEntity) IsServerError() bool { - return false -} - -// IsCode returns true when this get certificates unprocessable entity response a status code equal to that given -func (o *GetCertificatesUnprocessableEntity) IsCode(code int) bool { - return code == 422 -} - -// Code gets the status code for the get certificates unprocessable entity response -func (o *GetCertificatesUnprocessableEntity) Code() int { - return 422 -} - -func (o *GetCertificatesUnprocessableEntity) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnprocessableEntity %s", 422, payload) -} - -func (o *GetCertificatesUnprocessableEntity) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[GET /certificates][%d] getCertificatesUnprocessableEntity %s", 422, payload) -} - -func (o *GetCertificatesUnprocessableEntity) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *GetCertificatesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewGetCertificatesInternalServerError creates a GetCertificatesInternalServerError with default headers values -func NewGetCertificatesInternalServerError() *GetCertificatesInternalServerError { - return &GetCertificatesInternalServerError{} -} - -// GetCertificatesInternalServerError describes a response with status code 500, with default header values. -// -// Server Internal Error -type GetCertificatesInternalServerError struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this get certificates internal server error response has a 2xx status code -func (o *GetCertificatesInternalServerError) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get certificates internal server error response has a 3xx status code -func (o *GetCertificatesInternalServerError) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get certificates internal server error response has a 4xx status code -func (o *GetCertificatesInternalServerError) IsClientError() bool { - return false -} - -// IsServerError returns true when this get certificates internal server error response has a 5xx status code -func (o *GetCertificatesInternalServerError) IsServerError() bool { - return true -} - -// IsCode returns true when this get certificates internal server error response a status code equal to that given -func (o *GetCertificatesInternalServerError) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the get certificates internal server error response -func (o *GetCertificatesInternalServerError) Code() int { - return 500 -} - -func (o *GetCertificatesInternalServerError) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[GET /certificates][%d] getCertificatesInternalServerError %s", 500, payload) -} - -func (o *GetCertificatesInternalServerError) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[GET /certificates][%d] getCertificatesInternalServerError %s", 500, payload) -} - -func (o *GetCertificatesInternalServerError) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *GetCertificatesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} diff --git a/api/members/members_client/certificates/post_certificates_parameters.go b/api/members/members_client/certificates/post_certificates_parameters.go deleted file mode 100644 index d89b15c..0000000 --- a/api/members/members_client/certificates/post_certificates_parameters.go +++ /dev/null @@ -1,159 +0,0 @@ -// 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 certificates - -import ( - "context" - "net/http" - "time" - - "code.tnxs.net/vernonkeenan/lib/api/members/members_models" - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewPostCertificatesParams creates a new PostCertificatesParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewPostCertificatesParams() *PostCertificatesParams { - return NewPostCertificatesParamsWithTimeout(cr.DefaultTimeout) -} - -// NewPostCertificatesParamsWithTimeout creates a new PostCertificatesParams object -// with the ability to set a timeout on a request. -func NewPostCertificatesParamsWithTimeout(timeout time.Duration) *PostCertificatesParams { - return &PostCertificatesParams{ - inner: innerParams{ - timeout: timeout, - }, - } -} - -// NewPostCertificatesParamsWithContext creates a new PostCertificatesParams object -// with the ability to set a context for a request. -// -// Deprecated: use the operation call with context to pass the context instead of [PostCertificatesParams]. -func NewPostCertificatesParamsWithContext(ctx context.Context) *PostCertificatesParams { - return &PostCertificatesParams{ - inner: innerParams{ - ctx: ctx, - }, - } -} - -// NewPostCertificatesParamsWithHTTPClient creates a new PostCertificatesParams object -// with the ability to set a custom HTTPClient for a request. -func NewPostCertificatesParamsWithHTTPClient(client *http.Client) *PostCertificatesParams { - return &PostCertificatesParams{ - HTTPClient: client, - } -} - -/* -PostCertificatesParams contains all the parameters to send to the API endpoint - - for the post certificates operation. - - Typically these are written to a http.Request. -*/ -type PostCertificatesParams struct { - - // CertificateRequest. - // - // An array of new Certificate records - CertificateRequest *members_models.CertificateRequest - - HTTPClient *http.Client - - inner innerParams -} - -// WithDefaults hydrates default values in the post certificates params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PostCertificatesParams) WithDefaults() *PostCertificatesParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the post certificates params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PostCertificatesParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the post certificates params. -func (o *PostCertificatesParams) WithTimeout(timeout time.Duration) *PostCertificatesParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the post certificates params. -func (o *PostCertificatesParams) SetTimeout(timeout time.Duration) { - o.inner.timeout = timeout -} - -// WithContext adds the context to the post certificates params. -// -// Deprecated: use the operation call with context to pass the context instead of [PostCertificatesParams]. -func (o *PostCertificatesParams) WithContext(ctx context.Context) *PostCertificatesParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the post certificates params. -// -// Deprecated: use the operation call with context to pass the context instead of [PostCertificatesParams]. -func (o *PostCertificatesParams) SetContext(ctx context.Context) { - o.inner.ctx = ctx -} - -// WithHTTPClient adds the HTTPClient to the post certificates params. -func (o *PostCertificatesParams) WithHTTPClient(client *http.Client) *PostCertificatesParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the post certificates params. -func (o *PostCertificatesParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithCertificateRequest adds the certificateRequest to the post certificates params. -func (o *PostCertificatesParams) WithCertificateRequest(certificateRequest *members_models.CertificateRequest) *PostCertificatesParams { - o.SetCertificateRequest(certificateRequest) - return o -} - -// SetCertificateRequest adds the certificateRequest to the post certificates params. -func (o *PostCertificatesParams) SetCertificateRequest(certificateRequest *members_models.CertificateRequest) { - o.CertificateRequest = certificateRequest -} - -// WriteToRequest writes these params to a [runtime.ClientRequest]. -func (o *PostCertificatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.inner.timeout); err != nil { - return err - } - var res []error - if o.CertificateRequest != nil { - if err := r.SetBodyParam(o.CertificateRequest); err != nil { - return err - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/members/members_client/certificates/post_certificates_responses.go b/api/members/members_client/certificates/post_certificates_responses.go deleted file mode 100644 index 58bae27..0000000 --- a/api/members/members_client/certificates/post_certificates_responses.go +++ /dev/null @@ -1,484 +0,0 @@ -// 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 certificates - -import ( - "encoding/json" - stderrors "errors" - "fmt" - "io" - - "code.tnxs.net/vernonkeenan/lib/api/members/members_models" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// PostCertificatesReader is a Reader for the PostCertificates structure. -type PostCertificatesReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PostCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) { - switch response.Code() { - case 200: - result := NewPostCertificatesOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 401: - result := NewPostCertificatesUnauthorized() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewPostCertificatesForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewPostCertificatesNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 422: - result := NewPostCertificatesUnprocessableEntity() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewPostCertificatesInternalServerError() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[POST /certificates] postCertificates", response, response.Code()) - } -} - -// NewPostCertificatesOK creates a PostCertificatesOK with default headers values -func NewPostCertificatesOK() *PostCertificatesOK { - return &PostCertificatesOK{} -} - -// PostCertificatesOK describes a response with status code 200, with default header values. -// -// Certificate Response Object -type PostCertificatesOK struct { - Payload *members_models.CertificateResponse -} - -// IsSuccess returns true when this post certificates o k response has a 2xx status code -func (o *PostCertificatesOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this post certificates o k response has a 3xx status code -func (o *PostCertificatesOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post certificates o k response has a 4xx status code -func (o *PostCertificatesOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this post certificates o k response has a 5xx status code -func (o *PostCertificatesOK) IsServerError() bool { - return false -} - -// IsCode returns true when this post certificates o k response a status code equal to that given -func (o *PostCertificatesOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the post certificates o k response -func (o *PostCertificatesOK) Code() int { - return 200 -} - -func (o *PostCertificatesOK) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /certificates][%d] postCertificatesOK %s", 200, payload) -} - -func (o *PostCertificatesOK) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /certificates][%d] postCertificatesOK %s", 200, payload) -} - -func (o *PostCertificatesOK) GetPayload() *members_models.CertificateResponse { - return o.Payload -} - -func (o *PostCertificatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.CertificateResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPostCertificatesUnauthorized creates a PostCertificatesUnauthorized with default headers values -func NewPostCertificatesUnauthorized() *PostCertificatesUnauthorized { - return &PostCertificatesUnauthorized{} -} - -// PostCertificatesUnauthorized describes a response with status code 401, with default header values. -// -// Access Unauthorized, invalid API-KEY was used -type PostCertificatesUnauthorized struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this post certificates unauthorized response has a 2xx status code -func (o *PostCertificatesUnauthorized) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this post certificates unauthorized response has a 3xx status code -func (o *PostCertificatesUnauthorized) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post certificates unauthorized response has a 4xx status code -func (o *PostCertificatesUnauthorized) IsClientError() bool { - return true -} - -// IsServerError returns true when this post certificates unauthorized response has a 5xx status code -func (o *PostCertificatesUnauthorized) IsServerError() bool { - return false -} - -// IsCode returns true when this post certificates unauthorized response a status code equal to that given -func (o *PostCertificatesUnauthorized) IsCode(code int) bool { - return code == 401 -} - -// Code gets the status code for the post certificates unauthorized response -func (o *PostCertificatesUnauthorized) Code() int { - return 401 -} - -func (o *PostCertificatesUnauthorized) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnauthorized %s", 401, payload) -} - -func (o *PostCertificatesUnauthorized) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnauthorized %s", 401, payload) -} - -func (o *PostCertificatesUnauthorized) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PostCertificatesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPostCertificatesForbidden creates a PostCertificatesForbidden with default headers values -func NewPostCertificatesForbidden() *PostCertificatesForbidden { - return &PostCertificatesForbidden{} -} - -// PostCertificatesForbidden describes a response with status code 403, with default header values. -// -// Access forbidden, account lacks access -type PostCertificatesForbidden struct { - AccessControlAllowOrigin string - - Payload *members_models.Error -} - -// IsSuccess returns true when this post certificates forbidden response has a 2xx status code -func (o *PostCertificatesForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this post certificates forbidden response has a 3xx status code -func (o *PostCertificatesForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post certificates forbidden response has a 4xx status code -func (o *PostCertificatesForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this post certificates forbidden response has a 5xx status code -func (o *PostCertificatesForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this post certificates forbidden response a status code equal to that given -func (o *PostCertificatesForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the post certificates forbidden response -func (o *PostCertificatesForbidden) Code() int { - return 403 -} - -func (o *PostCertificatesForbidden) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /certificates][%d] postCertificatesForbidden %s", 403, payload) -} - -func (o *PostCertificatesForbidden) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /certificates][%d] postCertificatesForbidden %s", 403, payload) -} - -func (o *PostCertificatesForbidden) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PostCertificatesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPostCertificatesNotFound creates a PostCertificatesNotFound with default headers values -func NewPostCertificatesNotFound() *PostCertificatesNotFound { - return &PostCertificatesNotFound{} -} - -// PostCertificatesNotFound describes a response with status code 404, with default header values. -// -// Resource was not found -type PostCertificatesNotFound struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this post certificates not found response has a 2xx status code -func (o *PostCertificatesNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this post certificates not found response has a 3xx status code -func (o *PostCertificatesNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post certificates not found response has a 4xx status code -func (o *PostCertificatesNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this post certificates not found response has a 5xx status code -func (o *PostCertificatesNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this post certificates not found response a status code equal to that given -func (o *PostCertificatesNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the post certificates not found response -func (o *PostCertificatesNotFound) Code() int { - return 404 -} - -func (o *PostCertificatesNotFound) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /certificates][%d] postCertificatesNotFound %s", 404, payload) -} - -func (o *PostCertificatesNotFound) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /certificates][%d] postCertificatesNotFound %s", 404, payload) -} - -func (o *PostCertificatesNotFound) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PostCertificatesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPostCertificatesUnprocessableEntity creates a PostCertificatesUnprocessableEntity with default headers values -func NewPostCertificatesUnprocessableEntity() *PostCertificatesUnprocessableEntity { - return &PostCertificatesUnprocessableEntity{} -} - -// PostCertificatesUnprocessableEntity describes a response with status code 422, with default header values. -// -// Unprocessable Entity, likely a bad parameter -type PostCertificatesUnprocessableEntity struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this post certificates unprocessable entity response has a 2xx status code -func (o *PostCertificatesUnprocessableEntity) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this post certificates unprocessable entity response has a 3xx status code -func (o *PostCertificatesUnprocessableEntity) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post certificates unprocessable entity response has a 4xx status code -func (o *PostCertificatesUnprocessableEntity) IsClientError() bool { - return true -} - -// IsServerError returns true when this post certificates unprocessable entity response has a 5xx status code -func (o *PostCertificatesUnprocessableEntity) IsServerError() bool { - return false -} - -// IsCode returns true when this post certificates unprocessable entity response a status code equal to that given -func (o *PostCertificatesUnprocessableEntity) IsCode(code int) bool { - return code == 422 -} - -// Code gets the status code for the post certificates unprocessable entity response -func (o *PostCertificatesUnprocessableEntity) Code() int { - return 422 -} - -func (o *PostCertificatesUnprocessableEntity) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnprocessableEntity %s", 422, payload) -} - -func (o *PostCertificatesUnprocessableEntity) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnprocessableEntity %s", 422, payload) -} - -func (o *PostCertificatesUnprocessableEntity) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PostCertificatesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPostCertificatesInternalServerError creates a PostCertificatesInternalServerError with default headers values -func NewPostCertificatesInternalServerError() *PostCertificatesInternalServerError { - return &PostCertificatesInternalServerError{} -} - -// PostCertificatesInternalServerError describes a response with status code 500, with default header values. -// -// Server Internal Error -type PostCertificatesInternalServerError struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this post certificates internal server error response has a 2xx status code -func (o *PostCertificatesInternalServerError) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this post certificates internal server error response has a 3xx status code -func (o *PostCertificatesInternalServerError) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post certificates internal server error response has a 4xx status code -func (o *PostCertificatesInternalServerError) IsClientError() bool { - return false -} - -// IsServerError returns true when this post certificates internal server error response has a 5xx status code -func (o *PostCertificatesInternalServerError) IsServerError() bool { - return true -} - -// IsCode returns true when this post certificates internal server error response a status code equal to that given -func (o *PostCertificatesInternalServerError) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the post certificates internal server error response -func (o *PostCertificatesInternalServerError) Code() int { - return 500 -} - -func (o *PostCertificatesInternalServerError) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /certificates][%d] postCertificatesInternalServerError %s", 500, payload) -} - -func (o *PostCertificatesInternalServerError) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /certificates][%d] postCertificatesInternalServerError %s", 500, payload) -} - -func (o *PostCertificatesInternalServerError) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PostCertificatesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} diff --git a/api/members/members_client/certificates/put_certificates_parameters.go b/api/members/members_client/certificates/put_certificates_parameters.go deleted file mode 100644 index 61c04cc..0000000 --- a/api/members/members_client/certificates/put_certificates_parameters.go +++ /dev/null @@ -1,159 +0,0 @@ -// 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 certificates - -import ( - "context" - "net/http" - "time" - - "code.tnxs.net/vernonkeenan/lib/api/members/members_models" - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewPutCertificatesParams creates a new PutCertificatesParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewPutCertificatesParams() *PutCertificatesParams { - return NewPutCertificatesParamsWithTimeout(cr.DefaultTimeout) -} - -// NewPutCertificatesParamsWithTimeout creates a new PutCertificatesParams object -// with the ability to set a timeout on a request. -func NewPutCertificatesParamsWithTimeout(timeout time.Duration) *PutCertificatesParams { - return &PutCertificatesParams{ - inner: innerParams{ - timeout: timeout, - }, - } -} - -// NewPutCertificatesParamsWithContext creates a new PutCertificatesParams object -// with the ability to set a context for a request. -// -// Deprecated: use the operation call with context to pass the context instead of [PutCertificatesParams]. -func NewPutCertificatesParamsWithContext(ctx context.Context) *PutCertificatesParams { - return &PutCertificatesParams{ - inner: innerParams{ - ctx: ctx, - }, - } -} - -// NewPutCertificatesParamsWithHTTPClient creates a new PutCertificatesParams object -// with the ability to set a custom HTTPClient for a request. -func NewPutCertificatesParamsWithHTTPClient(client *http.Client) *PutCertificatesParams { - return &PutCertificatesParams{ - HTTPClient: client, - } -} - -/* -PutCertificatesParams contains all the parameters to send to the API endpoint - - for the put certificates operation. - - Typically these are written to a http.Request. -*/ -type PutCertificatesParams struct { - - // CertificateRequest. - // - // An array of new Certificate records - CertificateRequest *members_models.CertificateRequest - - HTTPClient *http.Client - - inner innerParams -} - -// WithDefaults hydrates default values in the put certificates params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PutCertificatesParams) WithDefaults() *PutCertificatesParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the put certificates params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PutCertificatesParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the put certificates params. -func (o *PutCertificatesParams) WithTimeout(timeout time.Duration) *PutCertificatesParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the put certificates params. -func (o *PutCertificatesParams) SetTimeout(timeout time.Duration) { - o.inner.timeout = timeout -} - -// WithContext adds the context to the put certificates params. -// -// Deprecated: use the operation call with context to pass the context instead of [PutCertificatesParams]. -func (o *PutCertificatesParams) WithContext(ctx context.Context) *PutCertificatesParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the put certificates params. -// -// Deprecated: use the operation call with context to pass the context instead of [PutCertificatesParams]. -func (o *PutCertificatesParams) SetContext(ctx context.Context) { - o.inner.ctx = ctx -} - -// WithHTTPClient adds the HTTPClient to the put certificates params. -func (o *PutCertificatesParams) WithHTTPClient(client *http.Client) *PutCertificatesParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the put certificates params. -func (o *PutCertificatesParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithCertificateRequest adds the certificateRequest to the put certificates params. -func (o *PutCertificatesParams) WithCertificateRequest(certificateRequest *members_models.CertificateRequest) *PutCertificatesParams { - o.SetCertificateRequest(certificateRequest) - return o -} - -// SetCertificateRequest adds the certificateRequest to the put certificates params. -func (o *PutCertificatesParams) SetCertificateRequest(certificateRequest *members_models.CertificateRequest) { - o.CertificateRequest = certificateRequest -} - -// WriteToRequest writes these params to a [runtime.ClientRequest]. -func (o *PutCertificatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.inner.timeout); err != nil { - return err - } - var res []error - if o.CertificateRequest != nil { - if err := r.SetBodyParam(o.CertificateRequest); err != nil { - return err - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/members/members_client/certificates/put_certificates_responses.go b/api/members/members_client/certificates/put_certificates_responses.go deleted file mode 100644 index 1ad6d94..0000000 --- a/api/members/members_client/certificates/put_certificates_responses.go +++ /dev/null @@ -1,484 +0,0 @@ -// 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 certificates - -import ( - "encoding/json" - stderrors "errors" - "fmt" - "io" - - "code.tnxs.net/vernonkeenan/lib/api/members/members_models" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// PutCertificatesReader is a Reader for the PutCertificates structure. -type PutCertificatesReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PutCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) { - switch response.Code() { - case 200: - result := NewPutCertificatesOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 401: - result := NewPutCertificatesUnauthorized() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewPutCertificatesForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewPutCertificatesNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 422: - result := NewPutCertificatesUnprocessableEntity() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewPutCertificatesInternalServerError() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[PUT /certificates] putCertificates", response, response.Code()) - } -} - -// NewPutCertificatesOK creates a PutCertificatesOK with default headers values -func NewPutCertificatesOK() *PutCertificatesOK { - return &PutCertificatesOK{} -} - -// PutCertificatesOK describes a response with status code 200, with default header values. -// -// Certificate Response Object -type PutCertificatesOK struct { - Payload *members_models.CertificateResponse -} - -// IsSuccess returns true when this put certificates o k response has a 2xx status code -func (o *PutCertificatesOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this put certificates o k response has a 3xx status code -func (o *PutCertificatesOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put certificates o k response has a 4xx status code -func (o *PutCertificatesOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this put certificates o k response has a 5xx status code -func (o *PutCertificatesOK) IsServerError() bool { - return false -} - -// IsCode returns true when this put certificates o k response a status code equal to that given -func (o *PutCertificatesOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the put certificates o k response -func (o *PutCertificatesOK) Code() int { - return 200 -} - -func (o *PutCertificatesOK) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /certificates][%d] putCertificatesOK %s", 200, payload) -} - -func (o *PutCertificatesOK) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /certificates][%d] putCertificatesOK %s", 200, payload) -} - -func (o *PutCertificatesOK) GetPayload() *members_models.CertificateResponse { - return o.Payload -} - -func (o *PutCertificatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.CertificateResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPutCertificatesUnauthorized creates a PutCertificatesUnauthorized with default headers values -func NewPutCertificatesUnauthorized() *PutCertificatesUnauthorized { - return &PutCertificatesUnauthorized{} -} - -// PutCertificatesUnauthorized describes a response with status code 401, with default header values. -// -// Access Unauthorized, invalid API-KEY was used -type PutCertificatesUnauthorized struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this put certificates unauthorized response has a 2xx status code -func (o *PutCertificatesUnauthorized) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put certificates unauthorized response has a 3xx status code -func (o *PutCertificatesUnauthorized) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put certificates unauthorized response has a 4xx status code -func (o *PutCertificatesUnauthorized) IsClientError() bool { - return true -} - -// IsServerError returns true when this put certificates unauthorized response has a 5xx status code -func (o *PutCertificatesUnauthorized) IsServerError() bool { - return false -} - -// IsCode returns true when this put certificates unauthorized response a status code equal to that given -func (o *PutCertificatesUnauthorized) IsCode(code int) bool { - return code == 401 -} - -// Code gets the status code for the put certificates unauthorized response -func (o *PutCertificatesUnauthorized) Code() int { - return 401 -} - -func (o *PutCertificatesUnauthorized) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnauthorized %s", 401, payload) -} - -func (o *PutCertificatesUnauthorized) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnauthorized %s", 401, payload) -} - -func (o *PutCertificatesUnauthorized) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PutCertificatesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPutCertificatesForbidden creates a PutCertificatesForbidden with default headers values -func NewPutCertificatesForbidden() *PutCertificatesForbidden { - return &PutCertificatesForbidden{} -} - -// PutCertificatesForbidden describes a response with status code 403, with default header values. -// -// Access forbidden, account lacks access -type PutCertificatesForbidden struct { - AccessControlAllowOrigin string - - Payload *members_models.Error -} - -// IsSuccess returns true when this put certificates forbidden response has a 2xx status code -func (o *PutCertificatesForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put certificates forbidden response has a 3xx status code -func (o *PutCertificatesForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put certificates forbidden response has a 4xx status code -func (o *PutCertificatesForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this put certificates forbidden response has a 5xx status code -func (o *PutCertificatesForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this put certificates forbidden response a status code equal to that given -func (o *PutCertificatesForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the put certificates forbidden response -func (o *PutCertificatesForbidden) Code() int { - return 403 -} - -func (o *PutCertificatesForbidden) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /certificates][%d] putCertificatesForbidden %s", 403, payload) -} - -func (o *PutCertificatesForbidden) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /certificates][%d] putCertificatesForbidden %s", 403, payload) -} - -func (o *PutCertificatesForbidden) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PutCertificatesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPutCertificatesNotFound creates a PutCertificatesNotFound with default headers values -func NewPutCertificatesNotFound() *PutCertificatesNotFound { - return &PutCertificatesNotFound{} -} - -// PutCertificatesNotFound describes a response with status code 404, with default header values. -// -// Resource was not found -type PutCertificatesNotFound struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this put certificates not found response has a 2xx status code -func (o *PutCertificatesNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put certificates not found response has a 3xx status code -func (o *PutCertificatesNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put certificates not found response has a 4xx status code -func (o *PutCertificatesNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this put certificates not found response has a 5xx status code -func (o *PutCertificatesNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this put certificates not found response a status code equal to that given -func (o *PutCertificatesNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the put certificates not found response -func (o *PutCertificatesNotFound) Code() int { - return 404 -} - -func (o *PutCertificatesNotFound) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /certificates][%d] putCertificatesNotFound %s", 404, payload) -} - -func (o *PutCertificatesNotFound) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /certificates][%d] putCertificatesNotFound %s", 404, payload) -} - -func (o *PutCertificatesNotFound) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PutCertificatesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPutCertificatesUnprocessableEntity creates a PutCertificatesUnprocessableEntity with default headers values -func NewPutCertificatesUnprocessableEntity() *PutCertificatesUnprocessableEntity { - return &PutCertificatesUnprocessableEntity{} -} - -// PutCertificatesUnprocessableEntity describes a response with status code 422, with default header values. -// -// Unprocessable Entity, likely a bad parameter -type PutCertificatesUnprocessableEntity struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this put certificates unprocessable entity response has a 2xx status code -func (o *PutCertificatesUnprocessableEntity) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put certificates unprocessable entity response has a 3xx status code -func (o *PutCertificatesUnprocessableEntity) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put certificates unprocessable entity response has a 4xx status code -func (o *PutCertificatesUnprocessableEntity) IsClientError() bool { - return true -} - -// IsServerError returns true when this put certificates unprocessable entity response has a 5xx status code -func (o *PutCertificatesUnprocessableEntity) IsServerError() bool { - return false -} - -// IsCode returns true when this put certificates unprocessable entity response a status code equal to that given -func (o *PutCertificatesUnprocessableEntity) IsCode(code int) bool { - return code == 422 -} - -// Code gets the status code for the put certificates unprocessable entity response -func (o *PutCertificatesUnprocessableEntity) Code() int { - return 422 -} - -func (o *PutCertificatesUnprocessableEntity) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnprocessableEntity %s", 422, payload) -} - -func (o *PutCertificatesUnprocessableEntity) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /certificates][%d] putCertificatesUnprocessableEntity %s", 422, payload) -} - -func (o *PutCertificatesUnprocessableEntity) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PutCertificatesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPutCertificatesInternalServerError creates a PutCertificatesInternalServerError with default headers values -func NewPutCertificatesInternalServerError() *PutCertificatesInternalServerError { - return &PutCertificatesInternalServerError{} -} - -// PutCertificatesInternalServerError describes a response with status code 500, with default header values. -// -// Server Internal Error -type PutCertificatesInternalServerError struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this put certificates internal server error response has a 2xx status code -func (o *PutCertificatesInternalServerError) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put certificates internal server error response has a 3xx status code -func (o *PutCertificatesInternalServerError) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put certificates internal server error response has a 4xx status code -func (o *PutCertificatesInternalServerError) IsClientError() bool { - return false -} - -// IsServerError returns true when this put certificates internal server error response has a 5xx status code -func (o *PutCertificatesInternalServerError) IsServerError() bool { - return true -} - -// IsCode returns true when this put certificates internal server error response a status code equal to that given -func (o *PutCertificatesInternalServerError) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the put certificates internal server error response -func (o *PutCertificatesInternalServerError) Code() int { - return 500 -} - -func (o *PutCertificatesInternalServerError) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /certificates][%d] putCertificatesInternalServerError %s", 500, payload) -} - -func (o *PutCertificatesInternalServerError) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /certificates][%d] putCertificatesInternalServerError %s", 500, payload) -} - -func (o *PutCertificatesInternalServerError) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PutCertificatesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} diff --git a/api/members/members_client/courses/courses_client.go b/api/members/members_client/courses/courses_client.go index ea345fd..851b332 100644 --- a/api/members/members_client/courses/courses_client.go +++ b/api/members/members_client/courses/courses_client.go @@ -119,6 +119,8 @@ type ClientService interface { // 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. // @@ -136,6 +138,8 @@ func (a *Client) GetCourseLessons(params *GetCourseLessonsParams, authInfo runti // 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 @@ -182,6 +186,8 @@ func (a *Client) GetCourseLessonsContext(ctx context.Context, params *GetCourseL // 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. // @@ -199,6 +205,8 @@ func (a *Client) GetCourseSections(params *GetCourseSectionsParams, authInfo run // 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 @@ -245,6 +253,8 @@ func (a *Client) GetCourseSectionsContext(ctx context.Context, params *GetCourse // 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. // @@ -262,6 +272,8 @@ func (a *Client) GetCourses(params *GetCoursesParams, authInfo runtime.ClientAut // 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 @@ -308,6 +320,8 @@ func (a *Client) GetCoursesContext(ctx context.Context, params *GetCoursesParams // 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. // @@ -325,6 +339,8 @@ func (a *Client) PostCourseLessons(params *PostCourseLessonsParams, authInfo run // 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 @@ -371,6 +387,8 @@ func (a *Client) PostCourseLessonsContext(ctx context.Context, params *PostCours // 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. // @@ -388,6 +406,8 @@ func (a *Client) PostCourseSections(params *PostCourseSectionsParams, authInfo r // 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 @@ -434,6 +454,8 @@ func (a *Client) PostCourseSectionsContext(ctx context.Context, params *PostCour // 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. // @@ -451,6 +473,8 @@ func (a *Client) PostCourses(params *PostCoursesParams, authInfo runtime.ClientA // 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 @@ -497,6 +521,8 @@ func (a *Client) PostCoursesContext(ctx context.Context, params *PostCoursesPara // 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. // @@ -514,6 +540,8 @@ func (a *Client) UpdateCourseLessons(params *UpdateCourseLessonsParams, authInfo // 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 @@ -560,6 +588,8 @@ func (a *Client) UpdateCourseLessonsContext(ctx context.Context, params *UpdateC // 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. // @@ -577,6 +607,8 @@ func (a *Client) UpdateCourseSections(params *UpdateCourseSectionsParams, authIn // 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 @@ -623,6 +655,8 @@ func (a *Client) UpdateCourseSectionsContext(ctx context.Context, params *Update // 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. // @@ -640,6 +674,8 @@ func (a *Client) UpdateCourses(params *UpdateCoursesParams, authInfo runtime.Cli // 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 diff --git a/api/members/members_client/courses/update_course_lessons_responses.go b/api/members/members_client/courses/update_course_lessons_responses.go index 3525d5e..c6d161a 100644 --- a/api/members/members_client/courses/update_course_lessons_responses.go +++ b/api/members/members_client/courses/update_course_lessons_responses.go @@ -49,6 +49,12 @@ func (o *UpdateCourseLessonsReader) ReadResponse(response runtime.ClientResponse return nil, err } return nil, result + case 409: + result := NewUpdateCourseLessonsConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result case 422: result := NewUpdateCourseLessonsUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { @@ -347,6 +353,74 @@ func (o *UpdateCourseLessonsNotFound) readResponse(response runtime.ClientRespon return nil } +// NewUpdateCourseLessonsConflict creates a UpdateCourseLessonsConflict with default headers values +func NewUpdateCourseLessonsConflict() *UpdateCourseLessonsConflict { + return &UpdateCourseLessonsConflict{} +} + +// UpdateCourseLessonsConflict describes a response with status code 409, with default header values. +// +// The supplied LastModifiedDate is stale; reload the record before retrying. +type UpdateCourseLessonsConflict struct { + Payload *members_models.Error +} + +// IsSuccess returns true when this update course lessons conflict response has a 2xx status code +func (o *UpdateCourseLessonsConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update course lessons conflict response has a 3xx status code +func (o *UpdateCourseLessonsConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update course lessons conflict response has a 4xx status code +func (o *UpdateCourseLessonsConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this update course lessons conflict response has a 5xx status code +func (o *UpdateCourseLessonsConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this update course lessons conflict response a status code equal to that given +func (o *UpdateCourseLessonsConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the update course lessons conflict response +func (o *UpdateCourseLessonsConflict) Code() int { + return 409 +} + +func (o *UpdateCourseLessonsConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /courselessons][%d] updateCourseLessonsConflict %s", 409, payload) +} + +func (o *UpdateCourseLessonsConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /courselessons][%d] updateCourseLessonsConflict %s", 409, payload) +} + +func (o *UpdateCourseLessonsConflict) GetPayload() *members_models.Error { + return o.Payload +} + +func (o *UpdateCourseLessonsConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(members_models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { + return err + } + + return nil +} + // NewUpdateCourseLessonsUnprocessableEntity creates a UpdateCourseLessonsUnprocessableEntity with default headers values func NewUpdateCourseLessonsUnprocessableEntity() *UpdateCourseLessonsUnprocessableEntity { return &UpdateCourseLessonsUnprocessableEntity{} diff --git a/api/members/members_client/courses/update_course_sections_responses.go b/api/members/members_client/courses/update_course_sections_responses.go index 279fc5b..e753151 100644 --- a/api/members/members_client/courses/update_course_sections_responses.go +++ b/api/members/members_client/courses/update_course_sections_responses.go @@ -49,6 +49,12 @@ func (o *UpdateCourseSectionsReader) ReadResponse(response runtime.ClientRespons return nil, err } return nil, result + case 409: + result := NewUpdateCourseSectionsConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result case 422: result := NewUpdateCourseSectionsUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { @@ -347,6 +353,74 @@ func (o *UpdateCourseSectionsNotFound) readResponse(response runtime.ClientRespo return nil } +// NewUpdateCourseSectionsConflict creates a UpdateCourseSectionsConflict with default headers values +func NewUpdateCourseSectionsConflict() *UpdateCourseSectionsConflict { + return &UpdateCourseSectionsConflict{} +} + +// UpdateCourseSectionsConflict describes a response with status code 409, with default header values. +// +// The supplied LastModifiedDate is stale; reload the record before retrying. +type UpdateCourseSectionsConflict struct { + Payload *members_models.Error +} + +// IsSuccess returns true when this update course sections conflict response has a 2xx status code +func (o *UpdateCourseSectionsConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update course sections conflict response has a 3xx status code +func (o *UpdateCourseSectionsConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update course sections conflict response has a 4xx status code +func (o *UpdateCourseSectionsConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this update course sections conflict response has a 5xx status code +func (o *UpdateCourseSectionsConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this update course sections conflict response a status code equal to that given +func (o *UpdateCourseSectionsConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the update course sections conflict response +func (o *UpdateCourseSectionsConflict) Code() int { + return 409 +} + +func (o *UpdateCourseSectionsConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /coursesections][%d] updateCourseSectionsConflict %s", 409, payload) +} + +func (o *UpdateCourseSectionsConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /coursesections][%d] updateCourseSectionsConflict %s", 409, payload) +} + +func (o *UpdateCourseSectionsConflict) GetPayload() *members_models.Error { + return o.Payload +} + +func (o *UpdateCourseSectionsConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(members_models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { + return err + } + + return nil +} + // NewUpdateCourseSectionsUnprocessableEntity creates a UpdateCourseSectionsUnprocessableEntity with default headers values func NewUpdateCourseSectionsUnprocessableEntity() *UpdateCourseSectionsUnprocessableEntity { return &UpdateCourseSectionsUnprocessableEntity{} diff --git a/api/members/members_client/courses/update_courses_responses.go b/api/members/members_client/courses/update_courses_responses.go index 908d22b..a6937b8 100644 --- a/api/members/members_client/courses/update_courses_responses.go +++ b/api/members/members_client/courses/update_courses_responses.go @@ -49,6 +49,12 @@ func (o *UpdateCoursesReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result + case 409: + result := NewUpdateCoursesConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result case 422: result := NewUpdateCoursesUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { @@ -347,6 +353,74 @@ func (o *UpdateCoursesNotFound) readResponse(response runtime.ClientResponse, co return nil } +// NewUpdateCoursesConflict creates a UpdateCoursesConflict with default headers values +func NewUpdateCoursesConflict() *UpdateCoursesConflict { + return &UpdateCoursesConflict{} +} + +// UpdateCoursesConflict describes a response with status code 409, with default header values. +// +// The supplied LastModifiedDate is stale; reload the record before retrying. +type UpdateCoursesConflict struct { + Payload *members_models.Error +} + +// IsSuccess returns true when this update courses conflict response has a 2xx status code +func (o *UpdateCoursesConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update courses conflict response has a 3xx status code +func (o *UpdateCoursesConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update courses conflict response has a 4xx status code +func (o *UpdateCoursesConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this update courses conflict response has a 5xx status code +func (o *UpdateCoursesConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this update courses conflict response a status code equal to that given +func (o *UpdateCoursesConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the update courses conflict response +func (o *UpdateCoursesConflict) Code() int { + return 409 +} + +func (o *UpdateCoursesConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /courses][%d] updateCoursesConflict %s", 409, payload) +} + +func (o *UpdateCoursesConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /courses][%d] updateCoursesConflict %s", 409, payload) +} + +func (o *UpdateCoursesConflict) GetPayload() *members_models.Error { + return o.Payload +} + +func (o *UpdateCoursesConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(members_models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { + return err + } + + return nil +} + // NewUpdateCoursesUnprocessableEntity creates a UpdateCoursesUnprocessableEntity with default headers values func NewUpdateCoursesUnprocessableEntity() *UpdateCoursesUnprocessableEntity { return &UpdateCoursesUnprocessableEntity{} diff --git a/api/members/members_client/enrollments/enrollments_client.go b/api/members/members_client/enrollments/enrollments_client.go index 4962463..e20ce12 100644 --- a/api/members/members_client/enrollments/enrollments_client.go +++ b/api/members/members_client/enrollments/enrollments_client.go @@ -83,7 +83,7 @@ type ClientService interface { // GetEnrollments gets a list enrollments. // -// Return a list of Enrollment records from the datastore. +// User-global enrollment read. Requires members:enrollment:read and an active human session. Because Enrollment has no TenantID, records are restricted to the authenticated user and tenant managers receive no cross-user visibility.. // // This method does not support injected context. // However, timeout and opentracing contexts are honored whenever enabled. @@ -102,7 +102,7 @@ func (a *Client) GetEnrollments(params *GetEnrollmentsParams, authInfo runtime.C // GetEnrollmentsContext gets a list enrollments. // -// Return a list of Enrollment records from the datastore. +// User-global enrollment read. Requires members:enrollment:read and an active human session. Because Enrollment has no TenantID, records are restricted to the authenticated user and tenant managers receive no cross-user visibility.. // // Do not use the deprecated [GetEnrollmentsParams.Context] with this method: it would be ignored. func (a *Client) GetEnrollmentsContext(ctx context.Context, params *GetEnrollmentsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEnrollmentsOK, error) { @@ -150,7 +150,7 @@ func (a *Client) GetEnrollmentsContext(ctx context.Context, params *GetEnrollmen // PostEnrollments creates new enrollments. // -// Create Enrollments. +// User-global self-enrollment create. Requires members:enrollment:create and an active human session. UserID is derived from the actor; IDs, audit fields, EnrollmentDate, and Completed are server-owned.. // // This method does not support injected context. // However, timeout and opentracing contexts are honored whenever enabled. @@ -169,7 +169,7 @@ func (a *Client) PostEnrollments(params *PostEnrollmentsParams, authInfo runtime // PostEnrollmentsContext creates new enrollments. // -// Create Enrollments. +// User-global self-enrollment create. Requires members:enrollment:create and an active human session. UserID is derived from the actor; IDs, audit fields, EnrollmentDate, and Completed are server-owned.. // // Do not use the deprecated [PostEnrollmentsParams.Context] with this method: it would be ignored. func (a *Client) PostEnrollmentsContext(ctx context.Context, params *PostEnrollmentsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostEnrollmentsOK, error) { @@ -217,7 +217,7 @@ func (a *Client) PostEnrollmentsContext(ctx context.Context, params *PostEnrollm // PutEnrollments updates enrollment. // -// Update Enrollment. +// User-global self-enrollment CAS update. Requires members:enrollment:update and an active human session. UserID and CourseID are immutable; completion is monotonic.. // // This method does not support injected context. // However, timeout and opentracing contexts are honored whenever enabled. @@ -236,7 +236,7 @@ func (a *Client) PutEnrollments(params *PutEnrollmentsParams, authInfo runtime.C // PutEnrollmentsContext updates enrollment. // -// Update Enrollment. +// User-global self-enrollment CAS update. Requires members:enrollment:update and an active human session. UserID and CourseID are immutable; completion is monotonic.. // // Do not use the deprecated [PutEnrollmentsParams.Context] with this method: it would be ignored. func (a *Client) PutEnrollmentsContext(ctx context.Context, params *PutEnrollmentsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutEnrollmentsOK, error) { diff --git a/api/members/members_client/enrollments/put_enrollments_responses.go b/api/members/members_client/enrollments/put_enrollments_responses.go index cf481bc..17b1151 100644 --- a/api/members/members_client/enrollments/put_enrollments_responses.go +++ b/api/members/members_client/enrollments/put_enrollments_responses.go @@ -49,6 +49,12 @@ func (o *PutEnrollmentsReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result + case 409: + result := NewPutEnrollmentsConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result case 422: result := NewPutEnrollmentsUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { @@ -347,6 +353,74 @@ func (o *PutEnrollmentsNotFound) readResponse(response runtime.ClientResponse, c return nil } +// NewPutEnrollmentsConflict creates a PutEnrollmentsConflict with default headers values +func NewPutEnrollmentsConflict() *PutEnrollmentsConflict { + return &PutEnrollmentsConflict{} +} + +// PutEnrollmentsConflict describes a response with status code 409, with default header values. +// +// The supplied LastModifiedDate is stale; reload the record before retrying. +type PutEnrollmentsConflict struct { + Payload *members_models.Error +} + +// IsSuccess returns true when this put enrollments conflict response has a 2xx status code +func (o *PutEnrollmentsConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this put enrollments conflict response has a 3xx status code +func (o *PutEnrollmentsConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this put enrollments conflict response has a 4xx status code +func (o *PutEnrollmentsConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this put enrollments conflict response has a 5xx status code +func (o *PutEnrollmentsConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this put enrollments conflict response a status code equal to that given +func (o *PutEnrollmentsConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the put enrollments conflict response +func (o *PutEnrollmentsConflict) Code() int { + return 409 +} + +func (o *PutEnrollmentsConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /enrollments][%d] putEnrollmentsConflict %s", 409, payload) +} + +func (o *PutEnrollmentsConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /enrollments][%d] putEnrollmentsConflict %s", 409, payload) +} + +func (o *PutEnrollmentsConflict) GetPayload() *members_models.Error { + return o.Payload +} + +func (o *PutEnrollmentsConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(members_models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { + return err + } + + return nil +} + // NewPutEnrollmentsUnprocessableEntity creates a PutEnrollmentsUnprocessableEntity with default headers values func NewPutEnrollmentsUnprocessableEntity() *PutEnrollmentsUnprocessableEntity { return &PutEnrollmentsUnprocessableEntity{} diff --git a/api/members/members_client/issued_certificates/issued_certificates_client.go b/api/members/members_client/issued_certificates/issued_certificates_client.go index 80279ac..d31355a 100644 --- a/api/members/members_client/issued_certificates/issued_certificates_client.go +++ b/api/members/members_client/issued_certificates/issued_certificates_client.go @@ -66,24 +66,12 @@ type ClientService interface { // GetIssuedCertificatesContext get a list issued certificates. GetIssuedCertificatesContext(ctx context.Context, params *GetIssuedCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetIssuedCertificatesOK, error) - // PostIssuedCertificates create new issued certificates. - PostIssuedCertificates(params *PostIssuedCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostIssuedCertificatesOK, error) - - // PostIssuedCertificatesContext create new issued certificates. - PostIssuedCertificatesContext(ctx context.Context, params *PostIssuedCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostIssuedCertificatesOK, error) - - // PutIssuedCertificates update issued certificate. - PutIssuedCertificates(params *PutIssuedCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutIssuedCertificatesOK, error) - - // PutIssuedCertificatesContext update issued certificate. - PutIssuedCertificatesContext(ctx context.Context, params *PutIssuedCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutIssuedCertificatesOK, error) - SetTransport(transport runtime.ContextualTransport) } // GetIssuedCertificates gets a list issued certificates. // -// Return a list of IssuedCertificate records from the datastore. +// Sanitized user-global certificate read. Requires members:issued-certificate:read and an active human session. Records are restricted to the authenticated user; verification material is never returned. Issuance, mutation, revocation, and deletion require a separate lifecycle API and are intentionally unavailable here.. // // This method does not support injected context. // However, timeout and opentracing contexts are honored whenever enabled. @@ -102,7 +90,7 @@ func (a *Client) GetIssuedCertificates(params *GetIssuedCertificatesParams, auth // GetIssuedCertificatesContext gets a list issued certificates. // -// Return a list of IssuedCertificate records from the datastore. +// Sanitized user-global certificate read. Requires members:issued-certificate:read and an active human session. Records are restricted to the authenticated user; verification material is never returned. Issuance, mutation, revocation, and deletion require a separate lifecycle API and are intentionally unavailable here.. // // Do not use the deprecated [GetIssuedCertificatesParams.Context] with this method: it would be ignored. func (a *Client) GetIssuedCertificatesContext(ctx context.Context, params *GetIssuedCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetIssuedCertificatesOK, error) { @@ -148,140 +136,6 @@ func (a *Client) GetIssuedCertificatesContext(ctx context.Context, params *GetIs panic(msg) } -// PostIssuedCertificates creates new issued certificates. -// -// Create IssuedCertificates. -// -// 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.PostIssuedCertificatesContext] instead. -func (a *Client) PostIssuedCertificates(params *PostIssuedCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostIssuedCertificatesOK, error) { - var ctx context.Context - if params.inner.ctx != nil { - ctx = params.inner.ctx - } else { - ctx = context.Background() - } - - return a.PostIssuedCertificatesContext(ctx, params, authInfo, opts...) -} - -// PostIssuedCertificatesContext creates new issued certificates. -// -// Create IssuedCertificates. -// -// Do not use the deprecated [PostIssuedCertificatesParams.Context] with this method: it would be ignored. -func (a *Client) PostIssuedCertificatesContext(ctx context.Context, params *PostIssuedCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostIssuedCertificatesOK, error) { - // NOTE: parameters are not validated before sending - if params == nil { - params = NewPostIssuedCertificatesParams() - } - - op := &runtime.ClientOperation{ - ID: "postIssuedCertificates", - Method: "POST", - PathPattern: "/issuedcertificates", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PostIssuedCertificatesReader{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.(*PostIssuedCertificatesOK) - 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 postIssuedCertificates: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -// PutIssuedCertificates updates issued certificate. -// -// Update IssuedCertificate. -// -// 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.PutIssuedCertificatesContext] instead. -func (a *Client) PutIssuedCertificates(params *PutIssuedCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutIssuedCertificatesOK, error) { - var ctx context.Context - if params.inner.ctx != nil { - ctx = params.inner.ctx - } else { - ctx = context.Background() - } - - return a.PutIssuedCertificatesContext(ctx, params, authInfo, opts...) -} - -// PutIssuedCertificatesContext updates issued certificate. -// -// Update IssuedCertificate. -// -// Do not use the deprecated [PutIssuedCertificatesParams.Context] with this method: it would be ignored. -func (a *Client) PutIssuedCertificatesContext(ctx context.Context, params *PutIssuedCertificatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutIssuedCertificatesOK, error) { - // NOTE: parameters are not validated before sending - if params == nil { - params = NewPutIssuedCertificatesParams() - } - - op := &runtime.ClientOperation{ - ID: "putIssuedCertificates", - Method: "PUT", - PathPattern: "/issuedcertificates", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PutIssuedCertificatesReader{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.(*PutIssuedCertificatesOK) - 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 putIssuedCertificates: 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 diff --git a/api/members/members_client/issued_certificates/post_issued_certificates_parameters.go b/api/members/members_client/issued_certificates/post_issued_certificates_parameters.go deleted file mode 100644 index b055d6c..0000000 --- a/api/members/members_client/issued_certificates/post_issued_certificates_parameters.go +++ /dev/null @@ -1,159 +0,0 @@ -// 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 issued_certificates - -import ( - "context" - "net/http" - "time" - - "code.tnxs.net/vernonkeenan/lib/api/members/members_models" - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewPostIssuedCertificatesParams creates a new PostIssuedCertificatesParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewPostIssuedCertificatesParams() *PostIssuedCertificatesParams { - return NewPostIssuedCertificatesParamsWithTimeout(cr.DefaultTimeout) -} - -// NewPostIssuedCertificatesParamsWithTimeout creates a new PostIssuedCertificatesParams object -// with the ability to set a timeout on a request. -func NewPostIssuedCertificatesParamsWithTimeout(timeout time.Duration) *PostIssuedCertificatesParams { - return &PostIssuedCertificatesParams{ - inner: innerParams{ - timeout: timeout, - }, - } -} - -// NewPostIssuedCertificatesParamsWithContext creates a new PostIssuedCertificatesParams object -// with the ability to set a context for a request. -// -// Deprecated: use the operation call with context to pass the context instead of [PostIssuedCertificatesParams]. -func NewPostIssuedCertificatesParamsWithContext(ctx context.Context) *PostIssuedCertificatesParams { - return &PostIssuedCertificatesParams{ - inner: innerParams{ - ctx: ctx, - }, - } -} - -// NewPostIssuedCertificatesParamsWithHTTPClient creates a new PostIssuedCertificatesParams object -// with the ability to set a custom HTTPClient for a request. -func NewPostIssuedCertificatesParamsWithHTTPClient(client *http.Client) *PostIssuedCertificatesParams { - return &PostIssuedCertificatesParams{ - HTTPClient: client, - } -} - -/* -PostIssuedCertificatesParams contains all the parameters to send to the API endpoint - - for the post issued certificates operation. - - Typically these are written to a http.Request. -*/ -type PostIssuedCertificatesParams struct { - - // IssuedCertificateRequest. - // - // An array of new IssuedCertificate records - IssuedCertificateRequest *members_models.IssuedCertificateRequest - - HTTPClient *http.Client - - inner innerParams -} - -// WithDefaults hydrates default values in the post issued certificates params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PostIssuedCertificatesParams) WithDefaults() *PostIssuedCertificatesParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the post issued certificates params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PostIssuedCertificatesParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the post issued certificates params. -func (o *PostIssuedCertificatesParams) WithTimeout(timeout time.Duration) *PostIssuedCertificatesParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the post issued certificates params. -func (o *PostIssuedCertificatesParams) SetTimeout(timeout time.Duration) { - o.inner.timeout = timeout -} - -// WithContext adds the context to the post issued certificates params. -// -// Deprecated: use the operation call with context to pass the context instead of [PostIssuedCertificatesParams]. -func (o *PostIssuedCertificatesParams) WithContext(ctx context.Context) *PostIssuedCertificatesParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the post issued certificates params. -// -// Deprecated: use the operation call with context to pass the context instead of [PostIssuedCertificatesParams]. -func (o *PostIssuedCertificatesParams) SetContext(ctx context.Context) { - o.inner.ctx = ctx -} - -// WithHTTPClient adds the HTTPClient to the post issued certificates params. -func (o *PostIssuedCertificatesParams) WithHTTPClient(client *http.Client) *PostIssuedCertificatesParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the post issued certificates params. -func (o *PostIssuedCertificatesParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithIssuedCertificateRequest adds the issuedCertificateRequest to the post issued certificates params. -func (o *PostIssuedCertificatesParams) WithIssuedCertificateRequest(issuedCertificateRequest *members_models.IssuedCertificateRequest) *PostIssuedCertificatesParams { - o.SetIssuedCertificateRequest(issuedCertificateRequest) - return o -} - -// SetIssuedCertificateRequest adds the issuedCertificateRequest to the post issued certificates params. -func (o *PostIssuedCertificatesParams) SetIssuedCertificateRequest(issuedCertificateRequest *members_models.IssuedCertificateRequest) { - o.IssuedCertificateRequest = issuedCertificateRequest -} - -// WriteToRequest writes these params to a [runtime.ClientRequest]. -func (o *PostIssuedCertificatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.inner.timeout); err != nil { - return err - } - var res []error - if o.IssuedCertificateRequest != nil { - if err := r.SetBodyParam(o.IssuedCertificateRequest); err != nil { - return err - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/members/members_client/issued_certificates/post_issued_certificates_responses.go b/api/members/members_client/issued_certificates/post_issued_certificates_responses.go deleted file mode 100644 index 6fba6d2..0000000 --- a/api/members/members_client/issued_certificates/post_issued_certificates_responses.go +++ /dev/null @@ -1,484 +0,0 @@ -// 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 issued_certificates - -import ( - "encoding/json" - stderrors "errors" - "fmt" - "io" - - "code.tnxs.net/vernonkeenan/lib/api/members/members_models" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// PostIssuedCertificatesReader is a Reader for the PostIssuedCertificates structure. -type PostIssuedCertificatesReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PostIssuedCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) { - switch response.Code() { - case 200: - result := NewPostIssuedCertificatesOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 401: - result := NewPostIssuedCertificatesUnauthorized() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewPostIssuedCertificatesForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewPostIssuedCertificatesNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 422: - result := NewPostIssuedCertificatesUnprocessableEntity() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewPostIssuedCertificatesInternalServerError() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[POST /issuedcertificates] postIssuedCertificates", response, response.Code()) - } -} - -// NewPostIssuedCertificatesOK creates a PostIssuedCertificatesOK with default headers values -func NewPostIssuedCertificatesOK() *PostIssuedCertificatesOK { - return &PostIssuedCertificatesOK{} -} - -// PostIssuedCertificatesOK describes a response with status code 200, with default header values. -// -// IssuedCertificate Response Object -type PostIssuedCertificatesOK struct { - Payload *members_models.IssuedCertificateResponse -} - -// IsSuccess returns true when this post issued certificates o k response has a 2xx status code -func (o *PostIssuedCertificatesOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this post issued certificates o k response has a 3xx status code -func (o *PostIssuedCertificatesOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post issued certificates o k response has a 4xx status code -func (o *PostIssuedCertificatesOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this post issued certificates o k response has a 5xx status code -func (o *PostIssuedCertificatesOK) IsServerError() bool { - return false -} - -// IsCode returns true when this post issued certificates o k response a status code equal to that given -func (o *PostIssuedCertificatesOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the post issued certificates o k response -func (o *PostIssuedCertificatesOK) Code() int { - return 200 -} - -func (o *PostIssuedCertificatesOK) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /issuedcertificates][%d] postIssuedCertificatesOK %s", 200, payload) -} - -func (o *PostIssuedCertificatesOK) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /issuedcertificates][%d] postIssuedCertificatesOK %s", 200, payload) -} - -func (o *PostIssuedCertificatesOK) GetPayload() *members_models.IssuedCertificateResponse { - return o.Payload -} - -func (o *PostIssuedCertificatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.IssuedCertificateResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPostIssuedCertificatesUnauthorized creates a PostIssuedCertificatesUnauthorized with default headers values -func NewPostIssuedCertificatesUnauthorized() *PostIssuedCertificatesUnauthorized { - return &PostIssuedCertificatesUnauthorized{} -} - -// PostIssuedCertificatesUnauthorized describes a response with status code 401, with default header values. -// -// Access Unauthorized, invalid API-KEY was used -type PostIssuedCertificatesUnauthorized struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this post issued certificates unauthorized response has a 2xx status code -func (o *PostIssuedCertificatesUnauthorized) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this post issued certificates unauthorized response has a 3xx status code -func (o *PostIssuedCertificatesUnauthorized) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post issued certificates unauthorized response has a 4xx status code -func (o *PostIssuedCertificatesUnauthorized) IsClientError() bool { - return true -} - -// IsServerError returns true when this post issued certificates unauthorized response has a 5xx status code -func (o *PostIssuedCertificatesUnauthorized) IsServerError() bool { - return false -} - -// IsCode returns true when this post issued certificates unauthorized response a status code equal to that given -func (o *PostIssuedCertificatesUnauthorized) IsCode(code int) bool { - return code == 401 -} - -// Code gets the status code for the post issued certificates unauthorized response -func (o *PostIssuedCertificatesUnauthorized) Code() int { - return 401 -} - -func (o *PostIssuedCertificatesUnauthorized) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /issuedcertificates][%d] postIssuedCertificatesUnauthorized %s", 401, payload) -} - -func (o *PostIssuedCertificatesUnauthorized) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /issuedcertificates][%d] postIssuedCertificatesUnauthorized %s", 401, payload) -} - -func (o *PostIssuedCertificatesUnauthorized) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PostIssuedCertificatesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPostIssuedCertificatesForbidden creates a PostIssuedCertificatesForbidden with default headers values -func NewPostIssuedCertificatesForbidden() *PostIssuedCertificatesForbidden { - return &PostIssuedCertificatesForbidden{} -} - -// PostIssuedCertificatesForbidden describes a response with status code 403, with default header values. -// -// Access forbidden, account lacks access -type PostIssuedCertificatesForbidden struct { - AccessControlAllowOrigin string - - Payload *members_models.Error -} - -// IsSuccess returns true when this post issued certificates forbidden response has a 2xx status code -func (o *PostIssuedCertificatesForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this post issued certificates forbidden response has a 3xx status code -func (o *PostIssuedCertificatesForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post issued certificates forbidden response has a 4xx status code -func (o *PostIssuedCertificatesForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this post issued certificates forbidden response has a 5xx status code -func (o *PostIssuedCertificatesForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this post issued certificates forbidden response a status code equal to that given -func (o *PostIssuedCertificatesForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the post issued certificates forbidden response -func (o *PostIssuedCertificatesForbidden) Code() int { - return 403 -} - -func (o *PostIssuedCertificatesForbidden) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /issuedcertificates][%d] postIssuedCertificatesForbidden %s", 403, payload) -} - -func (o *PostIssuedCertificatesForbidden) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /issuedcertificates][%d] postIssuedCertificatesForbidden %s", 403, payload) -} - -func (o *PostIssuedCertificatesForbidden) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PostIssuedCertificatesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPostIssuedCertificatesNotFound creates a PostIssuedCertificatesNotFound with default headers values -func NewPostIssuedCertificatesNotFound() *PostIssuedCertificatesNotFound { - return &PostIssuedCertificatesNotFound{} -} - -// PostIssuedCertificatesNotFound describes a response with status code 404, with default header values. -// -// Resource was not found -type PostIssuedCertificatesNotFound struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this post issued certificates not found response has a 2xx status code -func (o *PostIssuedCertificatesNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this post issued certificates not found response has a 3xx status code -func (o *PostIssuedCertificatesNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post issued certificates not found response has a 4xx status code -func (o *PostIssuedCertificatesNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this post issued certificates not found response has a 5xx status code -func (o *PostIssuedCertificatesNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this post issued certificates not found response a status code equal to that given -func (o *PostIssuedCertificatesNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the post issued certificates not found response -func (o *PostIssuedCertificatesNotFound) Code() int { - return 404 -} - -func (o *PostIssuedCertificatesNotFound) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /issuedcertificates][%d] postIssuedCertificatesNotFound %s", 404, payload) -} - -func (o *PostIssuedCertificatesNotFound) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /issuedcertificates][%d] postIssuedCertificatesNotFound %s", 404, payload) -} - -func (o *PostIssuedCertificatesNotFound) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PostIssuedCertificatesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPostIssuedCertificatesUnprocessableEntity creates a PostIssuedCertificatesUnprocessableEntity with default headers values -func NewPostIssuedCertificatesUnprocessableEntity() *PostIssuedCertificatesUnprocessableEntity { - return &PostIssuedCertificatesUnprocessableEntity{} -} - -// PostIssuedCertificatesUnprocessableEntity describes a response with status code 422, with default header values. -// -// Unprocessable Entity, likely a bad parameter -type PostIssuedCertificatesUnprocessableEntity struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this post issued certificates unprocessable entity response has a 2xx status code -func (o *PostIssuedCertificatesUnprocessableEntity) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this post issued certificates unprocessable entity response has a 3xx status code -func (o *PostIssuedCertificatesUnprocessableEntity) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post issued certificates unprocessable entity response has a 4xx status code -func (o *PostIssuedCertificatesUnprocessableEntity) IsClientError() bool { - return true -} - -// IsServerError returns true when this post issued certificates unprocessable entity response has a 5xx status code -func (o *PostIssuedCertificatesUnprocessableEntity) IsServerError() bool { - return false -} - -// IsCode returns true when this post issued certificates unprocessable entity response a status code equal to that given -func (o *PostIssuedCertificatesUnprocessableEntity) IsCode(code int) bool { - return code == 422 -} - -// Code gets the status code for the post issued certificates unprocessable entity response -func (o *PostIssuedCertificatesUnprocessableEntity) Code() int { - return 422 -} - -func (o *PostIssuedCertificatesUnprocessableEntity) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /issuedcertificates][%d] postIssuedCertificatesUnprocessableEntity %s", 422, payload) -} - -func (o *PostIssuedCertificatesUnprocessableEntity) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /issuedcertificates][%d] postIssuedCertificatesUnprocessableEntity %s", 422, payload) -} - -func (o *PostIssuedCertificatesUnprocessableEntity) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PostIssuedCertificatesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPostIssuedCertificatesInternalServerError creates a PostIssuedCertificatesInternalServerError with default headers values -func NewPostIssuedCertificatesInternalServerError() *PostIssuedCertificatesInternalServerError { - return &PostIssuedCertificatesInternalServerError{} -} - -// PostIssuedCertificatesInternalServerError describes a response with status code 500, with default header values. -// -// Server Internal Error -type PostIssuedCertificatesInternalServerError struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this post issued certificates internal server error response has a 2xx status code -func (o *PostIssuedCertificatesInternalServerError) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this post issued certificates internal server error response has a 3xx status code -func (o *PostIssuedCertificatesInternalServerError) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post issued certificates internal server error response has a 4xx status code -func (o *PostIssuedCertificatesInternalServerError) IsClientError() bool { - return false -} - -// IsServerError returns true when this post issued certificates internal server error response has a 5xx status code -func (o *PostIssuedCertificatesInternalServerError) IsServerError() bool { - return true -} - -// IsCode returns true when this post issued certificates internal server error response a status code equal to that given -func (o *PostIssuedCertificatesInternalServerError) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the post issued certificates internal server error response -func (o *PostIssuedCertificatesInternalServerError) Code() int { - return 500 -} - -func (o *PostIssuedCertificatesInternalServerError) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /issuedcertificates][%d] postIssuedCertificatesInternalServerError %s", 500, payload) -} - -func (o *PostIssuedCertificatesInternalServerError) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[POST /issuedcertificates][%d] postIssuedCertificatesInternalServerError %s", 500, payload) -} - -func (o *PostIssuedCertificatesInternalServerError) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PostIssuedCertificatesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} diff --git a/api/members/members_client/issued_certificates/put_issued_certificates_parameters.go b/api/members/members_client/issued_certificates/put_issued_certificates_parameters.go deleted file mode 100644 index 53cc0b9..0000000 --- a/api/members/members_client/issued_certificates/put_issued_certificates_parameters.go +++ /dev/null @@ -1,159 +0,0 @@ -// 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 issued_certificates - -import ( - "context" - "net/http" - "time" - - "code.tnxs.net/vernonkeenan/lib/api/members/members_models" - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewPutIssuedCertificatesParams creates a new PutIssuedCertificatesParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewPutIssuedCertificatesParams() *PutIssuedCertificatesParams { - return NewPutIssuedCertificatesParamsWithTimeout(cr.DefaultTimeout) -} - -// NewPutIssuedCertificatesParamsWithTimeout creates a new PutIssuedCertificatesParams object -// with the ability to set a timeout on a request. -func NewPutIssuedCertificatesParamsWithTimeout(timeout time.Duration) *PutIssuedCertificatesParams { - return &PutIssuedCertificatesParams{ - inner: innerParams{ - timeout: timeout, - }, - } -} - -// NewPutIssuedCertificatesParamsWithContext creates a new PutIssuedCertificatesParams object -// with the ability to set a context for a request. -// -// Deprecated: use the operation call with context to pass the context instead of [PutIssuedCertificatesParams]. -func NewPutIssuedCertificatesParamsWithContext(ctx context.Context) *PutIssuedCertificatesParams { - return &PutIssuedCertificatesParams{ - inner: innerParams{ - ctx: ctx, - }, - } -} - -// NewPutIssuedCertificatesParamsWithHTTPClient creates a new PutIssuedCertificatesParams object -// with the ability to set a custom HTTPClient for a request. -func NewPutIssuedCertificatesParamsWithHTTPClient(client *http.Client) *PutIssuedCertificatesParams { - return &PutIssuedCertificatesParams{ - HTTPClient: client, - } -} - -/* -PutIssuedCertificatesParams contains all the parameters to send to the API endpoint - - for the put issued certificates operation. - - Typically these are written to a http.Request. -*/ -type PutIssuedCertificatesParams struct { - - // IssuedCertificateRequest. - // - // An array of new IssuedCertificate records - IssuedCertificateRequest *members_models.IssuedCertificateRequest - - HTTPClient *http.Client - - inner innerParams -} - -// WithDefaults hydrates default values in the put issued certificates params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PutIssuedCertificatesParams) WithDefaults() *PutIssuedCertificatesParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the put issued certificates params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PutIssuedCertificatesParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the put issued certificates params. -func (o *PutIssuedCertificatesParams) WithTimeout(timeout time.Duration) *PutIssuedCertificatesParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the put issued certificates params. -func (o *PutIssuedCertificatesParams) SetTimeout(timeout time.Duration) { - o.inner.timeout = timeout -} - -// WithContext adds the context to the put issued certificates params. -// -// Deprecated: use the operation call with context to pass the context instead of [PutIssuedCertificatesParams]. -func (o *PutIssuedCertificatesParams) WithContext(ctx context.Context) *PutIssuedCertificatesParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the put issued certificates params. -// -// Deprecated: use the operation call with context to pass the context instead of [PutIssuedCertificatesParams]. -func (o *PutIssuedCertificatesParams) SetContext(ctx context.Context) { - o.inner.ctx = ctx -} - -// WithHTTPClient adds the HTTPClient to the put issued certificates params. -func (o *PutIssuedCertificatesParams) WithHTTPClient(client *http.Client) *PutIssuedCertificatesParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the put issued certificates params. -func (o *PutIssuedCertificatesParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithIssuedCertificateRequest adds the issuedCertificateRequest to the put issued certificates params. -func (o *PutIssuedCertificatesParams) WithIssuedCertificateRequest(issuedCertificateRequest *members_models.IssuedCertificateRequest) *PutIssuedCertificatesParams { - o.SetIssuedCertificateRequest(issuedCertificateRequest) - return o -} - -// SetIssuedCertificateRequest adds the issuedCertificateRequest to the put issued certificates params. -func (o *PutIssuedCertificatesParams) SetIssuedCertificateRequest(issuedCertificateRequest *members_models.IssuedCertificateRequest) { - o.IssuedCertificateRequest = issuedCertificateRequest -} - -// WriteToRequest writes these params to a [runtime.ClientRequest]. -func (o *PutIssuedCertificatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.inner.timeout); err != nil { - return err - } - var res []error - if o.IssuedCertificateRequest != nil { - if err := r.SetBodyParam(o.IssuedCertificateRequest); err != nil { - return err - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/members/members_client/issued_certificates/put_issued_certificates_responses.go b/api/members/members_client/issued_certificates/put_issued_certificates_responses.go deleted file mode 100644 index 36d8a67..0000000 --- a/api/members/members_client/issued_certificates/put_issued_certificates_responses.go +++ /dev/null @@ -1,484 +0,0 @@ -// 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 issued_certificates - -import ( - "encoding/json" - stderrors "errors" - "fmt" - "io" - - "code.tnxs.net/vernonkeenan/lib/api/members/members_models" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// PutIssuedCertificatesReader is a Reader for the PutIssuedCertificates structure. -type PutIssuedCertificatesReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PutIssuedCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) { - switch response.Code() { - case 200: - result := NewPutIssuedCertificatesOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 401: - result := NewPutIssuedCertificatesUnauthorized() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewPutIssuedCertificatesForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewPutIssuedCertificatesNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 422: - result := NewPutIssuedCertificatesUnprocessableEntity() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewPutIssuedCertificatesInternalServerError() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[PUT /issuedcertificates] putIssuedCertificates", response, response.Code()) - } -} - -// NewPutIssuedCertificatesOK creates a PutIssuedCertificatesOK with default headers values -func NewPutIssuedCertificatesOK() *PutIssuedCertificatesOK { - return &PutIssuedCertificatesOK{} -} - -// PutIssuedCertificatesOK describes a response with status code 200, with default header values. -// -// IssuedCertificate Response Object -type PutIssuedCertificatesOK struct { - Payload *members_models.IssuedCertificateResponse -} - -// IsSuccess returns true when this put issued certificates o k response has a 2xx status code -func (o *PutIssuedCertificatesOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this put issued certificates o k response has a 3xx status code -func (o *PutIssuedCertificatesOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put issued certificates o k response has a 4xx status code -func (o *PutIssuedCertificatesOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this put issued certificates o k response has a 5xx status code -func (o *PutIssuedCertificatesOK) IsServerError() bool { - return false -} - -// IsCode returns true when this put issued certificates o k response a status code equal to that given -func (o *PutIssuedCertificatesOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the put issued certificates o k response -func (o *PutIssuedCertificatesOK) Code() int { - return 200 -} - -func (o *PutIssuedCertificatesOK) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /issuedcertificates][%d] putIssuedCertificatesOK %s", 200, payload) -} - -func (o *PutIssuedCertificatesOK) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /issuedcertificates][%d] putIssuedCertificatesOK %s", 200, payload) -} - -func (o *PutIssuedCertificatesOK) GetPayload() *members_models.IssuedCertificateResponse { - return o.Payload -} - -func (o *PutIssuedCertificatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.IssuedCertificateResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPutIssuedCertificatesUnauthorized creates a PutIssuedCertificatesUnauthorized with default headers values -func NewPutIssuedCertificatesUnauthorized() *PutIssuedCertificatesUnauthorized { - return &PutIssuedCertificatesUnauthorized{} -} - -// PutIssuedCertificatesUnauthorized describes a response with status code 401, with default header values. -// -// Access Unauthorized, invalid API-KEY was used -type PutIssuedCertificatesUnauthorized struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this put issued certificates unauthorized response has a 2xx status code -func (o *PutIssuedCertificatesUnauthorized) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put issued certificates unauthorized response has a 3xx status code -func (o *PutIssuedCertificatesUnauthorized) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put issued certificates unauthorized response has a 4xx status code -func (o *PutIssuedCertificatesUnauthorized) IsClientError() bool { - return true -} - -// IsServerError returns true when this put issued certificates unauthorized response has a 5xx status code -func (o *PutIssuedCertificatesUnauthorized) IsServerError() bool { - return false -} - -// IsCode returns true when this put issued certificates unauthorized response a status code equal to that given -func (o *PutIssuedCertificatesUnauthorized) IsCode(code int) bool { - return code == 401 -} - -// Code gets the status code for the put issued certificates unauthorized response -func (o *PutIssuedCertificatesUnauthorized) Code() int { - return 401 -} - -func (o *PutIssuedCertificatesUnauthorized) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /issuedcertificates][%d] putIssuedCertificatesUnauthorized %s", 401, payload) -} - -func (o *PutIssuedCertificatesUnauthorized) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /issuedcertificates][%d] putIssuedCertificatesUnauthorized %s", 401, payload) -} - -func (o *PutIssuedCertificatesUnauthorized) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PutIssuedCertificatesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPutIssuedCertificatesForbidden creates a PutIssuedCertificatesForbidden with default headers values -func NewPutIssuedCertificatesForbidden() *PutIssuedCertificatesForbidden { - return &PutIssuedCertificatesForbidden{} -} - -// PutIssuedCertificatesForbidden describes a response with status code 403, with default header values. -// -// Access forbidden, account lacks access -type PutIssuedCertificatesForbidden struct { - AccessControlAllowOrigin string - - Payload *members_models.Error -} - -// IsSuccess returns true when this put issued certificates forbidden response has a 2xx status code -func (o *PutIssuedCertificatesForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put issued certificates forbidden response has a 3xx status code -func (o *PutIssuedCertificatesForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put issued certificates forbidden response has a 4xx status code -func (o *PutIssuedCertificatesForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this put issued certificates forbidden response has a 5xx status code -func (o *PutIssuedCertificatesForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this put issued certificates forbidden response a status code equal to that given -func (o *PutIssuedCertificatesForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the put issued certificates forbidden response -func (o *PutIssuedCertificatesForbidden) Code() int { - return 403 -} - -func (o *PutIssuedCertificatesForbidden) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /issuedcertificates][%d] putIssuedCertificatesForbidden %s", 403, payload) -} - -func (o *PutIssuedCertificatesForbidden) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /issuedcertificates][%d] putIssuedCertificatesForbidden %s", 403, payload) -} - -func (o *PutIssuedCertificatesForbidden) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PutIssuedCertificatesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // hydrates response header Access-Control-Allow-Origin - hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - - if hdrAccessControlAllowOrigin != "" { - o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin - } - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPutIssuedCertificatesNotFound creates a PutIssuedCertificatesNotFound with default headers values -func NewPutIssuedCertificatesNotFound() *PutIssuedCertificatesNotFound { - return &PutIssuedCertificatesNotFound{} -} - -// PutIssuedCertificatesNotFound describes a response with status code 404, with default header values. -// -// Resource was not found -type PutIssuedCertificatesNotFound struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this put issued certificates not found response has a 2xx status code -func (o *PutIssuedCertificatesNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put issued certificates not found response has a 3xx status code -func (o *PutIssuedCertificatesNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put issued certificates not found response has a 4xx status code -func (o *PutIssuedCertificatesNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this put issued certificates not found response has a 5xx status code -func (o *PutIssuedCertificatesNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this put issued certificates not found response a status code equal to that given -func (o *PutIssuedCertificatesNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the put issued certificates not found response -func (o *PutIssuedCertificatesNotFound) Code() int { - return 404 -} - -func (o *PutIssuedCertificatesNotFound) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /issuedcertificates][%d] putIssuedCertificatesNotFound %s", 404, payload) -} - -func (o *PutIssuedCertificatesNotFound) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /issuedcertificates][%d] putIssuedCertificatesNotFound %s", 404, payload) -} - -func (o *PutIssuedCertificatesNotFound) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PutIssuedCertificatesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPutIssuedCertificatesUnprocessableEntity creates a PutIssuedCertificatesUnprocessableEntity with default headers values -func NewPutIssuedCertificatesUnprocessableEntity() *PutIssuedCertificatesUnprocessableEntity { - return &PutIssuedCertificatesUnprocessableEntity{} -} - -// PutIssuedCertificatesUnprocessableEntity describes a response with status code 422, with default header values. -// -// Unprocessable Entity, likely a bad parameter -type PutIssuedCertificatesUnprocessableEntity struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this put issued certificates unprocessable entity response has a 2xx status code -func (o *PutIssuedCertificatesUnprocessableEntity) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put issued certificates unprocessable entity response has a 3xx status code -func (o *PutIssuedCertificatesUnprocessableEntity) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put issued certificates unprocessable entity response has a 4xx status code -func (o *PutIssuedCertificatesUnprocessableEntity) IsClientError() bool { - return true -} - -// IsServerError returns true when this put issued certificates unprocessable entity response has a 5xx status code -func (o *PutIssuedCertificatesUnprocessableEntity) IsServerError() bool { - return false -} - -// IsCode returns true when this put issued certificates unprocessable entity response a status code equal to that given -func (o *PutIssuedCertificatesUnprocessableEntity) IsCode(code int) bool { - return code == 422 -} - -// Code gets the status code for the put issued certificates unprocessable entity response -func (o *PutIssuedCertificatesUnprocessableEntity) Code() int { - return 422 -} - -func (o *PutIssuedCertificatesUnprocessableEntity) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /issuedcertificates][%d] putIssuedCertificatesUnprocessableEntity %s", 422, payload) -} - -func (o *PutIssuedCertificatesUnprocessableEntity) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /issuedcertificates][%d] putIssuedCertificatesUnprocessableEntity %s", 422, payload) -} - -func (o *PutIssuedCertificatesUnprocessableEntity) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PutIssuedCertificatesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} - -// NewPutIssuedCertificatesInternalServerError creates a PutIssuedCertificatesInternalServerError with default headers values -func NewPutIssuedCertificatesInternalServerError() *PutIssuedCertificatesInternalServerError { - return &PutIssuedCertificatesInternalServerError{} -} - -// PutIssuedCertificatesInternalServerError describes a response with status code 500, with default header values. -// -// Server Internal Error -type PutIssuedCertificatesInternalServerError struct { - Payload *members_models.Error -} - -// IsSuccess returns true when this put issued certificates internal server error response has a 2xx status code -func (o *PutIssuedCertificatesInternalServerError) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put issued certificates internal server error response has a 3xx status code -func (o *PutIssuedCertificatesInternalServerError) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put issued certificates internal server error response has a 4xx status code -func (o *PutIssuedCertificatesInternalServerError) IsClientError() bool { - return false -} - -// IsServerError returns true when this put issued certificates internal server error response has a 5xx status code -func (o *PutIssuedCertificatesInternalServerError) IsServerError() bool { - return true -} - -// IsCode returns true when this put issued certificates internal server error response a status code equal to that given -func (o *PutIssuedCertificatesInternalServerError) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the put issued certificates internal server error response -func (o *PutIssuedCertificatesInternalServerError) Code() int { - return 500 -} - -func (o *PutIssuedCertificatesInternalServerError) Error() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /issuedcertificates][%d] putIssuedCertificatesInternalServerError %s", 500, payload) -} - -func (o *PutIssuedCertificatesInternalServerError) String() string { - payload, _ := json.Marshal(o.Payload) - return fmt.Sprintf("[PUT /issuedcertificates][%d] putIssuedCertificatesInternalServerError %s", 500, payload) -} - -func (o *PutIssuedCertificatesInternalServerError) GetPayload() *members_models.Error { - return o.Payload -} - -func (o *PutIssuedCertificatesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(members_models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { - return err - } - - return nil -} diff --git a/api/members/members_client/learning_contract_test.go b/api/members/members_client/learning_contract_test.go new file mode 100644 index 0000000..288f020 --- /dev/null +++ b/api/members/members_client/learning_contract_test.go @@ -0,0 +1,652 @@ +package members_client_test + +import ( + "bytes" + "context" + "crypto/sha256" + "encoding/hex" + "encoding/json" + "os" + "path/filepath" + "reflect" + "regexp" + "runtime" + "strings" + "testing" + + "code.tnxs.net/vernonkeenan/lib/api/members/members_client/courses" + "code.tnxs.net/vernonkeenan/lib/api/members/members_client/enrollments" + "code.tnxs.net/vernonkeenan/lib/api/members/members_client/issued_certificates" + "code.tnxs.net/vernonkeenan/lib/api/members/members_client/lesson_progress" + "code.tnxs.net/vernonkeenan/lib/api/members/members_models" + openapiruntime "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +const membersLearningSpecSHA256 = "546c86af359490c898a2ab4fad2e0e96e9051fd854a5fcd07a56093a4121a891" + +var learningTestAuth = openapiruntime.ClientAuthInfoWriterFunc(func(openapiruntime.ClientRequest, strfmt.Registry) error { + return nil +}) + +type learningCaptureTransport struct { + operation *openapiruntime.ClientOperation +} + +func (transport *learningCaptureTransport) Submit(operation *openapiruntime.ClientOperation) (any, error) { + return transport.SubmitContext(context.Background(), operation) +} + +func (transport *learningCaptureTransport) SubmitContext(_ context.Context, operation *openapiruntime.ClientOperation) (any, error) { + transport.operation = operation + + switch operation.ID { + case "getCourses": + return courses.NewGetCoursesOK(), nil + case "postCourses": + return courses.NewPostCoursesOK(), nil + case "updateCourses": + return courses.NewUpdateCoursesOK(), nil + case "getCourseSections": + return courses.NewGetCourseSectionsOK(), nil + case "postCourseSections": + return courses.NewPostCourseSectionsOK(), nil + case "updateCourseSections": + return courses.NewUpdateCourseSectionsOK(), nil + case "getCourseLessons": + return courses.NewGetCourseLessonsOK(), nil + case "postCourseLessons": + return courses.NewPostCourseLessonsOK(), nil + case "updateCourseLessons": + return courses.NewUpdateCourseLessonsOK(), nil + case "getEnrollments": + return enrollments.NewGetEnrollmentsOK(), nil + case "postEnrollments": + return enrollments.NewPostEnrollmentsOK(), nil + case "putEnrollments": + return enrollments.NewPutEnrollmentsOK(), nil + case "getLessonProgresses": + return lesson_progress.NewGetLessonProgressesOK(), nil + case "postLessonProgresses": + return lesson_progress.NewPostLessonProgressesOK(), nil + case "putLessonProgresses": + return lesson_progress.NewPutLessonProgressesOK(), nil + case "getIssuedCertificates": + return issued_certificates.NewGetIssuedCertificatesOK(), nil + default: + panic("unexpected generated Learning operation: " + operation.ID) + } +} + +func TestGeneratedLearningOperationContract(t *testing.T) { + type operationCall func(openapiruntime.ContextualTransport) error + + tests := []struct { + name string + wantID string + wantMethod string + wantPath string + call operationCall + }{ + { + name: "list courses", wantID: "getCourses", wantMethod: "GET", wantPath: "/courses", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := courses.New(transport, strfmt.Default).GetCourses(courses.NewGetCoursesParams(), learningTestAuth) + return err + }, + }, + { + name: "create course", wantID: "postCourses", wantMethod: "POST", wantPath: "/courses", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := courses.New(transport, strfmt.Default).PostCourses(courses.NewPostCoursesParams(), learningTestAuth) + return err + }, + }, + { + name: "update course", wantID: "updateCourses", wantMethod: "PUT", wantPath: "/courses", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := courses.New(transport, strfmt.Default).UpdateCourses(courses.NewUpdateCoursesParams(), learningTestAuth) + return err + }, + }, + { + name: "list sections", wantID: "getCourseSections", wantMethod: "GET", wantPath: "/coursesections", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := courses.New(transport, strfmt.Default).GetCourseSections(courses.NewGetCourseSectionsParams(), learningTestAuth) + return err + }, + }, + { + name: "create section", wantID: "postCourseSections", wantMethod: "POST", wantPath: "/coursesections", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := courses.New(transport, strfmt.Default).PostCourseSections(courses.NewPostCourseSectionsParams(), learningTestAuth) + return err + }, + }, + { + name: "update section", wantID: "updateCourseSections", wantMethod: "PUT", wantPath: "/coursesections", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := courses.New(transport, strfmt.Default).UpdateCourseSections(courses.NewUpdateCourseSectionsParams(), learningTestAuth) + return err + }, + }, + { + name: "list lessons", wantID: "getCourseLessons", wantMethod: "GET", wantPath: "/courselessons", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := courses.New(transport, strfmt.Default).GetCourseLessons(courses.NewGetCourseLessonsParams(), learningTestAuth) + return err + }, + }, + { + name: "create lesson", wantID: "postCourseLessons", wantMethod: "POST", wantPath: "/courselessons", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := courses.New(transport, strfmt.Default).PostCourseLessons(courses.NewPostCourseLessonsParams(), learningTestAuth) + return err + }, + }, + { + name: "update lesson", wantID: "updateCourseLessons", wantMethod: "PUT", wantPath: "/courselessons", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := courses.New(transport, strfmt.Default).UpdateCourseLessons(courses.NewUpdateCourseLessonsParams(), learningTestAuth) + return err + }, + }, + { + name: "list enrollments", wantID: "getEnrollments", wantMethod: "GET", wantPath: "/enrollments", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := enrollments.New(transport, strfmt.Default).GetEnrollments(enrollments.NewGetEnrollmentsParams(), learningTestAuth) + return err + }, + }, + { + name: "create enrollment", wantID: "postEnrollments", wantMethod: "POST", wantPath: "/enrollments", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := enrollments.New(transport, strfmt.Default).PostEnrollments(enrollments.NewPostEnrollmentsParams(), learningTestAuth) + return err + }, + }, + { + name: "update enrollment", wantID: "putEnrollments", wantMethod: "PUT", wantPath: "/enrollments", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := enrollments.New(transport, strfmt.Default).PutEnrollments(enrollments.NewPutEnrollmentsParams(), learningTestAuth) + return err + }, + }, + { + name: "list lesson progress", wantID: "getLessonProgresses", wantMethod: "GET", wantPath: "/lessonprogress", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := lesson_progress.New(transport, strfmt.Default).GetLessonProgresses(lesson_progress.NewGetLessonProgressesParams(), learningTestAuth) + return err + }, + }, + { + name: "create lesson progress", wantID: "postLessonProgresses", wantMethod: "POST", wantPath: "/lessonprogress", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := lesson_progress.New(transport, strfmt.Default).PostLessonProgresses(lesson_progress.NewPostLessonProgressesParams(), learningTestAuth) + return err + }, + }, + { + name: "update lesson progress", wantID: "putLessonProgresses", wantMethod: "PUT", wantPath: "/lessonprogress", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := lesson_progress.New(transport, strfmt.Default).PutLessonProgresses(lesson_progress.NewPutLessonProgressesParams(), learningTestAuth) + return err + }, + }, + { + name: "list issued certificates", wantID: "getIssuedCertificates", wantMethod: "GET", wantPath: "/issuedcertificates", + call: func(transport openapiruntime.ContextualTransport) error { + _, err := issued_certificates.New(transport, strfmt.Default).GetIssuedCertificates(issued_certificates.NewGetIssuedCertificatesParams(), learningTestAuth) + return err + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + transport := &learningCaptureTransport{} + if err := test.call(transport); err != nil { + t.Fatalf("generated client operation failed: %v", err) + } + if transport.operation == nil { + t.Fatal("generated client did not submit an operation") + } + if transport.operation.ID != test.wantID { + t.Errorf("operation ID = %q, want %q", transport.operation.ID, test.wantID) + } + if transport.operation.Method != test.wantMethod { + t.Errorf("method = %q, want %q", transport.operation.Method, test.wantMethod) + } + if transport.operation.PathPattern != test.wantPath { + t.Errorf("path = %q, want %q", transport.operation.PathPattern, test.wantPath) + } + if transport.operation.AuthInfo == nil { + t.Error("generated operation discarded its auth-info writer") + } + }) + } +} + +func TestLearningSpecRequiresExactCompoundAuthentication(t *testing.T) { + specText := readMembersLearningSpec(t) + for _, definition := range []string{ + " ApiKeyAuth:\n type: \"apiKey\"\n in: \"header\"\n name: \"X-API-Key\"", + " kvSessionCookie:\n name: Cookie\n in: header\n type: apiKey", + } { + if !strings.Contains(specText, definition) { + t.Fatalf("authoritative spec is missing exact authentication definition:\n%s", definition) + } + } + + operations := map[string]map[string]string{ + "/courses": { + "get": "getCourses", + "post": "postCourses", + "put": "updateCourses", + }, + "/coursesections": { + "get": "getCourseSections", + "post": "postCourseSections", + "put": "updateCourseSections", + }, + "/courselessons": { + "get": "getCourseLessons", + "post": "postCourseLessons", + "put": "updateCourseLessons", + }, + "/enrollments": { + "get": "getEnrollments", + "post": "postEnrollments", + "put": "putEnrollments", + }, + "/lessonprogress": { + "get": "getLessonProgresses", + "post": "postLessonProgresses", + "put": "putLessonProgresses", + }, + "/issuedcertificates": { + "get": "getIssuedCertificates", + }, + } + + for path, methods := range operations { + for method, operationID := range methods { + operation := learningSpecOperationBlock(t, specText, path, method) + if !strings.Contains(operation, " operationId: "+operationID+"\n") { + t.Errorf("%s %s does not preserve operationId %q", strings.ToUpper(method), path, operationID) + } + const compoundSecurity = " security:\n - ApiKeyAuth: []\n kvSessionCookie: []" + if strings.Count(operation, compoundSecurity) != 1 { + t.Errorf("%s %s does not require the exact API-key + human-session compound security", strings.ToUpper(method), path) + } + } + } +} + +func TestLearningUpdateClientsPreserveConflictResponses(t *testing.T) { + conflicts := []interface{ IsCode(int) bool }{ + courses.NewUpdateCoursesConflict(), + courses.NewUpdateCourseSectionsConflict(), + courses.NewUpdateCourseLessonsConflict(), + enrollments.NewPutEnrollmentsConflict(), + lesson_progress.NewPutLessonProgressesConflict(), + } + for _, conflict := range conflicts { + if !conflict.IsCode(409) { + t.Errorf("%T does not preserve the optimistic-conflict response", conflict) + } + } +} + +func TestLearningGetOperationsPreserveIDFilters(t *testing.T) { + recordID := "record-id" + filters := []struct { + name string + got *string + }{ + {name: "Course", got: courses.NewGetCoursesParams().WithID(&recordID).ID}, + {name: "CourseSection", got: courses.NewGetCourseSectionsParams().WithID(&recordID).ID}, + {name: "CourseLesson", got: courses.NewGetCourseLessonsParams().WithID(&recordID).ID}, + {name: "Enrollment", got: enrollments.NewGetEnrollmentsParams().WithID(&recordID).ID}, + {name: "LessonProgress", got: lesson_progress.NewGetLessonProgressesParams().WithID(&recordID).ID}, + {name: "IssuedCertificate", got: issued_certificates.NewGetIssuedCertificatesParams().WithID(&recordID).ID}, + } + for _, filter := range filters { + if filter.got == nil || *filter.got != recordID { + t.Errorf("%s get-by-ID filter is absent", filter.name) + } + } +} + +func TestLearningModelsMatchSanitizedProviderContract(t *testing.T) { + assertExactModelFields(t, members_models.Course{}, map[string]string{ + "CreatedByID": "*string", "CreatedDate": "*string", "Description": "*string", + "Fulldescription": "*string", "ID": "string", "ImageAltText": "*string", + "ImageURL": "*string", "InstructorID": "*string", "LastModifiedByID": "*string", + "LastModifiedDate": "*string", "Logo": "*string", "Price": "*string", + "Slug": "*string", "TemplateID": "*string", "Title": "*string", + }) + assertExactModelFields(t, members_models.CourseSection{}, map[string]string{ + "Content": "*string", "CourseID": "*string", "CreatedByID": "*string", + "CreatedDate": "*string", "ID": "string", "ImageAltText": "*string", + "ImageURL": "*string", "LastModifiedByID": "*string", "LastModifiedDate": "*string", + "Logo": "*string", "Order": "*int64", "Slug": "*string", "Title": "*string", + }) + assertExactModelFields(t, members_models.CourseLesson{}, map[string]string{ + "Content": "*string", "CreatedByID": "*string", "CreatedDate": "*string", + "ID": "string", "ImageAltText": "*string", "ImageURL": "*string", + "LastModifiedByID": "*string", "LastModifiedDate": "*string", "Logo": "*string", + "Order": "*int64", "SectionID": "*string", "Slug": "*string", + "Title": "*string", "VideoURL": "*string", + }) + assertExactModelFields(t, members_models.Enrollment{}, map[string]string{ + "Completed": "*bool", "CourseID": "*string", "CreatedByID": "*string", + "CreatedDate": "*string", "EnrollmentDate": "*strfmt.Date", "ID": "string", + "LastModifiedByID": "*string", "LastModifiedDate": "*string", "UserID": "*string", + }) + assertExactModelFields(t, members_models.LessonProgress{}, map[string]string{ + "Completed": "bool", "CompletedAt": "*string", "CreatedByID": "*string", + "CreatedDate": "*string", "EnrollmentID": "*string", "ID": "string", + "LastModifiedByID": "*string", "LastModifiedDate": "*string", "LessonID": "*string", + "TenantID": "*string", "UserID": "*string", + }) + assertExactModelFields(t, members_models.IssuedCertificate{}, map[string]string{ + "AccountID": "*string", "CreatedByID": "*string", "CreatedDate": "*string", + "EnrollmentID": "*string", "ExpirationDate": "*string", "ID": "string", + "IssueDate": "*string", "LastModifiedByID": "*string", "LastModifiedDate": "*string", + "TemplateID": "*string", "UserID": "*string", + }) + + price := "125.50" + if err := (&members_models.Course{Price: &price}).Validate(strfmt.Default); err != nil { + t.Fatalf("valid exact-decimal Course.Price rejected: %v", err) + } + unsafePrice := "125.505" + if err := (&members_models.Course{Price: &unsafePrice}).Validate(strfmt.Default); err == nil { + t.Fatal("Course.Price accepted a value outside DECIMAL(10,2)") + } + + body, err := json.Marshal(members_models.IssuedCertificate{ID: "issued-certificate-id"}) + if err != nil { + t.Fatalf("marshal IssuedCertificate: %v", err) + } + for _, forbidden := range []string{"VerificationCode", "CertificateID"} { + if bytes.Contains(body, []byte(forbidden)) { + t.Errorf("sanitized IssuedCertificate JSON exposes %s: %s", forbidden, body) + } + } +} + +func TestLearningSingleRecordRequestsRejectBulkPayloads(t *testing.T) { + tests := []struct { + name string + validate func() error + }{ + { + name: "course", + validate: func() error { + return (&members_models.CourseRequest{Data: []*members_models.Course{{}, {}}}).Validate(strfmt.Default) + }, + }, + { + name: "course section", + validate: func() error { + return (&members_models.CourseSectionRequest{Data: []*members_models.CourseSection{{}, {}}}).Validate(strfmt.Default) + }, + }, + { + name: "course lesson", + validate: func() error { + return (&members_models.CourseLessonRequest{Data: []*members_models.CourseLesson{{}, {}}}).Validate(strfmt.Default) + }, + }, + { + name: "enrollment", + validate: func() error { + return (&members_models.EnrollmentRequest{Data: []*members_models.Enrollment{{}, {}}}).Validate(strfmt.Default) + }, + }, + { + name: "lesson progress", + validate: func() error { + return (&members_models.LessonProgressRequest{Data: []*members_models.LessonProgress{{}, {}}}).Validate(strfmt.Default) + }, + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + if err := test.validate(); err == nil { + t.Fatal("generated single-record request accepted a bulk payload") + } + }) + } +} + +func TestLearningLifecycleBoundariesRemainVisible(t *testing.T) { + specText := readMembersLearningSpec(t) + expectations := []struct { + path string + method string + terms []string + }{ + {path: "/coursesections", method: "put", terms: []string{"CourseID is immutable"}}, + {path: "/courselessons", method: "put", terms: []string{"SectionID is immutable"}}, + {path: "/enrollments", method: "put", terms: []string{"UserID and CourseID are immutable", "completion is monotonic"}}, + {path: "/lessonprogress", method: "put", terms: []string{"TenantID, UserID, EnrollmentID, and LessonID are immutable", "completion is monotonic", "CompletedAt is server-owned"}}, + {path: "/issuedcertificates", method: "get", terms: []string{"verification material is never returned", "Issuance, mutation, revocation, and deletion", "intentionally unavailable"}}, + } + for _, expectation := range expectations { + block := learningSpecOperationBlock(t, specText, expectation.path, expectation.method) + for _, term := range expectation.terms { + if !strings.Contains(block, term) { + t.Errorf("%s %s lost lifecycle boundary %q", strings.ToUpper(expectation.method), expectation.path, term) + } + } + } +} + +func TestLearningSurfaceOmitsUnsafeCertificateAndDeleteOperations(t *testing.T) { + contracts := []struct { + name string + typ reflect.Type + }{ + {name: "Courses", typ: reflect.TypeOf((*courses.ClientService)(nil)).Elem()}, + {name: "Enrollments", typ: reflect.TypeOf((*enrollments.ClientService)(nil)).Elem()}, + {name: "LessonProgress", typ: reflect.TypeOf((*lesson_progress.ClientService)(nil)).Elem()}, + {name: "IssuedCertificates", typ: reflect.TypeOf((*issued_certificates.ClientService)(nil)).Elem()}, + } + for _, contract := range contracts { + for index := 0; index < contract.typ.NumMethod(); index++ { + method := contract.typ.Method(index).Name + if strings.HasPrefix(method, "Delete") { + t.Errorf("%s client exposes unsupported delete operation %s", contract.name, method) + } + } + } + for _, method := range []string{ + "PostIssuedCertificate", "PostIssuedCertificateContext", + "PostIssuedCertificates", "PostIssuedCertificatesContext", + "PutIssuedCertificate", "PutIssuedCertificateContext", + "PutIssuedCertificates", "PutIssuedCertificatesContext", + "DeleteIssuedCertificate", "DeleteIssuedCertificateContext", + } { + if _, exists := contracts[3].typ.MethodByName(method); exists { + t.Errorf("read-only IssuedCertificate client exposes forbidden operation %s", method) + } + } + + repoRoot := learningRepoRoot(t) + certificateClientDir := filepath.Join(repoRoot, "api", "members", "members_client", "certificates") + if entries, err := os.ReadDir(certificateClientDir); err == nil { + for _, entry := range entries { + if strings.HasSuffix(entry.Name(), ".go") { + t.Errorf("removed /certificates generated client still contains %s", entry.Name()) + } + } + } else if !os.IsNotExist(err) { + t.Fatalf("inspect removed certificate client directory: %v", err) + } + for _, removed := range []string{ + filepath.Join(repoRoot, "api", "members", "members_models", "certificate.go"), + filepath.Join(repoRoot, "api", "members", "members_models", "certificate_request.go"), + filepath.Join(repoRoot, "api", "members", "members_models", "certificate_response.go"), + filepath.Join(repoRoot, "api", "members", "members_models", "issued_certificate_request.go"), + } { + if _, err := os.Stat(removed); !os.IsNotExist(err) { + t.Errorf("removed unsafe generated surface still exists: %s", removed) + } + } + + specText := readMembersLearningSpec(t) + if strings.Contains(specText, "\n /certificates:") { + t.Fatal("authoritative spec still exposes removed /certificates path") + } + issuedPath := learningSpecPathBlock(t, specText, "/issuedcertificates") + for _, forbidden := range []string{" post:", " put:", " patch:", " delete:"} { + if strings.Contains(issuedPath, forbidden) { + t.Fatalf("authoritative IssuedCertificate contract exposes forbidden operation %q", strings.TrimSpace(forbidden)) + } + } +} + +func TestMembersSpecIsPinnedToLearningProviderSource(t *testing.T) { + repoRoot := learningRepoRoot(t) + mainSpec, err := os.ReadFile(filepath.Join(repoRoot, "swagger", "members-vernonkeenan.yaml")) + if err != nil { + t.Fatalf("read Members spec: %v", err) + } + sum := sha256.Sum256(mainSpec) + if got := hex.EncodeToString(sum[:]); got != membersLearningSpecSHA256 { + t.Fatalf("Members spec drifted from Learning merge fb25d140: SHA-256 = %s, want %s", got, membersLearningSpecSHA256) + } + + externalSpec, err := os.ReadFile(filepath.Join(repoRoot, "swagger", "external", "members-vernonkeenan.yaml")) + if err != nil { + t.Fatalf("read external Members spec: %v", err) + } + normalized := bytes.ReplaceAll(externalSpec, []byte(`"https"`), []byte(`"http"`)) + normalized = bytes.ReplaceAll(normalized, []byte("gw.tnxs.net"), []byte("members.vernonkeenan.com:8080")) + normalized = bytes.ReplaceAll(normalized, []byte(`"/vk/members/v1"`), []byte(`"/v1"`)) + if !bytes.Equal(normalized, mainSpec) { + t.Fatal("external Members spec differs from the conventional host/scheme/base-path rewrite") + } +} + +func TestGeneratedLearningSurfaceHasNoSalesforceOrEmbeddedSecrets(t *testing.T) { + repoRoot := learningRepoRoot(t) + targets := []string{ + filepath.Join(repoRoot, "api", "members", "members_client", "courses"), + filepath.Join(repoRoot, "api", "members", "members_client", "enrollments"), + filepath.Join(repoRoot, "api", "members", "members_client", "lesson_progress"), + filepath.Join(repoRoot, "api", "members", "members_client", "issued_certificates"), + filepath.Join(repoRoot, "api", "members", "members_models", "course.go"), + filepath.Join(repoRoot, "api", "members", "members_models", "course_request.go"), + filepath.Join(repoRoot, "api", "members", "members_models", "course_section.go"), + filepath.Join(repoRoot, "api", "members", "members_models", "course_section_request.go"), + filepath.Join(repoRoot, "api", "members", "members_models", "course_lesson.go"), + filepath.Join(repoRoot, "api", "members", "members_models", "course_lesson_request.go"), + filepath.Join(repoRoot, "api", "members", "members_models", "enrollment.go"), + filepath.Join(repoRoot, "api", "members", "members_models", "enrollment_request.go"), + filepath.Join(repoRoot, "api", "members", "members_models", "lesson_progress.go"), + filepath.Join(repoRoot, "api", "members", "members_models", "lesson_progress_request.go"), + filepath.Join(repoRoot, "api", "members", "members_models", "issued_certificate.go"), + } + credentialLiteral := regexp.MustCompile(`(?i)(api[_-]?key|password|secret)\s*[:=]\s*["'][^"']+["']`) + + for _, target := range targets { + err := filepath.WalkDir(target, func(path string, entry os.DirEntry, walkErr error) error { + if walkErr != nil { + return walkErr + } + if entry.IsDir() || !strings.HasSuffix(path, ".go") || strings.HasSuffix(path, "_test.go") { + return nil + } + content, err := os.ReadFile(path) + if err != nil { + return err + } + lower := strings.ToLower(string(content)) + for _, forbidden := range []string{"salesforce", "sf-gate", "go-force", "private key-----"} { + if strings.Contains(lower, forbidden) { + t.Errorf("%s contains forbidden boundary %q", path, forbidden) + } + } + if credentialLiteral.Match(content) { + t.Errorf("%s contains a credential-shaped literal", path) + } + return nil + }) + if err != nil { + t.Fatalf("scan generated Learning target %s: %v", target, err) + } + } +} + +func assertExactModelFields(t *testing.T, model any, want map[string]string) { + t.Helper() + modelType := reflect.TypeOf(model) + if modelType.NumField() != len(want) { + t.Errorf("%s has %d fields, want exact authoritative set of %d", modelType.Name(), modelType.NumField(), len(want)) + } + for name, wantType := range want { + field, exists := modelType.FieldByName(name) + if !exists { + t.Errorf("%s is missing authoritative field %s", modelType.Name(), name) + continue + } + if field.Type.String() != wantType { + t.Errorf("%s.%s type = %s, want %s", modelType.Name(), name, field.Type, wantType) + } + if got := strings.Split(field.Tag.Get("json"), ",")[0]; got != name { + t.Errorf("%s.%s JSON name = %q, want %q", modelType.Name(), name, got, name) + } + } +} + +func readMembersLearningSpec(t *testing.T) string { + t.Helper() + content, err := os.ReadFile(filepath.Join(learningRepoRoot(t), "swagger", "members-vernonkeenan.yaml")) + if err != nil { + t.Fatalf("read Members Swagger: %v", err) + } + return string(content) +} + +func learningSpecPathBlock(t *testing.T, specText, path string) string { + t.Helper() + startMarker := " " + path + ":\n" + start := strings.Index(specText, startMarker) + if start < 0 { + t.Fatalf("authoritative spec is missing path %s", path) + } + block := specText[start+len(startMarker):] + if end := strings.Index(block, "\n /"); end >= 0 { + block = block[:end] + } + return block +} + +func learningSpecOperationBlock(t *testing.T, specText, path, method string) string { + t.Helper() + pathBlock := learningSpecPathBlock(t, specText, path) + startMarker := " " + method + ":\n" + start := strings.Index(pathBlock, startMarker) + if start < 0 { + t.Fatalf("authoritative spec is missing %s %s", strings.ToUpper(method), path) + } + block := pathBlock[start+len(startMarker):] + methodBoundary := regexp.MustCompile(`(?m)^ [a-z]+:\n`) + if end := methodBoundary.FindStringIndex(block); end != nil { + block = block[:end[0]] + } + return block +} + +func learningRepoRoot(t *testing.T) string { + t.Helper() + _, testFile, _, ok := runtime.Caller(0) + if !ok { + t.Fatal("resolve test source path") + } + return filepath.Clean(filepath.Join(filepath.Dir(testFile), "..", "..", "..")) +} diff --git a/api/members/members_client/lesson_progress/lesson_progress_client.go b/api/members/members_client/lesson_progress/lesson_progress_client.go index 659e8bd..036110d 100644 --- a/api/members/members_client/lesson_progress/lesson_progress_client.go +++ b/api/members/members_client/lesson_progress/lesson_progress_client.go @@ -83,7 +83,7 @@ type ClientService interface { // GetLessonProgresses gets a list lesson progresses. // -// Return a list of LessonProgress records from the datastore. +// Tenant- and user-scoped lesson-progress read. Requires members:lesson-progress:read and an active human session. Owners and managers can read their tenant; other members can read only their own records.. // // This method does not support injected context. // However, timeout and opentracing contexts are honored whenever enabled. @@ -102,7 +102,7 @@ func (a *Client) GetLessonProgresses(params *GetLessonProgressesParams, authInfo // GetLessonProgressesContext gets a list lesson progresses. // -// Return a list of LessonProgress records from the datastore. +// Tenant- and user-scoped lesson-progress read. Requires members:lesson-progress:read and an active human session. Owners and managers can read their tenant; other members can read only their own records.. // // Do not use the deprecated [GetLessonProgressesParams.Context] with this method: it would be ignored. func (a *Client) GetLessonProgressesContext(ctx context.Context, params *GetLessonProgressesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLessonProgressesOK, error) { @@ -150,7 +150,7 @@ func (a *Client) GetLessonProgressesContext(ctx context.Context, params *GetLess // PostLessonProgresses creates new lesson progresses. // -// Create LessonProgresses. +// Tenant- and user-scoped lesson-progress create. Requires members:lesson-progress:create and an active human session. Relationship ownership is validated; IDs, audit fields, Completed, and CompletedAt are server-owned.. // // This method does not support injected context. // However, timeout and opentracing contexts are honored whenever enabled. @@ -169,7 +169,7 @@ func (a *Client) PostLessonProgresses(params *PostLessonProgressesParams, authIn // PostLessonProgressesContext creates new lesson progresses. // -// Create LessonProgresses. +// Tenant- and user-scoped lesson-progress create. Requires members:lesson-progress:create and an active human session. Relationship ownership is validated; IDs, audit fields, Completed, and CompletedAt are server-owned.. // // Do not use the deprecated [PostLessonProgressesParams.Context] with this method: it would be ignored. func (a *Client) PostLessonProgressesContext(ctx context.Context, params *PostLessonProgressesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLessonProgressesOK, error) { @@ -217,7 +217,7 @@ func (a *Client) PostLessonProgressesContext(ctx context.Context, params *PostLe // PutLessonProgresses updates lesson progress. // -// Update LessonProgress. +// Tenant- and user-scoped lesson-progress CAS update. Requires members:lesson-progress:update and an active human session. TenantID, UserID, EnrollmentID, and LessonID are immutable; completion is monotonic and CompletedAt is server-owned.. // // This method does not support injected context. // However, timeout and opentracing contexts are honored whenever enabled. @@ -236,7 +236,7 @@ func (a *Client) PutLessonProgresses(params *PutLessonProgressesParams, authInfo // PutLessonProgressesContext updates lesson progress. // -// Update LessonProgress. +// Tenant- and user-scoped lesson-progress CAS update. Requires members:lesson-progress:update and an active human session. TenantID, UserID, EnrollmentID, and LessonID are immutable; completion is monotonic and CompletedAt is server-owned.. // // Do not use the deprecated [PutLessonProgressesParams.Context] with this method: it would be ignored. func (a *Client) PutLessonProgressesContext(ctx context.Context, params *PutLessonProgressesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutLessonProgressesOK, error) { diff --git a/api/members/members_client/lesson_progress/put_lesson_progresses_responses.go b/api/members/members_client/lesson_progress/put_lesson_progresses_responses.go index 0c2360b..cb3cc33 100644 --- a/api/members/members_client/lesson_progress/put_lesson_progresses_responses.go +++ b/api/members/members_client/lesson_progress/put_lesson_progresses_responses.go @@ -49,6 +49,12 @@ func (o *PutLessonProgressesReader) ReadResponse(response runtime.ClientResponse return nil, err } return nil, result + case 409: + result := NewPutLessonProgressesConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result case 422: result := NewPutLessonProgressesUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { @@ -347,6 +353,74 @@ func (o *PutLessonProgressesNotFound) readResponse(response runtime.ClientRespon return nil } +// NewPutLessonProgressesConflict creates a PutLessonProgressesConflict with default headers values +func NewPutLessonProgressesConflict() *PutLessonProgressesConflict { + return &PutLessonProgressesConflict{} +} + +// PutLessonProgressesConflict describes a response with status code 409, with default header values. +// +// The supplied LastModifiedDate is stale; reload the record before retrying. +type PutLessonProgressesConflict struct { + Payload *members_models.Error +} + +// IsSuccess returns true when this put lesson progresses conflict response has a 2xx status code +func (o *PutLessonProgressesConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this put lesson progresses conflict response has a 3xx status code +func (o *PutLessonProgressesConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this put lesson progresses conflict response has a 4xx status code +func (o *PutLessonProgressesConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this put lesson progresses conflict response has a 5xx status code +func (o *PutLessonProgressesConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this put lesson progresses conflict response a status code equal to that given +func (o *PutLessonProgressesConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the put lesson progresses conflict response +func (o *PutLessonProgressesConflict) Code() int { + return 409 +} + +func (o *PutLessonProgressesConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /lessonprogress][%d] putLessonProgressesConflict %s", 409, payload) +} + +func (o *PutLessonProgressesConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /lessonprogress][%d] putLessonProgressesConflict %s", 409, payload) +} + +func (o *PutLessonProgressesConflict) GetPayload() *members_models.Error { + return o.Payload +} + +func (o *PutLessonProgressesConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(members_models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { + return err + } + + return nil +} + // NewPutLessonProgressesUnprocessableEntity creates a PutLessonProgressesUnprocessableEntity with default headers values func NewPutLessonProgressesUnprocessableEntity() *PutLessonProgressesUnprocessableEntity { return &PutLessonProgressesUnprocessableEntity{} diff --git a/api/members/members_client/members_client.go b/api/members/members_client/members_client.go index e28d1b9..f7a0e55 100644 --- a/api/members/members_client/members_client.go +++ b/api/members/members_client/members_client.go @@ -10,7 +10,6 @@ import ( "maps" "code.tnxs.net/vernonkeenan/lib/api/members/members_client/attendees" - "code.tnxs.net/vernonkeenan/lib/api/members/members_client/certificates" "code.tnxs.net/vernonkeenan/lib/api/members/members_client/clusters" "code.tnxs.net/vernonkeenan/lib/api/members/members_client/courses" "code.tnxs.net/vernonkeenan/lib/api/members/members_client/credentials" @@ -87,7 +86,6 @@ func New(transport runtime.ContextualTransport, formats strfmt.Registry) *Member cli := new(Members) cli.Transport = transport cli.Attendees = attendees.New(transport, formats) - cli.Certificates = certificates.New(transport, formats) cli.Clusters = clusters.New(transport, formats) cli.Courses = courses.New(transport, formats) cli.Credentials = credentials.New(transport, formats) @@ -176,8 +174,6 @@ func (cfg *TransportConfig) WithConsumers(consumers map[string]runtime.Consumer) type Members struct { Attendees attendees.ClientService - Certificates certificates.ClientService - Clusters clusters.ClientService Courses courses.ClientService @@ -239,7 +235,6 @@ type Members struct { func (c *Members) SetTransport(transport runtime.ContextualTransport) { c.Transport = transport c.Attendees.SetTransport(transport) - c.Certificates.SetTransport(transport) c.Clusters.SetTransport(transport) c.Courses.SetTransport(transport) c.Credentials.SetTransport(transport) diff --git a/api/members/members_client/prompt_contract_test.go b/api/members/members_client/prompt_contract_test.go index 5814eeb..91a2491 100644 --- a/api/members/members_client/prompt_contract_test.go +++ b/api/members/members_client/prompt_contract_test.go @@ -3,8 +3,6 @@ package members_client_test import ( "bytes" "context" - "crypto/sha256" - "encoding/hex" "encoding/json" "os" "path/filepath" @@ -20,8 +18,6 @@ import ( "github.com/go-openapi/strfmt" ) -const membersPromptProviderSpecSHA256 = "ea2c06f8551555ecf3d36e4d728ba34beeae8731370a64535e194686b16ad07f" - var promptTestAuth = openapiruntime.ClientAuthInfoWriterFunc(func(openapiruntime.ClientRequest, strfmt.Registry) error { return nil }) @@ -321,16 +317,12 @@ func TestPromptUpdateClientsPreserveConflictResponses(t *testing.T) { } } -func TestMembersSpecIsPinnedToPromptProviderSource(t *testing.T) { +func TestPromptProviderContractKeepsExternalMembersSpecAligned(t *testing.T) { repoRoot := promptRepoRoot(t) mainSpec, err := os.ReadFile(filepath.Join(repoRoot, "swagger", "members-vernonkeenan.yaml")) if err != nil { t.Fatalf("read Members spec: %v", err) } - sum := sha256.Sum256(mainSpec) - if got := hex.EncodeToString(sum[:]); got != membersPromptProviderSpecSHA256 { - t.Fatalf("Members spec drifted from provider commit 4e868f1: SHA-256 = %s, want %s", got, membersPromptProviderSpecSHA256) - } externalSpec, err := os.ReadFile(filepath.Join(repoRoot, "swagger", "external", "members-vernonkeenan.yaml")) if err != nil { diff --git a/api/members/members_models/certificate.go b/api/members/members_models/certificate.go deleted file mode 100644 index d2dcd89..0000000 --- a/api/members/members_models/certificate.go +++ /dev/null @@ -1,75 +0,0 @@ -// 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 members_models - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag/jsonutils" -) - -// Certificate certificate -// -// swagger:model certificate -type Certificate struct { - - // certificate template - CertificateTemplate *string `json:"CertificateTemplate,omitempty"` - - // course ID - CourseID *string `json:"CourseID,omitempty"` - - // created by ID - CreatedByID *string `json:"CreatedByID,omitempty"` - - // created date - CreatedDate *string `json:"CreatedDate,omitempty"` - - // description - Description *string `json:"Description,omitempty"` - - // ID - ID string `json:"ID,omitempty"` - - // last modified by ID - LastModifiedByID *string `json:"LastModifiedByID,omitempty"` - - // last modified date - LastModifiedDate *string `json:"LastModifiedDate,omitempty"` - - // title - Title *string `json:"Title,omitempty"` -} - -// Validate validates this certificate -func (m *Certificate) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this certificate based on context it is used -func (m *Certificate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *Certificate) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return jsonutils.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *Certificate) UnmarshalBinary(b []byte) error { - var res Certificate - if err := jsonutils.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/api/members/members_models/certificate_request.go b/api/members/members_models/certificate_request.go deleted file mode 100644 index 101b15e..0000000 --- a/api/members/members_models/certificate_request.go +++ /dev/null @@ -1,132 +0,0 @@ -// 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 members_models - -import ( - "context" - stderrors "errors" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag/jsonutils" - "github.com/go-openapi/swag/typeutils" -) - -// CertificateRequest An array of Certificate objects -// -// swagger:model CertificateRequest -type CertificateRequest struct { - - // data - Data []*Certificate `json:"Data"` -} - -// Validate validates this certificate request -func (m *CertificateRequest) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateData(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *CertificateRequest) validateData(formats strfmt.Registry) error { - if typeutils.IsZero(m.Data) { // not required - return nil - } - - for i := 0; i < len(m.Data); i++ { - if typeutils.IsZero(m.Data[i]) { // not required - continue - } - - if m.Data[i] != nil { - if err := m.Data[i].Validate(formats); err != nil { - ve := new(errors.Validation) - if stderrors.As(err, &ve) { - return ve.ValidateName("Data" + "." + strconv.Itoa(i)) - } - ce := new(errors.CompositeError) - if stderrors.As(err, &ce) { - return ce.ValidateName("Data" + "." + strconv.Itoa(i)) - } - - return err - } - } - - } - - return nil -} - -// ContextValidate validate this certificate request based on the context it is used -func (m *CertificateRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateData(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *CertificateRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Data); i++ { - - if m.Data[i] != nil { - - if typeutils.IsZero(m.Data[i]) { // not required - return nil - } - - if err := m.Data[i].ContextValidate(ctx, formats); err != nil { - ve := new(errors.Validation) - if stderrors.As(err, &ve) { - return ve.ValidateName("Data" + "." + strconv.Itoa(i)) - } - ce := new(errors.CompositeError) - if stderrors.As(err, &ce) { - return ce.ValidateName("Data" + "." + strconv.Itoa(i)) - } - - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *CertificateRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return jsonutils.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *CertificateRequest) UnmarshalBinary(b []byte) error { - var res CertificateRequest - if err := jsonutils.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/api/members/members_models/certificate_response.go b/api/members/members_models/certificate_response.go deleted file mode 100644 index e71675c..0000000 --- a/api/members/members_models/certificate_response.go +++ /dev/null @@ -1,132 +0,0 @@ -// 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 members_models - -import ( - "context" - stderrors "errors" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag/jsonutils" - "github.com/go-openapi/swag/typeutils" -) - -// CertificateResponse An array of Certificate objects -// -// swagger:model CertificateResponse -type CertificateResponse struct { - - // data - Data []*Certificate `json:"Data"` -} - -// Validate validates this certificate response -func (m *CertificateResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateData(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *CertificateResponse) validateData(formats strfmt.Registry) error { - if typeutils.IsZero(m.Data) { // not required - return nil - } - - for i := 0; i < len(m.Data); i++ { - if typeutils.IsZero(m.Data[i]) { // not required - continue - } - - if m.Data[i] != nil { - if err := m.Data[i].Validate(formats); err != nil { - ve := new(errors.Validation) - if stderrors.As(err, &ve) { - return ve.ValidateName("Data" + "." + strconv.Itoa(i)) - } - ce := new(errors.CompositeError) - if stderrors.As(err, &ce) { - return ce.ValidateName("Data" + "." + strconv.Itoa(i)) - } - - return err - } - } - - } - - return nil -} - -// ContextValidate validate this certificate response based on the context it is used -func (m *CertificateResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateData(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *CertificateResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Data); i++ { - - if m.Data[i] != nil { - - if typeutils.IsZero(m.Data[i]) { // not required - return nil - } - - if err := m.Data[i].ContextValidate(ctx, formats); err != nil { - ve := new(errors.Validation) - if stderrors.As(err, &ve) { - return ve.ValidateName("Data" + "." + strconv.Itoa(i)) - } - ce := new(errors.CompositeError) - if stderrors.As(err, &ce) { - return ce.ValidateName("Data" + "." + strconv.Itoa(i)) - } - - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *CertificateResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return jsonutils.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *CertificateResponse) UnmarshalBinary(b []byte) error { - var res CertificateResponse - if err := jsonutils.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/api/members/members_models/course.go b/api/members/members_models/course.go index 4352c91..6b76db7 100644 --- a/api/members/members_models/course.go +++ b/api/members/members_models/course.go @@ -8,18 +8,17 @@ package members_models import ( "context" - stderrors "errors" - "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag/jsonutils" "github.com/go-openapi/swag/typeutils" + "github.com/go-openapi/validate" ) -// Course course +// Course Estate-global course catalog record. Tenant ownership is intentionally absent from the current schema. // -// swagger:model course +// swagger:model Course type Course struct { // created by ID @@ -55,19 +54,19 @@ type Course struct { // logo Logo *string `json:"Logo,omitempty"` - // price - Price *float64 `json:"Price,omitempty"` - - // sections - Sections []*CourseSection `json:"Sections"` + // Exact base-10 representation of DECIMAL(10,2). + // Pattern: ^[0-9]{1,8}(\.[0-9]{1,2})?$ + Price *string `json:"Price,omitempty"` // slug + // Max Length: 80 Slug *string `json:"Slug,omitempty"` // template ID TemplateID *string `json:"TemplateID,omitempty"` // title + // Max Length: 255 Title *string `json:"Title,omitempty"` } @@ -75,7 +74,15 @@ type Course struct { func (m *Course) Validate(formats strfmt.Registry) error { var res []error - if err := m.validateSections(formats); err != nil { + if err := m.validatePrice(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSlug(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTitle(formats); err != nil { res = append(res, err) } @@ -85,76 +92,44 @@ func (m *Course) Validate(formats strfmt.Registry) error { return nil } -func (m *Course) validateSections(formats strfmt.Registry) error { - if typeutils.IsZero(m.Sections) { // not required +func (m *Course) validatePrice(formats strfmt.Registry) error { + if typeutils.IsZero(m.Price) { // not required return nil } - for i := 0; i < len(m.Sections); i++ { - if typeutils.IsZero(m.Sections[i]) { // not required - continue - } - - if m.Sections[i] != nil { - if err := m.Sections[i].Validate(formats); err != nil { - ve := new(errors.Validation) - if stderrors.As(err, &ve) { - return ve.ValidateName("Sections" + "." + strconv.Itoa(i)) - } - ce := new(errors.CompositeError) - if stderrors.As(err, &ce) { - return ce.ValidateName("Sections" + "." + strconv.Itoa(i)) - } - - return err - } - } - + if err := validate.Pattern("Price", "body", *m.Price, `^[0-9]{1,8}(\.[0-9]{1,2})?$`); err != nil { + return err } return nil } -// ContextValidate validate this course based on the context it is used +func (m *Course) validateSlug(formats strfmt.Registry) error { + if typeutils.IsZero(m.Slug) { // not required + return nil + } + + if err := validate.MaxLength("Slug", "body", *m.Slug, 80); err != nil { + return err + } + + return nil +} + +func (m *Course) validateTitle(formats strfmt.Registry) error { + if typeutils.IsZero(m.Title) { // not required + return nil + } + + if err := validate.MaxLength("Title", "body", *m.Title, 255); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this course based on context it is used func (m *Course) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateSections(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *Course) contextValidateSections(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Sections); i++ { - - if m.Sections[i] != nil { - - if typeutils.IsZero(m.Sections[i]) { // not required - return nil - } - - if err := m.Sections[i].ContextValidate(ctx, formats); err != nil { - ve := new(errors.Validation) - if stderrors.As(err, &ve) { - return ve.ValidateName("Sections" + "." + strconv.Itoa(i)) - } - ce := new(errors.CompositeError) - if stderrors.As(err, &ce) { - return ce.ValidateName("Sections" + "." + strconv.Itoa(i)) - } - - return err - } - } - - } - return nil } diff --git a/api/members/members_models/course_lesson.go b/api/members/members_models/course_lesson.go index 348bf5e..80ced73 100644 --- a/api/members/members_models/course_lesson.go +++ b/api/members/members_models/course_lesson.go @@ -9,18 +9,18 @@ package members_models import ( "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag/jsonutils" + "github.com/go-openapi/swag/typeutils" + "github.com/go-openapi/validate" ) -// CourseLesson course lesson +// CourseLesson Estate-global lesson linked to one CourseSection. // -// swagger:model courseLesson +// swagger:model CourseLesson type CourseLesson struct { - // asset ID - AssetID *string `json:"AssetID,omitempty"` - // content Content *string `json:"Content,omitempty"` @@ -51,13 +51,15 @@ type CourseLesson struct { // order Order *int64 `json:"Order,omitempty"` - // section ID + // Persisted as coursesectionid. SectionID *string `json:"SectionID,omitempty"` // slug + // Max Length: 80 Slug *string `json:"Slug,omitempty"` // title + // Max Length: 255 Title *string `json:"Title,omitempty"` // video URL @@ -66,6 +68,43 @@ type CourseLesson struct { // Validate validates this course lesson func (m *CourseLesson) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSlug(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTitle(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CourseLesson) validateSlug(formats strfmt.Registry) error { + if typeutils.IsZero(m.Slug) { // not required + return nil + } + + if err := validate.MaxLength("Slug", "body", *m.Slug, 80); err != nil { + return err + } + + return nil +} + +func (m *CourseLesson) validateTitle(formats strfmt.Registry) error { + if typeutils.IsZero(m.Title) { // not required + return nil + } + + if err := validate.MaxLength("Title", "body", *m.Title, 255); err != nil { + return err + } + return nil } diff --git a/api/members/members_models/course_lesson_request.go b/api/members/members_models/course_lesson_request.go index a781a98..fe57b05 100644 --- a/api/members/members_models/course_lesson_request.go +++ b/api/members/members_models/course_lesson_request.go @@ -15,14 +15,17 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag/jsonutils" "github.com/go-openapi/swag/typeutils" + "github.com/go-openapi/validate" ) -// CourseLessonRequest An array of CourseLesson objects +// CourseLessonRequest Exactly one CourseLesson object // // swagger:model CourseLessonRequest type CourseLessonRequest struct { // data + // Max Items: 1 + // Min Items: 1 Data []*CourseLesson `json:"Data"` } @@ -45,6 +48,16 @@ func (m *CourseLessonRequest) validateData(formats strfmt.Registry) error { return nil } + iDataSize := int64(len(m.Data)) + + if err := validate.MinItems("Data", "body", iDataSize, 1); err != nil { + return err + } + + if err := validate.MaxItems("Data", "body", iDataSize, 1); err != nil { + return err + } + for i := 0; i < len(m.Data); i++ { if typeutils.IsZero(m.Data[i]) { // not required continue diff --git a/api/members/members_models/course_request.go b/api/members/members_models/course_request.go index 7da0566..42950cd 100644 --- a/api/members/members_models/course_request.go +++ b/api/members/members_models/course_request.go @@ -15,14 +15,17 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag/jsonutils" "github.com/go-openapi/swag/typeutils" + "github.com/go-openapi/validate" ) -// CourseRequest An array of Course objects +// CourseRequest Exactly one Course object // // swagger:model CourseRequest type CourseRequest struct { // data + // Max Items: 1 + // Min Items: 1 Data []*Course `json:"Data"` } @@ -45,6 +48,16 @@ func (m *CourseRequest) validateData(formats strfmt.Registry) error { return nil } + iDataSize := int64(len(m.Data)) + + if err := validate.MinItems("Data", "body", iDataSize, 1); err != nil { + return err + } + + if err := validate.MaxItems("Data", "body", iDataSize, 1); err != nil { + return err + } + for i := 0; i < len(m.Data); i++ { if typeutils.IsZero(m.Data[i]) { // not required continue diff --git a/api/members/members_models/course_section.go b/api/members/members_models/course_section.go index dd404fe..640218a 100644 --- a/api/members/members_models/course_section.go +++ b/api/members/members_models/course_section.go @@ -8,18 +8,17 @@ package members_models import ( "context" - stderrors "errors" - "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag/jsonutils" "github.com/go-openapi/swag/typeutils" + "github.com/go-openapi/validate" ) -// CourseSection course section +// CourseSection Estate-global section linked to one Course. // -// swagger:model courseSection +// swagger:model CourseSection type CourseSection struct { // content @@ -49,9 +48,6 @@ type CourseSection struct { // last modified date LastModifiedDate *string `json:"LastModifiedDate,omitempty"` - // lessons - Lessons []*CourseLesson `json:"Lessons"` - // logo Logo *string `json:"Logo,omitempty"` @@ -59,9 +55,11 @@ type CourseSection struct { Order *int64 `json:"Order,omitempty"` // slug + // Max Length: 80 Slug *string `json:"Slug,omitempty"` // title + // Max Length: 255 Title *string `json:"Title,omitempty"` } @@ -69,7 +67,11 @@ type CourseSection struct { func (m *CourseSection) Validate(formats strfmt.Registry) error { var res []error - if err := m.validateLessons(formats); err != nil { + if err := m.validateSlug(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTitle(formats); err != nil { res = append(res, err) } @@ -79,76 +81,32 @@ func (m *CourseSection) Validate(formats strfmt.Registry) error { return nil } -func (m *CourseSection) validateLessons(formats strfmt.Registry) error { - if typeutils.IsZero(m.Lessons) { // not required +func (m *CourseSection) validateSlug(formats strfmt.Registry) error { + if typeutils.IsZero(m.Slug) { // not required return nil } - for i := 0; i < len(m.Lessons); i++ { - if typeutils.IsZero(m.Lessons[i]) { // not required - continue - } - - if m.Lessons[i] != nil { - if err := m.Lessons[i].Validate(formats); err != nil { - ve := new(errors.Validation) - if stderrors.As(err, &ve) { - return ve.ValidateName("Lessons" + "." + strconv.Itoa(i)) - } - ce := new(errors.CompositeError) - if stderrors.As(err, &ce) { - return ce.ValidateName("Lessons" + "." + strconv.Itoa(i)) - } - - return err - } - } - + if err := validate.MaxLength("Slug", "body", *m.Slug, 80); err != nil { + return err } return nil } -// ContextValidate validate this course section based on the context it is used +func (m *CourseSection) validateTitle(formats strfmt.Registry) error { + if typeutils.IsZero(m.Title) { // not required + return nil + } + + if err := validate.MaxLength("Title", "body", *m.Title, 255); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this course section based on context it is used func (m *CourseSection) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateLessons(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *CourseSection) contextValidateLessons(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Lessons); i++ { - - if m.Lessons[i] != nil { - - if typeutils.IsZero(m.Lessons[i]) { // not required - return nil - } - - if err := m.Lessons[i].ContextValidate(ctx, formats); err != nil { - ve := new(errors.Validation) - if stderrors.As(err, &ve) { - return ve.ValidateName("Lessons" + "." + strconv.Itoa(i)) - } - ce := new(errors.CompositeError) - if stderrors.As(err, &ce) { - return ce.ValidateName("Lessons" + "." + strconv.Itoa(i)) - } - - return err - } - } - - } - return nil } diff --git a/api/members/members_models/course_section_request.go b/api/members/members_models/course_section_request.go index a735d7f..b498111 100644 --- a/api/members/members_models/course_section_request.go +++ b/api/members/members_models/course_section_request.go @@ -15,14 +15,17 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag/jsonutils" "github.com/go-openapi/swag/typeutils" + "github.com/go-openapi/validate" ) -// CourseSectionRequest An array of CourseSection objects +// CourseSectionRequest Exactly one CourseSection object // // swagger:model CourseSectionRequest type CourseSectionRequest struct { // data + // Max Items: 1 + // Min Items: 1 Data []*CourseSection `json:"Data"` } @@ -45,6 +48,16 @@ func (m *CourseSectionRequest) validateData(formats strfmt.Registry) error { return nil } + iDataSize := int64(len(m.Data)) + + if err := validate.MinItems("Data", "body", iDataSize, 1); err != nil { + return err + } + + if err := validate.MaxItems("Data", "body", iDataSize, 1); err != nil { + return err + } + for i := 0; i < len(m.Data); i++ { if typeutils.IsZero(m.Data[i]) { // not required continue diff --git a/api/members/members_models/enrollment.go b/api/members/members_models/enrollment.go index 8c1d123..afe0724 100644 --- a/api/members/members_models/enrollment.go +++ b/api/members/members_models/enrollment.go @@ -9,17 +9,20 @@ package members_models import ( "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag/jsonutils" + "github.com/go-openapi/swag/typeutils" + "github.com/go-openapi/validate" ) -// Enrollment enrollment +// Enrollment User-global enrollment. TenantID is intentionally absent from the current schema, so cross-user tenant-manager access is unavailable. // -// swagger:model enrollment +// swagger:model Enrollment type Enrollment struct { // completed - Completed *int64 `json:"Completed,omitempty"` + Completed *bool `json:"Completed,omitempty"` // course ID CourseID *string `json:"CourseID,omitempty"` @@ -31,7 +34,8 @@ type Enrollment struct { CreatedDate *string `json:"CreatedDate,omitempty"` // enrollment date - EnrollmentDate *string `json:"EnrollmentDate,omitempty"` + // Format: date + EnrollmentDate *strfmt.Date `json:"EnrollmentDate,omitempty"` // ID ID string `json:"ID,omitempty"` @@ -48,6 +52,27 @@ type Enrollment struct { // Validate validates this enrollment func (m *Enrollment) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEnrollmentDate(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Enrollment) validateEnrollmentDate(formats strfmt.Registry) error { + if typeutils.IsZero(m.EnrollmentDate) { // not required + return nil + } + + if err := validate.FormatOf("EnrollmentDate", "body", "date", m.EnrollmentDate.String(), formats); err != nil { + return err + } + return nil } diff --git a/api/members/members_models/enrollment_request.go b/api/members/members_models/enrollment_request.go index 7f4289e..f1677fe 100644 --- a/api/members/members_models/enrollment_request.go +++ b/api/members/members_models/enrollment_request.go @@ -15,14 +15,17 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag/jsonutils" "github.com/go-openapi/swag/typeutils" + "github.com/go-openapi/validate" ) -// EnrollmentRequest An array of Enrollment objects +// EnrollmentRequest Exactly one Enrollment object // // swagger:model EnrollmentRequest type EnrollmentRequest struct { // data + // Max Items: 1 + // Min Items: 1 Data []*Enrollment `json:"Data"` } @@ -45,6 +48,16 @@ func (m *EnrollmentRequest) validateData(formats strfmt.Registry) error { return nil } + iDataSize := int64(len(m.Data)) + + if err := validate.MinItems("Data", "body", iDataSize, 1); err != nil { + return err + } + + if err := validate.MaxItems("Data", "body", iDataSize, 1); err != nil { + return err + } + for i := 0; i < len(m.Data); i++ { if typeutils.IsZero(m.Data[i]) { // not required continue diff --git a/api/members/members_models/issued_certificate.go b/api/members/members_models/issued_certificate.go index 739add9..5f6dcd6 100644 --- a/api/members/members_models/issued_certificate.go +++ b/api/members/members_models/issued_certificate.go @@ -13,13 +13,13 @@ import ( "github.com/go-openapi/swag/jsonutils" ) -// IssuedCertificate issued certificate +// IssuedCertificate Sanitized user-global issuance evidence. VerificationCode is intentionally excluded from this contract. // -// swagger:model issuedCertificate +// swagger:model IssuedCertificate type IssuedCertificate struct { - // certificate ID - CertificateID *string `json:"CertificateID,omitempty"` + // account ID + AccountID *string `json:"AccountID,omitempty"` // created by ID CreatedByID *string `json:"CreatedByID,omitempty"` @@ -45,11 +45,11 @@ type IssuedCertificate struct { // last modified date LastModifiedDate *string `json:"LastModifiedDate,omitempty"` + // template ID + TemplateID *string `json:"TemplateID,omitempty"` + // user ID UserID *string `json:"UserID,omitempty"` - - // verification code - VerificationCode *string `json:"VerificationCode,omitempty"` } // Validate validates this issued certificate diff --git a/api/members/members_models/issued_certificate_request.go b/api/members/members_models/issued_certificate_request.go deleted file mode 100644 index 6674e75..0000000 --- a/api/members/members_models/issued_certificate_request.go +++ /dev/null @@ -1,132 +0,0 @@ -// 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 members_models - -import ( - "context" - stderrors "errors" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag/jsonutils" - "github.com/go-openapi/swag/typeutils" -) - -// IssuedCertificateRequest An array of IssuedCertificate objects -// -// swagger:model IssuedCertificateRequest -type IssuedCertificateRequest struct { - - // data - Data []*IssuedCertificate `json:"Data"` -} - -// Validate validates this issued certificate request -func (m *IssuedCertificateRequest) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateData(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *IssuedCertificateRequest) validateData(formats strfmt.Registry) error { - if typeutils.IsZero(m.Data) { // not required - return nil - } - - for i := 0; i < len(m.Data); i++ { - if typeutils.IsZero(m.Data[i]) { // not required - continue - } - - if m.Data[i] != nil { - if err := m.Data[i].Validate(formats); err != nil { - ve := new(errors.Validation) - if stderrors.As(err, &ve) { - return ve.ValidateName("Data" + "." + strconv.Itoa(i)) - } - ce := new(errors.CompositeError) - if stderrors.As(err, &ce) { - return ce.ValidateName("Data" + "." + strconv.Itoa(i)) - } - - return err - } - } - - } - - return nil -} - -// ContextValidate validate this issued certificate request based on the context it is used -func (m *IssuedCertificateRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateData(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *IssuedCertificateRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Data); i++ { - - if m.Data[i] != nil { - - if typeutils.IsZero(m.Data[i]) { // not required - return nil - } - - if err := m.Data[i].ContextValidate(ctx, formats); err != nil { - ve := new(errors.Validation) - if stderrors.As(err, &ve) { - return ve.ValidateName("Data" + "." + strconv.Itoa(i)) - } - ce := new(errors.CompositeError) - if stderrors.As(err, &ce) { - return ce.ValidateName("Data" + "." + strconv.Itoa(i)) - } - - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *IssuedCertificateRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return jsonutils.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *IssuedCertificateRequest) UnmarshalBinary(b []byte) error { - var res IssuedCertificateRequest - if err := jsonutils.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/api/members/members_models/lesson_progress.go b/api/members/members_models/lesson_progress.go index 71a71ce..718805e 100644 --- a/api/members/members_models/lesson_progress.go +++ b/api/members/members_models/lesson_progress.go @@ -13,16 +13,16 @@ import ( "github.com/go-openapi/swag/jsonutils" ) -// LessonProgress lesson progress +// LessonProgress Tenant-scoped progress for one enrollment and lesson. // -// swagger:model lessonProgress +// swagger:model LessonProgress type LessonProgress struct { // completed - Completed int64 `json:"Completed,omitempty"` + Completed bool `json:"Completed,omitempty"` - // completedat - Completedat *string `json:"Completedat,omitempty"` + // completed at + CompletedAt *string `json:"CompletedAt,omitempty"` // created by ID CreatedByID *string `json:"CreatedByID,omitempty"` @@ -45,6 +45,9 @@ type LessonProgress struct { // lesson ID LessonID *string `json:"LessonID,omitempty"` + // tenant ID + TenantID *string `json:"TenantID,omitempty"` + // user ID UserID *string `json:"UserID,omitempty"` } diff --git a/api/members/members_models/lesson_progress_request.go b/api/members/members_models/lesson_progress_request.go index b2808aa..490f87d 100644 --- a/api/members/members_models/lesson_progress_request.go +++ b/api/members/members_models/lesson_progress_request.go @@ -15,14 +15,17 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag/jsonutils" "github.com/go-openapi/swag/typeutils" + "github.com/go-openapi/validate" ) -// LessonProgressRequest An array of LessonProgress objects +// LessonProgressRequest Exactly one LessonProgress object // // swagger:model LessonProgressRequest type LessonProgressRequest struct { // data + // Max Items: 1 + // Min Items: 1 Data []*LessonProgress `json:"Data"` } @@ -45,6 +48,16 @@ func (m *LessonProgressRequest) validateData(formats strfmt.Registry) error { return nil } + iDataSize := int64(len(m.Data)) + + if err := validate.MinItems("Data", "body", iDataSize, 1); err != nil { + return err + } + + if err := validate.MaxItems("Data", "body", iDataSize, 1); err != nil { + return err + } + for i := 0; i < len(m.Data); i++ { if typeutils.IsZero(m.Data[i]) { // not required continue diff --git a/swagger/external/members-vernonkeenan.yaml b/swagger/external/members-vernonkeenan.yaml index 0d824cc..a70bb3d 100644 --- a/swagger/external/members-vernonkeenan.yaml +++ b/swagger/external/members-vernonkeenan.yaml @@ -141,13 +141,6 @@ parameters: required: true schema: $ref: "#/definitions/AttendeeRequest" - CertificateRequest: - description: An array of new Certificate records - in: body - name: certificateRequest - required: true - schema: - $ref: "#/definitions/CertificateRequest" CourseLessonRequest: description: An array of new CourseLesson records in: body @@ -224,13 +217,6 @@ parameters: required: true schema: $ref: "#/definitions/InvoiceRequest" - IssuedCertificateRequest: - description: An array of new IssuedCertificate records - in: body - name: issuedCertificateRequest - required: true - schema: - $ref: "#/definitions/IssuedCertificateRequest" LessonProgressRequest: description: An array of new LessonProgress records in: body @@ -523,10 +509,6 @@ responses: description: Attendee Response Object schema: $ref: "#/definitions/AttendeeResponse" - CertificateResponse: - description: Certificate Response Object - schema: - $ref: "#/definitions/CertificateResponse" ClusterResponse: description: Response with Cluster objects schema: @@ -1807,78 +1789,6 @@ paths: summary: Update Attendee tags: - Attendees - /certificates: - get: - description: Return a list of Certificate records from the datastore - operationId: getCertificates - parameters: - - $ref: "#/parameters/idQuery" - - $ref: "#/parameters/limitQuery" - - $ref: "#/parameters/offsetQuery" - responses: - "200": - $ref: "#/responses/CertificateResponse" - "401": - $ref: "#/responses/Unauthorized" - "403": - $ref: "#/responses/AccessForbidden" - "404": - $ref: "#/responses/NotFound" - "422": - $ref: "#/responses/UnprocessableEntity" - "500": - $ref: "#/responses/ServerError" - security: - - ApiKeyAuth: [] - summary: Get a list Certificates - tags: - - Certificates - post: - description: Create Certificates - operationId: postCertificates - parameters: - - $ref: "#/parameters/CertificateRequest" - responses: - "200": - $ref: "#/responses/CertificateResponse" - "401": - $ref: "#/responses/Unauthorized" - "403": - $ref: "#/responses/AccessForbidden" - "404": - $ref: "#/responses/NotFound" - "422": - $ref: "#/responses/UnprocessableEntity" - "500": - $ref: "#/responses/ServerError" - security: - - ApiKeyAuth: [] - summary: Create new Certificates - tags: - - Certificates - put: - description: Update Certificate - operationId: putCertificates - parameters: - - $ref: "#/parameters/CertificateRequest" - responses: - "200": - $ref: "#/responses/CertificateResponse" - "401": - $ref: "#/responses/Unauthorized" - "403": - $ref: "#/responses/AccessForbidden" - "404": - $ref: "#/responses/NotFound" - "422": - $ref: "#/responses/UnprocessableEntity" - "500": - $ref: "#/responses/ServerError" - security: - - ApiKeyAuth: [] - summary: Update Certificate - tags: - - Certificates /clusters: get: description: Return a list of Cluster records from the datastore @@ -1953,9 +1863,11 @@ paths: - Clusters /courselessons: get: + description: Estate-global learning catalog read. Requires members:course-lesson:read and an active human session. operationId: getCourseLessons security: - ApiKeyAuth: [] + kvSessionCookie: [] parameters: - $ref: "#/parameters/idQuery" - $ref: "#/parameters/limitQuery" @@ -1977,9 +1889,11 @@ paths: tags: - Courses post: + description: 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. operationId: postCourseLessons security: - ApiKeyAuth: [] + kvSessionCookie: [] parameters: - $ref: "#/parameters/CourseLessonRequest" responses: @@ -2001,6 +1915,8 @@ paths: put: security: - ApiKeyAuth: [] + kvSessionCookie: [] + description: Estate-global lesson CAS update. Requires members:course-lesson:update, an active human session, and tenant-independent Administrator/Admin authority. SectionID is immutable. operationId: updateCourseLessons parameters: - $ref: "#/parameters/CourseLessonRequest" @@ -2011,6 +1927,8 @@ paths: $ref: "#/responses/Unauthorized" "403": $ref: "#/responses/AccessForbidden" + "409": + $ref: "#/responses/Conflict" "404": $ref: "#/responses/NotFound" "422": @@ -2022,8 +1940,10 @@ paths: - Courses /courses: get: + description: Estate-global learning catalog read. Requires members:course:read and an active human session. security: - ApiKeyAuth: [] + kvSessionCookie: [] operationId: getCourses parameters: - $ref: "#/parameters/idQuery" @@ -2046,8 +1966,10 @@ paths: tags: - Courses post: + description: 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. security: - ApiKeyAuth: [] + kvSessionCookie: [] operationId: postCourses parameters: - $ref: "#/parameters/CourseRequest" @@ -2068,8 +1990,10 @@ paths: tags: - Courses put: + description: Estate-global course CAS update. Requires members:course:update, an active human session, and tenant-independent Administrator/Admin authority. security: - ApiKeyAuth: [] + kvSessionCookie: [] operationId: updateCourses parameters: - $ref: "#/parameters/CourseRequest" @@ -2080,6 +2004,8 @@ paths: $ref: "#/responses/Unauthorized" "403": $ref: "#/responses/AccessForbidden" + "409": + $ref: "#/responses/Conflict" "404": $ref: "#/responses/NotFound" "422": @@ -2091,8 +2017,10 @@ paths: - Courses /coursesections: get: + description: Estate-global course-section read. Requires members:course-section:read and an active human session. security: - ApiKeyAuth: [] + kvSessionCookie: [] operationId: getCourseSections parameters: - $ref: "#/parameters/idQuery" @@ -2115,8 +2043,10 @@ paths: tags: - Courses post: + description: 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. security: - ApiKeyAuth: [] + kvSessionCookie: [] operationId: postCourseSections parameters: - $ref: "#/parameters/CourseSectionRequest" @@ -2137,8 +2067,10 @@ paths: tags: - Courses put: + description: Estate-global course-section CAS update. Requires members:course-section:update, an active human session, and tenant-independent Administrator/Admin authority. CourseID is immutable. security: - ApiKeyAuth: [] + kvSessionCookie: [] operationId: updateCourseSections parameters: - $ref: "#/parameters/CourseSectionRequest" @@ -2149,6 +2081,8 @@ paths: $ref: "#/responses/Unauthorized" "403": $ref: "#/responses/AccessForbidden" + "409": + $ref: "#/responses/Conflict" "404": $ref: "#/responses/NotFound" "422": @@ -2561,7 +2495,7 @@ paths: - Emails /enrollments: get: - description: Return a list of Enrollment records from the datastore + description: User-global enrollment read. Requires members:enrollment:read and an active human session. Because Enrollment has no TenantID, records are restricted to the authenticated user and tenant managers receive no cross-user visibility. operationId: getEnrollments parameters: - $ref: "#/parameters/idQuery" @@ -2582,11 +2516,12 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Get a list Enrollments tags: - Enrollments post: - description: Create Enrollments + description: User-global self-enrollment create. Requires members:enrollment:create and an active human session. UserID is derived from the actor; IDs, audit fields, EnrollmentDate, and Completed are server-owned. operationId: postEnrollments parameters: - $ref: "#/parameters/EnrollmentRequest" @@ -2605,11 +2540,12 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Create new Enrollments tags: - Enrollments put: - description: Update Enrollment + description: User-global self-enrollment CAS update. Requires members:enrollment:update and an active human session. UserID and CourseID are immutable; completion is monotonic. operationId: putEnrollments parameters: - $ref: "#/parameters/EnrollmentRequest" @@ -2620,6 +2556,8 @@ paths: $ref: "#/responses/Unauthorized" "403": $ref: "#/responses/AccessForbidden" + "409": + $ref: "#/responses/Conflict" "404": $ref: "#/responses/NotFound" "422": @@ -2628,6 +2566,7 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Update Enrollment tags: - Enrollments @@ -2877,7 +2816,7 @@ paths: - Invoices /issuedcertificates: get: - description: Return a list of IssuedCertificate records from the datastore + description: Sanitized user-global certificate read. Requires members:issued-certificate:read and an active human session. Records are restricted to the authenticated user; verification material is never returned. Issuance, mutation, revocation, and deletion require a separate lifecycle API and are intentionally unavailable here. operationId: getIssuedCertificates parameters: - $ref: "#/parameters/idQuery" @@ -2898,58 +2837,13 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Get a list IssuedCertificates tags: - IssuedCertificates - post: - description: Create IssuedCertificates - operationId: postIssuedCertificates - parameters: - - $ref: "#/parameters/IssuedCertificateRequest" - responses: - "200": - $ref: "#/responses/IssuedCertificateResponse" - "401": - $ref: "#/responses/Unauthorized" - "403": - $ref: "#/responses/AccessForbidden" - "404": - $ref: "#/responses/NotFound" - "422": - $ref: "#/responses/UnprocessableEntity" - "500": - $ref: "#/responses/ServerError" - security: - - ApiKeyAuth: [] - summary: Create new IssuedCertificates - tags: - - IssuedCertificates - put: - description: Update IssuedCertificate - operationId: putIssuedCertificates - parameters: - - $ref: "#/parameters/IssuedCertificateRequest" - responses: - "200": - $ref: "#/responses/IssuedCertificateResponse" - "401": - $ref: "#/responses/Unauthorized" - "403": - $ref: "#/responses/AccessForbidden" - "404": - $ref: "#/responses/NotFound" - "422": - $ref: "#/responses/UnprocessableEntity" - "500": - $ref: "#/responses/ServerError" - security: - - ApiKeyAuth: [] - summary: Update IssuedCertificate - tags: - - IssuedCertificates /lessonprogress: get: - description: Return a list of LessonProgress records from the datastore + description: Tenant- and user-scoped lesson-progress read. Requires members:lesson-progress:read and an active human session. Owners and managers can read their tenant; other members can read only their own records. operationId: getLessonProgresses parameters: - $ref: "#/parameters/idQuery" @@ -2970,11 +2864,12 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Get a list LessonProgresses tags: - LessonProgress post: - description: Create LessonProgresses + description: Tenant- and user-scoped lesson-progress create. Requires members:lesson-progress:create and an active human session. Relationship ownership is validated; IDs, audit fields, Completed, and CompletedAt are server-owned. operationId: postLessonProgresses parameters: - $ref: "#/parameters/LessonProgressRequest" @@ -2993,11 +2888,12 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Create new LessonProgresses tags: - LessonProgress put: - description: Update LessonProgress + description: Tenant- and user-scoped lesson-progress CAS update. Requires members:lesson-progress:update and an active human session. TenantID, UserID, EnrollmentID, and LessonID are immutable; completion is monotonic and CompletedAt is server-owned. operationId: putLessonProgresses parameters: - $ref: "#/parameters/LessonProgressRequest" @@ -3008,6 +2904,8 @@ paths: $ref: "#/responses/Unauthorized" "403": $ref: "#/responses/AccessForbidden" + "409": + $ref: "#/responses/Conflict" "404": $ref: "#/responses/NotFound" "422": @@ -3016,6 +2914,7 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Update LessonProgress tags: - LessonProgress @@ -4676,22 +4575,6 @@ definitions: $ref: "../../lib/swagger/defs/attendee.yaml#/Attendee" type: array type: object - CertificateRequest: - description: An array of Certificate objects - properties: - Data: - items: - $ref: "../../lib/swagger/defs/certificate.yaml#/Certificate" - type: array - type: object - CertificateResponse: - description: An array of Certificate objects - properties: - Data: - items: - $ref: "../../lib/swagger/defs/certificate.yaml#/Certificate" - type: array - type: object ClusterRequest: properties: Data: @@ -4709,12 +4592,160 @@ definitions: Meta: $ref: "#/definitions/ResponseMeta" type: object + Course: + description: Estate-global course catalog record. Tenant ownership is intentionally absent from the current schema. + type: object + properties: + ID: + type: string + CreatedByID: + type: string + x-nullable: true + CreatedDate: + type: string + x-nullable: true + Description: + type: string + x-nullable: true + Fulldescription: + type: string + x-nullable: true + ImageAltText: + type: string + x-nullable: true + ImageURL: + type: string + x-nullable: true + InstructorID: + type: string + x-nullable: true + LastModifiedByID: + type: string + x-nullable: true + LastModifiedDate: + type: string + x-nullable: true + Logo: + type: string + x-nullable: true + Price: + description: Exact base-10 representation of DECIMAL(10,2). + type: string + pattern: '^[0-9]{1,8}(\.[0-9]{1,2})?$' + x-nullable: true + Slug: + type: string + maxLength: 80 + x-nullable: true + TemplateID: + type: string + x-nullable: true + Title: + type: string + maxLength: 255 + x-nullable: true + CourseSection: + description: Estate-global section linked to one Course. + type: object + properties: + ID: + type: string + Content: + type: string + x-nullable: true + CourseID: + type: string + x-nullable: true + CreatedByID: + type: string + x-nullable: true + CreatedDate: + type: string + x-nullable: true + ImageAltText: + type: string + x-nullable: true + ImageURL: + type: string + x-nullable: true + LastModifiedByID: + type: string + x-nullable: true + LastModifiedDate: + type: string + x-nullable: true + Logo: + type: string + x-nullable: true + Order: + type: integer + format: int64 + x-nullable: true + Slug: + type: string + maxLength: 80 + x-nullable: true + Title: + type: string + maxLength: 255 + x-nullable: true + CourseLesson: + description: Estate-global lesson linked to one CourseSection. + type: object + properties: + ID: + type: string + Content: + type: string + x-nullable: true + CreatedByID: + type: string + x-nullable: true + CreatedDate: + type: string + x-nullable: true + ImageAltText: + type: string + x-nullable: true + ImageURL: + type: string + x-nullable: true + LastModifiedByID: + type: string + x-nullable: true + LastModifiedDate: + type: string + x-nullable: true + Logo: + type: string + x-nullable: true + Order: + type: integer + format: int64 + x-nullable: true + SectionID: + description: Persisted as coursesectionid. + type: string + x-nullable: true + Slug: + type: string + maxLength: 80 + x-nullable: true + Title: + type: string + maxLength: 255 + x-nullable: true + VideoURL: + type: string + x-nullable: true CourseLessonRequest: - description: An array of CourseLesson objects + description: Exactly one CourseLesson object properties: Data: items: - $ref: "../../lib/swagger/defs/course-lesson.yaml#/CourseLesson" + $ref: "#/definitions/CourseLesson" + minItems: 1 + maxItems: 1 type: array type: object CourseLessonResponse: @@ -4722,17 +4753,19 @@ definitions: properties: Data: items: - $ref: "../../lib/swagger/defs/course-lesson.yaml#/CourseLesson" + $ref: "#/definitions/CourseLesson" type: array Meta: $ref: "#/definitions/ResponseMeta" type: object CourseRequest: - description: An array of Course objects + description: Exactly one Course object properties: Data: items: - $ref: "../../lib/swagger/defs/course.yaml#/Course" + $ref: "#/definitions/Course" + minItems: 1 + maxItems: 1 type: array type: object CourseResponse: @@ -4742,15 +4775,17 @@ definitions: $ref: "#/definitions/ResponseMeta" Data: items: - $ref: "../../lib/swagger/defs/course.yaml#/Course" + $ref: "#/definitions/Course" type: array type: object CourseSectionRequest: - description: An array of CourseSection objects + description: Exactly one CourseSection object properties: Data: items: - $ref: "../../lib/swagger/defs/course-section.yaml#/CourseSection" + $ref: "#/definitions/CourseSection" + minItems: 1 + maxItems: 1 type: array type: object CourseSectionResponse: @@ -4760,7 +4795,7 @@ definitions: $ref: "#/definitions/ResponseMeta" Data: items: - $ref: "../../lib/swagger/defs/course-section.yaml#/CourseSection" + $ref: "#/definitions/CourseSection" type: array type: object DatabaseRequest: @@ -5023,12 +5058,45 @@ definitions: meta: $ref: "#/definitions/ResponseMeta" type: object + Enrollment: + description: User-global enrollment. TenantID is intentionally absent from the current schema, so cross-user tenant-manager access is unavailable. + type: object + properties: + ID: + type: string + Completed: + type: boolean + x-nullable: true + CourseID: + type: string + x-nullable: true + CreatedByID: + type: string + x-nullable: true + CreatedDate: + type: string + x-nullable: true + EnrollmentDate: + type: string + format: date + x-nullable: true + LastModifiedByID: + type: string + x-nullable: true + LastModifiedDate: + type: string + x-nullable: true + UserID: + type: string + x-nullable: true EnrollmentRequest: - description: An array of Enrollment objects + description: Exactly one Enrollment object properties: Data: items: - $ref: "../../lib/swagger/defs/enrollment.yaml#/Enrollment" + $ref: "#/definitions/Enrollment" + minItems: 1 + maxItems: 1 type: array type: object EnrollmentResponse: @@ -5036,7 +5104,7 @@ definitions: properties: Data: items: - $ref: "../../lib/swagger/defs/enrollment.yaml#/Enrollment" + $ref: "#/definitions/Enrollment" type: array type: object EventRequest: @@ -5111,14 +5179,42 @@ definitions: $ref: "../../lib/swagger/defs/invoice.yaml#/Invoice" type: array type: object - IssuedCertificateRequest: - description: An array of IssuedCertificate objects - properties: - Data: - items: - $ref: "../../lib/swagger/defs/issued-certificate.yaml#/IssuedCertificate" - type: array + IssuedCertificate: + description: Sanitized user-global issuance evidence. VerificationCode is intentionally excluded from this contract. type: object + properties: + ID: + type: string + AccountID: + type: string + x-nullable: true + CreatedByID: + type: string + x-nullable: true + CreatedDate: + type: string + x-nullable: true + EnrollmentID: + type: string + x-nullable: true + ExpirationDate: + type: string + x-nullable: true + IssueDate: + type: string + x-nullable: true + LastModifiedByID: + type: string + x-nullable: true + LastModifiedDate: + type: string + x-nullable: true + TemplateID: + type: string + x-nullable: true + UserID: + type: string + x-nullable: true IssuedCertificateResponse: description: An array of IssuedCertificate objects properties: @@ -5126,15 +5222,52 @@ definitions: $ref: "#/definitions/ResponseMeta" Data: items: - $ref: "../../lib/swagger/defs/issued-certificate.yaml#/IssuedCertificate" + $ref: "#/definitions/IssuedCertificate" type: array type: object + LessonProgress: + description: Tenant-scoped progress for one enrollment and lesson. + type: object + properties: + ID: + type: string + Completed: + type: boolean + CompletedAt: + type: string + x-nullable: true + CreatedByID: + type: string + x-nullable: true + CreatedDate: + type: string + x-nullable: true + EnrollmentID: + type: string + x-nullable: true + LastModifiedByID: + type: string + x-nullable: true + LastModifiedDate: + type: string + x-nullable: true + LessonID: + type: string + x-nullable: true + TenantID: + type: string + x-nullable: true + UserID: + type: string + x-nullable: true LessonProgressRequest: - description: An array of LessonProgress objects + description: Exactly one LessonProgress object properties: Data: items: - $ref: "../../lib/swagger/defs/lesson-progress.yaml#/LessonProgress" + $ref: "#/definitions/LessonProgress" + minItems: 1 + maxItems: 1 type: array type: object LessonProgressResponse: @@ -5144,7 +5277,7 @@ definitions: $ref: "#/definitions/ResponseMeta" Data: items: - $ref: "../../lib/swagger/defs/lesson-progress.yaml#/LessonProgress" + $ref: "#/definitions/LessonProgress" type: array type: object OutgoingEmailMessageRequest: diff --git a/swagger/members-vernonkeenan.yaml b/swagger/members-vernonkeenan.yaml index 6488f54..a9b71a9 100644 --- a/swagger/members-vernonkeenan.yaml +++ b/swagger/members-vernonkeenan.yaml @@ -141,13 +141,6 @@ parameters: required: true schema: $ref: "#/definitions/AttendeeRequest" - CertificateRequest: - description: An array of new Certificate records - in: body - name: certificateRequest - required: true - schema: - $ref: "#/definitions/CertificateRequest" CourseLessonRequest: description: An array of new CourseLesson records in: body @@ -224,13 +217,6 @@ parameters: required: true schema: $ref: "#/definitions/InvoiceRequest" - IssuedCertificateRequest: - description: An array of new IssuedCertificate records - in: body - name: issuedCertificateRequest - required: true - schema: - $ref: "#/definitions/IssuedCertificateRequest" LessonProgressRequest: description: An array of new LessonProgress records in: body @@ -523,10 +509,6 @@ responses: description: Attendee Response Object schema: $ref: "#/definitions/AttendeeResponse" - CertificateResponse: - description: Certificate Response Object - schema: - $ref: "#/definitions/CertificateResponse" ClusterResponse: description: Response with Cluster objects schema: @@ -1807,78 +1789,6 @@ paths: summary: Update Attendee tags: - Attendees - /certificates: - get: - description: Return a list of Certificate records from the datastore - operationId: getCertificates - parameters: - - $ref: "#/parameters/idQuery" - - $ref: "#/parameters/limitQuery" - - $ref: "#/parameters/offsetQuery" - responses: - "200": - $ref: "#/responses/CertificateResponse" - "401": - $ref: "#/responses/Unauthorized" - "403": - $ref: "#/responses/AccessForbidden" - "404": - $ref: "#/responses/NotFound" - "422": - $ref: "#/responses/UnprocessableEntity" - "500": - $ref: "#/responses/ServerError" - security: - - ApiKeyAuth: [] - summary: Get a list Certificates - tags: - - Certificates - post: - description: Create Certificates - operationId: postCertificates - parameters: - - $ref: "#/parameters/CertificateRequest" - responses: - "200": - $ref: "#/responses/CertificateResponse" - "401": - $ref: "#/responses/Unauthorized" - "403": - $ref: "#/responses/AccessForbidden" - "404": - $ref: "#/responses/NotFound" - "422": - $ref: "#/responses/UnprocessableEntity" - "500": - $ref: "#/responses/ServerError" - security: - - ApiKeyAuth: [] - summary: Create new Certificates - tags: - - Certificates - put: - description: Update Certificate - operationId: putCertificates - parameters: - - $ref: "#/parameters/CertificateRequest" - responses: - "200": - $ref: "#/responses/CertificateResponse" - "401": - $ref: "#/responses/Unauthorized" - "403": - $ref: "#/responses/AccessForbidden" - "404": - $ref: "#/responses/NotFound" - "422": - $ref: "#/responses/UnprocessableEntity" - "500": - $ref: "#/responses/ServerError" - security: - - ApiKeyAuth: [] - summary: Update Certificate - tags: - - Certificates /clusters: get: description: Return a list of Cluster records from the datastore @@ -1953,9 +1863,11 @@ paths: - Clusters /courselessons: get: + description: Estate-global learning catalog read. Requires members:course-lesson:read and an active human session. operationId: getCourseLessons security: - ApiKeyAuth: [] + kvSessionCookie: [] parameters: - $ref: "#/parameters/idQuery" - $ref: "#/parameters/limitQuery" @@ -1977,9 +1889,11 @@ paths: tags: - Courses post: + description: 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. operationId: postCourseLessons security: - ApiKeyAuth: [] + kvSessionCookie: [] parameters: - $ref: "#/parameters/CourseLessonRequest" responses: @@ -2001,6 +1915,8 @@ paths: put: security: - ApiKeyAuth: [] + kvSessionCookie: [] + description: Estate-global lesson CAS update. Requires members:course-lesson:update, an active human session, and tenant-independent Administrator/Admin authority. SectionID is immutable. operationId: updateCourseLessons parameters: - $ref: "#/parameters/CourseLessonRequest" @@ -2011,6 +1927,8 @@ paths: $ref: "#/responses/Unauthorized" "403": $ref: "#/responses/AccessForbidden" + "409": + $ref: "#/responses/Conflict" "404": $ref: "#/responses/NotFound" "422": @@ -2022,8 +1940,10 @@ paths: - Courses /courses: get: + description: Estate-global learning catalog read. Requires members:course:read and an active human session. security: - ApiKeyAuth: [] + kvSessionCookie: [] operationId: getCourses parameters: - $ref: "#/parameters/idQuery" @@ -2046,8 +1966,10 @@ paths: tags: - Courses post: + description: 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. security: - ApiKeyAuth: [] + kvSessionCookie: [] operationId: postCourses parameters: - $ref: "#/parameters/CourseRequest" @@ -2068,8 +1990,10 @@ paths: tags: - Courses put: + description: Estate-global course CAS update. Requires members:course:update, an active human session, and tenant-independent Administrator/Admin authority. security: - ApiKeyAuth: [] + kvSessionCookie: [] operationId: updateCourses parameters: - $ref: "#/parameters/CourseRequest" @@ -2080,6 +2004,8 @@ paths: $ref: "#/responses/Unauthorized" "403": $ref: "#/responses/AccessForbidden" + "409": + $ref: "#/responses/Conflict" "404": $ref: "#/responses/NotFound" "422": @@ -2091,8 +2017,10 @@ paths: - Courses /coursesections: get: + description: Estate-global course-section read. Requires members:course-section:read and an active human session. security: - ApiKeyAuth: [] + kvSessionCookie: [] operationId: getCourseSections parameters: - $ref: "#/parameters/idQuery" @@ -2115,8 +2043,10 @@ paths: tags: - Courses post: + description: 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. security: - ApiKeyAuth: [] + kvSessionCookie: [] operationId: postCourseSections parameters: - $ref: "#/parameters/CourseSectionRequest" @@ -2137,8 +2067,10 @@ paths: tags: - Courses put: + description: Estate-global course-section CAS update. Requires members:course-section:update, an active human session, and tenant-independent Administrator/Admin authority. CourseID is immutable. security: - ApiKeyAuth: [] + kvSessionCookie: [] operationId: updateCourseSections parameters: - $ref: "#/parameters/CourseSectionRequest" @@ -2149,6 +2081,8 @@ paths: $ref: "#/responses/Unauthorized" "403": $ref: "#/responses/AccessForbidden" + "409": + $ref: "#/responses/Conflict" "404": $ref: "#/responses/NotFound" "422": @@ -2561,7 +2495,7 @@ paths: - Emails /enrollments: get: - description: Return a list of Enrollment records from the datastore + description: User-global enrollment read. Requires members:enrollment:read and an active human session. Because Enrollment has no TenantID, records are restricted to the authenticated user and tenant managers receive no cross-user visibility. operationId: getEnrollments parameters: - $ref: "#/parameters/idQuery" @@ -2582,11 +2516,12 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Get a list Enrollments tags: - Enrollments post: - description: Create Enrollments + description: User-global self-enrollment create. Requires members:enrollment:create and an active human session. UserID is derived from the actor; IDs, audit fields, EnrollmentDate, and Completed are server-owned. operationId: postEnrollments parameters: - $ref: "#/parameters/EnrollmentRequest" @@ -2605,11 +2540,12 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Create new Enrollments tags: - Enrollments put: - description: Update Enrollment + description: User-global self-enrollment CAS update. Requires members:enrollment:update and an active human session. UserID and CourseID are immutable; completion is monotonic. operationId: putEnrollments parameters: - $ref: "#/parameters/EnrollmentRequest" @@ -2620,6 +2556,8 @@ paths: $ref: "#/responses/Unauthorized" "403": $ref: "#/responses/AccessForbidden" + "409": + $ref: "#/responses/Conflict" "404": $ref: "#/responses/NotFound" "422": @@ -2628,6 +2566,7 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Update Enrollment tags: - Enrollments @@ -2877,7 +2816,7 @@ paths: - Invoices /issuedcertificates: get: - description: Return a list of IssuedCertificate records from the datastore + description: Sanitized user-global certificate read. Requires members:issued-certificate:read and an active human session. Records are restricted to the authenticated user; verification material is never returned. Issuance, mutation, revocation, and deletion require a separate lifecycle API and are intentionally unavailable here. operationId: getIssuedCertificates parameters: - $ref: "#/parameters/idQuery" @@ -2898,58 +2837,13 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Get a list IssuedCertificates tags: - IssuedCertificates - post: - description: Create IssuedCertificates - operationId: postIssuedCertificates - parameters: - - $ref: "#/parameters/IssuedCertificateRequest" - responses: - "200": - $ref: "#/responses/IssuedCertificateResponse" - "401": - $ref: "#/responses/Unauthorized" - "403": - $ref: "#/responses/AccessForbidden" - "404": - $ref: "#/responses/NotFound" - "422": - $ref: "#/responses/UnprocessableEntity" - "500": - $ref: "#/responses/ServerError" - security: - - ApiKeyAuth: [] - summary: Create new IssuedCertificates - tags: - - IssuedCertificates - put: - description: Update IssuedCertificate - operationId: putIssuedCertificates - parameters: - - $ref: "#/parameters/IssuedCertificateRequest" - responses: - "200": - $ref: "#/responses/IssuedCertificateResponse" - "401": - $ref: "#/responses/Unauthorized" - "403": - $ref: "#/responses/AccessForbidden" - "404": - $ref: "#/responses/NotFound" - "422": - $ref: "#/responses/UnprocessableEntity" - "500": - $ref: "#/responses/ServerError" - security: - - ApiKeyAuth: [] - summary: Update IssuedCertificate - tags: - - IssuedCertificates /lessonprogress: get: - description: Return a list of LessonProgress records from the datastore + description: Tenant- and user-scoped lesson-progress read. Requires members:lesson-progress:read and an active human session. Owners and managers can read their tenant; other members can read only their own records. operationId: getLessonProgresses parameters: - $ref: "#/parameters/idQuery" @@ -2970,11 +2864,12 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Get a list LessonProgresses tags: - LessonProgress post: - description: Create LessonProgresses + description: Tenant- and user-scoped lesson-progress create. Requires members:lesson-progress:create and an active human session. Relationship ownership is validated; IDs, audit fields, Completed, and CompletedAt are server-owned. operationId: postLessonProgresses parameters: - $ref: "#/parameters/LessonProgressRequest" @@ -2993,11 +2888,12 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Create new LessonProgresses tags: - LessonProgress put: - description: Update LessonProgress + description: Tenant- and user-scoped lesson-progress CAS update. Requires members:lesson-progress:update and an active human session. TenantID, UserID, EnrollmentID, and LessonID are immutable; completion is monotonic and CompletedAt is server-owned. operationId: putLessonProgresses parameters: - $ref: "#/parameters/LessonProgressRequest" @@ -3008,6 +2904,8 @@ paths: $ref: "#/responses/Unauthorized" "403": $ref: "#/responses/AccessForbidden" + "409": + $ref: "#/responses/Conflict" "404": $ref: "#/responses/NotFound" "422": @@ -3016,6 +2914,7 @@ paths: $ref: "#/responses/ServerError" security: - ApiKeyAuth: [] + kvSessionCookie: [] summary: Update LessonProgress tags: - LessonProgress @@ -4676,22 +4575,6 @@ definitions: $ref: "../../lib/swagger/defs/attendee.yaml#/Attendee" type: array type: object - CertificateRequest: - description: An array of Certificate objects - properties: - Data: - items: - $ref: "../../lib/swagger/defs/certificate.yaml#/Certificate" - type: array - type: object - CertificateResponse: - description: An array of Certificate objects - properties: - Data: - items: - $ref: "../../lib/swagger/defs/certificate.yaml#/Certificate" - type: array - type: object ClusterRequest: properties: Data: @@ -4709,12 +4592,160 @@ definitions: Meta: $ref: "#/definitions/ResponseMeta" type: object + Course: + description: Estate-global course catalog record. Tenant ownership is intentionally absent from the current schema. + type: object + properties: + ID: + type: string + CreatedByID: + type: string + x-nullable: true + CreatedDate: + type: string + x-nullable: true + Description: + type: string + x-nullable: true + Fulldescription: + type: string + x-nullable: true + ImageAltText: + type: string + x-nullable: true + ImageURL: + type: string + x-nullable: true + InstructorID: + type: string + x-nullable: true + LastModifiedByID: + type: string + x-nullable: true + LastModifiedDate: + type: string + x-nullable: true + Logo: + type: string + x-nullable: true + Price: + description: Exact base-10 representation of DECIMAL(10,2). + type: string + pattern: '^[0-9]{1,8}(\.[0-9]{1,2})?$' + x-nullable: true + Slug: + type: string + maxLength: 80 + x-nullable: true + TemplateID: + type: string + x-nullable: true + Title: + type: string + maxLength: 255 + x-nullable: true + CourseSection: + description: Estate-global section linked to one Course. + type: object + properties: + ID: + type: string + Content: + type: string + x-nullable: true + CourseID: + type: string + x-nullable: true + CreatedByID: + type: string + x-nullable: true + CreatedDate: + type: string + x-nullable: true + ImageAltText: + type: string + x-nullable: true + ImageURL: + type: string + x-nullable: true + LastModifiedByID: + type: string + x-nullable: true + LastModifiedDate: + type: string + x-nullable: true + Logo: + type: string + x-nullable: true + Order: + type: integer + format: int64 + x-nullable: true + Slug: + type: string + maxLength: 80 + x-nullable: true + Title: + type: string + maxLength: 255 + x-nullable: true + CourseLesson: + description: Estate-global lesson linked to one CourseSection. + type: object + properties: + ID: + type: string + Content: + type: string + x-nullable: true + CreatedByID: + type: string + x-nullable: true + CreatedDate: + type: string + x-nullable: true + ImageAltText: + type: string + x-nullable: true + ImageURL: + type: string + x-nullable: true + LastModifiedByID: + type: string + x-nullable: true + LastModifiedDate: + type: string + x-nullable: true + Logo: + type: string + x-nullable: true + Order: + type: integer + format: int64 + x-nullable: true + SectionID: + description: Persisted as coursesectionid. + type: string + x-nullable: true + Slug: + type: string + maxLength: 80 + x-nullable: true + Title: + type: string + maxLength: 255 + x-nullable: true + VideoURL: + type: string + x-nullable: true CourseLessonRequest: - description: An array of CourseLesson objects + description: Exactly one CourseLesson object properties: Data: items: - $ref: "../../lib/swagger/defs/course-lesson.yaml#/CourseLesson" + $ref: "#/definitions/CourseLesson" + minItems: 1 + maxItems: 1 type: array type: object CourseLessonResponse: @@ -4722,17 +4753,19 @@ definitions: properties: Data: items: - $ref: "../../lib/swagger/defs/course-lesson.yaml#/CourseLesson" + $ref: "#/definitions/CourseLesson" type: array Meta: $ref: "#/definitions/ResponseMeta" type: object CourseRequest: - description: An array of Course objects + description: Exactly one Course object properties: Data: items: - $ref: "../../lib/swagger/defs/course.yaml#/Course" + $ref: "#/definitions/Course" + minItems: 1 + maxItems: 1 type: array type: object CourseResponse: @@ -4742,15 +4775,17 @@ definitions: $ref: "#/definitions/ResponseMeta" Data: items: - $ref: "../../lib/swagger/defs/course.yaml#/Course" + $ref: "#/definitions/Course" type: array type: object CourseSectionRequest: - description: An array of CourseSection objects + description: Exactly one CourseSection object properties: Data: items: - $ref: "../../lib/swagger/defs/course-section.yaml#/CourseSection" + $ref: "#/definitions/CourseSection" + minItems: 1 + maxItems: 1 type: array type: object CourseSectionResponse: @@ -4760,7 +4795,7 @@ definitions: $ref: "#/definitions/ResponseMeta" Data: items: - $ref: "../../lib/swagger/defs/course-section.yaml#/CourseSection" + $ref: "#/definitions/CourseSection" type: array type: object DatabaseRequest: @@ -5023,12 +5058,45 @@ definitions: meta: $ref: "#/definitions/ResponseMeta" type: object + Enrollment: + description: User-global enrollment. TenantID is intentionally absent from the current schema, so cross-user tenant-manager access is unavailable. + type: object + properties: + ID: + type: string + Completed: + type: boolean + x-nullable: true + CourseID: + type: string + x-nullable: true + CreatedByID: + type: string + x-nullable: true + CreatedDate: + type: string + x-nullable: true + EnrollmentDate: + type: string + format: date + x-nullable: true + LastModifiedByID: + type: string + x-nullable: true + LastModifiedDate: + type: string + x-nullable: true + UserID: + type: string + x-nullable: true EnrollmentRequest: - description: An array of Enrollment objects + description: Exactly one Enrollment object properties: Data: items: - $ref: "../../lib/swagger/defs/enrollment.yaml#/Enrollment" + $ref: "#/definitions/Enrollment" + minItems: 1 + maxItems: 1 type: array type: object EnrollmentResponse: @@ -5036,7 +5104,7 @@ definitions: properties: Data: items: - $ref: "../../lib/swagger/defs/enrollment.yaml#/Enrollment" + $ref: "#/definitions/Enrollment" type: array type: object EventRequest: @@ -5111,14 +5179,42 @@ definitions: $ref: "../../lib/swagger/defs/invoice.yaml#/Invoice" type: array type: object - IssuedCertificateRequest: - description: An array of IssuedCertificate objects - properties: - Data: - items: - $ref: "../../lib/swagger/defs/issued-certificate.yaml#/IssuedCertificate" - type: array + IssuedCertificate: + description: Sanitized user-global issuance evidence. VerificationCode is intentionally excluded from this contract. type: object + properties: + ID: + type: string + AccountID: + type: string + x-nullable: true + CreatedByID: + type: string + x-nullable: true + CreatedDate: + type: string + x-nullable: true + EnrollmentID: + type: string + x-nullable: true + ExpirationDate: + type: string + x-nullable: true + IssueDate: + type: string + x-nullable: true + LastModifiedByID: + type: string + x-nullable: true + LastModifiedDate: + type: string + x-nullable: true + TemplateID: + type: string + x-nullable: true + UserID: + type: string + x-nullable: true IssuedCertificateResponse: description: An array of IssuedCertificate objects properties: @@ -5126,15 +5222,52 @@ definitions: $ref: "#/definitions/ResponseMeta" Data: items: - $ref: "../../lib/swagger/defs/issued-certificate.yaml#/IssuedCertificate" + $ref: "#/definitions/IssuedCertificate" type: array type: object + LessonProgress: + description: Tenant-scoped progress for one enrollment and lesson. + type: object + properties: + ID: + type: string + Completed: + type: boolean + CompletedAt: + type: string + x-nullable: true + CreatedByID: + type: string + x-nullable: true + CreatedDate: + type: string + x-nullable: true + EnrollmentID: + type: string + x-nullable: true + LastModifiedByID: + type: string + x-nullable: true + LastModifiedDate: + type: string + x-nullable: true + LessonID: + type: string + x-nullable: true + TenantID: + type: string + x-nullable: true + UserID: + type: string + x-nullable: true LessonProgressRequest: - description: An array of LessonProgress objects + description: Exactly one LessonProgress object properties: Data: items: - $ref: "../../lib/swagger/defs/lesson-progress.yaml#/LessonProgress" + $ref: "#/definitions/LessonProgress" + minItems: 1 + maxItems: 1 type: array type: object LessonProgressResponse: @@ -5144,7 +5277,7 @@ definitions: $ref: "#/definitions/ResponseMeta" Data: items: - $ref: "../../lib/swagger/defs/lesson-progress.yaml#/LessonProgress" + $ref: "#/definitions/LessonProgress" type: array type: object OutgoingEmailMessageRequest: