当前位置: 首页>>代码示例>>Golang>>正文


Golang Client.I64toa方法代码示例

本文整理汇总了Golang中github.com/anaminus/rbxweb.Client.I64toa方法的典型用法代码示例。如果您正苦于以下问题:Golang Client.I64toa方法的具体用法?Golang Client.I64toa怎么用?Golang Client.I64toa使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/anaminus/rbxweb.Client的用法示例。


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

示例1: GetInfo

// GetInfo returns information about an asset, given an asset id.
func GetInfo(client *rbxweb.Client, id int64) (info Info, err error) {
	query := url.Values{
		"assetId": {client.I64toa(id)},
	}
	resp, err := client.Get(client.GetURL(`api`, `/marketplace/productinfo`, query))
	if err = client.AssertResp(resp, err); err != nil {
		return Info{}, err
	}
	defer resp.Body.Close()

	dec := json.NewDecoder(resp.Body)
	dec.Decode(&info)
	return
}
开发者ID:master3395,项目名称:rbxweb,代码行数:15,代码来源:asset.go

示例2: Add

// Add adds an asset to a set. The set must belong to the current user, and
// the asset must be addable to sets.
//
// This function requires the client to be logged in.
func Add(client *rbxweb.Client, assetId int64, setId int32) (err error) {
	query := url.Values{
		"rqtype":  {"addtoset"},
		"assetId": {client.I64toa(assetId)},
		"setId":   {client.I32toa(setId)},
	}

	resp, err := client.Post(client.GetURL(`www`, `/Sets/SetHandler.ashx`, query), "", nil)
	if err = client.AssertResp(resp, err); err != nil {
		return err
	}
	resp.Body.Close()
	return nil
}
开发者ID:master3395,项目名称:rbxweb,代码行数:18,代码来源:set.go

示例3: UpdatePlace

// UpdatePlace uploads data from `reader` to Roblox as a Place asset.
// `placeId` must be the id of an existing place. This function cannot create
// a new place.
//
// This function requires the client to be logged in.
func UpdatePlace(client *rbxweb.Client, reader io.Reader, placeId int64) (err error) {
	query := url.Values{
		"assetid": {client.I64toa(placeId)},
		"type":    {"Place"},
	}
	buf := new(bytes.Buffer)
	buf.ReadFrom(reader)
	req, _ := http.NewRequest("POST", client.GetURL(`www`, `/Data/Upload.ashx`, query), buf)
	req.Header.Set("User-Agent", "Roblox")

	resp, err := client.Do(req)
	if err = client.AssertResp(resp, err); err != nil {
		return err
	}
	defer resp.Body.Close()
	return nil
}
开发者ID:master3395,项目名称:rbxweb,代码行数:22,代码来源:asset.go

示例4: UploadModel

// UploadModel uploads data from `reader` to Roblox as a Model asset. If
// updating an existing model, `modelId` should be the id of the model. If
// `modelId` is 0, then a new model will be uploaded. If uploading a new
// model, `info` can be used to specify information about the model.
//
// This function requires the client to be logged in.
func UploadModel(client *rbxweb.Client, reader io.Reader, modelId int64, info url.Values) (assetVersionId int64, err error) {
	query := url.Values{
		"assetid": {client.I64toa(modelId)},
		"type":    {"Model"},
		//	"name":          {"Unnamed Model"},
		//	"description":   {""},
		//	"genreTypeId":   {"1"},
		//	"isPublic":      {"False"},
		//	"allowComments": {"False"},
	}
	if info != nil {
		for key, value := range info {
			query[key] = value
		}
	}

	return assetVersionId, err
}
开发者ID:master3395,项目名称:rbxweb,代码行数:24,代码来源:asset.go

示例5: GetIdFromVersion

// GetIdFromVersion returns an asset id from an asset version id.
func GetIdFromVersion(client *rbxweb.Client, assetVersionId int64) (assetId int64, err error) {
	query := url.Values{
		"avid": {client.I64toa(assetVersionId)},
	}

	// This relies on how asset names are converted to url names. Currently,
	// if an asset name is "_", its url becomes "unnamed".
	req, _ := http.NewRequest("HEAD", client.GetURL(`www`, `/_-item`, query), nil)
	resp, err := client.Do(req)
	if err = client.AssertResp(resp, err); err != nil {
		return 0, err
	}
	resp.Body.Close()

	values, err := url.ParseQuery(resp.Header.Get("Location"))
	if err = client.AssertResp(resp, err); err != nil {
		return 0, err
	}

	return client.Atoi64(values.Get("id"))
}
开发者ID:master3395,项目名称:rbxweb,代码行数:22,代码来源:asset.go


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