api

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

code generated by orbit

Index

Constants

View Source
const (
	ErrCodeAuthFailed         = 1
	ErrCodeEmailAlreadyExists = 4
	ErrCodeNameAlreadyExists  = 3
	ErrCodeNotFound           = 2
)
View Source
const (
	CallIDRegister               = "Register"
	CallIDLogin                  = "Login"
	CallIDLogout                 = "Logout"
	CallIDGetUsers               = "GetUsers"
	CallIDGetUser                = "GetUser"
	CallIDGetUserProfileImage    = "GetUserProfileImage"
	CallIDCreateUser             = "CreateUser"
	CallIDUpdateUser             = "UpdateUser"
	CallIDUpdateUserProfileImage = "UpdateUserProfileImage"
	StreamIDObserveNotifications = "ObserveNotifications"
)

Variables

View Source
var (
	ErrAuthFailed         = errors.New("auth failed")
	ErrEmailAlreadyExists = errors.New("email already exists")
	ErrNameAlreadyExists  = errors.New("name already exists")
	ErrNotFound           = errors.New("not found")
)
View Source
var ErrClosed = errors.New("closed")

Functions

This section is empty.

Types

type Client

type Client interface {
	closer.Closer
	StateChan() <-chan oclient.State
	// Calls
	Register(ctx context.Context, arg RegisterArg) (err error)
	Login(ctx context.Context, arg LoginArg) (err error)
	Logout(ctx context.Context) (err error)
	GetUsers(ctx context.Context, arg GetUsersArg) (ret GetUsersRet, err error)
	GetUser(ctx context.Context, arg GetUserArg) (ret UserDetail, err error)
	GetUserProfileImage(ctx context.Context, arg GetUserProfileImageArg) (ret GetUserProfileImageRet, err error)
	CreateUser(ctx context.Context, arg CreateUserArg) (ret UserDetail, err error)
	UpdateUser(ctx context.Context, arg UpdateUserArg) (err error)
	UpdateUserProfileImage(ctx context.Context, arg UpdateUserProfileImageArg) (err error)
	// Streams
	ObserveNotifications(ctx context.Context) (stream *ObserveNotificationsClientStream, err error)
}

func NewClient

func NewClient(opts *oclient.Options) (c Client, err error)

type CreateUserArg

type CreateUserArg struct {
	UserName  string `validate:"required,min=4"`
	FirstName string `validate:"required"`
	LastName  string `validate:"required"`
	Email     string `validate:"email"`
}

func (*CreateUserArg) DecodeMsg

func (z *CreateUserArg) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*CreateUserArg) EncodeMsg

func (z *CreateUserArg) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*CreateUserArg) MarshalMsg

func (z *CreateUserArg) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*CreateUserArg) Msgsize

func (z *CreateUserArg) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*CreateUserArg) UnmarshalMsg

func (z *CreateUserArg) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type GetUserArg

type GetUserArg struct {
	UserID string `validate:"required"`
}

func (*GetUserArg) DecodeMsg

func (z *GetUserArg) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (GetUserArg) EncodeMsg

func (z GetUserArg) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (GetUserArg) MarshalMsg

func (z GetUserArg) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (GetUserArg) Msgsize

func (z GetUserArg) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*GetUserArg) UnmarshalMsg

func (z *GetUserArg) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type GetUserProfileImageArg

type GetUserProfileImageArg struct {
	UserID string `validate:"required"`
}

func (*GetUserProfileImageArg) DecodeMsg

func (z *GetUserProfileImageArg) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (GetUserProfileImageArg) EncodeMsg

func (z GetUserProfileImageArg) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (GetUserProfileImageArg) MarshalMsg

func (z GetUserProfileImageArg) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (GetUserProfileImageArg) Msgsize

func (z GetUserProfileImageArg) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*GetUserProfileImageArg) UnmarshalMsg

func (z *GetUserProfileImageArg) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type GetUserProfileImageRet

type GetUserProfileImageRet struct {
	Jpeg []byte
}

func (*GetUserProfileImageRet) DecodeMsg

func (z *GetUserProfileImageRet) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*GetUserProfileImageRet) EncodeMsg

func (z *GetUserProfileImageRet) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*GetUserProfileImageRet) MarshalMsg

func (z *GetUserProfileImageRet) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*GetUserProfileImageRet) Msgsize

func (z *GetUserProfileImageRet) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*GetUserProfileImageRet) UnmarshalMsg

func (z *GetUserProfileImageRet) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type GetUsersArg

type GetUsersArg struct {
	AfterUserID string
	Count       int `validate:"min=1,max=100"`
}

func (*GetUsersArg) DecodeMsg

func (z *GetUsersArg) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (GetUsersArg) EncodeMsg

func (z GetUsersArg) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (GetUsersArg) MarshalMsg

func (z GetUsersArg) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (GetUsersArg) Msgsize

func (z GetUsersArg) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*GetUsersArg) UnmarshalMsg

func (z *GetUsersArg) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type GetUsersRet

type GetUsersRet struct {
	Users []UserOverview
}

func (*GetUsersRet) DecodeMsg

func (z *GetUsersRet) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*GetUsersRet) EncodeMsg

func (z *GetUsersRet) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*GetUsersRet) MarshalMsg

func (z *GetUsersRet) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*GetUsersRet) Msgsize

func (z *GetUsersRet) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*GetUsersRet) UnmarshalMsg

func (z *GetUsersRet) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type LoginArg

type LoginArg struct {
	User     string `validate:"required"`
	Password string `validate:"required"`
}

func (*LoginArg) DecodeMsg

func (z *LoginArg) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (LoginArg) EncodeMsg

func (z LoginArg) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (LoginArg) MarshalMsg

func (z LoginArg) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (LoginArg) Msgsize

func (z LoginArg) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*LoginArg) UnmarshalMsg

func (z *LoginArg) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Notification

type Notification struct {
	Id            string
	Title         string
	Description   string
	ThumbnailJpeg []byte
	Link          string
}

func (*Notification) DecodeMsg

func (z *Notification) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Notification) EncodeMsg

func (z *Notification) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Notification) MarshalMsg

func (z *Notification) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Notification) Msgsize

func (z *Notification) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Notification) UnmarshalMsg

func (z *Notification) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ObserveNotificationsArg

type ObserveNotificationsArg struct {
	UserID string `validate:"required"`
}

func (*ObserveNotificationsArg) DecodeMsg

func (z *ObserveNotificationsArg) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (ObserveNotificationsArg) EncodeMsg

func (z ObserveNotificationsArg) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (ObserveNotificationsArg) MarshalMsg

func (z ObserveNotificationsArg) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (ObserveNotificationsArg) Msgsize

func (z ObserveNotificationsArg) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ObserveNotificationsArg) UnmarshalMsg

func (z *ObserveNotificationsArg) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ObserveNotificationsClientStream

type ObserveNotificationsClientStream struct {
	oclient.TypedStreamCloser
	// contains filtered or unexported fields
}

func (*ObserveNotificationsClientStream) Read

func (v1 *ObserveNotificationsClientStream) Read() (ret Notification, err error)

func (*ObserveNotificationsClientStream) Write

type ObserveNotificationsServiceStream

type ObserveNotificationsServiceStream struct {
	oservice.TypedStreamCloser
	// contains filtered or unexported fields
}

func (*ObserveNotificationsServiceStream) Read

func (*ObserveNotificationsServiceStream) Write

type RegisterArg

type RegisterArg struct {
	Email    string `validate:"email"`
	Password string `validate:"required,min=8"`
}

func (*RegisterArg) DecodeMsg

func (z *RegisterArg) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (RegisterArg) EncodeMsg

func (z RegisterArg) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (RegisterArg) MarshalMsg

func (z RegisterArg) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (RegisterArg) Msgsize

func (z RegisterArg) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*RegisterArg) UnmarshalMsg

func (z *RegisterArg) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Service

type Service interface {
	closer.Closer
	Run() error
}

func NewService

func NewService(h ServiceHandler, opts *oservice.Options) (s Service, err error)

type ServiceHandler

type ServiceHandler interface {
	// Calls
	Register(ctx oservice.Context, arg RegisterArg) (err error)
	Login(ctx oservice.Context, arg LoginArg) (err error)
	Logout(ctx oservice.Context) (err error)
	GetUsers(ctx oservice.Context, arg GetUsersArg) (ret GetUsersRet, err error)
	GetUser(ctx oservice.Context, arg GetUserArg) (ret UserDetail, err error)
	GetUserProfileImage(ctx oservice.Context, arg GetUserProfileImageArg) (ret GetUserProfileImageRet, err error)
	CreateUser(ctx oservice.Context, arg CreateUserArg) (ret UserDetail, err error)
	UpdateUser(ctx oservice.Context, arg UpdateUserArg) (err error)
	UpdateUserProfileImage(ctx oservice.Context, arg UpdateUserProfileImageArg) (err error)
	// Streams
	ObserveNotifications(ctx oservice.Context, stream *ObserveNotificationsServiceStream) error
}

type UpdateUserArg

type UpdateUserArg struct {
	UserID    string `validate:"required"`
	UserName  string `validate:"required,min=4"`
	FirstName string `validate:"required"`
	LastName  string `validate:"required"`
	Status    string
	Email     string `validate:"email"`
}

func (*UpdateUserArg) DecodeMsg

func (z *UpdateUserArg) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*UpdateUserArg) EncodeMsg

func (z *UpdateUserArg) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*UpdateUserArg) MarshalMsg

func (z *UpdateUserArg) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*UpdateUserArg) Msgsize

func (z *UpdateUserArg) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UpdateUserArg) UnmarshalMsg

func (z *UpdateUserArg) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type UpdateUserProfileImageArg

type UpdateUserProfileImageArg struct {
	UserID string `validate:"required"`
	Jpeg   []byte
}

func (*UpdateUserProfileImageArg) DecodeMsg

func (z *UpdateUserProfileImageArg) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*UpdateUserProfileImageArg) EncodeMsg

func (z *UpdateUserProfileImageArg) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*UpdateUserProfileImageArg) MarshalMsg

func (z *UpdateUserProfileImageArg) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*UpdateUserProfileImageArg) Msgsize

func (z *UpdateUserProfileImageArg) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UpdateUserProfileImageArg) UnmarshalMsg

func (z *UpdateUserProfileImageArg) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type UserDetail

type UserDetail struct {
	Overview        UserOverview
	NumberPosts     int
	NumberFollowing int
	NumberFriends   int
	UserStatus      UserStatus
}

func (*UserDetail) DecodeMsg

func (z *UserDetail) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*UserDetail) EncodeMsg

func (z *UserDetail) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*UserDetail) MarshalMsg

func (z *UserDetail) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*UserDetail) Msgsize

func (z *UserDetail) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UserDetail) UnmarshalMsg

func (z *UserDetail) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type UserOverview

type UserOverview struct {
	Id              string
	UserName        string
	FirstName       string
	LastName        string
	JoinedOn        time.Time
	Status          string
	NumberFollowers int
}

func (*UserOverview) DecodeMsg

func (z *UserOverview) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*UserOverview) EncodeMsg

func (z *UserOverview) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*UserOverview) MarshalMsg

func (z *UserOverview) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*UserOverview) Msgsize

func (z *UserOverview) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UserOverview) UnmarshalMsg

func (z *UserOverview) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type UserStatus

type UserStatus int
const (
	UserStatusEmailNotVerified UserStatus = 1
	UserStatusActive           UserStatus = 2
	UserStatusBlocked          UserStatus = 3
)

func (*UserStatus) DecodeMsg

func (z *UserStatus) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (UserStatus) EncodeMsg

func (z UserStatus) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (UserStatus) MarshalMsg

func (z UserStatus) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (UserStatus) Msgsize

func (z UserStatus) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UserStatus) UnmarshalMsg

func (z *UserStatus) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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