image

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2023 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const DownloadAPI = "/open-apis/im/v1/images/:image_key"

doc: https://open.feishu.cn/document/server-docs/im-v1/image/get

View Source
const UploadAPI = "/open-apis/im/v1/images"

doc: https://open.feishu.cn/document/server-docs/im-v1/image/create

Variables

This section is empty.

Functions

func Download

func Download(client client.Client, imageKey string, imageFilePath string) (err error)

Types

type DownloadRequest

type DownloadRequest struct {
	// ImageKey 图片的 Key
	ImageKey string `json:"image_key"`
}

type Image

type Image interface {
	Upload(cfg *UploadRequest) (resp *UploadResponse, err error)
}

func New

func New(c client.Client) Image

type UploadRequest

type UploadRequest struct {
	// ImageType 图片类型
	// 可选值: message(用于发送消息),avatar(用于设置头像)
	// 示例值: message
	// 必填: 是
	ImageType string `json:"image_type"`

	// Image 图片内容
	// 注意:上传的图片大小不能超过 10MB
	// 示例值: 二进制文件
	Image io.Reader `json:"image"`
}

type UploadResponse

type UploadResponse struct {
	// ImageKey 图片的 Key
	ImageKey string `json:"image_key"`
}

func Upload

func Upload(client client.Client, cfg *UploadRequest) (resp *UploadResponse, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL