Skip to content

Commit

Permalink
docs(zeebe): document ZeebeRestClient
Browse files Browse the repository at this point in the history
  • Loading branch information
jwulf committed May 20, 2024
1 parent 74ea913 commit faf2c7d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { Camunda8 } from '@camunda8/sdk'

const c8 = new Camunda8()
const zeebe = c8.getZeebeGrpcApiClient()
const zeebeRest = c8.getZeebeRestClient()
const operate = c8.getOperateApiClient()
const optimize = c8.getOptimizeApiClient()
const tasklist = c8.getTasklistApiClient()
Expand Down Expand Up @@ -119,7 +120,7 @@ This is the complete environment configuration needed to run against the Dockeri
```bash
# Self-Managed
export ZEEBE_GRPC_ADDRESS='localhost:26500'
export ZEEBE_REST_ADDRESS='localhost:8080/v1/'
export ZEEBE_REST_ADDRESS='http://localhost:8080'
export ZEEBE_CLIENT_ID='zeebe'
export ZEEBE_CLIENT_SECRET='zecret'
export CAMUNDA_OAUTH_URL='http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token'
Expand Down Expand Up @@ -245,3 +246,9 @@ class MyLargerDto extends LosslessDto {
The Zeebe worker receives custom headers as `job.customHeaders`. The `ZBClient.createWorker()` method accepts a `customHeadersDto` to control the behavior of custom header parsing of number values and provide design-time type information.

This follows the same strategy as the job variables, as previously described.

## Zeebe User Tasks

From 8.5, you can use Zeebe user tasks. See the documentation on [how to migrate to Zeebe user tasks](https://docs.camunda.io/docs/apis-tools/tasklist-api-rest/migrate-to-zeebe-user-tasks/).

The SDK supports the Zeebe REST API. Be sure to set the `ZEEBE_REST_ADDRESS` either via environment variable or configuration field.
4 changes: 4 additions & 0 deletions smoke-test/smoke-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ const operate = camunda.getOperateApiClient()

// console.log(operate)

const zeebeRest = camunda.getZeebeRestClient()

// console.log(zeebeRest)

console.log('Smoke test passed!')
14 changes: 13 additions & 1 deletion src/c8/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { OAuthProvider } from '../oauth'
import { OperateApiClient } from '../operate'
import { OptimizeApiClient } from '../optimize'
import { TasklistApiClient } from '../tasklist'
import { ZeebeGrpcClient } from '../zeebe'
import { ZeebeGrpcClient, ZeebeRestClient } from '../zeebe'

/**
* A single point of configuration for all Camunda Platform 8 clients.
Expand All @@ -22,6 +22,7 @@ import { ZeebeGrpcClient } from '../zeebe'
*
* const c8 = new Camunda8()
* const zeebe = c8.getZeebeGrpcApiClient()
* const zeebeRest = c8.getZeebeRestClient()
* const operate = c8.getOperateApiClient()
* const optimize = c8.getOptimizeApiClient()
* const tasklist = c8.getTasklistApiClient()
Expand All @@ -36,6 +37,7 @@ export class Camunda8 {
private optimizeApiClient?: OptimizeApiClient
private tasklistApiClient?: TasklistApiClient
private zeebeGrpcApiClient?: ZeebeGrpcClient
private zeebeRestClient?: ZeebeRestClient
private configuration: CamundaPlatform8Configuration
private oAuthProvider?: OAuthProvider

Expand Down Expand Up @@ -107,4 +109,14 @@ export class Camunda8 {
}
return this.zeebeGrpcApiClient
}

public getZeebeRestClient(): ZeebeRestClient {
if (!this.zeebeRestClient) {
this.zeebeRestClient = new ZeebeRestClient({
config: this.configuration,
oAuthProvider: this.oAuthProvider,
})
}
return this.zeebeRestClient
}
}
2 changes: 1 addition & 1 deletion src/zeebe/zb/ZeebeRESTClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface TaskChangeSet {
candidateGroups: string[]
}

export class ZeebeRESTClient {
export class ZeebeRestClient {
private userAgentString: string
private oAuthProvider: IOAuthProvider
private rest: Promise<typeof got>
Expand Down

0 comments on commit faf2c7d

Please sign in to comment.