material

package
v1.0.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package material 素材管理

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(ctx *corporation.App, params url.Values) (resp []byte, err error)

获取临时素材

See: https://work.weixin.qq.com/api/doc/90000/90135/90254

GET https://qyapi.weixin.qq.com/cgi-bin/media/get?access_token=ACCESS_TOKEN&media_id=MEDIA_ID

Example
package main

import (
	"fmt"
	"net/url"

	"github.com/fastwego/wechat4work/corporation"
	"github.com/fastwego/wechat4work/corporation/apis/material"
)

func main() {
	var ctx *corporation.App

	params := url.Values{}
	resp, err := material.Get(ctx, params)

	fmt.Println(resp, err)
}
Output:

func Jssdk

func Jssdk(ctx *corporation.App, params url.Values) (resp []byte, err error)

获取高清语音素材

See: https://work.weixin.qq.com/api/doc/90000/90135/90255

GET https://qyapi.weixin.qq.com/cgi-bin/media/get/jssdk?access_token=ACCESS_TOKEN&media_id=MEDIA_ID

Example
package main

import (
	"fmt"
	"net/url"

	"github.com/fastwego/wechat4work/corporation"
	"github.com/fastwego/wechat4work/corporation/apis/material"
)

func main() {
	var ctx *corporation.App

	params := url.Values{}
	resp, err := material.Jssdk(ctx, params)

	fmt.Println(resp, err)
}
Output:

func Upload

func Upload(ctx *corporation.App, media string, params url.Values) (resp []byte, err error)

上传临时素材

See: https://work.weixin.qq.com/api/doc/90000/90135/90253

POST(@media) https://qyapi.weixin.qq.com/cgi-bin/media/upload?access_token=ACCESS_TOKEN&type=TYPE

Example
package main

import (
	"fmt"
	"net/url"

	"github.com/fastwego/wechat4work/corporation"
	"github.com/fastwego/wechat4work/corporation/apis/material"
)

func main() {
	var ctx *corporation.App

	media := ""
	params := url.Values{}
	resp, err := material.Upload(ctx, media, params)

	fmt.Println(resp, err)
}
Output:

func UploadImg

func UploadImg(ctx *corporation.App, media string) (resp []byte, err error)

上传图片

See: https://work.weixin.qq.com/api/doc/90000/90135/90256

POST(@media) https://qyapi.weixin.qq.com/cgi-bin/media/uploadimg?access_token=ACCESS_TOKEN

Example
package main

import (
	"fmt"

	"github.com/fastwego/wechat4work/corporation"
	"github.com/fastwego/wechat4work/corporation/apis/material"
)

func main() {
	var ctx *corporation.App

	media := ""
	resp, err := material.UploadImg(ctx, media)

	fmt.Println(resp, err)
}
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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