gidpb

package
v0.0.0-...-48c4086 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Overview

Package gidpb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Package gidpb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Package gidpb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const EchoServicePathPrefix = "/twirp/gid.EchoService/"

EchoServicePathPrefix 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

View Source
const IdPathPrefix = "/twirp/gid.Id/"

IdPathPrefix 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

View Source
const LoginServicePathPrefix = "/twirp/gid.LoginService/"

LoginServicePathPrefix 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

View Source
var EchoService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "gid.EchoService",
	HandlerType: (*EchoServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Echo",
			Handler:    _EchoService_Echo_Handler,
		},
		{
			MethodName: "EchoBody",
			Handler:    _EchoService_EchoBody_Handler,
		},
		{
			MethodName: "EchoDelete",
			Handler:    _EchoService_EchoDelete_Handler,
		},
		{
			MethodName: "EchoPatch",
			Handler:    _EchoService_EchoPatch_Handler,
		},
		{
			MethodName: "EchoUnauthorized",
			Handler:    _EchoService_EchoUnauthorized_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "gid/echo_service.proto",
}

EchoService_ServiceDesc is the grpc.ServiceDesc for EchoService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_gid_a_bit_of_everything_proto protoreflect.FileDescriptor
View Source
var File_gid_echo_service_proto protoreflect.FileDescriptor
View Source
var File_gid_id_proto protoreflect.FileDescriptor
View Source
var Id_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "gid.Id",
	HandlerType: (*IdServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Generate",
			Handler:    _Id_Generate_Handler,
		},
		{
			MethodName: "Types",
			Handler:    _Id_Types_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "gid/id.proto",
}

Id_ServiceDesc is the grpc.ServiceDesc for Id service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var LoginService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "gid.LoginService",
	HandlerType: (*LoginServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Login",
			Handler:    _LoginService_Login_Handler,
		},
		{
			MethodName: "Logout",
			Handler:    _LoginService_Logout_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "gid/a_bit_of_everything.proto",
}

LoginService_ServiceDesc is the grpc.ServiceDesc for LoginService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterEchoServiceHandler

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

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

func RegisterEchoServiceHandlerClient

func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EchoServiceClient) error

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

func RegisterEchoServiceHandlerFromEndpoint

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

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

func RegisterEchoServiceHandlerServer

func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServiceServer) error

RegisterEchoServiceHandlerServer registers the http handlers for service EchoService to "mux". UnaryRPC :call EchoServiceServer 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 RegisterEchoServiceHandlerFromEndpoint instead.

func RegisterEchoServiceServer

func RegisterEchoServiceServer(s grpc.ServiceRegistrar, srv EchoServiceServer)

func RegisterIdHandler

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

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

func RegisterIdHandlerClient

func RegisterIdHandlerClient(ctx context.Context, mux *runtime.ServeMux, client IdClient) error

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

func RegisterIdHandlerFromEndpoint

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

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

func RegisterIdHandlerServer

func RegisterIdHandlerServer(ctx context.Context, mux *runtime.ServeMux, server IdServer) error

RegisterIdHandlerServer registers the http handlers for service Id to "mux". UnaryRPC :call IdServer 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 RegisterIdHandlerFromEndpoint instead.

func RegisterIdServer

func RegisterIdServer(s grpc.ServiceRegistrar, srv IdServer)

func RegisterLoginServiceHandler

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

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

func RegisterLoginServiceHandlerClient

func RegisterLoginServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client LoginServiceClient) error

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

func RegisterLoginServiceHandlerFromEndpoint

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

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

func RegisterLoginServiceHandlerServer

func RegisterLoginServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LoginServiceServer) error

RegisterLoginServiceHandlerServer registers the http handlers for service LoginService to "mux". UnaryRPC :call LoginServiceServer 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 RegisterLoginServiceHandlerFromEndpoint instead.

func RegisterLoginServiceServer

func RegisterLoginServiceServer(s grpc.ServiceRegistrar, srv LoginServiceServer)

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 DynamicMessage

type DynamicMessage struct {
	StructField *structpb.Struct `protobuf:"bytes,1,opt,name=struct_field,json=structField,proto3" json:"struct_field,omitempty"`
	ValueField  *structpb.Value  `protobuf:"bytes,2,opt,name=value_field,json=valueField,proto3" json:"value_field,omitempty"`
	// contains filtered or unexported fields
}

DynamicMessage represents a message which can have its structure built dynamically using Struct and Values.

func (*DynamicMessage) Descriptor deprecated

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

Deprecated: Use DynamicMessage.ProtoReflect.Descriptor instead.

func (*DynamicMessage) GetStructField

func (x *DynamicMessage) GetStructField() *structpb.Struct

func (*DynamicMessage) GetValueField

func (x *DynamicMessage) GetValueField() *structpb.Value

func (*DynamicMessage) ProtoMessage

func (*DynamicMessage) ProtoMessage()

func (*DynamicMessage) ProtoReflect

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

func (*DynamicMessage) Reset

func (x *DynamicMessage) Reset()

func (*DynamicMessage) String

func (x *DynamicMessage) String() string

type DynamicMessageUpdate

type DynamicMessageUpdate struct {
	Body *DynamicMessage `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` //  google.protobuf.FieldMask update_mask = 2;
	// contains filtered or unexported fields
}

func (*DynamicMessageUpdate) Descriptor deprecated

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

Deprecated: Use DynamicMessageUpdate.ProtoReflect.Descriptor instead.

func (*DynamicMessageUpdate) GetBody

func (x *DynamicMessageUpdate) GetBody() *DynamicMessage

func (*DynamicMessageUpdate) ProtoMessage

func (*DynamicMessageUpdate) ProtoMessage()

func (*DynamicMessageUpdate) ProtoReflect

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

func (*DynamicMessageUpdate) Reset

func (x *DynamicMessageUpdate) Reset()

func (*DynamicMessageUpdate) String

func (x *DynamicMessageUpdate) String() string

type EchoService

type EchoService interface {
	// Echo method receives a simple message and returns it.
	//
	// The message posted as the id parameter will also be
	// returned.
	Echo(context.Context, *SimpleMessage) (*SimpleMessage, error)

	// EchoBody method receives a simple message and returns it.
	EchoBody(context.Context, *SimpleMessage) (*SimpleMessage, error)

	// EchoDelete method receives a simple message and returns it.
	EchoDelete(context.Context, *SimpleMessage) (*SimpleMessage, error)

	// EchoPatch method receives a NonStandardUpdateRequest and returns it.
	EchoPatch(context.Context, *DynamicMessageUpdate) (*DynamicMessageUpdate, error)

	// EchoUnauthorized method receives a simple message and returns it. It must
	// always return a google.rpc.Code of `UNAUTHENTICATED` and a HTTP Status code
	// of 401.
	EchoUnauthorized(context.Context, *SimpleMessage) (*SimpleMessage, error)
}

Echo service responds to incoming echo requests.

func NewEchoServiceJSONClient

func NewEchoServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) EchoService

NewEchoServiceJSONClient creates a JSON client that implements the EchoService interface. It communicates using JSON and can be configured with a custom HTTPClient.

func NewEchoServiceProtobufClient

func NewEchoServiceProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) EchoService

NewEchoServiceProtobufClient creates a Protobuf client that implements the EchoService interface. It communicates using Protobuf and can be configured with a custom HTTPClient.

type EchoServiceClient

type EchoServiceClient interface {
	// Echo method receives a simple message and returns it.
	//
	// The message posted as the id parameter will also be
	// returned.
	Echo(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error)
	// EchoBody method receives a simple message and returns it.
	EchoBody(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error)
	// EchoDelete method receives a simple message and returns it.
	EchoDelete(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error)
	// EchoPatch method receives a NonStandardUpdateRequest and returns it.
	EchoPatch(ctx context.Context, in *DynamicMessageUpdate, opts ...grpc.CallOption) (*DynamicMessageUpdate, error)
	// EchoUnauthorized method receives a simple message and returns it. It must
	// always return a google.rpc.Code of `UNAUTHENTICATED` and a HTTP Status code
	// of 401.
	EchoUnauthorized(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error)
}

EchoServiceClient is the client API for EchoService 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.

type EchoServiceServer

type EchoServiceServer interface {
	// Echo method receives a simple message and returns it.
	//
	// The message posted as the id parameter will also be
	// returned.
	Echo(context.Context, *SimpleMessage) (*SimpleMessage, error)
	// EchoBody method receives a simple message and returns it.
	EchoBody(context.Context, *SimpleMessage) (*SimpleMessage, error)
	// EchoDelete method receives a simple message and returns it.
	EchoDelete(context.Context, *SimpleMessage) (*SimpleMessage, error)
	// EchoPatch method receives a NonStandardUpdateRequest and returns it.
	EchoPatch(context.Context, *DynamicMessageUpdate) (*DynamicMessageUpdate, error)
	// EchoUnauthorized method receives a simple message and returns it. It must
	// always return a google.rpc.Code of `UNAUTHENTICATED` and a HTTP Status code
	// of 401.
	EchoUnauthorized(context.Context, *SimpleMessage) (*SimpleMessage, error)
}

EchoServiceServer is the server API for EchoService service. All implementations should embed UnimplementedEchoServiceServer for forward compatibility

type Embedded

type Embedded struct {

	// Types that are assignable to Mark:
	//	*Embedded_Progress
	//	*Embedded_Note
	Mark isEmbedded_Mark `protobuf_oneof:"mark"`
	// contains filtered or unexported fields
}

Embedded represents a message embedded in SimpleMessage.

func (*Embedded) Descriptor deprecated

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

Deprecated: Use Embedded.ProtoReflect.Descriptor instead.

func (*Embedded) GetMark

func (m *Embedded) GetMark() isEmbedded_Mark

func (*Embedded) GetNote

func (x *Embedded) GetNote() string

func (*Embedded) GetProgress

func (x *Embedded) GetProgress() int64

func (*Embedded) ProtoMessage

func (*Embedded) ProtoMessage()

func (*Embedded) ProtoReflect

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

func (*Embedded) Reset

func (x *Embedded) Reset()

func (*Embedded) String

func (x *Embedded) String() string

type Embedded_Note

type Embedded_Note struct {
	Note string `protobuf:"bytes,2,opt,name=note,proto3,oneof"`
}

type Embedded_Progress

type Embedded_Progress struct {
	Progress int64 `protobuf:"varint,1,opt,name=progress,proto3,oneof"`
}

type GenerateRequest

type GenerateRequest struct {

	// type of id e.g uuid, shortid, snowflake (64 bit), bigflake (128 bit)
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// contains filtered or unexported fields
}

Generate a unique ID. Defaults to uuid.

func (*GenerateRequest) Descriptor deprecated

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

Deprecated: Use GenerateRequest.ProtoReflect.Descriptor instead.

func (*GenerateRequest) GetType

func (x *GenerateRequest) GetType() string

func (*GenerateRequest) ProtoMessage

func (*GenerateRequest) ProtoMessage()

func (*GenerateRequest) ProtoReflect

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

func (*GenerateRequest) Reset

func (x *GenerateRequest) Reset()

func (*GenerateRequest) String

func (x *GenerateRequest) String() string

type GenerateResponse

type GenerateResponse struct {

	// the unique id generated
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// the type of id generated
	Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
	// contains filtered or unexported fields
}

func (*GenerateResponse) Descriptor deprecated

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

Deprecated: Use GenerateResponse.ProtoReflect.Descriptor instead.

func (*GenerateResponse) GetId

func (x *GenerateResponse) GetId() string

func (*GenerateResponse) GetType

func (x *GenerateResponse) GetType() string

func (*GenerateResponse) ProtoMessage

func (*GenerateResponse) ProtoMessage()

func (*GenerateResponse) ProtoReflect

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

func (*GenerateResponse) Reset

func (x *GenerateResponse) Reset()

func (*GenerateResponse) String

func (x *GenerateResponse) String() string

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

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 Id

type Id interface {
	// Generate 生成ID
	Generate(context.Context, *GenerateRequest) (*GenerateResponse, error)

	// Types id类型
	Types(context.Context, *TypesRequest) (*TypesResponse, error)
}

Id 生成随机ID服务

func NewIdJSONClient

func NewIdJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Id

NewIdJSONClient creates a JSON client that implements the Id interface. It communicates using JSON and can be configured with a custom HTTPClient.

func NewIdProtobufClient

func NewIdProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Id

NewIdProtobufClient creates a Protobuf client that implements the Id interface. It communicates using Protobuf and can be configured with a custom HTTPClient.

type IdClient

type IdClient interface {
	// Generate 生成ID
	Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error)
	// Types id类型
	Types(ctx context.Context, in *TypesRequest, opts ...grpc.CallOption) (*TypesResponse, error)
}

IdClient is the client API for Id 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 NewIdClient

func NewIdClient(cc grpc.ClientConnInterface) IdClient

type IdServer

type IdServer interface {
	// Generate 生成ID
	Generate(context.Context, *GenerateRequest) (*GenerateResponse, error)
	// Types id类型
	Types(context.Context, *TypesRequest) (*TypesResponse, error)
}

IdServer is the server API for Id service. All implementations should embed UnimplementedIdServer for forward compatibility

type LoginReply

type LoginReply struct {
	Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	// Whether you have access or not
	Access bool `protobuf:"varint,2,opt,name=access,proto3" json:"access,omitempty"`
	// contains filtered or unexported fields
}

func (*LoginReply) Descriptor deprecated

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

Deprecated: Use LoginReply.ProtoReflect.Descriptor instead.

func (*LoginReply) GetAccess

func (x *LoginReply) GetAccess() bool

func (*LoginReply) GetMessage

func (x *LoginReply) GetMessage() string

func (*LoginReply) ProtoMessage

func (*LoginReply) ProtoMessage()

func (*LoginReply) ProtoReflect

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

func (*LoginReply) Reset

func (x *LoginReply) Reset()

func (*LoginReply) String

func (x *LoginReply) String() string

type LoginRequest

type LoginRequest struct {

	// The entered username
	Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	// The entered password
	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 LoginService

type LoginService interface {
	// Login
	//
	// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
	// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
	//
	// ## {{.RequestType.Name}}
	// | Field ID    | Name      | Type                                                       | Description                  |
	// | ----------- | --------- | ---------------------------------------------------------  | ---------------------------- | {{range .RequestType.Fields}}
	// | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
	//
	// ## {{.ResponseType.Name}}
	// | Field ID    | Name      | Type                                                       | Description                  |
	// | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}}
	// | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
	Login(context.Context, *LoginRequest) (*LoginReply, error)

	// Logout
	//
	// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
	// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
	//
	// ## {{.RequestType.Name}}
	// | Field ID    | Name      | Type                                                       | Description                  |
	// | ----------- | --------- | ---------------------------------------------------------  | ---------------------------- | {{range .RequestType.Fields}}
	// | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
	//
	// ## {{.ResponseType.Name}}
	// | Field ID    | Name      | Type                                                       | Description                  |
	// | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}}
	// | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
	Logout(context.Context, *LogoutRequest) (*LogoutReply, error)
}

func NewLoginServiceJSONClient

func NewLoginServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) LoginService

NewLoginServiceJSONClient creates a JSON client that implements the LoginService interface. It communicates using JSON and can be configured with a custom HTTPClient.

func NewLoginServiceProtobufClient

func NewLoginServiceProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) LoginService

NewLoginServiceProtobufClient creates a Protobuf client that implements the LoginService interface. It communicates using Protobuf and can be configured with a custom HTTPClient.

type LoginServiceClient

type LoginServiceClient interface {
	// Login
	//
	// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
	// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
	//
	// ## {{.RequestType.Name}}
	// | Field ID    | Name      | Type                                                       | Description                  |
	// | ----------- | --------- | ---------------------------------------------------------  | ---------------------------- | {{range .RequestType.Fields}}
	// | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
	//
	// ## {{.ResponseType.Name}}
	// | Field ID    | Name      | Type                                                       | Description                  |
	// | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}}
	// | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
	Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginReply, error)
	// Logout
	//
	// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
	// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
	//
	// ## {{.RequestType.Name}}
	// | Field ID    | Name      | Type                                                       | Description                  |
	// | ----------- | --------- | ---------------------------------------------------------  | ---------------------------- | {{range .RequestType.Fields}}
	// | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
	//
	// ## {{.ResponseType.Name}}
	// | Field ID    | Name      | Type                                                       | Description                  |
	// | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}}
	// | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
	Logout(ctx context.Context, in *LogoutRequest, opts ...grpc.CallOption) (*LogoutReply, error)
}

LoginServiceClient is the client API for LoginService 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.

type LoginServiceServer

type LoginServiceServer interface {
	// Login
	//
	// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
	// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
	//
	// ## {{.RequestType.Name}}
	// | Field ID    | Name      | Type                                                       | Description                  |
	// | ----------- | --------- | ---------------------------------------------------------  | ---------------------------- | {{range .RequestType.Fields}}
	// | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
	//
	// ## {{.ResponseType.Name}}
	// | Field ID    | Name      | Type                                                       | Description                  |
	// | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}}
	// | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
	Login(context.Context, *LoginRequest) (*LoginReply, error)
	// Logout
	//
	// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
	// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
	//
	// ## {{.RequestType.Name}}
	// | Field ID    | Name      | Type                                                       | Description                  |
	// | ----------- | --------- | ---------------------------------------------------------  | ---------------------------- | {{range .RequestType.Fields}}
	// | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
	//
	// ## {{.ResponseType.Name}}
	// | Field ID    | Name      | Type                                                       | Description                  |
	// | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}}
	// | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
	Logout(context.Context, *LogoutRequest) (*LogoutReply, error)
}

LoginServiceServer is the server API for LoginService service. All implementations should embed UnimplementedLoginServiceServer for forward compatibility

type LogoutReply

type LogoutReply struct {

	// Message that tells you whether your
	// logout was succesful or not
	Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*LogoutReply) Descriptor deprecated

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

Deprecated: Use LogoutReply.ProtoReflect.Descriptor instead.

func (*LogoutReply) GetMessage

func (x *LogoutReply) GetMessage() string

func (*LogoutReply) ProtoMessage

func (*LogoutReply) ProtoMessage()

func (*LogoutReply) ProtoReflect

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

func (*LogoutReply) Reset

func (x *LogoutReply) Reset()

func (*LogoutReply) String

func (x *LogoutReply) String() string

type LogoutRequest

type LogoutRequest struct {

	// The time the logout was registered
	Timeoflogout string `protobuf:"bytes,1,opt,name=timeoflogout,proto3" json:"timeoflogout,omitempty"`
	// This is the title
	//
	// This is the "Description" of field test
	// you can use as many newlines as you want
	//
	//
	// it will still format the same in the table
	Test int32 `protobuf:"varint,2,opt,name=test,proto3" json:"test,omitempty"`
	// This is an array
	//
	// It displays that using [] infront of the type
	Stringarray []string `protobuf:"bytes,3,rep,name=stringarray,proto3" json:"stringarray,omitempty"`
	// contains filtered or unexported fields
}

func (*LogoutRequest) Descriptor deprecated

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

Deprecated: Use LogoutRequest.ProtoReflect.Descriptor instead.

func (*LogoutRequest) GetStringarray

func (x *LogoutRequest) GetStringarray() []string

func (*LogoutRequest) GetTest

func (x *LogoutRequest) GetTest() int32

func (*LogoutRequest) GetTimeoflogout

func (x *LogoutRequest) GetTimeoflogout() string

func (*LogoutRequest) ProtoMessage

func (*LogoutRequest) ProtoMessage()

func (*LogoutRequest) ProtoReflect

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

func (*LogoutRequest) Reset

func (x *LogoutRequest) Reset()

func (*LogoutRequest) String

func (x *LogoutRequest) String() string

type SimpleMessage

type SimpleMessage struct {

	// Id represents the message identifier.
	Id  string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Num int64  `protobuf:"varint,2,opt,name=num,proto3" json:"num,omitempty"`
	// Types that are assignable to Code:
	//	*SimpleMessage_LineNum
	//	*SimpleMessage_Lang
	Code   isSimpleMessage_Code `protobuf_oneof:"code"`
	Status *Embedded            `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"`
	// Types that are assignable to Ext:
	//	*SimpleMessage_En
	//	*SimpleMessage_No
	Ext isSimpleMessage_Ext `protobuf_oneof:"ext"`
	// contains filtered or unexported fields
}

SimpleMessage represents a simple message sent to the Echo service.

func (*SimpleMessage) Descriptor deprecated

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

Deprecated: Use SimpleMessage.ProtoReflect.Descriptor instead.

func (*SimpleMessage) GetCode

func (m *SimpleMessage) GetCode() isSimpleMessage_Code

func (*SimpleMessage) GetEn

func (x *SimpleMessage) GetEn() int64

func (*SimpleMessage) GetExt

func (m *SimpleMessage) GetExt() isSimpleMessage_Ext

func (*SimpleMessage) GetId

func (x *SimpleMessage) GetId() string

func (*SimpleMessage) GetLang

func (x *SimpleMessage) GetLang() string

func (*SimpleMessage) GetLineNum

func (x *SimpleMessage) GetLineNum() int64

func (*SimpleMessage) GetNo

func (x *SimpleMessage) GetNo() *Embedded

func (*SimpleMessage) GetNum

func (x *SimpleMessage) GetNum() int64

func (*SimpleMessage) GetStatus

func (x *SimpleMessage) GetStatus() *Embedded

func (*SimpleMessage) ProtoMessage

func (*SimpleMessage) ProtoMessage()

func (*SimpleMessage) ProtoReflect

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

func (*SimpleMessage) Reset

func (x *SimpleMessage) Reset()

func (*SimpleMessage) String

func (x *SimpleMessage) String() string

type SimpleMessage_En

type SimpleMessage_En struct {
	En int64 `protobuf:"varint,6,opt,name=en,proto3,oneof"`
}

type SimpleMessage_Lang

type SimpleMessage_Lang struct {
	Lang string `protobuf:"bytes,4,opt,name=lang,proto3,oneof"`
}

type SimpleMessage_LineNum

type SimpleMessage_LineNum struct {
	LineNum int64 `protobuf:"varint,3,opt,name=line_num,json=lineNum,proto3,oneof"`
}

type SimpleMessage_No

type SimpleMessage_No struct {
	No *Embedded `protobuf:"bytes,7,opt,name=no,proto3,oneof"`
}

type Tag

type Tag struct {
	Key   string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*Tag) Descriptor deprecated

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

Deprecated: Use Tag.ProtoReflect.Descriptor instead.

func (*Tag) GetKey

func (x *Tag) GetKey() string

func (*Tag) GetValue

func (x *Tag) GetValue() string

func (*Tag) ProtoMessage

func (*Tag) ProtoMessage()

func (*Tag) ProtoReflect

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

func (*Tag) Reset

func (x *Tag) Reset()

func (*Tag) String

func (x *Tag) 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 NewEchoServiceServer

func NewEchoServiceServer(svc EchoService, opts ...interface{}) TwirpServer

NewEchoServiceServer 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).

func NewIdServer

func NewIdServer(svc Id, opts ...interface{}) TwirpServer

NewIdServer 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).

func NewLoginServiceServer

func NewLoginServiceServer(svc LoginService, opts ...interface{}) TwirpServer

NewLoginServiceServer 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 TypesRequest

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

List the types of IDs available. No query params needed.

func (*TypesRequest) Descriptor deprecated

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

Deprecated: Use TypesRequest.ProtoReflect.Descriptor instead.

func (*TypesRequest) ProtoMessage

func (*TypesRequest) ProtoMessage()

func (*TypesRequest) ProtoReflect

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

func (*TypesRequest) Reset

func (x *TypesRequest) Reset()

func (*TypesRequest) String

func (x *TypesRequest) String() string

type TypesResponse

type TypesResponse struct {
	Types []string `protobuf:"bytes,1,rep,name=types,proto3" json:"types,omitempty"`
	// contains filtered or unexported fields
}

TypesResponse 返回值类型

func (*TypesResponse) Descriptor deprecated

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

Deprecated: Use TypesResponse.ProtoReflect.Descriptor instead.

func (*TypesResponse) GetTypes

func (x *TypesResponse) GetTypes() []string

func (*TypesResponse) ProtoMessage

func (*TypesResponse) ProtoMessage()

func (*TypesResponse) ProtoReflect

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

func (*TypesResponse) Reset

func (x *TypesResponse) Reset()

func (*TypesResponse) String

func (x *TypesResponse) String() string

type UnimplementedEchoServiceServer

type UnimplementedEchoServiceServer struct {
}

UnimplementedEchoServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedEchoServiceServer) Echo

func (UnimplementedEchoServiceServer) EchoBody

func (UnimplementedEchoServiceServer) EchoDelete

func (UnimplementedEchoServiceServer) EchoPatch

func (UnimplementedEchoServiceServer) EchoUnauthorized

type UnimplementedIdServer

type UnimplementedIdServer struct {
}

UnimplementedIdServer should be embedded to have forward compatible implementations.

func (UnimplementedIdServer) Generate

func (UnimplementedIdServer) Types

type UnimplementedLoginServiceServer

type UnimplementedLoginServiceServer struct {
}

UnimplementedLoginServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedLoginServiceServer) Login

func (UnimplementedLoginServiceServer) Logout

type UnsafeEchoServiceServer

type UnsafeEchoServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeEchoServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to EchoServiceServer will result in compilation errors.

type UnsafeIdServer

type UnsafeIdServer interface {
	// contains filtered or unexported methods
}

UnsafeIdServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to IdServer will result in compilation errors.

type UnsafeLoginServiceServer

type UnsafeLoginServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeLoginServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to LoginServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

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