> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mastermindcms.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CustomerAnalyticsServiceImpl

> Вызов публичных методов сервиса через REST API: customerAnalyticsServiceImpl

<ResponseField name="beanId" type="string">
  Идентификатор Spring bean, который содержит вызываемый сервис.

  customerAnalyticsServiceImpl
</ResponseField>

<ResponseField name="scope" type="string" default="PROTOTYPE">
  Область действия bean. Для вызовов сервисов используется PROTOTYPE.
</ResponseField>

<ResponseField name="functionName" type="string">
  Имя публичного метода сервиса, указанное в сигнатуре ниже.
</ResponseField>

<ResponseField name="args" type="object[]">
  Массив аргументов метода. Каждый аргумент передаётся объектом с индексом 0, 1 и т. д.; значение должно соответствовать Java-типу параметра.
</ResponseField>

## Headers

```http theme={null}
POST /api/v1/bean/request
Content-Type: application/json
Lang-Context: ru
Site-Context: my-site
Authorization: Bearer <token>
```

Заголовки `Lang-Context` и `Site-Context` необходимо передавать в каждом запросе. Для защищённых методов передавайте JWT в заголовке `Authorization` в формате `Bearer <token>`.

**Доступ:** ADMIN. **Bearer Token:** требуется.

* GUEST — без логина; доступен только whitelist.
* USER — требуется авторизация; доступны методы с проверкой USER.
* ADMIN — полный доступ к public-методам всех сервисов.
* Если метод проверяет роль внутри логики, GUEST может получить null.

## Методы

<ResponseField name="getCustomerActivity" type="Page<CustomerActivity>">
  | Аргумент  | Тип                             | Описание                      |
  | --------- | ------------------------------- | ----------------------------- |
  | `request` | `LinkedHashMap<String, Object>` | Передаётся через `args[0].0`. |

  ### getCustomerActivity

  Пример JSON объекта запроса:

  ```json theme={null}
  {
      "type":  "SellerSKU",
      "searchTerm":  "",
      "query":  {
                    "isPublishedForSale":  true
                },
      "ignoreRegexWrap":  [
                              "id",
                              "name",
                              "embeddedSku",
                              "productsRef",
                              "isPublishedForSale"
                          ],
      "offset":  0,
      "limit":  10,
      "visiblePages":  10,
      "page":  1,
      "sortName":  "createdDate",
      "sortDirection":  "DESC"
  }
  ```

  Request:

  ```json theme={null}
  {
    "beanId": "customerAnalyticsServiceImpl",
    "scope": "PROTOTYPE",
    "functionName": "getCustomerActivity",
    "args": [
      {
        "0": null
      }
    ]
  }
  ```
</ResponseField>

<ResponseField name="getRegisteredCustomersChart" type="ChartData">
  | Аргумент | Тип | Описание                      |
  | -------- | --- | ----------------------------- |
  | —        | —   | Метод не принимает аргументы. |

  ### getRegisteredCustomersChart

  ```json theme={null}
  {
    "beanId": "customerAnalyticsServiceImpl",
    "scope": "PROTOTYPE",
    "functionName": "getRegisteredCustomersChart",
    "args": []
  }
  ```
</ResponseField>

<ResponseField name="getRegisteredCompaniesByCountry" type="Map<String, Integer>">
  | Аргумент | Тип | Описание                      |
  | -------- | --- | ----------------------------- |
  | —        | —   | Метод не принимает аргументы. |

  ### getRegisteredCompaniesByCountry

  ```json theme={null}
  {
    "beanId": "customerAnalyticsServiceImpl",
    "scope": "PROTOTYPE",
    "functionName": "getRegisteredCompaniesByCountry",
    "args": []
  }
  ```
</ResponseField>

<ResponseField name="getRegisteredCompaniesByType" type="Map<String, Integer>">
  | Аргумент | Тип | Описание                      |
  | -------- | --- | ----------------------------- |
  | —        | —   | Метод не принимает аргументы. |

  ### getRegisteredCompaniesByType

  ```json theme={null}
  {
    "beanId": "customerAnalyticsServiceImpl",
    "scope": "PROTOTYPE",
    "functionName": "getRegisteredCompaniesByType",
    "args": []
  }
  ```
</ResponseField>
