Interface UserProvider



  • public interface UserProvider

    Setting tags and fields on a user are features. Your plan must support these features in order to work with them.

    A provider which will offer a higher level of abstraction compared to the UserService
    You can create an instance of UserProvider like this:

          import com.zendesk.sdk.network.UserProvider;
          import com.zendesk.sdk.network.impl.ZendeskConfig;
          ...
          UserProvider provider = ZendeskConfig.INSTANCE.provider().userProvider();
          ...
     

    Once you have an instance of the provider you can call methods on it and handle the results in callbacks. A success callback will give you the resource(s) that you are requesting. The error callback will be called if there was some issue with the method call and it will define details about the error in an ErrorResponse

    For example you can upload a file like this:
    
       provider.addTags(Arrays.asList("tag", "foo", "bar"), new ZendeskCallback<User>() {
           @Override
          public void onSuccess(final User user) {
              // Handle success
          }
    
           @Override
          public void onError(final ErrorResponse errorResponse) {
              // Handle error
          }
       });
    
     
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      void addTags(java.util.List<java.lang.String> tags, <any> callback)
      Calls a user service to add tags to a user on behalf of the end-user.
      void deleteTags(java.util.List<java.lang.String> tags, <any> callback)
      Calls a user service to remove tags from a user on behalf of the end-user.
      void getUser(<any> callback)
      Calls a user service to get information about the current logged in user.
      void getUserFields(<any> callback)
      Calls a user service to get list of user field definitions.
      void setUserFields(java.util.Map<java.lang.String,java.lang.String> userFields, <any> callback)
      Calls a user service to set user fields.
    • Method Detail

      • addTags

        void addTags(java.util.List<java.lang.String> tags,
                     <any> callback)
        Calls a user service to add tags to a user on behalf of the end-user.
        Parameters:
        tags - A list of tags.
        callback - Callback that will deliver the list of the user's tags after the call or an ErrorResponse
        Since:
        1.4.0.1
      • deleteTags

        void deleteTags(java.util.List<java.lang.String> tags,
                        <any> callback)
        Calls a user service to remove tags from a user on behalf of the end-user.
        Parameters:
        tags - A list of tags
        callback - Callback that will deliver the list of the user's tags after the call or an ErrorResponse
      • getUserFields

        void getUserFields(<any> callback)
        Calls a user service to get list of user field definitions.
        Parameters:
        callback - Callback that will deliver a newly created list containing UserField or ErrorResponse
        Since:
        1.4.0.1
      • setUserFields

        void setUserFields(java.util.Map<java.lang.String,java.lang.String> userFields,
                           <any> callback)
        Calls a user service to set user fields.
        Parameters:
        userFields - A map containing the fields to be set.
        callback - Callback that will deliver the map of the user's fields and their values after the call or an ErrorResponse
        Since:
        1.4.0.1
      • getUser

        void getUser(<any> callback)
        Calls a user service to get information about the current logged in user.

        The User object which is returned from this method's callback only contains the user's tags and fields at this time.

        Parameters:
        callback - Callback that will deliver a newly created request of type User or ErrorResponse
        Since:
        1.4.0.1