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

# CertificateServiceImpl

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

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

  certificateServiceImpl
</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="searchResults" type="List<Certificate>">
  | Аргумент      | Тип      | Описание                      |
  | ------------- | -------- | ----------------------------- |
  | `requestJson` | `String` | Передаётся через `args[0].0`. |

  ### searchResults

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

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

  ### getRepository

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

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

  ### searchResultsPaged

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

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

  ### getPaginationFilter

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

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

  ### isCertificateExists

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

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

  ### isCertificateNotExists

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

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

  ### addCertificateToLoggedSeller

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

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

  ### removeCertificateFromLoggedSeller

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

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

  ### createCertificate

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

  ```json theme={null}
  {
      "id":  null,
      "logoUrl":  null,
      "name":  null,
      "fallIntoSellers":  null,
      "searchTerms":  null,
      "translations":  null,
      "imageURLs":  null,
      "expiredAt":  null
  }
  ```

  Request:

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

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

  ### saveCertificate

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

  ```json theme={null}
  {
      "id":  null,
      "logoUrl":  null,
      "name":  null,
      "fallIntoSellers":  null,
      "searchTerms":  null,
      "translations":  null,
      "imageURLs":  null,
      "expiredAt":  null
  }
  ```

  Request:

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

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

  ### addCertificateToSeller

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

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

  ### removeCertificateFromSeller

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

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

  ### removeCertificateAndClean

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

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

  ### removeCertificates

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

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

  ### addCertificatesByIds

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

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

  ### getSellerCertificates

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