docs: Show return types on each example
parent
b59e713ffa
commit
3adf214c7d
48
README.md
48
README.md
|
@ -40,7 +40,7 @@ We use [SemVer](http://semver.org/) for versioning. For the versions available,
|
|||
|
||||
## Usage
|
||||
|
||||
Assumming that you already know your *instance* and your *bearer token* you can do
|
||||
Assuming that you already know your *instance* and your *bearer token* you can do
|
||||
the following:
|
||||
|
||||
```elixir
|
||||
|
@ -49,6 +49,8 @@ iex(1)> conn = Hunter.new([base_url: "https://example.com", bearer_token: "12345
|
|||
bearer_token: "123456"}
|
||||
```
|
||||
|
||||
Returns `Hunter.Client` details.
|
||||
|
||||
### Getting the current user
|
||||
|
||||
```elixir
|
||||
|
@ -62,6 +64,8 @@ iex(2)> Hunter.verify_credentials(conn)
|
|||
url: "https://social.lou.lt/@milmazz", username: "milmazz"}
|
||||
```
|
||||
|
||||
Returns a `Hunter.Account`
|
||||
|
||||
### Fetching an account
|
||||
|
||||
```elixir
|
||||
|
@ -75,9 +79,9 @@ iex(3)> Hunter.account(conn, 8039)
|
|||
url: "https://social.lou.lt/@milmazz", username: "milmazz"}
|
||||
```
|
||||
|
||||
### Getting an account's followers
|
||||
Returns a `Hunter.Account`
|
||||
|
||||
Returns a list of `Accounts`
|
||||
### Getting an account's followers
|
||||
|
||||
```elixir
|
||||
iex(4)> Hunter.followers(conn, 8039)
|
||||
|
@ -94,9 +98,9 @@ iex(4)> Hunter.followers(conn, 8039)
|
|||
]
|
||||
```
|
||||
|
||||
### Getting who account is following
|
||||
Returns a list of `Hunter.Account`
|
||||
|
||||
Returns a list of `Accounts`
|
||||
### Getting who account is following
|
||||
|
||||
```elixir
|
||||
iex(5)> Hunter.following(conn, 8039)
|
||||
|
@ -111,6 +115,8 @@ iex(5)> Hunter.following(conn, 8039)
|
|||
...]
|
||||
```
|
||||
|
||||
Returns a list of `Hunter.Account`
|
||||
|
||||
### Following a remote user
|
||||
|
||||
```elixir
|
||||
|
@ -126,6 +132,8 @@ iex(6)> Hunter.follow_by_uri(conn, "paperswelove@mstdn.io")
|
|||
username: "paperswelove"}
|
||||
```
|
||||
|
||||
Returns a `Hunter.Account`
|
||||
|
||||
### Muting/unmuting an account
|
||||
|
||||
```elixir
|
||||
|
@ -137,6 +145,8 @@ iex(8)> Hunter.unmute(conn, 7899)
|
|||
muting: false, requested: false}
|
||||
```
|
||||
|
||||
Returns the target account's `Hunter.Relationship`
|
||||
|
||||
### Getting an account's statuses
|
||||
|
||||
```elixir
|
||||
|
@ -162,6 +172,8 @@ iex(9)> Hunter.statuses(conn, 8039)
|
|||
]
|
||||
```
|
||||
|
||||
Returns a list of `Hunter.Status`
|
||||
|
||||
### Fetching a user's favourites
|
||||
|
||||
```
|
||||
|
@ -169,6 +181,8 @@ iex(10)> Hunter.favourites(conn)
|
|||
[]
|
||||
```
|
||||
|
||||
Returns a list of `Hunter.Status` favourited by the authenticated user.
|
||||
|
||||
### Favouriting/unfavouriting a status
|
||||
|
||||
```elixir
|
||||
|
@ -193,7 +207,7 @@ iex(11)> Hunter.favourite(conn, 442)
|
|||
```
|
||||
|
||||
```elixir
|
||||
iex(12)> Hunter.unfavourite(conn, 442)
|
||||
iex(12)> Hunter.unfavourite(conn, 442)
|
||||
%Hunter.Status{account: %Hunter.Account{acct: "FriendlyPootis",
|
||||
avatar: "https://social.lou.lt/system/accounts/avatars/000/000/034/original/565da0399c2c26cf.jpg?1491228302",
|
||||
created_at: "2017-04-03T13:50:06.485Z", display_name: "FriendlyPootis 🚉",
|
||||
|
@ -213,6 +227,8 @@ iex(11)> Hunter.favourite(conn, 442)
|
|||
url: "https://social.lou.lt/@FriendlyPootis/442", visibility: "public"}
|
||||
```
|
||||
|
||||
Returns the target `Hunter.Status`
|
||||
|
||||
### Get instance information
|
||||
|
||||
```elixir
|
||||
|
@ -222,6 +238,8 @@ iex(13)> Hunter.instance_info(conn)
|
|||
uri: "social.lou.lt"}
|
||||
```
|
||||
|
||||
Returns the current `Hunter.Instance`. Does not require authentication.
|
||||
|
||||
### Fetch user's notifications
|
||||
|
||||
```elixir
|
||||
|
@ -240,6 +258,8 @@ iex(14)> Hunter.notifications(conn)
|
|||
]
|
||||
```
|
||||
|
||||
Returns a list of `Hunter.Notification` for the authenticated user.
|
||||
|
||||
### Fetch a single notification
|
||||
|
||||
```elixir
|
||||
|
@ -256,6 +276,8 @@ iex(15)> Hunter.notification(conn, 17476)
|
|||
status: nil, type: "follow"}
|
||||
```
|
||||
|
||||
Returns a single `Hunter.Notification`
|
||||
|
||||
### Clear notifications
|
||||
|
||||
```elixir
|
||||
|
@ -265,6 +287,8 @@ iex(17)> Hunter.notifications(conn)
|
|||
[]
|
||||
```
|
||||
|
||||
Deletes all notifications from the Mastodon server for the authenticated user.
|
||||
|
||||
### Get a card associated with a status
|
||||
|
||||
```elixir
|
||||
|
@ -274,6 +298,8 @@ iex(18)> Hunter.card_by_status(conn, 118635)
|
|||
title: "milmazz/hunter", url: "https://github.com/milmazz/hunter"}
|
||||
```
|
||||
|
||||
Returns a `Hunter.Card`
|
||||
|
||||
### Fetch a list of follow requests
|
||||
|
||||
```elixir
|
||||
|
@ -281,6 +307,8 @@ iex(19)> Hunter.follow_requests(conn)
|
|||
[]
|
||||
```
|
||||
|
||||
Returns a list of `Hunter.Account` which have requested to follow the authenticated user.
|
||||
|
||||
### Fetch user's blocks
|
||||
|
||||
```elixir
|
||||
|
@ -288,6 +316,8 @@ iex(20)> Hunter.blocks(conn)
|
|||
[]
|
||||
```
|
||||
|
||||
Returns a list of `Hunter.Account` blocked by the authenticated user.
|
||||
|
||||
### Fetch user's mutes
|
||||
|
||||
```elixir
|
||||
|
@ -295,6 +325,8 @@ iex(21)> Hunter.mutes(conn)
|
|||
[]
|
||||
```
|
||||
|
||||
Returns a list of `Hunter.Account` muted by the authenticated user.
|
||||
|
||||
### Fetch user's reports
|
||||
|
||||
```elixir
|
||||
|
@ -302,6 +334,8 @@ iex(22)> Hunter.reports(conn)
|
|||
[]
|
||||
```
|
||||
|
||||
Returns a list of `Hunter.Report` made by the authenticated user.
|
||||
|
||||
### Filter statuses given a hashtag
|
||||
|
||||
```elixir
|
||||
|
@ -337,6 +371,8 @@ iex(23)> Hunter.hashtag_timeline(conn, "paperswelove")
|
|||
]
|
||||
```
|
||||
|
||||
Returns a list of `Hunter.Status`, most recent ones first.
|
||||
|
||||
## License
|
||||
|
||||
Hunter source code is released under Apache 2 License.
|
||||
|
|
Loading…
Reference in New Issue