Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version to async client and docfix #30

Merged
merged 4 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Release History
===============

2.12.2 (2024-05-02)
perastov marked this conversation as resolved.
Show resolved Hide resolved
-------------------
- Add .version() method to CybsiAsyncClient
- Docfix of DictionaryItemForm and DictItemAttributeValue
- Fix stored query filter

2.12.1 (2024-04-26)
-------------------
- Fix api key generation
Expand Down
2 changes: 1 addition & 1 deletion cybsi/__version__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "2.12.1"
__version__ = "2.12.2"
__title__ = "cybsi-python-sdk"
__description__ = "Cybersecurity threat intelligence development kit"
__license__ = "Apache License 2.0"
Expand Down
13 changes: 13 additions & 0 deletions cybsi/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,19 @@ def observable(self) -> ObservableAsyncAPI:
"""Observable API handle."""
return ObservableAsyncAPI(self._connector)

async def version(self) -> "VersionView":
"""Get API and server version information.

Note:
Calls `GET /version`.
Returns:
Version view.
"""

path = "/version"
resp = await self._connector.do_get(path)
return VersionView(resp.json())


class VersionView(JsonObjectView):
"""Version view."""
Expand Down
10 changes: 6 additions & 4 deletions cybsi/api/dictionary/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,9 @@ class DictionaryItemForm(JsonObjectForm):
Args:
dictionary_uuid: Dictionary identifier.
key: Dictionary item key. The key should consist of characters
according to the pattern `[a-zA-Z0-9_ -]` and
have length in the range `[1;30]`.
according to the pattern `[a-zA-Z0-9_ :.@-]` and
have length in the range `[1;50]`.
First and last char of key can't be space-symbol
User-specified key case is preserved.
"""

Expand All @@ -377,8 +378,9 @@ class DictItemAttributeValue(JsonObjectForm):

Args:
key: Dictionary item key. The key should consist of characters
according to the pattern `[a-zA-Z0-9_ -]` and
have length in the range `[1;30]`.
according to the pattern `[a-zA-Z0-9_ :.@-]` and
have length in the range `[1;50]`.
First and last char of key can't be space-symbol
User-specified key case is preserved.
"""

Expand Down
1 change: 1 addition & 0 deletions cybsi/api/search/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
StoredQueryForm,
StoredQueryValidationView,
StoredQueryView,
StoredQueryFilterView,
CybsiLangErrorView,
ErrorPosition,
)
15 changes: 10 additions & 5 deletions cybsi/api/search/stored_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def filter(
user_uuid: Optional[uuid.UUID] = None,
cursor: Optional[Cursor] = None,
limit: Optional[int] = None,
) -> Page["StoredQueryView"]:
) -> Page["StoredQueryFilterView"]:
"""Get page of filtered stored queries list.

Note:
Expand Down Expand Up @@ -138,7 +138,7 @@ def filter(
params["limit"] = str(limit)

resp = self._connector.do_get(self._path, params=params)
page = Page(self._connector.do_get, resp, StoredQueryView)
page = Page(self._connector.do_get, resp, StoredQueryFilterView)
return page


Expand Down Expand Up @@ -264,9 +264,9 @@ def name(self) -> str:
return self._get("name")


class StoredQueryView(_TaggedRefView, StoredQueryCommonView):
"""View of a stored query,
as retrieved by :meth:`StoredQueriesAPI.view`."""
class StoredQueryFilterView(StoredQueryCommonView):
"""Filter view of a stored query,
as retrieved by :meth:`StoredQueriesAPI.filter`."""

@property
def text(self) -> str:
Expand All @@ -279,3 +279,8 @@ def author(self) -> RefView:
"""User, author of the query."""

return RefView(self._get("author"))


class StoredQueryView(_TaggedRefView, StoredQueryFilterView):
"""View of a stored query,
as retrieved by :meth:`StoredQueriesAPI.view`."""
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cybsi-sdk"
version = "2.12.1"
version = "2.12.2"
description = "Cybsi development kit"
authors = ["Cybsi SDK developers"]
license = "Apache License 2.0"
Expand Down Expand Up @@ -42,7 +42,7 @@ extend_skip = ["__init__.py"]
[tool.tbump]

[tool.tbump.version]
current = "2.12.1"
current = "2.12.2"

regex = '''
^
Expand Down
Loading