Skip to content

Commit fe7c2d4

Browse files
committed
Rearrangement of Platform API classes
1 parent 7dd06de commit fe7c2d4

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- [ApiKeyRestClient](#ApiKeyRestClient)
1010
- [CookieRestClient](#CookieRestClient)
1111
- [OAuth2AuthorizationCodeRestClient](#OAuth2AuthorizationCodeRestClient)
12+
- [Platform API Clients](#PlatformAPI-Clients)
1213
- [PlatformApiRestClient](#PlatformApiRestClient)
1314
- [PlatformApiLogicClient](#PlatformApiLogicClient)
1415
- [JSON Schema Converter](#JSON-Schema-Converter)
@@ -137,6 +138,9 @@ Handles both V1 and V2 of the NTLM Protocol.
137138
const Client = new NtlmRestClient(emitter, cfg);
138139
```
139140

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.
143+
140144
### PlatformApiRestClient
141145
[PlatformApiRestClient](https://github.com/elasticio/component-commons-library/blob/master/lib/authentication/PlatformApiRestClient.ts)
142146
class extends [BasicAuthRestClient](#BasicAuthRestClient) class.
@@ -176,8 +180,8 @@ const Client = new PlatformApiLogicClient(emitter, cfg);
176180
- fetchFlowById(id) - Fetch flow by it's id
177181
- fetchFlowByNameAndWorkspaceId(flowName, workspaceId) - Fetch flow by flow name and workspace id
178182
- changeFlowState(options) - Given a flow, change the flow to a given state (running, stopped, etc)
179-
- startFlow(flowId, options = {}) - sets the flow to active running state
180-
- stopFlow(flowId, options = {}) - sets the flow to inactive stopped state
183+
- startFlow(flowId, options) - sets the flow to active running state
184+
- stopFlow(flowId, options) - sets the flow to inactive stopped state
181185
- hydrateFlow(options) - Hydrates the flow using removeNonWritableProperties method, but additionally enriches the flow with all data samples, credential names, command and component Id fields.
182186

183187
## JSON Schema Converter

lib/authentication/PlatformApiLogicClient.ts renamed to lib/platformApi/PlatformApiLogicClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ interface WorkspaceListOptions {
1919

2020
export class PlatformApiLogicClient extends PlatformApiRestClient {
2121
workspaceList: any;
22+
makeRequest: any;
23+
emitter: any;
2224
/**
2325
* Fetch all flows for a given workspace
2426
* @param {string} options.workspaceId Id of the workspace to search

lib/authentication/PlatformApiRestClient.ts renamed to lib/platformApi/PlatformApiRestClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BasicAuthRestClient } from './BasicAuthRestClient';
1+
import { BasicAuthRestClient } from '../authentication/BasicAuthRestClient';
22
import removeTrailingSlash from 'remove-trailing-slash';
33
import util from 'util';
44

test/authentication/PlatformApiLogicClient.spec.ts renamed to test/platformApi/PlatformApiLogicClient.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import chai from 'chai';
22
import sinon from 'sinon';
33
import { Logger } from '../../lib';
4-
import { PlatformApiLogicClient } from '../../lib/authentication/PlatformApiLogicClient';
4+
import { PlatformApiLogicClient } from '../../lib/platformApi/PlatformApiLogicClient';
55
import * as allFlowsForWorkspace from '../helpers/allFlowsForWorkspace.json';
66
import * as allCredentialsForWorkspace from '../helpers/allCredentialsForWorkspace.json';
77
import * as componentsAccessibleFromContract from '../helpers/componentsAccessibleFromContract.json';

test/authentication/PlatformApiRestClient.spec.ts renamed to test/platformApi/PlatformApiRestClient.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import chai from 'chai';
22
import sinon from 'sinon';
33
import { Logger } from '../../lib';
4-
import { PlatformApiRestClient } from '../../lib/authentication/PlatformApiRestClient';
4+
import { PlatformApiRestClient } from '../../lib/platformApi/PlatformApiRestClient';
55
import * as flow from '../helpers/flow.json';
66

77
const { expect } = chai;

0 commit comments

Comments
 (0)