本文整理汇总了Golang中google/golang.org/api/googleapi.ResolveRelative函数的典型用法代码示例。如果您正苦于以下问题:Golang ResolveRelative函数的具体用法?Golang ResolveRelative怎么用?Golang ResolveRelative使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ResolveRelative函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
}
示例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"
// }
// }
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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"
// ]
// }
}
示例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"
// }
// }
}
示例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)
}
示例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)
}
示例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)
}
示例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"
// ]
// }
}
示例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"
// ]
// }
}
示例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)
}
示例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"
// ]
// }
}