<commit_before>node-tistoryAPI
===============

A Node.js library for interacting with the Tistory RESTful API.

[Tistory API documentation](http://www.tistory.com/guide/api/index)  
[Manage applications](http://www.tistory.com/guide/api/manage/list)

### Dependencies
This library uses the [request](https://github.com/request/request) package

```
npm install request
```

### Obtaining an access_token
There is a TistoryOAuth2 helper included for authorizing your app on behalf of the user and then requesting an access_token.

```javascript
var Tistory = require('./node-tistoryAPI/lib')

var config = {
    "client": {
        "client_id": "something_something_client_id",
        "client_secret": "client_something_secret",
        "callback": "http://mycallback:42777"
    },
    "cookies": {
        "TSSESSION" : "valid_tsession_cookie"
    }
}
var at = new Tistory.TistoryOAuth2(config);

at.start(function (access_token){ 
    //callback
    console.log('My access token is:', access_token);
});
```

Tistory API
============
Below are some examples on how to use the API
```javascript
var Tistory = require('./node-tistoryAPI/lib')

var access_token = 'abc<PASSWORD>';
var t = new Tistory.TistoryAPI(access_token);

// Make a /post/ list request
var params = {
    'targetUrl': 'toodur2',
    'page': '1',
    'count': '50'
};
t.post.list(params, callback);

// Make a /post/ read request
var params = {
    'targetUrl': 'thestudio.kr',
    'postId': '1537',
};
t.post.read(params, callback);

//your callback function
function callback (err, res, body){
    console.log(body);
}

```
##Constructors
- **Tistory.TistoryOauth2(config)**

> note: the `config` parameter accepts a dictionary, see [Obtaining an access_token](#obtaining-an-access_token) for more info.

- **Tistory.TistoryAPI(access_token, format)**

> note: the `format` parameter is optional, defaults to *`"XML"`* but can be set to *`"JSON"`* if needed.

See above for examples.

##Methods
These are the methods currently supported:
###t.post.write(params, callback)
|params|description|required|
|---------|-----|-----|-----|
|targetUrl|Blog Url |Yes|
|title|Blog-Entry title |Yes|
|content | Blog-Entry content|optional|
|visibility| Blog-Entry visability setting|optional|
|published|UNIX_TIMESTAMP() 예약발송|optional|
|tag|Tags|optional|
[Official documentation](http://www.tistory.com/guide/api/post.php#post-write)
###t.post.modify(params, callback)
|params|description|required|
|---------|-----|-----|
|targetUrl| Blog Url |Yes|
|postId| Blog-Entry ID-number | Yes |
|title| Blog-Entry title |Yes|
|content | Blog-Entry content|optional|
|visibility| Blog-Entry visability setting|optional|
|published|UNIX_TIMESTAMP() 예약발송|optional|
|tag|Tags|optional|
[Official documentation](http://www.tistory.com/guide/api/post.php#post-modify)
###t.post.list(params, callback)
|params|description|required|
|---------|-----|-----|
|targetUrl|Blog Url |Yes|
|page||optional|
|count|entries per page|optional|
[Official documentation](http://www.tistory.com/guide/api/post.php#post-list)
###t.post.read(params, callback)
|params|description|required|
|---------|-----|-----|
|targetUrl|Blog Url |Yes|
|postId| Blog-Entry ID-number | Yes |
[Official documentation](http://www.tistory.com/guide/api/post.php#post-read)

##Notes
For a Python 3 alternative,  check out [kastden/tistory](https://github.com/kastden/tistory)

<commit_msg>readme update<commit_after>node-tistoryAPI
===============

A Node.js library for interacting with the Tistory RESTful API.

[Tistory API documentation](http://www.tistory.com/guide/api/index)  
[Manage applications](http://www.tistory.com/guide/api/manage/list)

### Dependencies
This library uses the [request](https://github.com/request/request) package

```
npm install request
```

### Obtaining an access_token
There is a `TistoryOAuth2` helper included for authorizing your app on behalf of the user and then requesting an access_token.

```javascript
var Tistory = require('./node-tistoryAPI/lib')

var config = {
    "client": {
        "client_id": "something_something_client_id",
        "client_secret": "client_something_secret",
        "callback": "http://mycallback:42777"
    },
    "cookies": {
        "TSSESSION" : "valid_tsession_cookie"
    }
}
var at = new Tistory.TistoryOAuth2(config);

at.start(function (access_token){ 
    //callback
    console.log('My access token is:', access_token);
});
```

Tistory API
============
Below are some examples on how to use the API
```javascript
var Tistory = require('./node-tistoryAPI/lib')

var access_token = 'abc123';
var t = new Tistory.TistoryAPI(access_token);

// Make a /post/ list request
var params = {
    'targetUrl': 'toodur2',
    'page': '1',
    'count': '50'
};
t.post.list(params, callback);

// Make a /post/ read request
var params = {
    'targetUrl': 'thestudio.kr',
    'postId': '1537',
};
t.post.read(params, callback);

//your callback function
function callback (err, res, body){
    console.log(body);
}

```
##Constructors
- **Tistory.TistoryOAuth2(config)**

> note: the `config` parameter accepts a dictionary, see [Obtaining an access_token](#obtaining-an-access_token) for more info.

- **Tistory.TistoryAPI(access_token, format)**

> note: the `format` parameter is optional, defaults to *`"XML"`* but can be set to *`"JSON"`* if needed.

See above for examples.

##Methods
These are the `TistoryAPI` methods currently supported:
###t.post.write(params, callback)
|params|description|required|
|---------|-----|-----|-----|
|targetUrl|Blog Url |Yes|
|title|Blog-Entry title |Yes|
|content | Blog-Entry content|optional|
|visibility| Blog-Entry visability setting|optional|
|published|UNIX_TIMESTAMP() 예약발송|optional|
|tag|Tags|optional|
[Official documentation](http://www.tistory.com/guide/api/post.php#post-write)
###t.post.modify(params, callback)
|params|description|required|
|---------|-----|-----|
|targetUrl| Blog Url |Yes|
|postId| Blog-Entry ID-number | Yes |
|title| Blog-Entry title |Yes|
|content | Blog-Entry content|optional|
|visibility| Blog-Entry visability setting|optional|
|published|UNIX_TIMESTAMP() 예약발송|optional|
|tag|Tags|optional|
[Official documentation](http://www.tistory.com/guide/api/post.php#post-modify)
###t.post.list(params, callback)
|params|description|required|
|---------|-----|-----|
|targetUrl|Blog Url |Yes|
|page||optional|
|count|entries per page|optional|
[Official documentation](http://www.tistory.com/guide/api/post.php#post-list)
###t.post.read(params, callback)
|params|description|required|
|---------|-----|-----|
|targetUrl|Blog Url |Yes|
|postId| Blog-Entry ID-number | Yes |
[Official documentation](http://www.tistory.com/guide/api/post.php#post-read)

##Notes
For a Python 3 alternative,  check out [kastden/tistory](https://github.com/kastden/tistory)


{'fraction_non_alphanumeric': 0.1746526793308761, 'fraction_numerical': 0.0052452509214629996, 'mean_word_length': 3.7572488199595413, 'pattern_counts': {'":': 10, '<': 4, '<?xml version=': 0, '>': 8, 'https://': 4, 'lorem ipsum': 0, 'www.': 12, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4242227', 'n_tokens_mistral': 2496, 'n_tokens_neox': 2364, 'n_words': 530}