File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed
Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ import { Profile } from "." ;
2+
3+ /**
4+ * Retry options.
5+ *
6+ * Further opts could be used. Check {@link https://github.com/sindresorhus/p-retry | p-retry} for more info.
7+ */
8+ export interface RetryOpts {
9+ /**
10+ * The maximum amount of times to retry the operation.
11+ * @default 3
12+ */
13+ retries ?: number ;
14+ /**
15+ * The exponential factor to use.
16+ * @default 3
17+ */
18+ factor ?: number ;
19+ /**
20+ * The number of milliseconds before starting the first retry.
21+ * @default 5000
22+ */
23+ minTimeout ?: number ;
24+ }
25+
26+ /**
27+ * Use {@link Profile} opt-in for retrying failed requests to the endpoint.
28+ * @param profile - The base {@link Profile}
29+ * @param retryOpts - The {@link RetryOpts}
30+ */
31+ export function withRetrying ( profile : Profile , retryOpts ?: RetryOpts ) : Profile ;
Original file line number Diff line number Diff line change 1+ import { Profile } from "." ;
2+
3+ /**
4+ * Use {@link Profile} opt-in for throttling requests to the endpoint.
5+ * @param profile - The base {@link Profile}
6+ * @param [limit=5] - The maximum number of calls within an {@link interval}.
7+ * @param [interval=1000] - The timespan for {@link limit} in milliseconds.
8+ */
9+ export function withThrottling ( profile : Profile , limit ?: number , interval ?: number ) : Profile ;
Original file line number Diff line number Diff line change 1515 },
1616 "files" : [
1717 " index.d.ts" ,
18+ " throttle.d.ts" ,
19+ " retry.d.ts" ,
1820 " hafas-client-tests.ts"
1921 ]
2022}
You can’t perform that action at this time.
0 commit comments