Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
],
"name": "@ofs-users/proxy",
"type": "module",
"version": "1.5.1",
"version": "1.6.0",
"description": "A Javascript proxy to access Oracle Field Service via REST API",
"main": "dist/ofs.es.js",
"module": "dist/ofs.es.js",
Expand Down
23 changes: 22 additions & 1 deletion src/OFS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,15 @@ export class OFS {
return "Basic " + hash;
}

private _get(partialURL: string): Promise<OFSResponse> {
private _get(
partialURL: string,
params: any = undefined
): Promise<OFSResponse> {
var theURL = new URL(partialURL, this._baseURL);
if (params != undefined) {
const urlSearchParams = new URLSearchParams(params);
theURL.search = urlSearchParams.toString();
}
var myHeaders = new Headers();
myHeaders.append("Authorization", this.authorization);
var requestOptions = {
Expand Down Expand Up @@ -271,6 +278,20 @@ export class OFS {
return this._patch(partialURL, data);
}

// Core: User Management
async getUsers(
offset: number = 0,
limit: number = 100
): Promise<OFSResponse> {
const partialURL = "/rest/ofscCore/v1/users";
return this._get(partialURL, { offset: offset, limit: limit });
}

async getUserDetails(uname: string): Promise<OFSResponse> {
const partialURL = `/rest/ofscCore/v1/users/${uname}`;
return this._get(partialURL);
}

// Metadata: Plugin Management
async importPlugins(file?: PathLike, data?: string): Promise<OFSResponse> {
const partialURL =
Expand Down
Loading