auth_client

package module
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 8 Imported by: 0

README

Auth Service Client V2

An auth client for Omega private auth service.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAuthError

func IsAuthError(err error) bool

func RecoverPassword added in v2.0.1

func RecoverPassword(req *RecoverPassRequest) error

func ResendCode

func ResendCode(req *ResendCodeRequest) error

func ResetPassword added in v2.0.1

func ResetPassword(req *ResetPasswordRequest) error

func UpdatePassword added in v2.0.1

func UpdatePassword(req *UpdatePassRequest) error

func VerifyRecCode added in v2.0.1

func VerifyRecCode(req *VerifyRecCodeRequest) error

Types

type AuthError

type AuthError struct {
	Message    string
	Err        error
	StatusCode int
	Details    *ErrorDetails
}

func (AuthError) Error

func (e AuthError) Error() string

func (AuthError) String

func (e AuthError) String() string

type ErrorDetails

type ErrorDetails map[string]any

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type LoginResponse

type LoginResponse struct {
	User struct {
		OID             string      `json:"oid"`
		COID            string      `json:"coid"`
		Name            string      `json:"name"`
		Email           string      `json:"email"`
		PhoneNumber     string      `json:"phone_number"`
		Role            string      `json:"role"`
		EmailVerifiedAt interface{} `json:"email_verified_at"`
	} `json:"user"`

	AccessToken string     `json:"access_token,omitempty"`
	ExpireAt    *time.Time `json:"expire_at,omitempty"`
}

func LoginUser

func LoginUser(req *LoginRequest) (*LoginResponse, error)

type RecoverPassRequest added in v2.0.1

type RecoverPassRequest struct {
	Email string `json:"email"`
}

type RegisterRequest

type RegisterRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
	Name     string `json:"name"`
	Phone    string `json:"phone_number"`
	Company  string `json:"company_title"`
}

type RegisterResponse

type RegisterResponse struct {
	User struct {
		OID             string      `json:"oid"`
		COID            string      `json:"coid"`
		Name            string      `json:"name"`
		Email           string      `json:"email"`
		PhoneNumber     string      `json:"phone_number"`
		Role            string      `json:"role"`
		EmailVerifiedAt interface{} `json:"email_verified_at"`
	} `json:"user"`
	Company struct {
		OCID  string `json:"ocid"`
		Title string `json:"title"`
	} `json:"company"`
}

func RegisterUser

func RegisterUser(req *RegisterRequest) (*RegisterResponse, error)

type ResendCodeRequest

type ResendCodeRequest struct {
	Email string `json:"email"`
}

type ResetPasswordRequest added in v2.0.1

type ResetPasswordRequest struct {
	Email string `json:"email"`
	Code  string `json:"code"`

	NewPassword string `json:"new_password"`
}

type UpdatePassRequest added in v2.0.1

type UpdatePassRequest struct {
	OID         string `json:"oid"`
	OldPassword string `json:"old_password"`
	NewPassword string `json:"new_password"`
}

type UpdateProfileRequest added in v2.0.1

type UpdateProfileRequest struct {
	OID          string `json:"oid"`
	PhoneNumber  string `json:"phone_number"`
	Name         string `json:"name"`
	CompanyTitle string `json:"company_title"`
}

type UpdateProfileResponse added in v2.0.1

type UpdateProfileResponse struct {
	User struct {
		OID             string     `json:"oid"`
		COID            string     `json:"coid"`
		Name            string     `json:"name"`
		Email           string     `json:"email"`
		PhoneNumber     string     `json:"phone_number"`
		Role            string     `json:"role"`
		EmailVerifiedAt *time.Time `json:"email_verified_at"`
	} `json:"user"`
	Company struct {
		OCID  string `json:"ocid"`
		Title string `json:"title"`
	} `json:"company"`
}

func UpdateProfile added in v2.0.1

func UpdateProfile(req *UpdateProfileRequest) (*UpdateProfileResponse, error)

type VerifyRecCodeRequest added in v2.0.1

type VerifyRecCodeRequest struct {
	Email string `json:"email"`
	Code  string `json:"code"`
}

type VerifyRequest

type VerifyRequest struct {
	Email string `json:"email"`
	Code  string `json:"code"`
}

type VerifyResponse

type VerifyResponse struct {
	AccessToken string     `json:"access_token,omitempty"`
	ExpireAt    *time.Time `json:"expire_at,omitempty"`
	OID         string     `json:"oid"`
}

func VerifyUser

func VerifyUser(req *VerifyRequest) (*VerifyResponse, error)

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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