mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-11 19:04:35 +00:00
* add two rpcs to User service: - Passwordless: endpoint that receives an email, topic and an optional message - PasswordlessML: endpoint that receives token and topic via MagicLink. * Proposal to add Passwordless login feature to the endpoint user. * remove currency run check * Commit from GitHub Actions (Publish APIs & Clients) * Create downstream.yml * Commit from GitHub Actions (Publish APIs & Clients) * update todo * Commit from GitHub Actions (Publish APIs & Clients) * Update publish.yml * Commit from GitHub Actions (Publish APIs & Clients) * Update publish.yml * Commit from GitHub Actions (Publish APIs & Clients) * Update and rename publish.yml to generate.yml * Update generate.yml * Commit from GitHub Actions (Generate Clients & Examples) * Commit from GitHub Actions (Generate Clients & Examples) * add comments * Commit from GitHub Actions (Generate Clients & Examples) * move otp to auth category * charge for user verification * Commit from GitHub Actions (Generate Clients & Examples) * Update user.proto * Commit from GitHub Actions (Generate Clients & Examples) * Commit from GitHub Actions (Generate Clients & Examples) * Change js client git repo url (#249) * Commit from GitHub Actions (Generate Clients & Examples) * use tableName func for Count * Commit from GitHub Actions (Generate Clients & Examples) * update notes example * Commit from GitHub Actions (Generate Clients & Examples) * Update .gitignore * Update .gitignore * Commit from GitHub Actions (Generate Clients & Examples) * add new endpoints SendMagicLink and VerifyToken to M3O user serivce Signed-off-by: Daniel Joudat <danieljoudat@gmail.com> * remove stream from SendMagicLink Signed-off-by: Daniel Joudat <danieljoudat@gmail.com> * fix user/examples.json Signed-off-by: Daniel Joudat <danieljoudat@gmail.com> * fix typo in user.proto sessino -> session | add dumpy session in user/examples.json Signed-off-by: Daniel Joudat <danieljoudat@gmail.com> Co-authored-by: Asim Aslam <asim@aslam.me> Co-authored-by: asim <asim@users.noreply.github.com> Co-authored-by: Janos Dobronszki <dobronszki@gmail.com> Co-authored-by: crufter <crufter@users.noreply.github.com>
332 lines
13 KiB
Go
332 lines
13 KiB
Go
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
|
// source: proto/user.proto
|
|
|
|
package user
|
|
|
|
import (
|
|
fmt "fmt"
|
|
proto "github.com/golang/protobuf/proto"
|
|
math "math"
|
|
)
|
|
|
|
import (
|
|
context "context"
|
|
api "github.com/micro/micro/v3/service/api"
|
|
client "github.com/micro/micro/v3/service/client"
|
|
server "github.com/micro/micro/v3/service/server"
|
|
)
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ = proto.Marshal
|
|
var _ = fmt.Errorf
|
|
var _ = math.Inf
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the proto package it is being compiled against.
|
|
// A compilation error at this line likely means your copy of the
|
|
// proto package needs to be updated.
|
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ api.Endpoint
|
|
var _ context.Context
|
|
var _ client.Option
|
|
var _ server.Option
|
|
|
|
// Api Endpoints for User service
|
|
|
|
func NewUserEndpoints() []*api.Endpoint {
|
|
return []*api.Endpoint{}
|
|
}
|
|
|
|
// Client API for User service
|
|
|
|
type UserService interface {
|
|
Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error)
|
|
Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error)
|
|
Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error)
|
|
Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error)
|
|
UpdatePassword(ctx context.Context, in *UpdatePasswordRequest, opts ...client.CallOption) (*UpdatePasswordResponse, error)
|
|
Login(ctx context.Context, in *LoginRequest, opts ...client.CallOption) (*LoginResponse, error)
|
|
Logout(ctx context.Context, in *LogoutRequest, opts ...client.CallOption) (*LogoutResponse, error)
|
|
ReadSession(ctx context.Context, in *ReadSessionRequest, opts ...client.CallOption) (*ReadSessionResponse, error)
|
|
VerifyEmail(ctx context.Context, in *VerifyEmailRequest, opts ...client.CallOption) (*VerifyEmailResponse, error)
|
|
SendVerificationEmail(ctx context.Context, in *SendVerificationEmailRequest, opts ...client.CallOption) (*SendVerificationEmailResponse, error)
|
|
SendPasswordResetEmail(ctx context.Context, in *SendPasswordResetEmailRequest, opts ...client.CallOption) (*SendPasswordResetEmailResponse, error)
|
|
ResetPassword(ctx context.Context, in *ResetPasswordRequest, opts ...client.CallOption) (*ResetPasswordResponse, error)
|
|
List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
|
|
SendMagicLink(ctx context.Context, in *SendMagicLinkRequest, opts ...client.CallOption) (*SendMagicLinkResponse, error)
|
|
VerifyToken(ctx context.Context, in *VerifyTokenRequest, opts ...client.CallOption) (*VerifyTokenResponse, error)
|
|
}
|
|
|
|
type userService struct {
|
|
c client.Client
|
|
name string
|
|
}
|
|
|
|
func NewUserService(name string, c client.Client) UserService {
|
|
return &userService{
|
|
c: c,
|
|
name: name,
|
|
}
|
|
}
|
|
|
|
func (c *userService) Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) {
|
|
req := c.c.NewRequest(c.name, "User.Create", in)
|
|
out := new(CreateResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *userService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) {
|
|
req := c.c.NewRequest(c.name, "User.Read", in)
|
|
out := new(ReadResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *userService) Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) {
|
|
req := c.c.NewRequest(c.name, "User.Update", in)
|
|
out := new(UpdateResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *userService) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) {
|
|
req := c.c.NewRequest(c.name, "User.Delete", in)
|
|
out := new(DeleteResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *userService) UpdatePassword(ctx context.Context, in *UpdatePasswordRequest, opts ...client.CallOption) (*UpdatePasswordResponse, error) {
|
|
req := c.c.NewRequest(c.name, "User.UpdatePassword", in)
|
|
out := new(UpdatePasswordResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *userService) Login(ctx context.Context, in *LoginRequest, opts ...client.CallOption) (*LoginResponse, error) {
|
|
req := c.c.NewRequest(c.name, "User.Login", in)
|
|
out := new(LoginResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *userService) Logout(ctx context.Context, in *LogoutRequest, opts ...client.CallOption) (*LogoutResponse, error) {
|
|
req := c.c.NewRequest(c.name, "User.Logout", in)
|
|
out := new(LogoutResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *userService) ReadSession(ctx context.Context, in *ReadSessionRequest, opts ...client.CallOption) (*ReadSessionResponse, error) {
|
|
req := c.c.NewRequest(c.name, "User.ReadSession", in)
|
|
out := new(ReadSessionResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *userService) VerifyEmail(ctx context.Context, in *VerifyEmailRequest, opts ...client.CallOption) (*VerifyEmailResponse, error) {
|
|
req := c.c.NewRequest(c.name, "User.VerifyEmail", in)
|
|
out := new(VerifyEmailResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *userService) SendVerificationEmail(ctx context.Context, in *SendVerificationEmailRequest, opts ...client.CallOption) (*SendVerificationEmailResponse, error) {
|
|
req := c.c.NewRequest(c.name, "User.SendVerificationEmail", in)
|
|
out := new(SendVerificationEmailResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *userService) SendPasswordResetEmail(ctx context.Context, in *SendPasswordResetEmailRequest, opts ...client.CallOption) (*SendPasswordResetEmailResponse, error) {
|
|
req := c.c.NewRequest(c.name, "User.SendPasswordResetEmail", in)
|
|
out := new(SendPasswordResetEmailResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *userService) ResetPassword(ctx context.Context, in *ResetPasswordRequest, opts ...client.CallOption) (*ResetPasswordResponse, error) {
|
|
req := c.c.NewRequest(c.name, "User.ResetPassword", in)
|
|
out := new(ResetPasswordResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *userService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
|
|
req := c.c.NewRequest(c.name, "User.List", in)
|
|
out := new(ListResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *userService) SendMagicLink(ctx context.Context, in *SendMagicLinkRequest, opts ...client.CallOption) (*SendMagicLinkResponse, error) {
|
|
req := c.c.NewRequest(c.name, "User.SendMagicLink", in)
|
|
out := new(SendMagicLinkResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *userService) VerifyToken(ctx context.Context, in *VerifyTokenRequest, opts ...client.CallOption) (*VerifyTokenResponse, error) {
|
|
req := c.c.NewRequest(c.name, "User.VerifyToken", in)
|
|
out := new(VerifyTokenResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// Server API for User service
|
|
|
|
type UserHandler interface {
|
|
Create(context.Context, *CreateRequest, *CreateResponse) error
|
|
Read(context.Context, *ReadRequest, *ReadResponse) error
|
|
Update(context.Context, *UpdateRequest, *UpdateResponse) error
|
|
Delete(context.Context, *DeleteRequest, *DeleteResponse) error
|
|
UpdatePassword(context.Context, *UpdatePasswordRequest, *UpdatePasswordResponse) error
|
|
Login(context.Context, *LoginRequest, *LoginResponse) error
|
|
Logout(context.Context, *LogoutRequest, *LogoutResponse) error
|
|
ReadSession(context.Context, *ReadSessionRequest, *ReadSessionResponse) error
|
|
VerifyEmail(context.Context, *VerifyEmailRequest, *VerifyEmailResponse) error
|
|
SendVerificationEmail(context.Context, *SendVerificationEmailRequest, *SendVerificationEmailResponse) error
|
|
SendPasswordResetEmail(context.Context, *SendPasswordResetEmailRequest, *SendPasswordResetEmailResponse) error
|
|
ResetPassword(context.Context, *ResetPasswordRequest, *ResetPasswordResponse) error
|
|
List(context.Context, *ListRequest, *ListResponse) error
|
|
SendMagicLink(context.Context, *SendMagicLinkRequest, *SendMagicLinkResponse) error
|
|
VerifyToken(context.Context, *VerifyTokenRequest, *VerifyTokenResponse) error
|
|
}
|
|
|
|
func RegisterUserHandler(s server.Server, hdlr UserHandler, opts ...server.HandlerOption) error {
|
|
type user interface {
|
|
Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error
|
|
Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error
|
|
Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error
|
|
Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error
|
|
UpdatePassword(ctx context.Context, in *UpdatePasswordRequest, out *UpdatePasswordResponse) error
|
|
Login(ctx context.Context, in *LoginRequest, out *LoginResponse) error
|
|
Logout(ctx context.Context, in *LogoutRequest, out *LogoutResponse) error
|
|
ReadSession(ctx context.Context, in *ReadSessionRequest, out *ReadSessionResponse) error
|
|
VerifyEmail(ctx context.Context, in *VerifyEmailRequest, out *VerifyEmailResponse) error
|
|
SendVerificationEmail(ctx context.Context, in *SendVerificationEmailRequest, out *SendVerificationEmailResponse) error
|
|
SendPasswordResetEmail(ctx context.Context, in *SendPasswordResetEmailRequest, out *SendPasswordResetEmailResponse) error
|
|
ResetPassword(ctx context.Context, in *ResetPasswordRequest, out *ResetPasswordResponse) error
|
|
List(ctx context.Context, in *ListRequest, out *ListResponse) error
|
|
SendMagicLink(ctx context.Context, in *SendMagicLinkRequest, out *SendMagicLinkResponse) error
|
|
VerifyToken(ctx context.Context, in *VerifyTokenRequest, out *VerifyTokenResponse) error
|
|
}
|
|
type User struct {
|
|
user
|
|
}
|
|
h := &userHandler{hdlr}
|
|
return s.Handle(s.NewHandler(&User{h}, opts...))
|
|
}
|
|
|
|
type userHandler struct {
|
|
UserHandler
|
|
}
|
|
|
|
func (h *userHandler) Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error {
|
|
return h.UserHandler.Create(ctx, in, out)
|
|
}
|
|
|
|
func (h *userHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error {
|
|
return h.UserHandler.Read(ctx, in, out)
|
|
}
|
|
|
|
func (h *userHandler) Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error {
|
|
return h.UserHandler.Update(ctx, in, out)
|
|
}
|
|
|
|
func (h *userHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error {
|
|
return h.UserHandler.Delete(ctx, in, out)
|
|
}
|
|
|
|
func (h *userHandler) UpdatePassword(ctx context.Context, in *UpdatePasswordRequest, out *UpdatePasswordResponse) error {
|
|
return h.UserHandler.UpdatePassword(ctx, in, out)
|
|
}
|
|
|
|
func (h *userHandler) Login(ctx context.Context, in *LoginRequest, out *LoginResponse) error {
|
|
return h.UserHandler.Login(ctx, in, out)
|
|
}
|
|
|
|
func (h *userHandler) Logout(ctx context.Context, in *LogoutRequest, out *LogoutResponse) error {
|
|
return h.UserHandler.Logout(ctx, in, out)
|
|
}
|
|
|
|
func (h *userHandler) ReadSession(ctx context.Context, in *ReadSessionRequest, out *ReadSessionResponse) error {
|
|
return h.UserHandler.ReadSession(ctx, in, out)
|
|
}
|
|
|
|
func (h *userHandler) VerifyEmail(ctx context.Context, in *VerifyEmailRequest, out *VerifyEmailResponse) error {
|
|
return h.UserHandler.VerifyEmail(ctx, in, out)
|
|
}
|
|
|
|
func (h *userHandler) SendVerificationEmail(ctx context.Context, in *SendVerificationEmailRequest, out *SendVerificationEmailResponse) error {
|
|
return h.UserHandler.SendVerificationEmail(ctx, in, out)
|
|
}
|
|
|
|
func (h *userHandler) SendPasswordResetEmail(ctx context.Context, in *SendPasswordResetEmailRequest, out *SendPasswordResetEmailResponse) error {
|
|
return h.UserHandler.SendPasswordResetEmail(ctx, in, out)
|
|
}
|
|
|
|
func (h *userHandler) ResetPassword(ctx context.Context, in *ResetPasswordRequest, out *ResetPasswordResponse) error {
|
|
return h.UserHandler.ResetPassword(ctx, in, out)
|
|
}
|
|
|
|
func (h *userHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error {
|
|
return h.UserHandler.List(ctx, in, out)
|
|
}
|
|
|
|
func (h *userHandler) SendMagicLink(ctx context.Context, in *SendMagicLinkRequest, out *SendMagicLinkResponse) error {
|
|
return h.UserHandler.SendMagicLink(ctx, in, out)
|
|
}
|
|
|
|
func (h *userHandler) VerifyToken(ctx context.Context, in *VerifyTokenRequest, out *VerifyTokenResponse) error {
|
|
return h.UserHandler.VerifyToken(ctx, in, out)
|
|
}
|