@pnp/cli-microsoft365
Version:
Manage Microsoft 365 and SharePoint Framework projects on any platform
43 lines • 1.37 kB
JavaScript
import { z } from 'zod';
import { globalOptionsZod } from '../../../../Command.js';
import request from '../../../../request.js';
import { validation } from '../../../../utils/validation.js';
import { zod } from '../../../../utils/zod.js';
import SpoCommand from '../../../base/SpoCommand.js';
import commands from '../../commands.js';
const options = globalOptionsZod
.extend({
url: zod.alias('u', z.string().refine(url => validation.isValidSharePointUrl(url) === true, {
message: 'Specify a valid SharePoint site URL'
}))
})
.strict();
class SpoSiteGetCommand extends SpoCommand {
get name() {
return commands.SITE_GET;
}
get description() {
return 'Gets information about the specific site collection';
}
get schema() {
return options;
}
async commandAction(logger, args) {
const requestOptions = {
url: `${args.options.url}/_api/site`,
headers: {
accept: 'application/json;odata=nometadata'
},
responseType: 'json'
};
try {
const res = await request.get(requestOptions);
await logger.log(res);
}
catch (err) {
this.handleRejectedODataJsonPromise(err);
}
}
}
export default new SpoSiteGetCommand();
//# sourceMappingURL=site-get.js.map