node-ninjacat
Advanced tools
Comparing version 0.1.10 to 0.1.11
@@ -0,1 +1,2 @@ | ||
/// <reference types="ninjacat" /> | ||
import Request from 'request'; | ||
@@ -5,3 +6,3 @@ interface NinjacatClientOpts { | ||
client_secret: string; | ||
agency_id: number; | ||
agency_id: number | string; | ||
agency_identifier: string; | ||
@@ -19,17 +20,9 @@ report_secret: string; | ||
report: { | ||
retrieve: (request_id: RequestID) => Promise<any>; | ||
post: (template_id: Ninjacat.TemplateID, advertiser_id: Ninjacat.AdvertiserID, opts?: { | ||
start_date: string; | ||
end_date: string; | ||
}) => Promise<any>; | ||
get: (request_id: RequestID) => Promise<{ | ||
status: 0 | 1; | ||
id: number; | ||
} | { | ||
success: true; | ||
status: 2; | ||
id: number; | ||
data: Array<any>; | ||
errors: Array<string>; | ||
}) => Promise<{ | ||
request_id: number; | ||
}>; | ||
get: (request_id: RequestID) => Promise<Ninjacat.ReportResponse>; | ||
}; | ||
@@ -36,0 +29,0 @@ request: Request.RequestAPI<Request.Request, Request.CoreOptions, Request.RequiredUriUrl>; |
@@ -15,3 +15,3 @@ "use strict"; | ||
this.client_secret = opts.client_secret; | ||
this.agency_id = opts.agency_id; | ||
this.agency_id = Number(opts.agency_id); | ||
this.agency_identifier = opts.agency_identifier; | ||
@@ -29,10 +29,2 @@ this.report_secret = opts.report_secret; | ||
this.report = { | ||
retrieve: (request_id) => new Promise(async (resolve) => { | ||
let res = { status: 0 }; | ||
while (res.status !== 2) { | ||
console.log(res); | ||
res = await this.report.get(request_id); | ||
} | ||
resolve(res); | ||
}), | ||
get: (request_id) => { | ||
@@ -39,0 +31,0 @@ const path = ['open_api/report', this.agency_id, request_id].join('/'); |
@@ -21,5 +21,5 @@ "use strict"; | ||
}); | ||
const advertisers = await client.advertisers(); | ||
advertisers; | ||
console.log(advertisers); | ||
// const advertisers = await client.advertisers(); | ||
// advertisers; | ||
// console.log(advertisers); | ||
// const report = await client.report.post(89565, 10114719, { | ||
@@ -29,6 +29,8 @@ // start_date: '05/01/2020', | ||
// }); | ||
// const report = await client.report.retrieve(118105); | ||
// console.log(report); | ||
const res = await client.report.get(118105); | ||
if (res.status === 2) { | ||
console.log(res.data[0].dataRows.rows); | ||
} | ||
} | ||
main(); | ||
//# sourceMappingURL=test.js.map |
{ | ||
"name": "node-ninjacat", | ||
"description": "Reporting & Management API Client for https://www.ninjacat.io/", | ||
"version": "0.1.10", | ||
"version": "0.1.11", | ||
"main": "./lib/Client.js", | ||
@@ -6,0 +6,0 @@ "types": "./lib/Client.d.ts", |
{ | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"typeRoots": ["./node_modules/@types"], | ||
"typeRoots": ["./node_modules/@types", "./typings"], | ||
"moduleResolution": "node", | ||
@@ -15,4 +15,4 @@ "sourceMap": true, | ||
}, | ||
"include": ["./src/**/*", "./typings/**/*"], | ||
"include": ["./src/**/*"], | ||
"exclude": ["./node_modules/**/*"] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
13985
288
0