Documentation ¶
Index ¶
- Constants
- func NewServiceHandler(svc ServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler)
- type ServiceClient
- type ServiceHandler
- type UnimplementedServiceHandler
- func (UnimplementedServiceHandler) Delete(context.Context, *connect_go.Request[authentication.DeleteRequest]) (*connect_go.Response[authentication.DeleteResponse], error)
- func (UnimplementedServiceHandler) Get(context.Context, *connect_go.Request[authentication.GetRequest]) (*connect_go.Response[authentication.GetResponse], error)
- func (UnimplementedServiceHandler) GetAuthConfig(context.Context, *connect_go.Request[authentication.GetAuthConfigRequest]) (*connect_go.Response[authentication.GetAuthConfigResponse], error)
- func (UnimplementedServiceHandler) Login(context.Context, *connect_go.Request[authentication.LoginRequest]) (*connect_go.Response[authentication.LoginResponse], error)
- func (UnimplementedServiceHandler) Logout(context.Context, *connect_go.Request[authentication.LogoutRequest]) (*connect_go.Response[authentication.LogoutResponse], error)
- func (UnimplementedServiceHandler) RefreshToken(context.Context, *connect_go.Request[authentication.RefreshTokenRequest]) (*connect_go.Response[authentication.RefreshTokenResponse], error)
- func (UnimplementedServiceHandler) Register(context.Context, *connect_go.Request[authentication.RegisterRequest]) (*connect_go.Response[authentication.RegisterResponse], error)
- func (UnimplementedServiceHandler) ResetPassword(context.Context, *connect_go.Request[authentication.ResetPasswordRequest]) (*connect_go.Response[authentication.ResetPasswordResponse], error)
- func (UnimplementedServiceHandler) SendPasswordReset(context.Context, *connect_go.Request[authentication.SendPasswordResetRequest]) (*connect_go.Response[authentication.SendPasswordResetResponse], error)
- func (UnimplementedServiceHandler) VerifyEmail(context.Context, *connect_go.Request[authentication.VerifyEmailRequest]) (*connect_go.Response[authentication.VerifyEmailResponse], error)
- func (UnimplementedServiceHandler) VerifyPhoneNumber(context.Context, *connect_go.Request[authentication.VerifyPhoneNumberRequest]) (*connect_go.Response[authentication.VerifyPhoneNumberResponse], error)
Constants ¶
const ( // ServiceLoginProcedure is the fully-qualified name of the Service's Login RPC. ServiceLoginProcedure = "/api.v1.authentication.Service/Login" // ServiceLogoutProcedure is the fully-qualified name of the Service's Logout RPC. ServiceLogoutProcedure = "/api.v1.authentication.Service/Logout" // ServiceGetProcedure is the fully-qualified name of the Service's Get RPC. ServiceGetProcedure = "/api.v1.authentication.Service/Get" // ServiceRegisterProcedure is the fully-qualified name of the Service's Register RPC. ServiceRegisterProcedure = "/api.v1.authentication.Service/Register" // ServiceSendPasswordResetProcedure is the fully-qualified name of the Service's SendPasswordReset // RPC. ServiceSendPasswordResetProcedure = "/api.v1.authentication.Service/SendPasswordReset" // ServiceResetPasswordProcedure is the fully-qualified name of the Service's ResetPassword RPC. ServiceResetPasswordProcedure = "/api.v1.authentication.Service/ResetPassword" // ServiceDeleteProcedure is the fully-qualified name of the Service's Delete RPC. ServiceDeleteProcedure = "/api.v1.authentication.Service/Delete" // ServiceRefreshTokenProcedure is the fully-qualified name of the Service's RefreshToken RPC. ServiceRefreshTokenProcedure = "/api.v1.authentication.Service/RefreshToken" // ServiceGetAuthConfigProcedure is the fully-qualified name of the Service's GetAuthConfig RPC. ServiceGetAuthConfigProcedure = "/api.v1.authentication.Service/GetAuthConfig" // ServiceVerifyEmailProcedure is the fully-qualified name of the Service's VerifyEmail RPC. ServiceVerifyEmailProcedure = "/api.v1.authentication.Service/VerifyEmail" // ServiceVerifyPhoneNumberProcedure is the fully-qualified name of the Service's VerifyPhoneNumber // RPC. ServiceVerifyPhoneNumberProcedure = "/api.v1.authentication.Service/VerifyPhoneNumber" )
These constants are the fully-qualified names of the RPCs defined in this package. They're exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
Note that these are different from the fully-qualified method names used by google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to reflection-formatted method names, remove the leading slash and convert the remaining slash to a period.
const (
// ServiceName is the fully-qualified name of the Service service.
ServiceName = "api.v1.authentication.Service"
)
Variables ¶
This section is empty.
Functions ¶
func NewServiceHandler ¶
func NewServiceHandler(svc ServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler)
NewServiceHandler builds an HTTP handler from the service implementation. It returns the path on which to mount the handler and the handler itself.
By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf and JSON codecs. They also support gzip compression.
Types ¶
type ServiceClient ¶
type ServiceClient interface { // Login authenticats a user and returns a access/refresh token Login(context.Context, *connect_go.Request[authentication.LoginRequest]) (*connect_go.Response[authentication.LoginResponse], error) // Logout validates the access token and blocks it afterwards Logout(context.Context, *connect_go.Request[authentication.LogoutRequest]) (*connect_go.Response[authentication.LogoutResponse], error) // Get the logged in user Get(context.Context, *connect_go.Request[authentication.GetRequest]) (*connect_go.Response[authentication.GetResponse], error) // Register creates a new user Register(context.Context, *connect_go.Request[authentication.RegisterRequest]) (*connect_go.Response[authentication.RegisterResponse], error) // Send reset password email to the user SendPasswordReset(context.Context, *connect_go.Request[authentication.SendPasswordResetRequest]) (*connect_go.Response[authentication.SendPasswordResetResponse], error) // Reset password of the user ResetPassword(context.Context, *connect_go.Request[authentication.ResetPasswordRequest]) (*connect_go.Response[authentication.ResetPasswordResponse], error) // Delete logged in user Delete(context.Context, *connect_go.Request[authentication.DeleteRequest]) (*connect_go.Response[authentication.DeleteResponse], error) // Refresh logged in token pair RefreshToken(context.Context, *connect_go.Request[authentication.RefreshTokenRequest]) (*connect_go.Response[authentication.RefreshTokenResponse], error) // Get auth config for how available login methods GetAuthConfig(context.Context, *connect_go.Request[authentication.GetAuthConfigRequest]) (*connect_go.Response[authentication.GetAuthConfigResponse], error) // Verify email VerifyEmail(context.Context, *connect_go.Request[authentication.VerifyEmailRequest]) (*connect_go.Response[authentication.VerifyEmailResponse], error) // Verify phone number VerifyPhoneNumber(context.Context, *connect_go.Request[authentication.VerifyPhoneNumberRequest]) (*connect_go.Response[authentication.VerifyPhoneNumberResponse], error) }
ServiceClient is a client for the api.v1.authentication.Service service.
func NewServiceClient ¶
func NewServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) ServiceClient
NewServiceClient constructs a client for the api.v1.authentication.Service service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or connect.WithGRPCWeb() options.
The URL supplied here should be the base URL for the Connect or gRPC server (for example, http://api.acme.com or https://acme.com/grpc).
type ServiceHandler ¶
type ServiceHandler interface { // Login authenticats a user and returns a access/refresh token Login(context.Context, *connect_go.Request[authentication.LoginRequest]) (*connect_go.Response[authentication.LoginResponse], error) // Logout validates the access token and blocks it afterwards Logout(context.Context, *connect_go.Request[authentication.LogoutRequest]) (*connect_go.Response[authentication.LogoutResponse], error) // Get the logged in user Get(context.Context, *connect_go.Request[authentication.GetRequest]) (*connect_go.Response[authentication.GetResponse], error) // Register creates a new user Register(context.Context, *connect_go.Request[authentication.RegisterRequest]) (*connect_go.Response[authentication.RegisterResponse], error) // Send reset password email to the user SendPasswordReset(context.Context, *connect_go.Request[authentication.SendPasswordResetRequest]) (*connect_go.Response[authentication.SendPasswordResetResponse], error) // Reset password of the user ResetPassword(context.Context, *connect_go.Request[authentication.ResetPasswordRequest]) (*connect_go.Response[authentication.ResetPasswordResponse], error) // Delete logged in user Delete(context.Context, *connect_go.Request[authentication.DeleteRequest]) (*connect_go.Response[authentication.DeleteResponse], error) // Refresh logged in token pair RefreshToken(context.Context, *connect_go.Request[authentication.RefreshTokenRequest]) (*connect_go.Response[authentication.RefreshTokenResponse], error) // Get auth config for how available login methods GetAuthConfig(context.Context, *connect_go.Request[authentication.GetAuthConfigRequest]) (*connect_go.Response[authentication.GetAuthConfigResponse], error) // Verify email VerifyEmail(context.Context, *connect_go.Request[authentication.VerifyEmailRequest]) (*connect_go.Response[authentication.VerifyEmailResponse], error) // Verify phone number VerifyPhoneNumber(context.Context, *connect_go.Request[authentication.VerifyPhoneNumberRequest]) (*connect_go.Response[authentication.VerifyPhoneNumberResponse], error) }
ServiceHandler is an implementation of the api.v1.authentication.Service service.
type UnimplementedServiceHandler ¶
type UnimplementedServiceHandler struct{}
UnimplementedServiceHandler returns CodeUnimplemented from all methods.
func (UnimplementedServiceHandler) Delete ¶
func (UnimplementedServiceHandler) Delete(context.Context, *connect_go.Request[authentication.DeleteRequest]) (*connect_go.Response[authentication.DeleteResponse], error)
func (UnimplementedServiceHandler) GetAuthConfig ¶
func (UnimplementedServiceHandler) GetAuthConfig(context.Context, *connect_go.Request[authentication.GetAuthConfigRequest]) (*connect_go.Response[authentication.GetAuthConfigResponse], error)
func (UnimplementedServiceHandler) Logout ¶
func (UnimplementedServiceHandler) Logout(context.Context, *connect_go.Request[authentication.LogoutRequest]) (*connect_go.Response[authentication.LogoutResponse], error)
func (UnimplementedServiceHandler) RefreshToken ¶
func (UnimplementedServiceHandler) RefreshToken(context.Context, *connect_go.Request[authentication.RefreshTokenRequest]) (*connect_go.Response[authentication.RefreshTokenResponse], error)
func (UnimplementedServiceHandler) Register ¶
func (UnimplementedServiceHandler) Register(context.Context, *connect_go.Request[authentication.RegisterRequest]) (*connect_go.Response[authentication.RegisterResponse], error)
func (UnimplementedServiceHandler) ResetPassword ¶
func (UnimplementedServiceHandler) ResetPassword(context.Context, *connect_go.Request[authentication.ResetPasswordRequest]) (*connect_go.Response[authentication.ResetPasswordResponse], error)
func (UnimplementedServiceHandler) SendPasswordReset ¶
func (UnimplementedServiceHandler) SendPasswordReset(context.Context, *connect_go.Request[authentication.SendPasswordResetRequest]) (*connect_go.Response[authentication.SendPasswordResetResponse], error)
func (UnimplementedServiceHandler) VerifyEmail ¶
func (UnimplementedServiceHandler) VerifyEmail(context.Context, *connect_go.Request[authentication.VerifyEmailRequest]) (*connect_go.Response[authentication.VerifyEmailResponse], error)
func (UnimplementedServiceHandler) VerifyPhoneNumber ¶
func (UnimplementedServiceHandler) VerifyPhoneNumber(context.Context, *connect_go.Request[authentication.VerifyPhoneNumberRequest]) (*connect_go.Response[authentication.VerifyPhoneNumberResponse], error)