Skip to content

Commit

Permalink
Updated the mapper properties for site. Fixed the sites v2 to return …
Browse files Browse the repository at this point in the history
…the correct methods, based on inputs.
  • Loading branch information
gunjandatta committed Dec 17, 2024
1 parent 7978e5f commit daa835c
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 308 deletions.
2 changes: 1 addition & 1 deletion dist/gd-sprest.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/gd-sprest.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gd-sprest",
"version": "8.6.8",
"version": "8.6.9",
"description": "An easy way to develop against the SharePoint REST API.",
"author": "Gunjan Datta <[email protected]> (https://gunjandatta.github.io)",
"license": "MIT",
Expand Down
12 changes: 8 additions & 4 deletions src/mapper/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6673,6 +6673,14 @@ export const MapperV2: IMapper = {
query: { argNames: ["oData"], requestType: RequestType.OData },
},
site: {
properties: [
"columns|columns|/[Name]|columnDefinition", "drives|drives|/[Name]|drive",
"externalColumns|externalColumns|/[Name]|columnDefinition",
"items|listItems|/[Name]|listItem", "lists|lists|/[Name]|list",
"operations|operations|/[Name]|operation", "pages|pages|/[Name]|baseSitePage",
"permissions|permissions|/[Name]|permission", "sites|sites|/[Name]|site",
"termStores|termStores|/[Name]|termStore"
],
query: { argNames: ["oData"], requestType: RequestType.OData },
analytics: {
returnType: "itemAnalytics"
Expand Down Expand Up @@ -6769,10 +6777,6 @@ export const MapperV2: IMapper = {
},
},
sites: {
properties: [
"drives|drives|/[Name]|drive", "items|listItems|/[Name]|listItem",
"lists|lists|/[Name]|list"
],
query: { argNames: ["oData"], requestType: RequestType.OData },
add: {
argNames: ["values"],
Expand Down
299 changes: 0 additions & 299 deletions src/mapper/v2.txt

This file was deleted.

2 changes: 1 addition & 1 deletion src/rest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { IREST } from "../@types";
* SharePoint REST Library
*/
export const $REST: IREST = {
__ver: 8.68,
__ver: 8.69,
AppContext: (siteUrl: string) => { return Lib.Site.getAppContext(siteUrl); },
Apps: Lib.Apps,
ContextInfo: Lib.ContextInfo,
Expand Down
6 changes: 5 additions & 1 deletion src/v2/sites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ export const sites: Isites = ((props: { siteId?: string, webId?: string, targetI
}

// Add the methods
Request.addMethods(sites, { __metadata: { type: "@odata.context/_api/v2.0/$metadata#sites" } });
if (props.siteId || props.webId) {
Request.addMethods(sites, { __metadata: { type: "@odata.context/_api/v2.0/$metadata#site" } });
} else {
Request.addMethods(sites, { __metadata: { type: "@odata.context/_api/v2.0/$metadata#sites" } });
}

// Return the sites
return sites;
Expand Down

0 comments on commit daa835c

Please sign in to comment.