const getEndpoints = initRequest => {
  return initRequest({
    method: 'GET',
    path: 'tutorials/endpoints',
  });
};

const getCodeSnippets = (initRequest, data) => {
  return initRequest({
    method: 'POST',
    path: 'tutorials/getCodeSnippets',
    body: JSON.stringify(data),
  });
};

const getCodeString = (initRequest, data) => {
  return initRequest({
    method: 'POST',
    path: 'tutorials/getCodeString',
    body: JSON.stringify(data),
  });
};

const createTutorial = (initRequest, data) => {
  return initRequest({
    method: 'POST',
    path: 'tutorials',
    body: JSON.stringify(data),
  });
};

const updateTutorial = (initRequest, data) => {
  return initRequest({
    method: 'PUT',
    path: `tutorials/${data._id}`,
    body: JSON.stringify(data),
  });
};

const updateOnboarding = (initRequest, data) => {
  return initRequest({
    method: 'POST',
    path: `tutorials/onboarding`,
    body: JSON.stringify(data),
  });
};

export { getEndpoints, getCodeSnippets, getCodeString, createTutorial, updateTutorial, updateOnboarding };
