Skip to content

Commit

Permalink
google-api-go-client: external friendliness
Browse files Browse the repository at this point in the history
Adds some features to `google-api-go-client` to enable its use for
service generation outside of "google.golang.org/api". This allows
the generation of consistent code for other Cloud Endpoints services.

Added features:
- Move remaining "golang.google.org/api/internal" code into "gensupport"
  so services resident in other packages can compile under Go 1.5.
- Add `-base_url` flag to override the default service URL. This enables
  generation against local `dev_appserver.py` instances to use a base
  URL other than "http://localhost:8080".
- Add `-header_path` optional flag, which, when supplied, is a path to a
  file whose contents will be prepended to generated stubs. This is
  useful for adding project licenses to generated code.
- Fix a bug where generated code references to overridden package path
  require the overriding packages to use the default package's name.
- Fix a bug where "compute" API was included when generating '*' for any
  discovery URL, not just Google's.

Fixes googleapis#112.

Change-Id: I16d0a5992fc41f958468620cbe13a9177414fe41
Reviewed-on: https://code-review.googlesource.com/3706
Reviewed-by: Michael McGreevy <[email protected]>
  • Loading branch information
danjacques authored and mcgreevy committed Nov 10, 2015
1 parent a42d61d commit cd02e6c
Show file tree
Hide file tree
Showing 156 changed files with 5,106 additions and 5,067 deletions.
28 changes: 14 additions & 14 deletions adexchangebuyer/v1.2/adexchangebuyer-gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (
"encoding/json"
"errors"
"fmt"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
"google.golang.org/api/googleapi"
"google.golang.org/api/internal"
context "golang.org/x/net/context"
ctxhttp "golang.org/x/net/context/ctxhttp"
gensupport "google.golang.org/api/gensupport"
googleapi "google.golang.org/api/googleapi"
"io"
"net/http"
"net/url"
Expand All @@ -33,10 +33,10 @@ var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = gensupport.MarshalJSON
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = internal.MarshalJSON
var _ = context.Canceled
var _ = ctxhttp.Do

Expand Down Expand Up @@ -146,7 +146,7 @@ type Account struct {
func (s *Account) MarshalJSON() ([]byte, error) {
type noMethod Account
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

type AccountBidderLocation struct {
Expand Down Expand Up @@ -177,7 +177,7 @@ type AccountBidderLocation struct {
func (s *AccountBidderLocation) MarshalJSON() ([]byte, error) {
type noMethod AccountBidderLocation
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// AccountsList: An account feed lists Ad Exchange buyer accounts that
Expand Down Expand Up @@ -206,7 +206,7 @@ type AccountsList struct {
func (s *AccountsList) MarshalJSON() ([]byte, error) {
type noMethod AccountsList
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// Creative: A creative and its classification data.
Expand Down Expand Up @@ -319,7 +319,7 @@ type Creative struct {
func (s *Creative) MarshalJSON() ([]byte, error) {
type noMethod Creative
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

type CreativeCorrections struct {
Expand All @@ -341,7 +341,7 @@ type CreativeCorrections struct {
func (s *CreativeCorrections) MarshalJSON() ([]byte, error) {
type noMethod CreativeCorrections
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

type CreativeDisapprovalReasons struct {
Expand All @@ -363,7 +363,7 @@ type CreativeDisapprovalReasons struct {
func (s *CreativeDisapprovalReasons) MarshalJSON() ([]byte, error) {
type noMethod CreativeDisapprovalReasons
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// CreativeFilteringReasons: The filtering reasons for the creative.
Expand All @@ -388,7 +388,7 @@ type CreativeFilteringReasons struct {
func (s *CreativeFilteringReasons) MarshalJSON() ([]byte, error) {
type noMethod CreativeFilteringReasons
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

type CreativeFilteringReasonsReasons struct {
Expand All @@ -413,7 +413,7 @@ type CreativeFilteringReasonsReasons struct {
func (s *CreativeFilteringReasonsReasons) MarshalJSON() ([]byte, error) {
type noMethod CreativeFilteringReasonsReasons
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// CreativesList: The creatives feed lists the active creatives for the
Expand Down Expand Up @@ -447,7 +447,7 @@ type CreativesList struct {
func (s *CreativesList) MarshalJSON() ([]byte, error) {
type noMethod CreativesList
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// method id "adexchangebuyer.accounts.get":
Expand Down
60 changes: 30 additions & 30 deletions adexchangebuyer/v1.3/adexchangebuyer-gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (
"encoding/json"
"errors"
"fmt"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
"google.golang.org/api/googleapi"
"google.golang.org/api/internal"
context "golang.org/x/net/context"
ctxhttp "golang.org/x/net/context/ctxhttp"
gensupport "google.golang.org/api/gensupport"
googleapi "google.golang.org/api/googleapi"
"io"
"net/http"
"net/url"
Expand All @@ -33,10 +33,10 @@ var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = gensupport.MarshalJSON
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = internal.MarshalJSON
var _ = context.Canceled
var _ = ctxhttp.Do

Expand Down Expand Up @@ -206,7 +206,7 @@ type Account struct {
func (s *Account) MarshalJSON() ([]byte, error) {
type noMethod Account
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

type AccountBidderLocation struct {
Expand Down Expand Up @@ -237,7 +237,7 @@ type AccountBidderLocation struct {
func (s *AccountBidderLocation) MarshalJSON() ([]byte, error) {
type noMethod AccountBidderLocation
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// AccountsList: An account feed lists Ad Exchange buyer accounts that
Expand Down Expand Up @@ -266,7 +266,7 @@ type AccountsList struct {
func (s *AccountsList) MarshalJSON() ([]byte, error) {
type noMethod AccountsList
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// BillingInfo: The configuration data for an Ad Exchange billing info.
Expand Down Expand Up @@ -301,7 +301,7 @@ type BillingInfo struct {
func (s *BillingInfo) MarshalJSON() ([]byte, error) {
type noMethod BillingInfo
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// BillingInfoList: A billing info feed lists Billing Info the Ad
Expand Down Expand Up @@ -330,7 +330,7 @@ type BillingInfoList struct {
func (s *BillingInfoList) MarshalJSON() ([]byte, error) {
type noMethod BillingInfoList
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// Budget: The configuration data for Ad Exchange RTB - Budget API.
Expand Down Expand Up @@ -373,7 +373,7 @@ type Budget struct {
func (s *Budget) MarshalJSON() ([]byte, error) {
type noMethod Budget
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// Creative: A creative and its classification data.
Expand Down Expand Up @@ -490,7 +490,7 @@ type Creative struct {
func (s *Creative) MarshalJSON() ([]byte, error) {
type noMethod Creative
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

type CreativeCorrections struct {
Expand All @@ -512,7 +512,7 @@ type CreativeCorrections struct {
func (s *CreativeCorrections) MarshalJSON() ([]byte, error) {
type noMethod CreativeCorrections
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

type CreativeDisapprovalReasons struct {
Expand All @@ -534,7 +534,7 @@ type CreativeDisapprovalReasons struct {
func (s *CreativeDisapprovalReasons) MarshalJSON() ([]byte, error) {
type noMethod CreativeDisapprovalReasons
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// CreativeFilteringReasons: The filtering reasons for the creative.
Expand All @@ -559,7 +559,7 @@ type CreativeFilteringReasons struct {
func (s *CreativeFilteringReasons) MarshalJSON() ([]byte, error) {
type noMethod CreativeFilteringReasons
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

type CreativeFilteringReasonsReasons struct {
Expand All @@ -584,7 +584,7 @@ type CreativeFilteringReasonsReasons struct {
func (s *CreativeFilteringReasonsReasons) MarshalJSON() ([]byte, error) {
type noMethod CreativeFilteringReasonsReasons
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// CreativeNativeAd: If nativeAd is set, HTMLSnippet and videoURL should
Expand Down Expand Up @@ -641,7 +641,7 @@ type CreativeNativeAd struct {
func (s *CreativeNativeAd) MarshalJSON() ([]byte, error) {
type noMethod CreativeNativeAd
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// CreativeNativeAdAppIcon: The app icon, for app download ads.
Expand All @@ -664,7 +664,7 @@ type CreativeNativeAdAppIcon struct {
func (s *CreativeNativeAdAppIcon) MarshalJSON() ([]byte, error) {
type noMethod CreativeNativeAdAppIcon
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// CreativeNativeAdImage: A large image.
Expand All @@ -687,7 +687,7 @@ type CreativeNativeAdImage struct {
func (s *CreativeNativeAdImage) MarshalJSON() ([]byte, error) {
type noMethod CreativeNativeAdImage
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// CreativeNativeAdLogo: A smaller image, for the advertiser logo.
Expand All @@ -710,7 +710,7 @@ type CreativeNativeAdLogo struct {
func (s *CreativeNativeAdLogo) MarshalJSON() ([]byte, error) {
type noMethod CreativeNativeAdLogo
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// CreativesList: The creatives feed lists the active creatives for the
Expand Down Expand Up @@ -744,7 +744,7 @@ type CreativesList struct {
func (s *CreativesList) MarshalJSON() ([]byte, error) {
type noMethod CreativesList
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// DirectDeal: The configuration data for an Ad Exchange direct deal.
Expand Down Expand Up @@ -813,7 +813,7 @@ type DirectDeal struct {
func (s *DirectDeal) MarshalJSON() ([]byte, error) {
type noMethod DirectDeal
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// DirectDealsList: A direct deals feed lists Direct Deals the Ad
Expand Down Expand Up @@ -842,7 +842,7 @@ type DirectDealsList struct {
func (s *DirectDealsList) MarshalJSON() ([]byte, error) {
type noMethod DirectDealsList
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// PerformanceReport: The configuration data for an Ad Exchange
Expand Down Expand Up @@ -943,7 +943,7 @@ type PerformanceReport struct {
func (s *PerformanceReport) MarshalJSON() ([]byte, error) {
type noMethod PerformanceReport
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// PerformanceReportList: The configuration data for an Ad Exchange
Expand Down Expand Up @@ -974,7 +974,7 @@ type PerformanceReportList struct {
func (s *PerformanceReportList) MarshalJSON() ([]byte, error) {
type noMethod PerformanceReportList
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

type PretargetingConfig struct {
Expand Down Expand Up @@ -1091,7 +1091,7 @@ type PretargetingConfig struct {
func (s *PretargetingConfig) MarshalJSON() ([]byte, error) {
type noMethod PretargetingConfig
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

type PretargetingConfigDimensions struct {
Expand All @@ -1113,7 +1113,7 @@ type PretargetingConfigDimensions struct {
func (s *PretargetingConfigDimensions) MarshalJSON() ([]byte, error) {
type noMethod PretargetingConfigDimensions
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

type PretargetingConfigExcludedPlacements struct {
Expand All @@ -1137,7 +1137,7 @@ type PretargetingConfigExcludedPlacements struct {
func (s *PretargetingConfigExcludedPlacements) MarshalJSON() ([]byte, error) {
type noMethod PretargetingConfigExcludedPlacements
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

type PretargetingConfigPlacements struct {
Expand All @@ -1161,7 +1161,7 @@ type PretargetingConfigPlacements struct {
func (s *PretargetingConfigPlacements) MarshalJSON() ([]byte, error) {
type noMethod PretargetingConfigPlacements
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

type PretargetingConfigList struct {
Expand All @@ -1187,7 +1187,7 @@ type PretargetingConfigList struct {
func (s *PretargetingConfigList) MarshalJSON() ([]byte, error) {
type noMethod PretargetingConfigList
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}

// method id "adexchangebuyer.accounts.get":
Expand Down
Loading

0 comments on commit cd02e6c

Please sign in to comment.