diff --git a/README.md b/README.md index 6d90616..e572c1d 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ go get hub.rudder.build/rudder/rudder-go-sdk@latest ## Доступ -`APIKey` — это per-project Admin Key: поле «Admin Key» в настройках проекта +`AdminKey` — это per-project Admin Key: поле «Admin Key» в настройках проекта в дашборде (app.rudder.build → проект → Settings). Ключ сам определяет проект, отдельный project ID не нужен. Храните его только на сервере — никогда не вшивайте в игровые клиенты. @@ -32,7 +32,7 @@ go get hub.rudder.build/rudder/rudder-go-sdk@latest ```go client, err := rudder.New(rudder.Config{ - APIKey: os.Getenv("RUDDER_ADMIN_KEY"), + AdminKey: os.Getenv("RUDDER_ADMIN_KEY"), }) if err != nil { // *rudder.APIError с кодом sdk/invalid-options diff --git a/client.go b/client.go index 64e0e42..87f5cd5 100644 --- a/client.go +++ b/client.go @@ -8,7 +8,7 @@ import ( const DefaultBaseURL = "https://api.rudder.build" type Config struct { - APIKey string + AdminKey string BaseURL string Timeout time.Duration HTTPClient *http.Client @@ -26,8 +26,8 @@ type Client struct { } func New(config Config) (*Client, error) { - if config.APIKey == "" { - return nil, &APIError{Code: ErrorCodeInvalidOptions, Message: "APIKey is required"} + if config.AdminKey == "" { + return nil, &APIError{Code: ErrorCodeInvalidOptions, Message: "AdminKey is required"} } if config.BaseURL == "" { @@ -42,7 +42,7 @@ func New(config Config) (*Client, error) { transport := &transport{ baseURL: config.BaseURL, - apiKey: config.APIKey, + apiKey: config.AdminKey, httpClient: config.HTTPClient, } diff --git a/projectstorage.go b/projectstorage.go index c2a0383..296ea11 100644 --- a/projectstorage.go +++ b/projectstorage.go @@ -16,6 +16,7 @@ type ProjectStorageService struct { type ListProjectStorageParameters struct { Limit int Cursor string + Search string } func (s *ProjectStorageService) List(ctx context.Context, parameters ListProjectStorageParameters) (*models.GetProjectStorageResponse, error) { @@ -26,6 +27,9 @@ func (s *ProjectStorageService) List(ctx context.Context, parameters ListProject if parameters.Cursor != "" { query.Set("cursor", parameters.Cursor) } + if parameters.Search != "" { + query.Set("search", parameters.Search) + } var response models.GetProjectStorageResponse if err := s.transport.do(ctx, http.MethodGet, "/project-storage", query, nil, &response); err != nil {