Skip to content

Commit

Permalink
Add "access" param to IItemResourceRequestOptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
ssylvia committed Oct 2, 2018
1 parent 2863b5f commit 182ca56
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/arcgis-rest-items/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export interface IItemResourceRequestOptions extends IItemIdRequestOptions {
* Text input to be added as a file resource.
*/
content?: string;
/**
* Set file resource to be private regardless of the item access level, or revert it by setting
* it to inherit which makes the item resource have the same access as the item.
*/
access?: "private" | "inherit";
resource?: any;
}

Expand Down
2 changes: 2 additions & 0 deletions packages/arcgis-rest-items/test/add.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ describe("search", () => {
id: "3ef",
// File() is only available in the browser
resource: file,
access: "private",
name: "thebigkahuna",
...MOCK_USER_REQOPTS
})
Expand All @@ -203,6 +204,7 @@ describe("search", () => {
expect(params.get("token")).toEqual("fake-token");
expect(params.get("f")).toEqual("json");
expect(params.get("file")).toEqual(file);
expect(params.get("access")).toEqual("private");
expect(params.get("fileName")).toEqual("thebigkahuna");
}

Expand Down
2 changes: 2 additions & 0 deletions packages/arcgis-rest-items/test/update.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ describe("search", () => {
owner: "dbouwman",
name: "image/banner.png",
content: "jumbotron",
access: "inherit",
...MOCK_USER_REQOPTS
})
.then(response => {
Expand All @@ -168,6 +169,7 @@ describe("search", () => {
encodeParam("fileName", "image/banner.png")
);
expect(options.body).toContain(encodeParam("text", "jumbotron"));
expect(options.body).toContain(encodeParam("access", "inherit"));
expect(options.body).toContain(encodeParam("token", "fake-token"));
done();
})
Expand Down

0 comments on commit 182ca56

Please sign in to comment.