diff --git a/api/core/handlers/handlers.go b/api/core/handlers/handlers.go index f6d38f3a..dd88d383 100644 --- a/api/core/handlers/handlers.go +++ b/api/core/handlers/handlers.go @@ -117,10 +117,10 @@ func validateFunc(ctx *core.Context, req *request.Request) { req.Err = errors.ErrTenantKeyIsEmpty return } - if req.AccessTokenType == request.AccessTokenTypeUser && req.UserAccessToken == "" { - req.Err = errors.ErrUserAccessTokenKeyIsEmpty - return - } + } + if req.AccessTokenType == request.AccessTokenTypeUser && req.UserAccessToken == "" { + req.Err = errors.ErrUserAccessTokenKeyIsEmpty + return } } diff --git a/service/bitable/v1/api.go b/service/bitable/v1/api.go new file mode 100644 index 00000000..eaa6c729 --- /dev/null +++ b/service/bitable/v1/api.go @@ -0,0 +1,490 @@ +// Code generated by lark suite oapi sdk gen +package v1 + +import ( + "github.com/larksuite/oapi-sdk-go/api" + "github.com/larksuite/oapi-sdk-go/api/core/request" + "github.com/larksuite/oapi-sdk-go/core" + "github.com/larksuite/oapi-sdk-go/core/config" +) + +type Service struct { + conf *config.Config + Apps *AppService + AppTables *AppTableService + AppTableFields *AppTableFieldService + AppTableRecords *AppTableRecordService +} + +func NewService(conf *config.Config) *Service { + s := &Service{ + conf: conf, + } + s.Apps = newAppService(s) + s.AppTables = newAppTableService(s) + s.AppTableFields = newAppTableFieldService(s) + s.AppTableRecords = newAppTableRecordService(s) + return s +} + +type AppService struct { + service *Service +} + +func newAppService(service *Service) *AppService { + return &AppService{ + service: service, + } +} + +type AppTableService struct { + service *Service +} + +func newAppTableService(service *Service) *AppTableService { + return &AppTableService{ + service: service, + } +} + +type AppTableFieldService struct { + service *Service +} + +func newAppTableFieldService(service *Service) *AppTableFieldService { + return &AppTableFieldService{ + service: service, + } +} + +type AppTableRecordService struct { + service *Service +} + +func newAppTableRecordService(service *Service) *AppTableRecordService { + return &AppTableRecordService{ + service: service, + } +} + +type AppTableRecordBatchDeleteReqCall struct { + ctx *core.Context + appTableRecords *AppTableRecordService + body *AppTableRecordBatchDeleteReqBody + pathParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *AppTableRecordBatchDeleteReqCall) SetAppToken(appToken string) { + rc.pathParams["app_token"] = appToken +} +func (rc *AppTableRecordBatchDeleteReqCall) SetTableId(tableId string) { + rc.pathParams["table_id"] = tableId +} + +func (rc *AppTableRecordBatchDeleteReqCall) Do() (*AppTableRecordBatchDeleteResult, error) { + rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) + var result = &AppTableRecordBatchDeleteResult{} + req := request.NewRequest("bitable/v1/apps/:app_token/tables/:table_id/records/batch_delete", "POST", + []request.AccessTokenType{request.AccessTokenTypeUser}, rc.body, result, rc.optFns...) + err := api.Send(rc.ctx, rc.appTableRecords.service.conf, req) + return result, err +} + +func (appTableRecords *AppTableRecordService) BatchDelete(ctx *core.Context, body *AppTableRecordBatchDeleteReqBody, optFns ...request.OptFn) *AppTableRecordBatchDeleteReqCall { + return &AppTableRecordBatchDeleteReqCall{ + ctx: ctx, + appTableRecords: appTableRecords, + body: body, + pathParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type AppTableRecordBatchCreateReqCall struct { + ctx *core.Context + appTableRecords *AppTableRecordService + body *AppTableRecordBatchCreateReqBody + pathParams map[string]interface{} + queryParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *AppTableRecordBatchCreateReqCall) SetAppToken(appToken string) { + rc.pathParams["app_token"] = appToken +} +func (rc *AppTableRecordBatchCreateReqCall) SetTableId(tableId string) { + rc.pathParams["table_id"] = tableId +} +func (rc *AppTableRecordBatchCreateReqCall) SetUserIdType(userIdType string) { + rc.queryParams["user_id_type"] = userIdType +} + +func (rc *AppTableRecordBatchCreateReqCall) Do() (*AppTableRecordBatchCreateResult, error) { + rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &AppTableRecordBatchCreateResult{} + req := request.NewRequest("bitable/v1/apps/:app_token/tables/:table_id/records/batch_create", "POST", + []request.AccessTokenType{request.AccessTokenTypeUser}, rc.body, result, rc.optFns...) + err := api.Send(rc.ctx, rc.appTableRecords.service.conf, req) + return result, err +} + +func (appTableRecords *AppTableRecordService) BatchCreate(ctx *core.Context, body *AppTableRecordBatchCreateReqBody, optFns ...request.OptFn) *AppTableRecordBatchCreateReqCall { + return &AppTableRecordBatchCreateReqCall{ + ctx: ctx, + appTableRecords: appTableRecords, + body: body, + pathParams: map[string]interface{}{}, + queryParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type AppTableRecordGetReqCall struct { + ctx *core.Context + appTableRecords *AppTableRecordService + pathParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *AppTableRecordGetReqCall) SetAppToken(appToken string) { + rc.pathParams["app_token"] = appToken +} +func (rc *AppTableRecordGetReqCall) SetTableId(tableId string) { + rc.pathParams["table_id"] = tableId +} +func (rc *AppTableRecordGetReqCall) SetRecordId(recordId string) { + rc.pathParams["record_id"] = recordId +} + +func (rc *AppTableRecordGetReqCall) Do() (*AppTableRecordGetResult, error) { + rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) + var result = &AppTableRecordGetResult{} + req := request.NewRequest("bitable/v1/apps/:app_token/tables/:table_id/records/:record_id", "GET", + []request.AccessTokenType{request.AccessTokenTypeUser}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.appTableRecords.service.conf, req) + return result, err +} + +func (appTableRecords *AppTableRecordService) Get(ctx *core.Context, optFns ...request.OptFn) *AppTableRecordGetReqCall { + return &AppTableRecordGetReqCall{ + ctx: ctx, + appTableRecords: appTableRecords, + pathParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type AppTableRecordUpdateReqCall struct { + ctx *core.Context + appTableRecords *AppTableRecordService + body *AppTableRecord + pathParams map[string]interface{} + queryParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *AppTableRecordUpdateReqCall) SetAppToken(appToken string) { + rc.pathParams["app_token"] = appToken +} +func (rc *AppTableRecordUpdateReqCall) SetTableId(tableId string) { + rc.pathParams["table_id"] = tableId +} +func (rc *AppTableRecordUpdateReqCall) SetRecordId(recordId string) { + rc.pathParams["record_id"] = recordId +} +func (rc *AppTableRecordUpdateReqCall) SetUserIdType(userIdType string) { + rc.queryParams["user_id_type"] = userIdType +} + +func (rc *AppTableRecordUpdateReqCall) Do() (*AppTableRecordUpdateResult, error) { + rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &AppTableRecordUpdateResult{} + req := request.NewRequest("bitable/v1/apps/:app_token/tables/:table_id/records/:record_id", "PUT", + []request.AccessTokenType{request.AccessTokenTypeUser}, rc.body, result, rc.optFns...) + err := api.Send(rc.ctx, rc.appTableRecords.service.conf, req) + return result, err +} + +func (appTableRecords *AppTableRecordService) Update(ctx *core.Context, body *AppTableRecord, optFns ...request.OptFn) *AppTableRecordUpdateReqCall { + return &AppTableRecordUpdateReqCall{ + ctx: ctx, + appTableRecords: appTableRecords, + body: body, + pathParams: map[string]interface{}{}, + queryParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type AppTableRecordDeleteReqCall struct { + ctx *core.Context + appTableRecords *AppTableRecordService + pathParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *AppTableRecordDeleteReqCall) SetAppToken(appToken string) { + rc.pathParams["app_token"] = appToken +} +func (rc *AppTableRecordDeleteReqCall) SetTableId(tableId string) { + rc.pathParams["table_id"] = tableId +} +func (rc *AppTableRecordDeleteReqCall) SetRecordId(recordId string) { + rc.pathParams["record_id"] = recordId +} + +func (rc *AppTableRecordDeleteReqCall) Do() (*DeleteRecord, error) { + rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) + var result = &DeleteRecord{} + req := request.NewRequest("bitable/v1/apps/:app_token/tables/:table_id/records/:record_id", "DELETE", + []request.AccessTokenType{request.AccessTokenTypeUser}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.appTableRecords.service.conf, req) + return result, err +} + +func (appTableRecords *AppTableRecordService) Delete(ctx *core.Context, optFns ...request.OptFn) *AppTableRecordDeleteReqCall { + return &AppTableRecordDeleteReqCall{ + ctx: ctx, + appTableRecords: appTableRecords, + pathParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type AppTableRecordListReqCall struct { + ctx *core.Context + appTableRecords *AppTableRecordService + pathParams map[string]interface{} + queryParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *AppTableRecordListReqCall) SetAppToken(appToken string) { + rc.pathParams["app_token"] = appToken +} +func (rc *AppTableRecordListReqCall) SetTableId(tableId string) { + rc.pathParams["table_id"] = tableId +} +func (rc *AppTableRecordListReqCall) SetViewId(viewId string) { + rc.queryParams["view_id"] = viewId +} +func (rc *AppTableRecordListReqCall) SetPageToken(pageToken string) { + rc.queryParams["page_token"] = pageToken +} +func (rc *AppTableRecordListReqCall) SetPageSize(pageSize int) { + rc.queryParams["page_size"] = pageSize +} + +func (rc *AppTableRecordListReqCall) Do() (*AppTableRecordListResult, error) { + rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &AppTableRecordListResult{} + req := request.NewRequest("bitable/v1/apps/:app_token/tables/:table_id/records", "GET", + []request.AccessTokenType{request.AccessTokenTypeUser}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.appTableRecords.service.conf, req) + return result, err +} + +func (appTableRecords *AppTableRecordService) List(ctx *core.Context, optFns ...request.OptFn) *AppTableRecordListReqCall { + return &AppTableRecordListReqCall{ + ctx: ctx, + appTableRecords: appTableRecords, + pathParams: map[string]interface{}{}, + queryParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type AppTableRecordBatchUpdateReqCall struct { + ctx *core.Context + appTableRecords *AppTableRecordService + body *AppTableRecordBatchUpdateReqBody + pathParams map[string]interface{} + queryParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *AppTableRecordBatchUpdateReqCall) SetAppToken(appToken string) { + rc.pathParams["app_token"] = appToken +} +func (rc *AppTableRecordBatchUpdateReqCall) SetTableId(tableId string) { + rc.pathParams["table_id"] = tableId +} +func (rc *AppTableRecordBatchUpdateReqCall) SetUserIdType(userIdType string) { + rc.queryParams["user_id_type"] = userIdType +} + +func (rc *AppTableRecordBatchUpdateReqCall) Do() (*AppTableRecordBatchUpdateResult, error) { + rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &AppTableRecordBatchUpdateResult{} + req := request.NewRequest("bitable/v1/apps/:app_token/tables/:table_id/records/batch_update", "POST", + []request.AccessTokenType{request.AccessTokenTypeUser}, rc.body, result, rc.optFns...) + err := api.Send(rc.ctx, rc.appTableRecords.service.conf, req) + return result, err +} + +func (appTableRecords *AppTableRecordService) BatchUpdate(ctx *core.Context, body *AppTableRecordBatchUpdateReqBody, optFns ...request.OptFn) *AppTableRecordBatchUpdateReqCall { + return &AppTableRecordBatchUpdateReqCall{ + ctx: ctx, + appTableRecords: appTableRecords, + body: body, + pathParams: map[string]interface{}{}, + queryParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type AppTableRecordCreateReqCall struct { + ctx *core.Context + appTableRecords *AppTableRecordService + body *AppTableRecord + pathParams map[string]interface{} + queryParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *AppTableRecordCreateReqCall) SetAppToken(appToken string) { + rc.pathParams["app_token"] = appToken +} +func (rc *AppTableRecordCreateReqCall) SetTableId(tableId string) { + rc.pathParams["table_id"] = tableId +} +func (rc *AppTableRecordCreateReqCall) SetUserIdType(userIdType string) { + rc.queryParams["user_id_type"] = userIdType +} + +func (rc *AppTableRecordCreateReqCall) Do() (*AppTableRecordCreateResult, error) { + rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &AppTableRecordCreateResult{} + req := request.NewRequest("bitable/v1/apps/:app_token/tables/:table_id/records", "POST", + []request.AccessTokenType{request.AccessTokenTypeUser}, rc.body, result, rc.optFns...) + err := api.Send(rc.ctx, rc.appTableRecords.service.conf, req) + return result, err +} + +func (appTableRecords *AppTableRecordService) Create(ctx *core.Context, body *AppTableRecord, optFns ...request.OptFn) *AppTableRecordCreateReqCall { + return &AppTableRecordCreateReqCall{ + ctx: ctx, + appTableRecords: appTableRecords, + body: body, + pathParams: map[string]interface{}{}, + queryParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type AppGetReqCall struct { + ctx *core.Context + apps *AppService + pathParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *AppGetReqCall) SetAppToken(appToken string) { + rc.pathParams["app_token"] = appToken +} + +func (rc *AppGetReqCall) Do() (*AppGetResult, error) { + rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) + var result = &AppGetResult{} + req := request.NewRequest("bitable/v1/apps/:app_token", "GET", + []request.AccessTokenType{request.AccessTokenTypeUser}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.apps.service.conf, req) + return result, err +} + +func (apps *AppService) Get(ctx *core.Context, optFns ...request.OptFn) *AppGetReqCall { + return &AppGetReqCall{ + ctx: ctx, + apps: apps, + pathParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type AppTableListReqCall struct { + ctx *core.Context + appTables *AppTableService + pathParams map[string]interface{} + queryParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *AppTableListReqCall) SetAppToken(appToken string) { + rc.pathParams["app_token"] = appToken +} +func (rc *AppTableListReqCall) SetPageToken(pageToken string) { + rc.queryParams["page_token"] = pageToken +} +func (rc *AppTableListReqCall) SetPageSize(pageSize int) { + rc.queryParams["page_size"] = pageSize +} + +func (rc *AppTableListReqCall) Do() (*AppTableListResult, error) { + rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &AppTableListResult{} + req := request.NewRequest("bitable/v1/apps/:app_token/tables", "GET", + []request.AccessTokenType{request.AccessTokenTypeUser}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.appTables.service.conf, req) + return result, err +} + +func (appTables *AppTableService) List(ctx *core.Context, optFns ...request.OptFn) *AppTableListReqCall { + return &AppTableListReqCall{ + ctx: ctx, + appTables: appTables, + pathParams: map[string]interface{}{}, + queryParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type AppTableFieldListReqCall struct { + ctx *core.Context + appTableFields *AppTableFieldService + pathParams map[string]interface{} + queryParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *AppTableFieldListReqCall) SetAppToken(appToken string) { + rc.pathParams["app_token"] = appToken +} +func (rc *AppTableFieldListReqCall) SetTableId(tableId string) { + rc.pathParams["table_id"] = tableId +} +func (rc *AppTableFieldListReqCall) SetViewId(viewId string) { + rc.queryParams["view_id"] = viewId +} +func (rc *AppTableFieldListReqCall) SetPageToken(pageToken string) { + rc.queryParams["page_token"] = pageToken +} +func (rc *AppTableFieldListReqCall) SetPageSize(pageSize int) { + rc.queryParams["page_size"] = pageSize +} + +func (rc *AppTableFieldListReqCall) Do() (*AppTableFieldListResult, error) { + rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &AppTableFieldListResult{} + req := request.NewRequest("bitable/v1/apps/:app_token/tables/:table_id/fields", "GET", + []request.AccessTokenType{request.AccessTokenTypeUser}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.appTableFields.service.conf, req) + return result, err +} + +func (appTableFields *AppTableFieldService) List(ctx *core.Context, optFns ...request.OptFn) *AppTableFieldListReqCall { + return &AppTableFieldListReqCall{ + ctx: ctx, + appTableFields: appTableFields, + pathParams: map[string]interface{}{}, + queryParams: map[string]interface{}{}, + optFns: optFns, + } +} diff --git a/service/bitable/v1/model.go b/service/bitable/v1/model.go new file mode 100644 index 00000000..af17d2ef --- /dev/null +++ b/service/bitable/v1/model.go @@ -0,0 +1,172 @@ +// Code generated by lark suite oapi sdk gen +package v1 + +import ( + "github.com/larksuite/oapi-sdk-go/api/core/tools" +) + +type DeleteRecord struct { + Deleted bool `json:"deleted,omitempty"` + RecordId string `json:"record_id,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *DeleteRecord) MarshalJSON() ([]byte, error) { + type cp DeleteRecord + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type Person struct { + Id string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + EnName string `json:"en_name,omitempty"` + Email string `json:"email,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *Person) MarshalJSON() ([]byte, error) { + type cp Person + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type App struct { + AppToken string `json:"app_token,omitempty"` + Revision int `json:"revision,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *App) MarshalJSON() ([]byte, error) { + type cp App + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type AppTable struct { + TableId string `json:"table_id,omitempty"` + Revision int `json:"revision,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *AppTable) MarshalJSON() ([]byte, error) { + type cp AppTable + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type AppTableField struct { + FieldId string `json:"field_id,omitempty"` + FieldName string `json:"field_name,omitempty"` + Type int `json:"type,omitempty"` + Property interface{} `json:"property,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *AppTableField) MarshalJSON() ([]byte, error) { + type cp AppTableField + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type AppTableRecord struct { + RecordId string `json:"record_id,omitempty"` + Fields map[string]interface{} `json:"fields,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *AppTableRecord) MarshalJSON() ([]byte, error) { + type cp AppTableRecord + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type Option struct { + Name string `json:"name,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *Option) MarshalJSON() ([]byte, error) { + type cp Option + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type AppTableRecordBatchDeleteReqBody struct { + Records []string `json:"records,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *AppTableRecordBatchDeleteReqBody) MarshalJSON() ([]byte, error) { + type cp AppTableRecordBatchDeleteReqBody + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type AppTableRecordBatchDeleteResult struct { + Records []*DeleteRecord `json:"records,omitempty"` +} + +type AppTableRecordBatchCreateReqBody struct { + Records []*AppTableRecord `json:"records,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *AppTableRecordBatchCreateReqBody) MarshalJSON() ([]byte, error) { + type cp AppTableRecordBatchCreateReqBody + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type AppTableRecordBatchCreateResult struct { + Records []*AppTableRecord `json:"records,omitempty"` +} + +type AppTableRecordGetResult struct { + Record *AppTableRecord `json:"record,omitempty"` +} + +type AppTableRecordUpdateResult struct { + Record *AppTableRecord `json:"record,omitempty"` +} + +type AppTableRecordListResult struct { + HasMore bool `json:"has_more,omitempty"` + PageToken string `json:"page_token,omitempty"` + Items []*AppTableRecord `json:"items,omitempty"` +} + +type AppTableRecordBatchUpdateReqBody struct { + Records []*AppTableRecord `json:"records,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *AppTableRecordBatchUpdateReqBody) MarshalJSON() ([]byte, error) { + type cp AppTableRecordBatchUpdateReqBody + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type AppTableRecordBatchUpdateResult struct { + Records []*AppTableRecord `json:"records,omitempty"` +} + +type AppTableRecordCreateResult struct { + Record *AppTableRecord `json:"record,omitempty"` +} + +type AppGetResult struct { + App *App `json:"app,omitempty"` +} + +type AppTableListResult struct { + HasMore bool `json:"has_more,omitempty"` + PageToken string `json:"page_token,omitempty"` + Items []*AppTable `json:"items,omitempty"` +} + +type AppTableFieldListResult struct { + HasMore bool `json:"has_more,omitempty"` + PageToken string `json:"page_token,omitempty"` + Items []*AppTableField `json:"items,omitempty"` +} diff --git a/service/calendar/v4/api.go b/service/calendar/v4/api.go index 7208f5b6..3501fca9 100644 --- a/service/calendar/v4/api.go +++ b/service/calendar/v4/api.go @@ -405,41 +405,6 @@ func (calendarAcls *CalendarAclService) Create(ctx *core.Context, body *Calendar } } -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("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 @@ -484,6 +449,41 @@ func (calendarEventAttendees *CalendarEventAttendeeService) List(ctx *core.Conte } } +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("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 CalendarEventAttendeeBatchDeleteReqCall struct { ctx *core.Context calendarEventAttendees *CalendarEventAttendeeService diff --git a/service/calendar/v4/model.go b/service/calendar/v4/model.go index b15184e8..03c74ded 100644 --- a/service/calendar/v4/model.go +++ b/service/calendar/v4/model.go @@ -260,6 +260,12 @@ type CalendarEventCreateResult struct { Event *CalendarEvent `json:"event,omitempty"` } +type CalendarEventAttendeeListResult struct { + Items []*CalendarEventAttendee `json:"items,omitempty"` + HasMore bool `json:"has_more,omitempty"` + PageToken string `json:"page_token,omitempty"` +} + type CalendarListResult struct { HasMore bool `json:"has_more,omitempty"` PageToken string `json:"page_token,omitempty"` @@ -267,12 +273,6 @@ type CalendarListResult struct { CalendarList []*Calendar `json:"calendar_list,omitempty"` } -type CalendarEventAttendeeListResult struct { - Items []*CalendarEventAttendee `json:"items,omitempty"` - HasMore bool `json:"has_more,omitempty"` - PageToken string `json:"page_token,omitempty"` -} - type CalendarEventAttendeeBatchDeleteReqBody struct { AttendeeIds []string `json:"attendee_ids,omitempty"` ForceSendFields []string `json:"-"` diff --git a/service/im/v1/api.go b/service/im/v1/api.go index c5bf154f..1b5b5440 100644 --- a/service/im/v1/api.go +++ b/service/im/v1/api.go @@ -12,55 +12,51 @@ import ( type Service struct { conf *config.Config + Messages *MessageService Chats *ChatService - ChatMemberBots *ChatMemberBotService ChatMemberUsers *ChatMemberUserService - Messages *MessageService - MessageReactions *MessageReactionService + ChatMemberBots *ChatMemberBotService ChatAnnouncements *ChatAnnouncementService ChatMemberss *ChatMembersService + ChatModerations *ChatModerationService Files *FileService Images *ImageService MessageResources *MessageResourceService - ChatModerations *ChatModerationService - ChatCustomBots *ChatCustomBotService } func NewService(conf *config.Config) *Service { s := &Service{ conf: conf, } + s.Messages = newMessageService(s) s.Chats = newChatService(s) - s.ChatMemberBots = newChatMemberBotService(s) s.ChatMemberUsers = newChatMemberUserService(s) - s.Messages = newMessageService(s) - s.MessageReactions = newMessageReactionService(s) + s.ChatMemberBots = newChatMemberBotService(s) s.ChatAnnouncements = newChatAnnouncementService(s) s.ChatMemberss = newChatMembersService(s) + s.ChatModerations = newChatModerationService(s) s.Files = newFileService(s) s.Images = newImageService(s) s.MessageResources = newMessageResourceService(s) - s.ChatModerations = newChatModerationService(s) - s.ChatCustomBots = newChatCustomBotService(s) return s } -type ChatService struct { +type MessageService struct { service *Service } -func newChatService(service *Service) *ChatService { - return &ChatService{ +func newMessageService(service *Service) *MessageService { + return &MessageService{ service: service, } } -type ChatMemberBotService struct { +type ChatService struct { service *Service } -func newChatMemberBotService(service *Service) *ChatMemberBotService { - return &ChatMemberBotService{ +func newChatService(service *Service) *ChatService { + return &ChatService{ service: service, } } @@ -75,42 +71,42 @@ func newChatMemberUserService(service *Service) *ChatMemberUserService { } } -type MessageService struct { +type ChatMemberBotService struct { service *Service } -func newMessageService(service *Service) *MessageService { - return &MessageService{ +func newChatMemberBotService(service *Service) *ChatMemberBotService { + return &ChatMemberBotService{ service: service, } } -type MessageReactionService struct { +type ChatAnnouncementService struct { service *Service } -func newMessageReactionService(service *Service) *MessageReactionService { - return &MessageReactionService{ +func newChatAnnouncementService(service *Service) *ChatAnnouncementService { + return &ChatAnnouncementService{ service: service, } } -type ChatAnnouncementService struct { +type ChatMembersService struct { service *Service } -func newChatAnnouncementService(service *Service) *ChatAnnouncementService { - return &ChatAnnouncementService{ +func newChatMembersService(service *Service) *ChatMembersService { + return &ChatMembersService{ service: service, } } -type ChatMembersService struct { +type ChatModerationService struct { service *Service } -func newChatMembersService(service *Service) *ChatMembersService { - return &ChatMembersService{ +func newChatModerationService(service *Service) *ChatModerationService { + return &ChatModerationService{ service: service, } } @@ -145,215 +141,247 @@ func newMessageResourceService(service *Service) *MessageResourceService { } } -type ChatModerationService struct { - service *Service +type MessageListReqCall struct { + ctx *core.Context + messages *MessageService + queryParams map[string]interface{} + optFns []request.OptFn } -func newChatModerationService(service *Service) *ChatModerationService { - return &ChatModerationService{ - service: service, - } +func (rc *MessageListReqCall) SetContainerIdType(containerIdType string) { + rc.queryParams["container_id_type"] = containerIdType } - -type ChatCustomBotService struct { - service *Service +func (rc *MessageListReqCall) SetContainerId(containerId string) { + rc.queryParams["container_id"] = containerId } - -func newChatCustomBotService(service *Service) *ChatCustomBotService { - return &ChatCustomBotService{ - service: service, - } +func (rc *MessageListReqCall) SetStartTime(startTime string) { + rc.queryParams["start_time"] = startTime } - -type FileGetReqCall struct { - ctx *core.Context - files *FileService - pathParams map[string]interface{} - optFns []request.OptFn - result io.Writer +func (rc *MessageListReqCall) SetEndTime(endTime string) { + rc.queryParams["end_time"] = endTime } - -func (rc *FileGetReqCall) SetFileKey(fileKey string) { - rc.pathParams["file_key"] = fileKey +func (rc *MessageListReqCall) SetPageToken(pageToken string) { + rc.queryParams["page_token"] = pageToken } -func (rc *FileGetReqCall) SetResponseStream(result io.Writer) { - rc.result = result +func (rc *MessageListReqCall) SetPageSize(pageSize int) { + rc.queryParams["page_size"] = pageSize } -func (rc *FileGetReqCall) Do() (io.Writer, error) { - rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) - rc.optFns = append(rc.optFns, request.SetResponseStream()) - req := request.NewRequest("im/v1/files/:file_key", "GET", - []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, rc.result, rc.optFns...) - err := api.Send(rc.ctx, rc.files.service.conf, req) - return rc.result, err +func (rc *MessageListReqCall) Do() (*MessageListResult, error) { + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &MessageListResult{} + req := request.NewRequest("im/v1/messages", "GET", + []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.messages.service.conf, req) + return result, err } -func (files *FileService) Get(ctx *core.Context, optFns ...request.OptFn) *FileGetReqCall { - return &FileGetReqCall{ - ctx: ctx, - files: files, - pathParams: map[string]interface{}{}, - optFns: optFns, +func (messages *MessageService) List(ctx *core.Context, optFns ...request.OptFn) *MessageListReqCall { + return &MessageListReqCall{ + ctx: ctx, + messages: messages, + queryParams: map[string]interface{}{}, + optFns: optFns, } } -type ChatAnnouncementGetReqCall struct { - ctx *core.Context - chatAnnouncements *ChatAnnouncementService - pathParams map[string]interface{} - queryParams map[string]interface{} - optFns []request.OptFn +type MessagePatchReqCall struct { + ctx *core.Context + messages *MessageService + body *MessagePatchReqBody + pathParams map[string]interface{} + optFns []request.OptFn } -func (rc *ChatAnnouncementGetReqCall) SetChatId(chatId string) { - rc.pathParams["chat_id"] = chatId -} -func (rc *ChatAnnouncementGetReqCall) SetUserIdType(userIdType string) { - rc.queryParams["user_id_type"] = userIdType +func (rc *MessagePatchReqCall) SetMessageId(messageId string) { + rc.pathParams["message_id"] = messageId } -func (rc *ChatAnnouncementGetReqCall) Do() (*ChatAnnouncementGetResult, error) { +func (rc *MessagePatchReqCall) Do() (*response.NoData, error) { rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) - rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) - var result = &ChatAnnouncementGetResult{} - req := request.NewRequest("im/v1/chats/:chat_id/announcement", "GET", - []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, nil, result, rc.optFns...) - err := api.Send(rc.ctx, rc.chatAnnouncements.service.conf, req) + var result = &response.NoData{} + req := request.NewRequest("im/v1/messages/:message_id", "PATCH", + []request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, rc.body, result, rc.optFns...) + err := api.Send(rc.ctx, rc.messages.service.conf, req) return result, err } -func (chatAnnouncements *ChatAnnouncementService) Get(ctx *core.Context, optFns ...request.OptFn) *ChatAnnouncementGetReqCall { - return &ChatAnnouncementGetReqCall{ - ctx: ctx, - chatAnnouncements: chatAnnouncements, - pathParams: map[string]interface{}{}, - queryParams: map[string]interface{}{}, - optFns: optFns, +func (messages *MessageService) Patch(ctx *core.Context, body *MessagePatchReqBody, optFns ...request.OptFn) *MessagePatchReqCall { + return &MessagePatchReqCall{ + ctx: ctx, + messages: messages, + body: body, + pathParams: map[string]interface{}{}, + optFns: optFns, } } -type ImageGetReqCall struct { +type MessageReplyReqCall struct { ctx *core.Context - images *ImageService + messages *MessageService + body *MessageReplyReqBody pathParams map[string]interface{} optFns []request.OptFn - result io.Writer } -func (rc *ImageGetReqCall) SetImageKey(imageKey string) { - rc.pathParams["image_key"] = imageKey -} -func (rc *ImageGetReqCall) SetResponseStream(result io.Writer) { - rc.result = result +func (rc *MessageReplyReqCall) SetMessageId(messageId string) { + rc.pathParams["message_id"] = messageId } -func (rc *ImageGetReqCall) Do() (io.Writer, error) { +func (rc *MessageReplyReqCall) Do() (*Message, error) { rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) - rc.optFns = append(rc.optFns, request.SetResponseStream()) - req := request.NewRequest("im/v1/images/:image_key", "GET", - []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, rc.result, rc.optFns...) - err := api.Send(rc.ctx, rc.images.service.conf, req) - return rc.result, err + var result = &Message{} + req := request.NewRequest("im/v1/messages/:message_id/reply", "POST", + []request.AccessTokenType{request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) + err := api.Send(rc.ctx, rc.messages.service.conf, req) + return result, err } -func (images *ImageService) Get(ctx *core.Context, optFns ...request.OptFn) *ImageGetReqCall { - return &ImageGetReqCall{ +func (messages *MessageService) Reply(ctx *core.Context, body *MessageReplyReqBody, optFns ...request.OptFn) *MessageReplyReqCall { + return &MessageReplyReqCall{ ctx: ctx, - images: images, + messages: messages, + body: body, pathParams: map[string]interface{}{}, optFns: optFns, } } -type ChatAnnouncementPatchReqCall struct { - ctx *core.Context - chatAnnouncements *ChatAnnouncementService - body *ChatAnnouncementPatchReqBody - pathParams map[string]interface{} - optFns []request.OptFn +type MessageCreateReqCall struct { + ctx *core.Context + messages *MessageService + body *MessageCreateReqBody + queryParams map[string]interface{} + optFns []request.OptFn } -func (rc *ChatAnnouncementPatchReqCall) SetChatId(chatId string) { - rc.pathParams["chat_id"] = chatId +func (rc *MessageCreateReqCall) SetReceiveIdType(receiveIdType string) { + rc.queryParams["receive_id_type"] = receiveIdType } -func (rc *ChatAnnouncementPatchReqCall) Do() (*response.NoData, error) { - rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) - var result = &response.NoData{} - req := request.NewRequest("im/v1/chats/:chat_id/announcement", "PATCH", - []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) - err := api.Send(rc.ctx, rc.chatAnnouncements.service.conf, req) +func (rc *MessageCreateReqCall) Do() (*Message, error) { + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &Message{} + req := request.NewRequest("im/v1/messages", "POST", + []request.AccessTokenType{request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) + err := api.Send(rc.ctx, rc.messages.service.conf, req) return result, err } -func (chatAnnouncements *ChatAnnouncementService) Patch(ctx *core.Context, body *ChatAnnouncementPatchReqBody, optFns ...request.OptFn) *ChatAnnouncementPatchReqCall { - return &ChatAnnouncementPatchReqCall{ - ctx: ctx, - chatAnnouncements: chatAnnouncements, - body: body, - pathParams: map[string]interface{}{}, - optFns: optFns, +func (messages *MessageService) Create(ctx *core.Context, body *MessageCreateReqBody, optFns ...request.OptFn) *MessageCreateReqCall { + return &MessageCreateReqCall{ + ctx: ctx, + messages: messages, + body: body, + queryParams: map[string]interface{}{}, + optFns: optFns, } } -type ChatMembersMeJoinReqCall struct { - ctx *core.Context - chatMemberss *ChatMembersService - pathParams map[string]interface{} - optFns []request.OptFn +type MessageDeleteReqCall struct { + ctx *core.Context + messages *MessageService + pathParams map[string]interface{} + optFns []request.OptFn } -func (rc *ChatMembersMeJoinReqCall) SetChatId(chatId string) { - rc.pathParams["chat_id"] = chatId +func (rc *MessageDeleteReqCall) SetMessageId(messageId string) { + rc.pathParams["message_id"] = messageId } -func (rc *ChatMembersMeJoinReqCall) Do() (*response.NoData, error) { +func (rc *MessageDeleteReqCall) Do() (*response.NoData, error) { rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) var result = &response.NoData{} - req := request.NewRequest("im/v1/chats/:chat_id/members/me_join", "PATCH", - []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, nil, result, rc.optFns...) - err := api.Send(rc.ctx, rc.chatMemberss.service.conf, req) + req := request.NewRequest("im/v1/messages/:message_id", "DELETE", + []request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.messages.service.conf, req) return result, err } -func (chatMemberss *ChatMembersService) MeJoin(ctx *core.Context, optFns ...request.OptFn) *ChatMembersMeJoinReqCall { - return &ChatMembersMeJoinReqCall{ - ctx: ctx, - chatMemberss: chatMemberss, - pathParams: map[string]interface{}{}, - optFns: optFns, +func (messages *MessageService) Delete(ctx *core.Context, optFns ...request.OptFn) *MessageDeleteReqCall { + return &MessageDeleteReqCall{ + ctx: ctx, + messages: messages, + pathParams: map[string]interface{}{}, + optFns: optFns, } } -type MessageReactionCreateReqCall struct { - ctx *core.Context - messageReactions *MessageReactionService - body *MessageReaction - pathParams map[string]interface{} - optFns []request.OptFn +type MessageReadUsersReqCall struct { + ctx *core.Context + messages *MessageService + pathParams map[string]interface{} + queryParams map[string]interface{} + optFns []request.OptFn } -func (rc *MessageReactionCreateReqCall) SetMessageId(messageId string) { +func (rc *MessageReadUsersReqCall) SetMessageId(messageId string) { rc.pathParams["message_id"] = messageId } +func (rc *MessageReadUsersReqCall) SetUserIdType(userIdType string) { + rc.queryParams["user_id_type"] = userIdType +} +func (rc *MessageReadUsersReqCall) SetPageSize(pageSize int) { + rc.queryParams["page_size"] = pageSize +} +func (rc *MessageReadUsersReqCall) SetPageToken(pageToken string) { + rc.queryParams["page_token"] = pageToken +} -func (rc *MessageReactionCreateReqCall) Do() (*MessageReaction, error) { +func (rc *MessageReadUsersReqCall) Do() (*MessageReadUsersResult, error) { rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) - var result = &MessageReaction{} - req := request.NewRequest("im/v1/messages/:message_id/reactions", "POST", - []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) - err := api.Send(rc.ctx, rc.messageReactions.service.conf, req) + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &MessageReadUsersResult{} + req := request.NewRequest("im/v1/messages/:message_id/read_users", "GET", + []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.messages.service.conf, req) return result, err } -func (messageReactions *MessageReactionService) Create(ctx *core.Context, body *MessageReaction, optFns ...request.OptFn) *MessageReactionCreateReqCall { - return &MessageReactionCreateReqCall{ - ctx: ctx, - messageReactions: messageReactions, - body: body, - pathParams: map[string]interface{}{}, - optFns: optFns, +func (messages *MessageService) ReadUsers(ctx *core.Context, optFns ...request.OptFn) *MessageReadUsersReqCall { + return &MessageReadUsersReqCall{ + ctx: ctx, + messages: messages, + pathParams: map[string]interface{}{}, + queryParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type ChatUpdateReqCall struct { + ctx *core.Context + chats *ChatService + body *ChatUpdateReqBody + pathParams map[string]interface{} + queryParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *ChatUpdateReqCall) SetChatId(chatId string) { + rc.pathParams["chat_id"] = chatId +} +func (rc *ChatUpdateReqCall) SetUserIdType(userIdType string) { + rc.queryParams["user_id_type"] = userIdType +} + +func (rc *ChatUpdateReqCall) 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("im/v1/chats/:chat_id", "PUT", + []request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, rc.body, result, rc.optFns...) + err := api.Send(rc.ctx, rc.chats.service.conf, req) + return result, err +} + +func (chats *ChatService) Update(ctx *core.Context, body *ChatUpdateReqBody, optFns ...request.OptFn) *ChatUpdateReqCall { + return &ChatUpdateReqCall{ + ctx: ctx, + chats: chats, + body: body, + pathParams: map[string]interface{}{}, + queryParams: map[string]interface{}{}, + optFns: optFns, } } @@ -394,206 +422,102 @@ func (files *FileService) Create(ctx *core.Context, optFns ...request.OptFn) *Fi } } -type ImageCreateReqCall struct { - ctx *core.Context - images *ImageService - body *request.FormData - optFns []request.OptFn -} - -func (rc *ImageCreateReqCall) SetImageType(imageType string) { - rc.body.AddParam("image_type", imageType) -} -func (rc *ImageCreateReqCall) SetImage(image *request.File) { - rc.body.AddFile("image", image) -} - -func (rc *ImageCreateReqCall) Do() (*ImageCreateResult, error) { - var result = &ImageCreateResult{} - req := request.NewRequest("im/v1/images", "POST", - []request.AccessTokenType{request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) - err := api.Send(rc.ctx, rc.images.service.conf, req) - return result, err -} - -func (images *ImageService) Create(ctx *core.Context, optFns ...request.OptFn) *ImageCreateReqCall { - return &ImageCreateReqCall{ - ctx: ctx, - images: images, - body: request.NewFormData(), - optFns: optFns, - } -} - -type MessageReactionDeleteReqCall struct { - ctx *core.Context - messageReactions *MessageReactionService - pathParams map[string]interface{} - optFns []request.OptFn +type FileGetReqCall struct { + ctx *core.Context + files *FileService + pathParams map[string]interface{} + optFns []request.OptFn + result io.Writer } -func (rc *MessageReactionDeleteReqCall) SetMessageId(messageId string) { - rc.pathParams["message_id"] = messageId +func (rc *FileGetReqCall) SetFileKey(fileKey string) { + rc.pathParams["file_key"] = fileKey } -func (rc *MessageReactionDeleteReqCall) SetReactionId(reactionId string) { - rc.pathParams["reaction_id"] = reactionId +func (rc *FileGetReqCall) SetResponseStream(result io.Writer) { + rc.result = result } -func (rc *MessageReactionDeleteReqCall) Do() (*MessageReaction, error) { +func (rc *FileGetReqCall) Do() (io.Writer, error) { rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) - var result = &MessageReaction{} - req := request.NewRequest("im/v1/messages/:message_id/reactions/:reaction_id", "DELETE", - []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, nil, result, rc.optFns...) - err := api.Send(rc.ctx, rc.messageReactions.service.conf, req) - return result, err + rc.optFns = append(rc.optFns, request.SetResponseStream()) + req := request.NewRequest("im/v1/files/:file_key", "GET", + []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, rc.result, rc.optFns...) + err := api.Send(rc.ctx, rc.files.service.conf, req) + return rc.result, err } -func (messageReactions *MessageReactionService) Delete(ctx *core.Context, optFns ...request.OptFn) *MessageReactionDeleteReqCall { - return &MessageReactionDeleteReqCall{ - ctx: ctx, - messageReactions: messageReactions, - pathParams: map[string]interface{}{}, - optFns: optFns, +func (files *FileService) Get(ctx *core.Context, optFns ...request.OptFn) *FileGetReqCall { + return &FileGetReqCall{ + ctx: ctx, + files: files, + pathParams: map[string]interface{}{}, + optFns: optFns, } } -type MessageReactionListReqCall struct { - ctx *core.Context - messageReactions *MessageReactionService - pathParams map[string]interface{} - queryParams map[string]interface{} - optFns []request.OptFn +type ChatListReqCall struct { + ctx *core.Context + chats *ChatService + queryParams map[string]interface{} + optFns []request.OptFn } -func (rc *MessageReactionListReqCall) SetMessageId(messageId string) { - rc.pathParams["message_id"] = messageId -} -func (rc *MessageReactionListReqCall) SetReactionType(reactionType string) { - rc.queryParams["reaction_type"] = reactionType +func (rc *ChatListReqCall) SetUserIdType(userIdType string) { + rc.queryParams["user_id_type"] = userIdType } -func (rc *MessageReactionListReqCall) SetPageToken(pageToken string) { +func (rc *ChatListReqCall) SetPageToken(pageToken string) { rc.queryParams["page_token"] = pageToken } -func (rc *MessageReactionListReqCall) SetPageSize(pageSize int) { +func (rc *ChatListReqCall) SetPageSize(pageSize int) { rc.queryParams["page_size"] = pageSize } -func (rc *MessageReactionListReqCall) Do() (*MessageReactionListResult, error) { - rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) +func (rc *ChatListReqCall) Do() (*ChatListResult, error) { rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) - var result = &MessageReactionListResult{} - req := request.NewRequest("im/v1/messages/:message_id/reactions", "GET", + var result = &ChatListResult{} + req := request.NewRequest("im/v1/chats", "GET", []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, nil, result, rc.optFns...) - err := api.Send(rc.ctx, rc.messageReactions.service.conf, req) - return result, err -} - -func (messageReactions *MessageReactionService) List(ctx *core.Context, optFns ...request.OptFn) *MessageReactionListReqCall { - return &MessageReactionListReqCall{ - ctx: ctx, - messageReactions: messageReactions, - pathParams: map[string]interface{}{}, - queryParams: map[string]interface{}{}, - optFns: optFns, - } -} - -type MessageCreateReqCall struct { - ctx *core.Context - messages *MessageService - body *MessageCreateReqBody - queryParams map[string]interface{} - optFns []request.OptFn -} - -func (rc *MessageCreateReqCall) SetReceiveIdType(receiveIdType string) { - rc.queryParams["receive_id_type"] = receiveIdType -} - -func (rc *MessageCreateReqCall) Do() (*Message, error) { - rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) - var result = &Message{} - req := request.NewRequest("im/v1/messages", "POST", - []request.AccessTokenType{request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) - err := api.Send(rc.ctx, rc.messages.service.conf, req) + err := api.Send(rc.ctx, rc.chats.service.conf, req) return result, err } -func (messages *MessageService) Create(ctx *core.Context, body *MessageCreateReqBody, optFns ...request.OptFn) *MessageCreateReqCall { - return &MessageCreateReqCall{ +func (chats *ChatService) List(ctx *core.Context, optFns ...request.OptFn) *ChatListReqCall { + return &ChatListReqCall{ ctx: ctx, - messages: messages, - body: body, + chats: chats, queryParams: map[string]interface{}{}, optFns: optFns, } } -type ChatMembersCreateReqCall struct { - ctx *core.Context - chatMemberss *ChatMembersService - body *ChatMembersCreateReqBody - pathParams map[string]interface{} - queryParams map[string]interface{} - optFns []request.OptFn -} - -func (rc *ChatMembersCreateReqCall) SetChatId(chatId string) { - rc.pathParams["chat_id"] = chatId -} -func (rc *ChatMembersCreateReqCall) SetMemberIdType(memberIdType string) { - rc.queryParams["member_id_type"] = memberIdType -} - -func (rc *ChatMembersCreateReqCall) Do() (*ChatMembersCreateResult, error) { - rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) - rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) - var result = &ChatMembersCreateResult{} - req := request.NewRequest("im/v1/chats/:chat_id/members", "POST", - []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) - err := api.Send(rc.ctx, rc.chatMemberss.service.conf, req) - return result, err -} - -func (chatMemberss *ChatMembersService) Create(ctx *core.Context, body *ChatMembersCreateReqBody, optFns ...request.OptFn) *ChatMembersCreateReqCall { - return &ChatMembersCreateReqCall{ - ctx: ctx, - chatMemberss: chatMemberss, - body: body, - pathParams: map[string]interface{}{}, - queryParams: map[string]interface{}{}, - optFns: optFns, - } +type ImageCreateReqCall struct { + ctx *core.Context + images *ImageService + body *request.FormData + optFns []request.OptFn } -type ChatCreateReqCall struct { - ctx *core.Context - chats *ChatService - body *ChatCreateReqBody - queryParams map[string]interface{} - optFns []request.OptFn +func (rc *ImageCreateReqCall) SetImageType(imageType string) { + rc.body.AddParam("image_type", imageType) } - -func (rc *ChatCreateReqCall) SetUserIdType(userIdType string) { - rc.queryParams["user_id_type"] = userIdType +func (rc *ImageCreateReqCall) SetImage(image *request.File) { + rc.body.AddFile("image", image) } -func (rc *ChatCreateReqCall) Do() (*ChatCreateResult, error) { - rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) - var result = &ChatCreateResult{} - req := request.NewRequest("im/v1/chats", "POST", +func (rc *ImageCreateReqCall) Do() (*ImageCreateResult, error) { + var result = &ImageCreateResult{} + req := request.NewRequest("im/v1/images", "POST", []request.AccessTokenType{request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) - err := api.Send(rc.ctx, rc.chats.service.conf, req) + err := api.Send(rc.ctx, rc.images.service.conf, req) return result, err } -func (chats *ChatService) Create(ctx *core.Context, body *ChatCreateReqBody, optFns ...request.OptFn) *ChatCreateReqCall { - return &ChatCreateReqCall{ - ctx: ctx, - chats: chats, - body: body, - queryParams: map[string]interface{}{}, - optFns: optFns, +func (images *ImageService) Create(ctx *core.Context, optFns ...request.OptFn) *ImageCreateReqCall { + return &ImageCreateReqCall{ + ctx: ctx, + images: images, + body: request.NewFormData(), + optFns: optFns, } } @@ -626,81 +550,36 @@ func (chats *ChatService) Delete(ctx *core.Context, optFns ...request.OptFn) *Ch } } -type ChatMembersDeleteReqCall struct { - ctx *core.Context - chatMemberss *ChatMembersService - body *ChatMembersDeleteReqBody - pathParams map[string]interface{} - queryParams map[string]interface{} - optFns []request.OptFn -} - -func (rc *ChatMembersDeleteReqCall) SetChatId(chatId string) { - rc.pathParams["chat_id"] = chatId -} -func (rc *ChatMembersDeleteReqCall) SetMemberIdType(memberIdType string) { - rc.queryParams["member_id_type"] = memberIdType -} - -func (rc *ChatMembersDeleteReqCall) Do() (*ChatMembersDeleteResult, error) { - rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) - rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) - var result = &ChatMembersDeleteResult{} - req := request.NewRequest("im/v1/chats/:chat_id/members", "DELETE", - []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) - err := api.Send(rc.ctx, rc.chatMemberss.service.conf, req) - return result, err -} - -func (chatMemberss *ChatMembersService) Delete(ctx *core.Context, body *ChatMembersDeleteReqBody, optFns ...request.OptFn) *ChatMembersDeleteReqCall { - return &ChatMembersDeleteReqCall{ - ctx: ctx, - chatMemberss: chatMemberss, - body: body, - pathParams: map[string]interface{}{}, - queryParams: map[string]interface{}{}, - optFns: optFns, - } -} - -type ChatMembersGetReqCall struct { - ctx *core.Context - chatMemberss *ChatMembersService - pathParams map[string]interface{} - queryParams map[string]interface{} - optFns []request.OptFn +type ImageGetReqCall struct { + ctx *core.Context + images *ImageService + pathParams map[string]interface{} + optFns []request.OptFn + result io.Writer } -func (rc *ChatMembersGetReqCall) SetChatId(chatId string) { - rc.pathParams["chat_id"] = chatId -} -func (rc *ChatMembersGetReqCall) SetMemberIdType(memberIdType string) { - rc.queryParams["member_id_type"] = memberIdType -} -func (rc *ChatMembersGetReqCall) SetPageToken(pageToken string) { - rc.queryParams["page_token"] = pageToken +func (rc *ImageGetReqCall) SetImageKey(imageKey string) { + rc.pathParams["image_key"] = imageKey } -func (rc *ChatMembersGetReqCall) SetPageSize(pageSize int) { - rc.queryParams["page_size"] = pageSize +func (rc *ImageGetReqCall) SetResponseStream(result io.Writer) { + rc.result = result } -func (rc *ChatMembersGetReqCall) Do() (*ChatMembersGetResult, error) { +func (rc *ImageGetReqCall) Do() (io.Writer, error) { rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) - rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) - var result = &ChatMembersGetResult{} - req := request.NewRequest("im/v1/chats/:chat_id/members", "GET", - []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, nil, result, rc.optFns...) - err := api.Send(rc.ctx, rc.chatMemberss.service.conf, req) - return result, err + rc.optFns = append(rc.optFns, request.SetResponseStream()) + req := request.NewRequest("im/v1/images/:image_key", "GET", + []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, rc.result, rc.optFns...) + err := api.Send(rc.ctx, rc.images.service.conf, req) + return rc.result, err } -func (chatMemberss *ChatMembersService) Get(ctx *core.Context, optFns ...request.OptFn) *ChatMembersGetReqCall { - return &ChatMembersGetReqCall{ - ctx: ctx, - chatMemberss: chatMemberss, - pathParams: map[string]interface{}{}, - queryParams: map[string]interface{}{}, - optFns: optFns, +func (images *ImageService) Get(ctx *core.Context, optFns ...request.OptFn) *ImageGetReqCall { + return &ImageGetReqCall{ + ctx: ctx, + images: images, + pathParams: map[string]interface{}{}, + optFns: optFns, } } @@ -739,65 +618,32 @@ func (chats *ChatService) Get(ctx *core.Context, optFns ...request.OptFn) *ChatG } } -type ChatMembersIsInChatReqCall struct { - ctx *core.Context - chatMemberss *ChatMembersService - pathParams map[string]interface{} - optFns []request.OptFn -} - -func (rc *ChatMembersIsInChatReqCall) SetChatId(chatId string) { - rc.pathParams["chat_id"] = chatId -} - -func (rc *ChatMembersIsInChatReqCall) Do() (*ChatMembersIsInChatResult, error) { - rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) - var result = &ChatMembersIsInChatResult{} - req := request.NewRequest("im/v1/chats/:chat_id/members/is_in_chat", "GET", - []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, nil, result, rc.optFns...) - err := api.Send(rc.ctx, rc.chatMemberss.service.conf, req) - return result, err -} - -func (chatMemberss *ChatMembersService) IsInChat(ctx *core.Context, optFns ...request.OptFn) *ChatMembersIsInChatReqCall { - return &ChatMembersIsInChatReqCall{ - ctx: ctx, - chatMemberss: chatMemberss, - pathParams: map[string]interface{}{}, - optFns: optFns, - } -} - -type ChatListReqCall struct { +type ChatCreateReqCall struct { ctx *core.Context chats *ChatService + body *ChatCreateReqBody queryParams map[string]interface{} optFns []request.OptFn } -func (rc *ChatListReqCall) SetUserIdType(userIdType string) { +func (rc *ChatCreateReqCall) SetUserIdType(userIdType string) { rc.queryParams["user_id_type"] = userIdType } -func (rc *ChatListReqCall) SetPageToken(pageToken string) { - rc.queryParams["page_token"] = pageToken -} -func (rc *ChatListReqCall) SetPageSize(pageSize int) { - rc.queryParams["page_size"] = pageSize -} -func (rc *ChatListReqCall) Do() (*ChatListResult, error) { +func (rc *ChatCreateReqCall) Do() (*ChatCreateResult, error) { rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) - var result = &ChatListResult{} - req := request.NewRequest("im/v1/chats", "GET", - []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, nil, result, rc.optFns...) + var result = &ChatCreateResult{} + req := request.NewRequest("im/v1/chats", "POST", + []request.AccessTokenType{request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) err := api.Send(rc.ctx, rc.chats.service.conf, req) return result, err } -func (chats *ChatService) List(ctx *core.Context, optFns ...request.OptFn) *ChatListReqCall { - return &ChatListReqCall{ +func (chats *ChatService) Create(ctx *core.Context, body *ChatCreateReqBody, optFns ...request.OptFn) *ChatCreateReqCall { + return &ChatCreateReqCall{ ctx: ctx, chats: chats, + body: body, queryParams: map[string]interface{}{}, optFns: optFns, } @@ -841,65 +687,28 @@ func (chats *ChatService) Search(ctx *core.Context, optFns ...request.OptFn) *Ch } } -type ChatUpdateReqCall struct { - ctx *core.Context - chats *ChatService - body *ChatUpdateReqBody - pathParams map[string]interface{} - queryParams map[string]interface{} - optFns []request.OptFn -} - -func (rc *ChatUpdateReqCall) SetChatId(chatId string) { - rc.pathParams["chat_id"] = chatId -} -func (rc *ChatUpdateReqCall) SetUserIdType(userIdType string) { - rc.queryParams["user_id_type"] = userIdType -} - -func (rc *ChatUpdateReqCall) 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("im/v1/chats/:chat_id", "PUT", - []request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, rc.body, result, rc.optFns...) - err := api.Send(rc.ctx, rc.chats.service.conf, req) - return result, err -} - -func (chats *ChatService) Update(ctx *core.Context, body *ChatUpdateReqBody, optFns ...request.OptFn) *ChatUpdateReqCall { - return &ChatUpdateReqCall{ - ctx: ctx, - chats: chats, - body: body, - pathParams: map[string]interface{}{}, - queryParams: map[string]interface{}{}, - optFns: optFns, - } -} - -type MessageDeleteReqCall struct { +type MessageGetReqCall struct { ctx *core.Context messages *MessageService pathParams map[string]interface{} optFns []request.OptFn } -func (rc *MessageDeleteReqCall) SetMessageId(messageId string) { +func (rc *MessageGetReqCall) SetMessageId(messageId string) { rc.pathParams["message_id"] = messageId } -func (rc *MessageDeleteReqCall) Do() (*response.NoData, error) { +func (rc *MessageGetReqCall) Do() (*MessageGetResult, error) { rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) - var result = &response.NoData{} - req := request.NewRequest("im/v1/messages/:message_id", "DELETE", - []request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, nil, result, rc.optFns...) + var result = &MessageGetResult{} + req := request.NewRequest("im/v1/messages/:message_id", "GET", + []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...) err := api.Send(rc.ctx, rc.messages.service.conf, req) return result, err } -func (messages *MessageService) Delete(ctx *core.Context, optFns ...request.OptFn) *MessageDeleteReqCall { - return &MessageDeleteReqCall{ +func (messages *MessageService) Get(ctx *core.Context, optFns ...request.OptFn) *MessageGetReqCall { + return &MessageGetReqCall{ ctx: ctx, messages: messages, pathParams: map[string]interface{}{}, @@ -907,260 +716,156 @@ func (messages *MessageService) Delete(ctx *core.Context, optFns ...request.OptF } } -type ChatModerationGetReqCall struct { - ctx *core.Context - chatModerations *ChatModerationService - pathParams map[string]interface{} - queryParams map[string]interface{} - optFns []request.OptFn +type ChatMembersCreateReqCall struct { + ctx *core.Context + chatMemberss *ChatMembersService + body *ChatMembersCreateReqBody + pathParams map[string]interface{} + queryParams map[string]interface{} + optFns []request.OptFn } -func (rc *ChatModerationGetReqCall) SetChatId(chatId string) { +func (rc *ChatMembersCreateReqCall) SetChatId(chatId string) { rc.pathParams["chat_id"] = chatId } -func (rc *ChatModerationGetReqCall) SetUserIdType(userIdType string) { - rc.queryParams["user_id_type"] = userIdType -} -func (rc *ChatModerationGetReqCall) SetPageToken(pageToken string) { - rc.queryParams["page_token"] = pageToken -} -func (rc *ChatModerationGetReqCall) SetPageSize(pageSize int) { - rc.queryParams["page_size"] = pageSize +func (rc *ChatMembersCreateReqCall) SetMemberIdType(memberIdType string) { + rc.queryParams["member_id_type"] = memberIdType } -func (rc *ChatModerationGetReqCall) Do() (*ChatModerationGetResult, error) { +func (rc *ChatMembersCreateReqCall) Do() (*ChatMembersCreateResult, error) { rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) - var result = &ChatModerationGetResult{} - req := request.NewRequest("im/v1/chats/:chat_id/moderation", "GET", - []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, nil, result, rc.optFns...) - err := api.Send(rc.ctx, rc.chatModerations.service.conf, req) - return result, err -} - -func (chatModerations *ChatModerationService) Get(ctx *core.Context, optFns ...request.OptFn) *ChatModerationGetReqCall { - return &ChatModerationGetReqCall{ - ctx: ctx, - chatModerations: chatModerations, - pathParams: map[string]interface{}{}, - queryParams: map[string]interface{}{}, - optFns: optFns, - } -} - -type MessageListReqCall struct { - ctx *core.Context - messages *MessageService - queryParams map[string]interface{} - optFns []request.OptFn -} - -func (rc *MessageListReqCall) SetContainerIdType(containerIdType string) { - rc.queryParams["container_id_type"] = containerIdType -} -func (rc *MessageListReqCall) SetContainerId(containerId string) { - rc.queryParams["container_id"] = containerId -} -func (rc *MessageListReqCall) SetStartTime(startTime string) { - rc.queryParams["start_time"] = startTime -} -func (rc *MessageListReqCall) SetEndTime(endTime string) { - rc.queryParams["end_time"] = endTime -} -func (rc *MessageListReqCall) SetPageToken(pageToken string) { - rc.queryParams["page_token"] = pageToken -} -func (rc *MessageListReqCall) SetPageSize(pageSize int) { - rc.queryParams["page_size"] = pageSize -} - -func (rc *MessageListReqCall) Do() (*MessageListResult, error) { - rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) - var result = &MessageListResult{} - req := request.NewRequest("im/v1/messages", "GET", - []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...) - err := api.Send(rc.ctx, rc.messages.service.conf, req) - return result, err -} - -func (messages *MessageService) List(ctx *core.Context, optFns ...request.OptFn) *MessageListReqCall { - return &MessageListReqCall{ - ctx: ctx, - messages: messages, - queryParams: map[string]interface{}{}, - optFns: optFns, - } -} - -type MessagePatchReqCall struct { - ctx *core.Context - messages *MessageService - body *MessagePatchReqBody - pathParams map[string]interface{} - optFns []request.OptFn -} - -func (rc *MessagePatchReqCall) SetMessageId(messageId string) { - rc.pathParams["message_id"] = messageId -} - -func (rc *MessagePatchReqCall) Do() (*response.NoData, error) { - rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) - var result = &response.NoData{} - req := request.NewRequest("im/v1/messages/:message_id", "PATCH", - []request.AccessTokenType{request.AccessTokenTypeTenant, request.AccessTokenTypeUser}, rc.body, result, rc.optFns...) - err := api.Send(rc.ctx, rc.messages.service.conf, req) + var result = &ChatMembersCreateResult{} + req := request.NewRequest("im/v1/chats/:chat_id/members", "POST", + []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) + err := api.Send(rc.ctx, rc.chatMemberss.service.conf, req) return result, err } -func (messages *MessageService) Patch(ctx *core.Context, body *MessagePatchReqBody, optFns ...request.OptFn) *MessagePatchReqCall { - return &MessagePatchReqCall{ - ctx: ctx, - messages: messages, - body: body, - pathParams: map[string]interface{}{}, - optFns: optFns, +func (chatMemberss *ChatMembersService) Create(ctx *core.Context, body *ChatMembersCreateReqBody, optFns ...request.OptFn) *ChatMembersCreateReqCall { + return &ChatMembersCreateReqCall{ + ctx: ctx, + chatMemberss: chatMemberss, + body: body, + pathParams: map[string]interface{}{}, + queryParams: map[string]interface{}{}, + optFns: optFns, } } -type MessageReadUsersReqCall struct { - ctx *core.Context - messages *MessageService - pathParams map[string]interface{} - queryParams map[string]interface{} - optFns []request.OptFn +type ChatMembersDeleteReqCall struct { + ctx *core.Context + chatMemberss *ChatMembersService + body *ChatMembersDeleteReqBody + pathParams map[string]interface{} + queryParams map[string]interface{} + optFns []request.OptFn } -func (rc *MessageReadUsersReqCall) SetMessageId(messageId string) { - rc.pathParams["message_id"] = messageId -} -func (rc *MessageReadUsersReqCall) SetUserIdType(userIdType string) { - rc.queryParams["user_id_type"] = userIdType -} -func (rc *MessageReadUsersReqCall) SetPageSize(pageSize int) { - rc.queryParams["page_size"] = pageSize +func (rc *ChatMembersDeleteReqCall) SetChatId(chatId string) { + rc.pathParams["chat_id"] = chatId } -func (rc *MessageReadUsersReqCall) SetPageToken(pageToken string) { - rc.queryParams["page_token"] = pageToken +func (rc *ChatMembersDeleteReqCall) SetMemberIdType(memberIdType string) { + rc.queryParams["member_id_type"] = memberIdType } -func (rc *MessageReadUsersReqCall) Do() (*MessageReadUsersResult, error) { +func (rc *ChatMembersDeleteReqCall) Do() (*ChatMembersDeleteResult, error) { rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) - var result = &MessageReadUsersResult{} - req := request.NewRequest("im/v1/messages/:message_id/read_users", "GET", - []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...) - err := api.Send(rc.ctx, rc.messages.service.conf, req) + var result = &ChatMembersDeleteResult{} + req := request.NewRequest("im/v1/chats/:chat_id/members", "DELETE", + []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) + err := api.Send(rc.ctx, rc.chatMemberss.service.conf, req) return result, err } -func (messages *MessageService) ReadUsers(ctx *core.Context, optFns ...request.OptFn) *MessageReadUsersReqCall { - return &MessageReadUsersReqCall{ - ctx: ctx, - messages: messages, - pathParams: map[string]interface{}{}, - queryParams: map[string]interface{}{}, - optFns: optFns, +func (chatMemberss *ChatMembersService) Delete(ctx *core.Context, body *ChatMembersDeleteReqBody, optFns ...request.OptFn) *ChatMembersDeleteReqCall { + return &ChatMembersDeleteReqCall{ + ctx: ctx, + chatMemberss: chatMemberss, + body: body, + pathParams: map[string]interface{}{}, + queryParams: map[string]interface{}{}, + optFns: optFns, } } -type MessageReplyReqCall struct { - ctx *core.Context - messages *MessageService - body *MessageReplyReqBody - pathParams map[string]interface{} - optFns []request.OptFn +type ChatAnnouncementGetReqCall struct { + ctx *core.Context + chatAnnouncements *ChatAnnouncementService + pathParams map[string]interface{} + queryParams map[string]interface{} + optFns []request.OptFn } -func (rc *MessageReplyReqCall) SetMessageId(messageId string) { - rc.pathParams["message_id"] = messageId +func (rc *ChatAnnouncementGetReqCall) SetChatId(chatId string) { + rc.pathParams["chat_id"] = chatId +} +func (rc *ChatAnnouncementGetReqCall) SetUserIdType(userIdType string) { + rc.queryParams["user_id_type"] = userIdType } -func (rc *MessageReplyReqCall) Do() (*Message, error) { +func (rc *ChatAnnouncementGetReqCall) Do() (*ChatAnnouncementGetResult, error) { rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) - var result = &Message{} - req := request.NewRequest("im/v1/messages/:message_id/reply", "POST", - []request.AccessTokenType{request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) - err := api.Send(rc.ctx, rc.messages.service.conf, req) + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &ChatAnnouncementGetResult{} + req := request.NewRequest("im/v1/chats/:chat_id/announcement", "GET", + []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.chatAnnouncements.service.conf, req) return result, err } -func (messages *MessageService) Reply(ctx *core.Context, body *MessageReplyReqBody, optFns ...request.OptFn) *MessageReplyReqCall { - return &MessageReplyReqCall{ - ctx: ctx, - messages: messages, - body: body, - pathParams: map[string]interface{}{}, - optFns: optFns, +func (chatAnnouncements *ChatAnnouncementService) Get(ctx *core.Context, optFns ...request.OptFn) *ChatAnnouncementGetReqCall { + return &ChatAnnouncementGetReqCall{ + ctx: ctx, + chatAnnouncements: chatAnnouncements, + pathParams: map[string]interface{}{}, + queryParams: map[string]interface{}{}, + optFns: optFns, } } -type ChatModerationUpdateReqCall struct { +type ChatModerationGetReqCall struct { ctx *core.Context chatModerations *ChatModerationService - body *ChatModerationUpdateReqBody pathParams map[string]interface{} queryParams map[string]interface{} optFns []request.OptFn } -func (rc *ChatModerationUpdateReqCall) SetChatId(chatId string) { +func (rc *ChatModerationGetReqCall) SetChatId(chatId string) { rc.pathParams["chat_id"] = chatId } -func (rc *ChatModerationUpdateReqCall) SetUserIdType(userIdType string) { +func (rc *ChatModerationGetReqCall) SetUserIdType(userIdType string) { rc.queryParams["user_id_type"] = userIdType } +func (rc *ChatModerationGetReqCall) SetPageToken(pageToken string) { + rc.queryParams["page_token"] = pageToken +} +func (rc *ChatModerationGetReqCall) SetPageSize(pageSize int) { + rc.queryParams["page_size"] = pageSize +} -func (rc *ChatModerationUpdateReqCall) Do() (*response.NoData, error) { +func (rc *ChatModerationGetReqCall) Do() (*ChatModerationGetResult, 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("im/v1/chats/:chat_id/moderation", "PUT", - []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) + var result = &ChatModerationGetResult{} + req := request.NewRequest("im/v1/chats/:chat_id/moderation", "GET", + []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, nil, result, rc.optFns...) err := api.Send(rc.ctx, rc.chatModerations.service.conf, req) return result, err } -func (chatModerations *ChatModerationService) Update(ctx *core.Context, body *ChatModerationUpdateReqBody, optFns ...request.OptFn) *ChatModerationUpdateReqCall { - return &ChatModerationUpdateReqCall{ +func (chatModerations *ChatModerationService) Get(ctx *core.Context, optFns ...request.OptFn) *ChatModerationGetReqCall { + return &ChatModerationGetReqCall{ ctx: ctx, chatModerations: chatModerations, - body: body, pathParams: map[string]interface{}{}, queryParams: map[string]interface{}{}, optFns: optFns, } } -type MessageGetReqCall struct { - ctx *core.Context - messages *MessageService - pathParams map[string]interface{} - optFns []request.OptFn -} - -func (rc *MessageGetReqCall) SetMessageId(messageId string) { - rc.pathParams["message_id"] = messageId -} - -func (rc *MessageGetReqCall) Do() (*MessageGetResult, error) { - rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) - var result = &MessageGetResult{} - req := request.NewRequest("im/v1/messages/:message_id", "GET", - []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...) - err := api.Send(rc.ctx, rc.messages.service.conf, req) - return result, err -} - -func (messages *MessageService) Get(ctx *core.Context, optFns ...request.OptFn) *MessageGetReqCall { - return &MessageGetReqCall{ - ctx: ctx, - messages: messages, - pathParams: map[string]interface{}{}, - optFns: optFns, - } -} - type MessageResourceGetReqCall struct { ctx *core.Context messageResources *MessageResourceService @@ -1203,115 +908,169 @@ func (messageResources *MessageResourceService) Get(ctx *core.Context, optFns .. } } -type ChatCustomBotCreateReqCall struct { - ctx *core.Context - chatCustomBots *ChatCustomBotService - body *ChatCustomBotCreateReqBody - optFns []request.OptFn +type ChatMembersGetReqCall struct { + ctx *core.Context + chatMemberss *ChatMembersService + pathParams map[string]interface{} + queryParams map[string]interface{} + optFns []request.OptFn } -func (rc *ChatCustomBotCreateReqCall) Do() (*ChatCustomBotCreateResult, error) { - var result = &ChatCustomBotCreateResult{} - req := request.NewRequest("im/v1/chat_custom_bots", "POST", - []request.AccessTokenType{request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) - err := api.Send(rc.ctx, rc.chatCustomBots.service.conf, req) +func (rc *ChatMembersGetReqCall) SetChatId(chatId string) { + rc.pathParams["chat_id"] = chatId +} +func (rc *ChatMembersGetReqCall) SetMemberIdType(memberIdType string) { + rc.queryParams["member_id_type"] = memberIdType +} +func (rc *ChatMembersGetReqCall) SetPageToken(pageToken string) { + rc.queryParams["page_token"] = pageToken +} +func (rc *ChatMembersGetReqCall) SetPageSize(pageSize int) { + rc.queryParams["page_size"] = pageSize +} + +func (rc *ChatMembersGetReqCall) Do() (*ChatMembersGetResult, error) { + rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &ChatMembersGetResult{} + req := request.NewRequest("im/v1/chats/:chat_id/members", "GET", + []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.chatMemberss.service.conf, req) + return result, err +} + +func (chatMemberss *ChatMembersService) Get(ctx *core.Context, optFns ...request.OptFn) *ChatMembersGetReqCall { + return &ChatMembersGetReqCall{ + ctx: ctx, + chatMemberss: chatMemberss, + pathParams: map[string]interface{}{}, + queryParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type ChatMembersIsInChatReqCall struct { + ctx *core.Context + chatMemberss *ChatMembersService + pathParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *ChatMembersIsInChatReqCall) SetChatId(chatId string) { + rc.pathParams["chat_id"] = chatId +} + +func (rc *ChatMembersIsInChatReqCall) Do() (*ChatMembersIsInChatResult, error) { + rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) + var result = &ChatMembersIsInChatResult{} + req := request.NewRequest("im/v1/chats/:chat_id/members/is_in_chat", "GET", + []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.chatMemberss.service.conf, req) return result, err } -func (chatCustomBots *ChatCustomBotService) Create(ctx *core.Context, body *ChatCustomBotCreateReqBody, optFns ...request.OptFn) *ChatCustomBotCreateReqCall { - return &ChatCustomBotCreateReqCall{ - ctx: ctx, - chatCustomBots: chatCustomBots, - body: body, - optFns: optFns, +func (chatMemberss *ChatMembersService) IsInChat(ctx *core.Context, optFns ...request.OptFn) *ChatMembersIsInChatReqCall { + return &ChatMembersIsInChatReqCall{ + ctx: ctx, + chatMemberss: chatMemberss, + pathParams: map[string]interface{}{}, + optFns: optFns, } } -type ChatCustomBotDeleteReqCall struct { - ctx *core.Context - chatCustomBots *ChatCustomBotService - pathParams map[string]interface{} - optFns []request.OptFn +type ChatMembersMeJoinReqCall struct { + ctx *core.Context + chatMemberss *ChatMembersService + pathParams map[string]interface{} + optFns []request.OptFn } -func (rc *ChatCustomBotDeleteReqCall) SetChatCustomBotId(chatCustomBotId int64) { - rc.pathParams["chat_custom_bot_id"] = chatCustomBotId +func (rc *ChatMembersMeJoinReqCall) SetChatId(chatId string) { + rc.pathParams["chat_id"] = chatId } -func (rc *ChatCustomBotDeleteReqCall) Do() (*response.NoData, error) { +func (rc *ChatMembersMeJoinReqCall) Do() (*response.NoData, error) { rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) var result = &response.NoData{} - req := request.NewRequest("im/v1/chat_custom_bots/:chat_custom_bot_id", "DELETE", - []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...) - err := api.Send(rc.ctx, rc.chatCustomBots.service.conf, req) + req := request.NewRequest("im/v1/chats/:chat_id/members/me_join", "PATCH", + []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.chatMemberss.service.conf, req) return result, err } -func (chatCustomBots *ChatCustomBotService) Delete(ctx *core.Context, optFns ...request.OptFn) *ChatCustomBotDeleteReqCall { - return &ChatCustomBotDeleteReqCall{ - ctx: ctx, - chatCustomBots: chatCustomBots, - pathParams: map[string]interface{}{}, - optFns: optFns, +func (chatMemberss *ChatMembersService) MeJoin(ctx *core.Context, optFns ...request.OptFn) *ChatMembersMeJoinReqCall { + return &ChatMembersMeJoinReqCall{ + ctx: ctx, + chatMemberss: chatMemberss, + pathParams: map[string]interface{}{}, + optFns: optFns, } } -type ChatCustomBotGetReqCall struct { - ctx *core.Context - chatCustomBots *ChatCustomBotService - pathParams map[string]interface{} - optFns []request.OptFn +type ChatAnnouncementPatchReqCall struct { + ctx *core.Context + chatAnnouncements *ChatAnnouncementService + body *ChatAnnouncementPatchReqBody + pathParams map[string]interface{} + optFns []request.OptFn } -func (rc *ChatCustomBotGetReqCall) SetChatCustomBotId(chatCustomBotId int64) { - rc.pathParams["chat_custom_bot_id"] = chatCustomBotId +func (rc *ChatAnnouncementPatchReqCall) SetChatId(chatId string) { + rc.pathParams["chat_id"] = chatId } -func (rc *ChatCustomBotGetReqCall) Do() (*ChatCustomBotGetResult, error) { +func (rc *ChatAnnouncementPatchReqCall) Do() (*response.NoData, error) { rc.optFns = append(rc.optFns, request.SetPathParams(rc.pathParams)) - var result = &ChatCustomBotGetResult{} - req := request.NewRequest("im/v1/chat_custom_bots/:chat_custom_bot_id", "GET", - []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...) - err := api.Send(rc.ctx, rc.chatCustomBots.service.conf, req) + var result = &response.NoData{} + req := request.NewRequest("im/v1/chats/:chat_id/announcement", "PATCH", + []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) + err := api.Send(rc.ctx, rc.chatAnnouncements.service.conf, req) return result, err } -func (chatCustomBots *ChatCustomBotService) Get(ctx *core.Context, optFns ...request.OptFn) *ChatCustomBotGetReqCall { - return &ChatCustomBotGetReqCall{ - ctx: ctx, - chatCustomBots: chatCustomBots, - pathParams: map[string]interface{}{}, - optFns: optFns, +func (chatAnnouncements *ChatAnnouncementService) Patch(ctx *core.Context, body *ChatAnnouncementPatchReqBody, optFns ...request.OptFn) *ChatAnnouncementPatchReqCall { + return &ChatAnnouncementPatchReqCall{ + ctx: ctx, + chatAnnouncements: chatAnnouncements, + body: body, + pathParams: map[string]interface{}{}, + optFns: optFns, } } -type ChatCustomBotUpdateReqCall struct { - ctx *core.Context - chatCustomBots *ChatCustomBotService - body *ChatCustomBotUpdateReqBody - pathParams map[string]interface{} - optFns []request.OptFn +type ChatModerationUpdateReqCall struct { + ctx *core.Context + chatModerations *ChatModerationService + body *ChatModerationUpdateReqBody + pathParams map[string]interface{} + queryParams map[string]interface{} + optFns []request.OptFn } -func (rc *ChatCustomBotUpdateReqCall) SetChatCustomBotId(chatCustomBotId int64) { - rc.pathParams["chat_custom_bot_id"] = chatCustomBotId +func (rc *ChatModerationUpdateReqCall) SetChatId(chatId string) { + rc.pathParams["chat_id"] = chatId +} +func (rc *ChatModerationUpdateReqCall) SetUserIdType(userIdType string) { + rc.queryParams["user_id_type"] = userIdType } -func (rc *ChatCustomBotUpdateReqCall) Do() (*response.NoData, error) { +func (rc *ChatModerationUpdateReqCall) 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("im/v1/chat_custom_bots/:chat_custom_bot_id", "PUT", - []request.AccessTokenType{request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) - err := api.Send(rc.ctx, rc.chatCustomBots.service.conf, req) + req := request.NewRequest("im/v1/chats/:chat_id/moderation", "PUT", + []request.AccessTokenType{request.AccessTokenTypeUser, request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) + err := api.Send(rc.ctx, rc.chatModerations.service.conf, req) return result, err } -func (chatCustomBots *ChatCustomBotService) Update(ctx *core.Context, body *ChatCustomBotUpdateReqBody, optFns ...request.OptFn) *ChatCustomBotUpdateReqCall { - return &ChatCustomBotUpdateReqCall{ - ctx: ctx, - chatCustomBots: chatCustomBots, - body: body, - pathParams: map[string]interface{}{}, - optFns: optFns, +func (chatModerations *ChatModerationService) Update(ctx *core.Context, body *ChatModerationUpdateReqBody, optFns ...request.OptFn) *ChatModerationUpdateReqCall { + return &ChatModerationUpdateReqCall{ + ctx: ctx, + chatModerations: chatModerations, + body: body, + pathParams: map[string]interface{}{}, + queryParams: map[string]interface{}{}, + optFns: optFns, } } diff --git a/service/im/v1/event.go b/service/im/v1/event.go index cea92968..7b6e372b 100644 --- a/service/im/v1/event.go +++ b/service/im/v1/event.go @@ -7,100 +7,100 @@ import ( "github.com/larksuite/oapi-sdk-go/event" ) -type ChatMemberBotAddedEventHandler struct { - Fn func(*core.Context, *ChatMemberBotAddedEvent) error +type MessageReceiveEventHandler struct { + Fn func(*core.Context, *MessageReceiveEvent) error } -func (h *ChatMemberBotAddedEventHandler) GetEvent() interface{} { - return &ChatMemberBotAddedEvent{} +func (h *MessageReceiveEventHandler) GetEvent() interface{} { + return &MessageReceiveEvent{} } -func (h *ChatMemberBotAddedEventHandler) Handle(ctx *core.Context, event interface{}) error { - return h.Fn(ctx, event.(*ChatMemberBotAddedEvent)) +func (h *MessageReceiveEventHandler) Handle(ctx *core.Context, event interface{}) error { + return h.Fn(ctx, event.(*MessageReceiveEvent)) } -func SetChatMemberBotAddedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *ChatMemberBotAddedEvent) error) { - event.SetTypeHandler(conf, "im.chat.member.bot.added_v1", &ChatMemberBotAddedEventHandler{Fn: fn}) +func SetMessageReceiveEventHandler(conf *config.Config, fn func(ctx *core.Context, event *MessageReceiveEvent) error) { + event.SetTypeHandler(conf, "im.message.receive_v1", &MessageReceiveEventHandler{Fn: fn}) } -type ChatMemberUserAddedEventHandler struct { - Fn func(*core.Context, *ChatMemberUserAddedEvent) error +type ChatUpdatedEventHandler struct { + Fn func(*core.Context, *ChatUpdatedEvent) error } -func (h *ChatMemberUserAddedEventHandler) GetEvent() interface{} { - return &ChatMemberUserAddedEvent{} +func (h *ChatUpdatedEventHandler) GetEvent() interface{} { + return &ChatUpdatedEvent{} } -func (h *ChatMemberUserAddedEventHandler) Handle(ctx *core.Context, event interface{}) error { - return h.Fn(ctx, event.(*ChatMemberUserAddedEvent)) +func (h *ChatUpdatedEventHandler) Handle(ctx *core.Context, event interface{}) error { + return h.Fn(ctx, event.(*ChatUpdatedEvent)) } -func SetChatMemberUserAddedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *ChatMemberUserAddedEvent) error) { - event.SetTypeHandler(conf, "im.chat.member.user.added_v1", &ChatMemberUserAddedEventHandler{Fn: fn}) +func SetChatUpdatedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *ChatUpdatedEvent) error) { + event.SetTypeHandler(conf, "im.chat.updated_v1", &ChatUpdatedEventHandler{Fn: fn}) } -type ChatMemberBotDeletedEventHandler struct { - Fn func(*core.Context, *ChatMemberBotDeletedEvent) error +type ChatDisbandedEventHandler struct { + Fn func(*core.Context, *ChatDisbandedEvent) error } -func (h *ChatMemberBotDeletedEventHandler) GetEvent() interface{} { - return &ChatMemberBotDeletedEvent{} +func (h *ChatDisbandedEventHandler) GetEvent() interface{} { + return &ChatDisbandedEvent{} } -func (h *ChatMemberBotDeletedEventHandler) Handle(ctx *core.Context, event interface{}) error { - return h.Fn(ctx, event.(*ChatMemberBotDeletedEvent)) +func (h *ChatDisbandedEventHandler) Handle(ctx *core.Context, event interface{}) error { + return h.Fn(ctx, event.(*ChatDisbandedEvent)) } -func SetChatMemberBotDeletedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *ChatMemberBotDeletedEvent) error) { - event.SetTypeHandler(conf, "im.chat.member.bot.deleted_v1", &ChatMemberBotDeletedEventHandler{Fn: fn}) +func SetChatDisbandedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *ChatDisbandedEvent) error) { + event.SetTypeHandler(conf, "im.chat.disbanded_v1", &ChatDisbandedEventHandler{Fn: fn}) } -type ChatMemberUserDeletedEventHandler struct { - Fn func(*core.Context, *ChatMemberUserDeletedEvent) error +type ChatMemberBotAddedEventHandler struct { + Fn func(*core.Context, *ChatMemberBotAddedEvent) error } -func (h *ChatMemberUserDeletedEventHandler) GetEvent() interface{} { - return &ChatMemberUserDeletedEvent{} +func (h *ChatMemberBotAddedEventHandler) GetEvent() interface{} { + return &ChatMemberBotAddedEvent{} } -func (h *ChatMemberUserDeletedEventHandler) Handle(ctx *core.Context, event interface{}) error { - return h.Fn(ctx, event.(*ChatMemberUserDeletedEvent)) +func (h *ChatMemberBotAddedEventHandler) Handle(ctx *core.Context, event interface{}) error { + return h.Fn(ctx, event.(*ChatMemberBotAddedEvent)) } -func SetChatMemberUserDeletedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *ChatMemberUserDeletedEvent) error) { - event.SetTypeHandler(conf, "im.chat.member.user.deleted_v1", &ChatMemberUserDeletedEventHandler{Fn: fn}) +func SetChatMemberBotAddedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *ChatMemberBotAddedEvent) error) { + event.SetTypeHandler(conf, "im.chat.member.bot.added_v1", &ChatMemberBotAddedEventHandler{Fn: fn}) } -type ChatDisbandedEventHandler struct { - Fn func(*core.Context, *ChatDisbandedEvent) error +type ChatMemberUserAddedEventHandler struct { + Fn func(*core.Context, *ChatMemberUserAddedEvent) error } -func (h *ChatDisbandedEventHandler) GetEvent() interface{} { - return &ChatDisbandedEvent{} +func (h *ChatMemberUserAddedEventHandler) GetEvent() interface{} { + return &ChatMemberUserAddedEvent{} } -func (h *ChatDisbandedEventHandler) Handle(ctx *core.Context, event interface{}) error { - return h.Fn(ctx, event.(*ChatDisbandedEvent)) +func (h *ChatMemberUserAddedEventHandler) Handle(ctx *core.Context, event interface{}) error { + return h.Fn(ctx, event.(*ChatMemberUserAddedEvent)) } -func SetChatDisbandedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *ChatDisbandedEvent) error) { - event.SetTypeHandler(conf, "im.chat.disbanded_v1", &ChatDisbandedEventHandler{Fn: fn}) +func SetChatMemberUserAddedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *ChatMemberUserAddedEvent) error) { + event.SetTypeHandler(conf, "im.chat.member.user.added_v1", &ChatMemberUserAddedEventHandler{Fn: fn}) } -type ChatUpdatedEventHandler struct { - Fn func(*core.Context, *ChatUpdatedEvent) error +type ChatMemberBotDeletedEventHandler struct { + Fn func(*core.Context, *ChatMemberBotDeletedEvent) error } -func (h *ChatUpdatedEventHandler) GetEvent() interface{} { - return &ChatUpdatedEvent{} +func (h *ChatMemberBotDeletedEventHandler) GetEvent() interface{} { + return &ChatMemberBotDeletedEvent{} } -func (h *ChatUpdatedEventHandler) Handle(ctx *core.Context, event interface{}) error { - return h.Fn(ctx, event.(*ChatUpdatedEvent)) +func (h *ChatMemberBotDeletedEventHandler) Handle(ctx *core.Context, event interface{}) error { + return h.Fn(ctx, event.(*ChatMemberBotDeletedEvent)) } -func SetChatUpdatedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *ChatUpdatedEvent) error) { - event.SetTypeHandler(conf, "im.chat.updated_v1", &ChatUpdatedEventHandler{Fn: fn}) +func SetChatMemberBotDeletedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *ChatMemberBotDeletedEvent) error) { + event.SetTypeHandler(conf, "im.chat.member.bot.deleted_v1", &ChatMemberBotDeletedEventHandler{Fn: fn}) } type ChatMemberUserWithdrawnEventHandler struct { @@ -119,20 +119,20 @@ func SetChatMemberUserWithdrawnEventHandler(conf *config.Config, fn func(ctx *co event.SetTypeHandler(conf, "im.chat.member.user.withdrawn_v1", &ChatMemberUserWithdrawnEventHandler{Fn: fn}) } -type MessageReceiveEventHandler struct { - Fn func(*core.Context, *MessageReceiveEvent) error +type ChatMemberUserDeletedEventHandler struct { + Fn func(*core.Context, *ChatMemberUserDeletedEvent) error } -func (h *MessageReceiveEventHandler) GetEvent() interface{} { - return &MessageReceiveEvent{} +func (h *ChatMemberUserDeletedEventHandler) GetEvent() interface{} { + return &ChatMemberUserDeletedEvent{} } -func (h *MessageReceiveEventHandler) Handle(ctx *core.Context, event interface{}) error { - return h.Fn(ctx, event.(*MessageReceiveEvent)) +func (h *ChatMemberUserDeletedEventHandler) Handle(ctx *core.Context, event interface{}) error { + return h.Fn(ctx, event.(*ChatMemberUserDeletedEvent)) } -func SetMessageReceiveEventHandler(conf *config.Config, fn func(ctx *core.Context, event *MessageReceiveEvent) error) { - event.SetTypeHandler(conf, "im.message.receive_v1", &MessageReceiveEventHandler{Fn: fn}) +func SetChatMemberUserDeletedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *ChatMemberUserDeletedEvent) error) { + event.SetTypeHandler(conf, "im.chat.member.user.deleted_v1", &ChatMemberUserDeletedEventHandler{Fn: fn}) } type MessageAtMessageReadEventHandler struct { @@ -166,35 +166,3 @@ func (h *MessageMessageReadEventHandler) Handle(ctx *core.Context, event interfa func SetMessageMessageReadEventHandler(conf *config.Config, fn func(ctx *core.Context, event *MessageMessageReadEvent) error) { event.SetTypeHandler(conf, "im.message.message_read_v1", &MessageMessageReadEventHandler{Fn: fn}) } - -type MessageReactionCreatedEventHandler struct { - Fn func(*core.Context, *MessageReactionCreatedEvent) error -} - -func (h *MessageReactionCreatedEventHandler) GetEvent() interface{} { - return &MessageReactionCreatedEvent{} -} - -func (h *MessageReactionCreatedEventHandler) Handle(ctx *core.Context, event interface{}) error { - return h.Fn(ctx, event.(*MessageReactionCreatedEvent)) -} - -func SetMessageReactionCreatedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *MessageReactionCreatedEvent) error) { - event.SetTypeHandler(conf, "im.message.reaction.created_v1", &MessageReactionCreatedEventHandler{Fn: fn}) -} - -type MessageReactionDeletedEventHandler struct { - Fn func(*core.Context, *MessageReactionDeletedEvent) error -} - -func (h *MessageReactionDeletedEventHandler) GetEvent() interface{} { - return &MessageReactionDeletedEvent{} -} - -func (h *MessageReactionDeletedEventHandler) Handle(ctx *core.Context, event interface{}) error { - return h.Fn(ctx, event.(*MessageReactionDeletedEvent)) -} - -func SetMessageReactionDeletedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *MessageReactionDeletedEvent) error) { - event.SetTypeHandler(conf, "im.message.reaction.deleted_v1", &MessageReactionDeletedEventHandler{Fn: fn}) -} diff --git a/service/im/v1/model.go b/service/im/v1/model.go index 0ef922cb..c25a8abf 100644 --- a/service/im/v1/model.go +++ b/service/im/v1/model.go @@ -19,27 +19,6 @@ func (s *UserId) MarshalJSON() ([]byte, error) { return tools.MarshalJSON(raw, s.ForceSendFields) } -type Chat struct { - ChatId string `json:"chat_id,omitempty"` - Avatar string `json:"avatar,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - I18nNames *I18nNames `json:"i18n_names,omitempty"` - OnlyOwnerAdd bool `json:"only_owner_add,omitempty"` - ShareAllowed bool `json:"share_allowed,omitempty"` - OnlyOwnerAtAll bool `json:"only_owner_at_all,omitempty"` - OnlyOwnerEdit bool `json:"only_owner_edit,omitempty"` - OwnerUserId string `json:"owner_user_id,omitempty"` - Type string `json:"type,omitempty"` - ForceSendFields []string `json:"-"` -} - -func (s *Chat) MarshalJSON() ([]byte, error) { - type cp Chat - raw := cp(*s) - return tools.MarshalJSON(raw, s.ForceSendFields) -} - type ChatAnnouncement struct { } @@ -65,27 +44,6 @@ func (s *ChatMemberBot) MarshalJSON() ([]byte, error) { return tools.MarshalJSON(raw, s.ForceSendFields) } -type File struct { -} - -type Image struct { -} - -type AppUsage struct { - CreatorId int64 `json:"creator_id,omitempty,string"` - CreateTime int64 `json:"create_time,omitempty,string"` - UsageBotId int64 `json:"usage_bot_id,omitempty,string"` - ActivateStatus int64 `json:"activate_status,omitempty,string"` - AdminUids []int64 `json:"admin_uids,omitempty"` - ForceSendFields []string `json:"-"` -} - -func (s *AppUsage) MarshalJSON() ([]byte, error) { - type cp AppUsage - raw := cp(*s) - return tools.MarshalJSON(raw, s.ForceSendFields) -} - type ChatMembers struct { UserId string `json:"user_id,omitempty"` ForceSendFields []string `json:"-"` @@ -97,6 +55,9 @@ func (s *ChatMembers) MarshalJSON() ([]byte, error) { return tools.MarshalJSON(raw, s.ForceSendFields) } +type ChatModeration struct { +} + type Emoji struct { EmojiType string `json:"emoji_type,omitempty"` ForceSendFields []string `json:"-"` @@ -108,6 +69,28 @@ func (s *Emoji) MarshalJSON() ([]byte, error) { return tools.MarshalJSON(raw, s.ForceSendFields) } +type EventMessage struct { + MessageId string `json:"message_id,omitempty"` + RootId string `json:"root_id,omitempty"` + ParentId string `json:"parent_id,omitempty"` + CreateTime int64 `json:"create_time,omitempty,string"` + ChatId string `json:"chat_id,omitempty"` + ChatType string `json:"chat_type,omitempty"` + MessageType string `json:"message_type,omitempty"` + Content string `json:"content,omitempty"` + Mentions []*MentionEvent `json:"mentions,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *EventMessage) MarshalJSON() ([]byte, error) { + type cp EventMessage + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type File struct { +} + type I18nNames struct { ZhCn string `json:"zh_cn,omitempty"` EnUs string `json:"en_us,omitempty"` @@ -121,15 +104,32 @@ func (s *I18nNames) MarshalJSON() ([]byte, error) { return tools.MarshalJSON(raw, s.ForceSendFields) } -type MentionEvent struct { - Key string `json:"key,omitempty"` - Id string `json:"id,omitempty"` +type Image struct { +} + +type ListMember struct { + MemberIdType string `json:"member_id_type,omitempty"` + MemberId string `json:"member_id,omitempty"` Name string `json:"name,omitempty"` + TenantKey string `json:"tenant_key,omitempty"` ForceSendFields []string `json:"-"` } -func (s *MentionEvent) MarshalJSON() ([]byte, error) { - type cp MentionEvent +func (s *ListMember) MarshalJSON() ([]byte, error) { + type cp ListMember + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type ListModerator struct { + UserIdType string `json:"user_id_type,omitempty"` + UserId string `json:"user_id,omitempty"` + TenantKey string `json:"tenant_key,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *ListModerator) MarshalJSON() ([]byte, error) { + type cp ListModerator raw := cp(*s) return tools.MarshalJSON(raw, s.ForceSendFields) } @@ -157,6 +157,20 @@ func (s *Message) MarshalJSON() ([]byte, error) { return tools.MarshalJSON(raw, s.ForceSendFields) } +type MessageReaction struct { + ReactionId string `json:"reaction_id,omitempty"` + OperatorId string `json:"operator_id,omitempty"` + ActionTime string `json:"action_time,omitempty"` + ReactionType *Emoji `json:"reaction_type,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *MessageReaction) MarshalJSON() ([]byte, error) { + type cp MessageReaction + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + type MessageResource struct { } @@ -171,6 +185,31 @@ func (s *MessageBody) MarshalJSON() ([]byte, error) { return tools.MarshalJSON(raw, s.ForceSendFields) } +type ModeratorList struct { + AddedMemberList []*ListEventModerator `json:"added_member_list,omitempty"` + RemovedMemberList []*ListEventModerator `json:"removed_member_list,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *ModeratorList) MarshalJSON() ([]byte, error) { + type cp ModeratorList + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type Reaction struct { + ReactionType *Emoji `json:"reaction_type,omitempty"` + OperatorId string `json:"operator_id,omitempty"` + ActionTime string `json:"action_time,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *Reaction) MarshalJSON() ([]byte, error) { + type cp Reaction + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + type UrgentReceivers struct { UserIdList []string `json:"user_id_list,omitempty"` ForceSendFields []string `json:"-"` @@ -182,7 +221,39 @@ func (s *UrgentReceivers) MarshalJSON() ([]byte, error) { return tools.MarshalJSON(raw, s.ForceSendFields) } -type ChatModeration struct { +type Chat struct { + ChatId string `json:"chat_id,omitempty"` + Avatar string `json:"avatar,omitempty"` + Name string `json:"name,omitempty"` + Description string `json:"description,omitempty"` + I18nNames *I18nNames `json:"i18n_names,omitempty"` + OnlyOwnerAdd bool `json:"only_owner_add,omitempty"` + ShareAllowed bool `json:"share_allowed,omitempty"` + OnlyOwnerAtAll bool `json:"only_owner_at_all,omitempty"` + OnlyOwnerEdit bool `json:"only_owner_edit,omitempty"` + OwnerUserId string `json:"owner_user_id,omitempty"` + Type string `json:"type,omitempty"` + Labels []string `json:"labels,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *Chat) MarshalJSON() ([]byte, error) { + type cp Chat + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type ChatMemberUser struct { + Name string `json:"name,omitempty"` + TenantKey string `json:"tenant_key,omitempty"` + UserId *UserId `json:"user_id,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *ChatMemberUser) MarshalJSON() ([]byte, error) { + type cp ChatMemberUser + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) } type ChatChange struct { @@ -199,6 +270,7 @@ type ChatChange struct { LeaveMessageVisibility string `json:"leave_message_visibility,omitempty"` ModerationPermission string `json:"moderation_permission,omitempty"` OwnerId *UserId `json:"owner_id,omitempty"` + Labels []string `json:"labels,omitempty"` ForceSendFields []string `json:"-"` } @@ -208,21 +280,28 @@ func (s *ChatChange) MarshalJSON() ([]byte, error) { return tools.MarshalJSON(raw, s.ForceSendFields) } -type EventMessage struct { - MessageId string `json:"message_id,omitempty"` - RootId string `json:"root_id,omitempty"` - ParentId string `json:"parent_id,omitempty"` - CreateTime int64 `json:"create_time,omitempty,string"` - ChatId string `json:"chat_id,omitempty"` - ChatType string `json:"chat_type,omitempty"` - MessageType string `json:"message_type,omitempty"` - Content string `json:"content,omitempty"` - Mentions []*MentionEvent `json:"mentions,omitempty"` - ForceSendFields []string `json:"-"` +type EventMessageReader struct { + ReaderId *UserId `json:"reader_id,omitempty"` + ReadTime string `json:"read_time,omitempty"` + TenantKey string `json:"tenant_key,omitempty"` + ForceSendFields []string `json:"-"` } -func (s *EventMessage) MarshalJSON() ([]byte, error) { - type cp EventMessage +func (s *EventMessageReader) MarshalJSON() ([]byte, error) { + type cp EventMessageReader + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type EventSender struct { + SenderId *UserId `json:"sender_id,omitempty"` + SenderType string `json:"sender_type,omitempty"` + TenantKey string `json:"tenant_key,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *EventSender) MarshalJSON() ([]byte, error) { + type cp EventSender raw := cp(*s) return tools.MarshalJSON(raw, s.ForceSendFields) } @@ -236,6 +315,7 @@ type ListChat struct { OwnerIdType string `json:"owner_id_type,omitempty"` External bool `json:"external,omitempty"` TenantKey string `json:"tenant_key,omitempty"` + Labels []string `json:"labels,omitempty"` ForceSendFields []string `json:"-"` } @@ -245,174 +325,142 @@ func (s *ListChat) MarshalJSON() ([]byte, error) { return tools.MarshalJSON(raw, s.ForceSendFields) } -type ListMember struct { - MemberIdType string `json:"member_id_type,omitempty"` - MemberId string `json:"member_id,omitempty"` - Name string `json:"name,omitempty"` +type ListEventModerator struct { TenantKey string `json:"tenant_key,omitempty"` + UserId *UserId `json:"user_id,omitempty"` ForceSendFields []string `json:"-"` } -func (s *ListMember) MarshalJSON() ([]byte, error) { - type cp ListMember +func (s *ListEventModerator) MarshalJSON() ([]byte, error) { + type cp ListEventModerator raw := cp(*s) return tools.MarshalJSON(raw, s.ForceSendFields) } -type MessageReaction struct { - ReactionId string `json:"reaction_id,omitempty"` - OperatorId string `json:"operator_id,omitempty"` - ActionTime string `json:"action_time,omitempty"` - ReactionType *Emoji `json:"reaction_type,omitempty"` +type Mention struct { + Key string `json:"key,omitempty"` + Id string `json:"id,omitempty"` + IdType string `json:"id_type,omitempty"` + Name string `json:"name,omitempty"` + TenantKey string `json:"tenant_key,omitempty"` ForceSendFields []string `json:"-"` } -func (s *MessageReaction) MarshalJSON() ([]byte, error) { - type cp MessageReaction +func (s *Mention) MarshalJSON() ([]byte, error) { + type cp Mention raw := cp(*s) return tools.MarshalJSON(raw, s.ForceSendFields) } -type ModeratorList struct { - AddedMemberList []*ListEventModerator `json:"added_member_list,omitempty"` - RemovedMemberList []*ListEventModerator `json:"removed_member_list,omitempty"` - ForceSendFields []string `json:"-"` +type MentionEvent struct { + Key string `json:"key,omitempty"` + Id string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + TenantKey string `json:"tenant_key,omitempty"` + ForceSendFields []string `json:"-"` } -func (s *ModeratorList) MarshalJSON() ([]byte, error) { - type cp ModeratorList +func (s *MentionEvent) MarshalJSON() ([]byte, error) { + type cp MentionEvent raw := cp(*s) return tools.MarshalJSON(raw, s.ForceSendFields) } -type ListModerator struct { +type ReadUser struct { UserIdType string `json:"user_id_type,omitempty"` UserId string `json:"user_id,omitempty"` + Timestamp string `json:"timestamp,omitempty"` TenantKey string `json:"tenant_key,omitempty"` ForceSendFields []string `json:"-"` } -func (s *ListModerator) MarshalJSON() ([]byte, error) { - type cp ListModerator +func (s *ReadUser) MarshalJSON() ([]byte, error) { + type cp ReadUser raw := cp(*s) return tools.MarshalJSON(raw, s.ForceSendFields) } -type ChatMemberUser struct { - Name string `json:"name,omitempty"` +type Sender struct { + Id string `json:"id,omitempty"` + IdType string `json:"id_type,omitempty"` + SenderType string `json:"sender_type,omitempty"` TenantKey string `json:"tenant_key,omitempty"` - UserId *UserId `json:"user_id,omitempty"` ForceSendFields []string `json:"-"` } -func (s *ChatMemberUser) MarshalJSON() ([]byte, error) { - type cp ChatMemberUser +func (s *Sender) MarshalJSON() ([]byte, error) { + type cp Sender raw := cp(*s) return tools.MarshalJSON(raw, s.ForceSendFields) } -type EventMessageReader struct { - ReaderId *UserId `json:"reader_id,omitempty"` - ReadTime string `json:"read_time,omitempty"` +type MessageListResult struct { + HasMore bool `json:"has_more,omitempty"` + PageToken string `json:"page_token,omitempty"` + Items []*Message `json:"items,omitempty"` +} + +type MessagePatchReqBody struct { + Content string `json:"content,omitempty"` ForceSendFields []string `json:"-"` } -func (s *EventMessageReader) MarshalJSON() ([]byte, error) { - type cp EventMessageReader - raw := cp(*s) - return tools.MarshalJSON(raw, s.ForceSendFields) -} - -type ListEventModerator struct { - TenantKey string `json:"tenant_key,omitempty"` - UserId *UserId `json:"user_id,omitempty"` - ForceSendFields []string `json:"-"` -} - -func (s *ListEventModerator) MarshalJSON() ([]byte, error) { - type cp ListEventModerator - raw := cp(*s) - return tools.MarshalJSON(raw, s.ForceSendFields) -} - -type ChatCustomBot struct { -} - -type EventSender struct { - SenderId *UserId `json:"sender_id,omitempty"` - SenderType string `json:"sender_type,omitempty"` - TenantKey string `json:"tenant_key,omitempty"` - ForceSendFields []string `json:"-"` -} - -func (s *EventSender) MarshalJSON() ([]byte, error) { - type cp EventSender - raw := cp(*s) - return tools.MarshalJSON(raw, s.ForceSendFields) -} - -type Mention struct { - Key string `json:"key,omitempty"` - Id string `json:"id,omitempty"` - IdType string `json:"id_type,omitempty"` - Name string `json:"name,omitempty"` - TenantKey string `json:"tenant_key,omitempty"` - ForceSendFields []string `json:"-"` -} - -func (s *Mention) MarshalJSON() ([]byte, error) { - type cp Mention +func (s *MessagePatchReqBody) MarshalJSON() ([]byte, error) { + type cp MessagePatchReqBody raw := cp(*s) return tools.MarshalJSON(raw, s.ForceSendFields) } -type ReadUser struct { - UserIdType string `json:"user_id_type,omitempty"` - UserId string `json:"user_id,omitempty"` - Timestamp string `json:"timestamp,omitempty"` - TenantKey string `json:"tenant_key,omitempty"` +type MessageReplyReqBody struct { + Content string `json:"content,omitempty"` + MsgType string `json:"msg_type,omitempty"` ForceSendFields []string `json:"-"` } -func (s *ReadUser) MarshalJSON() ([]byte, error) { - type cp ReadUser +func (s *MessageReplyReqBody) MarshalJSON() ([]byte, error) { + type cp MessageReplyReqBody raw := cp(*s) return tools.MarshalJSON(raw, s.ForceSendFields) } -type Sender struct { - Id string `json:"id,omitempty"` - IdType string `json:"id_type,omitempty"` - SenderType string `json:"sender_type,omitempty"` - TenantKey string `json:"tenant_key,omitempty"` +type MessageCreateReqBody struct { + ReceiveId string `json:"receive_id,omitempty"` + Content string `json:"content,omitempty"` + MsgType string `json:"msg_type,omitempty"` ForceSendFields []string `json:"-"` } -func (s *Sender) MarshalJSON() ([]byte, error) { - type cp Sender +func (s *MessageCreateReqBody) MarshalJSON() ([]byte, error) { + type cp MessageCreateReqBody raw := cp(*s) return tools.MarshalJSON(raw, s.ForceSendFields) } -type ChatAnnouncementGetResult struct { - Content string `json:"content,omitempty"` - Revision string `json:"revision,omitempty"` - CreateTime string `json:"create_time,omitempty"` - UpdateTime string `json:"update_time,omitempty"` - OwnerIdType string `json:"owner_id_type,omitempty"` - OwnerId string `json:"owner_id,omitempty"` - ModifierIdType string `json:"modifier_id_type,omitempty"` - ModifierId string `json:"modifier_id,omitempty"` +type MessageReadUsersResult struct { + Items []*ReadUser `json:"items,omitempty"` + HasMore bool `json:"has_more,omitempty"` + PageToken string `json:"page_token,omitempty"` } -type ChatAnnouncementPatchReqBody struct { - Revision string `json:"revision,omitempty"` - Requests []string `json:"requests,omitempty"` - ForceSendFields []string `json:"-"` +type ChatUpdateReqBody struct { + Avatar string `json:"avatar,omitempty"` + Name string `json:"name,omitempty"` + Description string `json:"description,omitempty"` + I18nNames *I18nNames `json:"i18n_names,omitempty"` + AddMemberPermission string `json:"add_member_permission,omitempty"` + ShareCardPermission string `json:"share_card_permission,omitempty"` + AtAllPermission string `json:"at_all_permission,omitempty"` + EditPermission string `json:"edit_permission,omitempty"` + OwnerId string `json:"owner_id,omitempty"` + JoinMessageVisibility string `json:"join_message_visibility,omitempty"` + LeaveMessageVisibility string `json:"leave_message_visibility,omitempty"` + MembershipApproval string `json:"membership_approval,omitempty"` + Labels []string `json:"labels,omitempty"` + ForceSendFields []string `json:"-"` } -func (s *ChatAnnouncementPatchReqBody) MarshalJSON() ([]byte, error) { - type cp ChatAnnouncementPatchReqBody +func (s *ChatUpdateReqBody) MarshalJSON() ([]byte, error) { + type cp ChatUpdateReqBody raw := cp(*s) return tools.MarshalJSON(raw, s.ForceSendFields) } @@ -421,42 +469,37 @@ type FileCreateResult struct { FileKey string `json:"file_key,omitempty"` } -type ImageCreateResult struct { - ImageKey string `json:"image_key,omitempty"` -} - -type MessageReactionListResult struct { - Items []*MessageReaction `json:"items,omitempty"` - HasMore bool `json:"has_more,omitempty"` - PageToken string `json:"page_token,omitempty"` -} - -type MessageCreateReqBody struct { - ReceiveId string `json:"receive_id,omitempty"` - Content string `json:"content,omitempty"` - MsgType string `json:"msg_type,omitempty"` - ForceSendFields []string `json:"-"` -} - -func (s *MessageCreateReqBody) MarshalJSON() ([]byte, error) { - type cp MessageCreateReqBody - raw := cp(*s) - return tools.MarshalJSON(raw, s.ForceSendFields) -} - -type ChatMembersCreateReqBody struct { - IdList []string `json:"id_list,omitempty"` - ForceSendFields []string `json:"-"` +type ChatListResult struct { + Items []*ListChat `json:"items,omitempty"` + PageToken string `json:"page_token,omitempty"` + HasMore bool `json:"has_more,omitempty"` } -func (s *ChatMembersCreateReqBody) MarshalJSON() ([]byte, error) { - type cp ChatMembersCreateReqBody - raw := cp(*s) - return tools.MarshalJSON(raw, s.ForceSendFields) +type ImageCreateResult struct { + ImageKey string `json:"image_key,omitempty"` } -type ChatMembersCreateResult struct { - InvalidIdList []string `json:"invalid_id_list,omitempty"` +type ChatGetResult struct { + Avatar string `json:"avatar,omitempty"` + Name string `json:"name,omitempty"` + Description string `json:"description,omitempty"` + I18nNames *I18nNames `json:"i18n_names,omitempty"` + AddMemberPermission string `json:"add_member_permission,omitempty"` + ShareCardPermission string `json:"share_card_permission,omitempty"` + AtAllPermission string `json:"at_all_permission,omitempty"` + EditPermission string `json:"edit_permission,omitempty"` + OwnerIdType string `json:"owner_id_type,omitempty"` + OwnerId string `json:"owner_id,omitempty"` + ChatMode string `json:"chat_mode,omitempty"` + ChatType string `json:"chat_type,omitempty"` + ChatTag string `json:"chat_tag,omitempty"` + JoinMessageVisibility string `json:"join_message_visibility,omitempty"` + LeaveMessageVisibility string `json:"leave_message_visibility,omitempty"` + MembershipApproval string `json:"membership_approval,omitempty"` + ModerationPermission string `json:"moderation_permission,omitempty"` + External bool `json:"external,omitempty"` + TenantKey string `json:"tenant_key,omitempty"` + Labels []string `json:"labels,omitempty"` } type ChatCreateReqBody struct { @@ -471,6 +514,7 @@ type ChatCreateReqBody struct { JoinMessageVisibility string `json:"join_message_visibility,omitempty"` LeaveMessageVisibility string `json:"leave_message_visibility,omitempty"` MembershipApproval string `json:"membership_approval,omitempty"` + Labels []string `json:"labels,omitempty"` ForceSendFields []string `json:"-"` } @@ -501,88 +545,58 @@ type ChatCreateResult struct { LeaveMessageVisibility string `json:"leave_message_visibility,omitempty"` MembershipApproval string `json:"membership_approval,omitempty"` ModerationPermission string `json:"moderation_permission,omitempty"` + Labels []string `json:"labels,omitempty"` } -type ChatMembersDeleteReqBody struct { +type ChatSearchResult struct { + Items []*ListChat `json:"items,omitempty"` + PageToken string `json:"page_token,omitempty"` + HasMore bool `json:"has_more,omitempty"` +} + +type MessageGetResult struct { + Items []*Message `json:"items,omitempty"` +} + +type ChatMembersCreateReqBody struct { IdList []string `json:"id_list,omitempty"` ForceSendFields []string `json:"-"` } -func (s *ChatMembersDeleteReqBody) MarshalJSON() ([]byte, error) { - type cp ChatMembersDeleteReqBody +func (s *ChatMembersCreateReqBody) MarshalJSON() ([]byte, error) { + type cp ChatMembersCreateReqBody raw := cp(*s) return tools.MarshalJSON(raw, s.ForceSendFields) } -type ChatMembersDeleteResult struct { +type ChatMembersCreateResult struct { InvalidIdList []string `json:"invalid_id_list,omitempty"` } -type ChatMembersGetResult struct { - Items []*ListMember `json:"items,omitempty"` - PageToken string `json:"page_token,omitempty"` - HasMore bool `json:"has_more,omitempty"` - MemberTotal int `json:"member_total,omitempty"` -} - -type ChatGetResult struct { - Avatar string `json:"avatar,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - I18nNames *I18nNames `json:"i18n_names,omitempty"` - AddMemberPermission string `json:"add_member_permission,omitempty"` - ShareCardPermission string `json:"share_card_permission,omitempty"` - AtAllPermission string `json:"at_all_permission,omitempty"` - EditPermission string `json:"edit_permission,omitempty"` - OwnerIdType string `json:"owner_id_type,omitempty"` - OwnerId string `json:"owner_id,omitempty"` - ChatMode string `json:"chat_mode,omitempty"` - ChatType string `json:"chat_type,omitempty"` - ChatTag string `json:"chat_tag,omitempty"` - JoinMessageVisibility string `json:"join_message_visibility,omitempty"` - LeaveMessageVisibility string `json:"leave_message_visibility,omitempty"` - MembershipApproval string `json:"membership_approval,omitempty"` - ModerationPermission string `json:"moderation_permission,omitempty"` - External bool `json:"external,omitempty"` - TenantKey string `json:"tenant_key,omitempty"` -} - -type ChatMembersIsInChatResult struct { - IsInChat bool `json:"is_in_chat,omitempty"` -} - -type ChatListResult struct { - Items []*ListChat `json:"items,omitempty"` - PageToken string `json:"page_token,omitempty"` - HasMore bool `json:"has_more,omitempty"` +type ChatMembersDeleteReqBody struct { + IdList []string `json:"id_list,omitempty"` + ForceSendFields []string `json:"-"` } -type ChatSearchResult struct { - Items []*ListChat `json:"items,omitempty"` - PageToken string `json:"page_token,omitempty"` - HasMore bool `json:"has_more,omitempty"` +func (s *ChatMembersDeleteReqBody) MarshalJSON() ([]byte, error) { + type cp ChatMembersDeleteReqBody + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) } -type ChatUpdateReqBody struct { - Avatar string `json:"avatar,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - I18nNames *I18nNames `json:"i18n_names,omitempty"` - AddMemberPermission string `json:"add_member_permission,omitempty"` - ShareCardPermission string `json:"share_card_permission,omitempty"` - AtAllPermission string `json:"at_all_permission,omitempty"` - EditPermission string `json:"edit_permission,omitempty"` - OwnerId string `json:"owner_id,omitempty"` - JoinMessageVisibility string `json:"join_message_visibility,omitempty"` - LeaveMessageVisibility string `json:"leave_message_visibility,omitempty"` - MembershipApproval string `json:"membership_approval,omitempty"` - ForceSendFields []string `json:"-"` +type ChatMembersDeleteResult struct { + InvalidIdList []string `json:"invalid_id_list,omitempty"` } -func (s *ChatUpdateReqBody) MarshalJSON() ([]byte, error) { - type cp ChatUpdateReqBody - raw := cp(*s) - return tools.MarshalJSON(raw, s.ForceSendFields) +type ChatAnnouncementGetResult struct { + Content string `json:"content,omitempty"` + Revision string `json:"revision,omitempty"` + CreateTime string `json:"create_time,omitempty"` + UpdateTime string `json:"update_time,omitempty"` + OwnerIdType string `json:"owner_id_type,omitempty"` + OwnerId string `json:"owner_id,omitempty"` + ModifierIdType string `json:"modifier_id_type,omitempty"` + ModifierId string `json:"modifier_id,omitempty"` } type ChatModerationGetResult struct { @@ -592,37 +606,25 @@ type ChatModerationGetResult struct { Items []*ListModerator `json:"items,omitempty"` } -type MessageListResult struct { - HasMore bool `json:"has_more,omitempty"` - PageToken string `json:"page_token,omitempty"` - Items []*Message `json:"items,omitempty"` -} - -type MessagePatchReqBody struct { - Content string `json:"content,omitempty"` - ForceSendFields []string `json:"-"` -} - -func (s *MessagePatchReqBody) MarshalJSON() ([]byte, error) { - type cp MessagePatchReqBody - raw := cp(*s) - return tools.MarshalJSON(raw, s.ForceSendFields) +type ChatMembersGetResult struct { + Items []*ListMember `json:"items,omitempty"` + PageToken string `json:"page_token,omitempty"` + HasMore bool `json:"has_more,omitempty"` + MemberTotal int `json:"member_total,omitempty"` } -type MessageReadUsersResult struct { - Items []*ReadUser `json:"items,omitempty"` - HasMore bool `json:"has_more,omitempty"` - PageToken string `json:"page_token,omitempty"` +type ChatMembersIsInChatResult struct { + IsInChat bool `json:"is_in_chat,omitempty"` } -type MessageReplyReqBody struct { - Content string `json:"content,omitempty"` - MsgType string `json:"msg_type,omitempty"` +type ChatAnnouncementPatchReqBody struct { + Revision string `json:"revision,omitempty"` + Requests []string `json:"requests,omitempty"` ForceSendFields []string `json:"-"` } -func (s *MessageReplyReqBody) MarshalJSON() ([]byte, error) { - type cp MessageReplyReqBody +func (s *ChatAnnouncementPatchReqBody) MarshalJSON() ([]byte, error) { + type cp ChatAnnouncementPatchReqBody raw := cp(*s) return tools.MarshalJSON(raw, s.ForceSendFields) } @@ -640,82 +642,41 @@ func (s *ChatModerationUpdateReqBody) MarshalJSON() ([]byte, error) { return tools.MarshalJSON(raw, s.ForceSendFields) } -type MessageGetResult struct { - Items []*Message `json:"items,omitempty"` +type MessageReceiveEventData struct { + Sender *EventSender `json:"sender,omitempty"` + Message *EventMessage `json:"message,omitempty"` } -type ChatCustomBotCreateReqBody struct { - ChatId string `json:"chat_id,omitempty"` - AvatarKey string `json:"avatar_key,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - AllowIps []string `json:"allow_ips,omitempty"` - KeyWords []string `json:"key_words,omitempty"` - SignatureStatus bool `json:"signature_status,omitempty"` - Uuid int64 `json:"uuid,omitempty,string"` - ForceSendFields []string `json:"-"` +type MessageReceiveEvent struct { + *model.BaseEventV2 + Event *MessageReceiveEventData `json:"event"` } -func (s *ChatCustomBotCreateReqBody) MarshalJSON() ([]byte, error) { - type cp ChatCustomBotCreateReqBody - raw := cp(*s) - return tools.MarshalJSON(raw, s.ForceSendFields) -} - -type ChatCustomBotCreateResult struct { - BotId int64 `json:"bot_id,omitempty,string"` - ChatId string `json:"chat_id,omitempty"` - AvatarKey string `json:"avatar_key,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - I18nNames *I18nNames `json:"i18n_names,omitempty"` - I18nDescriptions *I18nNames `json:"i18n_descriptions,omitempty"` - Webhook string `json:"webhook,omitempty"` - AllowIps []string `json:"allow_ips,omitempty"` - KeyWords []string `json:"key_words,omitempty"` - SignatureStatus bool `json:"signature_status,omitempty"` - Signature string `json:"signature,omitempty"` - Enable bool `json:"enable,omitempty"` - InvitorId int64 `json:"invitor_id,omitempty,string"` - InvitorIdType string `json:"invitor_id_type,omitempty"` - Version int64 `json:"version,omitempty,string"` -} - -type ChatCustomBotGetResult struct { - BotId int64 `json:"bot_id,omitempty,string"` - ChatId string `json:"chat_id,omitempty"` - AvatarKey string `json:"avatar_key,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - I18nNames *I18nNames `json:"i18n_names,omitempty"` - I18nDescriptions *I18nNames `json:"i18n_descriptions,omitempty"` - Webhook string `json:"webhook,omitempty"` - AllowIps []string `json:"allow_ips,omitempty"` - KeyWords []string `json:"key_words,omitempty"` - SignatureStatus bool `json:"signature_status,omitempty"` - Signature string `json:"signature,omitempty"` - Enable bool `json:"enable,omitempty"` - InvitorId int64 `json:"invitor_id,omitempty,string"` - InvitorIdType string `json:"invitor_id_type,omitempty"` - Version int64 `json:"version,omitempty,string"` -} - -type ChatCustomBotUpdateReqBody struct { - AvatarKey string `json:"avatar_key,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - AllowIps []string `json:"allow_ips,omitempty"` - KeyWords []string `json:"key_words,omitempty"` - SignatureStatus bool `json:"signature_status,omitempty"` - ChangeSignature bool `json:"change_signature,omitempty"` - Enable bool `json:"enable,omitempty"` - ForceSendFields []string `json:"-"` +type ChatUpdatedEventData struct { + ChatId string `json:"chat_id,omitempty"` + OperatorId *UserId `json:"operator_id,omitempty"` + External bool `json:"external,omitempty"` + OperatorTenantKey string `json:"operator_tenant_key,omitempty"` + AfterChange *ChatChange `json:"after_change,omitempty"` + BeforeChange *ChatChange `json:"before_change,omitempty"` + ModeratorList *ModeratorList `json:"moderator_list,omitempty"` } -func (s *ChatCustomBotUpdateReqBody) MarshalJSON() ([]byte, error) { - type cp ChatCustomBotUpdateReqBody - raw := cp(*s) - return tools.MarshalJSON(raw, s.ForceSendFields) +type ChatUpdatedEvent struct { + *model.BaseEventV2 + Event *ChatUpdatedEventData `json:"event"` +} + +type ChatDisbandedEventData struct { + ChatId string `json:"chat_id,omitempty"` + OperatorId *UserId `json:"operator_id,omitempty"` + External bool `json:"external,omitempty"` + OperatorTenantKey string `json:"operator_tenant_key,omitempty"` +} + +type ChatDisbandedEvent struct { + *model.BaseEventV2 + Event *ChatDisbandedEventData `json:"event"` } type ChatMemberBotAddedEventData struct { @@ -755,7 +716,7 @@ type ChatMemberBotDeletedEvent struct { Event *ChatMemberBotDeletedEventData `json:"event"` } -type ChatMemberUserDeletedEventData struct { +type ChatMemberUserWithdrawnEventData struct { ChatId string `json:"chat_id,omitempty"` OperatorId *UserId `json:"operator_id,omitempty"` External bool `json:"external,omitempty"` @@ -763,39 +724,12 @@ type ChatMemberUserDeletedEventData struct { Users []*ChatMemberUser `json:"users,omitempty"` } -type ChatMemberUserDeletedEvent struct { - *model.BaseEventV2 - Event *ChatMemberUserDeletedEventData `json:"event"` -} - -type ChatDisbandedEventData struct { - ChatId string `json:"chat_id,omitempty"` - OperatorId *UserId `json:"operator_id,omitempty"` - External bool `json:"external,omitempty"` - OperatorTenantKey string `json:"operator_tenant_key,omitempty"` -} - -type ChatDisbandedEvent struct { - *model.BaseEventV2 - Event *ChatDisbandedEventData `json:"event"` -} - -type ChatUpdatedEventData struct { - ChatId string `json:"chat_id,omitempty"` - OperatorId *UserId `json:"operator_id,omitempty"` - External bool `json:"external,omitempty"` - OperatorTenantKey string `json:"operator_tenant_key,omitempty"` - AfterChange *ChatChange `json:"after_change,omitempty"` - BeforeChange *ChatChange `json:"before_change,omitempty"` - ModeratorList *ModeratorList `json:"moderator_list,omitempty"` -} - -type ChatUpdatedEvent struct { +type ChatMemberUserWithdrawnEvent struct { *model.BaseEventV2 - Event *ChatUpdatedEventData `json:"event"` + Event *ChatMemberUserWithdrawnEventData `json:"event"` } -type ChatMemberUserWithdrawnEventData struct { +type ChatMemberUserDeletedEventData struct { ChatId string `json:"chat_id,omitempty"` OperatorId *UserId `json:"operator_id,omitempty"` External bool `json:"external,omitempty"` @@ -803,19 +737,9 @@ type ChatMemberUserWithdrawnEventData struct { Users []*ChatMemberUser `json:"users,omitempty"` } -type ChatMemberUserWithdrawnEvent struct { - *model.BaseEventV2 - Event *ChatMemberUserWithdrawnEventData `json:"event"` -} - -type MessageReceiveEventData struct { - Sender *EventSender `json:"sender,omitempty"` - Message *EventMessage `json:"message,omitempty"` -} - -type MessageReceiveEvent struct { +type ChatMemberUserDeletedEvent struct { *model.BaseEventV2 - Event *MessageReceiveEventData `json:"event"` + Event *ChatMemberUserDeletedEventData `json:"event"` } type MessageAtMessageReadEventData struct { @@ -837,27 +761,3 @@ type MessageMessageReadEvent struct { *model.BaseEventV2 Event *MessageMessageReadEventData `json:"event"` } - -type MessageReactionCreatedEventData struct { - MessageId string `json:"message_id,omitempty"` - ReactionType *Emoji `json:"reaction_type,omitempty"` - OperatorId *UserId `json:"operator_id,omitempty"` - ActionTime string `json:"action_time,omitempty"` -} - -type MessageReactionCreatedEvent struct { - *model.BaseEventV2 - Event *MessageReactionCreatedEventData `json:"event"` -} - -type MessageReactionDeletedEventData struct { - MessageId string `json:"message_id,omitempty"` - ReactionType *Emoji `json:"reaction_type,omitempty"` - OperatorId *UserId `json:"operator_id,omitempty"` - ActionTime string `json:"action_time,omitempty"` -} - -type MessageReactionDeletedEvent struct { - *model.BaseEventV2 - Event *MessageReactionDeletedEventData `json:"event"` -} diff --git a/service/meeting_room/v1/api.go b/service/meeting_room/v1/api.go new file mode 100644 index 00000000..3a5ee4da --- /dev/null +++ b/service/meeting_room/v1/api.go @@ -0,0 +1,592 @@ +// Code generated by lark suite oapi sdk gen +package v1 + +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 + Buildings *BuildingService + Countrys *CountryService + Districts *DistrictService + Freebusys *FreebusyService + Instances *InstanceService + Rooms *RoomService + Summarys *SummaryService + MeetingRooms *MeetingRoomService +} + +func NewService(conf *config.Config) *Service { + s := &Service{ + conf: conf, + } + s.Buildings = newBuildingService(s) + s.Countrys = newCountryService(s) + s.Districts = newDistrictService(s) + s.Freebusys = newFreebusyService(s) + s.Instances = newInstanceService(s) + s.Rooms = newRoomService(s) + s.Summarys = newSummaryService(s) + s.MeetingRooms = newMeetingRoomService(s) + return s +} + +type BuildingService struct { + service *Service +} + +func newBuildingService(service *Service) *BuildingService { + return &BuildingService{ + service: service, + } +} + +type CountryService struct { + service *Service +} + +func newCountryService(service *Service) *CountryService { + return &CountryService{ + service: service, + } +} + +type DistrictService struct { + service *Service +} + +func newDistrictService(service *Service) *DistrictService { + return &DistrictService{ + service: service, + } +} + +type FreebusyService struct { + service *Service +} + +func newFreebusyService(service *Service) *FreebusyService { + return &FreebusyService{ + service: service, + } +} + +type InstanceService struct { + service *Service +} + +func newInstanceService(service *Service) *InstanceService { + return &InstanceService{ + service: service, + } +} + +type RoomService struct { + service *Service +} + +func newRoomService(service *Service) *RoomService { + return &RoomService{ + service: service, + } +} + +type SummaryService struct { + service *Service +} + +func newSummaryService(service *Service) *SummaryService { + return &SummaryService{ + service: service, + } +} + +type MeetingRoomService struct { + service *Service +} + +func newMeetingRoomService(service *Service) *MeetingRoomService { + return &MeetingRoomService{ + service: service, + } +} + +type BuildingBatchGetReqCall struct { + ctx *core.Context + buildings *BuildingService + queryParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *BuildingBatchGetReqCall) SetBuildingIds(buildingIds ...string) { + rc.queryParams["building_ids"] = buildingIds +} +func (rc *BuildingBatchGetReqCall) SetFields(fields string) { + rc.queryParams["fields"] = fields +} + +func (rc *BuildingBatchGetReqCall) Do() (*BuildingBatchGetResult, error) { + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &BuildingBatchGetResult{} + req := request.NewRequest("meeting_room/v1/building/batch_get", "GET", + []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.buildings.service.conf, req) + return result, err +} + +func (buildings *BuildingService) BatchGet(ctx *core.Context, optFns ...request.OptFn) *BuildingBatchGetReqCall { + return &BuildingBatchGetReqCall{ + ctx: ctx, + buildings: buildings, + queryParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type RoomBatchGetReqCall struct { + ctx *core.Context + rooms *RoomService + queryParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *RoomBatchGetReqCall) SetRoomIds(roomIds ...string) { + rc.queryParams["room_ids"] = roomIds +} +func (rc *RoomBatchGetReqCall) SetFields(fields string) { + rc.queryParams["fields"] = fields +} + +func (rc *RoomBatchGetReqCall) Do() (*RoomBatchGetResult, error) { + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &RoomBatchGetResult{} + req := request.NewRequest("meeting_room/v1/room/batch_get", "GET", + []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.rooms.service.conf, req) + return result, err +} + +func (rooms *RoomService) BatchGet(ctx *core.Context, optFns ...request.OptFn) *RoomBatchGetReqCall { + return &RoomBatchGetReqCall{ + ctx: ctx, + rooms: rooms, + queryParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type SummaryBatchGetReqCall struct { + ctx *core.Context + summarys *SummaryService + body *SummaryBatchGetReqBody + optFns []request.OptFn +} + +func (rc *SummaryBatchGetReqCall) Do() (*SummaryBatchGetResult, error) { + var result = &SummaryBatchGetResult{} + req := request.NewRequest("meeting_room/v1/summary/batch_get", "POST", + []request.AccessTokenType{request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) + err := api.Send(rc.ctx, rc.summarys.service.conf, req) + return result, err +} + +func (summarys *SummaryService) BatchGet(ctx *core.Context, body *SummaryBatchGetReqBody, optFns ...request.OptFn) *SummaryBatchGetReqCall { + return &SummaryBatchGetReqCall{ + ctx: ctx, + summarys: summarys, + body: body, + optFns: optFns, + } +} + +type FreebusyBatchGetReqCall struct { + ctx *core.Context + freebusys *FreebusyService + queryParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *FreebusyBatchGetReqCall) SetRoomIds(roomIds ...string) { + rc.queryParams["room_ids"] = roomIds +} +func (rc *FreebusyBatchGetReqCall) SetTimeMin(timeMin string) { + rc.queryParams["time_min"] = timeMin +} +func (rc *FreebusyBatchGetReqCall) SetTimeMax(timeMax string) { + rc.queryParams["time_max"] = timeMax +} + +func (rc *FreebusyBatchGetReqCall) Do() (*FreebusyBatchGetResult, error) { + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &FreebusyBatchGetResult{} + req := request.NewRequest("meeting_room/v1/freebusy/batch_get", "GET", + []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.freebusys.service.conf, req) + return result, err +} + +func (freebusys *FreebusyService) BatchGet(ctx *core.Context, optFns ...request.OptFn) *FreebusyBatchGetReqCall { + return &FreebusyBatchGetReqCall{ + ctx: ctx, + freebusys: freebusys, + queryParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type BuildingBatchGetIdReqCall struct { + ctx *core.Context + buildings *BuildingService + queryParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *BuildingBatchGetIdReqCall) SetCustomBuildingIds(customBuildingIds ...string) { + rc.queryParams["custom_building_ids"] = customBuildingIds +} + +func (rc *BuildingBatchGetIdReqCall) Do() (*BuildingBatchGetIdResult, error) { + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &BuildingBatchGetIdResult{} + req := request.NewRequest("meeting_room/v1/building/batch_get_id", "GET", + []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.buildings.service.conf, req) + return result, err +} + +func (buildings *BuildingService) BatchGetId(ctx *core.Context, optFns ...request.OptFn) *BuildingBatchGetIdReqCall { + return &BuildingBatchGetIdReqCall{ + ctx: ctx, + buildings: buildings, + queryParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type RoomBatchGetIdReqCall struct { + ctx *core.Context + rooms *RoomService + queryParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *RoomBatchGetIdReqCall) SetCustomRoomIds(customRoomIds ...string) { + rc.queryParams["custom_room_ids"] = customRoomIds +} + +func (rc *RoomBatchGetIdReqCall) Do() (*RoomBatchGetIdResult, error) { + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &RoomBatchGetIdResult{} + req := request.NewRequest("meeting_room/v1/room/batch_get_id", "GET", + []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.rooms.service.conf, req) + return result, err +} + +func (rooms *RoomService) BatchGetId(ctx *core.Context, optFns ...request.OptFn) *RoomBatchGetIdReqCall { + return &RoomBatchGetIdReqCall{ + ctx: ctx, + rooms: rooms, + queryParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type BuildingCreateReqCall struct { + ctx *core.Context + buildings *BuildingService + body *BuildingCreateReqBody + optFns []request.OptFn +} + +func (rc *BuildingCreateReqCall) Do() (*BuildingCreateResult, error) { + var result = &BuildingCreateResult{} + req := request.NewRequest("meeting_room/v1/building/create", "POST", + []request.AccessTokenType{request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) + err := api.Send(rc.ctx, rc.buildings.service.conf, req) + return result, err +} + +func (buildings *BuildingService) Create(ctx *core.Context, body *BuildingCreateReqBody, optFns ...request.OptFn) *BuildingCreateReqCall { + return &BuildingCreateReqCall{ + ctx: ctx, + buildings: buildings, + body: body, + optFns: optFns, + } +} + +type RoomCreateReqCall struct { + ctx *core.Context + rooms *RoomService + body *RoomCreateReqBody + optFns []request.OptFn +} + +func (rc *RoomCreateReqCall) Do() (*RoomCreateResult, error) { + var result = &RoomCreateResult{} + req := request.NewRequest("meeting_room/v1/room/create", "POST", + []request.AccessTokenType{request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) + err := api.Send(rc.ctx, rc.rooms.service.conf, req) + return result, err +} + +func (rooms *RoomService) Create(ctx *core.Context, body *RoomCreateReqBody, optFns ...request.OptFn) *RoomCreateReqCall { + return &RoomCreateReqCall{ + ctx: ctx, + rooms: rooms, + body: body, + optFns: optFns, + } +} + +type BuildingDeleteReqCall struct { + ctx *core.Context + buildings *BuildingService + optFns []request.OptFn +} + +func (rc *BuildingDeleteReqCall) Do() (*response.NoData, error) { + var result = &response.NoData{} + req := request.NewRequest("meeting_room/v1/building/delete", "POST", + []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.buildings.service.conf, req) + return result, err +} + +func (buildings *BuildingService) Delete(ctx *core.Context, optFns ...request.OptFn) *BuildingDeleteReqCall { + return &BuildingDeleteReqCall{ + ctx: ctx, + buildings: buildings, + optFns: optFns, + } +} + +type RoomDeleteReqCall struct { + ctx *core.Context + rooms *RoomService + optFns []request.OptFn +} + +func (rc *RoomDeleteReqCall) Do() (*response.NoData, error) { + var result = &response.NoData{} + req := request.NewRequest("meeting_room/v1/room/delete", "POST", + []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.rooms.service.conf, req) + return result, err +} + +func (rooms *RoomService) Delete(ctx *core.Context, optFns ...request.OptFn) *RoomDeleteReqCall { + return &RoomDeleteReqCall{ + ctx: ctx, + rooms: rooms, + optFns: optFns, + } +} + +type DistrictListReqCall struct { + ctx *core.Context + districts *DistrictService + queryParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *DistrictListReqCall) SetCountryId(countryId int) { + rc.queryParams["country_id"] = countryId +} + +func (rc *DistrictListReqCall) Do() (*DistrictListResult, error) { + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &DistrictListResult{} + req := request.NewRequest("meeting_room/v1/district/list", "GET", + []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.districts.service.conf, req) + return result, err +} + +func (districts *DistrictService) List(ctx *core.Context, optFns ...request.OptFn) *DistrictListReqCall { + return &DistrictListReqCall{ + ctx: ctx, + districts: districts, + queryParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type CountryListReqCall struct { + ctx *core.Context + countrys *CountryService + optFns []request.OptFn +} + +func (rc *CountryListReqCall) Do() (*CountryListResult, error) { + var result = &CountryListResult{} + req := request.NewRequest("meeting_room/v1/country/list", "GET", + []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.countrys.service.conf, req) + return result, err +} + +func (countrys *CountryService) List(ctx *core.Context, optFns ...request.OptFn) *CountryListReqCall { + return &CountryListReqCall{ + ctx: ctx, + countrys: countrys, + optFns: optFns, + } +} + +type BuildingListReqCall struct { + ctx *core.Context + buildings *BuildingService + queryParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *BuildingListReqCall) SetOrderBy(orderBy string) { + rc.queryParams["order_by"] = orderBy +} +func (rc *BuildingListReqCall) SetFields(fields string) { + rc.queryParams["fields"] = fields +} +func (rc *BuildingListReqCall) SetPageToken(pageToken string) { + rc.queryParams["page_token"] = pageToken +} +func (rc *BuildingListReqCall) SetPageSize(pageSize int) { + rc.queryParams["page_size"] = pageSize +} + +func (rc *BuildingListReqCall) Do() (*BuildingListResult, error) { + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &BuildingListResult{} + req := request.NewRequest("meeting_room/v1/building/list", "GET", + []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.buildings.service.conf, req) + return result, err +} + +func (buildings *BuildingService) List(ctx *core.Context, optFns ...request.OptFn) *BuildingListReqCall { + return &BuildingListReqCall{ + ctx: ctx, + buildings: buildings, + queryParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type RoomListReqCall struct { + ctx *core.Context + rooms *RoomService + queryParams map[string]interface{} + optFns []request.OptFn +} + +func (rc *RoomListReqCall) SetBuildingId(buildingId string) { + rc.queryParams["building_id"] = buildingId +} +func (rc *RoomListReqCall) SetOrderBy(orderBy string) { + rc.queryParams["order_by"] = orderBy +} +func (rc *RoomListReqCall) SetFields(fields string) { + rc.queryParams["fields"] = fields +} +func (rc *RoomListReqCall) SetPageToken(pageToken string) { + rc.queryParams["page_token"] = pageToken +} +func (rc *RoomListReqCall) SetPageSize(pageSize int) { + rc.queryParams["page_size"] = pageSize +} + +func (rc *RoomListReqCall) Do() (*RoomListResult, error) { + rc.optFns = append(rc.optFns, request.SetQueryParams(rc.queryParams)) + var result = &RoomListResult{} + req := request.NewRequest("meeting_room/v1/room/list", "GET", + []request.AccessTokenType{request.AccessTokenTypeTenant}, nil, result, rc.optFns...) + err := api.Send(rc.ctx, rc.rooms.service.conf, req) + return result, err +} + +func (rooms *RoomService) List(ctx *core.Context, optFns ...request.OptFn) *RoomListReqCall { + return &RoomListReqCall{ + ctx: ctx, + rooms: rooms, + queryParams: map[string]interface{}{}, + optFns: optFns, + } +} + +type InstanceReplyReqCall struct { + ctx *core.Context + instances *InstanceService + body *InstanceReplyReqBody + optFns []request.OptFn +} + +func (rc *InstanceReplyReqCall) Do() (*response.NoData, error) { + var result = &response.NoData{} + req := request.NewRequest("meeting_room/v1/instance/reply", "POST", + []request.AccessTokenType{request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) + err := api.Send(rc.ctx, rc.instances.service.conf, req) + return result, err +} + +func (instances *InstanceService) Reply(ctx *core.Context, body *InstanceReplyReqBody, optFns ...request.OptFn) *InstanceReplyReqCall { + return &InstanceReplyReqCall{ + ctx: ctx, + instances: instances, + body: body, + optFns: optFns, + } +} + +type BuildingUpdateReqCall struct { + ctx *core.Context + buildings *BuildingService + body *BuildingUpdateReqBody + optFns []request.OptFn +} + +func (rc *BuildingUpdateReqCall) Do() (*response.NoData, error) { + var result = &response.NoData{} + req := request.NewRequest("meeting_room/v1/building/update", "POST", + []request.AccessTokenType{request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) + err := api.Send(rc.ctx, rc.buildings.service.conf, req) + return result, err +} + +func (buildings *BuildingService) Update(ctx *core.Context, body *BuildingUpdateReqBody, optFns ...request.OptFn) *BuildingUpdateReqCall { + return &BuildingUpdateReqCall{ + ctx: ctx, + buildings: buildings, + body: body, + optFns: optFns, + } +} + +type RoomUpdateReqCall struct { + ctx *core.Context + rooms *RoomService + body *RoomUpdateReqBody + optFns []request.OptFn +} + +func (rc *RoomUpdateReqCall) Do() (*response.NoData, error) { + var result = &response.NoData{} + req := request.NewRequest("meeting_room/v1/room/update", "POST", + []request.AccessTokenType{request.AccessTokenTypeTenant}, rc.body, result, rc.optFns...) + err := api.Send(rc.ctx, rc.rooms.service.conf, req) + return result, err +} + +func (rooms *RoomService) Update(ctx *core.Context, body *RoomUpdateReqBody, optFns ...request.OptFn) *RoomUpdateReqCall { + return &RoomUpdateReqCall{ + ctx: ctx, + rooms: rooms, + body: body, + optFns: optFns, + } +} diff --git a/service/meeting_room/v1/event.go b/service/meeting_room/v1/event.go new file mode 100644 index 00000000..a7bbd6be --- /dev/null +++ b/service/meeting_room/v1/event.go @@ -0,0 +1,136 @@ +// Code generated by lark suite oapi sdk gen +package v1 + +import ( + "github.com/larksuite/oapi-sdk-go/core" + "github.com/larksuite/oapi-sdk-go/core/config" + "github.com/larksuite/oapi-sdk-go/event" +) + +type RoomCreatedEventHandler struct { + Fn func(*core.Context, *RoomCreatedEvent) error +} + +func (h *RoomCreatedEventHandler) GetEvent() interface{} { + return &RoomCreatedEvent{} +} + +func (h *RoomCreatedEventHandler) Handle(ctx *core.Context, event interface{}) error { + return h.Fn(ctx, event.(*RoomCreatedEvent)) +} + +func SetRoomCreatedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *RoomCreatedEvent) error) { + event.SetTypeHandler(conf, "meeting_room.room.created_v1", &RoomCreatedEventHandler{Fn: fn}) +} + +type RoomDeletedEventHandler struct { + Fn func(*core.Context, *RoomDeletedEvent) error +} + +func (h *RoomDeletedEventHandler) GetEvent() interface{} { + return &RoomDeletedEvent{} +} + +func (h *RoomDeletedEventHandler) Handle(ctx *core.Context, event interface{}) error { + return h.Fn(ctx, event.(*RoomDeletedEvent)) +} + +func SetRoomDeletedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *RoomDeletedEvent) error) { + event.SetTypeHandler(conf, "meeting_room.room.deleted_v1", &RoomDeletedEventHandler{Fn: fn}) +} + +type RoomStatusChangedEventHandler struct { + Fn func(*core.Context, *RoomStatusChangedEvent) error +} + +func (h *RoomStatusChangedEventHandler) GetEvent() interface{} { + return &RoomStatusChangedEvent{} +} + +func (h *RoomStatusChangedEventHandler) Handle(ctx *core.Context, event interface{}) error { + return h.Fn(ctx, event.(*RoomStatusChangedEvent)) +} + +func SetRoomStatusChangedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *RoomStatusChangedEvent) error) { + event.SetTypeHandler(conf, "meeting_room.room.status_changed_v1", &RoomStatusChangedEventHandler{Fn: fn}) +} + +type RoomUpdatedEventHandler struct { + Fn func(*core.Context, *RoomUpdatedEvent) error +} + +func (h *RoomUpdatedEventHandler) GetEvent() interface{} { + return &RoomUpdatedEvent{} +} + +func (h *RoomUpdatedEventHandler) Handle(ctx *core.Context, event interface{}) error { + return h.Fn(ctx, event.(*RoomUpdatedEvent)) +} + +func SetRoomUpdatedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *RoomUpdatedEvent) error) { + event.SetTypeHandler(conf, "meeting_room.room.updated_v1", &RoomUpdatedEventHandler{Fn: fn}) +} + +type MeetingRoomStatusChangedEventHandler struct { + Fn func(*core.Context, *MeetingRoomStatusChangedEvent) error +} + +func (h *MeetingRoomStatusChangedEventHandler) GetEvent() interface{} { + return &MeetingRoomStatusChangedEvent{} +} + +func (h *MeetingRoomStatusChangedEventHandler) Handle(ctx *core.Context, event interface{}) error { + return h.Fn(ctx, event.(*MeetingRoomStatusChangedEvent)) +} + +func SetMeetingRoomStatusChangedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *MeetingRoomStatusChangedEvent) error) { + event.SetTypeHandler(conf, "meeting_room.meeting_room.status_changed_v1", &MeetingRoomStatusChangedEventHandler{Fn: fn}) +} + +type MeetingRoomCreatedEventHandler struct { + Fn func(*core.Context, *MeetingRoomCreatedEvent) error +} + +func (h *MeetingRoomCreatedEventHandler) GetEvent() interface{} { + return &MeetingRoomCreatedEvent{} +} + +func (h *MeetingRoomCreatedEventHandler) Handle(ctx *core.Context, event interface{}) error { + return h.Fn(ctx, event.(*MeetingRoomCreatedEvent)) +} + +func SetMeetingRoomCreatedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *MeetingRoomCreatedEvent) error) { + event.SetTypeHandler(conf, "meeting_room.meeting_room.created_v1", &MeetingRoomCreatedEventHandler{Fn: fn}) +} + +type MeetingRoomDeletedEventHandler struct { + Fn func(*core.Context, *MeetingRoomDeletedEvent) error +} + +func (h *MeetingRoomDeletedEventHandler) GetEvent() interface{} { + return &MeetingRoomDeletedEvent{} +} + +func (h *MeetingRoomDeletedEventHandler) Handle(ctx *core.Context, event interface{}) error { + return h.Fn(ctx, event.(*MeetingRoomDeletedEvent)) +} + +func SetMeetingRoomDeletedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *MeetingRoomDeletedEvent) error) { + event.SetTypeHandler(conf, "meeting_room.meeting_room.deleted_v1", &MeetingRoomDeletedEventHandler{Fn: fn}) +} + +type MeetingRoomUpdatedEventHandler struct { + Fn func(*core.Context, *MeetingRoomUpdatedEvent) error +} + +func (h *MeetingRoomUpdatedEventHandler) GetEvent() interface{} { + return &MeetingRoomUpdatedEvent{} +} + +func (h *MeetingRoomUpdatedEventHandler) Handle(ctx *core.Context, event interface{}) error { + return h.Fn(ctx, event.(*MeetingRoomUpdatedEvent)) +} + +func SetMeetingRoomUpdatedEventHandler(conf *config.Config, fn func(ctx *core.Context, event *MeetingRoomUpdatedEvent) error) { + event.SetTypeHandler(conf, "meeting_room.meeting_room.updated_v1", &MeetingRoomUpdatedEventHandler{Fn: fn}) +} diff --git a/service/meeting_room/v1/model.go b/service/meeting_room/v1/model.go new file mode 100644 index 00000000..a70288c8 --- /dev/null +++ b/service/meeting_room/v1/model.go @@ -0,0 +1,389 @@ +// Code generated by lark suite oapi sdk gen +package v1 + +import ( + "github.com/larksuite/oapi-sdk-go/api/core/tools" + "github.com/larksuite/oapi-sdk-go/event/core/model" +) + +type Building struct { + BuildingId string `json:"building_id,omitempty"` + Description string `json:"description,omitempty"` + Floors []string `json:"floors,omitempty"` + Name string `json:"name,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *Building) MarshalJSON() ([]byte, error) { + type cp Building + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type BuildingId struct { + BuildingId string `json:"building_id,omitempty"` + CustomBuildingId string `json:"custom_building_id,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *BuildingId) MarshalJSON() ([]byte, error) { + type cp BuildingId + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type Country struct { + CountryId string `json:"country_id,omitempty"` + Name string `json:"name,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *Country) MarshalJSON() ([]byte, error) { + type cp Country + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type District struct { + DistrictId string `json:"district_id,omitempty"` + Name string `json:"name,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *District) MarshalJSON() ([]byte, error) { + type cp District + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type ErrorEventUid struct { + Uid string `json:"uid,omitempty"` + OriginalTime string `json:"original_time,omitempty"` + ErrorMsg string `json:"error_msg,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *ErrorEventUid) MarshalJSON() ([]byte, error) { + type cp ErrorEventUid + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type EventInfo struct { + Uid string `json:"uid,omitempty"` + OriginalTime string `json:"original_time,omitempty"` + Summary string `json:"summary,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *EventInfo) MarshalJSON() ([]byte, error) { + type cp EventInfo + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type EventUid struct { + Uid string `json:"uid,omitempty"` + OriginalTime int `json:"original_time,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *EventUid) MarshalJSON() ([]byte, error) { + type cp EventUid + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type Freebusy struct { +} + +type Instance struct { +} + +type OrganizerInfo struct { + Name string `json:"name,omitempty"` + OpenId string `json:"open_id,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *OrganizerInfo) MarshalJSON() ([]byte, error) { + type cp OrganizerInfo + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type Room struct { + RoomId string `json:"room_id,omitempty"` + BuildingId string `json:"building_id,omitempty"` + BuildingName string `json:"building_name,omitempty"` + Capacity int `json:"capacity,omitempty"` + Description string `json:"description,omitempty"` + DisplayId string `json:"display_id,omitempty"` + FloorName string `json:"floor_name,omitempty"` + IsDisabled bool `json:"is_disabled,omitempty"` + Name string `json:"name,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *Room) MarshalJSON() ([]byte, error) { + type cp Room + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type RoomFreeBusy struct { + StartTime string `json:"start_time,omitempty"` + EndTime string `json:"end_time,omitempty"` + Uid string `json:"uid,omitempty"` + OriginalTime int `json:"original_time,omitempty"` + OrganizerInfo *OrganizerInfo `json:"organizer_info,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *RoomFreeBusy) MarshalJSON() ([]byte, error) { + type cp RoomFreeBusy + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type RoomId struct { + RoomId string `json:"room_id,omitempty"` + CustomRoomId string `json:"custom_room_id,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *RoomId) MarshalJSON() ([]byte, error) { + type cp RoomId + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type Summary struct { +} + +type MeetingRoom struct { + RoomId int `json:"room_id,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *MeetingRoom) MarshalJSON() ([]byte, error) { + type cp MeetingRoom + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type BuildingBatchGetResult struct { + Buildings []*Building `json:"buildings,omitempty"` +} + +type RoomBatchGetResult struct { + Rooms []*Room `json:"rooms,omitempty"` +} + +type SummaryBatchGetReqBody struct { + EventUids []*EventUid `json:"EventUids,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *SummaryBatchGetReqBody) MarshalJSON() ([]byte, error) { + type cp SummaryBatchGetReqBody + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type SummaryBatchGetResult struct { + EventInfos []*EventInfo `json:"EventInfos,omitempty"` + ErrorEventUids []*ErrorEventUid `json:"ErrorEventUids,omitempty"` +} + +type FreebusyBatchGetResult struct { + TimeMin string `json:"time_min,omitempty"` + TimeMax string `json:"time_max,omitempty"` + FreeBusy map[string]*RoomFreeBusy `json:"free_busy,omitempty"` +} + +type BuildingBatchGetIdResult struct { + Buildings []*BuildingId `json:"buildings,omitempty"` +} + +type RoomBatchGetIdResult struct { + Rooms []*RoomId `json:"rooms,omitempty"` +} + +type BuildingCreateReqBody struct { + Name string `json:"name,omitempty"` + Floors []string `json:"floors,omitempty"` + CountryId string `json:"country_id,omitempty"` + DistrictId string `json:"district_id,omitempty"` + CustomBuildingId string `json:"custom_building_id,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *BuildingCreateReqBody) MarshalJSON() ([]byte, error) { + type cp BuildingCreateReqBody + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type BuildingCreateResult struct { + BuildingId string `json:"building_id,omitempty"` +} + +type RoomCreateReqBody struct { + BuildingId string `json:"building_id,omitempty"` + Floor string `json:"floor,omitempty"` + Name string `json:"name,omitempty"` + Capacity int `json:"capacity,omitempty"` + IsDisabled bool `json:"is_disabled,omitempty"` + CustomRoomId string `json:"custom_room_id,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *RoomCreateReqBody) MarshalJSON() ([]byte, error) { + type cp RoomCreateReqBody + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type RoomCreateResult struct { + RoomId string `json:"room_id,omitempty"` +} + +type DistrictListResult struct { + Districts []*District `json:"districts,omitempty"` +} + +type CountryListResult struct { + Countries []*Country `json:"countries,omitempty"` +} + +type BuildingListResult struct { + Buildings []*Building `json:"buildings,omitempty"` +} + +type RoomListResult struct { + Rooms []*Room `json:"rooms,omitempty"` +} + +type InstanceReplyReqBody struct { + RoomId string `json:"room_id,omitempty"` + Uid string `json:"uid,omitempty"` + OriginalTime int `json:"original_time,omitempty"` + Status string `json:"status,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *InstanceReplyReqBody) MarshalJSON() ([]byte, error) { + type cp InstanceReplyReqBody + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type BuildingUpdateReqBody struct { + Name string `json:"name,omitempty"` + Floors []string `json:"floors,omitempty"` + CountryId string `json:"country_id,omitempty"` + DistrictId string `json:"district_id,omitempty"` + CustomBuildingId string `json:"custom_building_id,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *BuildingUpdateReqBody) MarshalJSON() ([]byte, error) { + type cp BuildingUpdateReqBody + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type RoomUpdateReqBody struct { + Name string `json:"name,omitempty"` + Capacity int `json:"capacity,omitempty"` + IsDisabled bool `json:"is_disabled,omitempty"` + CustomRoomId string `json:"custom_room_id,omitempty"` + ForceSendFields []string `json:"-"` +} + +func (s *RoomUpdateReqBody) MarshalJSON() ([]byte, error) { + type cp RoomUpdateReqBody + raw := cp(*s) + return tools.MarshalJSON(raw, s.ForceSendFields) +} + +type RoomCreatedEventData struct { + RoomId string `json:"room_id,omitempty"` + RoomName string `json:"room_name,omitempty"` +} + +type RoomCreatedEvent struct { + *model.BaseEventV2 + Event *RoomCreatedEventData `json:"event"` +} + +type RoomDeletedEventData struct { + RoomId string `json:"room_id,omitempty"` + RoomName string `json:"room_name,omitempty"` +} + +type RoomDeletedEvent struct { + *model.BaseEventV2 + Event *RoomDeletedEventData `json:"event"` +} + +type RoomStatusChangedEventData struct { + RoomId string `json:"room_id,omitempty"` + RoomName string `json:"room_name,omitempty"` +} + +type RoomStatusChangedEvent struct { + *model.BaseEventV2 + Event *RoomStatusChangedEventData `json:"event"` +} + +type RoomUpdatedEventData struct { + RoomId string `json:"room_id,omitempty"` + RoomName string `json:"room_name,omitempty"` +} + +type RoomUpdatedEvent struct { + *model.BaseEventV2 + Event *RoomUpdatedEventData `json:"event"` +} + +type MeetingRoomStatusChangedEventData struct { + RoomName string `json:"room_name,omitempty"` + RoomId string `json:"room_id,omitempty"` +} + +type MeetingRoomStatusChangedEvent struct { + *model.BaseEventV2 + Event *MeetingRoomStatusChangedEventData `json:"event"` +} + +type MeetingRoomCreatedEventData struct { + RoomName string `json:"room_name,omitempty"` + RoomId string `json:"room_id,omitempty"` +} + +type MeetingRoomCreatedEvent struct { + *model.BaseEventV2 + Event *MeetingRoomCreatedEventData `json:"event"` +} + +type MeetingRoomDeletedEventData struct { + RoomName string `json:"room_name,omitempty"` + RoomId string `json:"room_id,omitempty"` +} + +type MeetingRoomDeletedEvent struct { + *model.BaseEventV2 + Event *MeetingRoomDeletedEventData `json:"event"` +} + +type MeetingRoomUpdatedEventData struct { + RoomName string `json:"room_name,omitempty"` + RoomId string `json:"room_id,omitempty"` +} + +type MeetingRoomUpdatedEvent struct { + *model.BaseEventV2 + Event *MeetingRoomUpdatedEventData `json:"event"` +}