Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
xHossein committed Feb 4, 2022
1 parent 34693db commit 3402f93
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 32 deletions.
2 changes: 1 addition & 1 deletion docs/coverpage.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# radiojavanapi <small>0.2.2</small>
# radiojavanapi <small>0.3.0</small>

> Fast and effective [RadioJavan](https://radiojavan.com/) API wrapper in python
Expand Down
1 change: 1 addition & 0 deletions docs/exceptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ UsernameExists | PrivateError | Raised when username used by another account (ed
DuplicatePassword | PrivateError | Raised when a duplicate password is provided (edit account)
DuplicateName | PrivateError | Raised when a duplicate name is provided for playlist (create or rename playlist)
InvalidMediaId | PrivateError | Raised when an invalid media id is provided (like, follow, ...)
InvalidEmail | PrivateError | Raised when an invalid email is provided
UnknownError | PrivateError | Raised when get unknown message (new message from radiojavan)
1 change: 1 addition & 0 deletions docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

* Get full info of a Song, Video, Podcast, Story, Playlist, Artist, Album, User and your Account
* Login by email and password
* Sign up to RadioJavan
* Like and Unlike a Song, Video, Podcast and Story
* Follow and Unfollow a Artist, User or MusicPlaylist
* Get followers and following of a user
Expand Down
74 changes: 72 additions & 2 deletions docs/methods.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,79 @@
# Methods

## Authentication
For [Actions](methods?id=actions) and [Account](methods?id=account) methods, you must have an account.

### Login
Arguments:

| Name | Type | Description
-------|------|------------
`email` | `str` | Your account email
`password` | `str` | Your account password

Example:
```python
from radiojavanapi import Client
from radiojavanapi.exceptions import BadCredentials

client = Client()
try:
client.login("YOUR EMAIL", "YOUR PASSWORD")
except BadCredentials:
# raise due to wrong email or password
# do something
pass

song = client.get_song_by_url(
'https://www.radiojavan.com/mp3s/mp3/Sijal-Baz-Mirim-Baham-(Ft-Sami-Low)')

print(client.like_song(song.id))
print(client.follow_artist(song.artist))
```
<details>
<summary>Show Output</summary>

```
True
True
```
</details>

### Sign Up

Arguments:

| Name | Type | Description
-------|------|------------
`firstname` | `str` | Your account firstname
`lastname` | `str` | Your account lastname
`username` | `str` | Your account username
`email` | `str` | Your account email
`password` | `str` | Your account password
`auto_login` | `bool` | Login to account after sign up

Example:
```python
from radiojavanapi import Client

client = Client()
client.signup("YOUR FIRSTNAME", "YOUR LASTNAME", "YOUR USERNAME", "YOUR EMAIL", "YOUR PASSWORD", True)
```

### Save & Load session
You can save your session like this:
```python
clientObj.save_session('./myaccount')
```
And you can load your session as well to avoid many logins:
```python
clientObj.load_session('./myaccount')
```

## Account
All account methods require authentication.

?> **Radiojavanapi Docs:** Check [here](quick-start?id=login-to-rj) for login by email and password.
?> **Radiojavanapi Docs:** Check [here](methods?id=authentication) for login or sign up.

### Activity
- Get list of:
Expand Down Expand Up @@ -42,7 +112,7 @@ deactive_account() | `bool` | Deactivate your account and logout | YES
## Actions
All action methods require authentication.

?> **Radiojavanapi Docs:** Check [here](quick-start?id=login-to-rj) for login by email and password.
?> **Radiojavanapi Docs:** Check [here](methods?id=authentication) for login or sign up.

### Like & Unlike

Expand Down
29 changes: 0 additions & 29 deletions docs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,32 +50,3 @@ HQ-Link: https://host2.mediacon-rj.app/media/mp3/aac-256/99926-cf9dd3814907dbb.m
</details>

!> Please note that `set_proxy` only gets proxy as dict.

## Login to RJ
For [Actions](methods?id=actions) and [Account](methods?id=account) methods, you must have an account.
```python
from radiojavanapi import Client
from radiojavanapi.exceptions import BadCredentials

client = Client()
try:
client.login("YOUR EMAIL", "YOUR PASSWORD")
except BadCredentials:
# raise due to wrong email or password
# do something
pass

song = client.get_song_by_url(
'https://www.radiojavan.com/mp3s/mp3/Sijal-Baz-Mirim-Baham-(Ft-Sami-Low)')

print(client.like_song(song.id))
print(client.follow_artist(song.artist))
```
<details>
<summary>Show Output</summary>

```
True
True
```
</details>

0 comments on commit 3402f93

Please sign in to comment.