/*****************************************************************************
* Corpora                                                                    *
* Fetch requests for /corpora/<entity>/followers routes                      *
*****************************************************************************/
Requests.corpora.entity.followers = {};

Requests.corpora.entity.followers.add = (corpusId, usernames) => {
  let input = `/corpora/${corpusId}/followers`;
  let init = {
    method: 'POST',
    body: JSON.stringify(usernames)
  };
  return Requests.JSONfetch(input, init);
};

Requests.corpora.entity.followers.entity = {};

Requests.corpora.entity.followers.entity.delete = (corpusId, followerId) => {
  let input = `/corpora/${corpusId}/followers/${followerId}`;
  let init = {
    method: 'DELETE',
  };
  return Requests.JSONfetch(input, init);
};

Requests.corpora.entity.followers.entity.role = {};

Requests.corpora.entity.followers.entity.role.update = (corpusId, followerId, value) => {
  let input = `/corpora/${corpusId}/followers/${followerId}/role`;
  let init = {
    method: 'PUT',
    body: JSON.stringify(value)
  };
  return Requests.JSONfetch(input, init);
};
