You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
decort-golang-sdk/pkg/cloudapi/user/search.go

34 lines
635 B

package user
import (
"context"
"encoding/json"
"net/http"
)
// SearchRequest struct for searching user's elements.
type SearchRequest struct {
// Text to search
// Required: true
Text string `url:"text" json:"text" validate:"required"`
}
// Search searches for user's elements.
func (u User) Search(ctx context.Context, req SearchRequest) (*FoundElements, error) {
url := "/cloudapi/user/search"
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
list := FoundElements{}
err = json.Unmarshal(res, &list)
if err != nil {
return nil, err
}
return &list, nil
}