Skip to content

Commit

Permalink
feat(search): allows use of the newly added but undocumented searchUs…
Browse files Browse the repository at this point in the history
…erAccess and searchUserName par

AFFECTS PACKAGES:
@esri/arcgis-rest-portal
  • Loading branch information
mjuniper committed Aug 25, 2021
1 parent 7ab0721 commit 279ef9e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/arcgis-rest-portal/src/util/generic-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
ISearchResult
} from "../util/search";

export function genericSearch<T extends IItem | IGroup | IUser>(
export function genericSearch<T extends IItem | IGroup | IUser> (
search:
| string
| ISearchOptions
Expand All @@ -36,7 +36,7 @@ export function genericSearch<T extends IItem | IGroup | IUser>(
} else {
options = appendCustomParams<ISearchOptions>(
search,
["q", "num", "start", "sortField", "sortOrder"],
["q", "num", "start", "sortField", "sortOrder", "searchUserAccess", "searchUserName"],
{
httpMethod: "GET"
}
Expand Down Expand Up @@ -74,7 +74,7 @@ export function genericSearch<T extends IItem | IGroup | IUser>(
// send the request
return request(url, options).then(r => {
if (r.nextStart && r.nextStart !== -1) {
r.nextPage = function() {
r.nextPage = function () {
let newOptions: ISearchOptions;

if (
Expand Down
7 changes: 5 additions & 2 deletions packages/arcgis-rest-portal/test/items/search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,16 @@ describe("search", () => {
num: 12,
start: 22,
sortField: "title",
sortOrder: "desc"
sortOrder: "desc",
searchUserAccess: "groupMember",
searchUserName: "casey",
foo: "bar" // this one should not end up on the url
})
.then(() => {
expect(fetchMock.called()).toEqual(true);
const [url, options]: [string, RequestInit] = fetchMock.lastCall("*");
expect(url).toEqual(
"https://www.arcgis.com/sharing/rest/search?f=json&q=DC%20AND%20typekeywords%3AhubSiteApplication&num=12&start=22&sortField=title&sortOrder=desc"
"https://www.arcgis.com/sharing/rest/search?f=json&q=DC%20AND%20typekeywords%3AhubSiteApplication&num=12&start=22&sortField=title&sortOrder=desc&searchUserAccess=groupMember&searchUserName=casey"
);
expect(options.method).toBe("GET");
done();
Expand Down

0 comments on commit 279ef9e

Please sign in to comment.