rewrite artifacts client to have public and internal implementations

This commit is contained in:
Rob Herley
2023-11-30 03:47:04 +00:00
committed by GitHub
parent 0787a93181
commit 695bf98f84
10 changed files with 1149 additions and 254 deletions

View File

@@ -3,6 +3,7 @@ import {BearerCredentialHandler} from '@actions/http-client/lib/auth'
import {info, debug} from '@actions/core'
import {ArtifactServiceClientJSON} from '../../generated'
import {getResultsServiceUrl, getRuntimeToken} from './config'
import {getUserAgentString} from './user-agent'
// The twirp http client must implement this interface
interface Rpc {
@@ -157,17 +158,16 @@ class ArtifactHttpClient implements Rpc {
}
}
export function createArtifactTwirpClient(
type: 'upload' | 'download',
maxAttempts?: number,
baseRetryIntervalMilliseconds?: number,
export function internalArtifactTwirpClient(options?: {
maxAttempts?: number
baseRetryIntervalMilliseconds?: number
retryMultiplier?: number
): ArtifactServiceClientJSON {
}): ArtifactServiceClientJSON {
const client = new ArtifactHttpClient(
`@actions/artifact-${type}`,
maxAttempts,
baseRetryIntervalMilliseconds,
retryMultiplier
getUserAgentString(),
options?.maxAttempts,
options?.baseRetryIntervalMilliseconds,
options?.retryMultiplier
)
return new ArtifactServiceClientJSON(client)
}