v1

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_account_service_proto protoreflect.FileDescriptor
View Source
var File_auth_service_proto protoreflect.FileDescriptor

Functions

func RegisterAccountServiceHandler

func RegisterAccountServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterAccountServiceHandler registers the http handlers for service AccountService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterAccountServiceHandlerClient

func RegisterAccountServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AccountServiceClient) error

RegisterAccountServiceHandlerClient registers the http handlers for service AccountService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AccountServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AccountServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "AccountServiceClient" to call the correct interceptors.

func RegisterAccountServiceHandlerFromEndpoint

func RegisterAccountServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterAccountServiceHandlerFromEndpoint is same as RegisterAccountServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterAccountServiceHandlerServer

func RegisterAccountServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AccountServiceServer) error

RegisterAccountServiceHandlerServer registers the http handlers for service AccountService to "mux". UnaryRPC :call AccountServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAccountServiceHandlerFromEndpoint instead.

func RegisterAccountServiceServer

func RegisterAccountServiceServer(s *grpc.Server, srv AccountServiceServer)

func RegisterAuthServiceServer

func RegisterAuthServiceServer(s *grpc.Server, srv AuthServiceServer)

Types

type Account

type Account struct {

	// Unique integer identifier of the account
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// Owner of the task
	Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"`
	// Balance
	Balance int64 `protobuf:"varint,3,opt,name=balance,proto3" json:"balance,omitempty"`
	// Currency
	Currency string `protobuf:"bytes,4,opt,name=currency,proto3" json:"currency,omitempty"`
	// Account created on
	CreatedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
	// contains filtered or unexported fields
}

Task we have to do

func (*Account) Descriptor deprecated

func (*Account) Descriptor() ([]byte, []int)

Deprecated: Use Account.ProtoReflect.Descriptor instead.

func (*Account) GetBalance

func (x *Account) GetBalance() int64

func (*Account) GetCreatedAt

func (x *Account) GetCreatedAt() *timestamppb.Timestamp

func (*Account) GetCurrency

func (x *Account) GetCurrency() string

func (*Account) GetId

func (x *Account) GetId() int64

func (*Account) GetOwner

func (x *Account) GetOwner() string

func (*Account) ProtoMessage

func (*Account) ProtoMessage()

func (*Account) ProtoReflect

func (x *Account) ProtoReflect() protoreflect.Message

func (*Account) Reset

func (x *Account) Reset()

func (*Account) String

func (x *Account) String() string

type AccountServiceClient

type AccountServiceClient interface {
	// Read all accounts
	ReadAll(ctx context.Context, in *ReadAllRequest, opts ...grpc.CallOption) (*ReadAllResponse, error)
	// Create new account
	Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
	// Read account
	Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error)
	// Update account
	Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*UpdateResponse, error)
	// Delete account
	Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
}

AccountServiceClient is the client API for AccountService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

type AccountServiceServer

type AccountServiceServer interface {
	// Read all accounts
	ReadAll(context.Context, *ReadAllRequest) (*ReadAllResponse, error)
	// Create new account
	Create(context.Context, *CreateRequest) (*CreateResponse, error)
	// Read account
	Read(context.Context, *ReadRequest) (*ReadResponse, error)
	// Update account
	Update(context.Context, *UpdateRequest) (*UpdateResponse, error)
	// Delete account
	Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
}

AccountServiceServer is the server API for AccountService service.

type AuthServiceClient

type AuthServiceClient interface {
	Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error)
}

AuthServiceClient is the client API for AuthService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

type AuthServiceServer

type AuthServiceServer interface {
	Login(context.Context, *LoginRequest) (*LoginResponse, error)
}

AuthServiceServer is the server API for AuthService service.

type CreateRequest

type CreateRequest struct {

	// API versioning: it is my best practice to specify version explicitly
	Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"`
	// Task entity to add
	Account *Account `protobuf:"bytes,2,opt,name=account,proto3" json:"account,omitempty"`
	// contains filtered or unexported fields
}

Request data to create new account

func (*CreateRequest) Descriptor deprecated

func (*CreateRequest) Descriptor() ([]byte, []int)

Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.

func (*CreateRequest) GetAccount

func (x *CreateRequest) GetAccount() *Account

func (*CreateRequest) GetApi

func (x *CreateRequest) GetApi() string

func (*CreateRequest) ProtoMessage

func (*CreateRequest) ProtoMessage()

func (*CreateRequest) ProtoReflect

func (x *CreateRequest) ProtoReflect() protoreflect.Message

func (*CreateRequest) Reset

func (x *CreateRequest) Reset()

func (*CreateRequest) String

func (x *CreateRequest) String() string

type CreateResponse

type CreateResponse struct {

	// API versioning: it is my best practice to specify version explicitly
	Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"`
	// ID of created task
	Account *Account `protobuf:"bytes,2,opt,name=account,proto3" json:"account,omitempty"`
	// contains filtered or unexported fields
}

Contains data of created account

func (*CreateResponse) Descriptor deprecated

func (*CreateResponse) Descriptor() ([]byte, []int)

Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead.

func (*CreateResponse) GetAccount

func (x *CreateResponse) GetAccount() *Account

func (*CreateResponse) GetApi

func (x *CreateResponse) GetApi() string

func (*CreateResponse) ProtoMessage

func (*CreateResponse) ProtoMessage()

func (*CreateResponse) ProtoReflect

func (x *CreateResponse) ProtoReflect() protoreflect.Message

func (*CreateResponse) Reset

func (x *CreateResponse) Reset()

func (*CreateResponse) String

func (x *CreateResponse) String() string

type DeleteRequest

type DeleteRequest struct {

	// API versioning: it is my best practice to specify version explicitly
	Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"`
	// Unique integer identifier of the account to delete
	Id int64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

Request data to delete account

func (*DeleteRequest) Descriptor deprecated

func (*DeleteRequest) Descriptor() ([]byte, []int)

Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.

func (*DeleteRequest) GetApi

func (x *DeleteRequest) GetApi() string

func (*DeleteRequest) GetId

func (x *DeleteRequest) GetId() int64

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) ProtoReflect

func (x *DeleteRequest) ProtoReflect() protoreflect.Message

func (*DeleteRequest) Reset

func (x *DeleteRequest) Reset()

func (*DeleteRequest) String

func (x *DeleteRequest) String() string

type DeleteResponse

type DeleteResponse struct {

	// API versioning: it is my best practice to specify version explicitly
	Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"`
	// Contains number of entities have beed deleted
	// Equals 1 in case of succesfull delete
	Deleted int64 `protobuf:"varint,2,opt,name=deleted,proto3" json:"deleted,omitempty"`
	// contains filtered or unexported fields
}

Contains status of delete operation

func (*DeleteResponse) Descriptor deprecated

func (*DeleteResponse) Descriptor() ([]byte, []int)

Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead.

func (*DeleteResponse) GetApi

func (x *DeleteResponse) GetApi() string

func (*DeleteResponse) GetDeleted

func (x *DeleteResponse) GetDeleted() int64

func (*DeleteResponse) ProtoMessage

func (*DeleteResponse) ProtoMessage()

func (*DeleteResponse) ProtoReflect

func (x *DeleteResponse) ProtoReflect() protoreflect.Message

func (*DeleteResponse) Reset

func (x *DeleteResponse) Reset()

func (*DeleteResponse) String

func (x *DeleteResponse) String() string

type LoginRequest

type LoginRequest struct {
	Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

func (*LoginRequest) Descriptor deprecated

func (*LoginRequest) Descriptor() ([]byte, []int)

Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead.

func (*LoginRequest) GetPassword

func (x *LoginRequest) GetPassword() string

func (*LoginRequest) GetUsername

func (x *LoginRequest) GetUsername() string

func (*LoginRequest) ProtoMessage

func (*LoginRequest) ProtoMessage()

func (*LoginRequest) ProtoReflect

func (x *LoginRequest) ProtoReflect() protoreflect.Message

func (*LoginRequest) Reset

func (x *LoginRequest) Reset()

func (*LoginRequest) String

func (x *LoginRequest) String() string

type LoginResponse

type LoginResponse struct {
	AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	// contains filtered or unexported fields
}

func (*LoginResponse) Descriptor deprecated

func (*LoginResponse) Descriptor() ([]byte, []int)

Deprecated: Use LoginResponse.ProtoReflect.Descriptor instead.

func (*LoginResponse) GetAccessToken

func (x *LoginResponse) GetAccessToken() string

func (*LoginResponse) ProtoMessage

func (*LoginResponse) ProtoMessage()

func (*LoginResponse) ProtoReflect

func (x *LoginResponse) ProtoReflect() protoreflect.Message

func (*LoginResponse) Reset

func (x *LoginResponse) Reset()

func (*LoginResponse) String

func (x *LoginResponse) String() string

type ReadAllRequest

type ReadAllRequest struct {

	// API versioning: it is my best practice to specify version explicitly
	Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"`
	// contains filtered or unexported fields
}

Request data to read all account

func (*ReadAllRequest) Descriptor deprecated

func (*ReadAllRequest) Descriptor() ([]byte, []int)

Deprecated: Use ReadAllRequest.ProtoReflect.Descriptor instead.

func (*ReadAllRequest) GetApi

func (x *ReadAllRequest) GetApi() string

func (*ReadAllRequest) ProtoMessage

func (*ReadAllRequest) ProtoMessage()

func (*ReadAllRequest) ProtoReflect

func (x *ReadAllRequest) ProtoReflect() protoreflect.Message

func (*ReadAllRequest) Reset

func (x *ReadAllRequest) Reset()

func (*ReadAllRequest) String

func (x *ReadAllRequest) String() string

type ReadAllResponse

type ReadAllResponse struct {

	// API versioning: it is my best practice to specify version explicitly
	Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"`
	// List of all accounts
	Accounts []*Account `protobuf:"bytes,2,rep,name=accounts,proto3" json:"accounts,omitempty"`
	// contains filtered or unexported fields
}

Contains list of all accounts

func (*ReadAllResponse) Descriptor deprecated

func (*ReadAllResponse) Descriptor() ([]byte, []int)

Deprecated: Use ReadAllResponse.ProtoReflect.Descriptor instead.

func (*ReadAllResponse) GetAccounts

func (x *ReadAllResponse) GetAccounts() []*Account

func (*ReadAllResponse) GetApi

func (x *ReadAllResponse) GetApi() string

func (*ReadAllResponse) ProtoMessage

func (*ReadAllResponse) ProtoMessage()

func (*ReadAllResponse) ProtoReflect

func (x *ReadAllResponse) ProtoReflect() protoreflect.Message

func (*ReadAllResponse) Reset

func (x *ReadAllResponse) Reset()

func (*ReadAllResponse) String

func (x *ReadAllResponse) String() string

type ReadRequest

type ReadRequest struct {

	// API versioning: it is my best practice to specify version explicitly
	Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"`
	// Unique integer identifier of the account
	Id int64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

Request data to read account

func (*ReadRequest) Descriptor deprecated

func (*ReadRequest) Descriptor() ([]byte, []int)

Deprecated: Use ReadRequest.ProtoReflect.Descriptor instead.

func (*ReadRequest) GetApi

func (x *ReadRequest) GetApi() string

func (*ReadRequest) GetId

func (x *ReadRequest) GetId() int64

func (*ReadRequest) ProtoMessage

func (*ReadRequest) ProtoMessage()

func (*ReadRequest) ProtoReflect

func (x *ReadRequest) ProtoReflect() protoreflect.Message

func (*ReadRequest) Reset

func (x *ReadRequest) Reset()

func (*ReadRequest) String

func (x *ReadRequest) String() string

type ReadResponse

type ReadResponse struct {

	// API versioning: it is my best practice to specify version explicitly
	Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"`
	// Task entity read by ID
	Account *Account `protobuf:"bytes,2,opt,name=account,proto3" json:"account,omitempty"`
	// contains filtered or unexported fields
}

Contains account data specified in by ID request

func (*ReadResponse) Descriptor deprecated

func (*ReadResponse) Descriptor() ([]byte, []int)

Deprecated: Use ReadResponse.ProtoReflect.Descriptor instead.

func (*ReadResponse) GetAccount

func (x *ReadResponse) GetAccount() *Account

func (*ReadResponse) GetApi

func (x *ReadResponse) GetApi() string

func (*ReadResponse) ProtoMessage

func (*ReadResponse) ProtoMessage()

func (*ReadResponse) ProtoReflect

func (x *ReadResponse) ProtoReflect() protoreflect.Message

func (*ReadResponse) Reset

func (x *ReadResponse) Reset()

func (*ReadResponse) String

func (x *ReadResponse) String() string

type UnimplementedAccountServiceServer

type UnimplementedAccountServiceServer struct {
}

UnimplementedAccountServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedAccountServiceServer) Create

func (*UnimplementedAccountServiceServer) Delete

func (*UnimplementedAccountServiceServer) Read

func (*UnimplementedAccountServiceServer) ReadAll

func (*UnimplementedAccountServiceServer) Update

type UnimplementedAuthServiceServer

type UnimplementedAuthServiceServer struct {
}

UnimplementedAuthServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedAuthServiceServer) Login

type UpdateRequest

type UpdateRequest struct {

	// API versioning: it is my best practice to specify version explicitly
	Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"`
	// Task entity to update
	Account *Account `protobuf:"bytes,2,opt,name=account,proto3" json:"account,omitempty"`
	// contains filtered or unexported fields
}

Request data to update account

func (*UpdateRequest) Descriptor deprecated

func (*UpdateRequest) Descriptor() ([]byte, []int)

Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead.

func (*UpdateRequest) GetAccount

func (x *UpdateRequest) GetAccount() *Account

func (*UpdateRequest) GetApi

func (x *UpdateRequest) GetApi() string

func (*UpdateRequest) ProtoMessage

func (*UpdateRequest) ProtoMessage()

func (*UpdateRequest) ProtoReflect

func (x *UpdateRequest) ProtoReflect() protoreflect.Message

func (*UpdateRequest) Reset

func (x *UpdateRequest) Reset()

func (*UpdateRequest) String

func (x *UpdateRequest) String() string

type UpdateResponse

type UpdateResponse struct {

	// API versioning: it is my best practice to specify version explicitly
	Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"`
	// Contains number of entities have beed updated
	// Equals 1 in case of succesfull update
	Updated int64 `protobuf:"varint,2,opt,name=updated,proto3" json:"updated,omitempty"`
	// contains filtered or unexported fields
}

Contains status of update operation

func (*UpdateResponse) Descriptor deprecated

func (*UpdateResponse) Descriptor() ([]byte, []int)

Deprecated: Use UpdateResponse.ProtoReflect.Descriptor instead.

func (*UpdateResponse) GetApi

func (x *UpdateResponse) GetApi() string

func (*UpdateResponse) GetUpdated

func (x *UpdateResponse) GetUpdated() int64

func (*UpdateResponse) ProtoMessage

func (*UpdateResponse) ProtoMessage()

func (*UpdateResponse) ProtoReflect

func (x *UpdateResponse) ProtoReflect() protoreflect.Message

func (*UpdateResponse) Reset

func (x *UpdateResponse) Reset()

func (*UpdateResponse) String

func (x *UpdateResponse) String() string

Jump to

Keyboard shortcuts

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