Skip to content

Commit

Permalink
update client
Browse files Browse the repository at this point in the history
  • Loading branch information
ksbomj committed May 23, 2023
1 parent 801b3ca commit df1c81d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
12 changes: 6 additions & 6 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,41 @@ package client
import (
"context"

acc "github.com/obada-foundation/registry/api/pb/v1/account"
"github.com/obada-foundation/registry/api/pb/v1/account"
"github.com/obada-foundation/registry/api/pb/v1/diddoc"
"google.golang.org/grpc"
)

// Client is allows communication with grpc server
type Client interface {
acc.AccountClient
account.AccountClient
diddoc.DIDDocClient

Close() error
}

type grpcClient struct {
cc *grpc.ClientConn
account acc.AccountClient
account account.AccountClient
diddoc diddoc.DIDDocClient
}

// NewClient creates a new instance of Client
func NewClient(conn *grpc.ClientConn) Client {
return grpcClient{
cc: conn,
account: acc.NewAccountClient(conn),
account: account.NewAccountClient(conn),
diddoc: diddoc.NewDIDDocClient(conn),
}
}

// GetPublicKey register a new public key
func (c grpcClient) GetPublicKey(ctx context.Context, msg *acc.GetPublicKeyRequest, opts ...grpc.CallOption) (*acc.GetPublicKeyResponse, error) {
func (c grpcClient) GetPublicKey(ctx context.Context, msg *account.GetPublicKeyRequest, opts ...grpc.CallOption) (*account.GetPublicKeyResponse, error) {
return c.account.GetPublicKey(ctx, msg, opts...)
}

// RegisterAccount register a new public key
func (c grpcClient) RegisterAccount(ctx context.Context, msg *acc.RegisterAccountRequest, opts ...grpc.CallOption) (*acc.RegisterAccountResponse, error) {
func (c grpcClient) RegisterAccount(ctx context.Context, msg *account.RegisterAccountRequest, opts ...grpc.CallOption) (*account.RegisterAccountResponse, error) {
return c.account.RegisterAccount(ctx, msg, opts...)
}

Expand Down
20 changes: 20 additions & 0 deletions client/mock/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit df1c81d

Please sign in to comment.