Skip to content

Commit 6c91baa

Browse files
authored
Merge pull request #12 from crowdsecurity/$main-1f9141a
Update python SDK version: 1.63.0
2 parents 1f9141a + 8d23bab commit 6c91baa

File tree

11 files changed

+64
-19
lines changed

11 files changed

+64
-19
lines changed

crowdsec_service_api/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Server(Enum):
4848
'BlocklistSources',
4949
'BlocklistStats',
5050
'BlocklistSubscriberEntity',
51-
'BlocklistSubscribersResponse',
51+
'BlocklistSubscribersCount',
5252
'BlocklistSubscription',
5353
'BlocklistSubscriptionRequest',
5454
'BlocklistSubscriptionResponse',
@@ -80,6 +80,7 @@ class Server(Enum):
8080
'PageAllowlistGetItemsResponse',
8181
'PageAllowlistGetResponse',
8282
'PageAllowlistSubscriberEntity',
83+
'PageBlocklistSubscriberEntity',
8384
'PageIntegrationGetResponse',
8485
'PagePublicBlocklistResponse',
8586
'Permission',
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

crowdsec_service_api/models.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: <stdin>
3-
# timestamp: 2025-04-01T14:11:38+00:00
3+
# timestamp: 2025-04-16T07:12:57+00:00
44

55
from __future__ import annotations
66

@@ -724,7 +724,7 @@ class BlocklistsUploadBlocklistContentQueryParameters(BaseModelSdk):
724724
Optional[datetime],
725725
Field(
726726
description='Blocklist expiration',
727-
examples='2025-04-01T14:11:16.563106+00:00',
727+
examples='2025-04-16T07:12:36.323875+00:00',
728728
title='Expiration',
729729
),
730730
] = None
@@ -783,6 +783,15 @@ class BlocklistsSubscribeBlocklistPathParameters(BaseModelSdk):
783783
]
784784

785785

786+
class BlocklistsGetBlocklistSubscribersQueryParameters(BaseModelSdk):
787+
page: Annotated[
788+
Optional[int], Field(description='Page number', ge=1, title='Page')
789+
] = 1
790+
size: Annotated[
791+
Optional[int], Field(description='Page size', ge=1, le=100, title='Size')
792+
] = 50
793+
794+
786795
class BlocklistsGetBlocklistSubscribersPathParameters(BaseModelSdk):
787796
blocklist_id: Annotated[
788797
str, Field(examples=['5f9d88b9e5c4f5b9a3d3e8b1'], title='Blocklist Id')
@@ -1185,11 +1194,11 @@ class BlocklistSubscriberEntity(BaseModelSdk):
11851194
remediation: Annotated[str, Field(description='Remediation', title='Remediation')]
11861195

11871196

1188-
class BlocklistSubscribersResponse(BaseModelSdk):
1189-
subscribers: Annotated[
1190-
List[BlocklistSubscriberEntity],
1191-
Field(description='List of subscribers', title='Subscribers'),
1197+
class BlocklistSubscribersCount(BaseModelSdk):
1198+
entity_type: Annotated[
1199+
SubscriberEntityType, Field(description='Subscriber entity type')
11921200
]
1201+
count: Annotated[int, Field(description='Subscriber entity count', title='Count')]
11931202

11941203

11951204
class BlocklistSubscriptionRequest(BaseModelSdk):
@@ -1463,6 +1472,15 @@ class PageAllowlistSubscriberEntity(BaseModelSdk):
14631472
links: Links
14641473

14651474

1475+
class PageBlocklistSubscriberEntity(BaseModelSdk):
1476+
items: Annotated[List[BlocklistSubscriberEntity], Field(title='Items')]
1477+
total: Annotated[Optional[Total], Field(title='Total')] = None
1478+
page: Annotated[Optional[Page], Field(title='Page')] = None
1479+
size: Annotated[Optional[Size], Field(title='Size')] = None
1480+
pages: Annotated[Optional[Pages], Field(title='Pages')] = None
1481+
links: Links
1482+
1483+
14661484
class PageIntegrationGetResponse(BaseModelSdk):
14671485
items: Annotated[List[IntegrationGetResponse], Field(title='Items')]
14681486
total: Annotated[Optional[Total], Field(title='Total')] = None
@@ -1536,7 +1554,7 @@ class PublicBlocklistResponse(BaseModelSdk):
15361554
),
15371555
] = None
15381556
subscribers: Annotated[
1539-
Optional[List[BlocklistSubscriberEntity]],
1557+
Optional[List[BlocklistSubscribersCount]],
15401558
Field(
15411559
description='List of subscribers to the blocklist. Only subscribers belonging to your organization are returned',
15421560
title='Subscribers',
Binary file not shown.

crowdsec_service_api/services/blocklists.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,17 @@ def download_blocklist_content(
230230
def get_blocklist_subscribers(
231231
self,
232232
blocklist_id: str,
233-
)-> BlocklistSubscribersResponse:
233+
page: int = 1,
234+
size: int = 50,
235+
)-> Page[BlocklistSubscriberEntity]:
234236
endpoint_url = "/blocklists/{blocklist_id}/subscribers"
235237
loc = locals()
236238
headers = {}
237-
params = {}
239+
params = json.loads(
240+
BlocklistsGetBlocklistSubscribersQueryParameters(**loc).model_dump_json(
241+
exclude_none=True
242+
)
243+
)
238244
path_params = json.loads(
239245
BlocklistsGetBlocklistSubscribersPathParameters(**loc).model_dump_json(
240246
exclude_none=True
@@ -245,7 +251,7 @@ def get_blocklist_subscribers(
245251
url=endpoint_url, path_params=path_params, params=params, headers=headers
246252
)
247253

248-
return BlocklistSubscribersResponse(**response.json())
254+
return Page[BlocklistSubscriberEntity](_client=self, **response.json())
249255

250256
def subscribe_blocklist(
251257
self,

doc/Blocklists.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,10 @@ print(response)
385385
| Parameter | Type | Description | Required | Default |
386386
| --------- | ---- | ----------- | -------- | ------- |
387387
| blocklist_id | str | | True | |
388+
| page | int | Page number | False | 1 |
389+
| size | int | Page size | False | 50 |
388390
### Returns:
389-
[BlocklistSubscribersResponse](./Models.md#blocklistsubscribersresponse)
391+
[Page[BlocklistSubscriberEntity]](./Models.md#page[blocklistsubscriberentity])
390392
### Errors:
391393
| Code | Description |
392394
| ---- | ----------- |
@@ -404,6 +406,8 @@ auth = ApiKeyAuth(api_key='your_api_key')
404406
client = Blocklists(base_url=Server.production_server.value, auth=auth)
405407
response = client.get_blocklist_subscribers(
406408
blocklist_id='sample-blocklist-id',
409+
page=1,
410+
size=50,
407411
)
408412
print(response)
409413
```

doc/Models.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,13 +311,14 @@ id, entity_type, remediation
311311
| entity_type | str | None ||
312312
| remediation | str | Remediation ||
313313

314-
# **BlocklistSubscribersResponse**
314+
# **BlocklistSubscribersCount**
315315
## Required:
316-
subscribers
316+
entity_type, count
317317
## Properties
318318
| Property | Type | Description | Example |
319319
|----------|------|-------------|---------|
320-
| subscribers | list[BlocklistSubscriberEntity] | List of subscribers ||
320+
| entity_type | str | None ||
321+
| count | int | Subscriber entity count ||
321322

322323
# **BlocklistSubscription**
323324
## Required:
@@ -644,6 +645,19 @@ items, total, page, size, links
644645
| pages | Optional[int] | None ||
645646
| links | Links | None ||
646647

648+
# **Page_BlocklistSubscriberEntity_**
649+
## Required:
650+
items, total, page, size, links
651+
## Properties
652+
| Property | Type | Description | Example |
653+
|----------|------|-------------|---------|
654+
| items | list[BlocklistSubscriberEntity] | None ||
655+
| total | Optional[int] | None ||
656+
| page | Optional[int] | None ||
657+
| size | Optional[int] | None ||
658+
| pages | Optional[int] | None ||
659+
| links | Links | None ||
660+
647661
# **Page_IntegrationGetResponse_**
648662
## Required:
649663
items, total, page, size, links
@@ -700,7 +714,7 @@ id, created_at, updated_at, name, description, is_private, pricing_tier, source,
700714
| since | Optional[str] | Since duration for the CTI query (eg. 5m, 2h, 7d). Max is 30 days ||
701715
| shared_with | list[Share] | List of organizations shared with ||
702716
| organization_id | Optional[str] | Blocklists owner's organization id ||
703-
| subscribers | list[BlocklistSubscriberEntity] | List of subscribers to the blocklist. Only subscribers belonging to your organization are returned ||
717+
| subscribers | list[BlocklistSubscribersCount] | List of subscribers to the blocklist. Only subscribers belonging to your organization are returned ||
704718
| categories | list[BlocklistCategory] | List of categories for the blocklist ||
705719

706720
# **PublicPaginatedBlocklistResponse**

doc/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ You can find a Quickstart about this SDK, following this [documentation](https:/
8383

8484
[BlocklistSubscriberEntity](./Models.md#blocklistsubscriberentity)
8585

86-
[BlocklistSubscribersResponse](./Models.md#blocklistsubscribersresponse)
86+
[BlocklistSubscribersCount](./Models.md#blocklistsubscriberscount)
8787

8888
[BlocklistSubscription](./Models.md#blocklistsubscription)
8989

@@ -147,6 +147,8 @@ You can find a Quickstart about this SDK, following this [documentation](https:/
147147

148148
[PageAllowlistSubscriberEntity](./Models.md#pageallowlistsubscriberentity)
149149

150+
[PageBlocklistSubscriberEntity](./Models.md#pageblocklistsubscriberentity)
151+
150152
[PageIntegrationGetResponse](./Models.md#pageintegrationgetresponse)
151153

152154
[PagePublicBlocklistResponse](./Models.md#pagepublicblocklistresponse)

openapi.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)