models

package
v0.10.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package models provides http request and response structs

Index

Constants

View Source
const (
	// DefaultRevision is the default revision to be used for new records
	DefaultRevision = "v0.0.1"
)

Variables

View Source
var (
	ErrUnsupportedDateTimeType = errors.New("unsupported time format")
	ErrInvalidTimeType         = errors.New("invalid date format, expected YYYY-MM-DD or full ISO8601")
)
View Source
var (
	ErrUnsupportedDataType = errors.New("unsupported aaguid format")
)
View Source
var ExampleAccountAccessReply = AccountAccessReply{
	Reply:   rout.Reply{Success: true},
	Allowed: true,
}

ExampleAccountAccessReply is an example of a successful `/account/access` response for OpenAPI documentation

View Source
var ExampleAccountAccessRequest = AccountAccessRequest{
	Relation:   "can_view",
	ObjectType: "organization",
	ObjectID:   "01J4EXD5MM60CX4YNYN0DEE3Y1",
}

ExampleAccountAccessRequest is an example of a successful `/account/access` request for OpenAPI documentation

View Source
var ExampleAccountRolesOrganizationReply = AccountRolesOrganizationReply{
	Reply:          rout.Reply{Success: true},
	Roles:          []string{"can_view", "can_edit", "audit_log_viewer"},
	OrganizationID: "01J4HMNDSZCCQBTY93BF9CBF5D",
}

ExampleAccountRolesOrganizationReply is an example of a successful `/account/roles/organization` response for OpenAPI documentation

View Source
var ExampleAccountRolesOrganizationRequest = AccountRolesOrganizationRequest{
	ID: "01J4HMNDSZCCQBTY93BF9CBF5D",
}

ExampleAccountRolesOrganizationRequest is an example of a successful `/account/roles/organization` request for OpenAPI documentation

View Source
var ExampleAccountRolesReply = AccountRolesReply{
	Reply: rout.Reply{Success: true},
	Roles: []string{"can_view", "can_edit", "audit_log_viewer"},
}

ExampleAccountRolesReply is an example of a successful `/account/roles` response for OpenAPI documentation

View Source
var ExampleAccountRolesRequest = AccountRolesRequest{
	ObjectType: "organization",
	ObjectID:   "01J4EXD5MM60CX4YNYN0DEE3Y1",
}

ExampleAccountRolesRequest is an example of a successful `/account/roles` request for OpenAPI documentation

View Source
var ExampleAvailableAuthTypeRequest = LoginRequest{
	Username: "sfunky@theopenlane.io",
}

ExampleAvailableAuthTypeRequest is an example of a successful available auth type check for OpenAPI documentation

View Source
var ExampleAvailableAuthTypeSuccessResponse = AvailableAuthTypeReply{
	Reply: rout.Reply{
		Success: true,
	},
	Methods: []enums.AuthProvider{
		enums.AuthProviderCredentials,
		enums.AuthProviderWebauthn,
	},
}

ExampleAvailableAuthTypeSuccessResponse is an example of a successful available auth methods check response for OpenAPI documentation

View Source
var ExampleExampleCSVRequest = ExampleCSVRequest{
	Filename: "actionplan",
}

ExampleLoginSuccessRequest is an example of a successful tfa validation request for OpenAPI documentation

View Source
var ExampleForgotPasswordSuccessRequest = ForgotPasswordRequest{
	Email: "example@theopenlane.io",
}

ExampleForgotPasswordSuccessRequest is an example of a successful forgot password request for OpenAPI documentation

View Source
var ExampleForgotPasswordSuccessResponse = ForgotPasswordReply{
	Reply: rout.Reply{
		Success: true,
	},
	Message: "We've received your request to have the password associated with this email reset. Please check your email.",
}

ExampleForgotPasswordSuccessResponse is an example of a successful forgot password response for OpenAPI documentation

View Source
var ExampleInviteRequest = InviteRequest{
	Token: "token",
}

ExampleInviteRequest is an example of a successful invite request for OpenAPI documentation

View Source
var ExampleInviteResponse = InviteReply{
	Reply:       rout.Reply{Success: true},
	ID:          "1234",
	Email:       "",
	JoinedOrgID: "1234",
	Role:        "admin",
	Message:     "Welcome to your new organization!",
	AuthData: AuthData{
		AccessToken:  "access_token",
		RefreshToken: "refresh_token",
		Session:      "session",
		TokenType:    "bearer",
	},
}

ExampleInviteResponse is an example of a successful invite response for OpenAPI documentation

View Source
var ExampleLoginSuccessRequest = LoginRequest{
	Username: "sfunky@theopenlane.io",
	Password: "mitb!",
}

ExampleLoginSuccessRequest is an example of a successful login request for OpenAPI documentation

View Source
var ExampleLoginSuccessResponse = LoginReply{
	Reply: rout.Reply{
		Success: true,
	},
	TFAEnabled: true,
	AuthData: AuthData{
		AccessToken:  "access_token",
		RefreshToken: "refresh_token",
		Session:      "session",
		TokenType:    "bearer",
	},
}

ExampleLoginSuccessResponse is an example of a successful login response for OpenAPI documentation

View Source
var ExampleRefreshRequest = RefreshRequest{
	RefreshToken: "token",
}

ExampleRefreshRequest is an example of a successful refresh request for OpenAPI documentation

View Source
var ExampleRefreshSuccessResponse = RefreshReply{
	Reply:   rout.Reply{Success: true},
	Message: "success",
	AuthData: AuthData{
		AccessToken:  "access_token",
		RefreshToken: "refresh_token",
		Session:      "session",
		TokenType:    "bearer",
	},
}

ExampleRefreshSuccessResponse is an example of a successful refresh response for OpenAPI documentation

View Source
var ExampleRegisterSuccessRequest = RegisterRequest{
	FirstName: "Sarah",
	LastName:  "Funk",
	Email:     "sfunky@theopenlane.io",
	Password:  "mitb!",
}

ExampleRegisterSuccessRequest is an example of a successful register request for OpenAPI documentation

View Source
var ExampleRegisterSuccessResponse = RegisterReply{
	Reply:   rout.Reply{Success: true},
	ID:      "1234",
	Email:   "",
	Message: "Welcome to Openlane!",
}

ExampleRegisterSuccessResponse is an example of a successful register response for OpenAPI documentation

View Source
var ExampleResendEmailSuccessRequest = ResendRequest{
	Email: "cercei.lannister@theopenlane.io",
}

ExampleResendEmailSuccessRequest is an example of a successful resend email request for OpenAPI documentation

View Source
var ExampleResendEmailSuccessResponse = ResendReply{
	Reply: rout.Reply{
		Success: true,
	},
	Message: "Email has been resent",
}

ExampleResendEmailSuccessResponse is an example of a successful resend email response for OpenAPI documentation

View Source
var ExampleResetPasswordSuccessRequest = ResetPasswordRequest{
	Password: "mitb!",
	Token:    "token",
}

ExampleResetPasswordSuccessRequest is an example of a successful reset password request for OpenAPI documentation

View Source
var ExampleResetPasswordSuccessResponse = ResetPasswordReply{
	Reply: rout.Reply{
		Success: true,
	},
	Message: "Password has been reset",
}

ExampleResetPasswordSuccessResponse is an example of a successful reset password response for OpenAPI documentation

View Source
var ExampleSwitchSuccessReply = SwitchOrganizationReply{
	Reply: rout.Reply{
		Success: true,
	},
	AuthData: AuthData{
		AccessToken:  "access_token",
		RefreshToken: "refresh_token",
		Session:      "session",
		TokenType:    "bearer",
	},
}

ExampleSwitchSuccessReply is an example of a successful switch organization response for OpenAPI documentation

View Source
var ExampleSwitchSuccessRequest = SwitchOrganizationRequest{
	TargetOrganizationID: ulids.New().String(),
}

ExampleSwitchSuccessRequest is an example of a successful switch organization request for OpenAPI documentation

View Source
var ExampleTFASSuccessResponse = TFAReply{
	Reply: rout.Reply{
		Success: true,
	},
}

ExampleLoginSuccessResponse is an example of a successful tfa validation response for OpenAPI documentation

View Source
var ExampleTFASuccessRequest = TFARequest{
	TOTPCode: "113371",
}

ExampleLoginSuccessRequest is an example of a successful tfa validation request for OpenAPI documentation

View Source
var ExampleUploadFileRequest = UploadFilesRequest{
	UploadFile: multipart.FileHeader{
		Filename: "file.txt",
		Size:     1024,
		Header: textproto.MIMEHeader{
			"Content-Type": []string{"text/plain"},
		},
	},
}

ExampleUploadFileRequest is an example of a successful upload request for OpenAPI documentation

View Source
var ExampleUploadFilesSuccessResponse = UploadFilesReply{
	Reply: rout.Reply{
		Success: true,
	},
	Message:   "file(s) uploaded successfully",
	FileCount: 1,
	Files: []File{
		{
			ID:           "1234",
			Name:         "file.txt",
			Size:         1024,
			MimeType:     "text/plain",
			ContentType:  "text/plain",
			PresignedURL: "https://example.com/file.txt",
			MD5:          []byte("1234"),
			CreatedAt:    time.Now(),
			UpdatedAt:    time.Now(),
		},
	},
}

ExampleUploadFilesSuccessResponse is an example of a successful upload response for OpenAPI documentation

View Source
var ExampleVerifySubscriptionResponse = VerifySubscribeReply{
	Reply:   rout.Reply{Success: true},
	Message: "Subscription confirmed, looking forward to sending you updates!",
}

ExampleVerifySubscriptionResponse is an example of a successful verify subscription response for OpenAPI documentation

View Source
var ExampleVerifySubscriptionSuccessRequest = VerifySubscribeRequest{
	Token: "token",
}

ExampleVerifySubscriptionSuccessRequest is an example of a successful verify subscription request for OpenAPI documentation

View Source
var ExampleVerifySuccessRequest = VerifyRequest{
	Token: "token",
}

ExampleVerifySuccessRequest is an example of a successful verify request for OpenAPI documentation

View Source
var ExampleVerifySuccessResponse = VerifyReply{
	Reply: rout.Reply{
		Success: true,
	},
	ID:      ulids.New().String(),
	Email:   "gregor.clegane@theopenlane.io",
	Message: "Email has been verified",
	AuthData: AuthData{
		AccessToken:  "access_token",
		RefreshToken: "refresh_token",
		Session:      "session",
		TokenType:    "bearer",
	},
}

ExampleVerifySuccessResponse is an example of a successful verify response for OpenAPI documentation

View Source
var ExampleWebauthnBeginRegistrationRequest = WebauthnRegistrationRequest{
	Email: "sarahisthebest@sarahsthebest.com",
	Name:  "Sarah Funk",
}
View Source
var ExampleWebauthnBeginRegistrationResponse = WebauthnBeginRegistrationResponse{
	Reply: rout.Reply{Success: true},
	CredentialCreation: &protocol.CredentialCreation{
		Response: protocol.PublicKeyCredentialCreationOptions{
			RelyingParty: protocol.RelyingPartyEntity{},
			User:         protocol.UserEntity{},
			Challenge:    protocol.URLEncodedBase64{},
		}},
	Session: "session",
}

Functions

func BumpMajor added in v0.7.5

func BumpMajor(v string) (string, error)

BumpMajor increments the major version by 1 It resets the minor and patch versions to 0 For example if the version is v1.7.1 the new version will be v2.0.0 It resets the pre-release version to empty

func BumpMinor added in v0.7.5

func BumpMinor(v string) (string, error)

BumpMinor increments the minor version by 1 It resets the patch version to 0 For example if the version is v1.7.1 the new version will be v1.8.0 It resets the pre-release version to empty

func BumpPatch added in v0.7.5

func BumpPatch(v string) (string, error)

BumpPatch increments the patch version by 1 For example if the version is v1.7.1 the new version will be v1.7.2 If the version has a pre-release version, it clears the pre-release version

func SetPreRelease added in v0.7.5

func SetPreRelease(v string) (string, error)

SetPreRelease sets the pre-release version to "draft" For example if the version is v1.7.1 the new version will be v1.7.2-draft

func WithVersionBumpContext added in v0.7.5

func WithVersionBumpContext(ctx context.Context, v *VersionBump) context.Context

WithVersionBumpContext adds the VersionBump to the context

func WithVersionBumpRequestContext added in v0.7.5

func WithVersionBumpRequestContext(ctx context.Context, v *VersionBump)

WithVersionBumpContext adds the VersionBump to the context

Types

type AAGUID added in v0.10.9

type AAGUID []byte

AAGUID is a custom type representing an authenticator attestation uuid.

func ToAAGUID added in v0.10.9

func ToAAGUID(b []byte) *AAGUID

func (AAGUID) MarshalGQL added in v0.10.9

func (a AAGUID) MarshalGQL(w io.Writer)

func (*AAGUID) Scan added in v0.10.9

func (a *AAGUID) Scan(value interface{}) error

func (AAGUID) String added in v0.10.9

func (a AAGUID) String() string

func (*AAGUID) UnmarshalGQL added in v0.10.9

func (a *AAGUID) UnmarshalGQL(v any) error

func (AAGUID) Value added in v0.10.9

func (a AAGUID) Value() (driver.Value, error)

type AccountAccessReply

type AccountAccessReply struct {
	rout.Reply
	Allowed bool `json:"allowed"`
}

AccountAccessReply holds the fields that are sent on a response to the `/account/access` endpoint

type AccountAccessRequest

type AccountAccessRequest struct {
	ObjectID    string `json:"objectId" description:"The ID of the object to check access for" example:"01J4EXD5MM60CX4YNYN0DEE3Y1"`
	ObjectType  string `` /* 137-byte string literal not displayed */
	Relation    string `json:"relation" description:"The relation to check access for, e.g. can_view, can_edit" example:"can_view"`
	SubjectType string `json:"subjectType,omitempty" description:"The type of subject to check access for, e.g. service, user" example:"user"`
}

AccountAccessRequest holds the fields that should be included on a request to the `/account/access` endpoint

func (*AccountAccessRequest) Validate

func (r *AccountAccessRequest) Validate() error

Validate ensures the required fields are set on the AccountAccessRequest

type AccountRolesOrganizationReply

type AccountRolesOrganizationReply struct {
	rout.Reply
	Roles          []string `json:"roles" description:"The roles the user has in the organization, e.g. can_view, can_edit" example:"can_view, can_edit"`
	OrganizationID string   `json:"organization_id" description:"The ID of the organization the user has roles in" example:"01J4HMNDSZCCQBTY93BF9CBF5D"`
}

AccountRolesOrganizationReply holds the fields that are sent on a response to the `/account/roles/organization` endpoint

type AccountRolesOrganizationRequest

type AccountRolesOrganizationRequest struct {
	ID string `param:"id" description:"The ID of the organization to check roles for" example:"01J4HMNDSZCCQBTY93BF9CBF5D"`
}

AccountRolesOrganizationRequest holds the fields that should be included on a request to the `/account/roles/organization` endpoint

func (*AccountRolesOrganizationRequest) Validate

func (r *AccountRolesOrganizationRequest) Validate() error

Validate ensures the required fields are set on the AccountAccessRequest

type AccountRolesReply

type AccountRolesReply struct {
	rout.Reply
	Roles []string `json:"roles"`
}

AccountRolesReply holds the fields that are sent on a response to the `/account/roles` endpoint

type AccountRolesRequest

type AccountRolesRequest struct {
	ObjectID    string   `json:"objectId" description:"The ID of the object to check roles for" example:"01J4EXD5MM60CX4YNYN0DEE3Y1"`
	ObjectType  string   `` /* 136-byte string literal not displayed */
	SubjectType string   `json:"subjectType,omitempty" description:"The type of subject to check roles for, e.g. service, user" example:"user"`
	Relations   []string `json:"relations,omitempty" description:"The relations to check roles for, e.g. can_view, can_edit" example:"can_view"`
}

AccountRolesRequest holds the fields that should be included on a request to the `/account/roles` endpoint

func (*AccountRolesRequest) Validate

func (r *AccountRolesRequest) Validate() error

Validate ensures the required fields are set on the AccountAccessRequest

type Address added in v0.6.6

type Address struct {
	// Line1 is the first line of the address
	Line1 string `json:"line1"`
	// Line2 is the second line of the address
	Line2 string `json:"line2"`
	// City is the city of the address
	City string `json:"city"`
	// State is the state of the address
	State string `json:"state"`
	// PostalCode is the postal code of the address
	PostalCode string `json:"postalCode"`
	// Country is the country of the address
	Country string `json:"country"`
}

Address is a custom type for Address

func (Address) MarshalGQL added in v0.6.6

func (a Address) MarshalGQL(w io.Writer)

MarshalGQL implement the Marshaler interface for gqlgen

func (Address) String added in v0.6.6

func (a Address) String() string

String returns a string representation of the address

func (*Address) UnmarshalGQL added in v0.6.6

func (a *Address) UnmarshalGQL(v interface{}) error

UnmarshalGQL implement the Unmarshaler interface for gqlgen

type AssessmentMethod added in v0.7.3

type AssessmentMethod struct {
	// ID is the unique identifier for the assessment method
	ID string `json:"id,omitempty"`
	// Type is the type of assessment being performed, e.g. Interview, Test, etc.
	Type string `json:"type,omitempty"`
	// Method is the associated language describing the assessment method
	Method string `json:"method,omitempty"`
}

AssessmentMethod are methods that can be used during the audit to assess the control implementation

func (AssessmentMethod) MarshalGQL added in v0.7.3

func (a AssessmentMethod) MarshalGQL(w io.Writer)

MarshalGQL implements the Marshaler interface for gqlgen

func (*AssessmentMethod) UnmarshalGQL added in v0.7.3

func (a *AssessmentMethod) UnmarshalGQL(v any) error

UnmarshalGQL implements the Unmarshaler interface for gqlgen

type AssessmentObjective added in v0.7.3

type AssessmentObjective struct {
	// Class is the class of the assessment objective which is typically what framework it origins from
	Class string `json:"class,omitempty"`
	// ID is the unique identifier for the assessment objective
	ID string `json:"id,omitempty"`
	// Objective is the associated language describing the assessment objective
	Objective string `json:"objective,omitempty" `
}

AssessmentObjective are objectives that are validated during the audit to ensure the control is implemented

func (AssessmentObjective) MarshalGQL added in v0.7.3

func (a AssessmentObjective) MarshalGQL(w io.Writer)

MarshalGQL implements the Marshaler interface for gqlgen

func (*AssessmentObjective) UnmarshalGQL added in v0.7.3

func (a *AssessmentObjective) UnmarshalGQL(v any) error

UnmarshalGQL implements the Unmarshaler interface for gqlgen

type AuthData

type AuthData struct {
	AccessToken  string `json:"access_token" description:"The access token to be used for authentication"`
	RefreshToken string `json:"refresh_token,omitempty" description:"The refresh token to be used to refresh the access token after it expires"`
	Session      string `json:"session,omitempty" description:"The short-lived session token required for authentication"`
	TokenType    string `json:"token_type,omitempty" description:"The type of token being returned" example:"bearer"`
}

type AvailableAuthTypeLoginRequest added in v0.10.1

type AvailableAuthTypeLoginRequest struct {
	Username string `json:"username" description:"The email address associated with the existing account" example:"jsnow@example.com"`
}

AvailableAuthTypeLoginRequest holds the payload for checking the auth types available to a user passkeys? or both passkeys and credentials or just credentials

func (*AvailableAuthTypeLoginRequest) Validate added in v0.10.1

func (r *AvailableAuthTypeLoginRequest) Validate() error

Validate ensures the required fields are set on the AvailableAuthTypeLoginRequest request

type AvailableAuthTypeReply added in v0.10.1

type AvailableAuthTypeReply struct {
	rout.Reply
	Methods []enums.AuthProvider `json:"methods,omitempty"`
}

AvailableAuthTypeReply holds the response to AvailableAuthTypeLoginRequest

type DateTime added in v0.10.2

type DateTime time.Time

DateTime is a custom GraphQL scalar that converts to/from time.Time

func ToDateTime added in v0.10.2

func ToDateTime(s string) (*DateTime, error)

func (DateTime) MarshalGQL added in v0.10.2

func (d DateTime) MarshalGQL(w io.Writer)

MarshalGQL writes the datetime as "YYYY-MM-DD"

func (*DateTime) Scan added in v0.10.2

func (d *DateTime) Scan(value any) error

func (DateTime) String added in v0.10.2

func (d DateTime) String() string

String formats the given datetime into a human readable version

func (*DateTime) UnmarshalCSV added in v0.10.2

func (d *DateTime) UnmarshalCSV(s string) error

func (*DateTime) UnmarshalGQL added in v0.10.2

func (d *DateTime) UnmarshalGQL(v any) error

UnmarshalGQL allows the DateTime to accept both "YYYY-MM-DD" and "YYYY-MM-DDTHH:MM:SSZ"

func (DateTime) Value added in v0.10.2

func (d DateTime) Value() (driver.Value, error)

type ExampleCSVRequest added in v0.7.5

type ExampleCSVRequest struct {
	Filename string `json:"filename" description:"the file name to check for" example:"actionplan"`
}

ExampleCSVRequest holds the payload for serving example CSV files

func (*ExampleCSVRequest) Validate added in v0.7.5

func (r *ExampleCSVRequest) Validate() error

Validate ensures the required fields are set on the ExampleCSVRequest request

type ExampleEvidence added in v0.7.3

type ExampleEvidence struct {
	// DocumentationType is the documentation artifact type for the example evidence
	DocumentationType string `json:"documentationType,omitempty"`
	// Description is the description of the example documentation artifact for the evidence
	Description string `json:"description,omitempty"`
}

ExampleEvidence is example evidence that can be used to satisfy the control

func (ExampleEvidence) MarshalGQL added in v0.7.3

func (e ExampleEvidence) MarshalGQL(w io.Writer)

MarshalGQL implements the Marshaler interface for gqlgen

func (*ExampleEvidence) UnmarshalGQL added in v0.7.3

func (e *ExampleEvidence) UnmarshalGQL(v any) error

UnmarshalGQL implements the Unmarshaler interface for gqlgen

type File added in v0.3.0

type File struct {
	ID           string    `json:"id,omitempty" description:"The ID of the uploaded file"`
	Name         string    `json:"name,omitempty" description:"The name of the uploaded file"`
	Size         int64     `json:"size,omitempty" description:"The size of the uploaded file in bytes"`
	MimeType     string    `json:"mime_type,omitempty" description:"The mime type of the uploaded file"`
	ContentType  string    `json:"content_type,omitempty" description:"The content type of the uploaded file"`
	PresignedURL string    `json:"presigned_url,omitempty" description:"The presigned URL to download the file"`
	MD5          []byte    `json:"md5,omitempty" description:"The MD5 hash of the uploaded file"`
	CreatedAt    time.Time `json:"created_at,omitempty" description:"The time the file was uploaded"`
	UpdatedAt    time.Time `json:"updated_at,omitempty" description:"The time the file was last updated"`
}

File holds the fields that are sent on a response to the `/upload` endpoint

type ForgotPasswordReply

type ForgotPasswordReply struct {
	rout.Reply
	Message string `json:"message,omitempty"`
}

ForgotPasswordReply contains fields for a forgot password response

type ForgotPasswordRequest

type ForgotPasswordRequest struct {
	Email string `` /* 136-byte string literal not displayed */
}

ForgotPasswordRequest contains fields for a forgot password request

func (*ForgotPasswordRequest) Validate

func (r *ForgotPasswordRequest) Validate() error

Validate ensures the required fields are set on the ForgotPasswordRequest request

type ImplementationGuidance added in v0.7.3

type ImplementationGuidance struct {
	// ReferenceID is the unique identifier for where the guidance was sourced from
	ReferenceID string `json:"referenceId,omitempty"`
	// Guidance are the steps to take to implement the control
	Guidance []string `json:"guidance,omitempty"`
}

ImplementationGuidance is the steps to take to implement the control they can come directly from the control source or pulled from external sources if the reference id matches the control ref code, the guidance is directly from the control if the reference id is different, the guidance is from an external source

func (ImplementationGuidance) MarshalGQL added in v0.7.3

func (i ImplementationGuidance) MarshalGQL(w io.Writer)

MarshalGQL implements the Marshaler interface for gqlgen

func (*ImplementationGuidance) UnmarshalGQL added in v0.7.3

func (i *ImplementationGuidance) UnmarshalGQL(v any) error

UnmarshalGQL implements the Unmarshaler interface for gqlgen

type InviteReply

type InviteReply struct {
	rout.Reply
	ID          string `json:"user_id" description:"The ID of the user that was created" example:"01J4EXD5MM60CX4YNYN0DEE3Y1"`
	Email       string `json:"email" description:"The email address of the user" example:"jsnow@example.com"`
	Message     string `json:"message"`
	JoinedOrgID string `json:"joined_org_id" description:"The ID of the organization the user joined" example:"01JJFVMGENQS9ZG3GVA50QVX5E"`
	Role        string `json:"role" description:"The role the user has in the organization" example:"admin"`
	AuthData
}

InviteReply holds the fields that are sent on a response to an accepted invitation

type InviteRequest

type InviteRequest struct {
	Token string `query:"token" description:"The token to be used to accept the invitation, token is sent via email"`
}

InviteRequest holds the fields that should be included on a request to the `/invite` endpoint

func (*InviteRequest) Validate

func (r *InviteRequest) Validate() error

Validate ensures the required fields are set on the InviteRequest request

type LoginReply

type LoginReply struct {
	rout.Reply
	AuthData
	TFAEnabled bool   `json:"tfa_enabled,omitempty"`
	Message    string `json:"message"`
}

LoginReply holds the response to LoginRequest

type LoginRequest

type LoginRequest struct {
	Username string `json:"username" description:"The email address associated with the existing account" example:"jsnow@example.com"`
	Password string `json:"password" description:"The password associated with the account" example:"Wint3rIsC0ming123!"`
}

LoginRequest holds the login payload for the /login route

func (*LoginRequest) Validate

func (r *LoginRequest) Validate() error

Validate ensures the required fields are set on the LoginRequest request

type OauthTokenRequest

type OauthTokenRequest struct {
	Name             string `json:"name" description:"The name of the user" example:"Jon Snow"`
	Email            string `json:"email" description:"The email address of the user" example:"jsnow@example.com"`
	AuthProvider     string `json:"authProvider" description:"The provider used to authenticate the user, e.g. google, github, etc." example:"google"`
	ExternalUserID   string `json:"externalUserId" description:"The ID of the user from the external provider" example:"1234567890"`
	ExternalUserName string `json:"externalUserName" description:"The username of the user from the external provider" example:"jsnow"`
	ClientToken      string `json:"clientToken" description:"The token provided by the external provider"`
	Image            string `json:"image,omitempty" description:"The image URL of the user from the external provider"`
}

OauthTokenRequest to authenticate an oauth user with the Server

type Price added in v0.6.7

type Price struct {
	// Amount is the dollar amount of the price (e.g 100)
	Amount float64 `json:"amount"`
	// Interval is the interval of the price (e.g monthly, yearly)
	Interval string `json:"interval"`
	// Currency is the currency of the price that is being charged (e.g USD)
	Currency string `json:"currency"`
}

Price is a custom type for pricing data

func (Price) MarshalGQL added in v0.6.7

func (p Price) MarshalGQL(w io.Writer)

MarshalGQL implement the Marshaler interface for gqlgen

func (Price) String added in v0.6.7

func (p Price) String() string

String returns a string representation of the price

func (*Price) UnmarshalGQL added in v0.6.7

func (p *Price) UnmarshalGQL(v interface{}) error

UnmarshalGQL implement the Unmarshaler interface for gqlgen

type Reference added in v0.7.3

type Reference struct {
	// Name is the name of the reference
	Name string `json:"name,omitempty"`
	// URL is the link to the reference
	URL string `json:"url,omitempty"`
}

Reference are links to external sources that can be used to gain more information about the control

func (Reference) MarshalGQL added in v0.7.3

func (r Reference) MarshalGQL(w io.Writer)

MarshalGQL implements the Marshaler interface for gqlgen

func (*Reference) UnmarshalGQL added in v0.7.3

func (r *Reference) UnmarshalGQL(v any) error

UnmarshalGQL implements the Unmarshaler interface for gqlgen

type RefreshReply

type RefreshReply struct {
	rout.Reply
	Message string `json:"message,omitempty"`
	AuthData
}

RefreshReply holds the fields that are sent on a response to the `/refresh` endpoint

type RefreshRequest

type RefreshRequest struct {
	RefreshToken string `json:"refresh_token" description:"The token to be used to refresh the access token after expiration"`
}

RefreshRequest holds the fields that should be included on a request to the `/refresh` endpoint

func (*RefreshRequest) Validate

func (r *RefreshRequest) Validate() error

Validate ensures the required fields are set on the RefreshRequest request

type RegisterReply

type RegisterReply struct {
	rout.Reply
	ID      string `json:"user_id" description:"The ID of the user that was created" example:"01J4EXD5MM60CX4YNYN0DEE3Y1"`
	Email   string `json:"email" description:"The email address of the user" example:"jsnow@example.com"`
	Message string `json:"message"`
	Token   string `json:"token,omitempty" exclude:"true"` // only used for requests against local development, excluded from OpenAPI documentation
}

RegisterReply holds the fields that are sent on a response to the `/register` endpoint

type RegisterRequest

type RegisterRequest struct {
	FirstName string `json:"first_name,omitempty" description:"The first name of the user" example:"Jon"`
	LastName  string `json:"last_name,omitempty" description:"The last name of the user" example:"Snow"`
	Email     string `json:"email" description:"The email address of the user" example:"jsnow@example.com"`
	Password  string `json:"password" description:"The password to be used for authentication after registration" example:"Wint3rIsC0ming123!"`
}

RegisterRequest holds the fields that should be included on a request to the `/register` endpoint

func (*RegisterRequest) Validate

func (r *RegisterRequest) Validate() error

Validate ensures the required fields are set on the RegisterRequest request

type ResendReply

type ResendReply struct {
	rout.Reply
	Message string `json:"message"`
}

ResendReply holds the fields that are sent on a response to the `/resend` endpoint

type ResendRequest

type ResendRequest struct {
	Email string `` /* 134-byte string literal not displayed */
}

ResendRequest contains fields for a resend email verification request to the `/resend` endpoint

func (*ResendRequest) Validate

func (r *ResendRequest) Validate() error

Validate ensures the required fields are set on the ResendRequest request

type ResetPasswordReply

type ResetPasswordReply struct {
	rout.Reply
	Message string `json:"message"`
}

ResetPasswordReply is the response returned from a non-successful password reset request on success, no content is returned (204)

type ResetPasswordRequest

type ResetPasswordRequest struct {
	Password string `json:"password" description:"The new password to be used for authentication"`
	Token    string `json:"token" description:"The token to be used to reset the password, token is sent via email"`
}

ResetPasswordRequest contains user input required to reset a user's password using /password-reset endpoint

func (*ResetPasswordRequest) Validate

func (r *ResetPasswordRequest) Validate() error

Validate ensures the required fields are set on the ResetPasswordRequest request

type SemverVersion added in v0.7.5

type SemverVersion struct {
	// Major is the major version
	Major int `json:"major,omitempty"`
	// Minor is the minor version
	Minor int `json:"minor,omitempty"`
	// Patch is the patch version
	Patch int `json:"patch,omitempty"`
	// PreRelease is the pre-release version (used for draft versions)
	PreRelease string `json:"preRelease,omitempty"`
}

SemverVersion is a custom type for semantic versioning It is used to represent the version of objects stored in the database

func ToSemverVersion added in v0.7.5

func ToSemverVersion(version *string) (*SemverVersion, error)

ToSemverVersion converts a string to a SemverVersion It parses the string and returns a SemverVersion object It supports the following formats: - v1.0.0 - 1.0.0 - v1.0.0-alpha - 1.0.0-alpha anything after the first "-" is considered a pre-release version

func (*SemverVersion) BumpPatchSemver added in v0.7.5

func (s *SemverVersion) BumpPatchSemver()

BumpPatch increments the patch version by 1 For example if the version is v1.7.1 the new version will be v1.7.2 It resets the pre-release version to empty

func (SemverVersion) String added in v0.7.5

func (s SemverVersion) String() string

String returns a string representation of the version

type SwitchOrganizationReply

type SwitchOrganizationReply struct {
	rout.Reply
	AuthData
}

SwitchOrganizationReply holds the new authentication and session information for the user for the new organization

type SwitchOrganizationRequest

type SwitchOrganizationRequest struct {
	TargetOrganizationID string `json:"target_organization_id" description:"The ID of the organization to switch to" example:"01J4EXD5MM60CX4YNYN0DEE3Y1"`
}

SwitchOrganizationRequest contains the target organization ID being switched to for the /switch endpoint

func (*SwitchOrganizationRequest) Validate

func (r *SwitchOrganizationRequest) Validate() error

Validate ensures the required fields are set on the SwitchOrganizationRequest request

type TFAReply added in v0.6.11

type TFAReply struct {
	rout.Reply
	Message string `json:"message"`
}

TFAReply holds the response to TFARequest

type TFARequest added in v0.6.11

type TFARequest struct {
	TOTPCode     string `` /* 127-byte string literal not displayed */
	RecoveryCode string `` /* 133-byte string literal not displayed */
}

TFARequest holds the payload for verifying the 2fa code (/2fa/validate)

func (*TFARequest) Validate added in v0.6.11

func (r *TFARequest) Validate() error

Validate ensures the required fields are set on the TFARequest request

type UploadFilesReply added in v0.3.0

type UploadFilesReply struct {
	rout.Reply
	Message   string `json:"message,omitempty"`
	FileCount int64  `json:"file_count,omitempty" description:"The number of files uploaded"`
	Files     []File `json:"files,omitempty" description:"The files that were uploaded"`
}

UploadFilesReply holds the fields that are sent on a response to the `/upload` endpoint

type UploadFilesRequest added in v0.3.0

type UploadFilesRequest struct {
	UploadFile multipart.FileHeader `form:"uploadFile" description:"The file to be uploaded"`
}

UploadFilesRequest holds the fields that should be included on a request to the `/upload` endpoint

type VerifyReply

type VerifyReply struct {
	rout.Reply
	ID      string `json:"user_id" description:"The ID of the user that was created" example:"01J4EXD5MM60CX4YNYN0DEE3Y1"`
	Email   string `json:"email" description:"The email address of the user" example:"jsnow@example.com"`
	Message string `json:"message,omitempty"`
	AuthData
}

VerifyReply holds the fields that are sent on a response to the `/verify` endpoint

type VerifyRequest

type VerifyRequest struct {
	Token string `query:"token" description:"The token to be used to verify the email address, token is sent via email"`
}

VerifyRequest holds the fields that should be included on a request to the `/verify` endpoint

func (*VerifyRequest) Validate

func (r *VerifyRequest) Validate() error

Validate ensures the required fields are set on the VerifyRequest request

type VerifySubscribeReply

type VerifySubscribeReply struct {
	rout.Reply
	Message string `json:"message,omitempty"`
}

VerifySubscribeReply holds the fields that are sent on a response to the `/subscribe/verify` endpoint

type VerifySubscribeRequest

type VerifySubscribeRequest struct {
	Token string `query:"token" description:"The token to be used to verify the subscription, token is sent via email"`
}

VerifySubscribeRequest holds the fields that should be included on a request to the `/subscribe/verify` endpoint

func (*VerifySubscribeRequest) Validate

func (r *VerifySubscribeRequest) Validate() error

Validate ensures the required fields are set on the VerifySubscribeRequest request

type VersionBump added in v0.7.5

type VersionBump string

VersionBump is a custom type for version bumping It is used to represent the type of version bumping

var (
	// Major is the major version
	Major VersionBump = "MAJOR"
	// Minor is the minor version
	Minor VersionBump = "MINOR"
	// Patch is the patch version
	Patch VersionBump = "PATCH"
	// PreRelease is the pre-release version
	PreRelease VersionBump = "DRAFT"
)

func ToVersionBump added in v0.8.3

func ToVersionBump(r string) *VersionBump

ToVersionBump returns the version bump enum based on string input

func VersionBumpFromContext added in v0.7.5

func VersionBumpFromContext(ctx context.Context) (*VersionBump, bool)

VersionBumpFromContext returns the VersionBump from the context

func VersionBumpFromRequestContext added in v0.7.5

func VersionBumpFromRequestContext(ctx context.Context) (*VersionBump, bool)

VersionBumpFromContext returns the VersionBump from the context

func (VersionBump) MarshalGQL added in v0.7.5

func (v VersionBump) MarshalGQL(w io.Writer)

MarshalGQL implement the Marshaler interface for gqlgen

func (VersionBump) String added in v0.7.5

func (v VersionBump) String() string

String returns the role as a string

func (*VersionBump) UnmarshalGQL added in v0.7.5

func (v *VersionBump) UnmarshalGQL(a any) error

UnmarshalGQL implement the Unmarshaler interface for gqlgen

func (VersionBump) Values added in v0.7.5

func (VersionBump) Values() (kinds []string)

Values returns a slice of strings that represents all the possible values of the VersionBump enum. Possible default values are "MAJOR", "MINOR", "PATCH", "DRAFT"

type WebauthnBeginLoginResponse

type WebauthnBeginLoginResponse struct {
	Reply rout.Reply
	*protocol.CredentialAssertion
	Session string `json:"session,omitempty"`
}

WebauthnBeginLoginResponse is the response to begin a webauthn login this includes the credential assertion options and the session token

type WebauthnBeginRegistrationResponse

type WebauthnBeginRegistrationResponse struct {
	Reply rout.Reply
	*protocol.CredentialCreation
	Session string `json:"session,omitempty"`
}

WebauthnBeginRegistrationResponse is the response to begin a webauthn login this includes the credential creation options and the session token

type WebauthnLoginRequest added in v0.10.1

type WebauthnLoginRequest struct {
	Email string `json:"email" description:"The email address associated with the account" example:"jsnow@example.com"`
}

WebauthnLoginRequest is the request to begin a webauthn login

func (*WebauthnLoginRequest) Validate added in v0.10.1

func (r *WebauthnLoginRequest) Validate() error

type WebauthnLoginResponse

type WebauthnLoginResponse struct {
	rout.Reply
	Message string `json:"message,omitempty"`
	AuthData
}

WebauthnLoginResponse is the response after a successful webauthn login

type WebauthnRegistrationRequest

type WebauthnRegistrationRequest struct {
	Email string `json:"email" description:"The email address associated with the account" example:"jsnow@example.com"`
	Name  string `json:"name" description:"The name of the user" example:"Jon Snow"`
}

WebauthnRegistrationRequest is the request to begin a webauthn login

func (*WebauthnRegistrationRequest) Validate added in v0.6.12

func (r *WebauthnRegistrationRequest) Validate() error

type WebauthnRegistrationResponse

type WebauthnRegistrationResponse struct {
	rout.Reply
	Message string `json:"message,omitempty"`
	AuthData
}

WebauthnRegistrationResponse is the response after a successful webauthn registration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL