package Ġcom . ap ol log raph ql . apollo . kotlin sample . data Ċ Ċ import Ġcom . ap ol log raph ql . apollo . A pol lo Client Ċ import Ġcom . ap ol log raph ql . apollo . api . Response Ċ import Ġcom . ap ol log raph ql . apollo . kotlin sample . Github Repositories Query Ċ import Ġcom . ap ol log raph ql . apollo . kotlin sample . Github Repository Commits Query Ċ import Ġcom . ap ol log raph ql . apollo . kotlin sample . Github Repository Detail Query Ċ import Ġcom . ap ol log raph ql . apollo . kotlin sample . fragment . Repository Fragment Ċ import Ġio . reactivex . Observable Ċ import Ġio . reactivex . subjects . Publish Subject Ċ Ċ /** Ċ Ġ* ĠThis Ġis Ġa Ġbase Ġclass Ġdefining Ġthe Ġrequired Ġbehavior Ġfor Ġa Ġdata Ġsource Ġof ĠGitHub Ġinformation . ĠWe Ġdon 't Ġcare Ġif Ġthat Ġdata Ċ Ġ* Ġis Ġfetched Ġvia ĠRx Java , Ġcor outines , Ġetc . ĠAny Ġimplementations Ġof Ġthis Ġcan Ġfetch Ġdata Ġhowever Ġthey Ġwant , Ġand Ġpost Ġthat Ġresult Ċ Ġ* Ġto Ġthe Ġpublic ĠObservable s Ġthat Ġactivities Ġcan Ġsubscribe Ġto Ġfor Ġinformation . Ċ Ġ*/ Ċ abstract Ġclass Ġ ĠGitHub DataSource ( protected Ġval Ġap ollo Client : ĠApollo Client ) Ġ{ ĊĠ Ġprotected Ġval Ġrepositories Subject : ĠPublish Subject < List < Repository Fragment >> Ġ= ĠPublish Subject . create () ĊĠ Ġprotected Ġval Ġrepository Detail Subject : ĠPublish Subject < Response < Github Repository Detail Query . Data >> Ġ= ĠPublish Subject . create () ĊĠ Ġprotected Ġval Ġcommits Subject : ĠPublish Subject < List < Github Repository Commits Query . Edge >> Ġ= ĠPublish Subject . create () ĊĠ Ġprotected Ġval Ġexception Subject : ĠPublish Subject < Throwable > Ġ= ĠPublish Subject . create () ĊĊĠ Ġval Ġrepositories : ĠObservable < List < Repository Fragment >> Ġ= Ġrepositories Subject . hide () ĊĠ Ġval Ġrepository Detail : ĠObservable < Response < Github Repository Detail Query . Data >> Ġ= Ġrepository Detail Subject . hide () ĊĠ Ġval Ġcommits : ĠObservable < List < Github Repository Commits Query . Edge >> Ġ= Ġcommits Subject . hide () ĊĠ Ġval Ġerror : ĠObservable < Throwable > Ġ= Ġexception Subject . hide () ĊĊĠ Ġabstract Ġfun Ġfetch Repositories () ĊĠ Ġabstract Ġfun Ġfetch Repository Detail ( repository Name : ĠString ) ĊĠ Ġabstract Ġfun Ġfetch Commits ( repository Name : ĠString ) ĊĠ Ġabstract Ġfun Ġcancel Fetching () ĊĊĠ Ġprotected Ġfun Ġmap Repositories Response To Repositories ( response : ĠResponse < Github Repositories Query . Data >): ĠList < Repository Fragment > Ġ{ ĊĠĠĠ Ġreturn Ġresponse . data ?. viewer ()?. repositories ()?. nodes ()?. map Ġ{ Ġit . fragments (). repository Fragment () Ġ} Ġ?: Ġempty List () ĊĠ Ġ} Ċ } Ċ