models

package
v0.6.10 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package models provides http request and response structs

Index

Constants

This section is empty.

Variables

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 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!",
	OTPCode:  "123456",
}

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

View Source
var ExampleLoginSuccessResponse = LoginReply{
	Reply: rout.Reply{
		Success: 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 ExamplePublishSuccessRequest = PublishRequest{
	Tags:    map[string]string{"tag1": "meow", "tag2": "meowzer"},
	Topic:   "meow",
	Message: "hot diggity dog",
}

ExamplePublishSuccessRequest is an example of a successful publish request for OpenAPI documentation

View Source
var ExamplePublishSuccessResponse = PublishReply{
	Reply: rout.Reply{
		Success: true,
	},
	Message: "success!",
}

ExamplePublishSuccessResponse is an example of a successful publish 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!",
	Token:   "",
}

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 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",
	Token:   "token",
	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

Functions

This section is empty.

Types

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"`
	ObjectType  string `json:"objectType"`
	Relation    string `json:"relation"`
	SubjectType string `json:"subjectType,omitempty"`
}

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"`
	OrganizationID string   `json:"organization_id"`
}

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"`
}

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"`
	ObjectType  string   `json:"objectType"`
	SubjectType string   `json:"subjectType,omitempty"`
	Relations   []string `json:"relations,omitempty"`
}

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 AuthData

type AuthData struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token,omitempty"`
	Session      string `json:"session,omitempty"`
	TokenType    string `json:"token_type,omitempty"`
}

type EntitlementsReply added in v0.4.1

type EntitlementsReply struct {
	ClientSecret string `json:"client_secret"`
}

EntitlementsReply holds the fields that are sent on a response to the `/entitlements` endpoint

type EntitlementsRequest added in v0.4.1

type EntitlementsRequest struct {
	OrganizationID string `json:"organization_id"`
}

EntitlementsRequest holds the fields that should be included on a request to the `/entitlements` endpoint

type File added in v0.3.0

type File struct {
	ID           string    `json:"id,omitempty"`
	Name         string    `json:"name,omitempty"`
	Size         int64     `json:"size,omitempty"`
	MimeType     string    `json:"mime_type,omitempty"`
	ContentType  string    `json:"content_type,omitempty"`
	PresignedURL string    `json:"presigned_url,omitempty"`
	MD5          []byte    `json:"md5,omitempty"`
	CreatedAt    time.Time `json:"created_at,omitempty"`
	UpdatedAt    time.Time `json:"updated_at,omitempty"`
}

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 `json:"email"`
}

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 InviteReply

type InviteReply struct {
	rout.Reply
	ID          string `json:"user_id"`
	Email       string `json:"email"`
	Message     string `json:"message"`
	JoinedOrgID string `json:"joined_org_id"`
	Role        string `json:"role"`
	AuthData
}

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

type InviteRequest

type InviteRequest struct {
	Token string `query:"token"`
}

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
	Message string `json:"message"`
}

LoginReply holds the response to LoginRequest

type LoginRequest

type LoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
	OTPCode  string `json:"otp_code,omitempty"`
}

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"`
	Email            string `json:"email"`
	AuthProvider     string `json:"authProvider"`
	ExternalUserID   string `json:"externalUserId"`
	ExternalUserName string `json:"externalUserName"`
	ClientToken      string `json:"clientToken"`
	Image            string `json:"image,omitempty"`
}

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 PublishReply

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

PublishReply holds the fields that are sent on a response to the `/event/publish` endpoint

type PublishRequest

type PublishRequest struct {
	Tags    map[string]string `json:"tags"`
	Topic   string            `json:"topic"`
	Message string            `json:"message"`
}

PublishRequest is the request payload for the event publisher

func (*PublishRequest) Validate

func (r *PublishRequest) Validate() error

Validate ensures the required fields are set on the PublishRequest request

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"`
}

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"`
	Email   string `json:"email"`
	Message string `json:"message"`
	Token   string `json:"token"`
}

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"`
	LastName  string `json:"last_name,omitempty"`
	Email     string `json:"email"`
	Password  string `json:"password"`
}

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 `json:"email"`
}

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"`
	Token    string `json:"token"`
}

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 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"`
}

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 UploadFilesReply added in v0.3.0

type UploadFilesReply struct {
	rout.Reply
	Message   string `json:"message,omitempty"`
	FileCount int64  `json:"file_count,omitempty"`
	Files     []File `json:"files,omitempty"`
}

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"`
}

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"`
	Email   string `json:"email"`
	Token   string `json:"token"`
	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"`
}

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"`
}

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 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"`
}

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

type WebauthnLoginResponse

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

WebauthnRegistrationResponse is the response after a successful webauthn login

type WebauthnRegistrationRequest

type WebauthnRegistrationRequest struct {
	Email string `json:"email"`
	Name  string `json:"name"`
}

WebauthnRegistrationRequest is the request to begin a webauthn login

type WebauthnRegistrationResponse

type WebauthnRegistrationResponse struct {
	rout.Reply
	Message   string `json:"message,omitempty"`
	TokenType string `json:"token_type"`
	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