File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -92,5 +92,31 @@ public IReadOnlyList<SearchResult> Search(
92
92
93
93
return result ;
94
94
} // Search()
95
+
96
+ /// <summary>
97
+ /// Searches for files by hash.
98
+ /// </summary>
99
+ /// <param name="fileHashes">A list of file hashes.</param>
100
+ /// <param name="groupName">Name of the group.</param>
101
+ /// <returns>A raw JSON result.</returns>
102
+ public string SearchForFile ( List < Hash > fileHashes , string groupName = "" )
103
+ {
104
+ Log . Debug ( $ "Searching for files by hash...") ;
105
+
106
+ var json = JsonConvert . SerializeObject ( fileHashes ) ;
107
+
108
+ var request = new RestRequest ( this . Url + "/filesearch" , Method . POST ) ;
109
+ request . RequestFormat = DataFormat . Json ;
110
+ request . JsonSerializer = new JsonSerializer ( ) ;
111
+ request . Parameters . Clear ( ) ;
112
+ if ( ! string . IsNullOrEmpty ( groupName ) )
113
+ {
114
+ request . AddHeader ( "groupName" , groupName ) ;
115
+ } // if
116
+
117
+ request . AddJsonBody ( json ) ;
118
+ var resultRaw = this . api . Execute ( request ) ;
119
+ return resultRaw . Content ;
120
+ } // SearchForFile()
95
121
} // FossologyClient
96
122
}
You can’t perform that action at this time.
0 commit comments