feat(api): Generate session management API client and models

- Added `get_me` and `refresh_session` parameters and responses for user session management.
- Implemented `sessions_client` for handling session-related API calls.
- Created models for `Credentials`, `Category`, `Product`, and `Service` with validation.
- Defined Swagger specifications for `Credentials`.
- Ensured all generated files are marked as non-editable to prevent manual changes.
v0.7.4 v0.7.4
Vernon Keenan 2025-05-27 03:20:36 +00:00
parent 2e3fdeec39
commit a13ad35fe2
25 changed files with 2271 additions and 326 deletions

View File

@ -31,6 +31,7 @@ import (
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/payment_methods"
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/prompts"
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/research_projects"
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/sessions"
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/templates"
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/tenants"
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/tickets"
@ -98,6 +99,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *Members {
cli.PaymentMethods = payment_methods.New(transport, formats)
cli.Prompts = prompts.New(transport, formats)
cli.ResearchProjects = research_projects.New(transport, formats)
cli.Sessions = sessions.New(transport, formats)
cli.Templates = templates.New(transport, formats)
cli.Tenants = tenants.New(transport, formats)
cli.Tickets = tickets.New(transport, formats)
@ -182,6 +184,8 @@ type Members struct {
ResearchProjects research_projects.ClientService
Sessions sessions.ClientService
Templates templates.ClientService
Tenants tenants.ClientService
@ -217,6 +221,7 @@ func (c *Members) SetTransport(transport runtime.ClientTransport) {
c.PaymentMethods.SetTransport(transport)
c.Prompts.SetTransport(transport)
c.ResearchProjects.SetTransport(transport)
c.Sessions.SetTransport(transport)
c.Templates.SetTransport(transport)
c.Tenants.SetTransport(transport)
c.Tickets.SetTransport(transport)

View File

@ -0,0 +1,154 @@
// 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 sessions
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
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"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
)
// NewCreateSessionParams creates a new CreateSessionParams 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 NewCreateSessionParams() *CreateSessionParams {
return &CreateSessionParams{
timeout: cr.DefaultTimeout,
}
}
// NewCreateSessionParamsWithTimeout creates a new CreateSessionParams object
// with the ability to set a timeout on a request.
func NewCreateSessionParamsWithTimeout(timeout time.Duration) *CreateSessionParams {
return &CreateSessionParams{
timeout: timeout,
}
}
// NewCreateSessionParamsWithContext creates a new CreateSessionParams object
// with the ability to set a context for a request.
func NewCreateSessionParamsWithContext(ctx context.Context) *CreateSessionParams {
return &CreateSessionParams{
Context: ctx,
}
}
// NewCreateSessionParamsWithHTTPClient creates a new CreateSessionParams object
// with the ability to set a custom HTTPClient for a request.
func NewCreateSessionParamsWithHTTPClient(client *http.Client) *CreateSessionParams {
return &CreateSessionParams{
HTTPClient: client,
}
}
/*
CreateSessionParams contains all the parameters to send to the API endpoint
for the create session operation.
Typically these are written to a http.Request.
*/
type CreateSessionParams struct {
// Credentials.
Credentials *members_models.Credentials
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the create session params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *CreateSessionParams) WithDefaults() *CreateSessionParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the create session params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *CreateSessionParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the create session params
func (o *CreateSessionParams) WithTimeout(timeout time.Duration) *CreateSessionParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the create session params
func (o *CreateSessionParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the create session params
func (o *CreateSessionParams) WithContext(ctx context.Context) *CreateSessionParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the create session params
func (o *CreateSessionParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the create session params
func (o *CreateSessionParams) WithHTTPClient(client *http.Client) *CreateSessionParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the create session params
func (o *CreateSessionParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithCredentials adds the credentials to the create session params
func (o *CreateSessionParams) WithCredentials(credentials *members_models.Credentials) *CreateSessionParams {
o.SetCredentials(credentials)
return o
}
// SetCredentials adds the credentials to the create session params
func (o *CreateSessionParams) SetCredentials(credentials *members_models.Credentials) {
o.Credentials = credentials
}
// WriteToRequest writes these params to a swagger request
func (o *CreateSessionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.Credentials != nil {
if err := r.SetBodyParam(o.Credentials); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,266 @@
// 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 sessions
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
)
// CreateSessionReader is a Reader for the CreateSession structure.
type CreateSessionReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *CreateSessionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewCreateSessionOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewCreateSessionUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 429:
result := NewCreateSessionTooManyRequests()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewCreateSessionOK creates a CreateSessionOK with default headers values
func NewCreateSessionOK() *CreateSessionOK {
return &CreateSessionOK{}
}
/*
CreateSessionOK describes a response with status code 200, with default header values.
Successful sign-in
*/
type CreateSessionOK struct {
/* kvSession=<jwt>; HttpOnly; Secure; SameSite=None; Domain=.keenanvision.net; Path=/; Max-Age=5400
*/
SetCookie string
Payload interface{}
}
// IsSuccess returns true when this create session o k response has a 2xx status code
func (o *CreateSessionOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this create session o k response has a 3xx status code
func (o *CreateSessionOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this create session o k response has a 4xx status code
func (o *CreateSessionOK) IsClientError() bool {
return false
}
// IsServerError returns true when this create session o k response has a 5xx status code
func (o *CreateSessionOK) IsServerError() bool {
return false
}
// IsCode returns true when this create session o k response a status code equal to that given
func (o *CreateSessionOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the create session o k response
func (o *CreateSessionOK) Code() int {
return 200
}
func (o *CreateSessionOK) Error() string {
return fmt.Sprintf("[POST /sessions][%d] createSessionOK %+v", 200, o.Payload)
}
func (o *CreateSessionOK) String() string {
return fmt.Sprintf("[POST /sessions][%d] createSessionOK %+v", 200, o.Payload)
}
func (o *CreateSessionOK) GetPayload() interface{} {
return o.Payload
}
func (o *CreateSessionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// hydrates response header Set-Cookie
hdrSetCookie := response.GetHeader("Set-Cookie")
if hdrSetCookie != "" {
o.SetCookie = hdrSetCookie
}
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewCreateSessionUnauthorized creates a CreateSessionUnauthorized with default headers values
func NewCreateSessionUnauthorized() *CreateSessionUnauthorized {
return &CreateSessionUnauthorized{}
}
/*
CreateSessionUnauthorized describes a response with status code 401, with default header values.
Access Unauthorized, invalid API-KEY was used
*/
type CreateSessionUnauthorized struct {
Payload *members_models.Error
}
// IsSuccess returns true when this create session unauthorized response has a 2xx status code
func (o *CreateSessionUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this create session unauthorized response has a 3xx status code
func (o *CreateSessionUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this create session unauthorized response has a 4xx status code
func (o *CreateSessionUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this create session unauthorized response has a 5xx status code
func (o *CreateSessionUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this create session unauthorized response a status code equal to that given
func (o *CreateSessionUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the create session unauthorized response
func (o *CreateSessionUnauthorized) Code() int {
return 401
}
func (o *CreateSessionUnauthorized) Error() string {
return fmt.Sprintf("[POST /sessions][%d] createSessionUnauthorized %+v", 401, o.Payload)
}
func (o *CreateSessionUnauthorized) String() string {
return fmt.Sprintf("[POST /sessions][%d] createSessionUnauthorized %+v", 401, o.Payload)
}
func (o *CreateSessionUnauthorized) GetPayload() *members_models.Error {
return o.Payload
}
func (o *CreateSessionUnauthorized) 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 && err != io.EOF {
return err
}
return nil
}
// NewCreateSessionTooManyRequests creates a CreateSessionTooManyRequests with default headers values
func NewCreateSessionTooManyRequests() *CreateSessionTooManyRequests {
return &CreateSessionTooManyRequests{}
}
/*
CreateSessionTooManyRequests describes a response with status code 429, with default header values.
Server Internal Error
*/
type CreateSessionTooManyRequests struct {
Payload *members_models.Error
}
// IsSuccess returns true when this create session too many requests response has a 2xx status code
func (o *CreateSessionTooManyRequests) IsSuccess() bool {
return false
}
// IsRedirect returns true when this create session too many requests response has a 3xx status code
func (o *CreateSessionTooManyRequests) IsRedirect() bool {
return false
}
// IsClientError returns true when this create session too many requests response has a 4xx status code
func (o *CreateSessionTooManyRequests) IsClientError() bool {
return true
}
// IsServerError returns true when this create session too many requests response has a 5xx status code
func (o *CreateSessionTooManyRequests) IsServerError() bool {
return false
}
// IsCode returns true when this create session too many requests response a status code equal to that given
func (o *CreateSessionTooManyRequests) IsCode(code int) bool {
return code == 429
}
// Code gets the status code for the create session too many requests response
func (o *CreateSessionTooManyRequests) Code() int {
return 429
}
func (o *CreateSessionTooManyRequests) Error() string {
return fmt.Sprintf("[POST /sessions][%d] createSessionTooManyRequests %+v", 429, o.Payload)
}
func (o *CreateSessionTooManyRequests) String() string {
return fmt.Sprintf("[POST /sessions][%d] createSessionTooManyRequests %+v", 429, o.Payload)
}
func (o *CreateSessionTooManyRequests) GetPayload() *members_models.Error {
return o.Payload
}
func (o *CreateSessionTooManyRequests) 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 && err != io.EOF {
return err
}
return nil
}

View File

@ -0,0 +1,132 @@
// 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 sessions
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
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"
)
// NewDeleteSessionParams creates a new DeleteSessionParams 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 NewDeleteSessionParams() *DeleteSessionParams {
return &DeleteSessionParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteSessionParamsWithTimeout creates a new DeleteSessionParams object
// with the ability to set a timeout on a request.
func NewDeleteSessionParamsWithTimeout(timeout time.Duration) *DeleteSessionParams {
return &DeleteSessionParams{
timeout: timeout,
}
}
// NewDeleteSessionParamsWithContext creates a new DeleteSessionParams object
// with the ability to set a context for a request.
func NewDeleteSessionParamsWithContext(ctx context.Context) *DeleteSessionParams {
return &DeleteSessionParams{
Context: ctx,
}
}
// NewDeleteSessionParamsWithHTTPClient creates a new DeleteSessionParams object
// with the ability to set a custom HTTPClient for a request.
func NewDeleteSessionParamsWithHTTPClient(client *http.Client) *DeleteSessionParams {
return &DeleteSessionParams{
HTTPClient: client,
}
}
/*
DeleteSessionParams contains all the parameters to send to the API endpoint
for the delete session operation.
Typically these are written to a http.Request.
*/
type DeleteSessionParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the delete session params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *DeleteSessionParams) WithDefaults() *DeleteSessionParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the delete session params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *DeleteSessionParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the delete session params
func (o *DeleteSessionParams) WithTimeout(timeout time.Duration) *DeleteSessionParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete session params
func (o *DeleteSessionParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the delete session params
func (o *DeleteSessionParams) WithContext(ctx context.Context) *DeleteSessionParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete session params
func (o *DeleteSessionParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete session params
func (o *DeleteSessionParams) WithHTTPClient(client *http.Client) *DeleteSessionParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete session params
func (o *DeleteSessionParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *DeleteSessionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,169 @@
// 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 sessions
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
)
// DeleteSessionReader is a Reader for the DeleteSession structure.
type DeleteSessionReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *DeleteSessionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 204:
result := NewDeleteSessionNoContent()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewDeleteSessionUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewDeleteSessionNoContent creates a DeleteSessionNoContent with default headers values
func NewDeleteSessionNoContent() *DeleteSessionNoContent {
return &DeleteSessionNoContent{}
}
/*
DeleteSessionNoContent describes a response with status code 204, with default header values.
Logged out; kvSession cookie cleared
*/
type DeleteSessionNoContent struct {
}
// IsSuccess returns true when this delete session no content response has a 2xx status code
func (o *DeleteSessionNoContent) IsSuccess() bool {
return true
}
// IsRedirect returns true when this delete session no content response has a 3xx status code
func (o *DeleteSessionNoContent) IsRedirect() bool {
return false
}
// IsClientError returns true when this delete session no content response has a 4xx status code
func (o *DeleteSessionNoContent) IsClientError() bool {
return false
}
// IsServerError returns true when this delete session no content response has a 5xx status code
func (o *DeleteSessionNoContent) IsServerError() bool {
return false
}
// IsCode returns true when this delete session no content response a status code equal to that given
func (o *DeleteSessionNoContent) IsCode(code int) bool {
return code == 204
}
// Code gets the status code for the delete session no content response
func (o *DeleteSessionNoContent) Code() int {
return 204
}
func (o *DeleteSessionNoContent) Error() string {
return fmt.Sprintf("[DELETE /sessions/current][%d] deleteSessionNoContent ", 204)
}
func (o *DeleteSessionNoContent) String() string {
return fmt.Sprintf("[DELETE /sessions/current][%d] deleteSessionNoContent ", 204)
}
func (o *DeleteSessionNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewDeleteSessionUnauthorized creates a DeleteSessionUnauthorized with default headers values
func NewDeleteSessionUnauthorized() *DeleteSessionUnauthorized {
return &DeleteSessionUnauthorized{}
}
/*
DeleteSessionUnauthorized describes a response with status code 401, with default header values.
Access Unauthorized, invalid API-KEY was used
*/
type DeleteSessionUnauthorized struct {
Payload *members_models.Error
}
// IsSuccess returns true when this delete session unauthorized response has a 2xx status code
func (o *DeleteSessionUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this delete session unauthorized response has a 3xx status code
func (o *DeleteSessionUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this delete session unauthorized response has a 4xx status code
func (o *DeleteSessionUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this delete session unauthorized response has a 5xx status code
func (o *DeleteSessionUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this delete session unauthorized response a status code equal to that given
func (o *DeleteSessionUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the delete session unauthorized response
func (o *DeleteSessionUnauthorized) Code() int {
return 401
}
func (o *DeleteSessionUnauthorized) Error() string {
return fmt.Sprintf("[DELETE /sessions/current][%d] deleteSessionUnauthorized %+v", 401, o.Payload)
}
func (o *DeleteSessionUnauthorized) String() string {
return fmt.Sprintf("[DELETE /sessions/current][%d] deleteSessionUnauthorized %+v", 401, o.Payload)
}
func (o *DeleteSessionUnauthorized) GetPayload() *members_models.Error {
return o.Payload
}
func (o *DeleteSessionUnauthorized) 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 && err != io.EOF {
return err
}
return nil
}

View File

@ -0,0 +1,132 @@
// 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 sessions
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
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"
)
// NewGetMeParams creates a new GetMeParams 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 NewGetMeParams() *GetMeParams {
return &GetMeParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetMeParamsWithTimeout creates a new GetMeParams object
// with the ability to set a timeout on a request.
func NewGetMeParamsWithTimeout(timeout time.Duration) *GetMeParams {
return &GetMeParams{
timeout: timeout,
}
}
// NewGetMeParamsWithContext creates a new GetMeParams object
// with the ability to set a context for a request.
func NewGetMeParamsWithContext(ctx context.Context) *GetMeParams {
return &GetMeParams{
Context: ctx,
}
}
// NewGetMeParamsWithHTTPClient creates a new GetMeParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetMeParamsWithHTTPClient(client *http.Client) *GetMeParams {
return &GetMeParams{
HTTPClient: client,
}
}
/*
GetMeParams contains all the parameters to send to the API endpoint
for the get me operation.
Typically these are written to a http.Request.
*/
type GetMeParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get me params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetMeParams) WithDefaults() *GetMeParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get me params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetMeParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get me params
func (o *GetMeParams) WithTimeout(timeout time.Duration) *GetMeParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get me params
func (o *GetMeParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get me params
func (o *GetMeParams) WithContext(ctx context.Context) *GetMeParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get me params
func (o *GetMeParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get me params
func (o *GetMeParams) WithHTTPClient(client *http.Client) *GetMeParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get me params
func (o *GetMeParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *GetMeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,179 @@
// 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 sessions
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
)
// GetMeReader is a Reader for the GetMe structure.
type GetMeReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetMeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetMeOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewGetMeUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewGetMeOK creates a GetMeOK with default headers values
func NewGetMeOK() *GetMeOK {
return &GetMeOK{}
}
/*
GetMeOK describes a response with status code 200, with default header values.
Current user profile
*/
type GetMeOK struct {
Payload interface{}
}
// IsSuccess returns true when this get me o k response has a 2xx status code
func (o *GetMeOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get me o k response has a 3xx status code
func (o *GetMeOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get me o k response has a 4xx status code
func (o *GetMeOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get me o k response has a 5xx status code
func (o *GetMeOK) IsServerError() bool {
return false
}
// IsCode returns true when this get me o k response a status code equal to that given
func (o *GetMeOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the get me o k response
func (o *GetMeOK) Code() int {
return 200
}
func (o *GetMeOK) Error() string {
return fmt.Sprintf("[GET /sessions/me][%d] getMeOK %+v", 200, o.Payload)
}
func (o *GetMeOK) String() string {
return fmt.Sprintf("[GET /sessions/me][%d] getMeOK %+v", 200, o.Payload)
}
func (o *GetMeOK) GetPayload() interface{} {
return o.Payload
}
func (o *GetMeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetMeUnauthorized creates a GetMeUnauthorized with default headers values
func NewGetMeUnauthorized() *GetMeUnauthorized {
return &GetMeUnauthorized{}
}
/*
GetMeUnauthorized describes a response with status code 401, with default header values.
Access Unauthorized, invalid API-KEY was used
*/
type GetMeUnauthorized struct {
Payload *members_models.Error
}
// IsSuccess returns true when this get me unauthorized response has a 2xx status code
func (o *GetMeUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get me unauthorized response has a 3xx status code
func (o *GetMeUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this get me unauthorized response has a 4xx status code
func (o *GetMeUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this get me unauthorized response has a 5xx status code
func (o *GetMeUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this get me unauthorized response a status code equal to that given
func (o *GetMeUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the get me unauthorized response
func (o *GetMeUnauthorized) Code() int {
return 401
}
func (o *GetMeUnauthorized) Error() string {
return fmt.Sprintf("[GET /sessions/me][%d] getMeUnauthorized %+v", 401, o.Payload)
}
func (o *GetMeUnauthorized) String() string {
return fmt.Sprintf("[GET /sessions/me][%d] getMeUnauthorized %+v", 401, o.Payload)
}
func (o *GetMeUnauthorized) GetPayload() *members_models.Error {
return o.Payload
}
func (o *GetMeUnauthorized) 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 && err != io.EOF {
return err
}
return nil
}

View File

@ -0,0 +1,132 @@
// 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 sessions
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
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"
)
// NewRefreshSessionParams creates a new RefreshSessionParams 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 NewRefreshSessionParams() *RefreshSessionParams {
return &RefreshSessionParams{
timeout: cr.DefaultTimeout,
}
}
// NewRefreshSessionParamsWithTimeout creates a new RefreshSessionParams object
// with the ability to set a timeout on a request.
func NewRefreshSessionParamsWithTimeout(timeout time.Duration) *RefreshSessionParams {
return &RefreshSessionParams{
timeout: timeout,
}
}
// NewRefreshSessionParamsWithContext creates a new RefreshSessionParams object
// with the ability to set a context for a request.
func NewRefreshSessionParamsWithContext(ctx context.Context) *RefreshSessionParams {
return &RefreshSessionParams{
Context: ctx,
}
}
// NewRefreshSessionParamsWithHTTPClient creates a new RefreshSessionParams object
// with the ability to set a custom HTTPClient for a request.
func NewRefreshSessionParamsWithHTTPClient(client *http.Client) *RefreshSessionParams {
return &RefreshSessionParams{
HTTPClient: client,
}
}
/*
RefreshSessionParams contains all the parameters to send to the API endpoint
for the refresh session operation.
Typically these are written to a http.Request.
*/
type RefreshSessionParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the refresh session params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *RefreshSessionParams) WithDefaults() *RefreshSessionParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the refresh session params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *RefreshSessionParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the refresh session params
func (o *RefreshSessionParams) WithTimeout(timeout time.Duration) *RefreshSessionParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the refresh session params
func (o *RefreshSessionParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the refresh session params
func (o *RefreshSessionParams) WithContext(ctx context.Context) *RefreshSessionParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the refresh session params
func (o *RefreshSessionParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the refresh session params
func (o *RefreshSessionParams) WithHTTPClient(client *http.Client) *RefreshSessionParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the refresh session params
func (o *RefreshSessionParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *RefreshSessionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,180 @@
// 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 sessions
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
)
// RefreshSessionReader is a Reader for the RefreshSession structure.
type RefreshSessionReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *RefreshSessionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewRefreshSessionOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewRefreshSessionUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewRefreshSessionOK creates a RefreshSessionOK with default headers values
func NewRefreshSessionOK() *RefreshSessionOK {
return &RefreshSessionOK{}
}
/*
RefreshSessionOK describes a response with status code 200, with default header values.
Token refreshed
*/
type RefreshSessionOK struct {
/* New kvSession cookie with updated expiry
*/
SetCookie string
}
// IsSuccess returns true when this refresh session o k response has a 2xx status code
func (o *RefreshSessionOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this refresh session o k response has a 3xx status code
func (o *RefreshSessionOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this refresh session o k response has a 4xx status code
func (o *RefreshSessionOK) IsClientError() bool {
return false
}
// IsServerError returns true when this refresh session o k response has a 5xx status code
func (o *RefreshSessionOK) IsServerError() bool {
return false
}
// IsCode returns true when this refresh session o k response a status code equal to that given
func (o *RefreshSessionOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the refresh session o k response
func (o *RefreshSessionOK) Code() int {
return 200
}
func (o *RefreshSessionOK) Error() string {
return fmt.Sprintf("[POST /sessions/refresh][%d] refreshSessionOK ", 200)
}
func (o *RefreshSessionOK) String() string {
return fmt.Sprintf("[POST /sessions/refresh][%d] refreshSessionOK ", 200)
}
func (o *RefreshSessionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// hydrates response header Set-Cookie
hdrSetCookie := response.GetHeader("Set-Cookie")
if hdrSetCookie != "" {
o.SetCookie = hdrSetCookie
}
return nil
}
// NewRefreshSessionUnauthorized creates a RefreshSessionUnauthorized with default headers values
func NewRefreshSessionUnauthorized() *RefreshSessionUnauthorized {
return &RefreshSessionUnauthorized{}
}
/*
RefreshSessionUnauthorized describes a response with status code 401, with default header values.
Access Unauthorized, invalid API-KEY was used
*/
type RefreshSessionUnauthorized struct {
Payload *members_models.Error
}
// IsSuccess returns true when this refresh session unauthorized response has a 2xx status code
func (o *RefreshSessionUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this refresh session unauthorized response has a 3xx status code
func (o *RefreshSessionUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this refresh session unauthorized response has a 4xx status code
func (o *RefreshSessionUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this refresh session unauthorized response has a 5xx status code
func (o *RefreshSessionUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this refresh session unauthorized response a status code equal to that given
func (o *RefreshSessionUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the refresh session unauthorized response
func (o *RefreshSessionUnauthorized) Code() int {
return 401
}
func (o *RefreshSessionUnauthorized) Error() string {
return fmt.Sprintf("[POST /sessions/refresh][%d] refreshSessionUnauthorized %+v", 401, o.Payload)
}
func (o *RefreshSessionUnauthorized) String() string {
return fmt.Sprintf("[POST /sessions/refresh][%d] refreshSessionUnauthorized %+v", 401, o.Payload)
}
func (o *RefreshSessionUnauthorized) GetPayload() *members_models.Error {
return o.Payload
}
func (o *RefreshSessionUnauthorized) 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 && err != io.EOF {
return err
}
return nil
}

View File

@ -0,0 +1,206 @@
// 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 sessions
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// New creates a new sessions API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for sessions API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods
type ClientService interface {
CreateSession(params *CreateSessionParams, opts ...ClientOption) (*CreateSessionOK, error)
DeleteSession(params *DeleteSessionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteSessionNoContent, error)
GetMe(params *GetMeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetMeOK, error)
RefreshSession(params *RefreshSessionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RefreshSessionOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
CreateSession creates new session sign in
*/
func (a *Client) CreateSession(params *CreateSessionParams, opts ...ClientOption) (*CreateSessionOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCreateSessionParams()
}
op := &runtime.ClientOperation{
ID: "createSession",
Method: "POST",
PathPattern: "/sessions",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &CreateSessionReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*CreateSessionOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for createSession: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
DeleteSession deletes current session log out
*/
func (a *Client) DeleteSession(params *DeleteSessionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteSessionNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteSessionParams()
}
op := &runtime.ClientOperation{
ID: "deleteSession",
Method: "DELETE",
PathPattern: "/sessions/current",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &DeleteSessionReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*DeleteSessionNoContent)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for deleteSession: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetMe gets current user
*/
func (a *Client) GetMe(params *GetMeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetMeOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetMeParams()
}
op := &runtime.ClientOperation{
ID: "getMe",
Method: "GET",
PathPattern: "/sessions/me",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetMeReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*GetMeOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getMe: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
RefreshSession refreshes session cookie
*/
func (a *Client) RefreshSession(params *RefreshSessionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RefreshSessionOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewRefreshSessionParams()
}
op := &runtime.ClientOperation{
ID: "refreshSession",
Method: "POST",
PathPattern: "/sessions/refresh",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &RefreshSessionReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*RefreshSessionOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for refreshSession: 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.ClientTransport) {
a.transport = transport
}

View File

@ -0,0 +1,104 @@
// 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
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// Credentials credentials
//
// swagger:model credentials
type Credentials struct {
// email
// Example: user@example.com
// Required: true
// Format: email
Email *strfmt.Email `json:"email"`
// password
// Example: p@55w0rd-example
// Required: true
// Min Length: 12
Password *string `json:"password"`
}
// Validate validates this credentials
func (m *Credentials) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateEmail(formats); err != nil {
res = append(res, err)
}
if err := m.validatePassword(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Credentials) validateEmail(formats strfmt.Registry) error {
if err := validate.Required("email", "body", m.Email); err != nil {
return err
}
if err := validate.FormatOf("email", "body", "email", m.Email.String(), formats); err != nil {
return err
}
return nil
}
func (m *Credentials) validatePassword(formats strfmt.Registry) error {
if err := validate.Required("password", "body", m.Password); err != nil {
return err
}
if err := validate.MinLength("password", "body", *m.Password, 12); err != nil {
return err
}
return nil
}
// ContextValidate validates this credentials based on context it is used
func (m *Credentials) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *Credentials) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Credentials) UnmarshalBinary(b []byte) error {
var res Credentials
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@ -65,6 +65,12 @@ GetCompaniesParams contains all the parameters to send to the API endpoint
*/
type GetCompaniesParams struct {
/* Channel.
The channel to filter companies by
*/
Channel *string
/* CompanyID.
Record Id of an Company
@ -130,6 +136,17 @@ func (o *GetCompaniesParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithChannel adds the channel to the get companies params
func (o *GetCompaniesParams) WithChannel(channel *string) *GetCompaniesParams {
o.SetChannel(channel)
return o
}
// SetChannel adds the channel to the get companies params
func (o *GetCompaniesParams) SetChannel(channel *string) {
o.Channel = channel
}
// WithCompanyID adds the companyID to the get companies params
func (o *GetCompaniesParams) WithCompanyID(companyID *string) *GetCompaniesParams {
o.SetCompanyID(companyID)
@ -160,6 +177,23 @@ func (o *GetCompaniesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.
}
var res []error
if o.Channel != nil {
// query param channel
var qrChannel string
if o.Channel != nil {
qrChannel = *o.Channel
}
qChannel := qrChannel
if qChannel != "" {
if err := r.SetQueryParam("channel", qChannel); err != nil {
return err
}
}
}
if o.CompanyID != nil {
// query param companyId

View File

@ -0,0 +1,87 @@
// 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 plex_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// Category Junction object between Industry and Company
//
// swagger:model Category
type Category struct {
// ID of the Company that owns this Category
CompanyID *string `json:"CompanyID,omitempty"`
// Name of the Company
CompanyName *string `json:"CompanyName,omitempty"`
// Slug of the Company
CompanySlug *string `json:"CompanySlug,omitempty"`
// TagLine of the Company
CompanyTagLine *string `json:"CompanyTagLine,omitempty"`
// Created Date
CreatedByDate *string `json:"CreatedByDate,omitempty"`
// Created By User ID
CreatedByID *string `json:"CreatedByID,omitempty"`
// Record Id
ID string `json:"ID,omitempty"`
// ID of the Industry that owns this Category
IndustryID *string `json:"IndustryID,omitempty"`
// Name of the Industry
IndustryName *string `json:"IndustryName,omitempty"`
// Slug of the Industry
IndustrySlug *string `json:"IndustrySlug,omitempty"`
// TagLine of the Industry
IndustryTagLine *string `json:"IndustryTagLine,omitempty"`
// The full path of this category, including Parent
Path *string `json:"Path,omitempty"`
}
// Validate validates this category
func (m *Category) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this category based on context it is used
func (m *Category) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *Category) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Category) UnmarshalBinary(b []byte) error {
var res Category
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@ -41,6 +41,9 @@ type Company struct {
// Salesforce AppExchange URL
AppExchange *string `json:"AppExchange,omitempty"`
// Company Categories
Categories []*Category `json:"Categories"`
// cloud revenue total
CloudRevenueTotal *float64 `json:"CloudRevenueTotal,omitempty"`
@ -50,12 +53,6 @@ type Company struct {
// The year company started cloud revenue
CloudYear *string `json:"CloudYear,omitempty"`
// Company Products
CompanyProducts []*CompanyProduct `json:"CompanyProducts"`
// Company Services
CompanyServices []*CompanyService `json:"CompanyServices"`
// Company Crunchbase URL
CrunchbaseURL *string `json:"CrunchbaseURL,omitempty"`
@ -104,9 +101,6 @@ type Company struct {
// Industry
Industry *string `json:"Industry,omitempty"`
// Similar Companies
IndustryCompanies []*IndustryCompany `json:"IndustryCompanies"`
// Company LinkedIn URL
LinkedIn *string `json:"LinkedIn,omitempty"`
@ -140,12 +134,18 @@ type Company struct {
// Phone
Phone *string `json:"Phone,omitempty"`
// Company Products
Products []*Product `json:"Products"`
// Publish this record?
Publish *bool `json:"Publish,omitempty"`
// A Salesforce-First company?
SalesforceFirst *bool `json:"SalesforceFirst,omitempty"`
// Company Services
Services []*Service `json:"Services"`
// Slug
Slug *string `json:"Slug,omitempty"`
@ -172,11 +172,7 @@ type Company struct {
func (m *Company) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCompanyProducts(formats); err != nil {
res = append(res, err)
}
if err := m.validateCompanyServices(formats); err != nil {
if err := m.validateCategories(formats); err != nil {
res = append(res, err)
}
@ -184,11 +180,15 @@ func (m *Company) Validate(formats strfmt.Registry) error {
res = append(res, err)
}
if err := m.validateIndustryCompanies(formats); err != nil {
if err := m.validateListingAddress(formats); err != nil {
res = append(res, err)
}
if err := m.validateListingAddress(formats); err != nil {
if err := m.validateProducts(formats); err != nil {
res = append(res, err)
}
if err := m.validateServices(formats); err != nil {
res = append(res, err)
}
@ -198,48 +198,22 @@ func (m *Company) Validate(formats strfmt.Registry) error {
return nil
}
func (m *Company) validateCompanyProducts(formats strfmt.Registry) error {
if swag.IsZero(m.CompanyProducts) { // not required
func (m *Company) validateCategories(formats strfmt.Registry) error {
if swag.IsZero(m.Categories) { // not required
return nil
}
for i := 0; i < len(m.CompanyProducts); i++ {
if swag.IsZero(m.CompanyProducts[i]) { // not required
for i := 0; i < len(m.Categories); i++ {
if swag.IsZero(m.Categories[i]) { // not required
continue
}
if m.CompanyProducts[i] != nil {
if err := m.CompanyProducts[i].Validate(formats); err != nil {
if m.Categories[i] != nil {
if err := m.Categories[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("CompanyProducts" + "." + strconv.Itoa(i))
return ve.ValidateName("Categories" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("CompanyProducts" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *Company) validateCompanyServices(formats strfmt.Registry) error {
if swag.IsZero(m.CompanyServices) { // not required
return nil
}
for i := 0; i < len(m.CompanyServices); i++ {
if swag.IsZero(m.CompanyServices[i]) { // not required
continue
}
if m.CompanyServices[i] != nil {
if err := m.CompanyServices[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("CompanyServices" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("CompanyServices" + "." + strconv.Itoa(i))
return ce.ValidateName("Categories" + "." + strconv.Itoa(i))
}
return err
}
@ -276,32 +250,6 @@ func (m *Company) validateFinancialStatements(formats strfmt.Registry) error {
return nil
}
func (m *Company) validateIndustryCompanies(formats strfmt.Registry) error {
if swag.IsZero(m.IndustryCompanies) { // not required
return nil
}
for i := 0; i < len(m.IndustryCompanies); i++ {
if swag.IsZero(m.IndustryCompanies[i]) { // not required
continue
}
if m.IndustryCompanies[i] != nil {
if err := m.IndustryCompanies[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("IndustryCompanies" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("IndustryCompanies" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *Company) validateListingAddress(formats strfmt.Registry) error {
if swag.IsZero(m.ListingAddress) { // not required
return nil
@ -321,46 +269,22 @@ func (m *Company) validateListingAddress(formats strfmt.Registry) error {
return nil
}
// ContextValidate validate this company based on the context it is used
func (m *Company) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateCompanyProducts(ctx, formats); err != nil {
res = append(res, err)
func (m *Company) validateProducts(formats strfmt.Registry) error {
if swag.IsZero(m.Products) { // not required
return nil
}
if err := m.contextValidateCompanyServices(ctx, formats); err != nil {
res = append(res, err)
}
for i := 0; i < len(m.Products); i++ {
if swag.IsZero(m.Products[i]) { // not required
continue
}
if err := m.contextValidateFinancialStatements(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateIndustryCompanies(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateListingAddress(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Company) contextValidateCompanyProducts(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.CompanyProducts); i++ {
if m.CompanyProducts[i] != nil {
if err := m.CompanyProducts[i].ContextValidate(ctx, formats); err != nil {
if m.Products[i] != nil {
if err := m.Products[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("CompanyProducts" + "." + strconv.Itoa(i))
return ve.ValidateName("Products" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("CompanyProducts" + "." + strconv.Itoa(i))
return ce.ValidateName("Products" + "." + strconv.Itoa(i))
}
return err
}
@ -371,16 +295,72 @@ func (m *Company) contextValidateCompanyProducts(ctx context.Context, formats st
return nil
}
func (m *Company) contextValidateCompanyServices(ctx context.Context, formats strfmt.Registry) error {
func (m *Company) validateServices(formats strfmt.Registry) error {
if swag.IsZero(m.Services) { // not required
return nil
}
for i := 0; i < len(m.CompanyServices); i++ {
for i := 0; i < len(m.Services); i++ {
if swag.IsZero(m.Services[i]) { // not required
continue
}
if m.CompanyServices[i] != nil {
if err := m.CompanyServices[i].ContextValidate(ctx, formats); err != nil {
if m.Services[i] != nil {
if err := m.Services[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("CompanyServices" + "." + strconv.Itoa(i))
return ve.ValidateName("Services" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("CompanyServices" + "." + strconv.Itoa(i))
return ce.ValidateName("Services" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this company based on the context it is used
func (m *Company) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateCategories(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateFinancialStatements(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateListingAddress(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateProducts(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateServices(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Company) contextValidateCategories(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Categories); i++ {
if m.Categories[i] != nil {
if err := m.Categories[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Categories" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Categories" + "." + strconv.Itoa(i))
}
return err
}
@ -411,26 +391,6 @@ func (m *Company) contextValidateFinancialStatements(ctx context.Context, format
return nil
}
func (m *Company) contextValidateIndustryCompanies(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.IndustryCompanies); i++ {
if m.IndustryCompanies[i] != nil {
if err := m.IndustryCompanies[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("IndustryCompanies" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("IndustryCompanies" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *Company) contextValidateListingAddress(ctx context.Context, formats strfmt.Registry) error {
if m.ListingAddress != nil {
@ -447,6 +407,46 @@ func (m *Company) contextValidateListingAddress(ctx context.Context, formats str
return nil
}
func (m *Company) contextValidateProducts(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Products); i++ {
if m.Products[i] != nil {
if err := m.Products[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Products" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Products" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *Company) contextValidateServices(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Services); i++ {
if m.Services[i] != nil {
if err := m.Services[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Services" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Services" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *Company) MarshalBinary() ([]byte, error) {
if m == nil {

View File

@ -22,52 +22,52 @@ import (
type FinancialStatement struct {
// EDGAR Access Number
AccessNumber string `json:"AccessNumber,omitempty"`
AccessNumber *string `json:"AccessNumber,omitempty"`
// Account ID
AccountID string `json:"AccountID,omitempty"`
AccountID *string `json:"AccountID,omitempty"`
// Cloud Revenue
CloudRevenue float64 `json:"CloudRevenue,omitempty"`
CloudRevenue *float64 `json:"CloudRevenue,omitempty"`
// Created By User ID
CreatedByID string `json:"CreatedByID,omitempty"`
CreatedByID *string `json:"CreatedByID,omitempty"`
// Created Date
CreatedDate string `json:"CreatedDate,omitempty"`
CreatedDate *string `json:"CreatedDate,omitempty"`
// Description
Description string `json:"Description,omitempty"`
Description *string `json:"Description,omitempty"`
// EDGAR URL
EdgarURL string `json:"EdgarURL,omitempty"`
EdgarURL *string `json:"EdgarURL,omitempty"`
// Filing Type
FilingType string `json:"FilingType,omitempty"`
FilingType *string `json:"FilingType,omitempty"`
// Gross Profit
GrossProfit float64 `json:"GrossProfit,omitempty"`
GrossProfit *float64 `json:"GrossProfit,omitempty"`
// Record Id
ID string `json:"ID,omitempty"`
// Last Modified By User ID
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
LastModifiedByID *string `json:"LastModifiedByID,omitempty"`
// Last Modified Date
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
LastModifiedDate *string `json:"LastModifiedDate,omitempty"`
// Net Income
NetIncome float64 `json:"NetIncome,omitempty"`
NetIncome *float64 `json:"NetIncome,omitempty"`
// Period End Date
PeriodEndDate string `json:"PeriodEndDate,omitempty"`
PeriodEndDate *string `json:"PeriodEndDate,omitempty"`
// Total Revenue
TotalRevenue float64 `json:"TotalRevenue,omitempty"`
TotalRevenue *float64 `json:"TotalRevenue,omitempty"`
// Year
Year string `json:"Year,omitempty"`
Year *string `json:"Year,omitempty"`
}
// Validate validates this financial statement

View File

@ -26,9 +26,6 @@ type Industry struct {
// The AccountIDs of the Companies in this Industry
Companies []string `json:"Companies"`
// The list of Products in this industry
CompanyProducts []*CompanyProduct `json:"CompanyProducts"`
// Created By User ID
CreatedByID *string `json:"CreatedByID,omitempty"`
@ -68,6 +65,9 @@ type Industry struct {
// The full path of this industry, including Parent
Path *string `json:"Path,omitempty"`
// The list of Products in this industry
Products []*Product `json:"Products"`
// The CMS Slug for this Industry
Slug *string `json:"Slug,omitempty"`
@ -79,7 +79,7 @@ type Industry struct {
func (m *Industry) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCompanyProducts(formats); err != nil {
if err := m.validateProducts(formats); err != nil {
res = append(res, err)
}
@ -89,22 +89,22 @@ func (m *Industry) Validate(formats strfmt.Registry) error {
return nil
}
func (m *Industry) validateCompanyProducts(formats strfmt.Registry) error {
if swag.IsZero(m.CompanyProducts) { // not required
func (m *Industry) validateProducts(formats strfmt.Registry) error {
if swag.IsZero(m.Products) { // not required
return nil
}
for i := 0; i < len(m.CompanyProducts); i++ {
if swag.IsZero(m.CompanyProducts[i]) { // not required
for i := 0; i < len(m.Products); i++ {
if swag.IsZero(m.Products[i]) { // not required
continue
}
if m.CompanyProducts[i] != nil {
if err := m.CompanyProducts[i].Validate(formats); err != nil {
if m.Products[i] != nil {
if err := m.Products[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("CompanyProducts" + "." + strconv.Itoa(i))
return ve.ValidateName("Products" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("CompanyProducts" + "." + strconv.Itoa(i))
return ce.ValidateName("Products" + "." + strconv.Itoa(i))
}
return err
}
@ -119,7 +119,7 @@ func (m *Industry) validateCompanyProducts(formats strfmt.Registry) error {
func (m *Industry) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateCompanyProducts(ctx, formats); err != nil {
if err := m.contextValidateProducts(ctx, formats); err != nil {
res = append(res, err)
}
@ -129,16 +129,16 @@ func (m *Industry) ContextValidate(ctx context.Context, formats strfmt.Registry)
return nil
}
func (m *Industry) contextValidateCompanyProducts(ctx context.Context, formats strfmt.Registry) error {
func (m *Industry) contextValidateProducts(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.CompanyProducts); i++ {
for i := 0; i < len(m.Products); i++ {
if m.CompanyProducts[i] != nil {
if err := m.CompanyProducts[i].ContextValidate(ctx, formats); err != nil {
if m.Products[i] != nil {
if err := m.Products[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("CompanyProducts" + "." + strconv.Itoa(i))
return ve.ValidateName("Products" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("CompanyProducts" + "." + strconv.Itoa(i))
return ce.ValidateName("Products" + "." + strconv.Itoa(i))
}
return err
}

View File

@ -1,87 +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 plex_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// IndustryCompany Junction object between Industry and Company
//
// swagger:model IndustryCompany
type IndustryCompany struct {
// company ID
CompanyID string `json:"CompanyID,omitempty"`
// company name
CompanyName string `json:"CompanyName,omitempty"`
// company slug
CompanySlug string `json:"CompanySlug,omitempty"`
// company website
CompanyWebsite string `json:"CompanyWebsite,omitempty"`
// Record Id
ID string `json:"ID,omitempty"`
// industry ID
IndustryID string `json:"IndustryID,omitempty"`
// industry name
IndustryName string `json:"IndustryName,omitempty"`
// industry slug
IndustrySlug string `json:"IndustrySlug,omitempty"`
// industry tag line
IndustryTagLine string `json:"IndustryTagLine,omitempty"`
// Last Modified By User ID
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
// Last Modified Date
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
// path
Path string `json:"Path,omitempty"`
}
// Validate validates this industry company
func (m *IndustryCompany) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this industry company based on context it is used
func (m *IndustryCompany) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *IndustryCompany) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *IndustryCompany) UnmarshalBinary(b []byte) error {
var res IndustryCompany
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@ -18,10 +18,10 @@ import (
"github.com/go-openapi/swag"
)
// CompanyProduct A software product or service vended by a Company
// Product A software product or service vended by a Company
//
// swagger:model CompanyProduct
type CompanyProduct struct {
// swagger:model Product
type Product struct {
// ID of the Company that owns this Product
AccountID *string `json:"AccountID,omitempty"`
@ -84,8 +84,8 @@ type CompanyProduct struct {
URL *string `json:"URL,omitempty"`
}
// Validate validates this company product
func (m *CompanyProduct) Validate(formats strfmt.Registry) error {
// Validate validates this product
func (m *Product) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateIndustries(formats); err != nil {
@ -98,7 +98,7 @@ func (m *CompanyProduct) Validate(formats strfmt.Registry) error {
return nil
}
func (m *CompanyProduct) validateIndustries(formats strfmt.Registry) error {
func (m *Product) validateIndustries(formats strfmt.Registry) error {
if swag.IsZero(m.Industries) { // not required
return nil
}
@ -124,8 +124,8 @@ func (m *CompanyProduct) validateIndustries(formats strfmt.Registry) error {
return nil
}
// ContextValidate validate this company product based on the context it is used
func (m *CompanyProduct) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
// ContextValidate validate this product based on the context it is used
func (m *Product) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateIndustries(ctx, formats); err != nil {
@ -138,7 +138,7 @@ func (m *CompanyProduct) ContextValidate(ctx context.Context, formats strfmt.Reg
return nil
}
func (m *CompanyProduct) contextValidateIndustries(ctx context.Context, formats strfmt.Registry) error {
func (m *Product) contextValidateIndustries(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Industries); i++ {
@ -159,7 +159,7 @@ func (m *CompanyProduct) contextValidateIndustries(ctx context.Context, formats
}
// MarshalBinary interface implementation
func (m *CompanyProduct) MarshalBinary() ([]byte, error) {
func (m *Product) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
@ -167,8 +167,8 @@ func (m *CompanyProduct) MarshalBinary() ([]byte, error) {
}
// UnmarshalBinary interface implementation
func (m *CompanyProduct) UnmarshalBinary(b []byte) error {
var res CompanyProduct
func (m *Product) UnmarshalBinary(b []byte) error {
var res Product
if err := swag.ReadJSON(b, &res); err != nil {
return err
}

View File

@ -18,10 +18,10 @@ import (
"github.com/go-openapi/swag"
)
// CompanyService A service performed by a Company
// Service A service performed by a Company
//
// swagger:model CompanyService
type CompanyService struct {
// swagger:model Service
type Service struct {
// ID of the Company that owns this Service
AccountID *string `json:"AccountID,omitempty"`
@ -84,8 +84,8 @@ type CompanyService struct {
URL *string `json:"URL,omitempty"`
}
// Validate validates this company service
func (m *CompanyService) Validate(formats strfmt.Registry) error {
// Validate validates this service
func (m *Service) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateIndustries(formats); err != nil {
@ -98,7 +98,7 @@ func (m *CompanyService) Validate(formats strfmt.Registry) error {
return nil
}
func (m *CompanyService) validateIndustries(formats strfmt.Registry) error {
func (m *Service) validateIndustries(formats strfmt.Registry) error {
if swag.IsZero(m.Industries) { // not required
return nil
}
@ -124,8 +124,8 @@ func (m *CompanyService) validateIndustries(formats strfmt.Registry) error {
return nil
}
// ContextValidate validate this company service based on the context it is used
func (m *CompanyService) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
// ContextValidate validate this service based on the context it is used
func (m *Service) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateIndustries(ctx, formats); err != nil {
@ -138,7 +138,7 @@ func (m *CompanyService) ContextValidate(ctx context.Context, formats strfmt.Reg
return nil
}
func (m *CompanyService) contextValidateIndustries(ctx context.Context, formats strfmt.Registry) error {
func (m *Service) contextValidateIndustries(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Industries); i++ {
@ -159,7 +159,7 @@ func (m *CompanyService) contextValidateIndustries(ctx context.Context, formats
}
// MarshalBinary interface implementation
func (m *CompanyService) MarshalBinary() ([]byte, error) {
func (m *Service) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
@ -167,8 +167,8 @@ func (m *CompanyService) MarshalBinary() ([]byte, error) {
}
// UnmarshalBinary interface implementation
func (m *CompanyService) UnmarshalBinary(b []byte) error {
var res CompanyService
func (m *Service) UnmarshalBinary(b []byte) error {
var res Service
if err := swag.ReadJSON(b, &res); err != nil {
return err
}

View File

@ -0,0 +1,12 @@
Credentials:
type: object
required: [email, password]
properties:
email:
type: string
format: email
example: user@example.com
password:
type: string
minLength: 12
example: "p@55w0rd-example"

View File

@ -1,5 +1,8 @@
User:
properties:
ID:
description: Record ID
type: string
APIGatewayURL:
description: API Gateway URL
type: string
@ -21,7 +24,7 @@ User:
type: string
x-nullable: true
Address:
$ref: "./address.yaml#/Address"
$ref: ./address.yaml#/Address
x-nullable: true
Alias:
description: Alias
@ -83,6 +86,10 @@ User:
description: Extension
type: string
x-nullable: true
ExternalAccount:
description: Account
type: string
x-nullable: true
Fax:
description: Fax
type: string
@ -103,9 +110,6 @@ User:
description: GitHub
type: string
x-nullable: true
ID:
description: Record ID
type: string
IsActive:
description: Active
type: boolean
@ -198,17 +202,13 @@ User:
description: Onboarding Status
type: string
x-nullable: true
ExternalAccount:
description: Account
type: string
x-nullable: true
TenantID:
description: Tenant ID associated with this user
type: string
x-nullable: true
TenantUsers:
items:
$ref: "./tenant-user.yaml#/TenantUser"
$ref: ./tenant-user.yaml#/TenantUser
type: array
x-nullable: true
TimeZone:
@ -229,7 +229,7 @@ User:
x-nullable: true
UserRoles:
items:
$ref: "./user-role.yaml#/UserRole"
$ref: ./user-role.yaml#/UserRole
type: array
x-nullable: true
UserType:

View File

@ -13,6 +13,13 @@ securityDefinitions:
type: "apiKey"
in: "header"
name: "X-API-Key"
kvSessionCookie:
type: apiKey
in: header
name: Cookie
description: >
Include a Cookie header containing kvSession=<JWT>. Example:
Cookie: kvSession=eyJhbGciOiJFZERTQSJ9...
schemes:
- "https"
basePath: "/vk/members/v1"
@ -527,6 +534,77 @@ responses:
schema:
$ref: "#/definitions/WebhookClerkResponse"
paths:
/sessions:
post:
tags: [sessions]
summary: Create new session (sign-in)
operationId: createSession
parameters:
- in: body
name: credentials
required: true
schema:
$ref: "../../lib/swagger/defs/credentials.yaml#/Credentials"
responses:
200:
description: Successful sign-in
headers:
Set-Cookie:
type: string
description: |
kvSession=<jwt>; HttpOnly; Secure; SameSite=None; Domain=.keenanvision.net; Path=/; Max-Age=5400
schema:
$ref: "#/responses/UserResponse"
401:
$ref: "#/responses/Unauthorized"
429:
$ref: "#/responses/ServerError"
/sessions/refresh:
post:
tags: [sessions]
summary: Refresh session cookie
operationId: refreshSession
security:
- kvSessionCookie: []
responses:
200:
description: Token refreshed
headers:
Set-Cookie:
type: string
description: New kvSession cookie with updated expiry
401:
$ref: "#/responses/Unauthorized"
/sessions/current:
delete:
tags: [sessions]
summary: Delete current session (log out)
operationId: deleteSession
security:
- kvSessionCookie: []
responses:
204:
description: Logged out; kvSession cookie cleared
401:
$ref: "#/responses/Unauthorized"
/sessions/me:
get:
tags: [sessions]
summary: Get current user
operationId: getMe
security:
- kvSessionCookie: []
responses:
200:
description: Current user profile
schema:
$ref: "#/responses/UserResponse"
401:
$ref: "#/responses/Unauthorized"
/attendees:
get:
description: Return a list of Attendee records from the datastore

View File

@ -34,6 +34,12 @@ parameters:
name: companyId
required: false
type: string
ChannelQuery:
description: The channel to filter companies by
in: query
name: channel
required: false
type: string
limitQuery:
description: "How many objects to return at one time"
format: int64
@ -91,6 +97,7 @@ paths:
parameters:
- $ref: "#/parameters/CompanyIdQuery"
- $ref: "#/parameters/slugQuery"
- $ref: "#/parameters/ChannelQuery"
responses:
"200":
$ref: "#/responses/CompanyResponse"
@ -315,30 +322,30 @@ definitions:
x-nullable: true
description: Year Started
type: string
CompanyProducts:
Products:
description: Company Products
x-nullable: true
type: array
items:
$ref: "#/definitions/CompanyProduct"
CompanyServices:
$ref: "#/definitions/Product"
Services:
description: Company Services
x-nullable: true
type: array
items:
$ref: "#/definitions/CompanyService"
$ref: "#/definitions/Service"
FinancialStatements:
description: Financial Statements
x-nullable: true
type: array
items:
$ref: "#/definitions/FinancialStatement"
IndustryCompanies:
description: Similar Companies
Categories:
description: Company Categories
x-nullable: true
type: array
items:
$ref: "#/definitions/IndustryCompany"
$ref: "#/definitions/Category"
type: object
FinancialStatement:
type: object
@ -348,51 +355,66 @@ definitions:
description: Record Id
type: string
AccessNumber:
x-nullable: true
description: EDGAR Access Number
type: string
AccountID:
x-nullable: true
description: Account ID
type: string
CloudRevenue:
x-nullable: true
description: Cloud Revenue
type: number
CreatedByID:
x-nullable: true
description: Created By User ID
type: string
CreatedDate:
x-nullable: true
description: Created Date
type: string
Description:
x-nullable: true
description: Description
type: string
EdgarURL:
x-nullable: true
description: EDGAR URL
type: string
FilingType:
x-nullable: true
description: Filing Type
type: string
GrossProfit:
x-nullable: true
description: Gross Profit
type: number
LastModifiedByID:
x-nullable: true
description: Last Modified By User ID
type: string
LastModifiedDate:
x-nullable: true
description: Last Modified Date
type: string
NetIncome:
x-nullable: true
description: Net Income
type: number
PeriodEndDate:
x-nullable: true
description: Period End Date
type: string
TotalRevenue:
x-nullable: true
description: Total Revenue
type: number
Year:
x-nullable: true
description: Year
type: string
CompanyProduct:
Product:
description: A software product or service vended by a Company
properties:
ID:
@ -477,7 +499,7 @@ definitions:
description: Website
type: string
type: object
CompanyService:
Service:
description: A service performed by a Company
properties:
ID:
@ -575,12 +597,12 @@ definitions:
type: array
items:
type: string
CompanyProducts:
Products:
x-nullable: true
description: The list of Products in this industry
type: array
items:
$ref: "#/definitions/CompanyProduct"
$ref: "#/definitions/Product"
CreatedByID:
x-nullable: true
description: Created By User ID
@ -638,35 +660,55 @@ definitions:
description: TagLine
type: string
type: object
IndustryCompany:
Category:
description: Junction object between Industry and Company
properties:
ID:
description: Record Id
type: string
CompanyID:
x-nullable: true
description: ID of the Company that owns this Category
type: string
CompanyName:
x-nullable: true
description: Name of the Company
type: string
CompanySlug:
x-nullable: true
description: Slug of the Company
type: string
CompanyWebsite:
CompanyTagLine:
x-nullable: true
description: TagLine of the Company
type: string
IndustryID:
x-nullable: true
description: ID of the Industry that owns this Category
type: string
IndustryName:
x-nullable: true
description: Name of the Industry
type: string
IndustrySlug:
x-nullable: true
description: Slug of the Industry
type: string
IndustryTagLine:
x-nullable: true
description: TagLine of the Industry
type: string
LastModifiedByID:
description: Last Modified By User ID
CreatedByID:
x-nullable: true
description: Created By User ID
type: string
LastModifiedDate:
description: Last Modified Date
CreatedByDate:
x-nullable: true
description: Created Date
type: string
Path:
x-nullable: true
description: The full path of this category, including Parent
type: string
type: object
CompanyRequest:

View File

@ -13,6 +13,13 @@ securityDefinitions:
type: "apiKey"
in: "header"
name: "X-API-Key"
kvSessionCookie:
type: apiKey
in: header
name: Cookie
description: >
Include a Cookie header containing kvSession=<JWT>. Example:
Cookie: kvSession=eyJhbGciOiJFZERTQSJ9...
schemes:
- "http"
basePath: "/v1"
@ -527,6 +534,77 @@ responses:
schema:
$ref: "#/definitions/WebhookClerkResponse"
paths:
/sessions:
post:
tags: [sessions]
summary: Create new session (sign-in)
operationId: createSession
parameters:
- in: body
name: credentials
required: true
schema:
$ref: "../../lib/swagger/defs/credentials.yaml#/Credentials"
responses:
200:
description: Successful sign-in
headers:
Set-Cookie:
type: string
description: |
kvSession=<jwt>; HttpOnly; Secure; SameSite=None; Domain=.keenanvision.net; Path=/; Max-Age=5400
schema:
$ref: "#/responses/UserResponse"
401:
$ref: "#/responses/Unauthorized"
429:
$ref: "#/responses/ServerError"
/sessions/refresh:
post:
tags: [sessions]
summary: Refresh session cookie
operationId: refreshSession
security:
- kvSessionCookie: []
responses:
200:
description: Token refreshed
headers:
Set-Cookie:
type: string
description: New kvSession cookie with updated expiry
401:
$ref: "#/responses/Unauthorized"
/sessions/current:
delete:
tags: [sessions]
summary: Delete current session (log out)
operationId: deleteSession
security:
- kvSessionCookie: []
responses:
204:
description: Logged out; kvSession cookie cleared
401:
$ref: "#/responses/Unauthorized"
/sessions/me:
get:
tags: [sessions]
summary: Get current user
operationId: getMe
security:
- kvSessionCookie: []
responses:
200:
description: Current user profile
schema:
$ref: "#/responses/UserResponse"
401:
$ref: "#/responses/Unauthorized"
/attendees:
get:
description: Return a list of Attendee records from the datastore

View File

@ -34,6 +34,12 @@ parameters:
name: companyId
required: false
type: string
ChannelQuery:
description: The channel to filter companies by
in: query
name: channel
required: false
type: string
limitQuery:
description: "How many objects to return at one time"
format: int64
@ -91,6 +97,7 @@ paths:
parameters:
- $ref: "#/parameters/CompanyIdQuery"
- $ref: "#/parameters/slugQuery"
- $ref: "#/parameters/ChannelQuery"
responses:
"200":
$ref: "#/responses/CompanyResponse"
@ -315,30 +322,30 @@ definitions:
x-nullable: true
description: Year Started
type: string
CompanyProducts:
Products:
description: Company Products
x-nullable: true
type: array
items:
$ref: "#/definitions/CompanyProduct"
CompanyServices:
$ref: "#/definitions/Product"
Services:
description: Company Services
x-nullable: true
type: array
items:
$ref: "#/definitions/CompanyService"
$ref: "#/definitions/Service"
FinancialStatements:
description: Financial Statements
x-nullable: true
type: array
items:
$ref: "#/definitions/FinancialStatement"
IndustryCompanies:
description: Similar Companies
Categories:
description: Company Categories
x-nullable: true
type: array
items:
$ref: "#/definitions/IndustryCompany"
$ref: "#/definitions/Category"
type: object
FinancialStatement:
type: object
@ -348,51 +355,66 @@ definitions:
description: Record Id
type: string
AccessNumber:
x-nullable: true
description: EDGAR Access Number
type: string
AccountID:
x-nullable: true
description: Account ID
type: string
CloudRevenue:
x-nullable: true
description: Cloud Revenue
type: number
CreatedByID:
x-nullable: true
description: Created By User ID
type: string
CreatedDate:
x-nullable: true
description: Created Date
type: string
Description:
x-nullable: true
description: Description
type: string
EdgarURL:
x-nullable: true
description: EDGAR URL
type: string
FilingType:
x-nullable: true
description: Filing Type
type: string
GrossProfit:
x-nullable: true
description: Gross Profit
type: number
LastModifiedByID:
x-nullable: true
description: Last Modified By User ID
type: string
LastModifiedDate:
x-nullable: true
description: Last Modified Date
type: string
NetIncome:
x-nullable: true
description: Net Income
type: number
PeriodEndDate:
x-nullable: true
description: Period End Date
type: string
TotalRevenue:
x-nullable: true
description: Total Revenue
type: number
Year:
x-nullable: true
description: Year
type: string
CompanyProduct:
Product:
description: A software product or service vended by a Company
properties:
ID:
@ -477,7 +499,7 @@ definitions:
description: Website
type: string
type: object
CompanyService:
Service:
description: A service performed by a Company
properties:
ID:
@ -575,12 +597,12 @@ definitions:
type: array
items:
type: string
CompanyProducts:
Products:
x-nullable: true
description: The list of Products in this industry
type: array
items:
$ref: "#/definitions/CompanyProduct"
$ref: "#/definitions/Product"
CreatedByID:
x-nullable: true
description: Created By User ID
@ -638,35 +660,55 @@ definitions:
description: TagLine
type: string
type: object
IndustryCompany:
Category:
description: Junction object between Industry and Company
properties:
ID:
description: Record Id
type: string
CompanyID:
x-nullable: true
description: ID of the Company that owns this Category
type: string
CompanyName:
x-nullable: true
description: Name of the Company
type: string
CompanySlug:
x-nullable: true
description: Slug of the Company
type: string
CompanyWebsite:
CompanyTagLine:
x-nullable: true
description: TagLine of the Company
type: string
IndustryID:
x-nullable: true
description: ID of the Industry that owns this Category
type: string
IndustryName:
x-nullable: true
description: Name of the Industry
type: string
IndustrySlug:
x-nullable: true
description: Slug of the Industry
type: string
IndustryTagLine:
x-nullable: true
description: TagLine of the Industry
type: string
LastModifiedByID:
description: Last Modified By User ID
CreatedByID:
x-nullable: true
description: Created By User ID
type: string
LastModifiedDate:
description: Last Modified Date
CreatedByDate:
x-nullable: true
description: Created Date
type: string
Path:
x-nullable: true
description: The full path of this category, including Parent
type: string
type: object
CompanyRequest: