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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,5 @@ dist

# End of https://www.toptal.com/developers/gitignore/api/node,macos
test/credentials*.json
credentials*.json
test/*.xml
18 changes: 17 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,20 @@
| `getActivity`| https://docs.oracle.com/en/cloud/saas/field-service/cxfsc/op-rest-ofsccore-v1-activities-activityid-get.html |
| `updateActivity`| https://docs.oracle.com/en/cloud/saas/field-service/cxfsc/op-rest-ofsccore-v1-activities-activityid-patch.html
| `getSubscriptions` | https://docs.oracle.com/en/cloud/saas/field-service/cxfsc/op-rest-ofsccore-v1-events-subscriptions-get.html
| `importPlugins` | https://docs.oracle.com/en/cloud/saas/field-service/cxfsc/op-rest-ofscmetadata-v1-plugins-custom-actions-import-post.html
| `importPlugins` | https://docs.oracle.com/en/cloud/saas/field-service/cxfsc/op-rest-ofscmetadata-v1-plugins-custom-actions-import-post.html

## Sample

1. Generate the javascript version of the module (`npm run dist`). A new folder called `dist` will be created, containing a javascript module (`ofs.es.js`)
2. Create in the same folder as the sample a file called `credentials_sample.json` with the following content, replacing the placeholders by your own environment data:
```
{
"instance": "<YOUR OFS INSTANCE NAME>",
"clientId": "<YOUR APPLICATION CLIENT ID>",
"clientSecret": "<YOUR APPLICATION CLIENT SECRET>"
}
```
3. Run the sample. The output should be a list of the active event subscriptions in your environment
```
node sample.js
```
12 changes: 12 additions & 0 deletions docs/sample/sample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright © 2023, Oracle and/or its affiliates.
* Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl/
*/

import { OFS } from "../../dist/ofs.es.js";
import myCredentials from "./credentials_sample.json" assert { type: "json" };

// Get the list of active subscriptions
const myProxy = new OFS(myCredentials);
const result = await myProxy.getSubscriptions();
console.log(result.data);
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"url": "https://github.com/oracle/ofs-js"
},
"scripts": {
"prepare": "tsc",
"build": "tsc",
"start": "ts-node src/index.ts",
"test": "jest",
Expand Down