Skip to content

Librari/RxParse

 
 

Repository files navigation

RxParse

rxparse.png

Join the chat at https://gitter.im/yongjhih/RxParse JitPack Download Bountysource Build Status

Usage

find

Before:

ParseUser.getQuery().findInBackground(new FindCallback() {
    @Override
    public done(ParseUser user, ParseException e) {
        if (e == null) System.out.println(user));
    }
});

After:

Observable<ParseUser> users = ParseObservable.from(ParseUser.class).find();
users.subscribe(user -> System.out.println(user.getObjectId()));
Observable<ParseUser> users = ParseObservable.from(ParseUser.class).find(ParseUser.getQuery().setLimit(1000));

count

Before:

ParseUser.getQuery().countInBackground(new CountCallback() {
    @Override
    public done(int count, ParseException e) {
        if (e == null) System.out.println(count));
    }
});

After:

Observable<Integer> count = ParseObservable.from(ParseUser.class).count();
count.subscirbe(c -> System.out.println(c));

loginWithFacebook

Observable<ParseUser> loginUser = ParseObservable.loginWithFacebook(activity);

fetchIfNeeded

Before:

ParseUser.getQuery().fetchIfNeededInBackground(new GetCallback() {
    @Override
    public done(ParseUser user, ParseException e) {
        if (e == null) System.out.println(user));
    }
});

After:

ParseObservable.fetchIfNeeded(user)
    .subscribe(user -> System.out.println(user));

pin

Before:

user.pinInBackground(new SaveCallback() {
    @Override
    public done(ParseException e) {
        // ...
    }
});

After:

ParseObservable.pin(user)
    .subscribe(user -> System.out.println(user));

pin List

Before:

ParseObject.pinAllInBackground(users, new SaveCallback() {
    @Override
    public done(ParseException e) {
        // ...
    }
});

After:

ParseObservable.pin(users)
    .subscribe(user -> System.out.println(user));

save

Before:

user.saveInBackground(new SaveCallback() {
    @Override
    public done(ParseException e) {
        // ...
    }
});

After:

ParseObservable.save(user)
    .subscribe(user -> System.out.println(user));

Installation

via jcenter

repositories {
    jcenter()
}

dependencies {
    compile 'com.infstory:rxparse:1.0.0'
}

Or via jitpack.io

repositories {
    maven {
        url "https://jitpack.io"
    }
}

dependencies {
    compile 'com.github.yongjhih:rxparse:1.0.0'
}

LICENSE

Copyright 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.

Packages

No packages published

Languages

  • Java 96.0%
  • Shell 4.0%