// Code generated by Lark OpenAPI.

package larkim

import (
	"context"
	"github.com/larksuite/oapi-sdk-go/v3/core"
	"net/http"
)

type V2 struct {
	AppFeedCard          *appFeedCard          // app_feed_card
	AppFeedCardBatch     *appFeedCardBatch     // app_feed_card.batch
	BizEntityTagRelation *bizEntityTagRelation // biz_entity_tag_relation
	ChatButton           *chatButton           // chat_button
	FeedCard             *feedCard             // feed_card
	Tag                  *tag                  // tag
	UrlPreview           *urlPreview           // url_preview
}

func New(config *larkcore.Config) *V2 {
	return &V2{
		AppFeedCard:          &appFeedCard{config: config},
		AppFeedCardBatch:     &appFeedCardBatch{config: config},
		BizEntityTagRelation: &bizEntityTagRelation{config: config},
		ChatButton:           &chatButton{config: config},
		FeedCard:             &feedCard{config: config},
		Tag:                  &tag{config: config},
		UrlPreview:           &urlPreview{config: config},
	}
}

type appFeedCard struct {
	config *larkcore.Config
}
type appFeedCardBatch struct {
	config *larkcore.Config
}
type bizEntityTagRelation struct {
	config *larkcore.Config
}
type chatButton struct {
	config *larkcore.Config
}
type feedCard struct {
	config *larkcore.Config
}
type tag struct {
	config *larkcore.Config
}
type urlPreview struct {
	config *larkcore.Config
}

// Create
//
// -
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=im&resource=app_feed_card&version=v2
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/imv2/create_appFeedCard.go
func (a *appFeedCard) Create(ctx context.Context, req *CreateAppFeedCardReq, options ...larkcore.RequestOptionFunc) (*CreateAppFeedCardResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/im/v2/app_feed_card"
	apiReq.HttpMethod = http.MethodPost
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, a.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &CreateAppFeedCardResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, a.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Delete
//
// -
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=delete&project=im&resource=app_feed_card.batch&version=v2
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/imv2/delete_appFeedCardBatch.go
func (a *appFeedCardBatch) Delete(ctx context.Context, req *DeleteAppFeedCardBatchReq, options ...larkcore.RequestOptionFunc) (*DeleteAppFeedCardBatchResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/im/v2/app_feed_card/batch"
	apiReq.HttpMethod = http.MethodDelete
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, a.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &DeleteAppFeedCardBatchResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, a.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Update
//
// -
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=update&project=im&resource=app_feed_card.batch&version=v2
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/imv2/update_appFeedCardBatch.go
func (a *appFeedCardBatch) Update(ctx context.Context, req *UpdateAppFeedCardBatchReq, options ...larkcore.RequestOptionFunc) (*UpdateAppFeedCardBatchResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/im/v2/app_feed_card/batch"
	apiReq.HttpMethod = http.MethodPut
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, a.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &UpdateAppFeedCardBatchResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, a.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Create
//
// -
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=im&resource=biz_entity_tag_relation&version=v2
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/imv2/create_bizEntityTagRelation.go
func (b *bizEntityTagRelation) Create(ctx context.Context, req *CreateBizEntityTagRelationReq, options ...larkcore.RequestOptionFunc) (*CreateBizEntityTagRelationResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/im/v2/biz_entity_tag_relation"
	apiReq.HttpMethod = http.MethodPost
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, b.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &CreateBizEntityTagRelationResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, b.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Get
//
// -
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=get&project=im&resource=biz_entity_tag_relation&version=v2
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/imv2/get_bizEntityTagRelation.go
func (b *bizEntityTagRelation) Get(ctx context.Context, req *GetBizEntityTagRelationReq, options ...larkcore.RequestOptionFunc) (*GetBizEntityTagRelationResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/im/v2/biz_entity_tag_relation"
	apiReq.HttpMethod = http.MethodGet
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, b.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &GetBizEntityTagRelationResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, b.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Update
//
// -
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=update&project=im&resource=biz_entity_tag_relation&version=v2
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/imv2/update_bizEntityTagRelation.go
func (b *bizEntityTagRelation) Update(ctx context.Context, req *UpdateBizEntityTagRelationReq, options ...larkcore.RequestOptionFunc) (*UpdateBizEntityTagRelationResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/im/v2/biz_entity_tag_relation"
	apiReq.HttpMethod = http.MethodPut
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, b.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &UpdateBizEntityTagRelationResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, b.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Update
//
// -
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=update&project=im&resource=chat_button&version=v2
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/imv2/update_chatButton.go
func (c *chatButton) Update(ctx context.Context, req *UpdateChatButtonReq, options ...larkcore.RequestOptionFunc) (*UpdateChatButtonResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/im/v2/chat_button"
	apiReq.HttpMethod = http.MethodPut
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, c.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &UpdateChatButtonResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, c.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// BotTimeSentive
//
// -
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=bot_time_sentive&project=im&resource=feed_card&version=v2
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/imv2/botTimeSentive_feedCard.go
func (f *feedCard) BotTimeSentive(ctx context.Context, req *BotTimeSentiveFeedCardReq, options ...larkcore.RequestOptionFunc) (*BotTimeSentiveFeedCardResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/im/v2/feed_cards/bot_time_sentive"
	apiReq.HttpMethod = http.MethodPatch
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, f.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &BotTimeSentiveFeedCardResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, f.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Patch
//
// -
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=patch&project=im&resource=feed_card&version=v2
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/imv2/patch_feedCard.go
func (f *feedCard) Patch(ctx context.Context, req *PatchFeedCardReq, options ...larkcore.RequestOptionFunc) (*PatchFeedCardResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/im/v2/feed_cards/:feed_card_id"
	apiReq.HttpMethod = http.MethodPatch
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, f.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &PatchFeedCardResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, f.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Create
//
// -
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=im&resource=tag&version=v2
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/imv2/create_tag.go
func (t *tag) Create(ctx context.Context, req *CreateTagReq, options ...larkcore.RequestOptionFunc) (*CreateTagResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/im/v2/tags"
	apiReq.HttpMethod = http.MethodPost
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, t.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &CreateTagResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, t.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Patch
//
// -
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=patch&project=im&resource=tag&version=v2
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/imv2/patch_tag.go
func (t *tag) Patch(ctx context.Context, req *PatchTagReq, options ...larkcore.RequestOptionFunc) (*PatchTagResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/im/v2/tags/:tag_id"
	apiReq.HttpMethod = http.MethodPatch
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, t.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &PatchTagResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, t.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// BatchUpdate
//
// -
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=batch_update&project=im&resource=url_preview&version=v2
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/imv2/batchUpdate_urlPreview.go
func (u *urlPreview) BatchUpdate(ctx context.Context, req *BatchUpdateUrlPreviewReq, options ...larkcore.RequestOptionFunc) (*BatchUpdateUrlPreviewResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/im/v2/url_previews/batch_update"
	apiReq.HttpMethod = http.MethodPost
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, u.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &BatchUpdateUrlPreviewResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, u.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}
