@indiciaosint/sdk 1.2.0 → 1.2.2
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.
- package/README.md +7 -1
- package/esm/funcs/infrastructure-virus-total-content.d.ts +18 -0
- package/esm/funcs/infrastructure-virus-total-content.d.ts.map +1 -0
- package/esm/funcs/infrastructure-virus-total-content.js +84 -0
- package/esm/funcs/infrastructure-virus-total-content.js.map +1 -0
- package/esm/funcs/intelligence-virus-total-intelligence.d.ts +18 -0
- package/esm/funcs/intelligence-virus-total-intelligence.d.ts.map +1 -0
- package/esm/funcs/intelligence-virus-total-intelligence.js +84 -0
- package/esm/funcs/intelligence-virus-total-intelligence.js.map +1 -0
- package/esm/funcs/socials-search-github.d.ts +3 -2
- package/esm/funcs/socials-search-github.d.ts.map +1 -1
- package/esm/funcs/socials-search-github.js +11 -3
- package/esm/funcs/socials-search-github.js.map +1 -1
- package/esm/funcs/socials-search-username.d.ts +3 -2
- package/esm/funcs/socials-search-username.d.ts.map +1 -1
- package/esm/funcs/socials-search-username.js +11 -3
- package/esm/funcs/socials-search-username.js.map +1 -1
- package/esm/funcs/tools-download-virus-total-file.d.ts +18 -0
- package/esm/funcs/tools-download-virus-total-file.d.ts.map +1 -0
- package/esm/funcs/tools-download-virus-total-file.js +84 -0
- package/esm/funcs/tools-download-virus-total-file.js.map +1 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/operations/download-virus-total-file.d.ts +34 -0
- package/esm/models/operations/download-virus-total-file.d.ts.map +1 -0
- package/esm/models/operations/download-virus-total-file.js +33 -0
- package/esm/models/operations/download-virus-total-file.js.map +1 -0
- package/esm/models/operations/get-activity.d.ts +3 -0
- package/esm/models/operations/get-activity.d.ts.map +1 -1
- package/esm/models/operations/get-activity.js +3 -0
- package/esm/models/operations/get-activity.js.map +1 -1
- package/esm/models/operations/get-info.d.ts +3 -0
- package/esm/models/operations/get-info.d.ts.map +1 -1
- package/esm/models/operations/get-info.js +3 -0
- package/esm/models/operations/get-info.js.map +1 -1
- package/esm/models/operations/index.d.ts +3 -0
- package/esm/models/operations/index.d.ts.map +1 -1
- package/esm/models/operations/index.js +3 -0
- package/esm/models/operations/index.js.map +1 -1
- package/esm/models/operations/list-activities.d.ts +3 -0
- package/esm/models/operations/list-activities.d.ts.map +1 -1
- package/esm/models/operations/list-activities.js +3 -0
- package/esm/models/operations/list-activities.js.map +1 -1
- package/esm/models/operations/search-face.d.ts +4 -4
- package/esm/models/operations/search-face.d.ts.map +1 -1
- package/esm/models/operations/search-face.js +4 -5
- package/esm/models/operations/search-face.js.map +1 -1
- package/esm/models/operations/search-github.d.ts +69 -7
- package/esm/models/operations/search-github.d.ts.map +1 -1
- package/esm/models/operations/search-github.js +83 -9
- package/esm/models/operations/search-github.js.map +1 -1
- package/esm/models/operations/search-username.d.ts +429 -13
- package/esm/models/operations/search-username.d.ts.map +1 -1
- package/esm/models/operations/search-username.js +725 -13
- package/esm/models/operations/search-username.js.map +1 -1
- package/esm/models/operations/search-web-databases.d.ts +2 -2
- package/esm/models/operations/search-web-databases.js +2 -2
- package/esm/models/operations/search-web-databases.js.map +1 -1
- package/esm/models/operations/virus-total-content.d.ts +62 -0
- package/esm/models/operations/virus-total-content.d.ts.map +1 -0
- package/esm/models/operations/virus-total-content.js +89 -0
- package/esm/models/operations/virus-total-content.js.map +1 -0
- package/esm/models/operations/virus-total-intelligence.d.ts +75 -0
- package/esm/models/operations/virus-total-intelligence.d.ts.map +1 -0
- package/esm/models/operations/virus-total-intelligence.js +92 -0
- package/esm/models/operations/virus-total-intelligence.js.map +1 -0
- package/esm/sdk/infrastructure.d.ts +7 -0
- package/esm/sdk/infrastructure.d.ts.map +1 -1
- package/esm/sdk/infrastructure.js +10 -0
- package/esm/sdk/infrastructure.js.map +1 -1
- package/esm/sdk/intelligence.d.ts +7 -0
- package/esm/sdk/intelligence.d.ts.map +1 -1
- package/esm/sdk/intelligence.js +10 -0
- package/esm/sdk/intelligence.js.map +1 -1
- package/esm/sdk/socials.d.ts +5 -4
- package/esm/sdk/socials.d.ts.map +1 -1
- package/esm/sdk/socials.js +2 -2
- package/esm/sdk/socials.js.map +1 -1
- package/esm/sdk/tools.d.ts +7 -0
- package/esm/sdk/tools.d.ts.map +1 -1
- package/esm/sdk/tools.js +10 -0
- package/esm/sdk/tools.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/infrastructure-virus-total-content.ts +174 -0
- package/src/funcs/intelligence-virus-total-intelligence.ts +174 -0
- package/src/funcs/socials-search-github.ts +21 -6
- package/src/funcs/socials-search-username.ts +23 -6
- package/src/funcs/tools-download-virus-total-file.ts +174 -0
- package/src/lib/config.ts +2 -2
- package/src/models/operations/download-virus-total-file.ts +93 -0
- package/src/models/operations/get-activity.ts +3 -0
- package/src/models/operations/get-info.ts +3 -0
- package/src/models/operations/index.ts +3 -0
- package/src/models/operations/list-activities.ts +3 -0
- package/src/models/operations/search-face.ts +15 -13
- package/src/models/operations/search-github.ts +225 -41
- package/src/models/operations/search-username.ts +1667 -77
- package/src/models/operations/search-web-databases.ts +2 -2
- package/src/models/operations/virus-total-content.ts +190 -0
- package/src/models/operations/virus-total-intelligence.ts +210 -0
- package/src/sdk/infrastructure.ts +18 -0
- package/src/sdk/intelligence.ts +18 -0
- package/src/sdk/socials.ts +5 -4
- package/src/sdk/tools.ts +18 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import { IndiciaCore } from "../core.js";
|
|
7
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
8
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
9
|
+
import * as M from "../lib/matchers.js";
|
|
10
|
+
import { compactMap } from "../lib/primitives.js";
|
|
11
|
+
import { safeParse } from "../lib/schemas.js";
|
|
12
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
13
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
14
|
+
import { pathToFunc } from "../lib/url.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/http-client-errors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { IndiciaError } from "../models/errors/indicia-error.js";
|
|
24
|
+
import { ResponseValidationError } from "../models/errors/response-validation-error.js";
|
|
25
|
+
import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
|
|
26
|
+
import * as operations from "../models/operations/index.js";
|
|
27
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
28
|
+
import { Result } from "../types/fp.js";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* VirusTotal File Intelligence
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Look up VirusTotal reputation and antivirus detection data for a URL, domain, IP address, or file hash.
|
|
35
|
+
*/
|
|
36
|
+
export function intelligenceVirusTotalIntelligence(
|
|
37
|
+
client: IndiciaCore,
|
|
38
|
+
request: operations.VirusTotalIntelligenceRequest,
|
|
39
|
+
options?: RequestOptions,
|
|
40
|
+
): APIPromise<
|
|
41
|
+
Result<
|
|
42
|
+
operations.VirusTotalIntelligenceResponse,
|
|
43
|
+
| errors.FailedResponseError
|
|
44
|
+
| IndiciaError
|
|
45
|
+
| ResponseValidationError
|
|
46
|
+
| ConnectionError
|
|
47
|
+
| RequestAbortedError
|
|
48
|
+
| RequestTimeoutError
|
|
49
|
+
| InvalidRequestError
|
|
50
|
+
| UnexpectedClientError
|
|
51
|
+
| SDKValidationError
|
|
52
|
+
>
|
|
53
|
+
> {
|
|
54
|
+
return new APIPromise($do(
|
|
55
|
+
client,
|
|
56
|
+
request,
|
|
57
|
+
options,
|
|
58
|
+
));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function $do(
|
|
62
|
+
client: IndiciaCore,
|
|
63
|
+
request: operations.VirusTotalIntelligenceRequest,
|
|
64
|
+
options?: RequestOptions,
|
|
65
|
+
): Promise<
|
|
66
|
+
[
|
|
67
|
+
Result<
|
|
68
|
+
operations.VirusTotalIntelligenceResponse,
|
|
69
|
+
| errors.FailedResponseError
|
|
70
|
+
| IndiciaError
|
|
71
|
+
| ResponseValidationError
|
|
72
|
+
| ConnectionError
|
|
73
|
+
| RequestAbortedError
|
|
74
|
+
| RequestTimeoutError
|
|
75
|
+
| InvalidRequestError
|
|
76
|
+
| UnexpectedClientError
|
|
77
|
+
| SDKValidationError
|
|
78
|
+
>,
|
|
79
|
+
APICall,
|
|
80
|
+
]
|
|
81
|
+
> {
|
|
82
|
+
const parsed = safeParse(
|
|
83
|
+
request,
|
|
84
|
+
(value) =>
|
|
85
|
+
z.parse(operations.VirusTotalIntelligenceRequest$outboundSchema, value),
|
|
86
|
+
"Input validation failed",
|
|
87
|
+
);
|
|
88
|
+
if (!parsed.ok) {
|
|
89
|
+
return [parsed, { status: "invalid" }];
|
|
90
|
+
}
|
|
91
|
+
const payload = parsed.value;
|
|
92
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
93
|
+
|
|
94
|
+
const path = pathToFunc("/v1/search/intelligence/virustotal")();
|
|
95
|
+
|
|
96
|
+
const headers = new Headers(compactMap({
|
|
97
|
+
"Content-Type": "application/json",
|
|
98
|
+
Accept: "application/json",
|
|
99
|
+
}));
|
|
100
|
+
|
|
101
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
102
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
103
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
104
|
+
|
|
105
|
+
const context = {
|
|
106
|
+
options: client._options,
|
|
107
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
108
|
+
operationID: "virusTotalIntelligence",
|
|
109
|
+
oAuth2Scopes: null,
|
|
110
|
+
|
|
111
|
+
resolvedSecurity: requestSecurity,
|
|
112
|
+
|
|
113
|
+
securitySource: client._options.apiKey,
|
|
114
|
+
retryConfig: options?.retries
|
|
115
|
+
|| client._options.retryConfig
|
|
116
|
+
|| { strategy: "none" },
|
|
117
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const requestRes = client._createRequest(context, {
|
|
121
|
+
security: requestSecurity,
|
|
122
|
+
method: "POST",
|
|
123
|
+
baseURL: options?.serverURL,
|
|
124
|
+
path: path,
|
|
125
|
+
headers: headers,
|
|
126
|
+
body: body,
|
|
127
|
+
userAgent: client._options.userAgent,
|
|
128
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
129
|
+
}, options);
|
|
130
|
+
if (!requestRes.ok) {
|
|
131
|
+
return [requestRes, { status: "invalid" }];
|
|
132
|
+
}
|
|
133
|
+
const req = requestRes.value;
|
|
134
|
+
|
|
135
|
+
const doResult = await client._do(req, {
|
|
136
|
+
context,
|
|
137
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
138
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
139
|
+
retryConfig: context.retryConfig,
|
|
140
|
+
retryCodes: context.retryCodes,
|
|
141
|
+
});
|
|
142
|
+
if (!doResult.ok) {
|
|
143
|
+
return [doResult, { status: "request-error", request: req }];
|
|
144
|
+
}
|
|
145
|
+
const response = doResult.value;
|
|
146
|
+
|
|
147
|
+
const responseFields = {
|
|
148
|
+
HttpMeta: { Response: response, Request: req },
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const [result] = await M.match<
|
|
152
|
+
operations.VirusTotalIntelligenceResponse,
|
|
153
|
+
| errors.FailedResponseError
|
|
154
|
+
| IndiciaError
|
|
155
|
+
| ResponseValidationError
|
|
156
|
+
| ConnectionError
|
|
157
|
+
| RequestAbortedError
|
|
158
|
+
| RequestTimeoutError
|
|
159
|
+
| InvalidRequestError
|
|
160
|
+
| UnexpectedClientError
|
|
161
|
+
| SDKValidationError
|
|
162
|
+
>(
|
|
163
|
+
M.json(200, operations.VirusTotalIntelligenceResponse$inboundSchema),
|
|
164
|
+
M.jsonErr(402, errors.FailedResponseError$inboundSchema),
|
|
165
|
+
M.jsonErr(500, errors.FailedResponseError$inboundSchema),
|
|
166
|
+
M.fail("4XX"),
|
|
167
|
+
M.fail("5XX"),
|
|
168
|
+
)(response, req, { extraFields: responseFields });
|
|
169
|
+
if (!result.ok) {
|
|
170
|
+
return [result, { status: "complete", request: req, response }];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return [result, { status: "complete", request: req, response }];
|
|
174
|
+
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as z from "zod/v4-mini";
|
|
6
6
|
import { IndiciaCore } from "../core.js";
|
|
7
7
|
import { encodeJSON } from "../lib/encodings.js";
|
|
8
|
+
import { EventStream } from "../lib/event-streams.js";
|
|
8
9
|
import { matchStatusCode } from "../lib/http.js";
|
|
9
10
|
import * as M from "../lib/matchers.js";
|
|
10
11
|
import { compactMap } from "../lib/primitives.js";
|
|
@@ -31,7 +32,7 @@ import { Result } from "../types/fp.js";
|
|
|
31
32
|
* GitHub Search
|
|
32
33
|
*
|
|
33
34
|
* @remarks
|
|
34
|
-
* Search GitHub profiles, info, and commit emails
|
|
35
|
+
* Search GitHub profiles, info, and commit emails. Streams progress updates via Server-Sent Events.
|
|
35
36
|
*/
|
|
36
37
|
export function socialsSearchGithub(
|
|
37
38
|
client: IndiciaCore,
|
|
@@ -39,7 +40,7 @@ export function socialsSearchGithub(
|
|
|
39
40
|
options?: RequestOptions,
|
|
40
41
|
): APIPromise<
|
|
41
42
|
Result<
|
|
42
|
-
operations.
|
|
43
|
+
EventStream<operations.GithubSearchEvent>,
|
|
43
44
|
| errors.FailedResponseError
|
|
44
45
|
| IndiciaError
|
|
45
46
|
| ResponseValidationError
|
|
@@ -65,7 +66,7 @@ async function $do(
|
|
|
65
66
|
): Promise<
|
|
66
67
|
[
|
|
67
68
|
Result<
|
|
68
|
-
operations.
|
|
69
|
+
EventStream<operations.GithubSearchEvent>,
|
|
69
70
|
| errors.FailedResponseError
|
|
70
71
|
| IndiciaError
|
|
71
72
|
| ResponseValidationError
|
|
@@ -94,7 +95,7 @@ async function $do(
|
|
|
94
95
|
|
|
95
96
|
const headers = new Headers(compactMap({
|
|
96
97
|
"Content-Type": "application/json",
|
|
97
|
-
Accept: "
|
|
98
|
+
Accept: "text/event-stream",
|
|
98
99
|
}));
|
|
99
100
|
|
|
100
101
|
const secConfig = await extractSecurity(client._options.apiKey);
|
|
@@ -148,7 +149,7 @@ async function $do(
|
|
|
148
149
|
};
|
|
149
150
|
|
|
150
151
|
const [result] = await M.match<
|
|
151
|
-
operations.
|
|
152
|
+
EventStream<operations.GithubSearchEvent>,
|
|
152
153
|
| errors.FailedResponseError
|
|
153
154
|
| IndiciaError
|
|
154
155
|
| ResponseValidationError
|
|
@@ -159,7 +160,21 @@ async function $do(
|
|
|
159
160
|
| UnexpectedClientError
|
|
160
161
|
| SDKValidationError
|
|
161
162
|
>(
|
|
162
|
-
M.
|
|
163
|
+
M.sse(
|
|
164
|
+
200,
|
|
165
|
+
z.pipe(
|
|
166
|
+
z.custom<ReadableStream<Uint8Array>>(x => x instanceof ReadableStream),
|
|
167
|
+
z.transform(stream => {
|
|
168
|
+
return new EventStream(stream, rawEvent => {
|
|
169
|
+
return {
|
|
170
|
+
done: false,
|
|
171
|
+
value: operations.GithubSearchEvent$inboundSchema.parse(rawEvent),
|
|
172
|
+
};
|
|
173
|
+
});
|
|
174
|
+
}),
|
|
175
|
+
),
|
|
176
|
+
),
|
|
177
|
+
M.jsonErr([400, 402], errors.FailedResponseError$inboundSchema),
|
|
163
178
|
M.jsonErr(500, errors.FailedResponseError$inboundSchema),
|
|
164
179
|
M.fail("4XX"),
|
|
165
180
|
M.fail("5XX"),
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as z from "zod/v4-mini";
|
|
6
6
|
import { IndiciaCore } from "../core.js";
|
|
7
7
|
import { encodeJSON } from "../lib/encodings.js";
|
|
8
|
+
import { EventStream } from "../lib/event-streams.js";
|
|
8
9
|
import { matchStatusCode } from "../lib/http.js";
|
|
9
10
|
import * as M from "../lib/matchers.js";
|
|
10
11
|
import { compactMap } from "../lib/primitives.js";
|
|
@@ -31,7 +32,7 @@ import { Result } from "../types/fp.js";
|
|
|
31
32
|
* Username Search V2
|
|
32
33
|
*
|
|
33
34
|
* @remarks
|
|
34
|
-
* Search various sites for a specific username
|
|
35
|
+
* Search various sites for a specific username. Streams progress updates via Server-Sent Events.
|
|
35
36
|
*/
|
|
36
37
|
export function socialsSearchUsername(
|
|
37
38
|
client: IndiciaCore,
|
|
@@ -39,7 +40,7 @@ export function socialsSearchUsername(
|
|
|
39
40
|
options?: RequestOptions,
|
|
40
41
|
): APIPromise<
|
|
41
42
|
Result<
|
|
42
|
-
operations.
|
|
43
|
+
EventStream<operations.UsernameSearchEvent>,
|
|
43
44
|
| errors.FailedResponseError
|
|
44
45
|
| IndiciaError
|
|
45
46
|
| ResponseValidationError
|
|
@@ -65,7 +66,7 @@ async function $do(
|
|
|
65
66
|
): Promise<
|
|
66
67
|
[
|
|
67
68
|
Result<
|
|
68
|
-
operations.
|
|
69
|
+
EventStream<operations.UsernameSearchEvent>,
|
|
69
70
|
| errors.FailedResponseError
|
|
70
71
|
| IndiciaError
|
|
71
72
|
| ResponseValidationError
|
|
@@ -94,7 +95,7 @@ async function $do(
|
|
|
94
95
|
|
|
95
96
|
const headers = new Headers(compactMap({
|
|
96
97
|
"Content-Type": "application/json",
|
|
97
|
-
Accept: "
|
|
98
|
+
Accept: "text/event-stream",
|
|
98
99
|
}));
|
|
99
100
|
|
|
100
101
|
const secConfig = await extractSecurity(client._options.apiKey);
|
|
@@ -148,7 +149,7 @@ async function $do(
|
|
|
148
149
|
};
|
|
149
150
|
|
|
150
151
|
const [result] = await M.match<
|
|
151
|
-
operations.
|
|
152
|
+
EventStream<operations.UsernameSearchEvent>,
|
|
152
153
|
| errors.FailedResponseError
|
|
153
154
|
| IndiciaError
|
|
154
155
|
| ResponseValidationError
|
|
@@ -159,7 +160,23 @@ async function $do(
|
|
|
159
160
|
| UnexpectedClientError
|
|
160
161
|
| SDKValidationError
|
|
161
162
|
>(
|
|
162
|
-
M.
|
|
163
|
+
M.sse(
|
|
164
|
+
200,
|
|
165
|
+
z.pipe(
|
|
166
|
+
z.custom<ReadableStream<Uint8Array>>(x => x instanceof ReadableStream),
|
|
167
|
+
z.transform(stream => {
|
|
168
|
+
return new EventStream(stream, rawEvent => {
|
|
169
|
+
return {
|
|
170
|
+
done: false,
|
|
171
|
+
value: operations.UsernameSearchEvent$inboundSchema.parse(
|
|
172
|
+
rawEvent,
|
|
173
|
+
),
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
}),
|
|
177
|
+
),
|
|
178
|
+
),
|
|
179
|
+
M.jsonErr([400, 402], errors.FailedResponseError$inboundSchema),
|
|
163
180
|
M.jsonErr(500, errors.FailedResponseError$inboundSchema),
|
|
164
181
|
M.fail("4XX"),
|
|
165
182
|
M.fail("5XX"),
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import { IndiciaCore } from "../core.js";
|
|
7
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
8
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
9
|
+
import * as M from "../lib/matchers.js";
|
|
10
|
+
import { compactMap } from "../lib/primitives.js";
|
|
11
|
+
import { safeParse } from "../lib/schemas.js";
|
|
12
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
13
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
14
|
+
import { pathToFunc } from "../lib/url.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/http-client-errors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { IndiciaError } from "../models/errors/indicia-error.js";
|
|
24
|
+
import { ResponseValidationError } from "../models/errors/response-validation-error.js";
|
|
25
|
+
import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
|
|
26
|
+
import * as operations from "../models/operations/index.js";
|
|
27
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
28
|
+
import { Result } from "../types/fp.js";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Download VirusTotal file
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Download a file from VirusTotal by its id. The file is returned base64-encoded.
|
|
35
|
+
*/
|
|
36
|
+
export function toolsDownloadVirusTotalFile(
|
|
37
|
+
client: IndiciaCore,
|
|
38
|
+
request: operations.DownloadVirusTotalFileRequest,
|
|
39
|
+
options?: RequestOptions,
|
|
40
|
+
): APIPromise<
|
|
41
|
+
Result<
|
|
42
|
+
operations.DownloadVirusTotalFileResponse,
|
|
43
|
+
| errors.FailedResponseError
|
|
44
|
+
| IndiciaError
|
|
45
|
+
| ResponseValidationError
|
|
46
|
+
| ConnectionError
|
|
47
|
+
| RequestAbortedError
|
|
48
|
+
| RequestTimeoutError
|
|
49
|
+
| InvalidRequestError
|
|
50
|
+
| UnexpectedClientError
|
|
51
|
+
| SDKValidationError
|
|
52
|
+
>
|
|
53
|
+
> {
|
|
54
|
+
return new APIPromise($do(
|
|
55
|
+
client,
|
|
56
|
+
request,
|
|
57
|
+
options,
|
|
58
|
+
));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function $do(
|
|
62
|
+
client: IndiciaCore,
|
|
63
|
+
request: operations.DownloadVirusTotalFileRequest,
|
|
64
|
+
options?: RequestOptions,
|
|
65
|
+
): Promise<
|
|
66
|
+
[
|
|
67
|
+
Result<
|
|
68
|
+
operations.DownloadVirusTotalFileResponse,
|
|
69
|
+
| errors.FailedResponseError
|
|
70
|
+
| IndiciaError
|
|
71
|
+
| ResponseValidationError
|
|
72
|
+
| ConnectionError
|
|
73
|
+
| RequestAbortedError
|
|
74
|
+
| RequestTimeoutError
|
|
75
|
+
| InvalidRequestError
|
|
76
|
+
| UnexpectedClientError
|
|
77
|
+
| SDKValidationError
|
|
78
|
+
>,
|
|
79
|
+
APICall,
|
|
80
|
+
]
|
|
81
|
+
> {
|
|
82
|
+
const parsed = safeParse(
|
|
83
|
+
request,
|
|
84
|
+
(value) =>
|
|
85
|
+
z.parse(operations.DownloadVirusTotalFileRequest$outboundSchema, value),
|
|
86
|
+
"Input validation failed",
|
|
87
|
+
);
|
|
88
|
+
if (!parsed.ok) {
|
|
89
|
+
return [parsed, { status: "invalid" }];
|
|
90
|
+
}
|
|
91
|
+
const payload = parsed.value;
|
|
92
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
93
|
+
|
|
94
|
+
const path = pathToFunc("/v1/tools/virustotal")();
|
|
95
|
+
|
|
96
|
+
const headers = new Headers(compactMap({
|
|
97
|
+
"Content-Type": "application/json",
|
|
98
|
+
Accept: "application/json",
|
|
99
|
+
}));
|
|
100
|
+
|
|
101
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
102
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
103
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
104
|
+
|
|
105
|
+
const context = {
|
|
106
|
+
options: client._options,
|
|
107
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
108
|
+
operationID: "downloadVirusTotalFile",
|
|
109
|
+
oAuth2Scopes: null,
|
|
110
|
+
|
|
111
|
+
resolvedSecurity: requestSecurity,
|
|
112
|
+
|
|
113
|
+
securitySource: client._options.apiKey,
|
|
114
|
+
retryConfig: options?.retries
|
|
115
|
+
|| client._options.retryConfig
|
|
116
|
+
|| { strategy: "none" },
|
|
117
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const requestRes = client._createRequest(context, {
|
|
121
|
+
security: requestSecurity,
|
|
122
|
+
method: "POST",
|
|
123
|
+
baseURL: options?.serverURL,
|
|
124
|
+
path: path,
|
|
125
|
+
headers: headers,
|
|
126
|
+
body: body,
|
|
127
|
+
userAgent: client._options.userAgent,
|
|
128
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
129
|
+
}, options);
|
|
130
|
+
if (!requestRes.ok) {
|
|
131
|
+
return [requestRes, { status: "invalid" }];
|
|
132
|
+
}
|
|
133
|
+
const req = requestRes.value;
|
|
134
|
+
|
|
135
|
+
const doResult = await client._do(req, {
|
|
136
|
+
context,
|
|
137
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
138
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
139
|
+
retryConfig: context.retryConfig,
|
|
140
|
+
retryCodes: context.retryCodes,
|
|
141
|
+
});
|
|
142
|
+
if (!doResult.ok) {
|
|
143
|
+
return [doResult, { status: "request-error", request: req }];
|
|
144
|
+
}
|
|
145
|
+
const response = doResult.value;
|
|
146
|
+
|
|
147
|
+
const responseFields = {
|
|
148
|
+
HttpMeta: { Response: response, Request: req },
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const [result] = await M.match<
|
|
152
|
+
operations.DownloadVirusTotalFileResponse,
|
|
153
|
+
| errors.FailedResponseError
|
|
154
|
+
| IndiciaError
|
|
155
|
+
| ResponseValidationError
|
|
156
|
+
| ConnectionError
|
|
157
|
+
| RequestAbortedError
|
|
158
|
+
| RequestTimeoutError
|
|
159
|
+
| InvalidRequestError
|
|
160
|
+
| UnexpectedClientError
|
|
161
|
+
| SDKValidationError
|
|
162
|
+
>(
|
|
163
|
+
M.json(200, operations.DownloadVirusTotalFileResponse$inboundSchema),
|
|
164
|
+
M.jsonErr(402, errors.FailedResponseError$inboundSchema),
|
|
165
|
+
M.jsonErr(500, errors.FailedResponseError$inboundSchema),
|
|
166
|
+
M.fail("4XX"),
|
|
167
|
+
M.fail("5XX"),
|
|
168
|
+
)(response, req, { extraFields: responseFields });
|
|
169
|
+
if (!result.ok) {
|
|
170
|
+
return [result, { status: "complete", request: req, response }];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return [result, { status: "complete", request: req, response }];
|
|
174
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -58,7 +58,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
58
58
|
export const SDK_METADATA = {
|
|
59
59
|
language: "typescript",
|
|
60
60
|
openapiDocVersion: "1.0.0",
|
|
61
|
-
sdkVersion: "1.2.
|
|
61
|
+
sdkVersion: "1.2.2",
|
|
62
62
|
genVersion: "2.912.1",
|
|
63
|
-
userAgent: "speakeasy-sdk/typescript 1.2.
|
|
63
|
+
userAgent: "speakeasy-sdk/typescript 1.2.2 2.912.1 1.0.0 @indiciaosint/sdk",
|
|
64
64
|
} as const;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import * as types from "../../types/primitives.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdk-validation-error.js";
|
|
10
|
+
|
|
11
|
+
export type DownloadVirusTotalFileRequest = {
|
|
12
|
+
id: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type DownloadVirusTotalFileData = {
|
|
16
|
+
content: string;
|
|
17
|
+
encoding: string;
|
|
18
|
+
id: string;
|
|
19
|
+
size: number;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Successful response
|
|
24
|
+
*/
|
|
25
|
+
export type DownloadVirusTotalFileResponse = {
|
|
26
|
+
success: boolean;
|
|
27
|
+
data?: DownloadVirusTotalFileData | undefined;
|
|
28
|
+
error?: string | undefined;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** @internal */
|
|
32
|
+
export type DownloadVirusTotalFileRequest$Outbound = {
|
|
33
|
+
id: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** @internal */
|
|
37
|
+
export const DownloadVirusTotalFileRequest$outboundSchema: z.ZodMiniType<
|
|
38
|
+
DownloadVirusTotalFileRequest$Outbound,
|
|
39
|
+
DownloadVirusTotalFileRequest
|
|
40
|
+
> = z.object({
|
|
41
|
+
id: z.string(),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export function downloadVirusTotalFileRequestToJSON(
|
|
45
|
+
downloadVirusTotalFileRequest: DownloadVirusTotalFileRequest,
|
|
46
|
+
): string {
|
|
47
|
+
return JSON.stringify(
|
|
48
|
+
DownloadVirusTotalFileRequest$outboundSchema.parse(
|
|
49
|
+
downloadVirusTotalFileRequest,
|
|
50
|
+
),
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** @internal */
|
|
55
|
+
export const DownloadVirusTotalFileData$inboundSchema: z.ZodMiniType<
|
|
56
|
+
DownloadVirusTotalFileData,
|
|
57
|
+
unknown
|
|
58
|
+
> = z.object({
|
|
59
|
+
content: types.string(),
|
|
60
|
+
encoding: types.string(),
|
|
61
|
+
id: types.string(),
|
|
62
|
+
size: types.number(),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export function downloadVirusTotalFileDataFromJSON(
|
|
66
|
+
jsonString: string,
|
|
67
|
+
): SafeParseResult<DownloadVirusTotalFileData, SDKValidationError> {
|
|
68
|
+
return safeParse(
|
|
69
|
+
jsonString,
|
|
70
|
+
(x) => DownloadVirusTotalFileData$inboundSchema.parse(JSON.parse(x)),
|
|
71
|
+
`Failed to parse 'DownloadVirusTotalFileData' from JSON`,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** @internal */
|
|
76
|
+
export const DownloadVirusTotalFileResponse$inboundSchema: z.ZodMiniType<
|
|
77
|
+
DownloadVirusTotalFileResponse,
|
|
78
|
+
unknown
|
|
79
|
+
> = z.object({
|
|
80
|
+
success: types.boolean(),
|
|
81
|
+
data: types.optional(z.lazy(() => DownloadVirusTotalFileData$inboundSchema)),
|
|
82
|
+
error: types.optional(types.string()),
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export function downloadVirusTotalFileResponseFromJSON(
|
|
86
|
+
jsonString: string,
|
|
87
|
+
): SafeParseResult<DownloadVirusTotalFileResponse, SDKValidationError> {
|
|
88
|
+
return safeParse(
|
|
89
|
+
jsonString,
|
|
90
|
+
(x) => DownloadVirusTotalFileResponse$inboundSchema.parse(JSON.parse(x)),
|
|
91
|
+
`Failed to parse 'DownloadVirusTotalFileResponse' from JSON`,
|
|
92
|
+
);
|
|
93
|
+
}
|
|
@@ -68,6 +68,9 @@ export const GetActivityType = {
|
|
|
68
68
|
Username: "username",
|
|
69
69
|
Usernames: "usernames",
|
|
70
70
|
Vehicle: "vehicle",
|
|
71
|
+
VirustotalContent: "virustotal.content",
|
|
72
|
+
VirustotalDownload: "virustotal.download",
|
|
73
|
+
VirustotalIntelligence: "virustotal.intelligence",
|
|
71
74
|
WebDbs: "web-dbs",
|
|
72
75
|
Whois: "whois",
|
|
73
76
|
} as const;
|
|
@@ -79,6 +79,9 @@ export const RestrictedFeatures = {
|
|
|
79
79
|
Uk: "uk",
|
|
80
80
|
Username: "username",
|
|
81
81
|
Vehicle: "vehicle",
|
|
82
|
+
VirustotalContent: "virustotal.content",
|
|
83
|
+
VirustotalDownload: "virustotal.download",
|
|
84
|
+
VirustotalIntelligence: "virustotal.intelligence",
|
|
82
85
|
WebDbs: "web-dbs",
|
|
83
86
|
Whois: "whois",
|
|
84
87
|
} as const;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
export * from "./bypass-double-counter.js";
|
|
6
6
|
export * from "./delete-activity.js";
|
|
7
7
|
export * from "./download-intelx-file.js";
|
|
8
|
+
export * from "./download-virus-total-file.js";
|
|
8
9
|
export * from "./geolocate-media.js";
|
|
9
10
|
export * from "./get-activity.js";
|
|
10
11
|
export * from "./get-info.js";
|
|
@@ -37,3 +38,5 @@ export * from "./search-username.js";
|
|
|
37
38
|
export * from "./search-web-databases.js";
|
|
38
39
|
export * from "./search-whois.js";
|
|
39
40
|
export * from "./send-organization-credits.js";
|
|
41
|
+
export * from "./virus-total-content.js";
|
|
42
|
+
export * from "./virus-total-intelligence.js";
|
|
@@ -66,6 +66,9 @@ export const ListActivitiesType = {
|
|
|
66
66
|
Username: "username",
|
|
67
67
|
Usernames: "usernames",
|
|
68
68
|
Vehicle: "vehicle",
|
|
69
|
+
VirustotalContent: "virustotal.content",
|
|
70
|
+
VirustotalDownload: "virustotal.download",
|
|
71
|
+
VirustotalIntelligence: "virustotal.intelligence",
|
|
69
72
|
WebDbs: "web-dbs",
|
|
70
73
|
Whois: "whois",
|
|
71
74
|
} as const;
|