<commit_before># imsails

Instant messaging app to interface server with sailsjs rest or socket.io API


Server API
---------------------------------------------------------
*   user

```
attributes:
	see [api/models/User.coffee](https://github.com/twhtanghk/imsails/blob/master/api/models/User.coffee)
		
api:
	get /api/user - list users for the specified pagination/sorting parameters skip, limit, sort
    get /api/user/:id - read user attributes of the specified id
    get /user/photo/:id - get user photo 
    get /api/user/me - read user attributes of current login user
    put /api/user/me - update user attributes of current login user excluding attribute id, jid, photoUrl 
```

*   group

```
attributes:
	see [api/models/Group.coffee](https://github.com/twhtanghk/imsails/blob/master/api/models/Group.coffee)
	
api:
	post /api/group - create group with the specified attributes excluding id, jid, photoUrl
    get /api/group - list public groups (moderated or unmoderated) for specified pagination/sorting parameters skip, limit, sort
    get /api/group/membersOnly - list private groups (members only) for specified pagination/sorting parameters skip, limit, sort
    get /group/photo/:id - get group photo
    put /api/group/:id - update group attributes of the specified id exlcuding id, jid, photoUrl
    del /api/group/:id - delete group of the specified id
```

*   roster
   
``` 
attributes:
	see [api/models/Roster.coffee](https://github.com/twhtanghk/imsails/blob/master/api/models/Roster.coffee)
	
api:
    post /api/roster - create a roster item with the specified attributes excluding id, jid
    get /api/roster - list all roster items for current login user
    del /api/roster/:id - delete roster item of the specified jid
```

*   msg

```
attributes:
	see [api/models/Msg.coffee](https://github.com/twhtanghk/imsails/blob/master/api/models/Msg.coffee)

api:
    get /api/msg - read message history for the specified chat type (type) and target user or group jid (to) (e.g. {type: 'chat', to: '<EMAIL>'} or {type: 'groupchat', to: '<EMAIL>'})
    get /api/msg/file/:id - get file attachment for the specified message id
    post /api/msg - send message with the specified attributes
    post /api/msg/file - send file attachment with the specified attributes
```

Configuration
=============

*   git clone https://github.com/twhtanghk/imsails.git
*   cd imsails
*   npm install && bower install
*   update environment variables in config/env/development.coffee for server
```
port: 3000
connections:<commit_msg>format readme.md<commit_after># imsails

Instant messaging app to interface server with sailsjs rest or socket.io API


Server API
---------------------------------------------------------
## user

* attributes

	see [api/models/User.coffee](https://github.com/twhtanghk/imsails/blob/master/api/models/User.coffee)
		
* api

	```
	get /api/user - list users for the specified pagination/sorting parameters skip, limit, sort
    get /api/user/:id - read user attributes of the specified id
    get /user/photo/:id - get user photo 
    get /api/user/me - read user attributes of current login user
    put /api/user/me - update user attributes of current login user excluding attribute id, jid, photoUrl 
	```

## group

* attributes
	
	see [api/models/Group.coffee](https://github.com/twhtanghk/imsails/blob/master/api/models/Group.coffee)
	
* api
	```
	post /api/group - create group with the specified attributes excluding id, jid, photoUrl
    get /api/group - list public groups (moderated or unmoderated) for specified pagination/sorting parameters skip, limit, sort
    get /api/group/membersOnly - list private groups (members only) for specified pagination/sorting parameters skip, limit, sort
    get /group/photo/:id - get group photo
    put /api/group/:id - update group attributes of the specified id exlcuding id, jid, photoUrl
    del /api/group/:id - delete group of the specified id
	```

## roster
   
* attributes

	see [api/models/Roster.coffee](https://github.com/twhtanghk/imsails/blob/master/api/models/Roster.coffee)

* api

	``` 
    post /api/roster - create a roster item with the specified attributes excluding id, jid
    get /api/roster - list all roster items for current login user
    del /api/roster/:id - delete roster item of the specified jid
	```

## msg

* attributes
	
	see [api/models/Msg.coffee](https://github.com/twhtanghk/imsails/blob/master/api/models/Msg.coffee)

* api
	```
    get /api/msg - read message history for the specified chat type (type) and target user or group jid (to) (e.g. {type: 'chat', to: '<EMAIL>'} or {type: 'groupchat', to: '<EMAIL>'})
    get /api/msg/file/:id - get file attachment for the specified message id
    post /api/msg - send message with the specified attributes
    post /api/msg/file - send file attachment with the specified attributes
	```

Configuration
=============

*   git clone https://github.com/twhtanghk/imsails.git
*   cd imsails
*   npm install && bower install
*   update environment variables in config/env/development.coffee for server
```
port: 3000
connections:
{'fraction_non_alphanumeric': 0.13063063063063063, 'fraction_numerical': 0.0015667841754798276, 'mean_word_length': 3.179214402618658, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, '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': '1610928', 'n_tokens_mistral': 1602, 'n_tokens_neox': 1511, 'n_words': 518}