v9.0.0
This commit is contained in:
1 parent
b924e85e49
commit
f1ffb4c0fd
1108 files changed
+72020
No files matched your search
@@ -0,0 +1,33 @@
|
||||
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
|
||||
}
|
||||
Reference in new issue
Block a user