@@ -486,6 +486,16 @@ def from_dict(cls, data: dict) -> "DiffArtifact":
486
486
487
487
score_data = data .get ("score" ) or data .get ("scores" )
488
488
score = SocketScore .from_dict (score_data ) if score_data else None
489
+ license_details_source = data .get ("licenseDetails" )
490
+ if license_details_source :
491
+ license_details = [LicenseDetail .from_dict (detail ) for detail in license_details_source ]
492
+ else :
493
+ license_details = []
494
+ license_attrib_source = data .get ("licenseAttrib" )
495
+ if license_attrib_source :
496
+ license_attrib = [LicenseAttribution .from_dict (attrib ) for attrib in license_attrib_source ]
497
+ else :
498
+ license_attrib = []
489
499
490
500
return cls (
491
501
diffType = DiffType (data ["diffType" ]),
@@ -495,7 +505,7 @@ def from_dict(cls, data: dict) -> "DiffArtifact":
495
505
score = score ,
496
506
version = data ["version" ],
497
507
alerts = [SocketAlert .from_dict (alert ) for alert in data .get ("alerts" , [])],
498
- licenseDetails = [ LicenseDetail . from_dict ( detail ) for detail in data [ "licenseDetails" ]] ,
508
+ licenseDetails = license_details ,
499
509
files = data .get ("files" ),
500
510
license = data .get ("license" ),
501
511
capabilities = SecurityCapabilities .from_dict (data ["capabilities" ]) if data .get ("capabilities" ) else None ,
@@ -510,7 +520,7 @@ def from_dict(cls, data: dict) -> "DiffArtifact":
510
520
author = data .get ("author" , []),
511
521
state = data .get ("state" ),
512
522
error = data .get ("error" ),
513
- licenseAttrib = [ LicenseAttribution . from_dict ( attrib ) for attrib in data [ "licenseAttrib" ]]
523
+ licenseAttrib = license_attrib
514
524
if data .get ("licenseAttrib" )
515
525
else None ,
516
526
)
@@ -766,9 +776,18 @@ def delete(self, org_slug: str, full_scan_id: str) -> dict:
766
776
return {}
767
777
768
778
def stream_diff (
769
- self , org_slug : str , before : str , after : str , use_types : bool = False
779
+ self ,
780
+ org_slug : str ,
781
+ before : str ,
782
+ after : str ,
783
+ use_types : bool = True ,
784
+ include_license_details : bool = False ,
785
+ ** kwargs ,
770
786
) -> Union [dict , StreamDiffResponse ]:
771
- path = f"orgs/{ org_slug } /full-scans/diff?before={ before } &after={ after } "
787
+ path = f"orgs/{ org_slug } /full-scans/diff?before={ before } &after={ after } &{ include_license_details } "
788
+ if kwargs :
789
+ for key , value in kwargs .items ():
790
+ path += f"&{ key } ={ value } "
772
791
773
792
response = self .api .do_request (path = path , method = "GET" )
774
793
0 commit comments