Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multioptionids #150

Open
wants to merge 4 commits into
base: entities
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions customfield_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,31 @@ func (c *CustomFieldManager) MustMultiOptionIds(fieldName string, optionNames ..
return ToUnorderedStrings(optionIds)
}

func (c *CustomFieldManager) GetMultiOptionIds(fieldName string, optionNames ...string) (*UnorderedStrings, error) {
if len(optionNames) == 0 {
return c.NullMultiOption()
}
var optionIds = []string{}
for _, optionName := range optionNames {
id, err := c.CustomFieldOptionId(fieldName, optionName)
if err != nil {
return nil, err
}
shouldAddOptionId := true
for _, optionId := range optionIds {
if id == optionId { // Don't add duplicate option ids
shouldAddOptionId = false
break
}
}

if shouldAddOptionId {
optionIds = append(optionIds, id)
}
}
return ToUnorderedStrings(optionIds), nil
}

func (c *CustomFieldManager) MustIsMultiOptionSet(fieldName string, optionName string, setOptionIds *UnorderedStrings) bool {
if setOptionIds == nil {
return false
Expand Down
10 changes: 5 additions & 5 deletions entity_hotel.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ type HotelEntity struct {
InstagramHandle *string `json:"instagramHandle,omitempty"`
TwitterHandle *string `json:"twitterHandle,omitempty"`

GoogleCoverPhoto **Image `json:"googleCoverPhoto,omitempty"`
GooglePreferredPhoto *string `json:"googlePreferredPhoto,omitempty"`
GoogleProfilePhoto **Image `json:"googleProfilePhoto,omitempty"`
GoogleWebsiteOverride *string `json:"googleWebsiteOverride,omitempty"`
GoogleAttributes *map[string][]string `json:"googleAttributes,omitempty"`
GoogleCoverPhoto **Image `json:"googleCoverPhoto,omitempty"`
GooglePreferredPhoto *string `json:"googlePreferredPhoto,omitempty"`
GoogleProfilePhoto **Image `json:"googleProfilePhoto,omitempty"`
GoogleWebsiteOverride *string `json:"googleWebsiteOverride,omitempty"`
GoogleAttributes *map[string][]string `json:"googleAttributes,omitempty"`

// Media
Logo **Photo `json:"logo,omitempty"`
Expand Down