/*
 * Copyright (C) 2015 8tory, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package retrofacebook;

import rx.Observable;
import rx.functions.*;

@RetroFacebook
public abstract class Facebook {
  @RetroFacebook.GET("/{postId}")
  public abstract Observable<Post> getPost(@RetroFacebook.Path String postId);

  // TODO @RetroFacebook.GET("/{userId}/photos?type=uploaded")
  @RetroFacebook.GET("/{userId}/photos")
  public abstract Observable<Photo> getPhotos(@RetroFacebook.Path String userId);

  public Observable<Photo> getPhotos() {
      return getPhotos("me");
  }

  @RetroFacebook.GET("/{userId}/feed")
  public abstract Observable<Post> getPosts(@RetroFacebook.Path String userId);

  public Observable<Post> getPosts() {
      return getPosts("me");
  }

  @RetroFacebook.GET("/{userId}/friends")
  public abstract Observable<User> getFriends(@RetroFacebook.Path String userId);

  public Observable<User> getFriends() {
      return getFriends("me");
  }

  public static Facebook create() {
      return new RetroFacebook_Facebook();
  }
}

@@ -648,19 +648,234 @@
  rx.
-functions.*
+Subscriber;%0A%0Aimport rx.functions.*;%0A%0Aimport com.facebook.*;%0Aimport com.facebook.login.*;%0A%0Aimport android.content.Intent;%0Aimport android.app.Activity;%0A%0Aimport java.util.Collection;%0Aimport java.util.List;%0Aimport java.util.Arrays
 ;%0A%0A@
@@ -1725,24 +1725,24 @@
  create() %7B%0A
-
       return
@@ -1775,11 +1775,1718 @@
 k();%0A  %7D
+%0A%0A  CallbackManager callbackManager;%0A  Activity activity;%0A%0A  public Facebook initialize(Activity activity) %7B%0A      this.activity = activity;%0A%0A      FacebookSdk.sdkInitialize(activity.getApplicationContext());%0A      callbackManager = CallbackManager.Factory.create();%0A%0A      return this;%0A  %7D%0A%0A  public static Facebook create(Activity activity) %7B%0A      return create().initialize(activity);%0A  %7D%0A%0A  public Observable%3CLoginResult%3E logIn() %7B%0A      return logInWithReadPermissions(Arrays.asList(%22public_profile%22, %22user_friends%22, %22user_photos%22, %22user_posts%22));%0A  %7D%0A%0A  public Observable%3CLoginResult%3E logInWithReadPermissions(final Collection%3CString%3E permissions) %7B%0A      return Observable.create(new Observable.OnSubscribe%3CLoginResult%3E() %7B%0A          @Override public void call(final Subscriber%3C? super LoginResult%3E sub) %7B%0A              LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback%3CLoginResult%3E() %7B%0A                  @Override%0A                  public void onSuccess(LoginResult loginResult) %7B%0A                      sub.onNext(loginResult);%0A                      sub.onCompleted();%0A                  %7D%0A%0A                  @Override%0A                  public void onCancel() %7B%0A                      sub.onCompleted();%0A                  %7D%0A%0A                  @Override%0A                  public void onError(FacebookException error) %7B%0A                      sub.onError(error);%0A                  %7D%0A              %7D);%0A              LoginManager.getInstance().logInWithReadPermissions(activity, permissions);%0A          %7D%0A      %7D);%0A  %7D%0A%0A  public void onActivityResult(int requestCode, int resultCode, Intent data) %7B%0A      callbackManager.onActivityResult(requestCode, resultCode, data);%0A  %7D
 %0A%7D%0A

Add logIn() and onActivityResult() for session needed api