Skip to content

Commit 3b54e33

Browse files
author
Mike Carter
committed
Remove unsupported API methods, implement new authentication, switch to karma for tests
1 parent 5b6bac6 commit 3b54e33

14 files changed

+2012
-240
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
tmp/*
22
node_modules/*
3+
test/testClientConfig.js
34
sandbox.js
45
index.html
56
npm-debug.log

Gruntfile.coffee

-17
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,12 @@ config = (grunt) ->
4444
reporter: 'spec',
4545
src: ['test/**/*.js']
4646

47-
connect:
48-
testServer:
49-
options:
50-
port: 8001
51-
base: '.'
52-
53-
mocha_phantomjs:
54-
all:
55-
options:
56-
urls: ['http://localhost:8001/test/runner.html']
57-
5847
module.exports = (grunt) ->
5948
grunt.initConfig( config(grunt) )
6049

6150
grunt.loadNpmTasks('grunt-contrib-uglify')
6251
grunt.loadNpmTasks('grunt-contrib-compress')
6352
grunt.loadNpmTasks('grunt-browserify');
64-
grunt.loadNpmTasks('grunt-contrib-connect');
65-
grunt.loadNpmTasks('grunt-mocha-phantomjs');
6653
grunt.loadNpmTasks('grunt-shell');
6754
grunt.loadNpmTasks('grunt-contrib-clean');
6855
grunt.loadNpmTasks('grunt-mocha-test');
@@ -78,8 +65,4 @@ module.exports = (grunt) ->
7865
grunt.registerTask('test', [
7966
'clean'
8067
'mochaTest'
81-
'shell:generateTestList'
82-
'release'
83-
'connect:testServer'
84-
'mocha_phantomjs'
8568
])

README.md

+4-39
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Mixpanel Data Export (v 1.8.2)
2-
==============================
1+
Mixpanel Data Export
2+
====================
33

44
Simply put, this is a JavaScript library that makes [Mixpanel's data export API](https://mixpanel.com/docs/api-documentation/data-export-api#libs-js) easy to use. Simply instantiate the class with your API secret and key and then make calls to api methods and get correctly formatted data back via a promise, callback or stream.
55

@@ -25,10 +25,10 @@ Every method detailed on [mixpanel's data export api page](https://mixpanel.com/
2525
- `annotations(parameters)`
2626
- `createAnnotation(parameters)`
2727
- `updateAnnotation(parameters)`
28+
- `deleteAnnotation(parameters)`
2829

2930
**Export:**
3031
- `export(parameters)` (node only, see: https://github.com/michaelcarter/mixpanel-data-export-js/issues/3)
31-
- `exportStream(parameters)` (node only, please see: [Streaming Exports](#streaming-exports))
3232

3333
**Events:**
3434
- `events(parameters)`
@@ -91,42 +91,7 @@ A full list of available API methods is detailed on [mixpanel's data export api
9191
## Undocumented Endpoints
9292
For any other requests (e.g. undocumented API endpoints), you can make raw requests to the API using `get`. The library will still handle all of param ordering and md5 signature stuff that the API requires, so you'll just need to supply a request type & parameters:
9393

94-
- `panel.get(requestType, parameters)`
94+
- `panel.get(requestType, parameters)`
9595

9696
`requestType` expects an array forming a path to the endpoint. Taking the "top events" endpoint as an example - it's available at `http://mixpanel.com/api/2.0/events/top/`, so to request it you'd call `panel.get(['events', 'top'], parameters)`.
9797

98-
99-
## Streaming Exports
100-
101-
Due to the large size of an export response, it's often appropriate to stream the data instead of waiting for it all:
102-
103-
```javascript
104-
// Create a stream object
105-
var exportStream = panel.exportStream({
106-
from_date: "2015-03-01",
107-
to_date: "2015-03-02"
108-
});
109-
110-
// Listen on stream data
111-
exportStream.on('data', function(data) {
112-
// do something with it
113-
});
114-
115-
// Listen for a stream error
116-
exportStream.on('error', function(err) {
117-
// handle error
118-
});
119-
120-
// Listen for the end of the stream
121-
exportStream.on('end', function() {
122-
// move on to do other stuff
123-
});
124-
125-
// Pause the stream
126-
exportStream.pause()
127-
128-
// Resume the stream
129-
exportStream.resume()
130-
```
131-
132-
Please note this option is only available in node environments, it's not supported in browser.

0 commit comments

Comments
 (0)