Skip to content

listFiles response type is not valid for folders #105

@lorenzocestaro

Description

@lorenzocestaro

The response type for the listFIiles API is only valid for file objects, but if the API is used to fetch folders the response will be different, for example:

{
  type: 'folder',
  name: 'folder-name',
  createdAt: '2024-12-02T20:54:59.433Z',
  updatedAt: '2024-12-02T20:54:59.433Z',
  folderId: '674e1ea3e375273f609c',
  folderPath: '/path/to/folder'
}

Unfortunately this is not even documented in the official API documentation of ImageKit. And there might even be a third response type for file-version. All available types according to the docs are:

  • file
  • file-version
  • folder
  • all

From the top of my head a solution to this would be making the response type dependent on the input type parameter (with all returning a union of all types). This should be quite clean and users can easily narrow down type using type in each object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions