-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from raian621/add-docs
added docs using docsify
- Loading branch information
Showing
11 changed files
with
509 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# GroupMeme | ||
|
||
Simple Python library for interfacing with the GroupMe API. | ||
|
||
I plan to add support for bot commands when I finish implementing the basic GroupMe API routes. | ||
|
||
## Prerequisites | ||
|
||
In order to use the GroupMe API, you must have: | ||
- A GroupMe account: [Sign up for GroupMe](https://web.groupme.com/signup) | ||
- A GroupMe API token: [GroupMe developer site](https://dev.groupme.com/) | ||
- Log in with your GroupMe account credentials | ||
- Click on 'Access Token' in the top right corner of the site to see your API token | ||
- Save your API token somewhere safe and **do not share your API token with anyone** | ||
- Python >=3.10 and pip installed on your system | ||
|
||
## Installation | ||
|
||
This library is still in development so it's only available on test.pypi.org | ||
|
||
```sh | ||
pip install -i https://test.pypi.org/simple/ groupmeme | ||
``` | ||
|
||
## Example Code | ||
|
||
```py | ||
from groupmeme.api import init_groupmeme, Group, Message | ||
|
||
# load data needed to send authenticated requests to GroupMe API: | ||
init_groupmeme( | ||
api_url='https://api.groupme.com/v3/', | ||
api_token='<GROUPME_API_TOKEN>' | ||
) | ||
|
||
# create a group: | ||
group = Group._create( | ||
name='The Meme Team', | ||
description='Dankest memes in the west', | ||
image_url='https://giphy.com/gifs/rick-astley-Ju7l5y9osyymQ' | ||
) | ||
|
||
# send message to the newly created group: | ||
Message._create( | ||
group_id=group.id, | ||
text='Hello World' | ||
) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
![logo](_media/logo.svg) | ||
|
||
# GroupMeme <small>0.0.5</small> | ||
|
||
- A Simple API Library for GroupMe | ||
|
||
[GitHub](https://github.com/raian621/groupmeme) | ||
[TestPyPi](https://test.pypi.org/project/groupmeme/) | ||
[Get Started](/quickstart) | ||
|
||
![color](#ddeeee) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!-- docs/_sidebar.md --> | ||
* **Get Started** | ||
* [Quickstart](/get-started/quickstart.md) | ||
* [Bot Tutorial](/get-started/bot-tutorial.md) | ||
* **Documentation** | ||
* **groupmeme** | ||
* [groupmeme.api](/groupmeme/api/) | ||
* [groupmeme.objects](/groupmeme/objects/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Bot Tutorial | ||
|
||
## Prerequisites | ||
- [Create a GroupMe account and obtain your API key](/get-started/quickstart#prerequisites) | ||
- Have `python >= 3.10` and `pip` installed on your system | ||
- [Have `groupmeme` installed on your system](/get-started/quickstart#installation) | ||
|
||
## Initialize GroupMeme with API token and API url | ||
```python | ||
from groupmeme import init_groupmeme | ||
from groupmeme.api import Group, Bot | ||
|
||
init_groupmeme( | ||
api_url='https://api.groupme.com/v1/', # default | ||
api_token='API_TOKEN' | ||
) | ||
``` | ||
|
||
## Create a testing group | ||
```python | ||
test_group = Group._create( | ||
name='Testing Group' | ||
) | ||
``` | ||
|
||
## Create and Register your bot | ||
```python | ||
test_bot = Bot._create('Test Bot', test_group.id) | ||
``` | ||
## Make your bot do something | ||
```python | ||
test_bot.send_message('Hello World!') | ||
``` | ||
|
||
## Final code: <!-- {docsify-ignore} --> | ||
```python | ||
from groupmeme import init_groupmeme | ||
from groupmeme.api import Group, Bot | ||
|
||
init_groupmeme( | ||
api_url='https://api.groupme.com/v1/', # default | ||
api_token='API_TOKEN' | ||
) | ||
|
||
# create a group called 'Test Group' | ||
test_group = Group._create('Test Group') | ||
|
||
# create a bot called 'Test Bot' | ||
test_bot = Bot._create('Test Bot', test_group.id) | ||
|
||
# send a message from 'Test Bot' in the 'Test Group' chat | ||
test_bot.send_message('Hello World!') | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Quickstart | ||
|
||
## Prerequisites | ||
|
||
In order to use the GroupMe API, you must have: | ||
- A GroupMe account: [Sign up for GroupMe](https://web.groupme.com/signup) | ||
- A GroupMe API token: [GroupMe developer site](https://dev.groupme.com/) | ||
- Log in with your GroupMe account credentials | ||
- Click on 'Access Token' in the top right corner of the site to see your API token | ||
- Save your API token somewhere safe and **do not share your API token with anyone** | ||
- Python >=3.10 and pip installed on your system | ||
|
||
## Installation | ||
|
||
This library is still in development so it's only available on test.pypi.org | ||
|
||
```sh | ||
pip install -i https://test.pypi.org/simple/ groupmeme | ||
``` | ||
|
||
## Example Code | ||
|
||
```py | ||
from groupmeme.api import init_groupmeme, Group, Message | ||
|
||
# load data needed to send authenticated requests to GroupMe API: | ||
init_groupmeme( | ||
api_url='https://api.groupme.com/v3/', | ||
api_token='<GROUPME_API_TOKEN>' | ||
) | ||
|
||
# create a group: | ||
group = Group._create( | ||
name='The Meme Team', | ||
description='Dankest memes in the west', | ||
image_url='https://giphy.com/gifs/rick-astley-Ju7l5y9osyymQ' | ||
) | ||
|
||
# send message to the newly created group: | ||
Message._create( | ||
group_id=group.id, | ||
text='Hello World' | ||
) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
# groupmeme.api | ||
|
||
Contains classes and functions used to interface with the GroupMe API. | ||
|
||
## `Group` | ||
--- | ||
### `Group.__init__` | ||
`Group` constructor | ||
|
||
**Params:** | ||
|
||
- **`id (str)`**: ID of the Group. | ||
- **`name (str)`**: The name of the Group | ||
- **`type (str)`**: The type of Group (`'public'` or `'private'`) | ||
- **`description (str)`**: The description of the Group | ||
- **`image_url (str)`**: URL for the Group's profile image | ||
- **`members (list[`[`Member`](/groupmeme/api/#member)`])`**- Members of the Group | ||
- **`created_at (str)`**: The time (Unix time) that the Group was created | ||
- **`updated_at (str)`**: The time (Unix time) that the Group was last updated | ||
- **`creator_user_id (str)`**: ID of the creator of the Group | ||
- **`share_url (str)`**: URL that can be used to join the Group | ||
- **`messages (list[`[`Message`](/groupmeme/api/#message)`])`**: Messages in the Group | ||
|
||
### `Group.from_dict` | ||
Initializes a `Group` object using the `group_dict` `dict`. | ||
|
||
**Params**: | ||
- **`group_dict (dict)`**: `dict` used to initialize the Group | ||
**Returns**: `Group` | ||
|
||
### `Group._groups` | ||
**Params**: | ||
|
||
**Returns**: `list[Group]` | ||
### `Group._former_groups` | ||
**Params**: | ||
|
||
**Returns**: `list[Group]` | ||
### `Group._get` | ||
**Params**: | ||
|
||
**Returns**: `Group` | ||
### `Group._create` | ||
**Params**: | ||
|
||
**Returns**: `Group` | ||
### `Group._update` | ||
**Params**: | ||
|
||
**Returns**: `Group` | ||
### `Group._destroy` | ||
**Params**: | ||
|
||
**Returns**: `status_code (int)` | ||
|
||
## `Bot` | ||
--- | ||
### `Bot.__init__` | ||
### `Bot.from_dict` | ||
**Params**: | ||
|
||
**Returns**: | ||
|
||
### `Bot._create` | ||
**Params**: | ||
|
||
**Returns**: | ||
|
||
### `Bot._send_message` | ||
**Params**: | ||
|
||
**Returns**: | ||
|
||
### `Bot.send_message` | ||
**Params**: | ||
|
||
**Returns**: | ||
|
||
### `Bot._get_bots` | ||
**Params**: | ||
|
||
**Returns**: | ||
|
||
### `Bot._destroy_bot` | ||
**Params**: | ||
|
||
**Returns**: | ||
|
||
|
||
## `Member` | ||
--- | ||
### `Member.__init__` | ||
**Params**: | ||
|
||
**Returns**: | ||
|
||
### `Member.from_dict` | ||
**Params**: | ||
|
||
**Returns**: | ||
|
||
### `Member._add` | ||
**Params**: | ||
|
||
**Returns**: | ||
|
||
### `Member._add_result` | ||
**Params**: | ||
|
||
**Returns**: | ||
|
||
### `Member._remove` | ||
**Params**: | ||
|
||
**Returns**: | ||
|
||
### `Member._update` | ||
**Params**: | ||
|
||
**Returns**: | ||
|
||
|
||
## `Message` | ||
--- | ||
### `Message.__init__` | ||
### `Message.from_dict` | ||
**Params**: | ||
|
||
**Returns**: | ||
|
||
### `Message._messages` | ||
**Params**: | ||
|
||
**Returns**: | ||
|
||
### `Message._create` | ||
**Params**: | ||
|
||
**Returns**: | ||
|
||
|
||
## `Pictures` | ||
--- | ||
### `upload_picture` | ||
**Params**: | ||
|
||
**Returns**: | ||
|
||
|
||
## `User` | ||
--- | ||
### `User.__init__` | ||
### `User.from_dict` | ||
**Params**: | ||
|
||
**Returns**: | ||
|
||
### `User._me` | ||
**Params**: | ||
|
||
**Returns**: | ||
|
||
### `User._update_me` | ||
**Params**: | ||
|
||
**Returns**: | ||
|
||
|
||
## Note on Static Class Functions and Class Functions | ||
--- | ||
Most functions used to interface with the GroupMe API are static class methods from classes corresponding to the desired API category: | ||
|
||
```py | ||
Group._update(group_id='1234567890', name='Updated Name') | ||
``` | ||
|
||
Some static class methods will have a corresponding class method that passes data from the object it is called on such as the object's id from the object it is called from to the static class method: | ||
|
||
```py | ||
# my_group is a Group object: | ||
my_group.update(name='Updated Name') | ||
--- | ||
# behind the scenes :3 | ||
class Group: | ||
... | ||
def update(self, name, ...): | ||
return Group._update(self.id, name=name) | ||
``` | ||
|
||
Static class methods that interact with the GroupMe API will always be prefixed with an underscore: | ||
|
||
```py | ||
Group._update() | ||
``` | ||
|
||
Whereas regular ol' class methods will drop the underscore at the beginning of the method: | ||
```py | ||
Group.update() | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Objects | ||
|
||
## `Attachment` | ||
Stores data used for [`Message`](/groupmeme/api/#message) attachments. | ||
|
||
Attachment Type (`_type`) | Parameters | ||
--|-- | ||
`'image'` | `url` | ||
`'location'` | `lat`, `lng`, `name` | ||
`'split'` | `token` | ||
`'emoji'` | `placeholder`, `charmap` | ||
|
||
### `Attachment.__init__` | ||
- **`_type (str)`**: type of attachment, can be (`'image'`|`'location'`|`'split'`|`'emoji'`) | ||
- **`url (str|None)`**: GroupMe CDN url for `'image'` attachments | ||
- **`lat (str|None)`**: Latitude value for `'location'` attachments | ||
- **`lng (str|None)`**: Longitude value for `'location'` attachments | ||
- **`name (str|None)`**: Name for `'location'` attachments | ||
- **`token (str|None)`**: Token value for `'split'` attachments | ||
- **`placeholder (str|None)`**: Placeholder for `'emoji'` attachments | ||
- **`charmap (any)`**: Charmap for `'emoji'` attachments |
Oops, something went wrong.