From 7ad26b7bae2f2ba04c58ae0c3e867f75a4274415 Mon Sep 17 00:00:00 2001 From: regevbr Date: Sun, 2 Jun 2019 09:41:16 +0300 Subject: [PATCH] remove api version control --- CHANGELOG.md | 8 ++ package.json | 2 +- src/CronicleClient.ts | 6 +- test/src/index.spec.ts | 224 ----------------------------------------- 4 files changed, 10 insertions(+), 230 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 175e8d6..efe4db3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## Development - nothing yet +## v1.0.0 + +[diff](https://github.com/PruvoNet/cronicle-client/compare/v0.2.0...v1.0.0) + +### Removed + +- removed option to set api version as new version will require a new class with different types anyways... + ## v0.2.0 [diff](https://github.com/PruvoNet/cronicle-client/compare/v0.1.0...v0.2.0) diff --git a/package.json b/package.json index d9c7b12..12dbccb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cronicle-client", - "version": "0.2.0", + "version": "1.0.0", "description": "Light Cronicle node client with full TypeScript support", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/CronicleClient.ts b/src/CronicleClient.ts index 1db9df4..a5b9702 100644 --- a/src/CronicleClient.ts +++ b/src/CronicleClient.ts @@ -19,8 +19,6 @@ import { } from './requestResponseTypes'; import {IBasePlugins} from './plugins'; -const DEFAULT_API_VERSION = 'v1'; - const enum HttpMethods { POST = 'POST', GET = 'GET', @@ -51,7 +49,6 @@ export class CronicleClient { }); }); - it('should get event with custom api version', () => { - const apiVersion = 'v2'; - const client = new cronicleClientStubbed({masterUrl, apiKey, apiVersion}); - const response = {code: 0}; - requestStub.resolves(response); - const id = 'myId'; - return client.getEvent({id}) - .then((resp) => { - expect(requestStub.firstCall.args[0]).to.eql({ - body: { - id, - }, - headers: { - 'X-API-Key': apiKey, - }, - json: true, - method: 'POST', - url: `${masterUrl}/api/app/get_event/${apiVersion}`, - }); - expect(resp).to.eq(response); - }); - }); - }); describe('get schedule', () => { @@ -456,26 +433,6 @@ limit=${limit}&offset=${offset}`, }); }); - it('should get schedule with custom api version', () => { - const apiVersion = 'v2'; - const client = new cronicleClientStubbed({masterUrl, apiKey, apiVersion}); - const response = {code: 0}; - requestStub.resolves(response); - return client.getSchedule() - .then((resp) => { - expect(requestStub.firstCall.args[0]).to.eql({ - body: undefined, - headers: { - 'X-API-Key': apiKey, - }, - json: true, - method: 'GET', - url: `${masterUrl}/api/app/get_schedule/${apiVersion}`, - }); - expect(resp).to.eq(response); - }); - }); - }); describe('run event', () => { @@ -543,31 +500,6 @@ limit=${limit}&offset=${offset}`, }); }); - it('should run event with custom api version', () => { - const apiVersion = 'v2'; - const client = new cronicleClientStubbed({masterUrl, apiKey, apiVersion}); - const response = {code: 0}; - requestStub.resolves(response); - const id = 'myId'; - const request = { - id, - log_max_size: 30, - }; - return client.runEvent(request) - .then((resp) => { - expect(requestStub.firstCall.args[0]).to.eql({ - body: request, - headers: { - 'X-API-Key': apiKey, - }, - json: true, - method: 'POST', - url: `${masterUrl}/api/app/run_event/${apiVersion}`, - }); - expect(resp).to.eq(response); - }); - }); - }); describe('create event', () => { @@ -799,39 +731,6 @@ limit=${limit}&offset=${offset}`, }); }); - it('should create event with custom api version', () => { - const apiVersion = 'v2'; - const client = new cronicleClientStubbed({masterUrl, apiKey, apiVersion}); - const response = {code: 0}; - requestStub.resolves(response); - const request = { - title: 'myTitle', - enabled: NumberedBoolean.TRUE, - category: BaseCategories.GENERAL, - target: BaseTargets.MAIN, - plugin: basePlugins.shellplug, - params: { - script: 'myScript', - annotate: NumberedBoolean.FALSE, - json: NumberedBoolean.TRUE, - }, - log_max_size: 30, - }; - return client.createEvent(request) - .then((resp) => { - expect(requestStub.firstCall.args[0]).to.eql({ - body: request, - headers: { - 'X-API-Key': apiKey, - }, - json: true, - method: 'POST', - url: `${masterUrl}/api/app/create_event/${apiVersion}`, - }); - expect(resp).to.eq(response); - }); - }); - }); describe('update event', () => { @@ -876,32 +775,6 @@ limit=${limit}&offset=${offset}`, }); }); - it('should update event with custom api version', () => { - const apiVersion = 'v2'; - const client = new cronicleClientStubbed({masterUrl, apiKey, apiVersion}); - const response = {code: 0}; - requestStub.resolves(response); - const id = 'myId'; - const request = { - id, - timeout: 30, - reset_cursor: NumberedBoolean.TRUE, - }; - return client.updateEvent(request) - .then((resp) => { - expect(requestStub.firstCall.args[0]).to.eql({ - body: request, - headers: { - 'X-API-Key': apiKey, - }, - json: true, - method: 'POST', - url: `${masterUrl}/api/app/update_event/${apiVersion}`, - }); - expect(resp).to.eq(response); - }); - }); - }); describe('update job', () => { @@ -946,32 +819,6 @@ limit=${limit}&offset=${offset}`, }); }); - it('should update job with custom api version', () => { - const apiVersion = 'v2'; - const client = new cronicleClientStubbed({masterUrl, apiKey, apiVersion}); - const response = {code: 0}; - requestStub.resolves(response); - const id = 'myId'; - const request = { - id, - timeout: 30, - reset_cursor: NumberedBoolean.TRUE, - }; - return client.updateJob(request) - .then((resp) => { - expect(requestStub.firstCall.args[0]).to.eql({ - body: request, - headers: { - 'X-API-Key': apiKey, - }, - json: true, - method: 'POST', - url: `${masterUrl}/api/app/update_job/${apiVersion}`, - }); - expect(resp).to.eq(response); - }); - }); - }); describe('delete event', () => { @@ -1015,31 +862,6 @@ limit=${limit}&offset=${offset}`, }); }); - it('should delete event with custom api version', () => { - const apiVersion = 'v2'; - const client = new cronicleClientStubbed({masterUrl, apiKey, apiVersion}); - const response = {code: 0}; - requestStub.resolves(response); - const id = 'myId'; - const request = { - id, - log_max_size: 30, - }; - return client.deleteEvent(request) - .then((resp) => { - expect(requestStub.firstCall.args[0]).to.eql({ - body: request, - headers: { - 'X-API-Key': apiKey, - }, - json: true, - method: 'POST', - url: `${masterUrl}/api/app/delete_event/${apiVersion}`, - }); - expect(resp).to.eq(response); - }); - }); - }); describe('abort job', () => { @@ -1082,31 +904,6 @@ limit=${limit}&offset=${offset}`, }); }); - it('should abort job with custom api version', () => { - const apiVersion = 'v2'; - const client = new cronicleClientStubbed({masterUrl, apiKey, apiVersion}); - const response = {code: 0}; - requestStub.resolves(response); - const id = 'myId'; - const request = { - id, - log_max_size: 30, - }; - return client.abortJob(request) - .then((resp) => { - expect(requestStub.firstCall.args[0]).to.eql({ - body: request, - headers: { - 'X-API-Key': apiKey, - }, - json: true, - method: 'POST', - url: `${masterUrl}/api/app/abort_job/${apiVersion}`, - }); - expect(resp).to.eq(response); - }); - }); - }); describe('get job status', () => { @@ -1146,27 +943,6 @@ limit=${limit}&offset=${offset}`, }); }); - it('should get job status with custom api version', () => { - const apiVersion = 'v2'; - const client = new cronicleClientStubbed({masterUrl, apiKey, apiVersion}); - const response = {code: 0}; - requestStub.resolves(response); - const id = 'myId'; - return client.getJobStatus({id}) - .then((resp) => { - expect(requestStub.firstCall.args[0]).to.eql({ - body: undefined, - headers: { - 'X-API-Key': apiKey, - }, - json: true, - method: 'GET', - url: `${masterUrl}/api/app/get_job_status/${apiVersion}?id=${id}`, - }); - expect(resp).to.eq(response); - }); - }); - }); });