models

package
v0.7.9 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2024 License: Apache-2.0 Imports: 5 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@datum.net",
}

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@datum.net",
	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@datum.net",
	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 Datum!",
	Token:   "",
}

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

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

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 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@datum.net",
	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 added in v0.7.8

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

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

func (r *AccountAccessRequest) Validate() error

Validate ensures the required fields are set on the AccountAccessRequest

type AccountRolesOrganizationReply added in v0.7.9

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

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

func (r *AccountRolesOrganizationRequest) Validate() error

Validate ensures the required fields are set on the AccountAccessRequest

type AccountRolesReply added in v0.7.9

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

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

func (r *AccountRolesRequest) Validate() error

Validate ensures the required fields are set on the AccountAccessRequest

type AuthData added in v0.6.1

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 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 Datum Server

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 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