A TypeScript client library for interacting with Workday Reports-as-a-Service APIs.
- A workday API client. These are used to initialize the RaaS client:
interface IsuCredentials {
clientId: string,
clientSecret: string,
refreshToken: string,
}- A Workday REST API endpoint for a Workday RaaS report.
The library provides two utility classes: RaasClient and WorkdayRequest. These work together to build reusable requests.
// Store the credentials as a JS object
const credentials: IsuCredentials = {
clientId: "myClientId",
clientSecret: "myClientSecret",
refreshToken: "myRefreshToken",
}
const authEndpoint = "authEndpoint"
// Initialize a client using the credentials and an auth endpoint
const client = new RaasClient(credentials, authEndpoint)
// Build requests
const raasEndpoint1 = "https://myRaasEndpoint.com"
const raasEndpoint2
const req1 = client
.request(raasEndpoint1)
.param("myParam", "myParamVal")
.param("multiValParam", ["val1", "val2", "val3")
const req2 = client
.request(raasEndpoint2)
.param("myPrompt", "myPromptVal")
// Send the requests in different formats
const jsonRes = await req1.json()
const xmlRes = await req1.xml()
const csv = await req2.csv()