> ## 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.

# CategoryServiceImpl

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

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

  categoryServiceImpl
</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>`.

**Доступ:** GUEST\* / USER или ADMIN. **Bearer Token:** условно для USER/ADMIN.

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

## Методы

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

  ### getRepository

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

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

  ### getPaginationFilter

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

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

  ### searchCategories

  Пример 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": "categoryServiceImpl",
    "scope": "PROTOTYPE",
    "functionName": "searchCategories",
    "args": [
      {
        "0": null
      }
    ]
  }
  ```
</ResponseField>

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

  ### searchCategoriesLightweight

  Пример 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": "categoryServiceImpl",
    "scope": "PROTOTYPE",
    "functionName": "searchCategoriesLightweight",
    "args": [
      {
        "0": null
      }
    ]
  }
  ```
</ResponseField>

<ResponseField name="searchCategories" type="LinkedHashSet<CategoryDTO>">
  | Аргумент      | Тип      | Описание                      |
  | ------------- | -------- | ----------------------------- |
  | `requestJson` | `String` | Передаётся через `args[0].0`. |

  ### searchCategories

  Пример 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": "categoryServiceImpl",
    "scope": "PROTOTYPE",
    "functionName": "searchCategories",
    "args": [
      {
        "0": null
      }
    ]
  }
  ```
</ResponseField>

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

  ### searchCategoriesPaged

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

<ResponseField name="searchCategories" type="List<Category>">
  | Аргумент | Тип      | Описание                      |
  | -------- | -------- | ----------------------------- |
  | `query`  | `String` | Передаётся через `args[0].0`. |
  | `from`   | `String` | Передаётся через `args[1].1`. |
  | `to`     | `String` | Передаётся через `args[2].2`. |

  ### searchCategories

  ```json theme={null}
  {
    "beanId": "categoryServiceImpl",
    "scope": "PROTOTYPE",
    "functionName": "searchCategories",
    "args": [
      {
        "0": null,
        "1": null,
        "2": null
      }
    ]
  }
  ```
</ResponseField>

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

  ### createCategory

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

  ```json theme={null}
  {
      "id":  null,
      "name":  null,
      "parentId":  null,
      "description":  null,
      "active":  false,
      "keywords":  null,
      "searchTerms":  null,
      "translations":  null,
      "productsOfCategory":  null,
      "children":  null,
      "imageURLs":  null
  }
  ```

  Request:

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

<ResponseField name="addChildCategory" type="Category">
  | Аргумент   | Тип      | Описание                      |
  | ---------- | -------- | ----------------------------- |
  | `parentId` | `String` | Передаётся через `args[0].0`. |
  | `childId`  | `String` | Передаётся через `args[1].1`. |

  ### addChildCategory

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

<ResponseField name="removeChildCategory" type="void">
  | Аргумент   | Тип      | Описание                      |
  | ---------- | -------- | ----------------------------- |
  | `parentId` | `String` | Передаётся через `args[0].0`. |
  | `childId`  | `String` | Передаётся через `args[1].1`. |

  ### removeChildCategory

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

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

  ### updateCategory

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

  ```json theme={null}
  {
      "id":  null,
      "name":  null,
      "parentId":  null,
      "description":  null,
      "active":  false,
      "keywords":  null,
      "searchTerms":  null,
      "translations":  null,
      "productsOfCategory":  null,
      "children":  null,
      "imageURLs":  null
  }
  ```

  Request:

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

<ResponseField name="removeCategoryFromTranslation" type="void">
  | Аргумент        | Тип      | Описание                      |
  | --------------- | -------- | ----------------------------- |
  | `categoryId`    | `String` | Передаётся через `args[0].0`. |
  | `translationId` | `String` | Передаётся через `args[1].1`. |

  ### removeCategoryFromTranslation

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

<ResponseField name="removeCategoryWithDescendants" type="void">
  | Аргумент | Тип      | Описание                      |
  | -------- | -------- | ----------------------------- |
  | `itemId` | `String` | Передаётся через `args[0].0`. |

  ### removeCategoryWithDescendants

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

<ResponseField name="removeCategoriesByIds" type="void">
  | Аргумент        | Тип                 | Описание                      |
  | --------------- | ------------------- | ----------------------------- |
  | `categoriesIds` | `ArrayList<String>` | Передаётся через `args[0].0`. |

  ### removeCategoriesByIds

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

<ResponseField name="lookupToParents" type="List<String>">
  | Аргумент     | Тип            | Описание                      |
  | ------------ | -------------- | ----------------------------- |
  | `categoryId` | `String`       | Передаётся через `args[0].0`. |
  | `result`     | `List<String>` | Передаётся через `args[1].1`. |

  ### lookupToParents

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