# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# See https://github.com/eolymp/contracts/tree/main/cmd/protoc-gen-python-esdk for more details.
"""Generated protocol buffer code."""

import urllib.parse
from google.protobuf import symbol_database as _symbol_database

_sym_db = _symbol_database.Default()


class KeeperClient:
    def __init__(self, transport, url="https://api.eolymp.com"):
        self.transport = transport
        self.url = url

    def CreateObject(self, request, **kwargs):
        path = "/objects"

        return self.transport.request(
            method="POST",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.keeper.CreateObjectOutput"),
            **kwargs,
        )

    def DescribeObject(self, request, **kwargs):
        path = "/objects/"+urllib.parse.quote(request.key)

        # Cleanup URL parameters to avoid any ambiguity
        request.key = ""

        return self.transport.request(
            method="GET",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.keeper.DescribeObjectOutput"),
            **kwargs,
        )

    def DownloadObject(self, request, **kwargs):
        path = "/objects/"+urllib.parse.quote(request.key)+"/data"

        # Cleanup URL parameters to avoid any ambiguity
        request.key = ""

        return self.transport.request(
            method="GET",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.keeper.DownloadObjectOutput"),
            **kwargs,
        )

    def StartMultipartUpload(self, request, **kwargs):
        path = "/uploads"

        return self.transport.request(
            method="POST",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.keeper.StartMultipartUploadOutput"),
            **kwargs,
        )

    def UploadPart(self, request, **kwargs):
        path = "/objects/"+urllib.parse.quote(request.object_id)+"/parts"

        # Cleanup URL parameters to avoid any ambiguity
        request.object_id = ""

        return self.transport.request(
            method="POST",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.keeper.UploadPartOutput"),
            **kwargs,
        )

    def CompleteMultipartUpload(self, request, **kwargs):
        path = "/objects/"+urllib.parse.quote(request.object_id)+"/complete"

        # Cleanup URL parameters to avoid any ambiguity
        request.object_id = ""

        return self.transport.request(
            method="POST",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.keeper.CompleteMultipartUploadOutput"),
            **kwargs,
        )

