Ejemplo n.º 1
0
    private void GetUser(int userId)
    {
        IDisposable query = ObservableWWW
                            .Get(endpoint.GetEndpointGetUser(userId))
                            .DelaySubscription(System.DateTimeOffset.Now.Add(TimeSpan.FromSeconds(callDelay)))
//			.CatchIgnore((WWWErrorException error) =>
//				LogUtil.PrintWarning(GetType(), "GetUser() CATCH IGNORE " + error.Message))
                            .Subscribe(
            userString => {
            GetSingleUserResponse userObject =
                networkHelper.ConvertStringToJsonObject <GetSingleUserResponse>(userString);

            LogUtil.PrintInfo(GetType(), "GetUser() the user is: "
                              + userObject.data.first_name + " " + userObject.data.last_name +
                              " with ID: " + userObject.data.id + " & avatar " + userObject.data.avatar);
        },
            error => LogUtil.PrintWarning(GetType(), "GetUser() " + error.Message)
            );

        compositeDisposable.Add(query);
    }