<commit_before># gitter-api-pcl [![Join the chat at https://gitter.im/Odonno/gitter-api-pcl](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Odonno/gitter-api-pcl?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Build status](https://ci.appveyor.com/api/projects/status/dnoqp3gt2f6d6w2t?svg=true)](https://ci.appveyor.com/project/Odonno/gitter-api-pcl)

Gitter# provide you the minimum code you need to use the Gitter API.

## Authentication

The Gitter API requires you to retrieve a token to have access to the entire API. You can follow [this tutorial to get a token using OAuth2 authentication](https://developer.gitter.im/docs/authentication).

Now, you should receive a token. All you need to do is to provide it to the ApiService :

```
IGitterApiService gitterApiService = new GitterApiService();
gitterApiService.TryAuthenticate("the-token");
```

## User

To complete...

## Room

To complete...

## Messages

To complete...

## Realtime messages

To complete...<commit_msg>docs(readme): show code to use the api, basically without realtime api<commit_after># gitter-api-pcl [![Join the chat at https://gitter.im/Odonno/gitter-api-pcl](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Odonno/gitter-api-pcl?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Build status](https://ci.appveyor.com/api/projects/status/dnoqp3gt2f6d6w2t?svg=true)](https://ci.appveyor.com/project/Odonno/gitter-api-pcl)

Gitter# provide you the minimum code you need to use the Gitter API.

## Authentication

The Gitter API requires you to retrieve a token to have access to the entire API. You can follow [this tutorial to get a token using OAuth2 authentication](https://developer.gitter.im/docs/authentication).

Now, you should receive a token. All you need to do is to provide it to the ApiService :

```
IGitterApiService gitterApiService = new GitterApiService();
gitterApiService.TryAuthenticate("the-token");
```

## User

### Current User

```
var currentUser = await gitterApiService.GetCurrentUserAsync();
```

## Unread items

### Unread messages

```
var unreadItems = await gitterApiService.RetrieveUnreadChatMessagesAsync("user-id", "room-id");
```

### Mark unread messages

```
IEnumerable<string> ids = new [] { "message-id", "another-message-id" };
await gitterApiService.MarkUnreadChatMessagesAsync("user-id", "room-id", ids);
```

## Room

### Retrieve rooms

```
var rooms = await gitterApiService.GetRoomsAsync();
```

### Join room

```
var room = await gitterApiService.JoinRoomAsync("room-uri");
```

## Messages

### Single message

```
var message = await gitterApiService.GetSingleRoomMessageAsync("room-id", "message-id");
```

### All room messages

```
var messages = await gitterApiService.GetRoomMessagesAsync("room-id");
```

```
var messages = await gitterApiService.GetRoomMessagesAsync("room-id", 20);
```

```
var messages = await gitterApiService.GetRoomMessagesAsync("room-id", 20, "message-id");
```

```
var messages = await gitterApiService.GetRoomMessagesAsync("room-id", 20, "message-id", "another-message-id");
```

```
var messages = await gitterApiService.GetRoomMessagesAsync("room-id", 20, "message-id", "another-message-id", 10);
```

### Send message

```
var message = await gitterApiService.SendMessageAsync("room-id", "this is a test message");
```

### Update message

```
var message = await gitterApiService.UpdateMessageAsync("room-id", "message-id", "this is an updated message");
```

## Realtime messages

To complete...
{'fraction_non_alphanumeric': 0.15040764689344954, 'fraction_numerical': 0.007309530503233062, 'mean_word_length': 5.422382671480144, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 12, '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': '4342990', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1164, 'n_words': 279}