Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def delete_collection(self):
e = native.get_error_pointer()
self._native('delete_collection')(e)
native.check_error(e)
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)
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)
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)
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)
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
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
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
def flush(self):
e = native.get_error_pointer()
self._native('flush')(e)
native.check_error(e)
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)