Documentation ¶
Index ¶
- Variables
- func NewCurrencyEndpoints() []*api.Endpoint
- func RegisterCurrencyHandler(s server.Server, hdlr CurrencyHandler, opts ...server.HandlerOption) error
- type Code
- type CodesRequest
- type CodesResponse
- type ConvertRequest
- func (*ConvertRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ConvertRequest) GetAmount() float64
- func (x *ConvertRequest) GetFrom() string
- func (x *ConvertRequest) GetTo() string
- func (*ConvertRequest) ProtoMessage()
- func (x *ConvertRequest) ProtoReflect() protoreflect.Message
- func (x *ConvertRequest) Reset()
- func (x *ConvertRequest) String() string
- type ConvertResponse
- func (*ConvertResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ConvertResponse) GetAmount() float64
- func (x *ConvertResponse) GetFrom() string
- func (x *ConvertResponse) GetRate() float64
- func (x *ConvertResponse) GetTo() string
- func (*ConvertResponse) ProtoMessage()
- func (x *ConvertResponse) ProtoReflect() protoreflect.Message
- func (x *ConvertResponse) Reset()
- func (x *ConvertResponse) String() string
- type CurrencyHandler
- type CurrencyService
- type HistoryRequest
- func (*HistoryRequest) Descriptor() ([]byte, []int)deprecated
- func (x *HistoryRequest) GetCode() string
- func (x *HistoryRequest) GetDate() string
- func (*HistoryRequest) ProtoMessage()
- func (x *HistoryRequest) ProtoReflect() protoreflect.Message
- func (x *HistoryRequest) Reset()
- func (x *HistoryRequest) String() string
- type HistoryResponse
- func (*HistoryResponse) Descriptor() ([]byte, []int)deprecated
- func (x *HistoryResponse) GetCode() string
- func (x *HistoryResponse) GetDate() string
- func (x *HistoryResponse) GetRates() map[string]float64
- func (*HistoryResponse) ProtoMessage()
- func (x *HistoryResponse) ProtoReflect() protoreflect.Message
- func (x *HistoryResponse) Reset()
- func (x *HistoryResponse) String() string
- type RatesRequest
- type RatesResponse
- func (*RatesResponse) Descriptor() ([]byte, []int)deprecated
- func (x *RatesResponse) GetCode() string
- func (x *RatesResponse) GetRates() map[string]float64
- func (*RatesResponse) ProtoMessage()
- func (x *RatesResponse) ProtoReflect() protoreflect.Message
- func (x *RatesResponse) Reset()
- func (x *RatesResponse) String() string
Constants ¶
This section is empty.
Variables ¶
var File_proto_currency_proto protoreflect.FileDescriptor
Functions ¶
func NewCurrencyEndpoints ¶
func RegisterCurrencyHandler ¶
func RegisterCurrencyHandler(s server.Server, hdlr CurrencyHandler, opts ...server.HandlerOption) error
Types ¶
type Code ¶
type Code struct { // e.g USD Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // e.g United States Dollar Currency string `protobuf:"bytes,2,opt,name=currency,proto3" json:"currency,omitempty"` // contains filtered or unexported fields }
func (*Code) Descriptor
deprecated
func (*Code) GetCurrency ¶
func (*Code) ProtoMessage ¶
func (*Code) ProtoMessage()
func (*Code) ProtoReflect ¶
func (x *Code) ProtoReflect() protoreflect.Message
type CodesRequest ¶
type CodesRequest struct {
// contains filtered or unexported fields
}
Codes returns the supported currency codes for the API
func (*CodesRequest) Descriptor
deprecated
func (*CodesRequest) Descriptor() ([]byte, []int)
Deprecated: Use CodesRequest.ProtoReflect.Descriptor instead.
func (*CodesRequest) ProtoMessage ¶
func (*CodesRequest) ProtoMessage()
func (*CodesRequest) ProtoReflect ¶
func (x *CodesRequest) ProtoReflect() protoreflect.Message
func (*CodesRequest) Reset ¶
func (x *CodesRequest) Reset()
func (*CodesRequest) String ¶
func (x *CodesRequest) String() string
type CodesResponse ¶
type CodesResponse struct { Codes []*Code `protobuf:"bytes,1,rep,name=codes,proto3" json:"codes,omitempty"` // contains filtered or unexported fields }
func (*CodesResponse) Descriptor
deprecated
func (*CodesResponse) Descriptor() ([]byte, []int)
Deprecated: Use CodesResponse.ProtoReflect.Descriptor instead.
func (*CodesResponse) GetCodes ¶
func (x *CodesResponse) GetCodes() []*Code
func (*CodesResponse) ProtoMessage ¶
func (*CodesResponse) ProtoMessage()
func (*CodesResponse) ProtoReflect ¶
func (x *CodesResponse) ProtoReflect() protoreflect.Message
func (*CodesResponse) Reset ¶
func (x *CodesResponse) Reset()
func (*CodesResponse) String ¶
func (x *CodesResponse) String() string
type ConvertRequest ¶
type ConvertRequest struct { // base code to convert from e.g USD From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` // target code to convert to e.g GBP To string `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"` // optional amount to convert e.g 10.0 Amount float64 `protobuf:"fixed64,3,opt,name=amount,proto3" json:"amount,omitempty"` // contains filtered or unexported fields }
Convert returns the currency conversion rate between two pairs e.g USD/GBP
func (*ConvertRequest) Descriptor
deprecated
func (*ConvertRequest) Descriptor() ([]byte, []int)
Deprecated: Use ConvertRequest.ProtoReflect.Descriptor instead.
func (*ConvertRequest) GetAmount ¶
func (x *ConvertRequest) GetAmount() float64
func (*ConvertRequest) GetFrom ¶
func (x *ConvertRequest) GetFrom() string
func (*ConvertRequest) GetTo ¶
func (x *ConvertRequest) GetTo() string
func (*ConvertRequest) ProtoMessage ¶
func (*ConvertRequest) ProtoMessage()
func (*ConvertRequest) ProtoReflect ¶
func (x *ConvertRequest) ProtoReflect() protoreflect.Message
func (*ConvertRequest) Reset ¶
func (x *ConvertRequest) Reset()
func (*ConvertRequest) String ¶
func (x *ConvertRequest) String() string
type ConvertResponse ¶
type ConvertResponse struct { // the base code e.g USD From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` // the target code e.g GBP To string `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"` // conversion rate e.g 0.71 Rate float64 `protobuf:"fixed64,3,opt,name=rate,proto3" json:"rate,omitempty"` // converted amount e.g 7.10 Amount float64 `protobuf:"fixed64,4,opt,name=amount,proto3" json:"amount,omitempty"` // contains filtered or unexported fields }
func (*ConvertResponse) Descriptor
deprecated
func (*ConvertResponse) Descriptor() ([]byte, []int)
Deprecated: Use ConvertResponse.ProtoReflect.Descriptor instead.
func (*ConvertResponse) GetAmount ¶
func (x *ConvertResponse) GetAmount() float64
func (*ConvertResponse) GetFrom ¶
func (x *ConvertResponse) GetFrom() string
func (*ConvertResponse) GetRate ¶
func (x *ConvertResponse) GetRate() float64
func (*ConvertResponse) GetTo ¶
func (x *ConvertResponse) GetTo() string
func (*ConvertResponse) ProtoMessage ¶
func (*ConvertResponse) ProtoMessage()
func (*ConvertResponse) ProtoReflect ¶
func (x *ConvertResponse) ProtoReflect() protoreflect.Message
func (*ConvertResponse) Reset ¶
func (x *ConvertResponse) Reset()
func (*ConvertResponse) String ¶
func (x *ConvertResponse) String() string
type CurrencyHandler ¶
type CurrencyHandler interface { Codes(context.Context, *CodesRequest, *CodesResponse) error Rates(context.Context, *RatesRequest, *RatesResponse) error Convert(context.Context, *ConvertRequest, *ConvertResponse) error History(context.Context, *HistoryRequest, *HistoryResponse) error }
type CurrencyService ¶
type CurrencyService interface { Codes(ctx context.Context, in *CodesRequest, opts ...client.CallOption) (*CodesResponse, error) Rates(ctx context.Context, in *RatesRequest, opts ...client.CallOption) (*RatesResponse, error) Convert(ctx context.Context, in *ConvertRequest, opts ...client.CallOption) (*ConvertResponse, error) History(ctx context.Context, in *HistoryRequest, opts ...client.CallOption) (*HistoryResponse, error) }
func NewCurrencyService ¶
func NewCurrencyService(name string, c client.Client) CurrencyService
type HistoryRequest ¶
type HistoryRequest struct { // currency code e.g USD Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` // date formatted as YYYY-MM-DD Date string `protobuf:"bytes,2,opt,name=date,proto3" json:"date,omitempty"` // contains filtered or unexported fields }
Returns the historic rates for a currency on a given date
func (*HistoryRequest) Descriptor
deprecated
func (*HistoryRequest) Descriptor() ([]byte, []int)
Deprecated: Use HistoryRequest.ProtoReflect.Descriptor instead.
func (*HistoryRequest) GetCode ¶
func (x *HistoryRequest) GetCode() string
func (*HistoryRequest) GetDate ¶
func (x *HistoryRequest) GetDate() string
func (*HistoryRequest) ProtoMessage ¶
func (*HistoryRequest) ProtoMessage()
func (*HistoryRequest) ProtoReflect ¶
func (x *HistoryRequest) ProtoReflect() protoreflect.Message
func (*HistoryRequest) Reset ¶
func (x *HistoryRequest) Reset()
func (*HistoryRequest) String ¶
func (x *HistoryRequest) String() string
type HistoryResponse ¶
type HistoryResponse struct { // The code of the request Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` // The date requested Date string `protobuf:"bytes,2,opt,name=date,proto3" json:"date,omitempty"` // The rate for the day as code:rate Rates map[string]float64 `` /* 153-byte string literal not displayed */ // contains filtered or unexported fields }
func (*HistoryResponse) Descriptor
deprecated
func (*HistoryResponse) Descriptor() ([]byte, []int)
Deprecated: Use HistoryResponse.ProtoReflect.Descriptor instead.
func (*HistoryResponse) GetCode ¶
func (x *HistoryResponse) GetCode() string
func (*HistoryResponse) GetDate ¶
func (x *HistoryResponse) GetDate() string
func (*HistoryResponse) GetRates ¶
func (x *HistoryResponse) GetRates() map[string]float64
func (*HistoryResponse) ProtoMessage ¶
func (*HistoryResponse) ProtoMessage()
func (*HistoryResponse) ProtoReflect ¶
func (x *HistoryResponse) ProtoReflect() protoreflect.Message
func (*HistoryResponse) Reset ¶
func (x *HistoryResponse) Reset()
func (*HistoryResponse) String ¶
func (x *HistoryResponse) String() string
type RatesRequest ¶
type RatesRequest struct { // The currency code to get rates for e.g USD Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` // contains filtered or unexported fields }
Rates returns the currency rates for a given code e.g USD
func (*RatesRequest) Descriptor
deprecated
func (*RatesRequest) Descriptor() ([]byte, []int)
Deprecated: Use RatesRequest.ProtoReflect.Descriptor instead.
func (*RatesRequest) GetCode ¶
func (x *RatesRequest) GetCode() string
func (*RatesRequest) ProtoMessage ¶
func (*RatesRequest) ProtoMessage()
func (*RatesRequest) ProtoReflect ¶
func (x *RatesRequest) ProtoReflect() protoreflect.Message
func (*RatesRequest) Reset ¶
func (x *RatesRequest) Reset()
func (*RatesRequest) String ¶
func (x *RatesRequest) String() string
type RatesResponse ¶
type RatesResponse struct { // The code requested e.g USD Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` // The rates for the given code as key-value pairs code:rate Rates map[string]float64 `` /* 153-byte string literal not displayed */ // contains filtered or unexported fields }
func (*RatesResponse) Descriptor
deprecated
func (*RatesResponse) Descriptor() ([]byte, []int)
Deprecated: Use RatesResponse.ProtoReflect.Descriptor instead.
func (*RatesResponse) GetCode ¶
func (x *RatesResponse) GetCode() string
func (*RatesResponse) GetRates ¶
func (x *RatesResponse) GetRates() map[string]float64
func (*RatesResponse) ProtoMessage ¶
func (*RatesResponse) ProtoMessage()
func (*RatesResponse) ProtoReflect ¶
func (x *RatesResponse) ProtoReflect() protoreflect.Message
func (*RatesResponse) Reset ¶
func (x *RatesResponse) Reset()
func (*RatesResponse) String ¶
func (x *RatesResponse) String() string