本文整理汇总了Golang中google/golang.org/api/googleapi.Expand函数的典型用法代码示例。如果您正苦于以下问题:Golang Expand函数的具体用法?Golang Expand怎么用?Golang Expand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Expand函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: doRequest
func (c *ManagementWebpropertiesListCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["max-results"]; ok {
params.Set("max-results", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["start-index"]; ok {
params.Set("start-index", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "management/accounts/{accountId}/webproperties")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"accountId": c.accountId,
})
req.Header.Set("User-Agent", c.s.userAgent())
if v, ok := c.opt_["ifNoneMatch"]; ok {
req.Header.Set("If-None-Match", fmt.Sprintf("%v", v))
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
示例2: doRequest
func (c *RepresentativesRepresentativeInfoByDivisionCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["levels"]; ok {
params.Set("levels", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["recursive"]; ok {
params.Set("recursive", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["roles"]; ok {
params.Set("roles", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "representatives/{ocdId}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"ocdId": c.ocdId,
})
req.Header.Set("User-Agent", c.s.userAgent())
return c.s.client.Do(req)
}
示例3: doRequest
func (c *TasksLeaseCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", alt)
params.Set("leaseSecs", fmt.Sprintf("%v", c.leaseSecs))
params.Set("numTasks", fmt.Sprintf("%v", c.numTasks))
if v, ok := c.opt_["groupByTag"]; ok {
params.Set("groupByTag", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["tag"]; ok {
params.Set("tag", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/taskqueues/{taskqueue}/tasks/lease")
urls += "?" + params.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"taskqueue": c.taskqueue,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
示例4: doRequest
func (c *JobsReportsGetCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["onBehalfOfContentOwner"]; ok {
params.Set("onBehalfOfContentOwner", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/jobs/{jobId}/reports/{reportId}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"jobId": c.jobId,
"reportId": c.reportId,
})
req.Header.Set("User-Agent", c.s.userAgent())
if v, ok := c.opt_["ifNoneMatch"]; ok {
req.Header.Set("If-None-Match", fmt.Sprintf("%v", v))
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
示例5: doRequest
func (c *TasksInsertCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.task)
if err != nil {
return nil, err
}
ctype := "application/json"
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["parent"]; ok {
params.Set("parent", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["previous"]; ok {
params.Set("previous", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "lists/{tasklist}/tasks")
urls += "?" + params.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.Expand(req.URL, map[string]string{
"tasklist": c.tasklistid,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
return c.s.client.Do(req)
}
示例6: doRequest
func (c *LicenseAssignmentsListForProductAndSkuCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", alt)
params.Set("customerId", fmt.Sprintf("%v", c.customerId))
if v, ok := c.opt_["maxResults"]; ok {
params.Set("maxResults", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["pageToken"]; ok {
params.Set("pageToken", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "{productId}/sku/{skuId}/users")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"productId": c.productId,
"skuId": c.skuId,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
示例7: Do
func (c *MetricDescriptorsDeleteCall) Do() (*DeleteMetricDescriptorResponse, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", "json")
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/metricDescriptors/{metric}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("DELETE", urls, body)
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"metric": c.metric,
})
req.Header.Set("User-Agent", c.s.userAgent())
res, err := c.s.client.Do(req)
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *DeleteMetricDescriptorResponse
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Delete an existing metric.",
// "httpMethod": "DELETE",
// "id": "cloudmonitoring.metricDescriptors.delete",
// "parameterOrder": [
// "project",
// "metric"
// ],
// "parameters": {
// "metric": {
// "description": "Name of the metric.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "project": {
// "description": "The project ID to which the metric belongs.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{project}/metricDescriptors/{metric}",
// "response": {
// "$ref": "DeleteMetricDescriptorResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/monitoring"
// ]
// }
}
示例8: doRequest
func (c *CommentsListCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["fetchBodies"]; ok {
params.Set("fetchBodies", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["maxResults"]; ok {
params.Set("maxResults", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["pageToken"]; ok {
params.Set("pageToken", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["startDate"]; ok {
params.Set("startDate", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}/comments")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"blogId": c.blogId,
"postId": c.postId,
})
req.Header.Set("User-Agent", c.s.userAgent())
return c.s.client.Do(req)
}
示例9: doRequest
func (c *CustomerUsageReportsGetCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["customerId"]; ok {
params.Set("customerId", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["pageToken"]; ok {
params.Set("pageToken", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["parameters"]; ok {
params.Set("parameters", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "usage/dates/{date}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"date": c.date,
})
req.Header.Set("User-Agent", c.s.userAgent())
return c.s.client.Do(req)
}
示例10: doRequest
func (c *ChangesListCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["maxResults"]; ok {
params.Set("maxResults", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["pageToken"]; ok {
params.Set("pageToken", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["sortBy"]; ok {
params.Set("sortBy", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["sortOrder"]; ok {
params.Set("sortOrder", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/managedZones/{managedZone}/changes")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"managedZone": c.managedZone,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
示例11: Do
func (c *TrainedmodelsGetCall) Do() (*Insert2, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", "json")
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/trainedmodels/{id}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"id": c.id,
})
req.Header.Set("User-Agent", c.s.userAgent())
res, err := c.s.client.Do(req)
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *Insert2
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Check training status of your model.",
// "httpMethod": "GET",
// "id": "prediction.trainedmodels.get",
// "parameterOrder": [
// "project",
// "id"
// ],
// "parameters": {
// "id": {
// "description": "The unique name for the predictive model.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "project": {
// "description": "The project associated with the model.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{project}/trainedmodels/{id}",
// "response": {
// "$ref": "Insert2"
// },
// "scopes": [
// "https://www.googleapis.com/auth/prediction"
// ]
// }
}
示例12: doRequest
func (c *BillingAccountsProjectsListCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["pageSize"]; ok {
params.Set("pageSize", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["pageToken"]; ok {
params.Set("pageToken", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/projects")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
req.Header.Set("User-Agent", c.s.userAgent())
if v, ok := c.opt_["ifNoneMatch"]; ok {
req.Header.Set("If-None-Match", fmt.Sprintf("%v", v))
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
示例13: doRequest
func (c *AutoscalersListCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["filter"]; ok {
params.Set("filter", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["maxResults"]; ok {
params.Set("maxResults", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["pageToken"]; ok {
params.Set("pageToken", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/zones/{zone}/autoscalers")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"zone": c.zone,
})
req.Header.Set("User-Agent", c.s.userAgent())
return c.s.client.Do(req)
}
示例14: Do
func (c *TemplatesGetCall) Do() (*Template, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", "json")
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "{projectId}/templates/{templateName}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"projectId": c.projectId,
"templateName": c.templateName,
})
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *Template
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "",
// "httpMethod": "GET",
// "id": "manager.templates.get",
// "parameterOrder": [
// "projectId",
// "templateName"
// ],
// "parameters": {
// "projectId": {
// "location": "path",
// "required": true,
// "type": "string"
// },
// "templateName": {
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{projectId}/templates/{templateName}",
// "response": {
// "$ref": "Template"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/ndev.cloudman",
// "https://www.googleapis.com/auth/ndev.cloudman.readonly"
// ]
// }
}
示例15: doRequest
func (c *ArchiveInsertCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{groupId}/archive")
if c.media_ != nil || c.resumable_ != nil {
urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
c.urlParams_.Set("uploadType", c.protocol_)
}
urls += "?" + c.urlParams_.Encode()
body = new(bytes.Buffer)
ctype := "application/json"
if c.protocol_ != "resumable" {
cancel := gensupport.ConditionallyIncludeMedia(c.media_, &body, &ctype)
defer cancel()
}
req, _ := http.NewRequest("POST", urls, body)
googleapi.Expand(req.URL, map[string]string{
"groupId": c.groupId,
})
if c.protocol_ == "resumable" {
if c.mediaType_ == "" {
c.mediaType_ = gensupport.DetectMediaType(c.resumable_)
}
req.Header.Set("X-Upload-Content-Type", c.mediaType_)
}
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}