Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 180 lines (145 sloc) 3.46 kb
e766556 @0mgw00 first commit
0mgw00 authored
1 ##
2 ###
3
6f03cbc Update README.md
Nyu authored
4 ![Kippt](https://d17f28g3dsa4vh.cloudfront.net/img/kippt-logo-r.png)
e766556 @0mgw00 first commit
0mgw00 authored
5
6 ## Installation
7
e525b2f @0mgw00 update readme
0mgw00 authored
8 [![Travis](https://api.travis-ci.org/jiin/kippt.png)](https://api.travis-ci.org/jiin/kippt)
9
e766556 @0mgw00 first commit
0mgw00 authored
10 Install this version via git:
11 ```bash
12 npm install git://github.com/jiin/kippt
13 ```
14
e525b2f @0mgw00 update readme
0mgw00 authored
15 And use in your node source:
16 ```javascript
8a788f3 @0mgw00 modify readme
0mgw00 authored
17 var Kippt = require('kippt');
e525b2f @0mgw00 update readme
0mgw00 authored
18 ```
19
e766556 @0mgw00 first commit
0mgw00 authored
20 ## Usage
21
e525b2f @0mgw00 update readme
0mgw00 authored
22 ### Authentication
23
24 You can use API only if you are authenticated. You can authenticate via API Token or via username/password combination.
25
26 ### API Token
27 ```javascript
8a788f3 @0mgw00 modify readme
0mgw00 authored
28 var client = new Kippt({
e525b2f @0mgw00 update readme
0mgw00 authored
29 username: 'your_nickname'
30 , api_token: '31e4d0b0d47acaf3ebbeb187d17d67cfddec79c1'
31 });
32 ```
33
34 ### Username/Password
35 ```javascript
8a788f3 @0mgw00 modify readme
0mgw00 authored
36 var client = new Kippt({
e525b2f @0mgw00 update readme
0mgw00 authored
37 username: 'your_nickname'
38 , password: 'your_password'
39 });
40 ```
41
42 ### Get account details
43 ```javascript
8a788f3 @0mgw00 modify readme
0mgw00 authored
44 var client = new Kippt({
e525b2f @0mgw00 update readme
0mgw00 authored
45 username: 'your_nickname'
46 , api_token: '31e4d0b0d47acaf3ebbeb187d17d67cfddec79c1'
47 });
48
49 client.account( function( err, result ) {
50 console.log( result );
51 });
52 ```
53
54 Output:
55 ```javascript
56 {
57 username: 'your_nickname',
58 app_url: '/your_nickname',
59 lists: '/api/users/your_nickname/lists/',
60 avatar_url: 'your_avatar',
61 api_token: '31e4d0b0d47acaf3ebbeb187d17d67cfddec79c1',
62 id: 666666,
63 resource_uri: '/api/users/666666/'
64 }
65 ```
66
67 ## Resources
68
69 ### Lists
70
71 Return object contains all the lists:
72 ```javascript
73 client.lists( function( err, lists ) {
74 console.log( lists );
75 });
76 ```
77
78 Only returns the list that id is the first argoument.
79 ```javascript
80 client.lists('123456', function( err, lists ) {
81 console.log( lists );
82 });
83 ```
84
85 Limit and offset can be controlled:
86 ```javascript
87 client.lists({ limit: 5, offeset: 2 }, function( err, lists ) {
88 console.log( lists );
89 });
90 ```
91
92 ### Clips
93
94 Return object contains all the clips:
95 ```javascript
96 client.clips( function( err, clips ) {
97 console.log( clipss );
98 });
99 ```
100
101 Only returns the clips that id is the first argoument.
102 ```javascript
103 client.clips('654321', function( err, lists ) {
104 console.log( clipss );
105 });
106 ```
107
108 Limit and offset can be controlled:
109 ```javascript
110 client.clips({ limit: 5, offeset: 2 }, function( err, clips ) {
111 console.log( clips );
112 });
113 ```
114
115 ### Search
116
117 Return clips searched:
118 ```javascript
119 client.search('css', function( err, result ) {
120 console.log( result );
121 });
122 ```
123
124 ### Starred
125
126 You can return the starred clips:
127 ```javascript
128 client.starred(function( err, starred ) {
129 console.log( starred );
130 });
131 ```
132
133 ## Modify resource
134
135 ### Creating
136
137 You can create a clip:
138 ```javascript
139 client.add({ type: 'clips' },{ title: 'new_clip', url: 'your_url' }, function( err, result ) {
140 console.log( result );
141 });
142 ```
143 You can create a list:
144 ```javascript
145 client.add({ type: 'lists' },{ title: 'new_clip', url: 'your_url' }, function( err, result ) {
146 console.log( result );
147 });
148 ```
149
150 ### Updating
151
152 You can update a clip:
153 ```javascript
154 client.update({ type: 'clips', id: '654321' }, { url: 'http://newurl.com/' }, function( err, result ) {
155 console.log( result );
156 });
157 ```
158
159 You can update a list:
160 ```javascript
161 client.update({ type: 'lists', id: '654321' }, { name: 'newname' }, function( err, result ) {
162 console.log( result );
163 });
164 ```
165
166 ### Deleting
167
168 You can deleting a clip:
169 ```javascript
170 client.delete({ type: 'clips', id: '123456' }, function( err, result ) {
171 console.log( result );
172 });
173 ```
174 You can deleting a list:
175 ```javascript
176 client.delete({ type: 'lists', id: '654321' }, function( err, result ) {
177 console.log( result );
178 });
6f03cbc Update README.md
Nyu authored
179 ```
Something went wrong with that request. Please try again.