now returning promises

This commit is contained in:
Philipp Kunz 2016-04-27 03:08:14 +02:00
parent 229b652c69
commit 71dcdd0d66
4 changed files with 34 additions and 6 deletions

View File

@ -18,11 +18,11 @@ cflareInstance.auth({
key:"" key:""
}); });
cflareInstance.createRecord(); cflareInstance.createRecord(); // returns promise with resolve function getting the response;
cflareInstance.removeRecord(); cflareInstance.removeRecord(); // returns promise with resolve function getting the response;
cflareInstance.copyRecord(); cflareInstance.copyRecord(); // returns promise with resolve function getting the response;
cflareInstance.listRecords(); cflareInstance.listRecords(); // returns promise with resolve function getting the response;
cflareInstance.listDomains(); cflareInstance.listDomains(); // returns promise with resolve function getting the response;
``` ```
### About the authors: ### About the authors:

View File

@ -22,6 +22,7 @@
"homepage": "https://github.com/pushrocks/cflare#readme", "homepage": "https://github.com/pushrocks/cflare#readme",
"dependencies": { "dependencies": {
"beautylog": "^4.1.2", "beautylog": "^4.1.2",
"q": "^1.4.1",
"request": "^2.72.0" "request": "^2.72.0"
}, },
"devDependencies": { "devDependencies": {

View File

@ -5,8 +5,34 @@ import helpers = require("./cflare.classes.helpers");
class cflare { class cflare {
private authEmail:string; private authEmail:string;
private authKey:string; private authKey:string;
private authCheck(){
return (this.authEmail && this.authKey); //check if auth is available
}
constructor(){ constructor(){
}; };
auth(optionsArg:{email:string,key:string}){
this.authEmail = optionsArg.email;
this.authKey = optionsArg.key;
}
createRecord(){
let done = plugins.q.defer();
return done.promise;
};
removeRecord(){
let done = plugins.q.defer();
return done.promise;
};
listRecords(){
let done = plugins.q.defer();
return done.promise;
}
listDomains(){
let done = plugins.q.defer();
return done.promise;
};
request(){
let done = plugins.q.defer();
return done.promise;
}
}; };

View File

@ -1,3 +1,4 @@
/// <reference path="./typings/main.d.ts" /> /// <reference path="./typings/main.d.ts" />
export let beautylog = require("beautylog"); export let beautylog = require("beautylog");
export let q = require("q");
export let request = require("request"); export let request = require("request");