socketdev 3.0.0__tar.gz → 3.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. socketdev-3.0.4/.github/PULL_REQUEST_TEMPLATE/bug-fix.md +19 -0
  2. socketdev-3.0.4/.github/PULL_REQUEST_TEMPLATE/feature.md +16 -0
  3. socketdev-3.0.4/.github/PULL_REQUEST_TEMPLATE/improvement.md +10 -0
  4. socketdev-3.0.4/.github/PULL_REQUEST_TEMPLATE.md +5 -0
  5. {socketdev-3.0.0 → socketdev-3.0.4}/.gitignore +2 -0
  6. {socketdev-3.0.0 → socketdev-3.0.4}/PKG-INFO +379 -40
  7. {socketdev-3.0.0 → socketdev-3.0.4}/README.rst +378 -39
  8. {socketdev-3.0.0 → socketdev-3.0.4}/pyproject.toml +1 -1
  9. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/__init__.py +10 -0
  10. socketdev-3.0.4/socketdev/alerttypes/__init__.py +38 -0
  11. socketdev-3.0.4/socketdev/analytics/__init__.py +64 -0
  12. socketdev-3.0.4/socketdev/apitokens/__init__.py +89 -0
  13. socketdev-3.0.4/socketdev/auditlog/__init__.py +27 -0
  14. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/core/dedupe.py +23 -1
  15. socketdev-3.0.4/socketdev/threatfeed/__init__.py +37 -0
  16. socketdev-3.0.4/socketdev/version.py +1 -0
  17. socketdev-3.0.4/tests/README.md +121 -0
  18. socketdev-3.0.4/tests/conftest.py +167 -0
  19. socketdev-3.0.4/tests/integration/test_all_endpoints.py +566 -0
  20. socketdev-3.0.4/tests/integration/test_comprehensive_integration.py +354 -0
  21. socketdev-3.0.4/tests/integration/test_new_endpoints.py +319 -0
  22. socketdev-3.0.4/tests/run_tests.py +378 -0
  23. socketdev-3.0.4/tests/unit/__init__.py +1 -0
  24. socketdev-3.0.4/tests/unit/test_all_endpoints_unit.py +649 -0
  25. socketdev-3.0.4/tests/unit/test_socket_sdk_unit.py +280 -0
  26. socketdev-3.0.4/tests/unit/test_working_endpoints_unit.py +464 -0
  27. socketdev-3.0.0/socketdev/apitokens/__init__.py +0 -0
  28. socketdev-3.0.0/socketdev/auditlog/__init__.py +0 -0
  29. socketdev-3.0.0/socketdev/threatfeed/__init__.py +0 -0
  30. socketdev-3.0.0/socketdev/version.py +0 -1
  31. {socketdev-3.0.0 → socketdev-3.0.4}/.github/CODEOWNERS +0 -0
  32. {socketdev-3.0.0 → socketdev-3.0.4}/.github/workflows/pr-preview.yml +0 -0
  33. {socketdev-3.0.0 → socketdev-3.0.4}/.github/workflows/release.yml +0 -0
  34. {socketdev-3.0.0 → socketdev-3.0.4}/.github/workflows/version-check.yml +0 -0
  35. {socketdev-3.0.0 → socketdev-3.0.4}/.hooks/sync_version.py +0 -0
  36. {socketdev-3.0.0 → socketdev-3.0.4}/.python-version +0 -0
  37. {socketdev-3.0.0 → socketdev-3.0.4}/LICENSE +0 -0
  38. {socketdev-3.0.0 → socketdev-3.0.4}/scripts/build.sh +0 -0
  39. {socketdev-3.0.0 → socketdev-3.0.4}/scripts/deploy-test-pypi.sh +0 -0
  40. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/core/api.py +0 -0
  41. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/core/classes.py +0 -0
  42. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/core/issues.py +0 -0
  43. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/dependencies/__init__.py +0 -0
  44. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/diffscans/__init__.py +0 -0
  45. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/exceptions.py +0 -0
  46. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/export/__init__.py +0 -0
  47. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/fullscans/__init__.py +0 -0
  48. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/historical/__init__.py +0 -0
  49. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/labels/__init__.py +0 -0
  50. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/licensemetadata/__init__.py +0 -0
  51. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/log.py +0 -0
  52. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/npm/__init__.py +0 -0
  53. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/openapi/__init__.py +0 -0
  54. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/org/__init__.py +0 -0
  55. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/purl/__init__.py +0 -0
  56. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/quota/__init__.py +0 -0
  57. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/report/__init__.py +0 -0
  58. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/repos/__init__.py +0 -0
  59. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/repositories/__init__.py +0 -0
  60. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/sbom/__init__.py +0 -0
  61. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/settings/__init__.py +0 -0
  62. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/tools/__init__.py +0 -0
  63. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/triage/__init__.py +0 -0
  64. {socketdev-3.0.0 → socketdev-3.0.4}/socketdev/utils/__init__.py +0 -0
  65. {socketdev-3.0.0 → socketdev-3.0.4}/tests/integration/test_diffscans_integration.py +0 -0
  66. {socketdev-3.0.0 → socketdev-3.0.4}/uv.lock +0 -0
@@ -0,0 +1,19 @@
1
+ <!--Description: Briefly describe the bug and its impact. ⬇️ -->
2
+
3
+ ## Root Cause
4
+ <!-- Concise explanation of what caused the bug ⬇️ -->
5
+
6
+
7
+
8
+ ## Fix
9
+ <!-- Explain how your changes address the bug ⬇️ -->
10
+
11
+ ## Public Changelog
12
+ <!-- Write a changelog message between comment tags if this should be included in the public product changelog, Leave blank otherwise. -->
13
+
14
+ <!-- changelog ⬇️-->
15
+ N/A
16
+ <!-- /changelog ⬆️ -->
17
+
18
+
19
+ <!-- TEMPLATE TYPE DON'T REMOVE: python-sdk-template-bug-fix -->
@@ -0,0 +1,16 @@
1
+ <!-- Description: Briefly describe the new feature you're introducing ⬇️ -->
2
+
3
+
4
+ ## Why?
5
+ <!-- Explain the motivation behind this feature and its expected benefits ⬇️ -->
6
+
7
+
8
+
9
+ ## Public Changelog
10
+ <!-- Write a changelog message between comment tags if this should be included in the public product changelog. -->
11
+
12
+ <!-- changelog ⬇️-->
13
+ N/A
14
+ <!-- /changelog ⬆️ -->
15
+
16
+ <!-- TEMPLATE TYPE DON'T REMOVE: python-sdk-template-feature -->
@@ -0,0 +1,10 @@
1
+ <!-- Description: Briefly describe the code improvement you're making. This could include things like lint fixes, adding monitoring dashboards, optimizing scripts, refactoring, etc. ⬇️ -->
2
+
3
+ ## Public Changelog
4
+ <!-- Write a changelog message between comment tags if this should be included in the public product changelog. -->
5
+
6
+ <!-- changelog ⬇️-->
7
+ N/A
8
+ <!-- /changelog ⬆️ -->
9
+
10
+ <!-- TEMPLATE TYPE DON'T REMOVE: python-sdk-template-improvement -->
@@ -0,0 +1,5 @@
1
+ Click on the "Preview" tab and select appropriate PR template:
2
+
3
+ [New Feature](?expand=1&template=feature.md)
4
+ [Bug Fix](?expand=1&template=bug-fix.md)
5
+ [Improvement](?expand=1&template=improvement.md)
@@ -3,6 +3,8 @@ main.py
3
3
  venv
4
4
  .idea
5
5
  .DS_Store
6
+ .env
7
+ *.swp
6
8
  *.zip
7
9
  *.pyc
8
10
  test.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: socketdev
3
- Version: 3.0.0
3
+ Version: 3.0.4
4
4
  Summary: Socket Security Python SDK
5
5
  Project-URL: Homepage, https://github.com/socketdev/socketdev
6
6
  Author-email: Douglas Coburn <douglas@socket.dev>
@@ -161,9 +161,9 @@ Export a Socket SBOM as an SPDX SBOM
161
161
  - **project_version (str)** - Filter by project version
162
162
  - **project_id (str)** - Filter by project ID
163
163
 
164
- fullscans.get(org_slug)
165
- """""""""""""""""""""""
166
- Retrieve the Fullscans information for around Organization
164
+ fullscans.get(org_slug, params)
165
+ """""""""""""""""""""""""""""""
166
+ Retrieve the Fullscans information for an Organization with query parameters
167
167
 
168
168
  **Usage:**
169
169
 
@@ -171,11 +171,20 @@ Retrieve the Fullscans information for around Organization
171
171
 
172
172
  from socketdev import socketdev
173
173
  socket = socketdev(token="REPLACE_ME")
174
- print(socket.fullscans.get("org_slug"))
174
+
175
+ # Query parameters for filtering full scans
176
+ params = {
177
+ "repo": "my-repo",
178
+ "branch": "main",
179
+ "limit": 10,
180
+ "offset": 0
181
+ }
182
+ print(socket.fullscans.get("org_slug", params))
175
183
 
176
184
  **PARAMETERS:**
177
185
 
178
186
  - **org_slug (str)** - The organization name
187
+ - **params (dict)** - Query parameters for filtering results (required)
179
188
 
180
189
  fullscans.post(files, params)
181
190
  """""""""""""""""""""""""""""
@@ -186,29 +195,30 @@ Create a full scan from a set of package manifest files. Returns a full scan inc
186
195
  .. code-block:: python
187
196
 
188
197
  from socketdev import socketdev
198
+ from socketdev.fullscans import FullScanParams
199
+
189
200
  socket = socketdev(token="REPLACE_ME")
190
201
  files = [
191
202
  "/path/to/manifest/package.json"
192
203
  ]
193
- params = {
194
- "org_slug": "org_name",
195
- "repo": "TestRepo",
196
- "branch": "main",
197
- "commit_message": "Test Commit Message",
198
- "commit_hash": "",
199
- "pull_request": "",
200
- "committers": "commiter",
201
- "make_default_branch": False,
202
- "set_as_pending_head": False,
203
- "tmp": ""
204
- }
204
+ params = FullScanParams(
205
+ org_slug="org_name",
206
+ repo="TestRepo",
207
+ branch="main",
208
+ commit_message="Test Commit Message",
209
+ commit_hash="abc123def456",
210
+ pull_request=123,
211
+ committers=["committer1", "committer2"],
212
+ make_default_branch=False,
213
+ set_as_pending_head=False
214
+ )
205
215
 
206
216
  print(socket.fullscans.post(files, params))
207
217
 
208
218
  **PARAMETERS:**
209
219
 
210
220
  - **files (list)** - List of file paths of manifest files
211
- - **params (dict)** - List of parameters to create a fullscan
221
+ - **params (FullScanParams)** - FullScanParams object containing scan configuration
212
222
 
213
223
  +------------------------+------------+-------------------------------------------------------------------------------+
214
224
  | Parameter | Required | Description |
@@ -219,20 +229,23 @@ Create a full scan from a set of package manifest files. Returns a full scan inc
219
229
  +------------------------+------------+-------------------------------------------------------------------------------+
220
230
  | branch | False | The string name in a git approved name for branches. |
221
231
  +------------------------+------------+-------------------------------------------------------------------------------+
222
- | committers | False | The string name of the person doing the commit or running the CLI. |
223
- | | | Can be specified multiple times to have more than one committer. |
232
+ | committers | False | List of committer names (List[str]). |
224
233
  +------------------------+------------+-------------------------------------------------------------------------------+
225
234
  | pull_request | False | The integer for the PR or MR number. |
226
235
  +------------------------+------------+-------------------------------------------------------------------------------+
227
236
  | commit_message | False | The string for a commit message if there is one. |
228
237
  +------------------------+------------+-------------------------------------------------------------------------------+
229
- | make_default_branch | False | If the flag is specified this will signal that this is the default branch. |
238
+ | make_default_branch | False | Boolean to signal that this is the default branch. |
230
239
  +------------------------+------------+-------------------------------------------------------------------------------+
231
240
  | commit_hash | False | Optional git commit hash |
232
241
  +------------------------+------------+-------------------------------------------------------------------------------+
233
- | set_as_pending_head | False | |
242
+ | set_as_pending_head | False | Boolean to set as pending head |
234
243
  +------------------------+------------+-------------------------------------------------------------------------------+
235
- | tmp | False | |
244
+ | tmp | False | Boolean temporary flag |
245
+ +------------------------+------------+-------------------------------------------------------------------------------+
246
+ | integration_type | False | IntegrationType enum value (e.g., "api", "github") |
247
+ +------------------------+------------+-------------------------------------------------------------------------------+
248
+ | integration_org_slug | False | Organization slug for integration |
236
249
  +------------------------+------------+-------------------------------------------------------------------------------+
237
250
 
238
251
  fullscans.delete(org_slug, full_scan_id)
@@ -245,15 +258,15 @@ Delete an existing full scan.
245
258
 
246
259
  from socketdev import socketdev
247
260
  socket = socketdev(token="REPLACE_ME")
248
- print(socket.fullscans.delete(org_slug, full_scan_id))
261
+ print(socket.fullscans.delete("org_slug", "full_scan_id"))
249
262
 
250
263
  **PARAMETERS:**
251
264
 
252
265
  - **org_slug (str)** - The organization name
253
266
  - **full_scan_id (str)** - The ID of the full scan
254
267
 
255
- fullscans.stream_diff(org_slug, before, after, preview, include_license_details)
256
- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
268
+ fullscans.stream_diff(org_slug, before, after, use_types=True, include_license_details="true", \*\*kwargs)
269
+ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
257
270
  Stream a diff between two full scans. Returns a scan diff.
258
271
 
259
272
  **Usage:**
@@ -263,16 +276,27 @@ Stream a diff between two full scans. Returns a scan diff.
263
276
  from socketdev import socketdev
264
277
  socket = socketdev(token="REPLACE_ME")
265
278
  print(socket.fullscans.stream_diff("org_slug", "before_scan_id", "after_scan_id"))
279
+
280
+ # With additional parameters
281
+ print(socket.fullscans.stream_diff(
282
+ "org_slug",
283
+ "before_scan_id",
284
+ "after_scan_id",
285
+ use_types=False,
286
+ include_license_details="false"
287
+ ))
266
288
 
267
289
  **PARAMETERS:**
268
290
 
269
291
  - **org_slug (str)** - The organization name
270
292
  - **before (str)** - The base full scan ID
271
293
  - **after (str)** - The comparison full scan ID
272
- - **include_license_details (bool)** - Include license details. Can greatly increase response size. Defaults to False.
294
+ - **use_types (bool)** - Whether to return typed response objects (default: True)
295
+ - **include_license_details (str)** - Include license details ("true"/"false"). Can greatly increase response size. Defaults to "true".
296
+ - **kwargs** - Additional query parameters
273
297
 
274
- fullscans.stream(org_slug, full_scan_id)
275
- """"""""""""""""""""""""""""""""""""""""
298
+ fullscans.stream(org_slug, full_scan_id, use_types=False)
299
+ """""""""""""""""""""""""""""""""""""""""""""""""""""""""
276
300
  Stream all SBOM artifacts for a full scan.
277
301
 
278
302
  **Usage:**
@@ -281,15 +305,19 @@ Stream all SBOM artifacts for a full scan.
281
305
 
282
306
  from socketdev import socketdev
283
307
  socket = socketdev(token="REPLACE_ME")
284
- print(socket.fullscans.stream(org_slug, full_scan_id))
308
+ print(socket.fullscans.stream("org_slug", "full_scan_id"))
309
+
310
+ # With typed response
311
+ print(socket.fullscans.stream("org_slug", "full_scan_id", use_types=True))
285
312
 
286
313
  **PARAMETERS:**
287
314
 
288
315
  - **org_slug (str)** - The organization name
289
316
  - **full_scan_id (str)** - The ID of the full scan
317
+ - **use_types (bool)** - Whether to return typed response objects (default: False)
290
318
 
291
- fullscans.metadata(org_slug, full_scan_id)
292
- """"""""""""""""""""""""""""""""""""""""""
319
+ fullscans.metadata(org_slug, full_scan_id, use_types=False)
320
+ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
293
321
  Get metadata for a single full scan
294
322
 
295
323
  **Usage:**
@@ -298,12 +326,34 @@ Get metadata for a single full scan
298
326
 
299
327
  from socketdev import socketdev
300
328
  socket = socketdev(token="REPLACE_ME")
301
- print(socket.fullscans.metadata(org_slug, full_scan_id))
329
+ print(socket.fullscans.metadata("org_slug", "full_scan_id"))
330
+
331
+ # With typed response
332
+ print(socket.fullscans.metadata("org_slug", "full_scan_id", use_types=True))
302
333
 
303
334
  **PARAMETERS:**
304
335
 
305
336
  - **org_slug (str)** - The organization name
306
337
  - **full_scan_id (str)** - The ID of the full scan
338
+ - **use_types (bool)** - Whether to return typed response objects (default: False)
339
+
340
+ fullscans.gfm(org_slug, before, after)
341
+ """"""""""""""""""""""""""""""""""""""
342
+ Get GitHub Flavored Markdown diff between two full scans.
343
+
344
+ **Usage:**
345
+
346
+ .. code-block:: python
347
+
348
+ from socketdev import socketdev
349
+ socket = socketdev(token="REPLACE_ME")
350
+ print(socket.fullscans.gfm("org_slug", "before_scan_id", "after_scan_id"))
351
+
352
+ **PARAMETERS:**
353
+
354
+ - **org_slug (str)** - The organization name
355
+ - **before (str)** - The base full scan ID
356
+ - **after (str)** - The comparison full scan ID
307
357
 
308
358
  dependencies.get(limit, offset)
309
359
  """""""""""""""""""""""""""""""
@@ -337,7 +387,7 @@ Retrieve the dependencies for the organization associated with the API Key
337
387
  ]
338
388
  params = {
339
389
  "repository": "username/repo-name",
340
- "branch": "dependency-branch
390
+ "branch": "dependency-branch"
341
391
  }
342
392
  print(socket.dependencies.post(file_names, params))
343
393
 
@@ -348,7 +398,7 @@ Retrieve the dependencies for the organization associated with the API Key
348
398
 
349
399
  repos.get()
350
400
  """""""""""
351
- Get a list of information about the tracked repositores
401
+ Get a list of information about the tracked repositories
352
402
 
353
403
  **Usage:**
354
404
 
@@ -360,7 +410,7 @@ Get a list of information about the tracked repositores
360
410
 
361
411
  **PARAMETERS:**
362
412
 
363
- - **sort** - The key to sort on froom the repo properties. Defaults to `created_at`
413
+ - **sort** - The key to sort on from the repo properties. Defaults to `created_at`
364
414
  - **direction** - Can be `desc` or `asc`. Defaults to `desc`
365
415
  - **per_page** - Integer between 1 to 100. Defaults to `10`
366
416
  - **page** - Integer page number defaults to `1`. If there are no more results it will be `0`
@@ -397,7 +447,7 @@ Create a new Socket Repository
397
447
 
398
448
  repos.repo()
399
449
  """"""""""""
400
- Get a list of information about the tracked repositores
450
+ Get a list of information about the tracked repositories
401
451
 
402
452
  **Usage:**
403
453
 
@@ -405,7 +455,7 @@ Get a list of information about the tracked repositores
405
455
 
406
456
  from socketdev import socketdev
407
457
  socket = socketdev(token="REPLACE_ME")
408
- print(socket.repos.repo(org_slug="example", repo_name="example-repo")
458
+ print(socket.repos.repo(org_slug="example", repo_name="example-repo"))
409
459
 
410
460
  repos.update()
411
461
  """"""""""""""
@@ -447,7 +497,7 @@ Delete a Socket Repository
447
497
 
448
498
  from socketdev import socketdev
449
499
  socket = socketdev(token="REPLACE_ME")
450
- print(socket.repos.delete(org_slug="example", repo_name="example-repo")
500
+ print(socket.repos.delete(org_slug="example", repo_name="example-repo"))
451
501
 
452
502
  **PARAMETERS:**
453
503
 
@@ -571,7 +621,7 @@ Create a new project health report with the provided files
571
621
 
572
622
  Deprecated: repositories.get()
573
623
  """"""""""""""""""""""""""""""
574
- Get a list of information about the tracked repositores
624
+ Get a list of information about the tracked repositories
575
625
 
576
626
  **Usage:**
577
627
 
@@ -828,3 +878,292 @@ List all historical snapshots for an organization.
828
878
 
829
879
  - **org_slug (str)** – The organization name
830
880
  - **query_params (dict, optional)** – Optional query parameters
881
+
882
+ diffscans.list(org_slug, params=None)
883
+ """""""""""""""""""""""""""""""""""""
884
+ List all diff scans for an organization.
885
+
886
+ **Usage:**
887
+
888
+ .. code-block:: python
889
+
890
+ from socketdev import socketdev
891
+ socket = socketdev(token="REPLACE_ME")
892
+ print(socket.diffscans.list("org_slug", {"limit": 10, "offset": 0}))
893
+
894
+ **PARAMETERS:**
895
+
896
+ - **org_slug (str)** – The organization name
897
+ - **params (dict, optional)** – Optional query parameters for filtering
898
+
899
+ diffscans.get(org_slug, diff_scan_id)
900
+ """""""""""""""""""""""""""""""""""""
901
+ Fetch a specific diff scan by ID.
902
+
903
+ **Usage:**
904
+
905
+ .. code-block:: python
906
+
907
+ from socketdev import socketdev
908
+ socket = socketdev(token="REPLACE_ME")
909
+ print(socket.diffscans.get("org_slug", "diff_scan_id"))
910
+
911
+ **PARAMETERS:**
912
+
913
+ - **org_slug (str)** – The organization name
914
+ - **diff_scan_id (str)** – The ID of the diff scan to retrieve
915
+
916
+ diffscans.create_from_ids(org_slug, params)
917
+ """""""""""""""""""""""""""""""""""""""""""
918
+ Create a diff scan from two full scan IDs.
919
+
920
+ **Usage:**
921
+
922
+ .. code-block:: python
923
+
924
+ from socketdev import socketdev
925
+ socket = socketdev(token="REPLACE_ME")
926
+ params = {
927
+ "before": "full_scan_id_1",
928
+ "after": "full_scan_id_2",
929
+ "description": "Compare two scans"
930
+ }
931
+ print(socket.diffscans.create_from_ids("org_slug", params))
932
+
933
+ **PARAMETERS:**
934
+
935
+ - **org_slug (str)** – The organization name
936
+ - **params (dict)** – Parameters including before and after scan IDs
937
+
938
+ diffscans.create_from_repo(org_slug, repo_slug, files, params=None)
939
+ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
940
+ Create a diff scan from repository files.
941
+
942
+ **Usage:**
943
+
944
+ .. code-block:: python
945
+
946
+ from socketdev import socketdev
947
+ socket = socketdev(token="REPLACE_ME")
948
+ files = ["/path/to/package.json"]
949
+ params = {"branch": "main", "commit": "abc123"}
950
+ print(socket.diffscans.create_from_repo("org_slug", "repo_slug", files, params))
951
+
952
+ **PARAMETERS:**
953
+
954
+ - **org_slug (str)** – The organization name
955
+ - **repo_slug (str)** – The repository name
956
+ - **files (list)** – List of file paths to scan
957
+ - **params (dict, optional)** – Optional parameters for the scan
958
+
959
+ diffscans.gfm(org_slug, diff_scan_id)
960
+ """""""""""""""""""""""""""""""""""""
961
+ Get GitHub Flavored Markdown comments for a diff scan.
962
+
963
+ **Usage:**
964
+
965
+ .. code-block:: python
966
+
967
+ from socketdev import socketdev
968
+ socket = socketdev(token="REPLACE_ME")
969
+ print(socket.diffscans.gfm("org_slug", "diff_scan_id"))
970
+
971
+ **PARAMETERS:**
972
+
973
+ - **org_slug (str)** – The organization name
974
+ - **diff_scan_id (str)** – The ID of the diff scan
975
+
976
+ diffscans.delete(org_slug, diff_scan_id)
977
+ """"""""""""""""""""""""""""""""""""""""
978
+ Delete a specific diff scan.
979
+
980
+ **Usage:**
981
+
982
+ .. code-block:: python
983
+
984
+ from socketdev import socketdev
985
+ socket = socketdev(token="REPLACE_ME")
986
+ print(socket.diffscans.delete("org_slug", "diff_scan_id"))
987
+
988
+ **PARAMETERS:**
989
+
990
+ - **org_slug (str)** – The organization name
991
+ - **diff_scan_id (str)** – The ID of the diff scan to delete
992
+
993
+ threatfeed.get(org_slug=None, \*\*kwargs)
994
+ """""""""""""""""""""""""""""""""""""""""""
995
+ Get threat feed items for an organization or globally.
996
+
997
+ **Usage:**
998
+
999
+ .. code-block:: python
1000
+
1001
+ from socketdev import socketdev
1002
+ socket = socketdev(token="REPLACE_ME")
1003
+
1004
+ # Get org-specific threat feed
1005
+ print(socket.threatfeed.get("org_slug", per_page=50, sort="created_at"))
1006
+
1007
+ # Get global threat feed (deprecated)
1008
+ print(socket.threatfeed.get())
1009
+
1010
+ **PARAMETERS:**
1011
+
1012
+ - **org_slug (str, optional)** – The organization name (recommended for new implementations)
1013
+ - **kwargs** – Query parameters like per_page, page_cursor, sort, etc.
1014
+
1015
+ apitokens.create(org_slug, \*\*kwargs)
1016
+ """"""""""""""""""""""""""""""""""""""
1017
+ Create a new API token for an organization.
1018
+
1019
+ **Usage:**
1020
+
1021
+ .. code-block:: python
1022
+
1023
+ from socketdev import socketdev
1024
+ socket = socketdev(token="REPLACE_ME")
1025
+ token_config = {
1026
+ "name": "My API Token",
1027
+ "permissions": ["read", "write"],
1028
+ "expires_at": "2024-12-31T23:59:59Z"
1029
+ }
1030
+ print(socket.apitokens.create("org_slug", **token_config))
1031
+
1032
+ **PARAMETERS:**
1033
+
1034
+ - **org_slug (str)** – The organization name
1035
+ - **kwargs** – Token configuration parameters
1036
+
1037
+ apitokens.update(org_slug, \*\*kwargs)
1038
+ """"""""""""""""""""""""""""""""""""""
1039
+ Update an existing API token.
1040
+
1041
+ **Usage:**
1042
+
1043
+ .. code-block:: python
1044
+
1045
+ from socketdev import socketdev
1046
+ socket = socketdev(token="REPLACE_ME")
1047
+ update_params = {
1048
+ "token_id": "token_123",
1049
+ "name": "Updated Token Name",
1050
+ "permissions": ["read"]
1051
+ }
1052
+ print(socket.apitokens.update("org_slug", **update_params))
1053
+
1054
+ **PARAMETERS:**
1055
+
1056
+ - **org_slug (str)** – The organization name
1057
+ - **kwargs** – Token update parameters
1058
+
1059
+ auditlog.get(org_slug, \*\*kwargs)
1060
+ """"""""""""""""""""""""""""""""""""
1061
+ Get audit log entries for an organization.
1062
+
1063
+ **Usage:**
1064
+
1065
+ .. code-block:: python
1066
+
1067
+ from socketdev import socketdev
1068
+ socket = socketdev(token="REPLACE_ME")
1069
+ print(socket.auditlog.get("org_slug", limit=100, cursor="abc123"))
1070
+
1071
+ **PARAMETERS:**
1072
+
1073
+ - **org_slug (str)** – The organization name
1074
+ - **kwargs** – Query parameters like limit, cursor, etc.
1075
+
1076
+ analytics.get_org(filter, \*\*kwargs)
1077
+ """""""""""""""""""""""""""""""""""""""
1078
+ Get organization analytics (deprecated - use Historical module instead).
1079
+
1080
+ **Usage:**
1081
+
1082
+ .. code-block:: python
1083
+
1084
+ from socketdev import socketdev
1085
+ socket = socketdev(token="REPLACE_ME")
1086
+ # DEPRECATED: Use socket.historical.list() or socket.historical.trend() instead
1087
+ print(socket.analytics.get_org("alerts", start_date="2024-01-01"))
1088
+
1089
+ **PARAMETERS:**
1090
+
1091
+ - **filter (str)** – Analytics filter type
1092
+ - **kwargs** – Additional query parameters
1093
+
1094
+ analytics.get_repo(name, filter, \*\*kwargs)
1095
+ """"""""""""""""""""""""""""""""""""""""""""""
1096
+ Get repository analytics (deprecated - use Historical module instead).
1097
+
1098
+ **Usage:**
1099
+
1100
+ .. code-block:: python
1101
+
1102
+ from socketdev import socketdev
1103
+ socket = socketdev(token="REPLACE_ME")
1104
+ # DEPRECATED: Use socket.historical.list() or socket.historical.trend() instead
1105
+ print(socket.analytics.get_repo("repo_name", "alerts", start_date="2024-01-01"))
1106
+
1107
+ **PARAMETERS:**
1108
+
1109
+ - **name (str)** – Repository name
1110
+ - **filter (str)** – Analytics filter type
1111
+ - **kwargs** – Additional query parameters
1112
+
1113
+ alerttypes.get(alert_types=None, language="en-US", \*\*kwargs)
1114
+ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1115
+ Get alert types metadata.
1116
+
1117
+ **Usage:**
1118
+
1119
+ .. code-block:: python
1120
+
1121
+ from socketdev import socketdev
1122
+ socket = socketdev(token="REPLACE_ME")
1123
+
1124
+ # Get metadata for specific alert types
1125
+ alert_list = ["supply_chain_risk", "license_risk"]
1126
+ print(socket.alerttypes.get(alert_list, language="en-US"))
1127
+
1128
+ # Get all alert types metadata
1129
+ print(socket.alerttypes.get())
1130
+
1131
+ **PARAMETERS:**
1132
+
1133
+ - **alert_types (list, optional)** – List of alert type strings to get metadata for
1134
+ - **language (str)** – Language for alert metadata (default: en-US)
1135
+ - **kwargs** – Additional query parameters
1136
+
1137
+ triage.list_alert_triage(org_slug, query_params=None)
1138
+ """""""""""""""""""""""""""""""""""""""""""""""""""""
1139
+ Get list of triaged alerts for an organization.
1140
+
1141
+ **Usage:**
1142
+
1143
+ .. code-block:: python
1144
+
1145
+ from socketdev import socketdev
1146
+ socket = socketdev(token="REPLACE_ME")
1147
+ query_params = {"status": "triaged", "limit": 50}
1148
+ print(socket.triage.list_alert_triage("org_slug", query_params))
1149
+
1150
+ **PARAMETERS:**
1151
+
1152
+ - **org_slug (str)** – The organization name
1153
+ - **query_params (dict, optional)** – Optional query parameters for filtering
1154
+
1155
+ openapi.get()
1156
+ """""""""""""
1157
+ Retrieve the OpenAPI specification for the Socket API.
1158
+
1159
+ **Usage:**
1160
+
1161
+ .. code-block:: python
1162
+
1163
+ from socketdev import socketdev
1164
+ socket = socketdev(token="REPLACE_ME")
1165
+ print(socket.openapi.get())
1166
+
1167
+ **PARAMETERS:**
1168
+
1169
+ None required.