clientv1

package
v0.0.0-...-a0d1ad3 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: MIT Imports: 23 Imported by: 0

README

HVX gRPC CLIENT V1

EXAMPLE

{GRPC_RESPONSE}, _ := clientv1.New(ctx, microsvc.{NAME}ServiceName).{GRPC_REQUEST}()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetServiceAddress

func GetServiceAddress(servicesName string) (address string)

GetServiceAddress receives the service name and returns the gRPC address. config provider is viper.

Types

type Accounts

type Accounts interface {
	IsExistAccount(username string) (*pb.IsExistResponse, error)
	GetAccountByUsername(username string) (*pb.GetByUsernameResponse, error)
	CreateAccount(username, mail, password, publicKey string) (*pb.CreateResponse, error)
	GetPrivateKey(accountId int64) (*pb.GetPrivateKeyResponse, error)
	Verify(username, password string) (*pb.VerifyResponse, error)
}

type Activity

type Activity interface {
	Inbox(name string, body []byte) (*pb.InboxResponse, error)
	ArticleActivity(accountId, actorId, articleId int64, article *article.CreateRequest) (*pb.ActivityResponse, error)
}

type Actor

type Actor interface {
	IsExistActor(preferredUsername string) (*pb.IsExistResponse, error)
	IsRemoteExist(preferredUsername, domain string) (*pb.IsExistResponse, error)
	GetActor(actorId int64) (*pb.GetResponse, error)
	GetActorByUsername(username string) (*pb.ActorData, error)
	GetActorByAddress(inbox string) (*pb.ActorData, error)
	CreateActor(preferredUsername, publicKey, actorType string) (*pb.CreateResponse, error)
	DeleteActor(actorId int64) (*pb.DeleteResponse, error)
}

type Auth

type Auth interface {
	SetAuthPublicKey(accountId int64, publicKey string) (*pb.SetPublicKeyResponse, error)
}

type Channel

type Channel interface {
	GetPrivateKeyByActorId(actorId int64) (*pb.GetPrivateKeyByActorIdResponse, error)
}

type Client

type Client struct {
	Context context.Context
	Conn    *grpc.ClientConn
}

func NewClient

func NewClient(ctx context.Context, endpoint string, cfg ...Option) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

type Config

type Config struct {
	Endpoint    string
	DialTimeout time.Duration
	TLS         *tls.Config
	DialOptions []grpc.DialOption
}

type CustomerTokenAuth

type CustomerTokenAuth struct{}

func (CustomerTokenAuth) GetRequestMetadata

func (c CustomerTokenAuth) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)

func (CustomerTokenAuth) RequireTransportSecurity

func (c CustomerTokenAuth) RequireTransportSecurity() bool

type Devices

type Devices interface {
	DeleteDevices(accountId int64) (*pb.DeleteDevicesResponse, error)
	AddDevice(accountId int64, userAgent string) (*pb.CreateResponse, error)
	IsExistDevice(deviceId int64) (*pb.IsExistResponse, error)
}

type FS

type FS interface {
	CreateFs(accountId int64, fileName, address string) (*pb.CreateResponse, error)
	GetFs(accountId int64, fileName string) (*pb.GetResponse, error)
	Delete(accountId int64, fileName string) (*pb.DeleteResponse, error)
}

type Option

type Option func(o *Config)

func SetDialOptionsWithToken

func SetDialOptionsWithToken() Option

func SetDialTimeout

func SetDialTimeout(t time.Duration) Option

func SetTLS

func SetTLS(tls *tls.Config) Option

type PerRPCCredentials

type PerRPCCredentials interface {
	GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)
	RequireTransportSecurity() bool
}

type Public

type Public interface {
	GetInstance() (*pb.GetInstanceResponse, error)
}

type Subscribe

type Subscribe interface {
	GetSubscribers(channelId, adminId int64) (*pb.GetSubscribersResponse, error)
}

type Svc

type Svc struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, serviceName string) *Svc

func (*Svc) AddDevice

func (svc *Svc) AddDevice(accountId int64, userAgent string) (*pb.CreateResponse, error)

func (*Svc) ArticleActivity

func (svc *Svc) ArticleActivity(accountId, actorId, articleId int64, article *article.CreateRequest) (*pb.ActivityResponse, error)

func (*Svc) CreateAccount

func (svc *Svc) CreateAccount(username, mail, password, publicKey string) (*pb.CreateResponse, error)

func (*Svc) CreateActor

func (svc *Svc) CreateActor(preferredUsername, publicKey, actorType string) (*pb.CreateResponse, error)

func (*Svc) CreateFs

func (svc *Svc) CreateFs(accountId int64, fileName, address string) (*pb.CreateResponse, error)

func (*Svc) Delete

func (svc *Svc) Delete(accountId int64, fileName string) (*pb.DeleteResponse, error)

func (*Svc) DeleteActor

func (svc *Svc) DeleteActor(actorId int64) (*pb.DeleteResponse, error)

func (*Svc) DeleteDevices

func (svc *Svc) DeleteDevices(accountId int64) (*pb.DeleteDevicesResponse, error)

func (*Svc) GetAccountByUsername

func (svc *Svc) GetAccountByUsername(username string) (*pb.GetByUsernameResponse, error)

func (*Svc) GetActor

func (svc *Svc) GetActor(actorId int64) (*pb.GetResponse, error)

func (*Svc) GetActorByAddress

func (svc *Svc) GetActorByAddress(inbox string) (*pb.ActorData, error)

func (*Svc) GetActorByUsername

func (svc *Svc) GetActorByUsername(username string) (*pb.ActorData, error)

func (*Svc) GetFs

func (svc *Svc) GetFs(accountId int64, fileName string) (*pb.GetResponse, error)

func (*Svc) GetInstance

func (svc *Svc) GetInstance() (*pb.GetInstanceResponse, error)

func (*Svc) GetPrivateKey

func (svc *Svc) GetPrivateKey(accountId int64) (*pb.GetPrivateKeyResponse, error)

func (*Svc) GetPrivateKeyByActorId

func (svc *Svc) GetPrivateKeyByActorId(actorId int64) (*pb.GetPrivateKeyByActorIdResponse, error)

func (*Svc) GetSubscribers

func (svc *Svc) GetSubscribers(channelId, adminId int64) (*pb.GetSubscribersResponse, error)

func (*Svc) Inbox

func (svc *Svc) Inbox(name string, body []byte) (*pb.InboxResponse, error)

func (*Svc) IsExistAccount

func (svc *Svc) IsExistAccount(username string) (*pb.IsExistResponse, error)

func (*Svc) IsExistActor

func (svc *Svc) IsExistActor(preferredUsername string) (*pb.IsExistResponse, error)

func (*Svc) IsExistDevice

func (svc *Svc) IsExistDevice(deviceId int64) (*pb.IsExistResponse, error)

func (*Svc) IsRemoteExist

func (svc *Svc) IsRemoteExist(preferredUsername, domain string) (*pb.IsExistResponse, error)

func (*Svc) SetAuthPublicKey

func (svc *Svc) SetAuthPublicKey(accountId int64, publicKey string) (*pb.SetPublicKeyResponse, error)

func (*Svc) Verify

func (svc *Svc) Verify(username, password string) (*pb.VerifyResponse, error)

Jump to

Keyboard shortcuts

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