RedditBot v0.1.1 RedditBot

A Reddit API library

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Link to this section Functions

Link to this function

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

request(method, endpoint, params \\ [], body \\ nil)
request(:get | :post, binary(), keyword(), map() | nil) :: map()

Request a Reddit API.

Arguments:

  • method: :get or :post
  • endpoint: requesting API endpoint, for example: "api/v1/me"
  • params: keyword representing query parameters, for example: [after: "abc"]
  • body: map representing a request body, only used for POST requests, will be encoded into JSON

Returns the response decoded as JSON if successful. Since there is no error handling, it will raise different nomatch exceptions on errors.