package Ġcom . example . base arch . presentation . ui . pull Request . details Ċ Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġandroidx . lifecycle . Mutable LiveData Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġandroidx . lifecycle . viewModel Scope Ċ import Ġbr . com . pe b med . domain . base . Base Error Data Ċ import Ġbr . com . pe b med . domain . base . Base Error Status Ċ import Ġbr . com . pe b med . domain . entities . PullRequest Model Ċ import Ġbr . com . pe b med . domain . use cases . Get PullRequest UseCase Ċ import Ġcom . example . base arch . presentation . extensions . load ViewState Ċ import Ġcom . example . base arch . presentation . ui . base . ViewState Ċ import Ġkotlinx . coroutines . Dispatch ers Ċ import Ġkotlinx . coroutines . launch Ċ Ċ class ĠPull Request ViewModel ( private Ġval Ġget PullRequest UseCase : ĠGet PullRequest UseCase ) Ġ: ĠViewModel () Ġ{ ĊĠĠĠ Ġprivate Ġval Ġ_ pull Request State Ġ= ĊĠĠĠĠĠĠĠ ĠMutable LiveData < ViewState < PullRequest Model , ĠBase Error Data < Base Error Status >> >() ĊĠĠĠ Ġval Ġpull Request State : ĠLive Data < ViewState < PullRequest Model , ĠBase Error Data < Base Error Status >>> ĊĠĠĠĠĠĠĠ Ġget () Ġ= Ġ_ pull Request State ĊĊĠĠĠ Ġfun Ġget PullRequest ( owner : ĠString , Ġrepo Name : ĠString , Ġpull Request Number : ĠLong ) Ġ{ ĊĠĠĠĠĠĠĠ Ġ_ pull Request State . post Value ( ViewState . Loading ()) ĊĊĠĠĠĠĠĠĠ ĠviewModel Scope . launch ( Dispatch ers . IO ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġparams Ġ= ĠGet PullRequest UseCase . Params ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġowner Ġ= Ġowner , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġrepo Name Ġ= Ġrepo Name , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġpull Request Number Ġ= Ġpull Request Number ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġresult Wrapper Ġ= Ġget PullRequest UseCase . run Async ( params ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġview State Ġ= Ġload ViewState ( result Wrapper ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ_ pull Request State . post Value ( view State ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }