1616
1717public class PeopleUtils {
1818
19- public static void fetchUsers (final String siteID , final int localTableBlogId , final FetchUsersCallback callback ) {
19+ public static void fetchUsers (final String blogId , final int localTableBlogId , final FetchUsersCallback callback ) {
2020 com .wordpress .rest .RestRequest .Listener listener = new RestRequest .Listener () {
2121 @ Override
2222 public void onResponse (JSONObject jsonObject ) {
2323 if (jsonObject != null && callback != null ) {
2424 try {
2525 JSONArray jsonArray = jsonObject .getJSONArray ("users" );
26- List <Person > people = peopleListFromJSON (jsonArray , siteID , localTableBlogId );
26+ List <Person > people = peopleListFromJSON (jsonArray , blogId , localTableBlogId );
2727 callback .onSuccess (people );
2828 }
2929 catch (JSONException e ) {
@@ -44,18 +44,18 @@ public void onErrorResponse(VolleyError volleyError) {
4444 }
4545 };
4646
47- String path = String .format ("sites/%s/users" , siteID );
47+ String path = String .format ("sites/%s/users" , blogId );
4848 WordPress .getRestClientUtilsV1_1 ().get (path , listener , errorListener );
4949 }
5050
51- public static void updateRole (final String siteID , String userID , String newRole , final int localTableBlogId ,
51+ public static void updateRole (final String blogId , String userID , String newRole , final int localTableBlogId ,
5252 final UpdateUserCallback callback ) {
5353 com .wordpress .rest .RestRequest .Listener listener = new RestRequest .Listener () {
5454 @ Override
5555 public void onResponse (JSONObject jsonObject ) {
5656 if (jsonObject != null && callback != null ) {
5757 try {
58- Person person = Person .fromJSON (jsonObject , siteID , localTableBlogId );
58+ Person person = Person .fromJSON (jsonObject , blogId , localTableBlogId );
5959 if (person != null ) {
6060 callback .onSuccess (person );
6161 } else {
@@ -85,7 +85,7 @@ public void onErrorResponse(VolleyError volleyError) {
8585 roles .put (newRole );
8686 jsonObject .put ("roles" , roles );
8787
88- String path = String .format ("sites/%s/users/%s" , siteID , userID );
88+ String path = String .format ("sites/%s/users/%s" , blogId , userID );
8989 WordPress .getRestClientUtilsV1_1 ().post (path , jsonObject , null , listener , errorListener );
9090 } catch (JSONException e ) {
9191 if (callback != null ) {
@@ -94,7 +94,7 @@ public void onErrorResponse(VolleyError volleyError) {
9494 }
9595 }
9696
97- private static List <Person > peopleListFromJSON (JSONArray jsonArray , String siteID , int localTableBlogId )
97+ private static List <Person > peopleListFromJSON (JSONArray jsonArray , String blogId , int localTableBlogId )
9898 throws JSONException {
9999 if (jsonArray == null ) {
100100 return null ;
@@ -103,7 +103,7 @@ private static List<Person> peopleListFromJSON(JSONArray jsonArray, String siteI
103103 ArrayList <Person > peopleList = new ArrayList <>(jsonArray .length ());
104104
105105 for (int i = 0 ; i < jsonArray .length (); i ++) {
106- Person person = Person .fromJSON (jsonArray .optJSONObject (i ), siteID , localTableBlogId );
106+ Person person = Person .fromJSON (jsonArray .optJSONObject (i ), blogId , localTableBlogId );
107107 if (person != null ) {
108108 peopleList .add (person );
109109 }
0 commit comments