Commit 075b0c50 authored by Marcel Hellkamp's avatar Marcel Hellkamp
Browse files

Implemented strict-mode for scrolling

parent bde5c7ee
......@@ -373,12 +373,24 @@ class CDStar:
return self.rest("GET", vault, archive, file, params={"meta": ""})
return self.rest("GET", vault, archive, params={"meta": ""})
def scroll(self, vault, start="", limit=1024) -> JsonObject:
return self.rest("GET", vault, params={"scroll": start, "limit": limit})
def scroll(self, vault, start="", limit=1024, strict=False) -> JsonObject:
""" List IDs in a vault.
def iter_scroll(self, vault, start="", limit=1024) -> typing.Iterator[JsonObject]:
By default, all IDs that were ever created in that vault are
returned, including deleted or private archives. This requires
`list` permissions on the vault.
In strict mode (since 3.0.4) only archives load-able by the current
user are considered.
"""
params = {"scroll": start, "limit": limit}
if strict:
params["strict"] = strict
return self.rest("GET", vault, params=params)
def iter_scroll(self, vault, start="", limit=1024, strict=False) -> typing.Iterator[JsonObject]:
while True:
page = self.scroll(vault, start=start, limit=limit)
page = self.scroll(vault, start=start, limit=limit, strict=strict)
if not page["results"]:
break
yield from page["results"]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment