external

package
v0.0.0-...-6f95374 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HeaderTID トレースIDのヘッダー名.
	HeaderTID = "tid"
	// HeaderUID ユーザーIDのヘッダー名.
	HeaderUID = "uid"
)

Variables

This section is empty.

Functions

func NewMockNotice

func NewMockNotice() rpc.Notice

func NewNotice

func NewNotice(
	client *resend.Client,
	from string,
) rpc.Notice

func NewRequest

func NewRequest[T any](ctx context.Context, msg *T) *connect.Request[T]

Types

type Article

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

func NewArticle

func NewArticle(
	connect articlev1connect.ArticleServiceClient,
) *Article

func (*Article) AddToUser

func (ext *Article) AddToUser(
	ctx context.Context,
	articleID article.ID,
	userID user.ID,
) error

func (*Article) Delete

func (ext *Article) Delete(
	ctx context.Context,
	articleID article.ID,
) error

func (*Article) List

func (ext *Article) List(
	ctx context.Context,
	index value.Index,
	size value.Size,
	filter ...value.Filter,
) ([]model.Article, error)

func (*Article) ListByUser

func (ext *Article) ListByUser(
	ctx context.Context,
	userID user.ID,
	index value.Index,
	size value.Size,
	filter ...value.Filter,
) ([]model.Article, error)

func (*Article) RemoveFromUser

func (ext *Article) RemoveFromUser(
	ctx context.Context,
	articleID article.ID,
	userID user.ID,
) error

func (*Article) Share

func (ext *Article) Share(
	ctx context.Context,
	url article.URL,
	title article.Title,
	description article.Description,
	thumbnail article.Thumbnail,
) (model.Article, error)

type ArticleFactory

type ArticleFactory interface {
	Article(string) (*Article, error)
}

type Auth

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

func NewAuth

func NewAuth(
	endpoint string,
	apiKey string,
	httpClient *http.Client,
	firebaseAuth *firebase.Client,
) *Auth

func (*Auth) ChangePassword

func (ext *Auth) ChangePassword(
	ctx context.Context,
	userID user.ID,
	password auth.Password,
) error

func (*Auth) GetEmail

func (ext *Auth) GetEmail(
	ctx context.Context,
	userID user.ID,
) (auth.Email, error)

func (*Auth) SignIn

func (ext *Auth) SignIn(ctx context.Context, email auth.Email, password auth.Password) (model.User, error)

func (*Auth) SignUp

func (ext *Auth) SignUp(ctx context.Context, uid user.ID, email auth.Email, password auth.Password) error

type AuthFactory

type AuthFactory interface {
	Auth(secret string, endpoint string, apiKey string) (*Auth, error)
}

type External

type External struct{}

func New

func New() *External

func (*External) HandleError

func (ext *External) HandleError(_ context.Context, err error) error

type Health

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

func NewHealth

func NewHealth(
	connect healthv1connect.HealthServiceClient,
) *Health

func (*Health) Check

func (ext *Health) Check(ctx context.Context) error

type HealthFactory

type HealthFactory interface {
	Health(string) (*Health, error)
}

type MockNotice

type MockNotice struct{}

func (*MockNotice) Notify

func (lg *MockNotice) Notify(
	ctx context.Context,
	to auth.Email,
	subject notice.Subject,
	message notice.Message,
) (notice.ID, error)

type Notice

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

func (*Notice) Notify

func (ntc *Notice) Notify(
	ctx context.Context,
	to auth.Email,
	subject notice.Subject,
	message notice.Message,
) (notice.ID, error)

type NoticeFactory

type NoticeFactory interface {
	Notice(key, from string) (rpc.Notice, error)
	MockNotice() rpc.Notice
}

type SignInRequest

type SignInRequest struct {
	Email             string `json:"email"`
	Password          string `json:"password"`
	ReturnSecureToken bool   `json:"returnSecureToken"`
}

type SignInResponse

type SignInResponse struct {
	ExpiresIn    string `json:"expiresIn"`
	LocalID      string `json:"localId"`
	IDToken      string `json:"idToken"`
	RefreshToken string `json:"refreshToken"`
}

type User

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

func NewUser

func NewUser(
	connect userv1connect.UserServiceClient,
) *User

func (*User) Create

func (ext *User) Create(ctx context.Context) (model.User, error)

func (*User) Update

func (ext *User) Update(ctx context.Context, uid user.ID) (model.User, error)

type UserFactory

type UserFactory interface {
	User(string) (*User, error)
}

Jump to

Keyboard shortcuts

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