Skip to content

Conversation

@Adam-it
Copy link
Member

@Adam-it Adam-it commented Nov 29, 2025

Closes #6719

@Adam-it Adam-it changed the title Extends 'spo container get' command. Closes #6719 Extends 'spe container get' command. Closes #6719 Nov 29, 2025
Copy link
Contributor

@MartinM85 MartinM85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution @Adam-it 🚀

I have a few notes regarding the API calls optimization.

try {
const res = await request.get<SpeContainer>(requestOptions);
await logger.log(res);
const response = await request.get<{ value?: SpeContainer[] }>(requestOptions);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try to use $filter and return only containers with the specific name?

If filtering by the displayName not supported...rather use the odata.getAllItems which handles also paging and returns all items.

Suggested change
const response = await request.get<{ value?: SpeContainer[] }>(requestOptions);
const response = await odata.getAllItems<SpeContainer[]>(requestOptions);

According to the doc the /v1.0/storage/fileStorage/containers endpoint requires the containerTypeId parameter. Does the query work without the containerTypeId?

In fact, if a user wants to retrieve a container by it's name, we will make two calls. One call to get all containers and find the one with the specific name. The second call to get a container by it's id even if we have already retrieved the container and its details in the first call.

throw 'Invalid Request';
});

await command.action(logger, { options: { id: containerId } } as any);
Copy link
Contributor

@MartinM85 MartinM85 Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parse the command option from zod schema to ensure the inputs are correct.

Suggested change
await command.action(logger, { options: { id: containerId } } as any);
await command.action(logger, { options: schema.parse({ id: containerId }) } as any);

Please do it for all unit tests.

@MartinM85 MartinM85 self-assigned this Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a name option to spe container get command

2 participants