from __future__ import annotations

import urllib.parse
from typing import Any, Dict, Optional

from ..client import Client

class AuthorsResource:
    def __init__(self, client: Client) -> None:
        self._client = client

    def create(self, body: Any, *, query: Optional[Dict[str, Any]] = None):
        return self._client.request("POST", "/authors/create", query=query, body=body)

    def update(self, body: Any, *, query: Optional[Dict[str, Any]] = None):
        return self._client.request("PUT", "/authors/update", query=query, body=body)

    def deleteId(self, id, *, query: Optional[Dict[str, Any]] = None):
        return self._client.request("DELETE", "/authors/delete/" + urllib.parse.quote(str(id)), query=query, body=None)

    def getAll(self, *, query: Optional[Dict[str, Any]] = None):
        return self._client.request("GET", "/authors/getAll", query=query, body=None)

    def getById(self, id, *, query: Optional[Dict[str, Any]] = None):
        return self._client.request("GET", "/authors/getById/" + urllib.parse.quote(str(id)), query=query, body=None)

    def getBySlug(self, slug, *, query: Optional[Dict[str, Any]] = None):
        return self._client.request("GET", "/authors/getBySlug/" + urllib.parse.quote(str(slug)), query=query, body=None)
