authservice

package
v0.0.0-...-0ca0b20 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const AuthServiceV1PathPrefix = "/twirp/com.abboudlab.directoryservice.auth.AuthServiceV1/"

AuthServiceV1PathPrefix 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 AuthServiceV1_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "com.abboudlab.directoryservice.auth.AuthServiceV1",
	HandlerType: (*AuthServiceV1Server)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Login",
			Handler:    _AuthServiceV1_Login_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "rpc/authservice/service.proto",
}

AuthServiceV1_ServiceDesc is the grpc.ServiceDesc for AuthServiceV1 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_rpc_authservice_service_proto protoreflect.FileDescriptor

Functions

func RegisterAuthServiceV1Server

func RegisterAuthServiceV1Server(s grpc.ServiceRegistrar, srv AuthServiceV1Server)

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 AuthServiceV1

type AuthServiceV1 interface {
	Login(context.Context, *LoginRequestV1) (*LoginResponseV1, error)
}

func NewAuthServiceV1JSONClient

func NewAuthServiceV1JSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) AuthServiceV1

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

func NewAuthServiceV1ProtobufClient

func NewAuthServiceV1ProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) AuthServiceV1

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

type AuthServiceV1Client

type AuthServiceV1Client interface {
	Login(ctx context.Context, in *LoginRequestV1, opts ...grpc.CallOption) (*LoginResponseV1, error)
}

AuthServiceV1Client is the client API for AuthServiceV1 service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.golang.ir/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type AuthServiceV1Server

type AuthServiceV1Server interface {
	Login(context.Context, *LoginRequestV1) (*LoginResponseV1, error)
	// contains filtered or unexported methods
}

AuthServiceV1Server is the server API for AuthServiceV1 service. All implementations must embed UnimplementedAuthServiceV1Server for forward compatibility

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 LoginRequestV1

type LoginRequestV1 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 (*LoginRequestV1) Descriptor deprecated

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

Deprecated: Use LoginRequestV1.ProtoReflect.Descriptor instead.

func (*LoginRequestV1) GetPassword

func (x *LoginRequestV1) GetPassword() string

func (*LoginRequestV1) GetUsername

func (x *LoginRequestV1) GetUsername() string

func (*LoginRequestV1) ProtoMessage

func (*LoginRequestV1) ProtoMessage()

func (*LoginRequestV1) ProtoReflect

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

func (*LoginRequestV1) Reset

func (x *LoginRequestV1) Reset()

func (*LoginRequestV1) String

func (x *LoginRequestV1) String() string

type LoginResponseV1

type LoginResponseV1 struct {
	AccessToken string `protobuf:"bytes,1,opt,name=accessToken,proto3" json:"accessToken,omitempty"`
	ExpiresIn   int64  `protobuf:"varint,2,opt,name=expiresIn,proto3" json:"expiresIn,omitempty"`
	// contains filtered or unexported fields
}

func (*LoginResponseV1) Descriptor deprecated

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

Deprecated: Use LoginResponseV1.ProtoReflect.Descriptor instead.

func (*LoginResponseV1) GetAccessToken

func (x *LoginResponseV1) GetAccessToken() string

func (*LoginResponseV1) GetExpiresIn

func (x *LoginResponseV1) GetExpiresIn() int64

func (*LoginResponseV1) ProtoMessage

func (*LoginResponseV1) ProtoMessage()

func (*LoginResponseV1) ProtoReflect

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

func (*LoginResponseV1) Reset

func (x *LoginResponseV1) Reset()

func (*LoginResponseV1) String

func (x *LoginResponseV1) 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 NewAuthServiceV1Server

func NewAuthServiceV1Server(svc AuthServiceV1, opts ...interface{}) TwirpServer

NewAuthServiceV1Server 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 UnimplementedAuthServiceV1Server

type UnimplementedAuthServiceV1Server struct {
}

UnimplementedAuthServiceV1Server must be embedded to have forward compatible implementations.

func (UnimplementedAuthServiceV1Server) Login

type UnsafeAuthServiceV1Server

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

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

Jump to

Keyboard shortcuts

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