@@ -35,7 +35,7 @@ export default class GitHubTsClient {
3535
3636 constructor ( public client : fetchClient , public url : string ) { }
3737
38- addStar ( repositoyId ? :string ) : Promise < AddStarResult > {
38+ addStar ( repositoyId :string ) : Promise < AddStarResult > {
3939 return this . client . fetch ( this . url , {
4040 method : 'POST' ,
4141 body : JSON . stringify ( {
@@ -95,7 +95,7 @@ export default class GitHubTsClient {
9595 }
9696 } )
9797 }
98- search ( type ? :SearchType , query ? :string ) : Promise < SearchResult > {
98+ search ( type :SearchType , query :string ) : Promise < SearchResult > {
9999 return this . client . fetch ( this . url , {
100100 method : 'POST' ,
101101 body : JSON . stringify ( {
@@ -140,7 +140,7 @@ export default class GitHubTsClient {
140140 }
141141 } )
142142 }
143- usersRepositores ( login ? :string , repoCount ? :number ) : Promise < UsersRepositoresResult > {
143+ usersRepositores ( login :string , repoCount :number ) : Promise < UsersRepositoresResult > {
144144 return this . client . fetch ( this . url , {
145145 method : 'POST' ,
146146 body : JSON . stringify ( {
@@ -187,24 +187,24 @@ export default class GitHubTsClient {
187187 }
188188}
189189
190- export class StarrableResult {
191- viewerHasStarred ? :boolean ;
190+ export class AddStarResult {
191+ addStar ? :AddStarPayloadResult ;
192192
193- static fromJS ( json :any ) :StarrableResult {
193+ static fromJS ( json :any ) :AddStarResult {
194194 if ( json == null || json == undefined ) {
195195 return null ;
196196 }
197197
198- var result = new StarrableResult ( ) ;
198+ var result = new AddStarResult ( ) ;
199199
200- result . viewerHasStarred = json [ "viewerHasStarred" ] ;
200+ result . addStar = AddStarPayloadResult . fromJS ( json [ "addStar" ] ) ;
201201
202202 return result ;
203203 }
204204}
205205
206206export class AddStarPayloadResult {
207- starrable ? :StarrableResult ;
207+ starrable :StarrableResult ;
208208
209209 static fromJS ( json :any ) :AddStarPayloadResult {
210210 if ( json == null || json == undefined ) {
@@ -219,90 +219,92 @@ result.starrable= StarrableResult.fromJS(json["starrable"]);
219219 }
220220}
221221
222- export class AddStarResult {
223- addStar : AddStarPayloadResult ;
222+ export class StarrableResult {
223+ viewerHasStarred : boolean ;
224224
225- static fromJS ( json :any ) :AddStarResult {
225+ static fromJS ( json :any ) :StarrableResult {
226226 if ( json == null || json == undefined ) {
227227 return null ;
228228 }
229229
230- var result = new AddStarResult ( ) ;
230+ var result = new StarrableResult ( ) ;
231231
232- result . addStar = AddStarPayloadResult . fromJS ( json [ "addStar" ] ) ;
232+ result . viewerHasStarred = json [ "viewerHasStarred" ] ;
233233
234234 return result ;
235235 }
236236}
237237
238- export class UserResult {
239- login ? :string ;
240- bio :string ;
238+ export class CurrentUserResult {
239+ viewer :UserResult ;
241240
242- static fromJS ( json :any ) :UserResult {
241+ static fromJS ( json :any ) :CurrentUserResult {
243242 if ( json == null || json == undefined ) {
244243 return null ;
245244 }
246245
247- var result = new UserResult ( ) ;
246+ var result = new CurrentUserResult ( ) ;
248247
249- result . login = json [ "login" ] ;
250- result . bio = json [ "bio" ] ;
248+ result . viewer = UserResult . fromJS ( json [ "viewer" ] ) ;
251249
252250 return result ;
253251 }
254252}
255253
256- export class CurrentUserResult {
257- viewer ? :UserResult ;
254+ export class UserResult {
255+ login :string ;
256+ bio ? :string ;
258257
259- static fromJS ( json :any ) :CurrentUserResult {
258+ static fromJS ( json :any ) :UserResult {
260259 if ( json == null || json == undefined ) {
261260 return null ;
262261 }
263262
264- var result = new CurrentUserResult ( ) ;
263+ var result = new UserResult ( ) ;
265264
266- result . viewer = UserResult . fromJS ( json [ "viewer" ] ) ;
265+ result . login = json [ "login" ] ;
266+ result . bio = json [ "bio" ] ;
267267
268268 return result ;
269269 }
270270}
271271
272- export class User1Result {
273- login ? :string ;
272+ export class SearchResult {
273+ viewer :User1Result ;
274+ search :SearchResultItemConnectionResult ;
274275
275- static fromJS ( json :any ) :User1Result {
276+ static fromJS ( json :any ) :SearchResult {
276277 if ( json == null || json == undefined ) {
277278 return null ;
278279 }
279280
280- var result = new User1Result ( ) ;
281+ var result = new SearchResult ( ) ;
281282
282- result . login = json [ "login" ] ;
283+ result . viewer = User1Result . fromJS ( json [ "viewer" ] ) ;
284+ result . search = SearchResultItemConnectionResult . fromJS ( json [ "search" ] ) ;
283285
284286 return result ;
285287 }
286288}
287289
288- export class SearchResultItemResult {
289- __typename :string ;
290+ export class User1Result {
291+ login :string ;
290292
291- static fromJS ( json :any ) :SearchResultItemResult {
293+ static fromJS ( json :any ) :User1Result {
292294 if ( json == null || json == undefined ) {
293295 return null ;
294296 }
295297
296- var result = new SearchResultItemResult ( ) ;
298+ var result = new User1Result ( ) ;
297299
298- result . __typename = json [ "__typename " ] ;
300+ result . login = json [ "login " ] ;
299301
300302 return result ;
301303 }
302304}
303305
304306export class SearchResultItemConnectionResult {
305- nodes :Array < SearchResultItemResult > ;
307+ nodes ? :Array < SearchResultItemResult > ;
306308
307309 static fromJS ( json :any ) :SearchResultItemConnectionResult {
308310 if ( json == null || json == undefined ) {
@@ -319,95 +321,93 @@ if(json["nodes"]){
319321 }
320322}
321323
322- export class SearchResult {
323- viewer ? :User1Result ;
324- search ? :SearchResultItemConnectionResult ;
324+ export class SearchResultItemResult {
325+ __typename :string ;
325326
326- static fromJS ( json :any ) :SearchResult {
327+ static fromJS ( json :any ) :SearchResultItemResult {
327328 if ( json == null || json == undefined ) {
328329 return null ;
329330 }
330331
331- var result = new SearchResult ( ) ;
332+ var result = new SearchResultItemResult ( ) ;
332333
333- result . viewer = User1Result . fromJS ( json [ "viewer" ] ) ;
334- result . search = SearchResultItemConnectionResult . fromJS ( json [ "search" ] ) ;
334+ result . __typename = json [ "__typename" ] ;
335335
336336 return result ;
337337 }
338338}
339339
340- export class RepositoryResult {
341- id ? :string ;
342- name ? :string ;
343- updatedAt ? :Date ;
340+ export class UsersRepositoresResult {
341+ user ? :User2Result ;
344342
345- static fromJS ( json :any ) :RepositoryResult {
343+ static fromJS ( json :any ) :UsersRepositoresResult {
346344 if ( json == null || json == undefined ) {
347345 return null ;
348346 }
349347
350- var result = new RepositoryResult ( ) ;
348+ var result = new UsersRepositoresResult ( ) ;
351349
352- result . id = json [ "id" ] ;
353- result . name = json [ "name" ] ;
354- result . updatedAt = json [ "updatedAt" ] ? new Date ( json [ "updatedAt" ] ) : null ;
350+ result . user = User2Result . fromJS ( json [ "user" ] ) ;
355351
356352 return result ;
357353 }
358354}
359355
360- export class RepositoryConnectionResult {
361- nodes :Array < RepositoryResult > ;
356+ export class User2Result {
357+ login :string ;
358+ bio ? :string ;
359+ first :RepositoryConnectionResult ;
360+ last :RepositoryConnectionResult ;
362361
363- static fromJS ( json :any ) :RepositoryConnectionResult {
362+ static fromJS ( json :any ) :User2Result {
364363 if ( json == null || json == undefined ) {
365364 return null ;
366365 }
367366
368- var result = new RepositoryConnectionResult ( ) ;
367+ var result = new User2Result ( ) ;
369368
370- if ( json [ "nodes" ] ) {
371- result . nodes = json [ "nodes" ] . map ( v => RepositoryResult . fromJS ( v ) ) ;
372- }
369+ result . login = json [ "login" ] ;
370+ result . bio = json [ "bio" ] ;
371+ result . first = RepositoryConnectionResult . fromJS ( json [ "first" ] ) ;
372+ result . last = RepositoryConnectionResult . fromJS ( json [ "last" ] ) ;
373373
374374 return result ;
375375 }
376376}
377377
378- export class User2Result {
379- login ? :string ;
380- bio :string ;
381- first ? :RepositoryConnectionResult ;
382- last ? :RepositoryConnectionResult ;
378+ export class RepositoryConnectionResult {
379+ nodes ? :Array < RepositoryResult > ;
383380
384- static fromJS ( json :any ) :User2Result {
381+ static fromJS ( json :any ) :RepositoryConnectionResult {
385382 if ( json == null || json == undefined ) {
386383 return null ;
387384 }
388385
389- var result = new User2Result ( ) ;
386+ var result = new RepositoryConnectionResult ( ) ;
390387
391- result . login = json [ "login" ] ;
392- result . bio = json [ "bio" ] ;
393- result . first = RepositoryConnectionResult . fromJS ( json [ "first" ] ) ;
394- result . last = RepositoryConnectionResult . fromJS ( json [ "last" ] ) ;
388+ if ( json [ "nodes" ] ) {
389+ result . nodes = json [ "nodes" ] . map ( v => RepositoryResult . fromJS ( v ) ) ;
390+ }
395391
396392 return result ;
397393 }
398394}
399395
400- export class UsersRepositoresResult {
401- user :User2Result ;
396+ export class RepositoryResult {
397+ id :string ;
398+ name :string ;
399+ updatedAt :Date ;
402400
403- static fromJS ( json :any ) :UsersRepositoresResult {
401+ static fromJS ( json :any ) :RepositoryResult {
404402 if ( json == null || json == undefined ) {
405403 return null ;
406404 }
407405
408- var result = new UsersRepositoresResult ( ) ;
406+ var result = new RepositoryResult ( ) ;
409407
410- result . user = User2Result . fromJS ( json [ "user" ] ) ;
408+ result . id = json [ "id" ] ;
409+ result . name = json [ "name" ] ;
410+ result . updatedAt = json [ "updatedAt" ] ? new Date ( json [ "updatedAt" ] ) : null ;
411411
412412 return result ;
413413 }
0 commit comments