Skip to content

Commit

Permalink
Merge pull request #28 from zak10/master
Browse files Browse the repository at this point in the history
Retrieve ProductBiddingCategory slice from API
  • Loading branch information
bbachtel authored May 31, 2017
2 parents 388f17d + c14278a commit 0576808
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 0 deletions.
28 changes: 28 additions & 0 deletions v201605/constant_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,34 @@ func (s *ConstantDataService) GetOperatingSystemVersionCriterion() (operatingSys
return getResp.OperatingSystemVersionCriterions, err
}

func (s *ConstantDataService) GetProductBiddingCategoryCriterion(selector Selector) (categoryData []ProductBiddingCategoryData, err error) {
respBody, err := s.Auth.request(
constantDataServiceUrl,
"getProductBiddingCategoryData",
struct {
XMLName xml.Name
Sel Selector
}{
XMLName: xml.Name{
Space: "https://adwords.google.com/api/adwords/cm/v201605",
Local: "getProductBiddingCategoryData",
},
Sel: selector,
},
)
if err != nil {
return categoryData, err
}
getResp := struct {
ProductBiddingCategoryDatas []ProductBiddingCategoryData `xml:"rval"`
}{}
err = xml.Unmarshal([]byte(respBody), &getResp)
if err != nil {
return categoryData, err
}
return getResp.ProductBiddingCategoryDatas, err
}

func (s *ConstantDataService) GetUserInterestCriterion() (userInterests []UserInterestCriterion, err error) {
respBody, err := s.Auth.request(
constantDataServiceUrl,
Expand Down
16 changes: 16 additions & 0 deletions v201605/criterion.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,22 @@ type ProductCriterion struct {
Text string `xml:"text,omitempty"`
}

// Represents a google_product_category level
type ProductBiddingCategory ProductDimension

type ProductBiddingCategoryData struct {
DimensionValue ProductBiddingCategory `xml:"dimensionValue"`
ParentDimensionValue ProductBiddingCategory `xml:"parentDimensionValue"`
Country string `xml:"country"`
Status string `xml:"status"`
DisplayValue []StringMapEntry `xml:"displayValue"`
}

type StringMapEntry struct {
Key string `xml:"key"`
Value string `xml:"value"`
}

type GeoPoint struct {
Latitude int64 `xml:"latitudeInMicroDegrees"`
Longitude int64 `xml:"longitudeInMicroDegrees"`
Expand Down
28 changes: 28 additions & 0 deletions v201607/constant_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,34 @@ func (s *ConstantDataService) GetOperatingSystemVersionCriterion() (operatingSys
return getResp.OperatingSystemVersionCriterions, err
}

func (s *ConstantDataService) GetProductBiddingCategoryCriterion(selector Selector) (categoryData []ProductBiddingCategoryData, err error) {
respBody, err := s.Auth.request(
constantDataServiceUrl,
"getProductBiddingCategoryData",
struct {
XMLName xml.Name
Sel Selector
}{
XMLName: xml.Name{
Space: "https://adwords.google.com/api/adwords/cm/v201607",
Local: "getProductBiddingCategoryData",
},
Sel: selector,
},
)
if err != nil {
return categoryData, err
}
getResp := struct {
ProductBiddingCategoryDatas []ProductBiddingCategoryData `xml:"rval"`
}{}
err = xml.Unmarshal([]byte(respBody), &getResp)
if err != nil {
return categoryData, err
}
return getResp.ProductBiddingCategoryDatas, err
}

func (s *ConstantDataService) GetUserInterestCriterion() (userInterests []UserInterestCriterion, err error) {
respBody, err := s.Auth.request(
constantDataServiceUrl,
Expand Down
16 changes: 16 additions & 0 deletions v201607/criterion.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,22 @@ type ProductCriterion struct {
Text string `xml:"text,omitempty"`
}

// Represents a google_product_category level
type ProductBiddingCategory ProductDimension

type ProductBiddingCategoryData struct {
DimensionValue ProductBiddingCategory `xml:"dimensionValue"`
ParentDimensionValue ProductBiddingCategory `xml:"parentDimensionValue"`
Country string `xml:"country"`
Status string `xml:"status"`
DisplayValue []StringMapEntry `xml:"displayValue"`
}

type StringMapEntry struct {
Key string `xml:"key"`
Value string `xml:"value"`
}

type GeoPoint struct {
Latitude int64 `xml:"latitudeInMicroDegrees"`
Longitude int64 `xml:"longitudeInMicroDegrees"`
Expand Down
28 changes: 28 additions & 0 deletions v201609/constant_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,34 @@ func (s *ConstantDataService) GetOperatingSystemVersionCriterion() (operatingSys
return getResp.OperatingSystemVersionCriterions, err
}

func (s *ConstantDataService) GetProductBiddingCategoryCriterion(selector Selector) (categoryData []ProductBiddingCategoryData, err error) {
respBody, err := s.Auth.request(
constantDataServiceUrl,
"getProductBiddingCategoryData",
struct {
XMLName xml.Name
Sel Selector
}{
XMLName: xml.Name{
Space: "https://adwords.google.com/api/adwords/cm/v201609",
Local: "getProductBiddingCategoryData",
},
Sel: selector,
},
)
if err != nil {
return categoryData, err
}
getResp := struct {
ProductBiddingCategoryDatas []ProductBiddingCategoryData `xml:"rval"`
}{}
err = xml.Unmarshal([]byte(respBody), &getResp)
if err != nil {
return categoryData, err
}
return getResp.ProductBiddingCategoryDatas, err
}

func (s *ConstantDataService) GetUserInterestCriterion() (userInterests []UserInterestCriterion, err error) {
respBody, err := s.Auth.request(
constantDataServiceUrl,
Expand Down
16 changes: 16 additions & 0 deletions v201609/criterion.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,22 @@ type ProductCriterion struct {
Text string `xml:"text,omitempty"`
}

// Represents a google_product_category level
type ProductBiddingCategory ProductDimension

type ProductBiddingCategoryData struct {
DimensionValue ProductBiddingCategory `xml:"dimensionValue"`
ParentDimensionValue ProductBiddingCategory `xml:"parentDimensionValue"`
Country string `xml:"country"`
Status string `xml:"status"`
DisplayValue []StringMapEntry `xml:"displayValue"`
}

type StringMapEntry struct {
Key string `xml:"key"`
Value string `xml:"value"`
}

type GeoPoint struct {
Latitude int64 `xml:"latitudeInMicroDegrees"`
Longitude int64 `xml:"longitudeInMicroDegrees"`
Expand Down

0 comments on commit 0576808

Please sign in to comment.