Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting v3 ready! #2

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c300766
Add example of what the promise based api would look like :gift:
AdrieanKhisbe Mar 8, 2019
4d74587
Improve client.request to return promise when no callback :wrench:
AdrieanKhisbe Mar 8, 2019
0d51b8f
Some fix and return the promise anyway :gear:
AdrieanKhisbe Mar 8, 2019
2bcd567
All api method return promise of client.request :hammer_and_wrench:
AdrieanKhisbe Mar 8, 2019
cb24149
Replace vanilla low level https cal with request-promise library :tel…
AdrieanKhisbe Oct 11, 2019
5e05e65
Refactor of top level files :hammer_and_wrench:
AdrieanKhisbe Oct 11, 2019
a9ff51f
Replace utils.format by template string :writing_hand:
AdrieanKhisbe Oct 11, 2019
7920388
Refresh dependencies :wind_face:
AdrieanKhisbe Oct 11, 2019
c191242
Change eslint base config and bymp eslint 5->6 :oncoming_police_car:
AdrieanKhisbe Oct 14, 2019
bb72bc3
Apply the lint and manualy fix prefer-rest-params and no-prototype-bu…
AdrieanKhisbe Oct 14, 2019
8d9b400
Replace all ava assertion from true to assert for power assert :memo:
AdrieanKhisbe Oct 18, 2019
71dbd6e
Rename bin file to datadog-cli :file_folder:
AdrieanKhisbe Oct 30, 2019
8ff8e24
Add private and tmp to gitignore :no_entry_sign:
AdrieanKhisbe Oct 30, 2019
e1b6ef5
Minor refactors and test file pattern :hammer_and_wrench:
AdrieanKhisbe Oct 30, 2019
afea9ff
Configure test to show coverage (and the current scary :8ball:) :scream:
AdrieanKhisbe Oct 30, 2019
0a1875a
Add basic tests safety net loading and checkying client entrypoint :s…
AdrieanKhisbe Oct 30, 2019
ee67a44
Bump license for the new decade :balance_scale:
AdrieanKhisbe Feb 9, 2020
5656690
Bump all the libraries (dev&prod) :outbox_tray:
AdrieanKhisbe Feb 9, 2020
93d46df
Adding maintainer section in package.json :man_mechanic:
AdrieanKhisbe Feb 9, 2020
b8ff00f
Safety check for all api methods :link:
AdrieanKhisbe Feb 9, 2020
4eb4446
Improve safety check by having a fake client :innocent:
AdrieanKhisbe Feb 9, 2020
5dbb616
Test on latest node LTS :traffic_light:
AdrieanKhisbe May 20, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 2 additions & 27 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,31 +1,6 @@
{
"env": {
"commonjs": true,
"es6": true,
"node": true
},
"extends": [
"plugin:@coorpacademy/coorpacademy/core",
"plugin:@coorpacademy/coorpacademy/ava",
"plugin:@coorpacademy/coorpacademy/es20XX",
"plugin:@coorpacademy/coorpacademy/lodash-fp",
"plugin:@coorpacademy/coorpacademy/prettier"
],
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module"
},
"plugins": [
"@coorpacademy/coorpacademy"
],
"rules": {
"promise/no-native": "off",
"strict": "off",
"fp/no-arguments": "warn",
"no-param-reassign": "warn",
"prefer-rest-params": "warn",
"fp/no-loops": "warn"
},
"extends": ["plugin:@-k/base"],
"plugins": ["@-k"],
"overrides": [
{
"files": [ "bin/*" ],
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ npm-debug.log
.nyc_output
coverage.lcov
coverage
private
tmp
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ node_js:
- "8"
- "10"
- "12"
- "14"
- "node"

install:
- npm install

script:
- npm run lint
- npm run cover
- npm test

after_success:
- npm run publish-coverage
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2013 Brett Langdon <me@brett.is>
Copyright (c) 2019 Adriean Khisbe
Copyright (c) 2019-2020 Adriean Khisbe


Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
8 changes: 4 additions & 4 deletions bin/dogapi → bin/datadog-cli
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/usr/bin/env node
const dogapi = require('..');
const {EOL} = require('os');
const _ = require('lodash/fp');
const json = require('json-bigint');
const minimist = require('minimist');
const rc = require('rc');
const {EOL} = require('os');
const {version} = require('../package');
const dogapi = require('..');

const config = rc('dogapi', {api_key: null, app_key: null});
dogapi.initialize(config);

const hasKey = (key, functionName) =>
_.hasOwnProperty(functionName, dogapi[key]) && _.isFunction(_.get([key, functionName], dogapi));
_.has([key, functionName], dogapi) && _.isFunction(_.get([key, functionName], dogapi));

const usage = [
'Usage:',
Expand Down Expand Up @@ -41,7 +41,7 @@ const main = args => {
if (command === 'future' && args._.length > 3)
return console.log(dogapi.now() + parseInt(args._[args._.length - 1]));

if (dogapi.hasOwnProperty(command)) {
if (_.has(command, dogapi)) {
if (subcommand) {
dogapi[command].handleCli(subcommand, args, function(err, res) {
if (err) {
Expand Down
11 changes: 10 additions & 1 deletion examples/new-interface.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Dogapi = require('../src'); // use 'datadog-client' instead
const Dogapi = require('..'); // use 'datadog-client' instead

const options = {
api_key: 'YOUR_KEY_HERE',
Expand All @@ -8,3 +8,12 @@ const options = {
const dogapi = new Dogapi(options);

dogapi.metric.send('test', 1);

dogapi.event
.create('Some event', '**THIS** happened')
.then(res => {
console.log(res);
})
.catch(err => {
console.error(err);
});
2 changes: 1 addition & 1 deletion examples/original-interface.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const dogapi = require('../src'); // use 'datadog-client' instead
const dogapi = require('..'); // use 'datadog-client' instead

const options = {
api_key: 'YOUR_KEY_HERE',
Expand Down
Loading