import * as ChartMogul from 'chartmogul-node'; const config = new ChartMogul.Config("token", "secret", "baseURL"); config.retries = 10; config.getAccountToken(); // $ExpectType string config.getSecretKey(); // $ExpectType string config.VERSION; // $ExpectType string ChartMogul.Ping.ping(config); // $ExpectType Promise // $ExpectType Promise ChartMogul.DataSource.create(config, { name: "" }); // $ExpectType Promise ChartMogul.DataSource.retrieve(config, ""); // $ExpectType Promise<{}> ChartMogul.DataSource.destroy(config, ""); // $ExpectType Promise ChartMogul.DataSource.all(config, { name: "" }); ChartMogul.DataSource.all(config).then(data => { data.data_sources[0]; // $ExpectType DataSource data.data_sources[0].name; // $ExpectType string }); // $ExpectType Promise ChartMogul.Customer.create(config, { data_source_uuid: "", name: "", external_id: "", attributes: { tags: ["important", "Prio1"], custom: [ {type: "String", key: "channel", value: "Facebook", source: "integration"}, {type: "Integer", key: "age", value: 18} ] } }); // $ExpectType Promise ChartMogul.Customer.retrieve(config, ""); // $ExpectType Promise ChartMogul.Customer.modify(config, "", {}); // $ExpectType Promise<{}> ChartMogul.Customer.destroy(config, ""); // $ExpectType Promise> ChartMogul.Customer.all(config, { data_source_uuid: "" }); ChartMogul.Customer.all(config).then(data => { data.entries[0]; // $ExpectType Customer data.entries[0].attributes!.stripe!['something']; // $ExpectType any data.page!; // $ExpectType number }); // $ExpectType Promise> ChartMogul.Customer.search(config, { email: "" }); // $ExpectType Promise<{}> ChartMogul.Customer.merge(config, { from: {customer_uuid: ""}, into: {customer_uuid: ""} }); // $ExpectType Promise ChartMogul.Customer.attributes(config, ""); // $ExpectType Promise ChartMogul.Plan.create(config, { data_source_uuid: "", name: "", interval_count: 1, interval_unit: "", external_id: "" }); // $ExpectType Promise ChartMogul.Plan.retrieve(config, ""); // $ExpectType Promise ChartMogul.Plan.modify(config, "", { name: "" }); // $ExpectType Promise<{}> ChartMogul.Plan.destroy(config, ""); ChartMogul.Plan.all(config, { page: 1 }).then(data => { data.plans[0]; // $ExpectType Plan data.plans[0].name!; // $ExpectType string data.page!; // $ExpectType number }); // $ExpectType Promise ChartMogul.Invoice.retrieve(config, ""); // $ExpectType Promise ChartMogul.Invoice.create(config, "", { invoices: [ { external_id: "" } ] }); // $ExpectType Promise<{}> ChartMogul.Invoice.destroy(config, ""); ChartMogul.Invoice.all(config, { external_id: "" }).then(data => { data.invoices[0]; // $ExpectType Invoice data.invoices[0].uuid!; // $ExpectType string data.page!; // $ExpectType number }); ChartMogul.Invoice.all(config, "", { page: 1 }).then(data => { data.customer_uuid!; // $ExpectType string data.invoices[0]; // $ExpectType Invoice data.invoices[0].uuid!; // $ExpectType string data.page!; // $ExpectType number }); // $ExpectType Promise ChartMogul.Transaction.create(config, "", { type: "", date: "", result: "" }); ChartMogul.Subscription.all(config, "", { page: 1 }).then(data => { data.customer_uuid!; // $ExpectType string data.subscriptions[0]; // $ExpectType Subscription data.subscriptions[0].uuid; // $ExpectType string data.current_page!; // $ExpectType number }); ChartMogul.Subscription.cancel(config, "", { cancelled_at: "" }).then(data => { data.customer_uuid; // $ExpectType string }); // $ExpectType Promise> ChartMogul.Tag.add(config, "", { email: "", tags: [""] }); // $ExpectType Promise ChartMogul.Tag.add(config, "", { tags: [""] }); // $ExpectType Promise ChartMogul.Tag.remove(config, "", { tags: [""] }); // $ExpectType Promise ChartMogul.CustomAttribute.add(config, "", { custom: [ {type: "", key: "", value: 0} ] }); // $ExpectType Promise> ChartMogul.CustomAttribute.add(config, "", { email: "", custom: [ {type: "", key: "", value: 0} ] }); // $ExpectType Promise ChartMogul.CustomAttribute.update(config, "", { custom: { pro: true, channel: "" } }); ChartMogul.CustomAttribute.remove(config, "", { custom: [""] }).then(data => { data.custom["key"]; // $ExpectType any }); // $ExpectType Promise ChartMogul.Metrics.all(config, { 'start-date': '2015-01-01', 'end-date': '2015-11-24', interval: '', geo: '', plans: '' }); // $ExpectType Promise> ChartMogul.Metrics.mrr(config, { 'start-date': '2015-01-01', 'end-date': '2015-11-01' }); // $ExpectType Promise> ChartMogul.Metrics.arr(config, { 'start-date': '2015-01-01', 'end-date': '2015-11-01' }); // $ExpectType Promise> ChartMogul.Metrics.arpa(config, { 'start-date': '2015-01-01', 'end-date': '2015-11-01' }); // $ExpectType Promise> ChartMogul.Metrics.asp(config, { 'start-date': '2015-01-01', 'end-date': '2015-11-01' }); // $ExpectType Promise> ChartMogul.Metrics.customerCount(config, { 'start-date': '2015-01-01', 'end-date': '2015-11-01' }); // $ExpectType Promise> ChartMogul.Metrics.customerChurnRate(config, { 'start-date': '2015-01-01', 'end-date': '2015-11-01', geo: '', plans: '' }); // $ExpectType Promise> ChartMogul.Metrics.mrrChurnRate(config, { 'start-date': '2015-01-01', 'end-date': '2015-11-01' }); ChartMogul.Metrics.ltv(config, { 'start-date': '2015-01-01', 'end-date': '2015-11-01' }).then(data => { data.entries[0].ltv; // $ExpectType number data.summary; // $ExpectType Summary data.summary.current; // $ExpectType number }); // $ExpectType Promise> ChartMogul.Metrics.Customer.subscriptions(config, "", { page: 1 }); ChartMogul.Metrics.Customer.activities(config, "", { page: 1 }).then(data => { data.entries; // $ExpectType MetricsActivity[] data.entries[0]; // $ExpectType MetricsActivity data.entries[0]['activity-mrr']; // $ExpectType number data.page!; // $ExpectType number });