gitee.com/larksuite/oapi-sdk-go/v3@v3.0.3/service/block/v2/model.go (about)

     1  // Package block code generated by oapi sdk gen
     2  /*
     3   * MIT License
     4   *
     5   * Copyright (c) 2022 Lark Technologies Pte. Ltd.
     6   *
     7   * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
     8   *
     9   * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software.
    10   *
    11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    12   */
    13  
    14  package larkblock
    15  
    16  import (
    17  	"fmt"
    18  
    19  	"gitee.com/larksuite/oapi-sdk-go/v3/core"
    20  )
    21  
    22  type Entity struct {
    23  	BlockId     *string `json:"block_id,omitempty"`      // block 唯一标识
    24  	Title       *string `json:"title,omitempty"`         // 标题
    25  	BlockTypeId *string `json:"block_type_id,omitempty"` // block 类型ID
    26  	SourceData  *string `json:"source_data,omitempty"`   // 业务数据 json
    27  	SourceMeta  *string `json:"source_meta,omitempty"`   // 元数据 json
    28  	Version     *string `json:"version,omitempty"`       // 版本号(自增)
    29  	SourceLink  *string `json:"source_link,omitempty"`   // 链接
    30  	Summary     *string `json:"summary,omitempty"`       // 总括
    31  	Preview     *string `json:"preview,omitempty"`       // 预览
    32  	I18nSummay  *string `json:"i18n_summay,omitempty"`   // 综述 json
    33  	I18nPreview *string `json:"i18n_preview,omitempty"`  // 预览 json
    34  	Owner       *string `json:"owner,omitempty"`         // 所有者
    35  	Extra       *string `json:"extra,omitempty"`         // 扩展字段 json
    36  }
    37  
    38  type EntityBuilder struct {
    39  	blockId         string // block 唯一标识
    40  	blockIdFlag     bool
    41  	title           string // 标题
    42  	titleFlag       bool
    43  	blockTypeId     string // block 类型ID
    44  	blockTypeIdFlag bool
    45  	sourceData      string // 业务数据 json
    46  	sourceDataFlag  bool
    47  	sourceMeta      string // 元数据 json
    48  	sourceMetaFlag  bool
    49  	version         string // 版本号(自增)
    50  	versionFlag     bool
    51  	sourceLink      string // 链接
    52  	sourceLinkFlag  bool
    53  	summary         string // 总括
    54  	summaryFlag     bool
    55  	preview         string // 预览
    56  	previewFlag     bool
    57  	i18nSummay      string // 综述 json
    58  	i18nSummayFlag  bool
    59  	i18nPreview     string // 预览 json
    60  	i18nPreviewFlag bool
    61  	owner           string // 所有者
    62  	ownerFlag       bool
    63  	extra           string // 扩展字段 json
    64  	extraFlag       bool
    65  }
    66  
    67  func NewEntityBuilder() *EntityBuilder {
    68  	builder := &EntityBuilder{}
    69  	return builder
    70  }
    71  
    72  // block 唯一标识
    73  //
    74  // 示例值:7794641623571830467
    75  func (builder *EntityBuilder) BlockId(blockId string) *EntityBuilder {
    76  	builder.blockId = blockId
    77  	builder.blockIdFlag = true
    78  	return builder
    79  }
    80  
    81  // 标题
    82  //
    83  // 示例值:已阅 block
    84  func (builder *EntityBuilder) Title(title string) *EntityBuilder {
    85  	builder.title = title
    86  	builder.titleFlag = true
    87  	return builder
    88  }
    89  
    90  // block 类型ID
    91  //
    92  // 示例值:blk_6204893fee000013739f5359
    93  func (builder *EntityBuilder) BlockTypeId(blockTypeId string) *EntityBuilder {
    94  	builder.blockTypeId = blockTypeId
    95  	builder.blockTypeIdFlag = true
    96  	return builder
    97  }
    98  
    99  // 业务数据 json
   100  //
   101  // 示例值:{"data":"业务数据"}
   102  func (builder *EntityBuilder) SourceData(sourceData string) *EntityBuilder {
   103  	builder.sourceData = sourceData
   104  	builder.sourceDataFlag = true
   105  	return builder
   106  }
   107  
   108  // 元数据 json
   109  //
   110  // 示例值:{"bizId":"7094067849152430100"}
   111  func (builder *EntityBuilder) SourceMeta(sourceMeta string) *EntityBuilder {
   112  	builder.sourceMeta = sourceMeta
   113  	builder.sourceMetaFlag = true
   114  	return builder
   115  }
   116  
   117  // 版本号(自增)
   118  //
   119  // 示例值:1651716489253602
   120  func (builder *EntityBuilder) Version(version string) *EntityBuilder {
   121  	builder.version = version
   122  	builder.versionFlag = true
   123  	return builder
   124  }
   125  
   126  // 链接
   127  //
   128  // 示例值:{}
   129  func (builder *EntityBuilder) SourceLink(sourceLink string) *EntityBuilder {
   130  	builder.sourceLink = sourceLink
   131  	builder.sourceLinkFlag = true
   132  	return builder
   133  }
   134  
   135  // 总括
   136  //
   137  // 示例值:{"cn":"这是一个block"}
   138  func (builder *EntityBuilder) Summary(summary string) *EntityBuilder {
   139  	builder.summary = summary
   140  	builder.summaryFlag = true
   141  	return builder
   142  }
   143  
   144  // 预览
   145  //
   146  // 示例值:{"cn":"这是一个block"}
   147  func (builder *EntityBuilder) Preview(preview string) *EntityBuilder {
   148  	builder.preview = preview
   149  	builder.previewFlag = true
   150  	return builder
   151  }
   152  
   153  // 综述 json
   154  //
   155  // 示例值:{"cn":"这是一个block","va": "this is a block"}
   156  func (builder *EntityBuilder) I18nSummay(i18nSummay string) *EntityBuilder {
   157  	builder.i18nSummay = i18nSummay
   158  	builder.i18nSummayFlag = true
   159  	return builder
   160  }
   161  
   162  // 预览 json
   163  //
   164  // 示例值:{"cn":"这是一个block","va": "this is a block"}
   165  func (builder *EntityBuilder) I18nPreview(i18nPreview string) *EntityBuilder {
   166  	builder.i18nPreview = i18nPreview
   167  	builder.i18nPreviewFlag = true
   168  	return builder
   169  }
   170  
   171  // 所有者
   172  //
   173  // 示例值:ou_fa7aa170f92d1615de63371ac425a767
   174  func (builder *EntityBuilder) Owner(owner string) *EntityBuilder {
   175  	builder.owner = owner
   176  	builder.ownerFlag = true
   177  	return builder
   178  }
   179  
   180  // 扩展字段 json
   181  //
   182  // 示例值:{}
   183  func (builder *EntityBuilder) Extra(extra string) *EntityBuilder {
   184  	builder.extra = extra
   185  	builder.extraFlag = true
   186  	return builder
   187  }
   188  
   189  func (builder *EntityBuilder) Build() *Entity {
   190  	req := &Entity{}
   191  	if builder.blockIdFlag {
   192  		req.BlockId = &builder.blockId
   193  
   194  	}
   195  	if builder.titleFlag {
   196  		req.Title = &builder.title
   197  
   198  	}
   199  	if builder.blockTypeIdFlag {
   200  		req.BlockTypeId = &builder.blockTypeId
   201  
   202  	}
   203  	if builder.sourceDataFlag {
   204  		req.SourceData = &builder.sourceData
   205  
   206  	}
   207  	if builder.sourceMetaFlag {
   208  		req.SourceMeta = &builder.sourceMeta
   209  
   210  	}
   211  	if builder.versionFlag {
   212  		req.Version = &builder.version
   213  
   214  	}
   215  	if builder.sourceLinkFlag {
   216  		req.SourceLink = &builder.sourceLink
   217  
   218  	}
   219  	if builder.summaryFlag {
   220  		req.Summary = &builder.summary
   221  
   222  	}
   223  	if builder.previewFlag {
   224  		req.Preview = &builder.preview
   225  
   226  	}
   227  	if builder.i18nSummayFlag {
   228  		req.I18nSummay = &builder.i18nSummay
   229  
   230  	}
   231  	if builder.i18nPreviewFlag {
   232  		req.I18nPreview = &builder.i18nPreview
   233  
   234  	}
   235  	if builder.ownerFlag {
   236  		req.Owner = &builder.owner
   237  
   238  	}
   239  	if builder.extraFlag {
   240  		req.Extra = &builder.extra
   241  
   242  	}
   243  	return req
   244  }
   245  
   246  type Message struct {
   247  	Body     *string  `json:"body,omitempty"`     // 协同数据内容
   248  	Version  *string  `json:"version,omitempty"`  // 版本号(自增)
   249  	BlockId  *string  `json:"block_id,omitempty"` // entity实体ID
   250  	Resource *string  `json:"resource,omitempty"` // 业务来源
   251  	OpenIds  []string `json:"open_ids,omitempty"` // 推送用户列表
   252  }
   253  
   254  type MessageBuilder struct {
   255  	body         string // 协同数据内容
   256  	bodyFlag     bool
   257  	version      string // 版本号(自增)
   258  	versionFlag  bool
   259  	blockId      string // entity实体ID
   260  	blockIdFlag  bool
   261  	resource     string // 业务来源
   262  	resourceFlag bool
   263  	openIds      []string // 推送用户列表
   264  	openIdsFlag  bool
   265  }
   266  
   267  func NewMessageBuilder() *MessageBuilder {
   268  	builder := &MessageBuilder{}
   269  	return builder
   270  }
   271  
   272  // 协同数据内容
   273  //
   274  // 示例值:{"id":"7094066727704592403","token":"test_123456789"}
   275  func (builder *MessageBuilder) Body(body string) *MessageBuilder {
   276  	builder.body = body
   277  	builder.bodyFlag = true
   278  	return builder
   279  }
   280  
   281  // 版本号(自增)
   282  //
   283  // 示例值:1637565292196
   284  func (builder *MessageBuilder) Version(version string) *MessageBuilder {
   285  	builder.version = version
   286  	builder.versionFlag = true
   287  	return builder
   288  }
   289  
   290  // entity实体ID
   291  //
   292  // 示例值:8116040162664047375
   293  func (builder *MessageBuilder) BlockId(blockId string) *MessageBuilder {
   294  	builder.blockId = blockId
   295  	builder.blockIdFlag = true
   296  	return builder
   297  }
   298  
   299  // 业务来源
   300  //
   301  // 示例值:read_block
   302  func (builder *MessageBuilder) Resource(resource string) *MessageBuilder {
   303  	builder.resource = resource
   304  	builder.resourceFlag = true
   305  	return builder
   306  }
   307  
   308  // 推送用户列表
   309  //
   310  // 示例值:["ou_fa7aa170f92d1615de63371ac425a767"]
   311  func (builder *MessageBuilder) OpenIds(openIds []string) *MessageBuilder {
   312  	builder.openIds = openIds
   313  	builder.openIdsFlag = true
   314  	return builder
   315  }
   316  
   317  func (builder *MessageBuilder) Build() *Message {
   318  	req := &Message{}
   319  	if builder.bodyFlag {
   320  		req.Body = &builder.body
   321  
   322  	}
   323  	if builder.versionFlag {
   324  		req.Version = &builder.version
   325  
   326  	}
   327  	if builder.blockIdFlag {
   328  		req.BlockId = &builder.blockId
   329  
   330  	}
   331  	if builder.resourceFlag {
   332  		req.Resource = &builder.resource
   333  
   334  	}
   335  	if builder.openIdsFlag {
   336  		req.OpenIds = builder.openIds
   337  	}
   338  	return req
   339  }
   340  
   341  type CreateEntityReqBodyBuilder struct {
   342  	title           string // 标题
   343  	titleFlag       bool
   344  	blockTypeId     string // block 类型ID
   345  	blockTypeIdFlag bool
   346  	sourceData      string // 内容
   347  	sourceDataFlag  bool
   348  	sourceMeta      string // 元数据
   349  	sourceMetaFlag  bool
   350  	version         string // 版本号(自增值)
   351  	versionFlag     bool
   352  	sourceLink      string // block原链接
   353  	sourceLinkFlag  bool
   354  	owner           string // 所有者
   355  	ownerFlag       bool
   356  	extra           string // 扩展字段
   357  	extraFlag       bool
   358  	i18nSummary     string // 国际化概括
   359  	i18nSummaryFlag bool
   360  	i18nPreview     string // 国际化预览
   361  	i18nPreviewFlag bool
   362  	summary         string // 概括
   363  	summaryFlag     bool
   364  	preview         string // 预览
   365  	previewFlag     bool
   366  }
   367  
   368  func NewCreateEntityReqBodyBuilder() *CreateEntityReqBodyBuilder {
   369  	builder := &CreateEntityReqBodyBuilder{}
   370  	return builder
   371  }
   372  
   373  // 标题
   374  //
   375  //示例值:已阅block
   376  func (builder *CreateEntityReqBodyBuilder) Title(title string) *CreateEntityReqBodyBuilder {
   377  	builder.title = title
   378  	builder.titleFlag = true
   379  	return builder
   380  }
   381  
   382  // block 类型ID
   383  //
   384  //示例值:blk_614c1c952f800014b27f87d6
   385  func (builder *CreateEntityReqBodyBuilder) BlockTypeId(blockTypeId string) *CreateEntityReqBodyBuilder {
   386  	builder.blockTypeId = blockTypeId
   387  	builder.blockTypeIdFlag = true
   388  	return builder
   389  }
   390  
   391  // 内容
   392  //
   393  //示例值:{"data":"业务数据"}
   394  func (builder *CreateEntityReqBodyBuilder) SourceData(sourceData string) *CreateEntityReqBodyBuilder {
   395  	builder.sourceData = sourceData
   396  	builder.sourceDataFlag = true
   397  	return builder
   398  }
   399  
   400  // 元数据
   401  //
   402  //示例值:{"id":7090084015725608979}
   403  func (builder *CreateEntityReqBodyBuilder) SourceMeta(sourceMeta string) *CreateEntityReqBodyBuilder {
   404  	builder.sourceMeta = sourceMeta
   405  	builder.sourceMetaFlag = true
   406  	return builder
   407  }
   408  
   409  // 版本号(自增值)
   410  //
   411  //示例值:1
   412  func (builder *CreateEntityReqBodyBuilder) Version(version string) *CreateEntityReqBodyBuilder {
   413  	builder.version = version
   414  	builder.versionFlag = true
   415  	return builder
   416  }
   417  
   418  // block原链接
   419  //
   420  //示例值:{"_data":"https://docs.feishu.cn/block/78","_version":1}
   421  func (builder *CreateEntityReqBodyBuilder) SourceLink(sourceLink string) *CreateEntityReqBodyBuilder {
   422  	builder.sourceLink = sourceLink
   423  	builder.sourceLinkFlag = true
   424  	return builder
   425  }
   426  
   427  // 所有者
   428  //
   429  //示例值:ou_fa7aa170f92d1615de63371ac425a767
   430  func (builder *CreateEntityReqBodyBuilder) Owner(owner string) *CreateEntityReqBodyBuilder {
   431  	builder.owner = owner
   432  	builder.ownerFlag = true
   433  	return builder
   434  }
   435  
   436  // 扩展字段
   437  //
   438  //示例值:{}
   439  func (builder *CreateEntityReqBodyBuilder) Extra(extra string) *CreateEntityReqBodyBuilder {
   440  	builder.extra = extra
   441  	builder.extraFlag = true
   442  	return builder
   443  }
   444  
   445  // 国际化概括
   446  //
   447  //示例值:{"cn":"这是一个block","va": "this is a block"}
   448  func (builder *CreateEntityReqBodyBuilder) I18nSummary(i18nSummary string) *CreateEntityReqBodyBuilder {
   449  	builder.i18nSummary = i18nSummary
   450  	builder.i18nSummaryFlag = true
   451  	return builder
   452  }
   453  
   454  // 国际化预览
   455  //
   456  //示例值:{"cn":"这是一个block","va": "this is a block"}
   457  func (builder *CreateEntityReqBodyBuilder) I18nPreview(i18nPreview string) *CreateEntityReqBodyBuilder {
   458  	builder.i18nPreview = i18nPreview
   459  	builder.i18nPreviewFlag = true
   460  	return builder
   461  }
   462  
   463  // 概括
   464  //
   465  //示例值:{"cn":"这是一个block"}
   466  func (builder *CreateEntityReqBodyBuilder) Summary(summary string) *CreateEntityReqBodyBuilder {
   467  	builder.summary = summary
   468  	builder.summaryFlag = true
   469  	return builder
   470  }
   471  
   472  // 预览
   473  //
   474  //示例值:{"cn":"这是一个block"}
   475  func (builder *CreateEntityReqBodyBuilder) Preview(preview string) *CreateEntityReqBodyBuilder {
   476  	builder.preview = preview
   477  	builder.previewFlag = true
   478  	return builder
   479  }
   480  
   481  func (builder *CreateEntityReqBodyBuilder) Build() *CreateEntityReqBody {
   482  	req := &CreateEntityReqBody{}
   483  	if builder.titleFlag {
   484  		req.Title = &builder.title
   485  	}
   486  	if builder.blockTypeIdFlag {
   487  		req.BlockTypeId = &builder.blockTypeId
   488  	}
   489  	if builder.sourceDataFlag {
   490  		req.SourceData = &builder.sourceData
   491  	}
   492  	if builder.sourceMetaFlag {
   493  		req.SourceMeta = &builder.sourceMeta
   494  	}
   495  	if builder.versionFlag {
   496  		req.Version = &builder.version
   497  	}
   498  	if builder.sourceLinkFlag {
   499  		req.SourceLink = &builder.sourceLink
   500  	}
   501  	if builder.ownerFlag {
   502  		req.Owner = &builder.owner
   503  	}
   504  	if builder.extraFlag {
   505  		req.Extra = &builder.extra
   506  	}
   507  	if builder.i18nSummaryFlag {
   508  		req.I18nSummary = &builder.i18nSummary
   509  	}
   510  	if builder.i18nPreviewFlag {
   511  		req.I18nPreview = &builder.i18nPreview
   512  	}
   513  	if builder.summaryFlag {
   514  		req.Summary = &builder.summary
   515  	}
   516  	if builder.previewFlag {
   517  		req.Preview = &builder.preview
   518  	}
   519  	return req
   520  }
   521  
   522  type CreateEntityPathReqBodyBuilder struct {
   523  	title           string // 标题
   524  	titleFlag       bool
   525  	blockTypeId     string // block 类型ID
   526  	blockTypeIdFlag bool
   527  	sourceData      string // 内容
   528  	sourceDataFlag  bool
   529  	sourceMeta      string // 元数据
   530  	sourceMetaFlag  bool
   531  	version         string // 版本号(自增值)
   532  	versionFlag     bool
   533  	sourceLink      string // block原链接
   534  	sourceLinkFlag  bool
   535  	owner           string // 所有者
   536  	ownerFlag       bool
   537  	extra           string // 扩展字段
   538  	extraFlag       bool
   539  	i18nSummary     string // 国际化概括
   540  	i18nSummaryFlag bool
   541  	i18nPreview     string // 国际化预览
   542  	i18nPreviewFlag bool
   543  	summary         string // 概括
   544  	summaryFlag     bool
   545  	preview         string // 预览
   546  	previewFlag     bool
   547  }
   548  
   549  func NewCreateEntityPathReqBodyBuilder() *CreateEntityPathReqBodyBuilder {
   550  	builder := &CreateEntityPathReqBodyBuilder{}
   551  	return builder
   552  }
   553  
   554  // 标题
   555  //
   556  // 示例值:已阅block
   557  func (builder *CreateEntityPathReqBodyBuilder) Title(title string) *CreateEntityPathReqBodyBuilder {
   558  	builder.title = title
   559  	builder.titleFlag = true
   560  	return builder
   561  }
   562  
   563  // block 类型ID
   564  //
   565  // 示例值:blk_614c1c952f800014b27f87d6
   566  func (builder *CreateEntityPathReqBodyBuilder) BlockTypeId(blockTypeId string) *CreateEntityPathReqBodyBuilder {
   567  	builder.blockTypeId = blockTypeId
   568  	builder.blockTypeIdFlag = true
   569  	return builder
   570  }
   571  
   572  // 内容
   573  //
   574  // 示例值:{"data":"业务数据"}
   575  func (builder *CreateEntityPathReqBodyBuilder) SourceData(sourceData string) *CreateEntityPathReqBodyBuilder {
   576  	builder.sourceData = sourceData
   577  	builder.sourceDataFlag = true
   578  	return builder
   579  }
   580  
   581  // 元数据
   582  //
   583  // 示例值:{"id":7090084015725608979}
   584  func (builder *CreateEntityPathReqBodyBuilder) SourceMeta(sourceMeta string) *CreateEntityPathReqBodyBuilder {
   585  	builder.sourceMeta = sourceMeta
   586  	builder.sourceMetaFlag = true
   587  	return builder
   588  }
   589  
   590  // 版本号(自增值)
   591  //
   592  // 示例值:1
   593  func (builder *CreateEntityPathReqBodyBuilder) Version(version string) *CreateEntityPathReqBodyBuilder {
   594  	builder.version = version
   595  	builder.versionFlag = true
   596  	return builder
   597  }
   598  
   599  // block原链接
   600  //
   601  // 示例值:{"_data":"https://docs.feishu.cn/block/78","_version":1}
   602  func (builder *CreateEntityPathReqBodyBuilder) SourceLink(sourceLink string) *CreateEntityPathReqBodyBuilder {
   603  	builder.sourceLink = sourceLink
   604  	builder.sourceLinkFlag = true
   605  	return builder
   606  }
   607  
   608  // 所有者
   609  //
   610  // 示例值:ou_fa7aa170f92d1615de63371ac425a767
   611  func (builder *CreateEntityPathReqBodyBuilder) Owner(owner string) *CreateEntityPathReqBodyBuilder {
   612  	builder.owner = owner
   613  	builder.ownerFlag = true
   614  	return builder
   615  }
   616  
   617  // 扩展字段
   618  //
   619  // 示例值:{}
   620  func (builder *CreateEntityPathReqBodyBuilder) Extra(extra string) *CreateEntityPathReqBodyBuilder {
   621  	builder.extra = extra
   622  	builder.extraFlag = true
   623  	return builder
   624  }
   625  
   626  // 国际化概括
   627  //
   628  // 示例值:{"cn":"这是一个block","va": "this is a block"}
   629  func (builder *CreateEntityPathReqBodyBuilder) I18nSummary(i18nSummary string) *CreateEntityPathReqBodyBuilder {
   630  	builder.i18nSummary = i18nSummary
   631  	builder.i18nSummaryFlag = true
   632  	return builder
   633  }
   634  
   635  // 国际化预览
   636  //
   637  // 示例值:{"cn":"这是一个block","va": "this is a block"}
   638  func (builder *CreateEntityPathReqBodyBuilder) I18nPreview(i18nPreview string) *CreateEntityPathReqBodyBuilder {
   639  	builder.i18nPreview = i18nPreview
   640  	builder.i18nPreviewFlag = true
   641  	return builder
   642  }
   643  
   644  // 概括
   645  //
   646  // 示例值:{"cn":"这是一个block"}
   647  func (builder *CreateEntityPathReqBodyBuilder) Summary(summary string) *CreateEntityPathReqBodyBuilder {
   648  	builder.summary = summary
   649  	builder.summaryFlag = true
   650  	return builder
   651  }
   652  
   653  // 预览
   654  //
   655  // 示例值:{"cn":"这是一个block"}
   656  func (builder *CreateEntityPathReqBodyBuilder) Preview(preview string) *CreateEntityPathReqBodyBuilder {
   657  	builder.preview = preview
   658  	builder.previewFlag = true
   659  	return builder
   660  }
   661  
   662  func (builder *CreateEntityPathReqBodyBuilder) Build() (*CreateEntityReqBody, error) {
   663  	req := &CreateEntityReqBody{}
   664  	if builder.titleFlag {
   665  		req.Title = &builder.title
   666  	}
   667  	if builder.blockTypeIdFlag {
   668  		req.BlockTypeId = &builder.blockTypeId
   669  	}
   670  	if builder.sourceDataFlag {
   671  		req.SourceData = &builder.sourceData
   672  	}
   673  	if builder.sourceMetaFlag {
   674  		req.SourceMeta = &builder.sourceMeta
   675  	}
   676  	if builder.versionFlag {
   677  		req.Version = &builder.version
   678  	}
   679  	if builder.sourceLinkFlag {
   680  		req.SourceLink = &builder.sourceLink
   681  	}
   682  	if builder.ownerFlag {
   683  		req.Owner = &builder.owner
   684  	}
   685  	if builder.extraFlag {
   686  		req.Extra = &builder.extra
   687  	}
   688  	if builder.i18nSummaryFlag {
   689  		req.I18nSummary = &builder.i18nSummary
   690  	}
   691  	if builder.i18nPreviewFlag {
   692  		req.I18nPreview = &builder.i18nPreview
   693  	}
   694  	if builder.summaryFlag {
   695  		req.Summary = &builder.summary
   696  	}
   697  	if builder.previewFlag {
   698  		req.Preview = &builder.preview
   699  	}
   700  	return req, nil
   701  }
   702  
   703  type CreateEntityReqBuilder struct {
   704  	apiReq *larkcore.ApiReq
   705  	body   *CreateEntityReqBody
   706  }
   707  
   708  func NewCreateEntityReqBuilder() *CreateEntityReqBuilder {
   709  	builder := &CreateEntityReqBuilder{}
   710  	builder.apiReq = &larkcore.ApiReq{
   711  		PathParams:  larkcore.PathParams{},
   712  		QueryParams: larkcore.QueryParams{},
   713  	}
   714  	return builder
   715  }
   716  
   717  // 开发者可以通过该接口将部分或全部数据存放于 BlockEntity。
   718  func (builder *CreateEntityReqBuilder) Body(body *CreateEntityReqBody) *CreateEntityReqBuilder {
   719  	builder.body = body
   720  	return builder
   721  }
   722  
   723  func (builder *CreateEntityReqBuilder) Build() *CreateEntityReq {
   724  	req := &CreateEntityReq{}
   725  	req.apiReq = &larkcore.ApiReq{}
   726  	req.apiReq.Body = builder.body
   727  	return req
   728  }
   729  
   730  type CreateEntityReqBody struct {
   731  	Title       *string `json:"title,omitempty"`         // 标题
   732  	BlockTypeId *string `json:"block_type_id,omitempty"` // block 类型ID
   733  	SourceData  *string `json:"source_data,omitempty"`   // 内容
   734  	SourceMeta  *string `json:"source_meta,omitempty"`   // 元数据
   735  	Version     *string `json:"version,omitempty"`       // 版本号(自增值)
   736  	SourceLink  *string `json:"source_link,omitempty"`   // block原链接
   737  	Owner       *string `json:"owner,omitempty"`         // 所有者
   738  	Extra       *string `json:"extra,omitempty"`         // 扩展字段
   739  	I18nSummary *string `json:"i18n_summary,omitempty"`  // 国际化概括
   740  	I18nPreview *string `json:"i18n_preview,omitempty"`  // 国际化预览
   741  	Summary     *string `json:"summary,omitempty"`       // 概括
   742  	Preview     *string `json:"preview,omitempty"`       // 预览
   743  }
   744  
   745  type CreateEntityReq struct {
   746  	apiReq *larkcore.ApiReq
   747  	Body   *CreateEntityReqBody `body:""`
   748  }
   749  
   750  type CreateEntityRespData struct {
   751  	Entity *Entity `json:"entity,omitempty"` // 返回对象实体
   752  }
   753  
   754  type CreateEntityResp struct {
   755  	*larkcore.ApiResp `json:"-"`
   756  	larkcore.CodeError
   757  	Data *CreateEntityRespData `json:"data"` // 业务数据
   758  }
   759  
   760  func (resp *CreateEntityResp) Success() bool {
   761  	return resp.Code == 0
   762  }
   763  
   764  type UpdateEntityReqBuilder struct {
   765  	apiReq *larkcore.ApiReq
   766  	entity *Entity
   767  }
   768  
   769  func NewUpdateEntityReqBuilder() *UpdateEntityReqBuilder {
   770  	builder := &UpdateEntityReqBuilder{}
   771  	builder.apiReq = &larkcore.ApiReq{
   772  		PathParams:  larkcore.PathParams{},
   773  		QueryParams: larkcore.QueryParams{},
   774  	}
   775  	return builder
   776  }
   777  
   778  // block唯一标识
   779  //
   780  // 示例值:7794641623571830467
   781  func (builder *UpdateEntityReqBuilder) BlockId(blockId string) *UpdateEntityReqBuilder {
   782  	builder.apiReq.PathParams.Set("block_id", fmt.Sprint(blockId))
   783  	return builder
   784  }
   785  
   786  // 开发者通过该接口可以更新存储在BlockEntity中的数据,并实时推送到端侧。
   787  func (builder *UpdateEntityReqBuilder) Entity(entity *Entity) *UpdateEntityReqBuilder {
   788  	builder.entity = entity
   789  	return builder
   790  }
   791  
   792  func (builder *UpdateEntityReqBuilder) Build() *UpdateEntityReq {
   793  	req := &UpdateEntityReq{}
   794  	req.apiReq = &larkcore.ApiReq{}
   795  	req.apiReq.PathParams = builder.apiReq.PathParams
   796  	req.apiReq.Body = builder.entity
   797  	return req
   798  }
   799  
   800  type UpdateEntityReq struct {
   801  	apiReq *larkcore.ApiReq
   802  	Entity *Entity `body:""`
   803  }
   804  
   805  type UpdateEntityResp struct {
   806  	*larkcore.ApiResp `json:"-"`
   807  	larkcore.CodeError
   808  }
   809  
   810  func (resp *UpdateEntityResp) Success() bool {
   811  	return resp.Code == 0
   812  }
   813  
   814  type CreateMessageReqBuilder struct {
   815  	apiReq  *larkcore.ApiReq
   816  	message *Message
   817  }
   818  
   819  func NewCreateMessageReqBuilder() *CreateMessageReqBuilder {
   820  	builder := &CreateMessageReqBuilder{}
   821  	builder.apiReq = &larkcore.ApiReq{
   822  		PathParams:  larkcore.PathParams{},
   823  		QueryParams: larkcore.QueryParams{},
   824  	}
   825  	return builder
   826  }
   827  
   828  // 根据BlockID向指定用户列表推送协同数据。
   829  func (builder *CreateMessageReqBuilder) Message(message *Message) *CreateMessageReqBuilder {
   830  	builder.message = message
   831  	return builder
   832  }
   833  
   834  func (builder *CreateMessageReqBuilder) Build() *CreateMessageReq {
   835  	req := &CreateMessageReq{}
   836  	req.apiReq = &larkcore.ApiReq{}
   837  	req.apiReq.Body = builder.message
   838  	return req
   839  }
   840  
   841  type CreateMessageReq struct {
   842  	apiReq  *larkcore.ApiReq
   843  	Message *Message `body:""`
   844  }
   845  
   846  type CreateMessageResp struct {
   847  	*larkcore.ApiResp `json:"-"`
   848  	larkcore.CodeError
   849  }
   850  
   851  func (resp *CreateMessageResp) Success() bool {
   852  	return resp.Code == 0
   853  }