https://github.com/druids/smsbrana
A connector for SMS brána https://www.smsbrana.cz
https://github.com/druids/smsbrana
Last synced: over 1 year ago
JSON representation
A connector for SMS brána https://www.smsbrana.cz
- Host: GitHub
- URL: https://github.com/druids/smsbrana
- Owner: druids
- License: mit
- Created: 2018-05-29T06:40:10.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-06T11:31:31.000Z (about 8 years ago)
- Last Synced: 2025-01-30T02:14:12.177Z (over 1 year ago)
- Language: Clojure
- Size: 12.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
smsbrana
========
A connector for SMS brána [https://www.smsbrana.cz](https://www.smsbrana.cz)
[](https://circleci.com/gh/druids/smsbrana)
[](https://jarkeeper.com/druids/smsbrana)
[](https://opensource.org/licenses/MIT)
Leiningen/Boot
--------------
```clojure
[smsbrana "0.2.0"]
```
Documentation
-------------
All functions are designed to return errors instead of throwing exceptions.
All API calls return a tuple within following structure: [keyword response http-response] where keyword can be:
- :ok when a response is a success and parsed
- :error when a response is parsed but it's an error response
- :error-malformed when a response is not an expected XML structure
- :error-unmarshalling when a response is not a valid XML
A `response` is a parsed body of an original HTTP response.
To be able to run examples this line is needed:
```clojure
(require '[smsbrana.core :as sms])
```
### send
Sends a SMS within `opts`.
```clojure
(sms/send {:login "login", :password "password", :message "TEST", :number "+420777666555"})
;; [:ok
;; {:credit 1523.32, :price 1.1, :sms_count 1, :sms_id "377351", :err 0}
;; {:request-time 386, ...
```
Example of an error response:
```clojure
(sms/send {:login "login", :password "password", :message "TEST", :number "+420777666555"})
;; [:error
;; {:err 4}
;; {:request-time 386, ...
```
Or
```clojure
(sms/send {:login "login", :password "password", :message "TEST", :number "+420777666555"})
;; [:error-unmarshalling
;; nil
;; {:request-time 386, ...
```