You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A number of REST Client classes are available to use and extend to create Clients for a given API.
31
34
32
-
Each of the REST Clients extends from the `NoAuthRestClient`, overriding the relevant methods.
35
+
Each of the REST Clients extends from the `NoAuthRestClient`, overriding the relevant methods. Exception is PlatformApiRestClient and PlatformApiLogicClient.
33
36
34
37
### NoAuthRestClient
35
38
[NoAuthRestClient](https://github.com/elasticio/component-commons-library/blob/master/lib/authentication/NoAuthRestClient.ts) class to make rest requests no no auth APIs by provided options.
@@ -135,6 +138,52 @@ Handles both V1 and V2 of the NTLM Protocol.
135
138
const Client = new NtlmRestClient(emitter, cfg);
136
139
```
137
140
141
+
## Platform API Clients
142
+
A number of Platform API Client classes are available to use and extend them to create Clients for Platform API.
class extends [BasicAuthRestClient](#BasicAuthRestClient) class.
147
+
The method inside this class checks for the status code 200, if not, then throws an error. And also checks that the response came with the correct data in the JSON format and the other expected response headers.
148
+
149
+
#### constructor(emitter, cfg)
150
+
- emitter - EIO emitting context.
151
+
- cfg - configuration of EIO component object.
152
+
153
+
```
154
+
const Client = new PlatformApiRestClient(emitter, cfg);
class extends [PlatformApiRestClient](#PlatformApiRestClient) class.
160
+
Contains useful methods to manipulate flow's state to set it either to active running or to inactive stopped, searching flows, workspaces, credentials and more.
161
+
162
+
#### constructor(emitter, cfg)
163
+
- emitter - EIO emitting context.
164
+
- cfg - configuration of EIO component object.
165
+
166
+
```
167
+
const Client = new PlatformApiLogicClient(emitter, cfg);
168
+
```
169
+
170
+
#### List of methods
171
+
- fetchAllFlowsForWorkspace(options) - Fetch all flows for a given workspace
172
+
- fetchAllCredentialsForWorkspace(options) - Fetch all credentials for a given workspace
173
+
- fetchComponentsAccessibleFromContract(options) - Fetch All Components Accessible From a Given Workspace
174
+
- splitParallelization(maxParallelization, splitFactor) - Helping method to calculate right number of parallel calls
175
+
- fetchFlowList(options) - Fetches a list of flows
176
+
- fetchWorkspaceList(options) - Fetch a list of all workspaces across all contracts for a user
177
+
- fetchWorkspaceId(workspaceUniqueCriteria) - Given a set of unique criteria, find the workspace that matches
178
+
- removeNonWritableProperties(flow, includeDataSamples) - Given a flow, remove the properties of the flow that are regularly changed by the system such as last executed time
179
+
- fetchFlowId(flowUniqueCriteria) - Fetch flow by it's unique criteria
180
+
- fetchFlowById(id) - Fetch flow by it's id
181
+
- fetchFlowByNameAndWorkspaceId(flowName, workspaceId) - Fetch flow by flow name and workspace id
182
+
- changeFlowState(options) - Given a flow, change the flow to a given state (running, stopped, etc)
183
+
- startFlow(flowId, options) - sets the flow to active running state
184
+
- stopFlow(flowId, options) - sets the flow to inactive stopped state
185
+
- hydrateFlow(options) - Hydrates the flow using removeNonWritableProperties method, but additionally enriches the flow with all data samples, credential names, command and component Id fields.
0 commit comments