Repository navigation
Expand file tree
/
Copy pathanalyses.ts
More file actions
100 lines (92 loc) · 3.37 KB
/
Copy pathanalyses.ts
File metadata and controls
100 lines (92 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import * as ConfigRegistryAPI from './config-registry';
import { AnalysisSummariesOffsetPagination } from './config-registry';
import { APIPromise } from '../../core/api-promise';
import { OffsetPagination, type OffsetPaginationParams, PagePromise } from '../../core/pagination';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
import {
waitForConfigRegistryAnalysis,
type ConfigRegistryAnalysisWaitOptions,
} from '../../lib/config-registry-wait';
/**
* Resolve browser and proxy recommendations for bot-protected sites.
*/
export class Analyses extends APIResource {
/**
* Returns a project-scoped historical analysis and the recommendation outcome
* concluded by that run. Later knowledge does not change this response.
*
* @example
* ```ts
* const configRegistryResponse =
* await client.configRegistry.analyses.retrieve('id');
* ```
*/
retrieve(id: string, options?: RequestOptions): APIPromise<ConfigRegistryAPI.ConfigRegistryResponse> {
return this._client.get(path`/config-registry/analyses/${id}`, options);
}
/**
* Wait for an analysis to finish and return its complete result.
*
* The first retrieval happens immediately. `maxWaitMs` is a soft polling
* deadline: an in-flight request and its normal retries may finish after it.
* Timing out or aborting does not cancel the remote analysis.
*/
async waitForResult(
id: string,
options?: ConfigRegistryAnalysisWaitOptions,
): Promise<ConfigRegistryAPI.ConfigRegistryResponse> {
return await waitForConfigRegistryAnalysis(this, id, options);
}
/**
* Lists analyses for the selected project, newest first.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const analysisSummary of client.configRegistry.analyses.list()) {
* // ...
* }
* ```
*/
list(
query: AnalysisListParams | null | undefined = {},
options?: RequestOptions,
): PagePromise<AnalysisSummariesOffsetPagination, ConfigRegistryAPI.AnalysisSummary> {
return this._client.getAPIList(
'/config-registry/analyses',
OffsetPagination<ConfigRegistryAPI.AnalysisSummary>,
{ query, ...options },
);
}
/**
* Requests cancellation of a running project-scoped analysis. Cancellation is
* asynchronous; poll the analysis until its status becomes canceled. Repeating the
* request after the analysis reaches a terminal state returns the existing
* outcome.
*
* @example
* ```ts
* const configRegistryResponse =
* await client.configRegistry.analyses.cancel('id');
* ```
*/
cancel(id: string, options?: RequestOptions): APIPromise<ConfigRegistryAPI.ConfigRegistryResponse> {
return this._client.post(path`/config-registry/analyses/${id}/cancel`, options);
}
}
export interface AnalysisListParams extends OffsetPaginationParams {
/**
* Case-insensitive substring search over requested URLs.
*/
search?: string;
}
export declare namespace Analyses {
export {
type AnalysisListParams as AnalysisListParams,
type ConfigRegistryAnalysisWaitOptions as ConfigRegistryAnalysisWaitOptions,
};
}
export { type AnalysisSummariesOffsetPagination, type ConfigRegistryAnalysisWaitOptions };