Skip to content
api for https://sm.ms, write by golang( go语言版本的 sm.ms 图床 API)
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd
.gitignore
README.md
sm_ms_api.go

README.md

sm_ms_api

api for https://sm.ms

Golang 版本的 https://sm.ms/doc/v2 API接口

如何安装

go get gopkg.in/sndnvaps/sm-ms-api.v2

如果需要使用v1版本,可以用如下的命令来安装

go get gopkg.in/sndnvaps/sm-ms-api.v1

支持如下功能

Clear

Delete

Upload

ListHistory

函数原型

  func Clear() (MsgBody, error)

  func Delete(delUrlLink string) string

  func Upload(filename string) (map[string]interface{}, error)

  func ListUploadHistory() (HistoryMsgBody, error)

返回值定义结构体

//用于 Upload() func
type MsgBody struct {
	Code string   `json:"code"`
	Data DataInfo `json:"data,omitempty"`
	Msg  string   `json:"msg,omitempty"` //用于接收错误信息
}

//用于 ListUploadHistory() func
type HistoryMsgBody struct {
	Code string     `json:"code"`
	Data []DataInfo `json:"data"`
}

//用于获取上传图片的信息
type DataInfo struct {
	Width     int    `json:"width"`
	Height    int    `json:"height"`
	FileName  string `json:"filename"`
	StoreName string `json:"storename"`
	Size      int    `json:"size"`
	Path      string `json:"path"`
	Hash      string `json:"hash"`
	TimeStamp int64  `json:"timestamp"`
	Ip        string `json:"ip"`
	Url       string `json:"url"`
	Delete    string `json:"delete"`
}

使用方法,请查看 example 目录下面的例子

更新日志

License

MIT

You can’t perform that action at this time.