// Code generated by lark suite oapi sdk gen
package v4

import (
	"github.com/larksuite/oapi-sdk-go/api"
	"github.com/larksuite/oapi-sdk-go/api/core/request"
	"github.com/larksuite/oapi-sdk-go/api/core/response"
	"github.com/larksuite/oapi-sdk-go/core"
	"github.com/larksuite/oapi-sdk-go/core/config"
)

type Service struct {
	conf                             *config.Config
	Calendars                        *CalendarService
	CalendarAcls                     *CalendarAclService
	CalendarEvents                   *CalendarEventService
	CalendarEventAttendees           *CalendarEventAttendeeService
	CalendarEventAttendeeChatMembers *CalendarEventAttendeeChatMemberService
	Freebusys                        *FreebusyService
	Settings                         *SettingService
	TimeoffEvents                    *TimeoffEventService
}

func NewService(conf *config.Config) *Service {
	s := &Service{
		conf: conf,
	}
	s.Calendars = newCalendarService(s)
	s.CalendarAcls = newCalendarAclService(s)
	s.CalendarEvents = newCalendarEventService(s)
	s.CalendarEventAttendees = newCalendarEventAttendeeService(s)
	s.CalendarEventAttendeeChatMembers = newCalendarEventAttendeeChatMemberService(s)
	s.Freebusys = newFreebusyService(s)
	s.Settings = newSettingService(s)
	s.TimeoffEvents = newTimeoffEventService(s)
	return s
}

type CalendarService struct {
	service *Service
}

func newCalendarService(service *Service) *CalendarService {
	return &CalendarService{
		service: service,
	}
}

type CalendarAclService struct {
	service *Service
}

func newCalendarAclService(service *Service) *CalendarAclService {
	return &CalendarAclService{
		service: service,
	}
}

type CalendarEventService struct {
	service *Service
}

func newCalendarEventService(service *Service) *CalendarEventService {
	return &CalendarEventService{
		service: service,
	}
}

type CalendarEventAttendeeService struct {
	service *Service
}

func newCalendarEventAttendeeService(service *Service) *CalendarEventAttendeeService {
	return &CalendarEventAttendeeService{
		service: service,
	}
}

type CalendarEventAttendeeChatMemberService struct {
	service *Service
}

func newCalendarEventAttendeeChatMemberService(service *Service) *CalendarEventAttendeeChatMemberService {
	return &CalendarEventAttendeeChatMemberService{
		service: service,
	}
}

type FreebusyService struct {
	service *Service
}

func newFreebusyService(service *Service) *FreebusyService {
	return &FreebusyService{
		service: service,
	}
}

type SettingService struct {
	service *Service
}

func newSettingService(service *Service) *SettingService {
	return &SettingService{
		service: service,
	}
}

type TimeoffEventService struct {
	service *Service
}

func newTimeoffEventService(service *Service) *TimeoffEventService {
	return &TimeoffEventService{
		service: service,
	}
}

type CalendarCreateReqCall struct {
	ctx       *core.Context
	calendars *CalendarService
	body      *Calendar
	optFns    []request.OptFn
}

func (rc *CalendarCreateReqCall) Do() (*CalendarCreateResult, error) {
	var result = &CalendarCreateResult{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars", "POST",
		[]request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, rc.body, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendars.service.conf, req)
	return result, err
}

func (calendars *CalendarService) Create(ctx *core.Context, body *Calendar, optFns ...request.OptFn) *CalendarCreateReqCall {
	return &CalendarCreateReqCall{
		ctx:       ctx,
		calendars: calendars,
		body:      body,
		optFns:    optFns,
	}
}

type CalendarEventDeleteReqCall struct {
	ctx            *core.Context
	calendarEvents *CalendarEventService
	pathParams     map[string]interface{}
	queryParams    map[string]interface{}
	optFns         []request.OptFn
}

func (rc *CalendarEventDeleteReqCall) SetCalendarId(calendarId string) {
	rc.pathParams["calendar_id"] = calendarId
}
func (rc *CalendarEventDeleteReqCall) SetEventId(eventId string) {
	rc.pathParams["event_id"] = eventId
}
func (rc *CalendarEventDeleteReqCall) SetNeedNotification(needNotification bool) {
	rc.queryParams["need_notification"] = needNotification
}

func (rc *CalendarEventDeleteReqCall) Do() (*response.NoData, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams))
	var result = &response.NoData{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id", "DELETE",
		[]request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, nil, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendarEvents.service.conf, req)
	return result, err
}

func (calendarEvents *CalendarEventService) Delete(ctx *core.Context, optFns ...request.OptFn) *CalendarEventDeleteReqCall {
	return &CalendarEventDeleteReqCall{
		ctx:            ctx,
		calendarEvents: calendarEvents,
		pathParams:     map[string]interface{}{},
		queryParams:    map[string]interface{}{},
		optFns:         optFns,
	}
}

type CalendarEventGetReqCall struct {
	ctx            *core.Context
	calendarEvents *CalendarEventService
	pathParams     map[string]interface{}
	optFns         []request.OptFn
}

func (rc *CalendarEventGetReqCall) SetCalendarId(calendarId string) {
	rc.pathParams["calendar_id"] = calendarId
}
func (rc *CalendarEventGetReqCall) SetEventId(eventId string) {
	rc.pathParams["event_id"] = eventId
}

func (rc *CalendarEventGetReqCall) Do() (*CalendarEventGetResult, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	var result = &CalendarEventGetResult{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id", "GET",
		[]request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, nil, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendarEvents.service.conf, req)
	return result, err
}

func (calendarEvents *CalendarEventService) Get(ctx *core.Context, optFns ...request.OptFn) *CalendarEventGetReqCall {
	return &CalendarEventGetReqCall{
		ctx:            ctx,
		calendarEvents: calendarEvents,
		pathParams:     map[string]interface{}{},
		optFns:         optFns,
	}
}

type CalendarPatchReqCall struct {
	ctx        *core.Context
	calendars  *CalendarService
	body       *Calendar
	pathParams map[string]interface{}
	optFns     []request.OptFn
}

func (rc *CalendarPatchReqCall) SetCalendarId(calendarId string) {
	rc.pathParams["calendar_id"] = calendarId
}

func (rc *CalendarPatchReqCall) Do() (*CalendarPatchResult, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	var result = &CalendarPatchResult{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/:calendar_id", "PATCH",
		[]request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, rc.body, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendars.service.conf, req)
	return result, err
}

func (calendars *CalendarService) Patch(ctx *core.Context, body *Calendar, optFns ...request.OptFn) *CalendarPatchReqCall {
	return &CalendarPatchReqCall{
		ctx:        ctx,
		calendars:  calendars,
		body:       body,
		pathParams: map[string]interface{}{},
		optFns:     optFns,
	}
}

type CalendarDeleteReqCall struct {
	ctx        *core.Context
	calendars  *CalendarService
	pathParams map[string]interface{}
	optFns     []request.OptFn
}

func (rc *CalendarDeleteReqCall) SetCalendarId(calendarId string) {
	rc.pathParams["calendar_id"] = calendarId
}

func (rc *CalendarDeleteReqCall) Do() (*response.NoData, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	var result = &response.NoData{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/:calendar_id", "DELETE",
		[]request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, nil, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendars.service.conf, req)
	return result, err
}

func (calendars *CalendarService) Delete(ctx *core.Context, optFns ...request.OptFn) *CalendarDeleteReqCall {
	return &CalendarDeleteReqCall{
		ctx:        ctx,
		calendars:  calendars,
		pathParams: map[string]interface{}{},
		optFns:     optFns,
	}
}

type CalendarAclListReqCall struct {
	ctx          *core.Context
	calendarAcls *CalendarAclService
	pathParams   map[string]interface{}
	queryParams  map[string]interface{}
	optFns       []request.OptFn
}

func (rc *CalendarAclListReqCall) SetCalendarId(calendarId string) {
	rc.pathParams["calendar_id"] = calendarId
}
func (rc *CalendarAclListReqCall) SetUserIdType(userIdType string) {
	rc.queryParams["user_id_type"] = userIdType
}
func (rc *CalendarAclListReqCall) SetPageToken(pageToken string) {
	rc.queryParams["page_token"] = pageToken
}
func (rc *CalendarAclListReqCall) SetPageSize(pageSize int) {
	rc.queryParams["page_size"] = pageSize
}

func (rc *CalendarAclListReqCall) Do() (*CalendarAclListResult, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams))
	var result = &CalendarAclListResult{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/:calendar_id/acls", "GET",
		[]request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, nil, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendarAcls.service.conf, req)
	return result, err
}

func (calendarAcls *CalendarAclService) List(ctx *core.Context, optFns ...request.OptFn) *CalendarAclListReqCall {
	return &CalendarAclListReqCall{
		ctx:          ctx,
		calendarAcls: calendarAcls,
		pathParams:   map[string]interface{}{},
		queryParams:  map[string]interface{}{},
		optFns:       optFns,
	}
}

type CalendarAclDeleteReqCall struct {
	ctx          *core.Context
	calendarAcls *CalendarAclService
	pathParams   map[string]interface{}
	optFns       []request.OptFn
}

func (rc *CalendarAclDeleteReqCall) SetCalendarId(calendarId string) {
	rc.pathParams["calendar_id"] = calendarId
}
func (rc *CalendarAclDeleteReqCall) SetAclId(aclId string) {
	rc.pathParams["acl_id"] = aclId
}

func (rc *CalendarAclDeleteReqCall) Do() (*response.NoData, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	var result = &response.NoData{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/:calendar_id/acls/:acl_id", "DELETE",
		[]request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, nil, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendarAcls.service.conf, req)
	return result, err
}

func (calendarAcls *CalendarAclService) Delete(ctx *core.Context, optFns ...request.OptFn) *CalendarAclDeleteReqCall {
	return &CalendarAclDeleteReqCall{
		ctx:          ctx,
		calendarAcls: calendarAcls,
		pathParams:   map[string]interface{}{},
		optFns:       optFns,
	}
}

type CalendarAclCreateReqCall struct {
	ctx          *core.Context
	calendarAcls *CalendarAclService
	body         *CalendarAcl
	pathParams   map[string]interface{}
	queryParams  map[string]interface{}
	optFns       []request.OptFn
}

func (rc *CalendarAclCreateReqCall) SetCalendarId(calendarId string) {
	rc.pathParams["calendar_id"] = calendarId
}
func (rc *CalendarAclCreateReqCall) SetUserIdType(userIdType string) {
	rc.queryParams["user_id_type"] = userIdType
}

func (rc *CalendarAclCreateReqCall) Do() (*CalendarAcl, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams))
	var result = &CalendarAcl{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/:calendar_id/acls", "POST",
		[]request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, rc.body, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendarAcls.service.conf, req)
	return result, err
}

func (calendarAcls *CalendarAclService) Create(ctx *core.Context, body *CalendarAcl, optFns ...request.OptFn) *CalendarAclCreateReqCall {
	return &CalendarAclCreateReqCall{
		ctx:          ctx,
		calendarAcls: calendarAcls,
		body:         body,
		pathParams:   map[string]interface{}{},
		queryParams:  map[string]interface{}{},
		optFns:       optFns,
	}
}

type CalendarListReqCall struct {
	ctx         *core.Context
	calendars   *CalendarService
	queryParams map[string]interface{}
	optFns      []request.OptFn
}

func (rc *CalendarListReqCall) SetPageSize(pageSize int) {
	rc.queryParams["page_size"] = pageSize
}
func (rc *CalendarListReqCall) SetPageToken(pageToken string) {
	rc.queryParams["page_token"] = pageToken
}
func (rc *CalendarListReqCall) SetSyncToken(syncToken string) {
	rc.queryParams["sync_token"] = syncToken
}

func (rc *CalendarListReqCall) Do() (*CalendarListResult, error) {
	rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams))
	var result = &CalendarListResult{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars", "GET",
		[]request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, nil, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendars.service.conf, req)
	return result, err
}

func (calendars *CalendarService) List(ctx *core.Context, optFns ...request.OptFn) *CalendarListReqCall {
	return &CalendarListReqCall{
		ctx:         ctx,
		calendars:   calendars,
		queryParams: map[string]interface{}{},
		optFns:      optFns,
	}
}

type CalendarEventAttendeeListReqCall struct {
	ctx                    *core.Context
	calendarEventAttendees *CalendarEventAttendeeService
	pathParams             map[string]interface{}
	queryParams            map[string]interface{}
	optFns                 []request.OptFn
}

func (rc *CalendarEventAttendeeListReqCall) SetCalendarId(calendarId string) {
	rc.pathParams["calendar_id"] = calendarId
}
func (rc *CalendarEventAttendeeListReqCall) SetEventId(eventId string) {
	rc.pathParams["event_id"] = eventId
}
func (rc *CalendarEventAttendeeListReqCall) SetUserIdType(userIdType string) {
	rc.queryParams["user_id_type"] = userIdType
}
func (rc *CalendarEventAttendeeListReqCall) SetPageToken(pageToken string) {
	rc.queryParams["page_token"] = pageToken
}
func (rc *CalendarEventAttendeeListReqCall) SetPageSize(pageSize int) {
	rc.queryParams["page_size"] = pageSize
}

func (rc *CalendarEventAttendeeListReqCall) Do() (*CalendarEventAttendeeListResult, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams))
	var result = &CalendarEventAttendeeListResult{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id/attendees", "GET",
		[]request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, nil, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendarEventAttendees.service.conf, req)
	return result, err
}

func (calendarEventAttendees *CalendarEventAttendeeService) List(ctx *core.Context, optFns ...request.OptFn) *CalendarEventAttendeeListReqCall {
	return &CalendarEventAttendeeListReqCall{
		ctx:                    ctx,
		calendarEventAttendees: calendarEventAttendees,
		pathParams:             map[string]interface{}{},
		queryParams:            map[string]interface{}{},
		optFns:                 optFns,
	}
}

type CalendarEventAttendeeBatchDeleteReqCall struct {
	ctx                    *core.Context
	calendarEventAttendees *CalendarEventAttendeeService
	body                   *CalendarEventAttendeeBatchDeleteReqBody
	pathParams             map[string]interface{}
	optFns                 []request.OptFn
}

func (rc *CalendarEventAttendeeBatchDeleteReqCall) SetCalendarId(calendarId string) {
	rc.pathParams["calendar_id"] = calendarId
}
func (rc *CalendarEventAttendeeBatchDeleteReqCall) SetEventId(eventId string) {
	rc.pathParams["event_id"] = eventId
}

func (rc *CalendarEventAttendeeBatchDeleteReqCall) Do() (*response.NoData, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	var result = &response.NoData{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id/attendees/batch_delete", "POST",
		[]request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, rc.body, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendarEventAttendees.service.conf, req)
	return result, err
}

func (calendarEventAttendees *CalendarEventAttendeeService) BatchDelete(ctx *core.Context, body *CalendarEventAttendeeBatchDeleteReqBody, optFns ...request.OptFn) *CalendarEventAttendeeBatchDeleteReqCall {
	return &CalendarEventAttendeeBatchDeleteReqCall{
		ctx:                    ctx,
		calendarEventAttendees: calendarEventAttendees,
		body:                   body,
		pathParams:             map[string]interface{}{},
		optFns:                 optFns,
	}
}

type CalendarEventAttendeeCreateReqCall struct {
	ctx                    *core.Context
	calendarEventAttendees *CalendarEventAttendeeService
	body                   *CalendarEventAttendeeCreateReqBody
	pathParams             map[string]interface{}
	queryParams            map[string]interface{}
	optFns                 []request.OptFn
}

func (rc *CalendarEventAttendeeCreateReqCall) SetCalendarId(calendarId string) {
	rc.pathParams["calendar_id"] = calendarId
}
func (rc *CalendarEventAttendeeCreateReqCall) SetEventId(eventId string) {
	rc.pathParams["event_id"] = eventId
}
func (rc *CalendarEventAttendeeCreateReqCall) SetUserIdType(userIdType string) {
	rc.queryParams["user_id_type"] = userIdType
}

func (rc *CalendarEventAttendeeCreateReqCall) Do() (*CalendarEventAttendeeCreateResult, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams))
	var result = &CalendarEventAttendeeCreateResult{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id/attendees", "POST",
		[]request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, rc.body, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendarEventAttendees.service.conf, req)
	return result, err
}

func (calendarEventAttendees *CalendarEventAttendeeService) Create(ctx *core.Context, body *CalendarEventAttendeeCreateReqBody, optFns ...request.OptFn) *CalendarEventAttendeeCreateReqCall {
	return &CalendarEventAttendeeCreateReqCall{
		ctx:                    ctx,
		calendarEventAttendees: calendarEventAttendees,
		body:                   body,
		pathParams:             map[string]interface{}{},
		queryParams:            map[string]interface{}{},
		optFns:                 optFns,
	}
}

type CalendarGetReqCall struct {
	ctx        *core.Context
	calendars  *CalendarService
	pathParams map[string]interface{}
	optFns     []request.OptFn
}

func (rc *CalendarGetReqCall) SetCalendarId(calendarId string) {
	rc.pathParams["calendar_id"] = calendarId
}

func (rc *CalendarGetReqCall) Do() (*Calendar, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	var result = &Calendar{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/:calendar_id", "GET",
		[]request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, nil, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendars.service.conf, req)
	return result, err
}

func (calendars *CalendarService) Get(ctx *core.Context, optFns ...request.OptFn) *CalendarGetReqCall {
	return &CalendarGetReqCall{
		ctx:        ctx,
		calendars:  calendars,
		pathParams: map[string]interface{}{},
		optFns:     optFns,
	}
}

type CalendarEventListReqCall struct {
	ctx            *core.Context
	calendarEvents *CalendarEventService
	pathParams     map[string]interface{}
	queryParams    map[string]interface{}
	optFns         []request.OptFn
}

func (rc *CalendarEventListReqCall) SetCalendarId(calendarId string) {
	rc.pathParams["calendar_id"] = calendarId
}
func (rc *CalendarEventListReqCall) SetPageSize(pageSize int) {
	rc.queryParams["page_size"] = pageSize
}
func (rc *CalendarEventListReqCall) SetAnchorTime(anchorTime string) {
	rc.queryParams["anchor_time"] = anchorTime
}
func (rc *CalendarEventListReqCall) SetPageToken(pageToken string) {
	rc.queryParams["page_token"] = pageToken
}
func (rc *CalendarEventListReqCall) SetSyncToken(syncToken string) {
	rc.queryParams["sync_token"] = syncToken
}

func (rc *CalendarEventListReqCall) Do() (*CalendarEventListResult, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams))
	var result = &CalendarEventListResult{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/:calendar_id/events", "GET",
		[]request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, nil, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendarEvents.service.conf, req)
	return result, err
}

func (calendarEvents *CalendarEventService) List(ctx *core.Context, optFns ...request.OptFn) *CalendarEventListReqCall {
	return &CalendarEventListReqCall{
		ctx:            ctx,
		calendarEvents: calendarEvents,
		pathParams:     map[string]interface{}{},
		queryParams:    map[string]interface{}{},
		optFns:         optFns,
	}
}

type CalendarSearchReqCall struct {
	ctx         *core.Context
	calendars   *CalendarService
	body        *CalendarSearchReqBody
	queryParams map[string]interface{}
	optFns      []request.OptFn
}

func (rc *CalendarSearchReqCall) SetPageToken(pageToken string) {
	rc.queryParams["page_token"] = pageToken
}
func (rc *CalendarSearchReqCall) SetPageSize(pageSize int) {
	rc.queryParams["page_size"] = pageSize
}

func (rc *CalendarSearchReqCall) Do() (*CalendarSearchResult, error) {
	rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams))
	var result = &CalendarSearchResult{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/search", "POST",
		[]request.AccessTokenType{request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendars.service.conf, req)
	return result, err
}

func (calendars *CalendarService) Search(ctx *core.Context, body *CalendarSearchReqBody, optFns ...request.OptFn) *CalendarSearchReqCall {
	return &CalendarSearchReqCall{
		ctx:         ctx,
		calendars:   calendars,
		body:        body,
		queryParams: map[string]interface{}{},
		optFns:      optFns,
	}
}

type FreebusyListReqCall struct {
	ctx         *core.Context
	freebusys   *FreebusyService
	body        *FreebusyListReqBody
	queryParams map[string]interface{}
	optFns      []request.OptFn
}

func (rc *FreebusyListReqCall) SetUserIdType(userIdType string) {
	rc.queryParams["user_id_type"] = userIdType
}

func (rc *FreebusyListReqCall) Do() (*FreebusyListResult, error) {
	rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams))
	var result = &FreebusyListResult{}
	req := request.NewRequest("/open-apis/calendar/v4/freebusy/list", "POST",
		[]request.AccessTokenType{request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.freebusys.service.conf, req)
	return result, err
}

func (freebusys *FreebusyService) List(ctx *core.Context, body *FreebusyListReqBody, optFns ...request.OptFn) *FreebusyListReqCall {
	return &FreebusyListReqCall{
		ctx:         ctx,
		freebusys:   freebusys,
		body:        body,
		queryParams: map[string]interface{}{},
		optFns:      optFns,
	}
}

type CalendarEventPatchReqCall struct {
	ctx            *core.Context
	calendarEvents *CalendarEventService
	body           *CalendarEvent
	pathParams     map[string]interface{}
	optFns         []request.OptFn
}

func (rc *CalendarEventPatchReqCall) SetCalendarId(calendarId string) {
	rc.pathParams["calendar_id"] = calendarId
}
func (rc *CalendarEventPatchReqCall) SetEventId(eventId string) {
	rc.pathParams["event_id"] = eventId
}

func (rc *CalendarEventPatchReqCall) Do() (*CalendarEventPatchResult, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	var result = &CalendarEventPatchResult{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id", "PATCH",
		[]request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, rc.body, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendarEvents.service.conf, req)
	return result, err
}

func (calendarEvents *CalendarEventService) Patch(ctx *core.Context, body *CalendarEvent, optFns ...request.OptFn) *CalendarEventPatchReqCall {
	return &CalendarEventPatchReqCall{
		ctx:            ctx,
		calendarEvents: calendarEvents,
		body:           body,
		pathParams:     map[string]interface{}{},
		optFns:         optFns,
	}
}

type TimeoffEventDeleteReqCall struct {
	ctx           *core.Context
	timeoffEvents *TimeoffEventService
	pathParams    map[string]interface{}
	optFns        []request.OptFn
}

func (rc *TimeoffEventDeleteReqCall) SetTimeoffEventId(timeoffEventId string) {
	rc.pathParams["timeoff_event_id"] = timeoffEventId
}

func (rc *TimeoffEventDeleteReqCall) Do() (*response.NoData, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	var result = &response.NoData{}
	req := request.NewRequest("/open-apis/calendar/v4/timeoff_events/:timeoff_event_id", "DELETE",
		[]request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.timeoffEvents.service.conf, req)
	return result, err
}

func (timeoffEvents *TimeoffEventService) Delete(ctx *core.Context, optFns ...request.OptFn) *TimeoffEventDeleteReqCall {
	return &TimeoffEventDeleteReqCall{
		ctx:           ctx,
		timeoffEvents: timeoffEvents,
		pathParams:    map[string]interface{}{},
		optFns:        optFns,
	}
}

type TimeoffEventCreateReqCall struct {
	ctx           *core.Context
	timeoffEvents *TimeoffEventService
	body          *TimeoffEvent
	queryParams   map[string]interface{}
	optFns        []request.OptFn
}

func (rc *TimeoffEventCreateReqCall) SetUserIdType(userIdType string) {
	rc.queryParams["user_id_type"] = userIdType
}

func (rc *TimeoffEventCreateReqCall) Do() (*TimeoffEvent, error) {
	rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams))
	var result = &TimeoffEvent{}
	req := request.NewRequest("/open-apis/calendar/v4/timeoff_events", "POST",
		[]request.AccessTokenType{request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.timeoffEvents.service.conf, req)
	return result, err
}

func (timeoffEvents *TimeoffEventService) Create(ctx *core.Context, body *TimeoffEvent, optFns ...request.OptFn) *TimeoffEventCreateReqCall {
	return &TimeoffEventCreateReqCall{
		ctx:           ctx,
		timeoffEvents: timeoffEvents,
		body:          body,
		queryParams:   map[string]interface{}{},
		optFns:        optFns,
	}
}

type CalendarUnsubscribeReqCall struct {
	ctx        *core.Context
	calendars  *CalendarService
	pathParams map[string]interface{}
	optFns     []request.OptFn
}

func (rc *CalendarUnsubscribeReqCall) SetCalendarId(calendarId string) {
	rc.pathParams["calendar_id"] = calendarId
}

func (rc *CalendarUnsubscribeReqCall) Do() (*response.NoData, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	var result = &response.NoData{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/:calendar_id/unsubscribe", "POST",
		[]request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, nil, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendars.service.conf, req)
	return result, err
}

func (calendars *CalendarService) Unsubscribe(ctx *core.Context, optFns ...request.OptFn) *CalendarUnsubscribeReqCall {
	return &CalendarUnsubscribeReqCall{
		ctx:        ctx,
		calendars:  calendars,
		pathParams: map[string]interface{}{},
		optFns:     optFns,
	}
}

type CalendarEventSearchReqCall struct {
	ctx            *core.Context
	calendarEvents *CalendarEventService
	body           *CalendarEventSearchReqBody
	pathParams     map[string]interface{}
	queryParams    map[string]interface{}
	optFns         []request.OptFn
}

func (rc *CalendarEventSearchReqCall) SetCalendarId(calendarId string) {
	rc.pathParams["calendar_id"] = calendarId
}
func (rc *CalendarEventSearchReqCall) SetUserIdType(userIdType string) {
	rc.queryParams["user_id_type"] = userIdType
}
func (rc *CalendarEventSearchReqCall) SetPageToken(pageToken string) {
	rc.queryParams["page_token"] = pageToken
}
func (rc *CalendarEventSearchReqCall) SetPageSize(pageSize int) {
	rc.queryParams["page_size"] = pageSize
}

func (rc *CalendarEventSearchReqCall) Do() (*CalendarEventSearchResult, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams))
	var result = &CalendarEventSearchResult{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/:calendar_id/events/search", "POST",
		[]request.AccessTokenType{request.AccessTokenTypeUser}, rc.body, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendarEvents.service.conf, req)
	return result, err
}

func (calendarEvents *CalendarEventService) Search(ctx *core.Context, body *CalendarEventSearchReqBody, optFns ...request.OptFn) *CalendarEventSearchReqCall {
	return &CalendarEventSearchReqCall{
		ctx:            ctx,
		calendarEvents: calendarEvents,
		body:           body,
		pathParams:     map[string]interface{}{},
		queryParams:    map[string]interface{}{},
		optFns:         optFns,
	}
}

type CalendarSubscribeReqCall struct {
	ctx        *core.Context
	calendars  *CalendarService
	pathParams map[string]interface{}
	optFns     []request.OptFn
}

func (rc *CalendarSubscribeReqCall) SetCalendarId(calendarId string) {
	rc.pathParams["calendar_id"] = calendarId
}

func (rc *CalendarSubscribeReqCall) Do() (*CalendarSubscribeResult, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	var result = &CalendarSubscribeResult{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/:calendar_id/subscribe", "POST",
		[]request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, nil, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendars.service.conf, req)
	return result, err
}

func (calendars *CalendarService) Subscribe(ctx *core.Context, optFns ...request.OptFn) *CalendarSubscribeReqCall {
	return &CalendarSubscribeReqCall{
		ctx:        ctx,
		calendars:  calendars,
		pathParams: map[string]interface{}{},
		optFns:     optFns,
	}
}

type SettingGenerateCaldavConfReqCall struct {
	ctx      *core.Context
	settings *SettingService
	body     *SettingGenerateCaldavConfReqBody
	optFns   []request.OptFn
}

func (rc *SettingGenerateCaldavConfReqCall) Do() (*SettingGenerateCaldavConfResult, error) {
	var result = &SettingGenerateCaldavConfResult{}
	req := request.NewRequest("/open-apis/calendar/v4/settings/generate_caldav_conf", "POST",
		[]request.AccessTokenType{request.AccessTokenTypeUser}, rc.body, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.settings.service.conf, req)
	return result, err
}

func (settings *SettingService) GenerateCaldavConf(ctx *core.Context, body *SettingGenerateCaldavConfReqBody, optFns ...request.OptFn) *SettingGenerateCaldavConfReqCall {
	return &SettingGenerateCaldavConfReqCall{
		ctx:      ctx,
		settings: settings,
		body:     body,
		optFns:   optFns,
	}
}

type CalendarEventSubscriptionReqCall struct {
	ctx            *core.Context
	calendarEvents *CalendarEventService
	pathParams     map[string]interface{}
	optFns         []request.OptFn
}

func (rc *CalendarEventSubscriptionReqCall) SetCalendarId(calendarId string) {
	rc.pathParams["calendar_id"] = calendarId
}

func (rc *CalendarEventSubscriptionReqCall) Do() (*response.NoData, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	var result = &response.NoData{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/:calendar_id/events/subscription", "POST",
		[]request.AccessTokenType{request.AccessTokenTypeUser}, nil, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendarEvents.service.conf, req)
	return result, err
}

func (calendarEvents *CalendarEventService) Subscription(ctx *core.Context, optFns ...request.OptFn) *CalendarEventSubscriptionReqCall {
	return &CalendarEventSubscriptionReqCall{
		ctx:            ctx,
		calendarEvents: calendarEvents,
		pathParams:     map[string]interface{}{},
		optFns:         optFns,
	}
}

type CalendarSubscriptionReqCall struct {
	ctx       *core.Context
	calendars *CalendarService
	optFns    []request.OptFn
}

func (rc *CalendarSubscriptionReqCall) Do() (*response.NoData, error) {
	var result = &response.NoData{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/subscription", "POST",
		[]request.AccessTokenType{request.AccessTokenTypeUser}, nil, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendars.service.conf, req)
	return result, err
}

func (calendars *CalendarService) Subscription(ctx *core.Context, optFns ...request.OptFn) *CalendarSubscriptionReqCall {
	return &CalendarSubscriptionReqCall{
		ctx:       ctx,
		calendars: calendars,
		optFns:    optFns,
	}
}

type CalendarAclSubscriptionReqCall struct {
	ctx          *core.Context
	calendarAcls *CalendarAclService
	pathParams   map[string]interface{}
	optFns       []request.OptFn
}

func (rc *CalendarAclSubscriptionReqCall) SetCalendarId(calendarId string) {
	rc.pathParams["calendar_id"] = calendarId
}

func (rc *CalendarAclSubscriptionReqCall) Do() (*response.NoData, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	var result = &response.NoData{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/:calendar_id/acls/subscription", "POST",
		[]request.AccessTokenType{request.AccessTokenTypeUser}, nil, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendarAcls.service.conf, req)
	return result, err
}

func (calendarAcls *CalendarAclService) Subscription(ctx *core.Context, optFns ...request.OptFn) *CalendarAclSubscriptionReqCall {
	return &CalendarAclSubscriptionReqCall{
		ctx:          ctx,
		calendarAcls: calendarAcls,
		pathParams:   map[string]interface{}{},
		optFns:       optFns,
	}
}

type CalendarEventAttendeeChatMemberListReqCall struct {
	ctx                              *core.Context
	calendarEventAttendeeChatMembers *CalendarEventAttendeeChatMemberService
	pathParams                       map[string]interface{}
	queryParams                      map[string]interface{}
	optFns                           []request.OptFn
}

func (rc *CalendarEventAttendeeChatMemberListReqCall) SetCalendarId(calendarId string) {
	rc.pathParams["calendar_id"] = calendarId
}
func (rc *CalendarEventAttendeeChatMemberListReqCall) SetEventId(eventId string) {
	rc.pathParams["event_id"] = eventId
}
func (rc *CalendarEventAttendeeChatMemberListReqCall) SetAttendeeId(attendeeId string) {
	rc.pathParams["attendee_id"] = attendeeId
}
func (rc *CalendarEventAttendeeChatMemberListReqCall) SetPageToken(pageToken string) {
	rc.queryParams["page_token"] = pageToken
}
func (rc *CalendarEventAttendeeChatMemberListReqCall) SetPageSize(pageSize int) {
	rc.queryParams["page_size"] = pageSize
}

func (rc *CalendarEventAttendeeChatMemberListReqCall) Do() (*CalendarEventAttendeeChatMemberListResult, error) {
	rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams))
	rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams))
	var result = &CalendarEventAttendeeChatMemberListResult{}
	req := request.NewRequest("/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id/attendees/:attendee_id/chat_members", "GET",
		[]request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, nil, result, rc.optFns...)
	err := api.Send(rc.ctx, rc.calendarEventAttendeeChatMembers.service.conf, req)
	return result, err
}

func (calendarEventAttendeeChatMembers *CalendarEventAttendeeChatMemberService) List(ctx *core.Context, optFns ...request.OptFn) *CalendarEventAttendeeChatMemberListReqCall {
	return &CalendarEventAttendeeChatMemberListReqCall{
		ctx:                              ctx,
		calendarEventAttendeeChatMembers: calendarEventAttendeeChatMembers,
		pathParams:                       map[string]interface{}{},
		queryParams:                      map[string]interface{}{},
		optFns:                           optFns,
	}
}
