class ApiKeys:
    def __init__(self, client):
        self.client = client

    def list(self):
        return self.client.request("GET", "/api-keys")

    def create(self, name, permissions=None):
        data = {"name": name}
        if permissions:
            data["permissions"] = permissions
        else:
            data["permissions"] = ["read", "write"]
        return self.client.request("POST", "/api-keys", json=data)

    def revoke(self, key_id):
        return self.client.request("PATCH", f"/api-keys/{key_id}/revoke")

    def delete(self, key_id):
        return self.client.request("DELETE", f"/api-keys/{key_id}")
