• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang httprpc.CallJson函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/kdar/httprpc.CallJson函数的典型用法代码示例。如果您正苦于以下问题:Golang CallJson函数的具体用法?Golang CallJson怎么用?Golang CallJson使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CallJson函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: main

func main() {
	var reply Reply
	err := httprpc.CallJson("1.0", "http://localhost:9000/rpc", "HelloService.Say", &Args{"kevin"}, &reply)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(reply.Message)
}
开发者ID:NoahShen,项目名称:httprpc,代码行数:8,代码来源:client.go


示例2: PauseAll

func PauseAll() (string, error) {
	method := "aria2.pauseAll"
	paramArr := make([]string, 0)
	var reply string
	err := httprpc.CallJson(RpcVersion, RpcUrl, method, paramArr, &reply)
	if err != nil {
		return "", err
	}
	return reply, nil
}
开发者ID:ukd1,项目名称:aria2rpc,代码行数:10,代码来源:aria2rpc.go


示例3: GetGlobalStat

func GetGlobalStat() (map[string]interface{}, error) {
	method := "aria2.getGlobalStat"
	paramArr := make([]interface{}, 0)
	var reply = make(map[string]interface{})
	err := httprpc.CallJson(RpcVersion, RpcUrl, method, paramArr, &reply)
	if err != nil {
		return nil, err
	}
	return reply, nil
}
开发者ID:ukd1,项目名称:aria2rpc,代码行数:10,代码来源:aria2rpc.go


示例4: GetGlobalOption

func GetGlobalOption() (map[string]interface{}, error) {
	method := "aria2.getGlobalOption"
	paramArr := make([]interface{}, 1)
	paramArr[0] = "token:" + RpcSecret
	var reply = make(map[string]interface{})
	err := httprpc.CallJson(RpcVersion, RpcUrl, method, paramArr, &reply)
	if err != nil {
		return nil, err
	}
	return reply, nil
}
开发者ID:headzoo,项目名称:aria2rpc,代码行数:11,代码来源:aria2rpc.go


示例5: UnpauseAll

func UnpauseAll() (string, error) {
	method := "aria2.unpauseAll"
	paramArr := make([]string, 1)
	paramArr[0] = "token:" + RpcSecret
	var reply string
	err := httprpc.CallJson(RpcVersion, RpcUrl, method, paramArr, &reply)
	if err != nil {
		return "", err
	}
	return reply, nil
}
开发者ID:headzoo,项目名称:aria2rpc,代码行数:11,代码来源:aria2rpc.go


示例6: Unpause

func Unpause(gid string) (string, error) {
	method := "aria2.unpause"
	paramArr := make([]interface{}, 1)
	paramArr[0] = gid
	var replyGID string
	err := httprpc.CallJson(RpcVersion, RpcUrl, method, paramArr, &replyGID)
	if err != nil {
		return "", err
	}
	return replyGID, nil
}
开发者ID:ukd1,项目名称:aria2rpc,代码行数:11,代码来源:aria2rpc.go


示例7: ChangeGlobalOption

func ChangeGlobalOption(params map[string]string) (string, error) {
	method := "aria2.changeGlobalOption"
	paramArr := make([]interface{}, 0)
	paramArr = append(paramArr, params)

	var reply string
	err := httprpc.CallJson(RpcVersion, RpcUrl, method, paramArr, &reply)
	if err != nil {
		return "", err
	}
	return reply, nil
}
开发者ID:ukd1,项目名称:aria2rpc,代码行数:12,代码来源:aria2rpc.go


示例8: GetActive

func GetActive(keys []string) ([]map[string]interface{}, error) {
	method := "aria2.tellActive"
	paramArr := make([]interface{}, 0)
	if keys != nil && len(keys) > 0 {
		paramArr = append(paramArr, keys)
	}
	var reply = make([]map[string]interface{}, 10)
	err := httprpc.CallJson(RpcVersion, RpcUrl, method, paramArr, &reply)
	if err != nil {
		return nil, err
	}
	return reply, nil
}
开发者ID:ukd1,项目名称:aria2rpc,代码行数:13,代码来源:aria2rpc.go


示例9: ChangeOption

func ChangeOption(gid string, params map[string]string) (string, error) {
	method := "aria2.changeOption"
	paramArr := make([]interface{}, 2)
	paramArr[0] = "token:" + RpcSecret
	paramArr[1] = gid
	paramArr = append(paramArr, params)

	var reply string
	err := httprpc.CallJson(RpcVersion, RpcUrl, method, paramArr, &reply)
	if err != nil {
		return "", err
	}
	return reply, nil
}
开发者ID:headzoo,项目名称:aria2rpc,代码行数:14,代码来源:aria2rpc.go


示例10: GetStatus

func GetStatus(gid string, keys []string) (map[string]interface{}, error) {
	method := "aria2.tellStatus"
	paramArr := make([]interface{}, 1)
	paramArr[0] = gid
	if keys != nil && len(keys) > 0 {
		paramArr = append(paramArr, keys)
	}
	var reply = make(map[string]interface{})
	err := httprpc.CallJson(RpcVersion, RpcUrl, method, paramArr, &reply)
	if err != nil {
		return nil, err
	}
	return reply, nil
}
开发者ID:ukd1,项目名称:aria2rpc,代码行数:14,代码来源:aria2rpc.go


示例11: GetStopped

func GetStopped(offset, num int, keys []string) ([]map[string]interface{}, error) {
	method := "aria2.tellStopped"
	paramArr := make([]interface{}, 2)
	paramArr[0] = offset
	paramArr[1] = num
	if keys != nil && len(keys) > 0 {
		paramArr = append(paramArr, keys)
	}
	var reply = make([]map[string]interface{}, 10)
	err := httprpc.CallJson(RpcVersion, RpcUrl, method, paramArr, &reply)
	if err != nil {
		return nil, err
	}
	return reply, nil
}
开发者ID:ukd1,项目名称:aria2rpc,代码行数:15,代码来源:aria2rpc.go


示例12: Pause

func Pause(gid string, force bool) (string, error) {
	var method string
	if force {
		method = "aria2.forcePause"
	} else {
		method = "aria2.pause"
	}
	paramArr := make([]interface{}, 1)
	paramArr[0] = gid
	var replyGID string
	err := httprpc.CallJson(RpcVersion, RpcUrl, method, paramArr, &replyGID)
	if err != nil {
		return "", err
	}
	return replyGID, nil
}
开发者ID:ukd1,项目名称:aria2rpc,代码行数:16,代码来源:aria2rpc.go


示例13: Remove

func Remove(gid string, force bool) (string, error) {
	var method string
	if force {
		method = "aria2.forceRemove"
	} else {
		method = "aria2.remove"
	}
	paramArr := make([]interface{}, 2)
	paramArr[0] = "token:" + RpcSecret
	paramArr[1] = gid
	var replyGID string
	err := httprpc.CallJson(RpcVersion, RpcUrl, method, paramArr, &replyGID)
	if err != nil {
		return "", err
	}
	return replyGID, nil
}
开发者ID:headzoo,项目名称:aria2rpc,代码行数:17,代码来源:aria2rpc.go


示例14: AddUri

func AddUri(uri string, params map[string]interface{}) (string, error) {
	method := "aria2.addUri"
	paramArr := make([]interface{}, 1)
	uris := make([]string, 1)
	uris[0] = uri
	paramArr[0] = uris
	if params != nil {
		paramArr = append(paramArr, params)
	}

	var replyGID string
	err := httprpc.CallJson(RpcVersion, RpcUrl, method, paramArr, &replyGID)
	if err != nil {
		return "", err
	}
	return replyGID, nil
}
开发者ID:ukd1,项目名称:aria2rpc,代码行数:17,代码来源:aria2rpc.go


示例15: AddTorrent

func AddTorrent(path string) (string, error) {
	file, openFileErr := os.Open(path)
	if openFileErr != nil {
		return "", nil
	}

	fileBytes, readError := ioutil.ReadAll(bufio.NewReader(file))
	if readError != nil {
		return "", readError
	}
	coder := base64.StdEncoding
	encoded := coder.EncodeToString(fileBytes)

	method := "aria2.addTorrent"
	paramArr := make([]interface{}, 1)
	paramArr[0] = encoded
	var replyGID string
	err := httprpc.CallJson(RpcVersion, RpcUrl, method, paramArr, &replyGID)
	if err != nil {
		return "", err
	}
	return replyGID, nil
}
开发者ID:ukd1,项目名称:aria2rpc,代码行数:23,代码来源:aria2rpc.go



注:本文中的github.com/kdar/httprpc.CallJson函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang lua.State类代码示例发布时间:2022-05-23
下一篇:
Golang callback.Registry类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap