Skip to content

Commit

Permalink
fix(Global Search): remove is_hidden param from search operation (#239)
Browse files Browse the repository at this point in the history
Signed-off-by: francescadecicco <francescadecicco@it.ibm.com>
  • Loading branch information
francescadecicco committed Mar 7, 2023
1 parent df61d02 commit 67937e4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 33 deletions.
24 changes: 1 addition & 23 deletions globalsearchv2/global_search_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

/*
* IBM OpenAPI SDK Code Generator Version: 3.63.0-5dae26c1-20230111-193039
* IBM OpenAPI SDK Code Generator Version: 3.67.0-df2073a1-20230222-221157
*/

// Package globalsearchv2 : Operations and models for the GlobalSearchV2 service
Expand Down Expand Up @@ -247,9 +247,6 @@ func (globalSearch *GlobalSearchV2) SearchWithContext(ctx context.Context, searc
if searchOptions.CanTag != nil {
builder.AddQuery("can_tag", fmt.Sprint(*searchOptions.CanTag))
}
if searchOptions.IsHidden != nil {
builder.AddQuery("is_hidden", fmt.Sprint(*searchOptions.IsHidden))
}

body := make(map[string]interface{})
if searchOptions.Query != nil {
Expand Down Expand Up @@ -521,10 +518,6 @@ type SearchOptions struct {
// only resources that user has permissions for tagging are returned (_for administrators only_).
CanTag *string `json:"can_tag,omitempty"`

// Determines if the result set must return only the visible resources or not. If false (default), only visible
// resources are returned; if true, only hidden resources are returned; if any, all resources are returned.
IsHidden *string `json:"is_hidden,omitempty"`

// Allows users to set headers on API requests
Headers map[string]string
}
Expand Down Expand Up @@ -575,15 +568,6 @@ const (
SearchOptionsCanTagTrueConst = "true"
)

// Constants associated with the SearchOptions.IsHidden property.
// Determines if the result set must return only the visible resources or not. If false (default), only visible
// resources are returned; if true, only hidden resources are returned; if any, all resources are returned.
const (
SearchOptionsIsHiddenAnyConst = "any"
SearchOptionsIsHiddenFalseConst = "false"
SearchOptionsIsHiddenTrueConst = "true"
)

// NewSearchOptions : Instantiate SearchOptions
func (*GlobalSearchV2) NewSearchOptions() *SearchOptions {
return &SearchOptions{}
Expand Down Expand Up @@ -673,12 +657,6 @@ func (_options *SearchOptions) SetCanTag(canTag string) *SearchOptions {
return _options
}

// SetIsHidden : Allow user to set IsHidden
func (_options *SearchOptions) SetIsHidden(isHidden string) *SearchOptions {
_options.IsHidden = core.StringPtr(isHidden)
return _options
}

// SetHeaders : Allow user to set Headers
func (options *SearchOptions) SetHeaders(param map[string]string) *SearchOptions {
options.Headers = param
Expand Down
10 changes: 0 additions & 10 deletions globalsearchv2/global_search_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ var _ = Describe(`GlobalSearchV2`, func() {
Expect(req.URL.Query()["is_public"]).To(Equal([]string{"false"}))
Expect(req.URL.Query()["impersonate_user"]).To(Equal([]string{"testString"}))
Expect(req.URL.Query()["can_tag"]).To(Equal([]string{"false"}))
Expect(req.URL.Query()["is_hidden"]).To(Equal([]string{"false"}))
res.Header().Set("Content-type", "application/json")
res.WriteHeader(200)
fmt.Fprint(res, `} this is not valid json {`)
Expand Down Expand Up @@ -214,7 +213,6 @@ var _ = Describe(`GlobalSearchV2`, func() {
searchOptionsModel.IsPublic = core.StringPtr("false")
searchOptionsModel.ImpersonateUser = core.StringPtr("testString")
searchOptionsModel.CanTag = core.StringPtr("false")
searchOptionsModel.IsHidden = core.StringPtr("false")
searchOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"}
// Expect response parsing to fail since we are receiving a text/plain response
result, response, operationErr := globalSearchService.Search(searchOptionsModel)
Expand Down Expand Up @@ -272,7 +270,6 @@ var _ = Describe(`GlobalSearchV2`, func() {
Expect(req.URL.Query()["is_public"]).To(Equal([]string{"false"}))
Expect(req.URL.Query()["impersonate_user"]).To(Equal([]string{"testString"}))
Expect(req.URL.Query()["can_tag"]).To(Equal([]string{"false"}))
Expect(req.URL.Query()["is_hidden"]).To(Equal([]string{"false"}))
// Sleep a short time to support a timeout test
time.Sleep(100 * time.Millisecond)

Expand Down Expand Up @@ -307,7 +304,6 @@ var _ = Describe(`GlobalSearchV2`, func() {
searchOptionsModel.IsPublic = core.StringPtr("false")
searchOptionsModel.ImpersonateUser = core.StringPtr("testString")
searchOptionsModel.CanTag = core.StringPtr("false")
searchOptionsModel.IsHidden = core.StringPtr("false")
searchOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"}

// Invoke operation with a Context to test a timeout error
Expand Down Expand Up @@ -371,7 +367,6 @@ var _ = Describe(`GlobalSearchV2`, func() {
Expect(req.URL.Query()["is_public"]).To(Equal([]string{"false"}))
Expect(req.URL.Query()["impersonate_user"]).To(Equal([]string{"testString"}))
Expect(req.URL.Query()["can_tag"]).To(Equal([]string{"false"}))
Expect(req.URL.Query()["is_hidden"]).To(Equal([]string{"false"}))
// Set mock response
res.Header().Set("Content-type", "application/json")
res.WriteHeader(200)
Expand Down Expand Up @@ -408,7 +403,6 @@ var _ = Describe(`GlobalSearchV2`, func() {
searchOptionsModel.IsPublic = core.StringPtr("false")
searchOptionsModel.ImpersonateUser = core.StringPtr("testString")
searchOptionsModel.CanTag = core.StringPtr("false")
searchOptionsModel.IsHidden = core.StringPtr("false")
searchOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"}

// Invoke operation with valid options model (positive test)
Expand Down Expand Up @@ -442,7 +436,6 @@ var _ = Describe(`GlobalSearchV2`, func() {
searchOptionsModel.IsPublic = core.StringPtr("false")
searchOptionsModel.ImpersonateUser = core.StringPtr("testString")
searchOptionsModel.CanTag = core.StringPtr("false")
searchOptionsModel.IsHidden = core.StringPtr("false")
searchOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"}
// Invoke operation with empty URL (negative test)
err := globalSearchService.SetServiceURL("")
Expand Down Expand Up @@ -490,7 +483,6 @@ var _ = Describe(`GlobalSearchV2`, func() {
searchOptionsModel.IsPublic = core.StringPtr("false")
searchOptionsModel.ImpersonateUser = core.StringPtr("testString")
searchOptionsModel.CanTag = core.StringPtr("false")
searchOptionsModel.IsHidden = core.StringPtr("false")
searchOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"}

// Invoke operation
Expand Down Expand Up @@ -736,7 +728,6 @@ var _ = Describe(`GlobalSearchV2`, func() {
searchOptionsModel.SetIsPublic("false")
searchOptionsModel.SetImpersonateUser("testString")
searchOptionsModel.SetCanTag("false")
searchOptionsModel.SetIsHidden("false")
searchOptionsModel.SetHeaders(map[string]string{"foo": "bar"})
Expect(searchOptionsModel).ToNot(BeNil())
Expect(searchOptionsModel.Query).To(Equal(core.StringPtr("testString")))
Expand All @@ -753,7 +744,6 @@ var _ = Describe(`GlobalSearchV2`, func() {
Expect(searchOptionsModel.IsPublic).To(Equal(core.StringPtr("false")))
Expect(searchOptionsModel.ImpersonateUser).To(Equal(core.StringPtr("testString")))
Expect(searchOptionsModel.CanTag).To(Equal(core.StringPtr("false")))
Expect(searchOptionsModel.IsHidden).To(Equal(core.StringPtr("false")))
Expect(searchOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"}))
})
})
Expand Down

0 comments on commit 67937e4

Please sign in to comment.