File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 161161 } else {
162162 $ info = 'Github/GithubClient testApi1 (reading github public repos) failed ' ;
163163 }
164+ $ result = $ client ->testUserRepositories ();
165+ if ($ result ) {
166+ $ info .= '<br>Github/GithubClient testUserRepositories (reading github repos of primary setting) successfully finished ' ;
167+ } else {
168+ $ info .= '<br>Github/GithubClient testUserRepositories (reading github repos of primary setting) failed ' ;
169+ }
170+
164171 $ GLOBALS ['xoopsTpl ' ]->assign ('info1 ' , $ info );
165172 break ;
166173}
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ class GithubClient extends Api
4040 /**
4141 * @var string
4242 */
43- // public $userAuth = 'myusername';
43+ public $ userAuth = 'myusername ' ;
4444
4545 /**
4646 * @var string
@@ -107,6 +107,18 @@ public function testApi2($url) {
107107 return $ data ;
108108 }
109109
110+ /**
111+ * Get repositories of given user
112+ *
113+ * @return array|bool
114+ */
115+ public function testUserRepositories ()
116+ {
117+ $ url = static ::BASE_URL . 'users/ ' . \rawurlencode ($ this ->userAuth ) . '/repos?per_page=1&page=1 ' ;
118+
119+ return $ this ->_get ($ url );
120+ }
121+
110122 /**
111123 * Get repositories of given user
112124 *
@@ -343,7 +355,7 @@ private function getSetting()
343355 if (0 == \count ($ setting )) {
344356 \redirect_header (\XOOPS_URL . '/index.php ' , 3 , \_AM_WGGITHUB_THEREARENT_SETTINGS );
345357 }
346- // $this->userAuth = $setting['user'];
358+ $ this ->userAuth = $ setting ['user ' ];
347359 $ this ->tokenAuth = $ setting ['token ' ];
348360
349361 return true ;
Original file line number Diff line number Diff line change @@ -149,6 +149,12 @@ class JsonException extends RuntimeException
149149 class BadResponseException extends Github \RuntimeException
150150 {}
151151
152+ /**
153+ * HTTP response is somehow wrong and cannot be processed.
154+ */
155+ class RateLimitExceedException extends Github \RuntimeException
156+ {}
157+
152158}
153159
154160
Original file line number Diff line number Diff line change 66 - permanent display of filter with enabled/disabled buttons (alain01/goffy)
77 - added new bt4 templates (alain01/goffy)
88 - fixed bug with wrong icon and link (alain01/goffy)
9+ - added extended test of API connection (goffy)
910
1011===================================================================
11122021/03/31 Version 1.03 Final
You can’t perform that action at this time.
0 commit comments