Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit c9e6118

Browse files
authored
[client-python] Fix search args in relationships (#672)
1 parent 068925b commit c9e6118

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

pycti/entities/opencti_stix_core_relationship.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ def list(self, **kwargs):
396396
custom_attributes = kwargs.get("customAttributes", None)
397397
get_all = kwargs.get("getAll", False)
398398
with_pagination = kwargs.get("withPagination", False)
399+
search = kwargs.get("search", None)
399400
if get_all:
400401
first = 100
401402

@@ -409,12 +410,13 @@ def list(self, **kwargs):
409410
"element_with_target_types": element_with_target_types,
410411
"from_types": from_types,
411412
"to_types": to_types,
413+
"search": search,
412414
},
413415
)
414416
query = (
415417
"""
416-
query StixCoreRelationships($fromOrToId: [String], $elementWithTargetTypes: [String], $fromId: [String], $fromTypes: [String], $toId: [String], $toTypes: [String], $relationship_type: [String], $startTimeStart: DateTime, $startTimeStop: DateTime, $stopTimeStart: DateTime, $stopTimeStop: DateTime, $filters: FilterGroup, $first: Int, $after: ID, $orderBy: StixCoreRelationshipsOrdering, $orderMode: OrderingMode) {
417-
stixCoreRelationships(fromOrToId: $fromOrToId, elementWithTargetTypes: $elementWithTargetTypes, fromId: $fromId, fromTypes: $fromTypes, toId: $toId, toTypes: $toTypes, relationship_type: $relationship_type, startTimeStart: $startTimeStart, startTimeStop: $startTimeStop, stopTimeStart: $stopTimeStart, stopTimeStop: $stopTimeStop, filters: $filters, first: $first, after: $after, orderBy: $orderBy, orderMode: $orderMode) {
418+
query StixCoreRelationships($fromOrToId: [String], $elementWithTargetTypes: [String], $fromId: [String], $fromTypes: [String], $toId: [String], $toTypes: [String], $relationship_type: [String], $startTimeStart: DateTime, $startTimeStop: DateTime, $stopTimeStart: DateTime, $stopTimeStop: DateTime, $filters: FilterGroup, $first: Int, $after: ID, $orderBy: StixCoreRelationshipsOrdering, $orderMode: OrderingMode, $search: String) {
419+
stixCoreRelationships(fromOrToId: $fromOrToId, elementWithTargetTypes: $elementWithTargetTypes, fromId: $fromId, fromTypes: $fromTypes, toId: $toId, toTypes: $toTypes, relationship_type: $relationship_type, startTimeStart: $startTimeStart, startTimeStop: $startTimeStop, stopTimeStart: $stopTimeStart, stopTimeStop: $stopTimeStop, filters: $filters, first: $first, after: $after, orderBy: $orderBy, orderMode: $orderMode, search: $search) {
418420
edges {
419421
node {
420422
"""
@@ -452,6 +454,7 @@ def list(self, **kwargs):
452454
"after": after,
453455
"orderBy": order_by,
454456
"orderMode": order_mode,
457+
"search": search,
455458
},
456459
)
457460
if get_all:

pycti/entities/opencti_stix_sighting_relationship.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ def list(self, **kwargs):
316316
custom_attributes = kwargs.get("customAttributes", None)
317317
get_all = kwargs.get("getAll", False)
318318
with_pagination = kwargs.get("withPagination", False)
319+
search = kwargs.get("search", None)
319320
if get_all:
320321
first = 100
321322

@@ -325,8 +326,8 @@ def list(self, **kwargs):
325326
)
326327
query = (
327328
"""
328-
query StixSightingRelationships($fromOrToId: String, $fromId: StixRef, $fromTypes: [String], $toId: StixRef, $toTypes: [String], $firstSeenStart: DateTime, $firstSeenStop: DateTime, $lastSeenStart: DateTime, $lastSeenStop: DateTime, $filters: FilterGroup, $first: Int, $after: ID, $orderBy: StixSightingRelationshipsOrdering, $orderMode: OrderingMode) {
329-
stixSightingRelationships(fromOrToId: $fromOrToId, fromId: $fromId, fromTypes: $fromTypes, toId: $toId, toTypes: $toTypes, firstSeenStart: $firstSeenStart, firstSeenStop: $firstSeenStop, lastSeenStart: $lastSeenStart, lastSeenStop: $lastSeenStop, filters: $filters, first: $first, after: $after, orderBy: $orderBy, orderMode: $orderMode) {
329+
query StixSightingRelationships($fromOrToId: String, $fromId: StixRef, $fromTypes: [String], $toId: StixRef, $toTypes: [String], $firstSeenStart: DateTime, $firstSeenStop: DateTime, $lastSeenStart: DateTime, $lastSeenStop: DateTime, $filters: FilterGroup, $first: Int, $after: ID, $orderBy: StixSightingRelationshipsOrdering, $orderMode: OrderingMode, $search: String) {
330+
stixSightingRelationships(fromOrToId: $fromOrToId, fromId: $fromId, fromTypes: $fromTypes, toId: $toId, toTypes: $toTypes, firstSeenStart: $firstSeenStart, firstSeenStop: $firstSeenStop, lastSeenStart: $lastSeenStart, lastSeenStop: $lastSeenStop, filters: $filters, first: $first, after: $after, orderBy: $orderBy, orderMode: $orderMode, search: $search) {
330331
edges {
331332
node {
332333
"""
@@ -362,6 +363,7 @@ def list(self, **kwargs):
362363
"after": after,
363364
"orderBy": order_by,
364365
"orderMode": order_mode,
366+
"search": search,
365367
},
366368
)
367369
if get_all:

scripts/clone-opencti.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,13 @@ clone_for_pr_build() {
6363
clone_for_push_build() {
6464
echo "[CLONE-DEPS] Build from a commit, checking if a dedicated branch is required."
6565
OPENCTI_BRANCH=$([ $(echo $PR_BRANCH_NAME | cut -d "/" -f 1) == opencti ] && echo $(echo $PR_BRANCH_NAME | cut -d "/" -f2-) || echo 'master' )
66-
git clone -b $OPENCTI_BRANCH https://github.com/OpenCTI-Platform/opencti.git
66+
if [ "$(echo "$(git ls-remote --heads https://github.com/OpenCTI-Platform/opencti.git refs/heads/OPENCTI_BRANCH)")" != '' ]
67+
then
68+
git clone -b $OPENCTI_BRANCH https://github.com/OpenCTI-Platform/opencti.git
69+
else
70+
git clone -b master https://github.com/OpenCTI-Platform/opencti.git
71+
fi
72+
6773
}
6874

6975
echo "[CLONE-DEPS] START; with PR_BRANCH_NAME=${PR_BRANCH_NAME}, PR_NUMBER=${PR_NUMBER}, OPENCTI_DIR=${OPENCTI_DIR}."

0 commit comments

Comments
 (0)