// Code generated by Lark OpenAPI.

package larkdocs

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

type V1 struct {
	Content *content // content
}

func New(config *larkcore.Config) *V1 {
	return &V1{
		Content: &content{config: config},
	}
}

type content struct {
	config *larkcore.Config
}

// Get
//
// - 获取云文档正文内容
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=get&project=docs&resource=content&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/docsv1/get_content.go
func (c *content) Get(ctx context.Context, req *GetContentReq, options ...larkcore.RequestOptionFunc) (*GetContentResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/docs/v1/content"
	apiReq.HttpMethod = http.MethodGet
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, c.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &GetContentResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, c.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}
