Skip to content

Commit

Permalink
Merge pull request #3 from rgaida/master
Browse files Browse the repository at this point in the history
Fix image uploading and simplify namespace usage
  • Loading branch information
emilh91 committed Oct 3, 2015
2 parents 47de44c + aef4c7e commit b06989f
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 105 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Install using Composer:
Your GroupMe API key can be found on the page mentioned above once you are logged in.
```php
require 'vendor/autoload.php';
$c = new GroupMeApiClient\Client('API-KEY');
$c = new GroupMeApi\Client('API-KEY');
```

### Client methods
Expand Down Expand Up @@ -83,10 +83,19 @@ Aah, the pinnacle of modern communication... To send emojis in GroupMe, you need

```php
$raw_text = 'Hello :cool_guy_face::cigar_face:';
$emojification = GroupMeApiClient\EmojiUtils::extractEmojiNamesFromText($raw_text); // returns an array
$emoji_attachment = GroupMeApiClient\AttachmentUtils::makeEmojiAttachment($emojification['charmap']);
$emojification = GroupMeApi\EmojiUtils::extractEmojiNamesFromText($raw_text); // returns an array
$emoji_attachment = GroupMeApi\AttachmentUtils::makeEmojiAttachment($emojification['charmap']);
$c->sendDirectMessage('OTHER-USER-ID', $emojification['text'], null, array($emoji_attachment));
```

### Image Service
This functionality is still buggy. Check back again later. Sorry :(
Before using images in messages you have to upload an image to GroupMe's image service.

```php
require 'vendor/autoload.php';
$c = new GroupMeApi\Client('API-KEY');
$res = $c->uploadImage('my_image_file.png', 'image/png', 'testpic');
```

If the upload was successfull, the return variable contains the image url in `$res['payload']['url']` or an error message in `$res['error'][]`.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"autoload": {
"psr-4": {
"GroupMeApiClient\\": "src"
"GroupMeApi\\": "src"
}
}
}
Loading

0 comments on commit b06989f

Please sign in to comment.