Skip to content

Commit

Permalink
docs(lookup): add example to lookup function and comment to configs file
Browse files Browse the repository at this point in the history
Added an example and detailed parameters to the `findThreadMatches` function in the lookup file. Provided a comment in the configs file explaining the purpose and version of the exported Google Safe Browsing API endpoint.
  • Loading branch information
hckhanh committed Mar 1, 2024
1 parent 9b4e135 commit b36db72
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/configs.ts
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
/**
* The base URL of the Google Safe Browsing API. The current version is v4.
*/
export const endpoint = 'https://safebrowsing.googleapis.com/v4'
20 changes: 20 additions & 0 deletions src/lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@ export type FindThreadMatchesResponse = {
/**
* Finds threat matches using Google Safe Browsing API.
*
* @example
* ```ts
* const result = await findThreadMatches('apiKey', {
* client: {
* clientId: 'uniqueClientId',
* clientVersion: '1.0.0',
* },
* threatInfo: {
* threatTypes: ['MALWARE', 'SOCIAL_ENGINEERING'],
* platformTypes: ['ALL_PLATFORMS'],
* threatEntryTypes: ['URL'],
* threatEntries: [
* { url: 'http://malware.testing.google.test/testing/malware/' },
* ],
* },
* })
*
* const hasRisk = result.matches !== undefined && result.matches.length > 0
* ```
*
* @param apiKey The API key for accessing the Google Safe Browsing API. You should follow the instruction to get the API key at https://developers.google.com/safe-browsing/v4/get-started.
* @param request The request object containing the parameters for finding thread matches.
*
Expand Down

0 comments on commit b36db72

Please sign in to comment.