ejabberd
Version, currently 0.1.01 version
- 0.1.0latestMay 8, 2018
github.com/c1tt1/ejabberd.cr
A Crystal library to easily communicate with the ejabberd admin API.
Installation
# Add this to your shard.yml
dependencies:
ejabberd:
github: c1tt1/ejabberd.cr
version: ~> 0.1.0Then run:
shards installshard.yml
- Crystal
0.24.2- License
- MIT
- Author
- stern0
Dependencies
This version declares no dependencies.
README
ejabberd.cr
A Crystal library to easily communicate with the ejabberd admin API.
It implements all ejabberd rest api reference.
This library is small and simple, it can be read and understood in no more than 10 minutes.
Installation
Add this to your application's shard.yml:
dependencies:
ejabberd:
github: stern0/ejabberd.cr
Usage
require "ejabberd"
# ejabberd = Ejabberd.new "api_url"
ejabberd = Ejabberd.new "http://127.0.0.1:5280"
This library implements same method names as the ejabberd rest api reference and take same value types as the api reference.
For example add_rosteritem in the api reference like the following:
POST /api/add_rosteritem
{
"localuser": "user1",
"localserver": "myserver.com",
"user": "user2",
"server": "myserver.com",
"nick": "User 2",
"group": "Friends",
"subs": "both"
}
HTTP/1.1 200 OK
""
With this library the above becomes the following:
ejabberd.add_rosteritem("user1", "myserver.com", "user2", "myserver.com", "User 2", "Friends", "both")
You can also add the argument names like the following:
ejabberd.add_rosteritem(localuser: "user1", localserver: "myserver.com", user: "user2", server: "myserver.com", nick: "User 2", group: "Friends", subs: "both")
Return types
Each method return an HTTP::Client::Response instance, so you can any call methods like body or status_code on it.
Memory footprint
The library resides on the stack which makes it fast and cheap due to to no allocation on the heap.
Development
This project requires a locally running ejabberd server running with http api set in ejabberd.yml file. The test specs are currently in implementation.
Contributing
- Fork it ( https://github.com/stern0/ejabberd.cr/ )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- Bug reports and pull requests are welcome on GitHub at stern0 - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.0- Tagged
- May 8, 2018
- Commit
817ed988f747- Crystal
0.24.2- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/c1tt1/ejabberd.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 1