This repository was archived by the owner on Jul 21, 2020. It is now read-only.
Description I have a issue with updating the title, I can get the BeamChannel using
Futures .addCallback (beam .use (ChannelsService .class ).findOne (beamUser .channel .id ), new ResponseHandler <BeamChannel >() {
but how do i update the title/name and push it back again?
Ive tried to change the name by:
beamChannel .name = "Maybe API is working?" ;
Futures .addCallback (beam .use (ChannelsService .class ).update (beamChannel ), new ResponseHandler <BeamChannel >() {
I get this error:
aug 18 , 2016 1 :29 :55 PM com .google .common .util .concurrent .ExecutionList executeListener
SEVERE : RuntimeException while executing runnable com .google .common .util .concurrent .Futures$5 @ 120d b25 with executor com .google .common .util .concurrent .MoreExecutors$SameThreadExecutorService @ 73 c6c8da
java .lang .NullPointerException : null value in entry : streamKey =null
at com .google .common .collect .CollectPreconditions .checkEntryNotNull (CollectPreconditions .java :33 )
Code
package com .ostsoft .stream .beam ;
import com .google .common .util .concurrent .Futures ;
import pro .beam .api .BeamAPI ;
import pro .beam .api .resource .BeamUser ;
import pro .beam .api .resource .channel .BeamChannel ;
import pro .beam .api .services .impl .ChannelsService ;
import pro .beam .api .services .impl .UsersService ;
import pro .beam .api .util .ResponseHandler ;
import java .net .URI ;
public class TestBeam {
public static void main (String [] args ) throws InterruptedException {
new TestBeam ("YourUsername" , "YourPassword" );
}
private BeamAPI beam ;
private TestBeam (String username , String password ) {
beam = new BeamAPI (URI .create ("https://beam.pro/api/v1/" ), username , password );
Futures .addCallback (beam .use (UsersService .class ).login (username , password ), new ResponseHandler <BeamUser >() {
@ Override
public void onSuccess (BeamUser beamUser ) {
Futures .addCallback (beam .use (ChannelsService .class ).findOne (beamUser .channel .id ), new ResponseHandler <BeamChannel >() {
@ Override
public void onSuccess (BeamChannel beamChannel ) {
beamChannel .name = "Maybe API is working?" ;
Futures .addCallback (beam .use (ChannelsService .class ).update (beamChannel ), new ResponseHandler <BeamChannel >() {
@ Override
public void onSuccess (BeamChannel beamChannel ) {
System .out .println (beamChannel .name );
}
});
}
});
}
});
}
}
Complete stacktrace
aug 18 , 2016 2 :25 :44 PM com .google .common .util .concurrent .ExecutionList executeListener
SEVERE : RuntimeException while executing runnable com .google .common .util .concurrent .Futures$5 @ 767 c3401 with executor com .google .common .util .concurrent .MoreExecutors$SameThreadExecutorService @ 316 aba68
java .lang .NullPointerException : null value in entry : streamKey =null
at com .google .common .collect .CollectPreconditions .checkEntryNotNull (CollectPreconditions .java :33 )
at com .google .common .collect .ImmutableMap .entryOf (ImmutableMap .java :135 )
at com .google .common .collect .ImmutableMap$Builder .put (ImmutableMap .java :206 )
at pro .beam .api .services .impl .ChannelsService .update (ChannelsService .java :106 )
at com .ostsoft .stream .beam .TestBeam$1$1 .onSuccess (TestBeam .java :30 )
at com .ostsoft .stream .beam .TestBeam$1$1 .onSuccess (TestBeam .java :26 )
at com .google .common .util .concurrent .Futures$5 .run (Futures .java :1231 )
at com .google .common .util .concurrent .MoreExecutors$SameThreadExecutorService .execute (MoreExecutors .java :297 )
at com .google .common .util .concurrent .ExecutionList .executeListener (ExecutionList .java :156 )
at com .google .common .util .concurrent .ExecutionList .execute (ExecutionList .java :145 )
at com .google .common .util .concurrent .ListenableFutureTask .done (ListenableFutureTask .java :91 )
at java .util .concurrent .FutureTask .finishCompletion (FutureTask .java :384 )
at java .util .concurrent .FutureTask .set (FutureTask .java :233 )
at java .util .concurrent .FutureTask .run (FutureTask .java :274 )
at java .util .concurrent .ThreadPoolExecutor .runWorker (ThreadPoolExecutor .java :1142 )
at java .util .concurrent .ThreadPoolExecutor$Worker .run (ThreadPoolExecutor .java :617 )
at java .lang .Thread .run (Thread .java :745 )Reactions are currently unavailable
I have a issue with updating the title, I can get the BeamChannel using
but how do i update the title/name and push it back again?
Ive tried to change the name by:
I get this error:
Code
Complete stacktrace