Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterWeatherServer(s grpc.ServiceRegistrar, srv WeatherServer)
- func WriteError(resp http.ResponseWriter, err error)
- type HTTPClient
- type Location
- type TemperatureRange
- func (*TemperatureRange) Descriptor() ([]byte, []int)deprecated
- func (x *TemperatureRange) GetMax() float64
- func (x *TemperatureRange) GetMin() float64
- func (*TemperatureRange) ProtoMessage()
- func (x *TemperatureRange) ProtoReflect() protoreflect.Message
- func (x *TemperatureRange) Reset()
- func (x *TemperatureRange) String() string
- type TwirpServer
- type UnimplementedWeatherServer
- type UnsafeWeatherServer
- type Weather
- type WeatherClient
- type WeatherCurrent
- func (*WeatherCurrent) Descriptor() ([]byte, []int)deprecated
- func (x *WeatherCurrent) GetHumidity() int32
- func (x *WeatherCurrent) GetIcon() string
- func (x *WeatherCurrent) GetTemperature() float64
- func (x *WeatherCurrent) GetTimestamp() uint64
- func (x *WeatherCurrent) GetWeather() WeatherType
- func (x *WeatherCurrent) GetWindSpeed() float64
- func (*WeatherCurrent) ProtoMessage()
- func (x *WeatherCurrent) ProtoReflect() protoreflect.Message
- func (x *WeatherCurrent) Reset()
- func (x *WeatherCurrent) String() string
- type WeatherDailyPoint
- func (*WeatherDailyPoint) Descriptor() ([]byte, []int)deprecated
- func (x *WeatherDailyPoint) GetHumidity() int32
- func (x *WeatherDailyPoint) GetIcon() string
- func (x *WeatherDailyPoint) GetTemperature() float64
- func (x *WeatherDailyPoint) GetTemperatureRange() *TemperatureRange
- func (x *WeatherDailyPoint) GetTimestamp() uint64
- func (x *WeatherDailyPoint) GetWeather() WeatherType
- func (*WeatherDailyPoint) ProtoMessage()
- func (x *WeatherDailyPoint) ProtoReflect() protoreflect.Message
- func (x *WeatherDailyPoint) Reset()
- func (x *WeatherDailyPoint) String() string
- type WeatherFilter
- func (*WeatherFilter) Descriptor() ([]byte, []int)deprecated
- func (x *WeatherFilter) GetLatitude() float64
- func (x *WeatherFilter) GetLocationCityName() string
- func (x *WeatherFilter) GetLongitude() float64
- func (*WeatherFilter) ProtoMessage()
- func (x *WeatherFilter) ProtoReflect() protoreflect.Message
- func (x *WeatherFilter) Reset()
- func (x *WeatherFilter) String() string
- type WeatherReply
- func (*WeatherReply) Descriptor() ([]byte, []int)deprecated
- func (x *WeatherReply) GetWeatherCurrent() *WeatherCurrent
- func (x *WeatherReply) GetWeatherPoint() []*WeatherDailyPoint
- func (*WeatherReply) ProtoMessage()
- func (x *WeatherReply) ProtoReflect() protoreflect.Message
- func (x *WeatherReply) Reset()
- func (x *WeatherReply) String() string
- type WeatherRequest
- type WeatherServer
- type WeatherType
- func (WeatherType) Descriptor() protoreflect.EnumDescriptor
- func (x WeatherType) Enum() *WeatherType
- func (WeatherType) EnumDescriptor() ([]byte, []int)deprecated
- func (x WeatherType) Number() protoreflect.EnumNumber
- func (x WeatherType) String() string
- func (WeatherType) Type() protoreflect.EnumType
Constants ¶
const WeatherPathPrefix = "/twirp/endpoints.v1.Weather/"
WeatherPathPrefix is a convenience constant that may identify URL paths. Should be used with caution, it only matches routes generated by Twirp Go clients, with the default "/twirp" prefix and default CamelCase service and method names. More info: https://twitchtv.github.io/twirp/docs/routing.html
Variables ¶
var ( WeatherType_name = map[int32]string{ 0: "UNKNOWN", 1: "THUNDERSTORM", 2: "DRIZZLE", 3: "RAIN", 4: "SNOW", 5: "MIST", 6: "SMOKE", 7: "HAZE", 8: "DUST", 9: "FOG", 10: "SAND", 11: "ASH", 12: "SQUALL", 13: "TORNADO", 14: "CLEAR", 15: "CLOUDS", } WeatherType_value = map[string]int32{ "UNKNOWN": 0, "THUNDERSTORM": 1, "DRIZZLE": 2, "RAIN": 3, "SNOW": 4, "MIST": 5, "SMOKE": 6, "HAZE": 7, "DUST": 8, "FOG": 9, "SAND": 10, "ASH": 11, "SQUALL": 12, "TORNADO": 13, "CLEAR": 14, "CLOUDS": 15, } )
Enum value maps for WeatherType.
var File_endpoints_v1_proto protoreflect.FileDescriptor
var Weather_ServiceDesc = grpc.ServiceDesc{ ServiceName: "endpoints.v1.Weather", HandlerType: (*WeatherServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetWeather", Handler: _Weather_GetWeather_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "endpoints.v1.proto", }
Weather_ServiceDesc is the grpc.ServiceDesc for Weather service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterWeatherServer ¶
func RegisterWeatherServer(s grpc.ServiceRegistrar, srv WeatherServer)
func WriteError ¶
func WriteError(resp http.ResponseWriter, err error)
WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta). Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)
Types ¶
type HTTPClient ¶
HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.
HTTPClient implementations should not follow redirects. Redirects are automatically disabled if *(net/http).Client is passed to client constructors. See the withoutRedirects function in this file for more details.
type Location ¶
type Location struct {
// contains filtered or unexported fields
}
func (*Location) Descriptor
deprecated
func (*Location) ProtoMessage ¶
func (*Location) ProtoMessage()
func (*Location) ProtoReflect ¶
func (x *Location) ProtoReflect() protoreflect.Message
type TemperatureRange ¶
type TemperatureRange struct { Max float64 `protobuf:"fixed64,1,opt,name=max,proto3" json:"max,omitempty"` Min float64 `protobuf:"fixed64,2,opt,name=min,proto3" json:"min,omitempty"` // contains filtered or unexported fields }
func (*TemperatureRange) Descriptor
deprecated
func (*TemperatureRange) Descriptor() ([]byte, []int)
Deprecated: Use TemperatureRange.ProtoReflect.Descriptor instead.
func (*TemperatureRange) GetMax ¶
func (x *TemperatureRange) GetMax() float64
func (*TemperatureRange) GetMin ¶
func (x *TemperatureRange) GetMin() float64
func (*TemperatureRange) ProtoMessage ¶
func (*TemperatureRange) ProtoMessage()
func (*TemperatureRange) ProtoReflect ¶
func (x *TemperatureRange) ProtoReflect() protoreflect.Message
func (*TemperatureRange) Reset ¶
func (x *TemperatureRange) Reset()
func (*TemperatureRange) String ¶
func (x *TemperatureRange) String() string
type TwirpServer ¶
type TwirpServer interface { http.Handler // ServiceDescriptor returns gzipped bytes describing the .proto file that // this service was generated from. Once unzipped, the bytes can be // unmarshalled as a // google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto. // // The returned integer is the index of this particular service within that // FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a // low-level field, expected to be used for reflection. ServiceDescriptor() ([]byte, int) // ProtocGenTwirpVersion is the semantic version string of the version of // twirp used to generate this file. ProtocGenTwirpVersion() string // PathPrefix returns the HTTP URL path prefix for all methods handled by this // service. This can be used with an HTTP mux to route Twirp requests. // The path prefix is in the form: "/<prefix>/<package>.<Service>/" // that is, everything in a Twirp route except for the <Method> at the end. PathPrefix() string }
TwirpServer is the interface generated server structs will support: they're HTTP handlers with additional methods for accessing metadata about the service. Those accessors are a low-level API for building reflection tools. Most people can think of TwirpServers as just http.Handlers.
func NewWeatherServer ¶
func NewWeatherServer(svc Weather, opts ...interface{}) TwirpServer
NewWeatherServer builds a TwirpServer that can be used as an http.Handler to handle HTTP requests that are routed to the right method in the provided svc implementation. The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).
type UnimplementedWeatherServer ¶
type UnimplementedWeatherServer struct { }
UnimplementedWeatherServer should be embedded to have forward compatible implementations.
func (UnimplementedWeatherServer) GetWeather ¶
func (UnimplementedWeatherServer) GetWeather(context.Context, *WeatherRequest) (*WeatherReply, error)
type UnsafeWeatherServer ¶
type UnsafeWeatherServer interface {
// contains filtered or unexported methods
}
UnsafeWeatherServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to WeatherServer will result in compilation errors.
type Weather ¶
type Weather interface {
GetWeather(context.Context, *WeatherRequest) (*WeatherReply, error)
}
func NewWeatherJSONClient ¶
func NewWeatherJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Weather
NewWeatherJSONClient creates a JSON client that implements the Weather interface. It communicates using JSON and can be configured with a custom HTTPClient.
func NewWeatherProtobufClient ¶
func NewWeatherProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Weather
NewWeatherProtobufClient creates a Protobuf client that implements the Weather interface. It communicates using Protobuf and can be configured with a custom HTTPClient.
type WeatherClient ¶
type WeatherClient interface {
GetWeather(ctx context.Context, in *WeatherRequest, opts ...grpc.CallOption) (*WeatherReply, error)
}
WeatherClient is the client API for Weather service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewWeatherClient ¶
func NewWeatherClient(cc grpc.ClientConnInterface) WeatherClient
type WeatherCurrent ¶
type WeatherCurrent struct { Temperature float64 `protobuf:"fixed64,1,opt,name=temperature,proto3" json:"temperature,omitempty"` WindSpeed float64 `protobuf:"fixed64,2,opt,name=windSpeed,proto3" json:"windSpeed,omitempty"` Timestamp uint64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` Humidity int32 `protobuf:"varint,4,opt,name=humidity,proto3" json:"humidity,omitempty"` Weather WeatherType `protobuf:"varint,5,opt,name=weather,proto3,enum=endpoints.v1.WeatherType" json:"weather,omitempty"` Icon string `protobuf:"bytes,6,opt,name=icon,proto3" json:"icon,omitempty"` // contains filtered or unexported fields }
func (*WeatherCurrent) Descriptor
deprecated
func (*WeatherCurrent) Descriptor() ([]byte, []int)
Deprecated: Use WeatherCurrent.ProtoReflect.Descriptor instead.
func (*WeatherCurrent) GetHumidity ¶
func (x *WeatherCurrent) GetHumidity() int32
func (*WeatherCurrent) GetIcon ¶
func (x *WeatherCurrent) GetIcon() string
func (*WeatherCurrent) GetTemperature ¶
func (x *WeatherCurrent) GetTemperature() float64
func (*WeatherCurrent) GetTimestamp ¶
func (x *WeatherCurrent) GetTimestamp() uint64
func (*WeatherCurrent) GetWeather ¶
func (x *WeatherCurrent) GetWeather() WeatherType
func (*WeatherCurrent) GetWindSpeed ¶
func (x *WeatherCurrent) GetWindSpeed() float64
func (*WeatherCurrent) ProtoMessage ¶
func (*WeatherCurrent) ProtoMessage()
func (*WeatherCurrent) ProtoReflect ¶
func (x *WeatherCurrent) ProtoReflect() protoreflect.Message
func (*WeatherCurrent) Reset ¶
func (x *WeatherCurrent) Reset()
func (*WeatherCurrent) String ¶
func (x *WeatherCurrent) String() string
type WeatherDailyPoint ¶
type WeatherDailyPoint struct { Timestamp uint64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` Temperature float64 `protobuf:"fixed64,2,opt,name=temperature,proto3" json:"temperature,omitempty"` Humidity int32 `protobuf:"varint,3,opt,name=humidity,proto3" json:"humidity,omitempty"` TemperatureRange *TemperatureRange `protobuf:"bytes,4,opt,name=temperatureRange,proto3" json:"temperatureRange,omitempty"` Weather WeatherType `protobuf:"varint,5,opt,name=weather,proto3,enum=endpoints.v1.WeatherType" json:"weather,omitempty"` Icon string `protobuf:"bytes,6,opt,name=icon,proto3" json:"icon,omitempty"` // contains filtered or unexported fields }
func (*WeatherDailyPoint) Descriptor
deprecated
func (*WeatherDailyPoint) Descriptor() ([]byte, []int)
Deprecated: Use WeatherDailyPoint.ProtoReflect.Descriptor instead.
func (*WeatherDailyPoint) GetHumidity ¶
func (x *WeatherDailyPoint) GetHumidity() int32
func (*WeatherDailyPoint) GetIcon ¶
func (x *WeatherDailyPoint) GetIcon() string
func (*WeatherDailyPoint) GetTemperature ¶
func (x *WeatherDailyPoint) GetTemperature() float64
func (*WeatherDailyPoint) GetTemperatureRange ¶
func (x *WeatherDailyPoint) GetTemperatureRange() *TemperatureRange
func (*WeatherDailyPoint) GetTimestamp ¶
func (x *WeatherDailyPoint) GetTimestamp() uint64
func (*WeatherDailyPoint) GetWeather ¶
func (x *WeatherDailyPoint) GetWeather() WeatherType
func (*WeatherDailyPoint) ProtoMessage ¶
func (*WeatherDailyPoint) ProtoMessage()
func (*WeatherDailyPoint) ProtoReflect ¶
func (x *WeatherDailyPoint) ProtoReflect() protoreflect.Message
func (*WeatherDailyPoint) Reset ¶
func (x *WeatherDailyPoint) Reset()
func (*WeatherDailyPoint) String ¶
func (x *WeatherDailyPoint) String() string
type WeatherFilter ¶
type WeatherFilter struct { LocationCityName *string `protobuf:"bytes,1,opt,name=locationCityName,proto3,oneof" json:"locationCityName,omitempty"` Latitude float64 `protobuf:"fixed64,2,opt,name=latitude,proto3" json:"latitude,omitempty"` Longitude float64 `protobuf:"fixed64,3,opt,name=longitude,proto3" json:"longitude,omitempty"` // contains filtered or unexported fields }
func (*WeatherFilter) Descriptor
deprecated
func (*WeatherFilter) Descriptor() ([]byte, []int)
Deprecated: Use WeatherFilter.ProtoReflect.Descriptor instead.
func (*WeatherFilter) GetLatitude ¶
func (x *WeatherFilter) GetLatitude() float64
func (*WeatherFilter) GetLocationCityName ¶
func (x *WeatherFilter) GetLocationCityName() string
func (*WeatherFilter) GetLongitude ¶
func (x *WeatherFilter) GetLongitude() float64
func (*WeatherFilter) ProtoMessage ¶
func (*WeatherFilter) ProtoMessage()
func (*WeatherFilter) ProtoReflect ¶
func (x *WeatherFilter) ProtoReflect() protoreflect.Message
func (*WeatherFilter) Reset ¶
func (x *WeatherFilter) Reset()
func (*WeatherFilter) String ¶
func (x *WeatherFilter) String() string
type WeatherReply ¶
type WeatherReply struct { WeatherPoint []*WeatherDailyPoint `protobuf:"bytes,1,rep,name=weatherPoint,proto3" json:"weatherPoint,omitempty"` WeatherCurrent *WeatherCurrent `protobuf:"bytes,2,opt,name=weatherCurrent,proto3" json:"weatherCurrent,omitempty"` // contains filtered or unexported fields }
func (*WeatherReply) Descriptor
deprecated
func (*WeatherReply) Descriptor() ([]byte, []int)
Deprecated: Use WeatherReply.ProtoReflect.Descriptor instead.
func (*WeatherReply) GetWeatherCurrent ¶
func (x *WeatherReply) GetWeatherCurrent() *WeatherCurrent
func (*WeatherReply) GetWeatherPoint ¶
func (x *WeatherReply) GetWeatherPoint() []*WeatherDailyPoint
func (*WeatherReply) ProtoMessage ¶
func (*WeatherReply) ProtoMessage()
func (*WeatherReply) ProtoReflect ¶
func (x *WeatherReply) ProtoReflect() protoreflect.Message
func (*WeatherReply) Reset ¶
func (x *WeatherReply) Reset()
func (*WeatherReply) String ¶
func (x *WeatherReply) String() string
type WeatherRequest ¶
type WeatherRequest struct { WeatherFilter *WeatherFilter `protobuf:"bytes,1,opt,name=weatherFilter,proto3,oneof" json:"weatherFilter,omitempty"` // contains filtered or unexported fields }
func (*WeatherRequest) Descriptor
deprecated
func (*WeatherRequest) Descriptor() ([]byte, []int)
Deprecated: Use WeatherRequest.ProtoReflect.Descriptor instead.
func (*WeatherRequest) GetWeatherFilter ¶
func (x *WeatherRequest) GetWeatherFilter() *WeatherFilter
func (*WeatherRequest) ProtoMessage ¶
func (*WeatherRequest) ProtoMessage()
func (*WeatherRequest) ProtoReflect ¶
func (x *WeatherRequest) ProtoReflect() protoreflect.Message
func (*WeatherRequest) Reset ¶
func (x *WeatherRequest) Reset()
func (*WeatherRequest) String ¶
func (x *WeatherRequest) String() string
type WeatherServer ¶
type WeatherServer interface {
GetWeather(context.Context, *WeatherRequest) (*WeatherReply, error)
}
WeatherServer is the server API for Weather service. All implementations should embed UnimplementedWeatherServer for forward compatibility
type WeatherType ¶
type WeatherType int32
const ( WeatherType_UNKNOWN WeatherType = 0 WeatherType_THUNDERSTORM WeatherType = 1 WeatherType_DRIZZLE WeatherType = 2 WeatherType_RAIN WeatherType = 3 WeatherType_SNOW WeatherType = 4 WeatherType_MIST WeatherType = 5 WeatherType_SMOKE WeatherType = 6 WeatherType_HAZE WeatherType = 7 WeatherType_DUST WeatherType = 8 WeatherType_FOG WeatherType = 9 WeatherType_SAND WeatherType = 10 WeatherType_ASH WeatherType = 11 WeatherType_SQUALL WeatherType = 12 WeatherType_TORNADO WeatherType = 13 WeatherType_CLEAR WeatherType = 14 WeatherType_CLOUDS WeatherType = 15 )
func (WeatherType) Descriptor ¶
func (WeatherType) Descriptor() protoreflect.EnumDescriptor
func (WeatherType) Enum ¶
func (x WeatherType) Enum() *WeatherType
func (WeatherType) EnumDescriptor
deprecated
func (WeatherType) EnumDescriptor() ([]byte, []int)
Deprecated: Use WeatherType.Descriptor instead.
func (WeatherType) Number ¶
func (x WeatherType) Number() protoreflect.EnumNumber
func (WeatherType) String ¶
func (x WeatherType) String() string
func (WeatherType) Type ¶
func (WeatherType) Type() protoreflect.EnumType