How to use the vdirsyncer.native.check_error function in vdirsyncer

To help you get started, we’ve selected a few vdirsyncer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pimutils / vdirsyncer / vdirsyncer / storage / _rust.py View on Github external
def delete_collection(self):
        e = native.get_error_pointer()
        self._native('delete_collection')(e)
        native.check_error(e)
github pimutils / vdirsyncer / vdirsyncer / storage / _rust.py View on Github external
def create_collection(cls, **kwargs):
        try:
            discover = cls._static_native('create')
        except AttributeError:
            raise NotImplementedError()

        e = native.get_error_pointer()
        rv = discover(
            json.dumps(kwargs).encode('utf-8'),
            e
        )
        native.check_error(e)
        rv = native.string_rv(rv)
        return json.loads(rv)
github pimutils / vdirsyncer / vdirsyncer / storage / _rust.py View on Github external
def discover(cls, **kwargs):
        try:
            discover = cls._static_native('discover')
        except AttributeError:
            raise NotImplementedError()

        e = native.get_error_pointer()
        rv = discover(
            json.dumps(kwargs).encode('utf-8'),
            e
        )
        native.check_error(e)
        rv = native.string_rv(rv)
        return json.loads(rv)
github pimutils / vdirsyncer / vdirsyncer / storage / _rust.py View on Github external
def set_meta(self, key, value):
        enum_variant = _map_meta_key(key)
        e = native.get_error_pointer()
        self._native('set_meta')(
            enum_variant,
            (value or '').encode('utf-8'),
            e
        )
        native.check_error(e)
github pimutils / vdirsyncer / vdirsyncer / storage / _rust.py View on Github external
def delete(self, href, etag):
        href = href.encode('utf-8')
        etag = etag.encode('utf-8')
        e = native.get_error_pointer()
        self._native('delete')(href, etag, e)
        native.check_error(e)
github pimutils / vdirsyncer / vdirsyncer / storage / _rust.py View on Github external
def update(self, href, item, etag):
        href = href.encode('utf-8')
        etag = etag.encode('utf-8')
        e = native.get_error_pointer()
        etag = self._native('update')(href, item._native, etag, e)
        native.check_error(e)
        return native.string_rv(etag) or None
github pimutils / vdirsyncer / vdirsyncer / storage / _rust.py View on Github external
def get(self, href):
        href = href.encode('utf-8')
        e = native.get_error_pointer()
        result = self._native('get')(href, e)
        native.check_error(e)
        result = native.ffi.gc(result,
                               native.lib.vdirsyncer_free_storage_get_result)
        item = native.item_rv(result.item)
        etag = native.string_rv(result.etag)
        return Item(None, _native=item), etag
github pimutils / vdirsyncer / vdirsyncer / storage / _rust.py View on Github external
def upload(self, item):
        e = native.get_error_pointer()
        result = self._native('upload')(item._native, e)
        native.check_error(e)
        result = native.ffi.gc(
            result, native.lib.vdirsyncer_free_storage_upload_result)
        href = native.string_rv(result.href)
        etag = native.string_rv(result.etag)
        return href, etag or None
github pimutils / vdirsyncer / vdirsyncer / storage / _rust.py View on Github external
def flush(self):
        e = native.get_error_pointer()
        self._native('flush')(e)
        native.check_error(e)
github pimutils / vdirsyncer / vdirsyncer / storage / _rust.py View on Github external
def get_meta(self, key):
        enum_variant = _map_meta_key(key)
        e = native.get_error_pointer()
        rv = self._native('get_meta')(enum_variant, e)
        native.check_error(e)
        return native.string_rv(rv)