flashduty

package
v8.0.11 Latest Latest
Warning

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

Go to latest
Published: May 20, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Api     string
	Headers map[string]string
	Timeout time.Duration
)

Functions

func Init

func Init(fdConf cconf.FlashDuty)

func NeedSyncTeam

func NeedSyncTeam(ctx *ctx.Context) bool

func NeedSyncUser

func NeedSyncUser(ctx *ctx.Context) bool

func PostFlashDuty

func PostFlashDuty(path string, appKey string, body interface{}) error

func PostFlashDutyWithResp

func PostFlashDutyWithResp[T any](path string, appKey string, body interface{}) (T, error)

func PostJSON

func PostJSON(url string, timeout time.Duration, headers map[string]string, v interface{}, retries ...int) (response []byte, code int, err error)

func SyncUsersChange

func SyncUsersChange(ctx *ctx.Context, dbUsers []*models.User) error

func UpdateUser

func UpdateUser(ctx *ctx.Context, target models.User, email, phone string)

Types

type Data

type Data struct {
	P     int    `json:"p"`
	Limit int    `json:"limit"`
	Total int    `json:"total"`
	Items []Item `json:"items"`
}

type Item

type Item struct {
	MemberID      int    `json:"member_id"`
	MemberName    string `json:"member_name"`
	Phone         string `json:"phone"`
	Email         string `json:"email"`
	EmailVerified string `json:"email_verified"`
	RefID         string `json:"ref_id"`
}

type Members

type Members struct {
	Users []User `json:"members"`
}

type Team

type Team struct {
	TeamID           int64    `json:"team_id"`
	TeamName         string   `json:"team_name"`
	ResetIfNameExist bool     `json:"reset_if_name_exist"`
	Description      string   `json:"description"`
	Emails           []string `json:"emails"`
	Phones           []string `json:"phones"`
	RefID            string   `json:"ref_id"`
}

func (*Team) AddTeam

func (t *Team) AddTeam(appKey string) error

func (*Team) DelTeam

func (t *Team) DelTeam(appKey string) error

func (*Team) UpdateTeam

func (t *Team) UpdateTeam(appKey string) error

type TeamInfo

type TeamInfo struct {
	TeamID        int64   `json:"team_id"`
	TeamName      string  `json:"team_name"`
	Description   string  `json:"description"`
	CreatedAt     int64   `json:"created_at"`
	UpdatedAt     int64   `json:"updated_at"`
	UpdatedBy     int64   `json:"updated_by"`
	UpdatedByName string  `json:"updated_by_name"`
	CreatorID     int64   `json:"creator_id"`
	RefID         string  `json:"ref_id"`
	PersonIDs     []int64 `json:"person_ids"`
}

type Updates

type Updates struct {
	RefID       string `json:"ref_id,omitempty"`
	Email       string `json:"email,omitempty"`
	Phone       string `json:"phone,omitempty"`
	MemberName  string `json:"member_name,omitempty"`
	CountryCode string `json:"country_code,omitempty"`
}

type User

type User struct {
	Email      string  `json:"email,omitempty"`
	Phone      string  `json:"phone,omitempty"`
	MemberName string  `json:"member_name,omitempty"`
	RefID      string  `json:"ref_id,omitempty"`
	Updates    Updates `json:"updates,omitempty"`
}

func (*User) UpdateMember

func (user *User) UpdateMember(appKey string) error

type UserGroupSyncer

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

func NewUserGroupSyncer

func NewUserGroupSyncer(ctx *ctx.Context, ug *models.UserGroup) (*UserGroupSyncer, error)

func (*UserGroupSyncer) CheckTeam

func (ugs *UserGroupSyncer) CheckTeam(ref_id string) (int64, error)

CheckTeam 检查ref_id是否存在

func (*UserGroupSyncer) SyncMembersAdd

func (ugs *UserGroupSyncer) SyncMembersAdd() error

func (*UserGroupSyncer) SyncMembersDel

func (ugs *UserGroupSyncer) SyncMembersDel() error

func (*UserGroupSyncer) SyncUGAdd

func (ugs *UserGroupSyncer) SyncUGAdd() error

func (*UserGroupSyncer) SyncUGDel

func (ugs *UserGroupSyncer) SyncUGDel() error

func (*UserGroupSyncer) SyncUGPut

func (ugs *UserGroupSyncer) SyncUGPut() error

Jump to

Keyboard shortcuts

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