本文整理汇总了Golang中google/golang.org/api/googleapi.ResolveRelative函数的典型用法代码示例。如果您正苦于以下问题:Golang ResolveRelative函数的具体用法?Golang ResolveRelative怎么用?Golang ResolveRelative使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ResolveRelative函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: 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)
}
开发者ID:ryanharper,项目名称:google-api-go-client,代码行数:28,代码来源:taskqueue-gen.go
示例2: Do
func (c *WebfontsListCall) Do() (*WebfontList, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", "json")
if v, ok := c.opt_["sort"]; ok {
params.Set("sort", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "webfonts")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.SetOpaque(req.URL)
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 *WebfontList
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Retrieves the list of fonts currently served by the Google Fonts Developer API",
// "httpMethod": "GET",
// "id": "webfonts.webfonts.list",
// "parameters": {
// "sort": {
// "description": "Enables sorting of the list",
// "enum": [
// "alpha",
// "date",
// "popularity",
// "style",
// "trending"
// ],
// "enumDescriptions": [
// "Sort alphabetically",
// "Sort by date added",
// "Sort by popularity",
// "Sort by number of styles",
// "Sort by trending"
// ],
// "location": "query",
// "type": "string"
// }
// },
// "path": "webfonts",
// "response": {
// "$ref": "WebfontList"
// }
// }
}
开发者ID:avinash-,项目名称:google-api-go-client,代码行数:60,代码来源:webfonts-gen.go
示例3: doRequest
func (c *PagespeedapiRunpagespeedCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", alt)
params.Set("url", fmt.Sprintf("%v", c.url))
if v, ok := c.opt_["filter_third_party_resources"]; ok {
params.Set("filter_third_party_resources", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["locale"]; ok {
params.Set("locale", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["rule"]; ok {
params.Set("rule", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["screenshot"]; ok {
params.Set("screenshot", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["strategy"]; ok {
params.Set("strategy", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "runPagespeed")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.SetOpaque(req.URL)
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)
}
开发者ID:vichetuc,项目名称:google-api-go-client,代码行数:33,代码来源:pagespeedonline-gen.go
示例4: doRequest
func (c *ProjectsPatchTracesCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.traces)
if err != nil {
return nil, err
}
ctype := "application/json"
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}/traces")
urls += "?" + params.Encode()
req, _ := http.NewRequest("PATCH", urls, body)
googleapi.Expand(req.URL, map[string]string{
"projectId": c.projectId,
})
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)
}
开发者ID:davidnguyenwm,项目名称:google-api-go-client,代码行数:25,代码来源:cloudtrace-gen.go
示例5: doRequest
func (c *TranslationsListCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", alt)
params.Set("target", fmt.Sprintf("%v", c.target))
for _, v := range c.q {
params.Add("q", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["cid"]; ok {
params.Set("cid", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["format"]; ok {
params.Set("format", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["source"]; ok {
params.Set("source", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "v2")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.SetOpaque(req.URL)
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)
}
开发者ID:ryanharper,项目名称:google-api-go-client,代码行数:33,代码来源:translate-gen.go
示例6: doRequest
func (c *TrainingInsertCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.training)
if err != nil {
return nil, err
}
ctype := "application/json"
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["data"]; ok {
params.Set("data", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "training")
urls += "?" + params.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.SetOpaque(req.URL)
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)
}
开发者ID:ryanharper,项目名称:google-api-go-client,代码行数:26,代码来源:prediction-gen.go
示例7: 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"
// ]
// }
}
开发者ID:avinash-,项目名称:google-api-go-client,代码行数:60,代码来源:manager-gen.go
示例8: Do
func (c *GetCertForOpenIdConnectRawCall) Do() (*Raw, 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, "oauth2/v1/raw_public_keys")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.SetOpaque(req.URL)
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 *Raw
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "httpMethod": "GET",
// "id": "oauth2.getCertForOpenIdConnectRaw",
// "path": "oauth2/v1/raw_public_keys",
// "response": {
// "$ref": "Raw"
// }
// }
}
开发者ID:avinash-,项目名称:google-api-go-client,代码行数:35,代码来源:oauth2-gen.go
示例9: 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)
}
开发者ID:peterkshultz,项目名称:google-api-go-client,代码行数:25,代码来源:civicinfo-gen.go
示例10: 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)
}
开发者ID:davidnguyenwm,项目名称:google-api-go-client,代码行数:28,代码来源:analytics-gen.go
示例11: 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)
}
开发者ID:davidnguyenwm,项目名称:google-api-go-client,代码行数:26,代码来源:youtubereporting-gen.go
示例12: Do
func (c *SubscriptionsActivateCall) Do() (*Subscription, 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, "customers/{customerId}/subscriptions/{subscriptionId}/activate")
urls += "?" + params.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.Expand(req.URL, map[string]string{
"customerId": c.customerId,
"subscriptionId": c.subscriptionId,
})
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 *Subscription
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Activates a subscription previously suspended by the reseller",
// "httpMethod": "POST",
// "id": "reseller.subscriptions.activate",
// "parameterOrder": [
// "customerId",
// "subscriptionId"
// ],
// "parameters": {
// "customerId": {
// "description": "Id of the Customer",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "subscriptionId": {
// "description": "Id of the subscription, which is unique for a customer",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "customers/{customerId}/subscriptions/{subscriptionId}/activate",
// "response": {
// "$ref": "Subscription"
// },
// "scopes": [
// "https://www.googleapis.com/auth/apps.order"
// ]
// }
}
开发者ID:Tecsisa,项目名称:dex,代码行数:60,代码来源:reseller-gen.go
示例13: Do
func (c *ProjectsZonesClustersListCall) Do() (*ListClustersResponse, 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, "v1/projects/{projectId}/zones/{zone}/clusters")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"projectId": c.projectId,
"zone": c.zone,
})
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 *ListClustersResponse
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Lists all clusters owned by a project in either the specified zone or all zones.",
// "httpMethod": "GET",
// "id": "container.projects.zones.clusters.list",
// "parameterOrder": [
// "projectId",
// "zone"
// ],
// "parameters": {
// "projectId": {
// "description": "The Google Developers Console [project ID](https://console.developers.google.com/project) or [project number](https://developers.google.com/console/help/project-number)",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "zone": {
// "description": "The name of the Google Compute Engine [zone](/compute/docs/zones#available) in which the cluster resides, or \"-\" for all zones.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/projects/{projectId}/zones/{zone}/clusters",
// "response": {
// "$ref": "ListClustersResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
开发者ID:johndmulhausen,项目名称:kubernetes,代码行数:60,代码来源:container-gen.go
示例14: doRequest
func (c *MediaUploadCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.media)
if err != nil {
return nil, err
}
ctype := "application/json"
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/media/{+resourceName}")
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()
if c.protocol_ != "resumable" && c.media_ != nil {
cancel := gensupport.IncludeMedia(c.media_, &body, &ctype)
defer cancel()
}
req, _ := http.NewRequest("POST", urls, body)
googleapi.Expand(req.URL, map[string]string{
"resourceName": c.resourceName,
})
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)
}
开发者ID:pilwon,项目名称:google-api-go-client,代码行数:35,代码来源:dataproc-gen.go
示例15: Do
func (c *PagesGetCall) Do() (*Page, 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, "blogs/{blogId}/pages/{pageId}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"blogId": c.blogId,
"pageId": c.pageId,
})
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 *Page
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Gets one blog page by id.",
// "httpMethod": "GET",
// "id": "blogger.pages.get",
// "parameterOrder": [
// "blogId",
// "pageId"
// ],
// "parameters": {
// "blogId": {
// "description": "ID of the blog containing the page.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "pageId": {
// "description": "The ID of the page to get.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "blogs/{blogId}/pages/{pageId}",
// "response": {
// "$ref": "Page"
// },
// "scopes": [
// "https://www.googleapis.com/auth/blogger"
// ]
// }
}
开发者ID:GamerockSA,项目名称:dex,代码行数:60,代码来源:blogger-gen.go
示例16: doRequest
func (c *TransfersListCall) 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_["maxResults"]; ok {
params.Set("maxResults", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["newOwnerUserId"]; ok {
params.Set("newOwnerUserId", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["oldOwnerUserId"]; ok {
params.Set("oldOwnerUserId", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["pageToken"]; ok {
params.Set("pageToken", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["status"]; ok {
params.Set("status", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "transfers")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.SetOpaque(req.URL)
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)
}
开发者ID:vichetuc,项目名称:google-api-go-client,代码行数:35,代码来源:admin-gen.go
示例17: Do
func (c *ProjectsZonesOperationsListCall) Do() (*ListOperationsResponse, 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}/zones/{zoneId}/operations")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"projectId": c.projectId,
"zoneId": c.zoneId,
})
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 *ListOperationsResponse
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Lists all operations in a project in a specific zone.",
// "httpMethod": "GET",
// "id": "container.projects.zones.operations.list",
// "parameterOrder": [
// "projectId",
// "zoneId"
// ],
// "parameters": {
// "projectId": {
// "description": "The Google Developers Console project ID or project number.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "zoneId": {
// "description": "The name of the Google Compute Engine zone to return operations for.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{projectId}/zones/{zoneId}/operations",
// "response": {
// "$ref": "ListOperationsResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
开发者ID:nguansak,项目名称:google-api-go-client,代码行数:60,代码来源:container-gen.go
示例18: Do
func (c *BatchReportsListCall) Do() (*BatchReportList, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", "json")
params.Set("batchReportDefinitionId", fmt.Sprintf("%v", c.batchReportDefinitionId))
params.Set("onBehalfOfContentOwner", fmt.Sprintf("%v", c.onBehalfOfContentOwner))
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "batchReports")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.SetOpaque(req.URL)
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 *BatchReportList
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Retrieves a list of processed batch reports.",
// "httpMethod": "GET",
// "id": "youtubeAnalytics.batchReports.list",
// "parameterOrder": [
// "batchReportDefinitionId",
// "onBehalfOfContentOwner"
// ],
// "parameters": {
// "batchReportDefinitionId": {
// "description": "The batchReportDefinitionId parameter specifies the ID of the batch reportort definition for which you are retrieving reports.",
// "location": "query",
// "required": true,
// "type": "string"
// },
// "onBehalfOfContentOwner": {
// "description": "The onBehalfOfContentOwner parameter identifies the content owner that the user is acting on behalf of.",
// "location": "query",
// "required": true,
// "type": "string"
// }
// },
// "path": "batchReports",
// "response": {
// "$ref": "BatchReportList"
// },
// "scopes": [
// "https://www.googleapis.com/auth/yt-analytics-monetary.readonly",
// "https://www.googleapis.com/auth/yt-analytics.readonly"
// ]
// }
}
开发者ID:avinash-,项目名称:google-api-go-client,代码行数:60,代码来源:youtubeanalytics-gen.go
示例19: 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.resumableBuffer_ != nil {
urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
protocol := "multipart"
if c.resumableBuffer_ != nil {
protocol = "resumable"
}
c.urlParams_.Set("uploadType", protocol)
}
urls += "?" + c.urlParams_.Encode()
body = new(bytes.Buffer)
ctype := "application/json"
if c.media_ != nil {
var combined io.ReadCloser
combined, ctype = gensupport.CombineBodyMedia(body, ctype, c.media_, c.mediaType_)
defer combined.Close()
body = combined
}
req, _ := http.NewRequest("POST", urls, body)
googleapi.Expand(req.URL, map[string]string{
"groupId": c.groupId,
})
if c.resumableBuffer_ != nil {
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)
}
开发者ID:Celluliodio,项目名称:flannel,代码行数:35,代码来源:groupsmigration-gen.go
示例20: doRequest
func (c *ActivitiesListCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["drive.ancestorId"]; ok {
params.Set("drive.ancestorId", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["drive.fileId"]; ok {
params.Set("drive.fileId", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["groupingStrategy"]; ok {
params.Set("groupingStrategy", fmt.Sprintf("%v", v))
}
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_["source"]; ok {
params.Set("source", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["userId"]; ok {
params.Set("userId", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "activities")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.SetOpaque(req.URL)
req.Header.Set("User-Agent", c.s.userAgent())
return c.s.client.Do(req)
}
开发者ID:80nashi,项目名称:google-api-go-client,代码行数:35,代码来源:appsactivity-gen.go
注:本文中的google/golang.org/api/googleapi.ResolveRelative函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论