title: Android repository pattern: how pass extra data to Fragment/Activity
body: <p>I read this guide: <a href="https://developer.android.com/jetpack/docs/guide" rel="nofollow noreferrer">https://developer.android.com/jetpack/docs/guide</a>
  <a href="https://i.stack.imgur.com/L3wWF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/L3wWF.png" alt="enter image description here"></a>
   and try to use repository pattern in this case:</p>
  
  <p>app via Retrofit lib make GET request to server <code>/get/user</code> and response from server may be like this (with status 200):</p>
  
  <pre><code> {
      "user": {"name" : "Jack", "id": "99"},
      "status": true
   }
  </code></pre>
  
  <p>or like this (with status 200):</p>
  
  <pre><code>{ "status": false, "message": "Some error here"}
  </code></pre>
  
  <p>or, 500 error, for example.</p>
  
  <p>My <code>UserFragment</code> should show dialog, dependent on server response: if all is ok - ok message, if status false - error message from api response, if 500 - other error message.</p>
  
  <p>My POJO model looks like this:</p>
  
  <pre><code>public class User {
    private String id;
    private String name;
    // getters and setters omitted
  }
  
  
  public class ApiResponse {
    private User user;
    private Boolean status;
    private String message;
    // getters and setters omitted
  }
  </code></pre>
  
  <p>How I should deal with it in repository pattern?</p>
  
  <ol>
  <li>Does my repository object should return User to ViewModel? If yes - how my ViewModel know about status and message fields of api response?</li>
  <li>Or my repository object should return Directly ApiResponse to ViewModel, and ViewModel got status, message and user from it and pass them to Fragment? But what if I want cache user to database? Does we need store all ApiResponse to database or we need Store only User?</li>
  <li>Or something else...?</li>
  </ol>
  
  <p>I prefer 1, because It's more clear for  me, but my problem - how deal with status and message fields, returned from server and needed to display data in Fragment.</p>