Skip to content

Commit 64f4b5b

Browse files
committed
Rename PodcastApiClient
1 parent 9e77ef2 commit 64f4b5b

File tree

12 files changed

+57
-56
lines changed

12 files changed

+57
-56
lines changed

README.md

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ try {
7575

7676
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
7777

78-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
78+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
7979
$strResponse = $objClient->typeahead( [ 'q' => 'startup', 'show_podcasts' => '1' ] );
8080
$arrHeaders = $objClient->getHeaders();
8181

@@ -87,17 +87,17 @@ try {
8787
print("\n=== Response data ===\n");
8888
print_r( json_decode( $strResponse ) );
8989

90-
} catch ( ListenNotes\PodcastApiClient\Exception\APIConnectionException $objException ) {
90+
} catch ( ListenNotes\PodcastApi\Exception\APIConnectionException $objException ) {
9191
print("Failed ot connect to Listen API servers");
92-
} catch ( ListenNotes\PodcastApiClient\Exception\AuthenticationException $objException ) {
92+
} catch ( ListenNotes\PodcastApi\Exception\AuthenticationException $objException ) {
9393
print("Wrong api key, or your account has been suspended!");
94-
} catch ( ListenNotes\PodcastApiClient\Exception\InvalidRequestException $objException ) {
94+
} catch ( ListenNotes\PodcastApi\Exception\InvalidRequestException $objException ) {
9595
print("Wrong parameters!");
96-
} catch ( ListenNotes\PodcastApiClient\Exception\NotFoundException $objException ) {
96+
} catch ( ListenNotes\PodcastApi\Exception\NotFoundException $objException ) {
9797
print("Endpoint not exist or the podcast / episode not exist!");
98-
} catch ( ListenNotes\PodcastApiClient\Exception\RateLimitException $objException ) {
98+
} catch ( ListenNotes\PodcastApi\Exception\RateLimitException $objException ) {
9999
print("You have reached your quota limit!");
100-
} catch ( ListenNotes\PodcastApiClient\Exception\ListenApiException $objException ) {
100+
} catch ( ListenNotes\PodcastApi\Exception\ListenApiException $objException ) {
101101
print("Something wrong on Listen Notes servers");
102102
} catch ( Exception $e ) {
103103
print("Other errors that may not be related to Listen API");
@@ -128,7 +128,6 @@ And you can see some sample code [here](https://github.com/ListenNotes/podcast-a
128128

129129

130130

131-
132131
## API Reference
133132

134133
Each function is a wrapper to send an HTTP request to the corresponding endpoint on the
@@ -156,7 +155,7 @@ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
156155

157156
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
158157

159-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
158+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
160159

161160
$strResponse = $objClient->search( [ 'q' => 'startup' ] );
162161
print_r( json_decode( $strResponse ) );
@@ -993,7 +992,7 @@ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
993992

994993
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
995994

996-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
995+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
997996

998997
$strResponse = $objClient->typeahead( [ 'q' => 'startup', 'show_podcasts' => '1' ] );
999998
print_r( json_decode( $strResponse ) );
@@ -1202,7 +1201,7 @@ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
12021201

12031202
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
12041203

1205-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
1204+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
12061205

12071206
$strResponse = $objClient->getPodcastById( [ 'id' => '4d3fe717742d4963a85562e9f84d8c79' ] );
12081207
print_r( json_decode( $strResponse ) );
@@ -1755,7 +1754,7 @@ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
17551754

17561755
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
17571756

1758-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
1757+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
17591758

17601759
$strResponse = $objClient->fetchEpisodeById( [ 'id' => '6b6d65930c5a4f71b254465871fed370',
17611760
'show_transcript' => '1' ] );
@@ -2161,7 +2160,7 @@ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
21612160

21622161
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
21632162

2164-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
2163+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
21652164

21662165
$strResponse = $objClient->fetchPodcastLanguages();
21672166
print_r( json_decode( $strResponse ) );
@@ -2332,7 +2331,7 @@ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
23322331

23332332
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
23342333

2335-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
2334+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
23362335

23372336
$strResponse = $objClient->fetchPodcastGenres( [ 'top_level_only' => '1' ] );
23382337
print_r( json_decode( $strResponse ) );
@@ -2523,7 +2522,7 @@ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
25232522

25242523
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
25252524

2526-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
2525+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
25272526

25282527
$strResponse = $objClient->fetchBestPodcasts( [ 'genre_id' => '93', 'page' => '2' ] );
25292528
print_r( json_decode( $strResponse ) );
@@ -3843,7 +3842,7 @@ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
38433842

38443843
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
38453844

3846-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
3845+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
38473846

38483847
$strResponse = $objClient->fetchPodcastRegions();
38493848
print_r( json_decode( $strResponse ) );
@@ -4058,7 +4057,7 @@ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
40584057

40594058
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
40604059

4061-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
4060+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
40624061

40634062
$strResponse = $objClient->fetchRecommendationsForPodcast(
40644063
[ 'id' => '25212ac3c53240a880dd5032e547047b', 'safe_mode' => 1 ] );
@@ -4734,7 +4733,7 @@ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
47344733

47354734
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
47364735

4737-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
4736+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
47384737

47394738
$strResponse = $objClient->fetchRecommendationsForEpisode(
47404739
[ 'id' => '914a9deafa5340eeaa2859c77f275799', 'safe_mode' => 1 ] );
@@ -5118,7 +5117,7 @@ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
51185117

51195118
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
51205119

5121-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
5120+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
51225121

51235122
$strResponse = $objClient->batchFetchEpisodes( [
51245123
'ids' => 'c577d55b2b2b483c969fae3ceb58e362,0f34a9099579490993eec9e8c8cebb82' ] );
@@ -5349,7 +5348,7 @@ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
53495348

53505349
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
53515350

5352-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
5351+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
53535352

53545353
$strResponse = $objClient->batchFetchPodcasts( [
53555354
'ids' => '3302bc71139541baa46ecb27dbf6071a,68faf62be97149c280ebcc25178aa731,9cf19c590ff0484d97b18b329fed0c6a' ] );
@@ -6531,7 +6530,7 @@ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
65316530

65326531
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
65336532

6534-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
6533+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
65356534

65366535
$strResponse = $objClient->justListen();
65376536
print_r( json_decode( $strResponse ) );
@@ -6718,7 +6717,7 @@ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
67186717

67196718
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
67206719

6721-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
6720+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
67226721

67236722
$strResponse = $objClient->fetchCuratedPodcastsListById( [ 'id' => 'SDFKduyJ47r' ] );
67246723
print_r( json_decode( $strResponse ) );
@@ -7819,7 +7818,7 @@ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
78197818

78207819
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
78217820

7822-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
7821+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
78237822

78247823
$strResponse = $objClient->fetchCuratedPodcastsLists( [ 'page' => 2 ] );
78257824
print_r( json_decode( $strResponse ) );
@@ -9249,7 +9248,7 @@ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
92499248

92509249
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
92519250

9252-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
9251+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
92539252

92549253
$strResponse = $objClient->submitPodcast( [ 'rss' => 'https://feeds.megaphone.fm/committed' ] );
92559254
print_r( json_decode( $strResponse ) );
@@ -9370,7 +9369,7 @@ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
93709369

93719370
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
93729371

9373-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
9372+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
93749373

93759374
$strResponse = $objClient->deletePodcast( [ 'id' => '4d3fe717742d4963a85562e9f84d8c79' ] );
93769375
print_r( json_decode( $strResponse ) );
@@ -9442,7 +9441,7 @@ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
94429441

94439442
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
94449443

9445-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
9444+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
94469445

94479446
$strResponse = $objClient->fetchPlaylistById( [ 'id' => 'm1pe7z60bsw', 'type' ='podcast_list' ] );
94489447
print_r( json_decode( $strResponse ) );
@@ -10637,7 +10636,7 @@ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
1063710636

1063810637
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
1063910638

10640-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
10639+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
1064110640

1064210641
$strResponse = $objClient->fetchMyPlaylists( [ 'page' => '1', 'sort' ='name_a_to_z' ] );
1064310642
print_r( json_decode( $strResponse ) );
@@ -10798,3 +10797,6 @@ See all available parameters on the [API Docs page](https://www.listennotes.com/
1079810797
}
1079910798
```
1080010799
</details>
10800+
10801+
10802+

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
},
2020
"autoload": {
2121
"psr-4": {
22-
"ListenNotes\\PodcastApiClient\\": "listennotes/"
22+
"ListenNotes\\PodcastApi\\": "listennotes/"
2323
}
2424
},
2525
"autoload-dev": {
2626
"psr-4": {
27-
"ListenNotes\\PodcastApiClient\\": [
27+
"ListenNotes\\PodcastApi\\": [
2828
"tests/"
2929
]
3030
}

examples/sample.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
define( 'API_KEY', ( getenv( 'API_KEY' ) ? getenv( 'API_KEY' ) : null ) );
99

10-
$objClient = new ListenNotes\PodcastApiClient\PodcastApiClient( API_KEY );
11-
$strResponse = $objClient->typeahead( [ 'q' => 'startup', 'show_podcasts' => '1' ] );
10+
$objClient = new ListenNotes\PodcastApi\Client( API_KEY );
11+
$strResponse = $objClient->typeahead( [ 'q' => 'pod', 'show_podcasts' => '1' ] );
1212
$arrHeaders = $objClient->getHeaders();
1313

1414
print("\n=== Some account info ===\n");
@@ -19,17 +19,17 @@
1919
print("\n=== Response data ===\n");
2020
print_r( json_decode( $strResponse ) );
2121

22-
} catch ( ListenNotes\PodcastApiClient\Exception\APIConnectionException $objException ) {
22+
} catch ( ListenNotes\PodcastApi\Exception\APIConnectionException $objException ) {
2323
print("Failed ot connect to Listen API servers");
24-
} catch ( ListenNotes\PodcastApiClient\Exception\AuthenticationException $objException ) {
24+
} catch ( ListenNotes\PodcastApi\Exception\AuthenticationException $objException ) {
2525
print("Wrong api key, or your account has been suspended!");
26-
} catch ( ListenNotes\PodcastApiClient\Exception\InvalidRequestException $objException ) {
26+
} catch ( ListenNotes\PodcastApi\Exception\InvalidRequestException $objException ) {
2727
print("Wrong parameters!");
28-
} catch ( ListenNotes\PodcastApiClient\Exception\NotFoundException $objException ) {
28+
} catch ( ListenNotes\PodcastApi\Exception\NotFoundException $objException ) {
2929
print("Endpoint not exist or the podcast / episode not exist!");
30-
} catch ( ListenNotes\PodcastApiClient\Exception\RateLimitException $objException ) {
30+
} catch ( ListenNotes\PodcastApi\Exception\RateLimitException $objException ) {
3131
print("You have reached your quota limit!");
32-
} catch ( ListenNotes\PodcastApiClient\Exception\ListenApiException $objException ) {
32+
} catch ( ListenNotes\PodcastApi\Exception\ListenApiException $objException ) {
3333
print("Something wrong on Listen Notes servers");
3434
} catch ( Exception $e ) {
3535
print("Other errors that may not be related to Listen API");
@@ -56,8 +56,8 @@
5656
// $strResponse = $objClient->fetchCuratedPodcastsListById( [ 'id' => 'SDFKduyJ47r' ] );
5757
// print_r( json_decode( $strResponse ) );
5858

59-
$strResponse = $objClient->fetchCuratedPodcastsLists( [ 'page' => 2 ] );
60-
print_r( json_decode( $strResponse ) );
59+
// $strResponse = $objClient->fetchCuratedPodcastsLists( [ 'page' => 2 ] );
60+
// print_r( json_decode( $strResponse ) );
6161

6262
// $strResponse = $objClient->fetchPodcastGenres( [ 'top_level_only' => 0 ] );
6363
// print_r( json_decode( $strResponse ) );

listennotes/PodcastApiClient.php renamed to listennotes/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
declare(strict_types=1);
44

5-
namespace ListenNotes\PodcastApiClient;
5+
namespace ListenNotes\PodcastApi;
66

7-
final class PodcastApiClient extends Client\Curl
7+
final class Client extends Http\Curl
88
{
99
public function __construct( $strApiKey = '' )
1010
{

listennotes/Exception/APIConnectionException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace ListenNotes\PodcastApiClient\Exception;
3+
namespace ListenNotes\PodcastApi\Exception;
44

55
class APIConnectionException extends ListenApiException
66
{

listennotes/Exception/AuthenticationException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33

4-
namespace ListenNotes\PodcastApiClient\Exception;
4+
namespace ListenNotes\PodcastApi\Exception;
55

66
class AuthenticationException extends ListenApiException
77
{

listennotes/Exception/InvalidRequestException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33

4-
namespace ListenNotes\PodcastApiClient\Exception;
4+
namespace ListenNotes\PodcastApi\Exception;
55

66
class InvalidRequestException extends ListenApiException
77
{

listennotes/Exception/ListenApiException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace ListenNotes\PodcastApiClient\Exception;
3+
namespace ListenNotes\PodcastApi\Exception;
44

55
class ListenApiException extends \Exception
66
{

listennotes/Exception/NotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace ListenNotes\PodcastApiClient\Exception;
3+
namespace ListenNotes\PodcastApi\Exception;
44

55
class NotFoundException extends ListenApiException
66
{

listennotes/Exception/RateLimitException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace ListenNotes\PodcastApiClient\Exception;
3+
namespace ListenNotes\PodcastApi\Exception;
44

55
class RateLimitException extends ListenApiException
66
{

0 commit comments

Comments
 (0)