22
33namespace FiveamCode \LaravelNotionApi ;
44
5- use Illuminate \Http \Client \PendingRequest ;
65use Illuminate \Support \Facades \Http ;
7- use FiveamCode \LaravelNotionApi \Endpoints \Blocks ;
8- use FiveamCode \LaravelNotionApi \Endpoints \Databases ;
9- use FiveamCode \LaravelNotionApi \Endpoints \Endpoint ;
6+ use Illuminate \Http \Client \PendingRequest ;
107use FiveamCode \LaravelNotionApi \Endpoints \Pages ;
8+ use FiveamCode \LaravelNotionApi \Endpoints \Blocks ;
119use FiveamCode \LaravelNotionApi \Endpoints \Search ;
1210use FiveamCode \LaravelNotionApi \Endpoints \Users ;
11+ use FiveamCode \LaravelNotionApi \Endpoints \Endpoint ;
12+ use FiveamCode \LaravelNotionApi \Endpoints \Database ;
13+ use FiveamCode \LaravelNotionApi \Endpoints \Databases ;
1314
1415
1516class Notion
@@ -27,17 +28,17 @@ class Notion
2728 */
2829 public function __construct (string $ version = null , string $ token = null )
2930 {
30- $ this ->endpoint = new Endpoint ();
31+ if ($ token !== null ) {
32+ $ this ->setToken ($ token );
33+ }
34+
35+ $ this ->endpoint = new Endpoint ($ this );
3136
3237 if ($ version !== null ) {
3338 $ this ->setVersion ($ version );
3439 } else {
3540 $ this ->v1 ();
3641 }
37-
38- if ($ token !== null ) {
39- $ this ->setToken ($ token );
40- }
4142 }
4243
4344 /**
@@ -96,6 +97,14 @@ public function databases(): Databases
9697 return new Databases ($ this );
9798 }
9899
100+ /**
101+ * @return Database
102+ */
103+ public function database (string $ databaseId ): Database
104+ {
105+ return new Database ($ this , $ databaseId );
106+ }
107+
99108 /**
100109 * @return Pages
101110 */
0 commit comments