Skip to content

Commit

Permalink
feat: update api
Browse files Browse the repository at this point in the history
  • Loading branch information
maemual committed Oct 16, 2024
1 parent 6ee69f8 commit f291450
Show file tree
Hide file tree
Showing 31 changed files with 11,076 additions and 3,976 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
## 安装

```shell
go get -u github.com/larksuite/oapi-sdk-go/[email protected].4
go get -u github.com/larksuite/oapi-sdk-go/[email protected].5
```

## API Client
Expand Down
152 changes: 76 additions & 76 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,53 +74,53 @@ import (

type Client struct {
config *larkcore.Config
Hire *hire.Service
Lingo *lingo.Service
Attendance *attendance.Service
HumanAuthentication *human_authentication.Service
Acs *acs.Service
Search *search.Service
Translation *translation.Service
Contact *contact.Service
Ehr *ehr.Service
Mail *mail.Service
SpeechToText *speech_to_text.Service
Workplace *workplace.Service
Aily *aily.Service
Authen *authen.Service
Block *block.Service
Compensation *compensation.Service
Docx *docx.Service
Event *event.Service
Okr *okr.Service
Report *report.Service
Approval *approval.Service
Board *board.Service
Calendar *calendar.Service
Task *task.Service
Verification *verification.Service
Wiki *wiki.Service
Tenant *tenant.Service
Application *application.Service
Ehr *ehr.Service
Helpdesk *helpdesk.Service
Translation *translation.Service
DocumentAi *document_ai.Service
OpticalCharRecognition *optical_char_recognition.Service
Bitable *bitable.Service
Drive *drive.Service
PersonalSettings *personal_settings.Service
Vc *vc.Service
Calendar *calendar.Service
HumanAuthentication *human_authentication.Service
Aily *aily.Service
Hire *hire.Service
Im *im.Service
Moments *moments.Service
Admin *admin.Service
Auth *auth.Service
Baike *baike.Service
Event *event.Service
GrayTestOpenSg *gray_test_open_sg.Service
Im *im.Service
Search *search.Service
Sheets *sheets.Service
Approval *approval.Service
Block *block.Service
DocumentAi *document_ai.Service
Report *report.Service
SecurityAndCompliance *security_and_compliance.Service
Workplace *workplace.Service
Authen *authen.Service
Mail *mail.Service
Passport *passport.Service
Bitable *bitable.Service
Board *board.Service
Contact *contact.Service
Docx *docx.Service
PersonalSettings *personal_settings.Service
Lingo *lingo.Service
Mdm *mdm.Service
Acs *acs.Service
Admin *admin.Service
Attendance *attendance.Service
Tenant *tenant.Service
Moments *moments.Service
Okr *okr.Service
SpeechToText *speech_to_text.Service
OpticalCharRecognition *optical_char_recognition.Service
Task *task.Service
Compensation *compensation.Service
Corehr *corehr.Service
MeetingRoom *meeting_room.Service
SecurityAndCompliance *security_and_compliance.Service
Sheets *sheets.Service
Corehr *corehr.Service
GrayTestOpenSg *gray_test_open_sg.Service
Helpdesk *helpdesk.Service
Vc *vc.Service
Ext *larkext.ExtService
}

Expand Down Expand Up @@ -244,53 +244,53 @@ func NewClient(appId, appSecret string, options ...ClientOptionFunc) *Client {
}

func initService(client *Client, config *larkcore.Config) {
client.Hire = hire.NewService(config)
client.Lingo = lingo.NewService(config)
client.Attendance = attendance.NewService(config)
client.HumanAuthentication = human_authentication.NewService(config)
client.Acs = acs.NewService(config)
client.Search = search.NewService(config)
client.Translation = translation.NewService(config)
client.Contact = contact.NewService(config)
client.Ehr = ehr.NewService(config)
client.Mail = mail.NewService(config)
client.SpeechToText = speech_to_text.NewService(config)
client.Workplace = workplace.NewService(config)
client.Aily = aily.NewService(config)
client.Authen = authen.NewService(config)
client.Block = block.NewService(config)
client.Compensation = compensation.NewService(config)
client.Docx = docx.NewService(config)
client.Event = event.NewService(config)
client.Okr = okr.NewService(config)
client.Report = report.NewService(config)
client.Approval = approval.NewService(config)
client.Board = board.NewService(config)
client.Calendar = calendar.NewService(config)
client.Task = task.NewService(config)
client.Verification = verification.NewService(config)
client.Wiki = wiki.NewService(config)
client.Tenant = tenant.NewService(config)
client.Application = application.NewService(config)
client.Ehr = ehr.NewService(config)
client.Helpdesk = helpdesk.NewService(config)
client.Translation = translation.NewService(config)
client.DocumentAi = document_ai.NewService(config)
client.OpticalCharRecognition = optical_char_recognition.NewService(config)
client.Bitable = bitable.NewService(config)
client.Drive = drive.NewService(config)
client.PersonalSettings = personal_settings.NewService(config)
client.Vc = vc.NewService(config)
client.Calendar = calendar.NewService(config)
client.HumanAuthentication = human_authentication.NewService(config)
client.Aily = aily.NewService(config)
client.Hire = hire.NewService(config)
client.Im = im.NewService(config)
client.Moments = moments.NewService(config)
client.Admin = admin.NewService(config)
client.Auth = auth.NewService(config)
client.Baike = baike.NewService(config)
client.Event = event.NewService(config)
client.GrayTestOpenSg = gray_test_open_sg.NewService(config)
client.Im = im.NewService(config)
client.Search = search.NewService(config)
client.Sheets = sheets.NewService(config)
client.Approval = approval.NewService(config)
client.Block = block.NewService(config)
client.DocumentAi = document_ai.NewService(config)
client.Report = report.NewService(config)
client.SecurityAndCompliance = security_and_compliance.NewService(config)
client.Workplace = workplace.NewService(config)
client.Authen = authen.NewService(config)
client.Mail = mail.NewService(config)
client.Passport = passport.NewService(config)
client.Bitable = bitable.NewService(config)
client.Board = board.NewService(config)
client.Contact = contact.NewService(config)
client.Docx = docx.NewService(config)
client.PersonalSettings = personal_settings.NewService(config)
client.Lingo = lingo.NewService(config)
client.Mdm = mdm.NewService(config)
client.Acs = acs.NewService(config)
client.Admin = admin.NewService(config)
client.Attendance = attendance.NewService(config)
client.Tenant = tenant.NewService(config)
client.Moments = moments.NewService(config)
client.Okr = okr.NewService(config)
client.SpeechToText = speech_to_text.NewService(config)
client.OpticalCharRecognition = optical_char_recognition.NewService(config)
client.Task = task.NewService(config)
client.Compensation = compensation.NewService(config)
client.Corehr = corehr.NewService(config)
client.MeetingRoom = meeting_room.NewService(config)
client.SecurityAndCompliance = security_and_compliance.NewService(config)
client.Sheets = sheets.NewService(config)
client.Corehr = corehr.NewService(config)
client.GrayTestOpenSg = gray_test_open_sg.NewService(config)
client.Helpdesk = helpdesk.NewService(config)
client.Vc = vc.NewService(config)
client.Ext = larkext.NewService(config)
}

Expand Down
156 changes: 156 additions & 0 deletions event/dispatcher/corehr_v2_event_dispatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,78 @@ import (
"github.com/larksuite/oapi-sdk-go/v3/service/corehr/v2"
)

// -
//
// - 事件描述文档链接:
func (dispatcher *EventDispatcher) OnP2CompanyCreatedV2(handler func(ctx context.Context, event *larkcorehr.P2CompanyCreatedV2) error) *EventDispatcher {
_, existed := dispatcher.eventType2EventHandler["corehr.company.created_v2"]
if existed {
panic("event: multiple handler registrations for " + "corehr.company.created_v2")
}
dispatcher.eventType2EventHandler["corehr.company.created_v2"] = larkcorehr.NewP2CompanyCreatedV2Handler(handler)
return dispatcher
}

// -
//
// - 事件描述文档链接:
func (dispatcher *EventDispatcher) OnP2CompanyDeletedV2(handler func(ctx context.Context, event *larkcorehr.P2CompanyDeletedV2) error) *EventDispatcher {
_, existed := dispatcher.eventType2EventHandler["corehr.company.deleted_v2"]
if existed {
panic("event: multiple handler registrations for " + "corehr.company.deleted_v2")
}
dispatcher.eventType2EventHandler["corehr.company.deleted_v2"] = larkcorehr.NewP2CompanyDeletedV2Handler(handler)
return dispatcher
}

// -
//
// - 事件描述文档链接:
func (dispatcher *EventDispatcher) OnP2CompanyUpdatedV2(handler func(ctx context.Context, event *larkcorehr.P2CompanyUpdatedV2) error) *EventDispatcher {
_, existed := dispatcher.eventType2EventHandler["corehr.company.updated_v2"]
if existed {
panic("event: multiple handler registrations for " + "corehr.company.updated_v2")
}
dispatcher.eventType2EventHandler["corehr.company.updated_v2"] = larkcorehr.NewP2CompanyUpdatedV2Handler(handler)
return dispatcher
}

// -
//
// - 事件描述文档链接:
func (dispatcher *EventDispatcher) OnP2CostCenterCreatedV2(handler func(ctx context.Context, event *larkcorehr.P2CostCenterCreatedV2) error) *EventDispatcher {
_, existed := dispatcher.eventType2EventHandler["corehr.cost_center.created_v2"]
if existed {
panic("event: multiple handler registrations for " + "corehr.cost_center.created_v2")
}
dispatcher.eventType2EventHandler["corehr.cost_center.created_v2"] = larkcorehr.NewP2CostCenterCreatedV2Handler(handler)
return dispatcher
}

// -
//
// - 事件描述文档链接:
func (dispatcher *EventDispatcher) OnP2CostCenterDeletedV2(handler func(ctx context.Context, event *larkcorehr.P2CostCenterDeletedV2) error) *EventDispatcher {
_, existed := dispatcher.eventType2EventHandler["corehr.cost_center.deleted_v2"]
if existed {
panic("event: multiple handler registrations for " + "corehr.cost_center.deleted_v2")
}
dispatcher.eventType2EventHandler["corehr.cost_center.deleted_v2"] = larkcorehr.NewP2CostCenterDeletedV2Handler(handler)
return dispatcher
}

// -
//
// - 事件描述文档链接:
func (dispatcher *EventDispatcher) OnP2CostCenterUpdatedV2(handler func(ctx context.Context, event *larkcorehr.P2CostCenterUpdatedV2) error) *EventDispatcher {
_, existed := dispatcher.eventType2EventHandler["corehr.cost_center.updated_v2"]
if existed {
panic("event: multiple handler registrations for " + "corehr.cost_center.updated_v2")
}
dispatcher.eventType2EventHandler["corehr.cost_center.updated_v2"] = larkcorehr.NewP2CostCenterUpdatedV2Handler(handler)
return dispatcher
}

// -
//
// - 事件描述文档链接:
Expand Down Expand Up @@ -90,6 +162,42 @@ func (dispatcher *EventDispatcher) OnP2JobFamilyUpdatedV2(handler func(ctx conte
return dispatcher
}

// -
//
// - 事件描述文档链接:
func (dispatcher *EventDispatcher) OnP2JobGradeCreatedV2(handler func(ctx context.Context, event *larkcorehr.P2JobGradeCreatedV2) error) *EventDispatcher {
_, existed := dispatcher.eventType2EventHandler["corehr.job_grade.created_v2"]
if existed {
panic("event: multiple handler registrations for " + "corehr.job_grade.created_v2")
}
dispatcher.eventType2EventHandler["corehr.job_grade.created_v2"] = larkcorehr.NewP2JobGradeCreatedV2Handler(handler)
return dispatcher
}

// -
//
// - 事件描述文档链接:
func (dispatcher *EventDispatcher) OnP2JobGradeDeletedV2(handler func(ctx context.Context, event *larkcorehr.P2JobGradeDeletedV2) error) *EventDispatcher {
_, existed := dispatcher.eventType2EventHandler["corehr.job_grade.deleted_v2"]
if existed {
panic("event: multiple handler registrations for " + "corehr.job_grade.deleted_v2")
}
dispatcher.eventType2EventHandler["corehr.job_grade.deleted_v2"] = larkcorehr.NewP2JobGradeDeletedV2Handler(handler)
return dispatcher
}

// -
//
// - 事件描述文档链接:
func (dispatcher *EventDispatcher) OnP2JobGradeUpdatedV2(handler func(ctx context.Context, event *larkcorehr.P2JobGradeUpdatedV2) error) *EventDispatcher {
_, existed := dispatcher.eventType2EventHandler["corehr.job_grade.updated_v2"]
if existed {
panic("event: multiple handler registrations for " + "corehr.job_grade.updated_v2")
}
dispatcher.eventType2EventHandler["corehr.job_grade.updated_v2"] = larkcorehr.NewP2JobGradeUpdatedV2Handler(handler)
return dispatcher
}

// -
//
// - 事件描述文档链接:
Expand Down Expand Up @@ -126,6 +234,42 @@ func (dispatcher *EventDispatcher) OnP2JobLevelUpdatedV2(handler func(ctx contex
return dispatcher
}

// -
//
// - 事件描述文档链接:
func (dispatcher *EventDispatcher) OnP2LocationCreatedV2(handler func(ctx context.Context, event *larkcorehr.P2LocationCreatedV2) error) *EventDispatcher {
_, existed := dispatcher.eventType2EventHandler["corehr.location.created_v2"]
if existed {
panic("event: multiple handler registrations for " + "corehr.location.created_v2")
}
dispatcher.eventType2EventHandler["corehr.location.created_v2"] = larkcorehr.NewP2LocationCreatedV2Handler(handler)
return dispatcher
}

// -
//
// - 事件描述文档链接:
func (dispatcher *EventDispatcher) OnP2LocationDeletedV2(handler func(ctx context.Context, event *larkcorehr.P2LocationDeletedV2) error) *EventDispatcher {
_, existed := dispatcher.eventType2EventHandler["corehr.location.deleted_v2"]
if existed {
panic("event: multiple handler registrations for " + "corehr.location.deleted_v2")
}
dispatcher.eventType2EventHandler["corehr.location.deleted_v2"] = larkcorehr.NewP2LocationDeletedV2Handler(handler)
return dispatcher
}

// -
//
// - 事件描述文档链接:
func (dispatcher *EventDispatcher) OnP2LocationUpdatedV2(handler func(ctx context.Context, event *larkcorehr.P2LocationUpdatedV2) error) *EventDispatcher {
_, existed := dispatcher.eventType2EventHandler["corehr.location.updated_v2"]
if existed {
panic("event: multiple handler registrations for " + "corehr.location.updated_v2")
}
dispatcher.eventType2EventHandler["corehr.location.updated_v2"] = larkcorehr.NewP2LocationUpdatedV2Handler(handler)
return dispatcher
}

// -
//
// - 事件描述文档链接:
Expand Down Expand Up @@ -233,3 +377,15 @@ func (dispatcher *EventDispatcher) OnP2ProcessNodeUpdatedV2(handler func(ctx con
dispatcher.eventType2EventHandler["corehr.process.node.updated_v2"] = larkcorehr.NewP2ProcessNodeUpdatedV2Handler(handler)
return dispatcher
}

// -
//
// - 事件描述文档链接:
func (dispatcher *EventDispatcher) OnP2ProcessStatusUpdateV2(handler func(ctx context.Context, event *larkcorehr.P2ProcessStatusUpdateV2) error) *EventDispatcher {
_, existed := dispatcher.eventType2EventHandler["corehr.process.status.update_v2"]
if existed {
panic("event: multiple handler registrations for " + "corehr.process.status.update_v2")
}
dispatcher.eventType2EventHandler["corehr.process.status.update_v2"] = larkcorehr.NewP2ProcessStatusUpdateV2Handler(handler)
return dispatcher
}
2 changes: 2 additions & 0 deletions sample/apiall/attendancev1/create_shift.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ func main() {
OvertimeRestTimeRule([]*larkattendance.RestRule{larkattendance.NewRestRuleBuilder().Build()}).
LateMinutesAsSeriousLate(40).
ShiftMiddleTimeRule(larkattendance.NewShiftMiddleTimeRuleBuilder().Build()).
ShiftAttendanceTimeConfig(larkattendance.NewShiftAttendanceTimeConfigBuilder().Build()).
LateOffLateOnSetting(larkattendance.NewLateOffLateOnSettingBuilder().Build()).
Id("6919358778597097404").
Build()).
Build()
// 发起请求
Expand Down
1 change: 1 addition & 0 deletions sample/apiall/compensationv1/list_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func main() {
req := larkcompensation.NewListItemReqBuilder().
PageSize(100).
PageToken("5234233214").
ItemType("bonus").
Build()
// 发起请求
resp, err := client.Compensation.V1.Item.List(context.Background(), req)
Expand Down
Loading

0 comments on commit f291450

Please sign in to comment.