Skip to content

Commit

Permalink
Turn actions property in IJenkinsBuild into a typed array. Update tes…
Browse files Browse the repository at this point in the history
…ts, readme and version
  • Loading branch information
Andrei Straut committed Nov 9, 2017
1 parent bbbe950 commit bb8230f
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 988 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ nbproject
.idea
dist
compiled
.awcache
.awcache
/test-report.xml
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
NPM: https://www.npmjs.com/package/jenkins-api-ts-typings
Jenkins: https://www.andreistraut.info/jenkins/view/Jenkins%20TS%20Typings/

This library offers a set of classes to use when working with Jenkins JSON API. Jenkins Job, Build, User, View, Changeset and Node / Computer are supported
This library offers a set of classes to use when working with Jenkins JSON API. Jenkins Job, Build, Actions, User, View, Changeset and Node / Computer are supported

## Installation and usage

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jenkins-api-ts-typings",
"version": "0.4.0",
"version": "0.5.0",
"description": "Jenkins JSON API TypeScript Typings",
"keywords": [
"jenkins",
Expand Down
92 changes: 3 additions & 89 deletions src/JenkinsBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { IJenkinsBuild } from './jenkins-api-ts-typings'
import { IJenkinsChangeSet } from './jenkins-api-ts-typings'
import { IJenkinsAction } from './jenkins-api-ts-typings'

export class JenkinsBuild implements IJenkinsBuild {
jsonData: JSON;
Expand All @@ -26,7 +27,7 @@ import { IJenkinsChangeSet } from './jenkins-api-ts-typings'
mavenVersionUsed: string;

changeSets: Array<IJenkinsChangeSet>;
actions: Array<any>;
actions: Array<IJenkinsAction>;
artifacts: Array<any>;
mavenArtifacts: Array<any>;
executor: Array<any>;
Expand All @@ -49,90 +50,7 @@ import { IJenkinsChangeSet } from './jenkins-api-ts-typings'
let data:JSON = JSON.parse(json);
this.jsonData = data;

if(data.hasOwnProperty("number")) {
this.number = (data as any)["number"];
}

if(data.hasOwnProperty("url")) {
this.url = (data as any)["url"];
}

if(data.hasOwnProperty("displayName")) {
this.displayName = (data as any)["displayName"];
}

if(data.hasOwnProperty("fullDisplayName")) {
this.fullDisplayName = (data as any)["fullDisplayName"];
}

if(data.hasOwnProperty("description")) {
this.description = (data as any)["description"];
}

if(data.hasOwnProperty("_class")) {
this._class = (data as any)["_class"];
}

if(data.hasOwnProperty("building")) {
this.building = (data as any)["building"];
}

if(data.hasOwnProperty("duration")) {
this.duration = (data as any)["duration"];
}

if(data.hasOwnProperty("estimatedDuration")) {
this.estimatedDuration = (data as any)["estimatedDuration"];
}

if(data.hasOwnProperty("id")) {
this.id = (data as any)["id"];
}

if(data.hasOwnProperty("keepLog")) {
this.keepLog = (data as any)["keepLog"];
}

if(data.hasOwnProperty("queueId")) {
this.queueId = (data as any)["queueId"];
}

if(data.hasOwnProperty("result")) {
this.result = (data as any)["result"];
}

if(data.hasOwnProperty("timestamp")) {
this.timestamp = (data as any)["timestamp"];
this.date = new Date((data as any)["timestamp"]);
}

if(data.hasOwnProperty("builtOn")) {
this.builtOn = (data as any)["builtOn"];
}

if(data.hasOwnProperty("actions")) {
this.actions = (data as any)["actions"];
}

if(data.hasOwnProperty("artifacts")) {
this.artifacts = (data as any)["artifacts"];
}

if(data.hasOwnProperty("executor")) {
this.executor = (data as any)["executor"];
}

if(data.hasOwnProperty("culprits")) {
this.culprits = (data as any)["culprits"];
}

if(data.hasOwnProperty("mavenVersionUsed")) {
this.mavenVersionUsed = (data as any)["mavenVersionUsed"];
}

if(data.hasOwnProperty("mavenArtifacts")) {
this.mavenArtifacts = (data as any)["mavenArtifacts"];
}
this.fromJson(data);
}

public fromJson(data: JSON): void {
Expand Down Expand Up @@ -199,10 +117,6 @@ import { IJenkinsChangeSet } from './jenkins-api-ts-typings'
this.builtOn = (data as any)["builtOn"];
}

if(data.hasOwnProperty("actions")) {
this.actions = (data as any)["actions"];
}

if(data.hasOwnProperty("artifacts")) {
this.artifacts = (data as any)["artifacts"];
}
Expand Down
2 changes: 1 addition & 1 deletion src/jenkins-api-ts-typings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export interface IJenkinsJob extends IJenkinsObject {
builtOn: string;
changeSets: Array<IJenkinsChangeSet>;

actions: Array<any>;
actions: Array<IJenkinsAction>;
artifacts: Array<any>;
executor: Array<any>;
culprits: Array<any>;
Expand Down
Loading

0 comments on commit bb8230f

Please sign in to comment.