diff --git a/packages/storage/src/internals/apis/list.ts b/packages/storage/src/internals/apis/list.ts index b3d14c8512f..9fb00cc348a 100644 --- a/packages/storage/src/internals/apis/list.ts +++ b/packages/storage/src/internals/apis/list.ts @@ -4,10 +4,23 @@ import { Amplify } from '@aws-amplify/core'; import { list as listInternal } from '../../providers/s3/apis/internal/list'; -import { ListInput } from '../types/inputs'; -import { ListPaginateWithPathInput } from '../../providers/s3'; +import { ListAllInput, ListInput, ListPaginateInput } from '../types/inputs'; +import { + ListAllWithPathOutput, + ListPaginateWithPathOutput, +} from '../../providers/s3'; import { ListOutput } from '../types/outputs'; +/** + * @internal + */ +export function list(input: ListAllInput): Promise; +/** + * @internal + */ +export function list( + input: ListPaginateInput, +): Promise; /** * @internal */ @@ -21,8 +34,8 @@ export function list(input: ListInput): Promise { listAll: input.options?.listAll, // Pagination options - nextToken: (input as ListPaginateWithPathInput).options?.nextToken, - pageSize: (input as ListPaginateWithPathInput).options?.pageSize, + nextToken: (input as ListPaginateInput).options?.nextToken, + pageSize: (input as ListPaginateInput).options?.pageSize, // Advanced options locationCredentialsProvider: input.options?.locationCredentialsProvider, }, diff --git a/packages/storage/src/internals/index.ts b/packages/storage/src/internals/index.ts index 00f48dc0b67..f1b0acc36e0 100644 --- a/packages/storage/src/internals/index.ts +++ b/packages/storage/src/internals/index.ts @@ -16,6 +16,8 @@ export { GetUrlInput, CopyInput, ListInput, + ListAllInput, + ListPaginateInput, RemoveInput, UploadDataInput, DownloadDataInput, diff --git a/packages/storage/src/internals/types/inputs.ts b/packages/storage/src/internals/types/inputs.ts index 522266108e5..7d3d6ca94bb 100644 --- a/packages/storage/src/internals/types/inputs.ts +++ b/packages/storage/src/internals/types/inputs.ts @@ -48,13 +48,28 @@ export interface GetDataAccessInput { /** * @internal */ -export type ListInput = ExtendInputWithAdvancedOptions< - ListAllWithPathInput | ListPaginateWithPathInput, +export type ListAllInput = ExtendInputWithAdvancedOptions< + ListAllWithPathInput, + { + locationCredentialsProvider?: CredentialsProvider; + } +>; + +/** + * @internal + */ +export type ListPaginateInput = ExtendInputWithAdvancedOptions< + ListPaginateWithPathInput, { locationCredentialsProvider?: CredentialsProvider; } >; +/** + * @internal + */ +export type ListInput = ListAllInput | ListPaginateInput; + /** * @internal */