@Override public Map<String, Object> finish( @Nullable Map<String, Object> parameters, @Nullable Locale locale ) { if ( parameters != null ) { params.putAll( parameters ); } filler.acceptLanguage( locale ); filler.fillInCredential( params ); if ( token != null ) { filler.authorization( token ); } HttpHeaders headers = filler.getHeaders(); return adapter.executeDownload( downloader, adaptee, resource, identifier, output, interceptor, headers, params, locale ); }
@Override public Request<T> addHeader( @Nonnull String header, @Nonnull String value ) { checkNotNull( header ); checkNotNull( value ); filler.addHeader( header, value ); return this; }
@Override public Request<T> bearer() { filler.setAuthScheme( GoogleRequestHeaders.AuthScheme.BEARER ); return this; }
@Override public T finish( @Nullable Map<String, Object> parameters, @Nullable Locale locale ) { if ( parameters != null ) { params.putAll( parameters ); } filler.acceptLanguage( locale ); if ( token != null ) { filler.authorization( token ); } return adapter.callbackExecuteDelete( adaptee, remoteRequest, identifier, resource, params, locale ); }
this.interceptor = checkNotNull( interceptor ); this.params = new HashMap<>(); this.filler = new GoogleRequestHeaders(); this.filler.contentType( type );
NewInstanceRequest( @Nonnull Class<T> resource, @Nonnull RestFacadeAdapter adapter, @Nonnull NewExecutorAdaptee adaptee, @Nullable Object remoteRequest ) { this.resource = checkNotNull( resource ); this.adapter = checkNotNull( adapter ); this.adaptee = checkNotNull( adaptee ); this.remoteRequest = remoteRequest; this.params = new HashMap<>(); this.filler = new GoogleRequestHeaders( remoteRequest ); }
public void fillInCredential( @Nullable Map<String, Object> params ) { //noinspection MismatchedQueryAndUpdateOfCollection RequestCredential credential = new RequestCredential(); credential.fillInFrom( params, false ); authorization( credential.getApiKey() ); }
@Override public T finish( @Nullable Map<String, Object> parameters, @Nullable Locale locale ) { if ( parameters != null ) { params.putAll( parameters ); } filler.acceptLanguage( locale ); if ( token != null ) { filler.authorization( token ); } return adapter.callbackExecuteInsert( adaptee, remoteRequest, resource, parentKey, params, locale ); }
ListRequest( @Nonnull Class<T> resource, @Nonnull RestFacadeAdapter adapter, @Nonnull ListExecutorAdaptee adaptee, @Nonnull Object remoteRequest ) { this.resource = checkNotNull( resource ); this.adapter = checkNotNull( adapter ); this.adaptee = checkNotNull( adaptee ); this.remoteRequest = checkNotNull( remoteRequest ); this.params = new HashMap<>(); this.filler = new GoogleRequestHeaders( remoteRequest ); }
@Override public T finish( @Nullable Map<String, Object> parameters, @Nullable Locale locale ) { if ( parameters != null ) { params.putAll( parameters ); } filler.acceptLanguage( locale ); if ( token != null ) { filler.authorization( token ); } return adapter.callbackExecuteGet( adaptee, remoteRequest, resource, identifier, params, locale ); }
@Override public Request<List<T>> addHeader( @Nonnull String header, @Nonnull String value ) { checkNotNull( header ); checkNotNull( value ); filler.addHeader( header, value ); return this; }
UpdateRequest( @Nonnull Class<T> resource, @Nonnull Object identifier, @Nonnull RestFacadeAdapter adapter, @Nonnull UpdateExecutorAdaptee adaptee, @Nonnull Object remoteRequest ) { this.resource = checkNotNull( resource ); this.identifier = checkNotNull( identifier ); this.adapter = checkNotNull( adapter ); this.adaptee = checkNotNull( adaptee ); this.remoteRequest = checkNotNull( remoteRequest ); this.params = new HashMap<>(); this.filler = new GoogleRequestHeaders( remoteRequest ); }
@Override public Request<T> oauth() { filler.setAuthScheme( GoogleRequestHeaders.AuthScheme.OAUTH ); return this; }
@Override public T finish( @Nullable Map<String, Object> parameters, @Nullable Locale locale ) { if ( parameters != null ) { params.putAll( parameters ); } filler.acceptLanguage( locale ); if ( token != null ) { filler.authorization( token ); } return adapter.callbackExecuteUpdate( adaptee, remoteRequest, resource, identifier, params, locale ); }
@Override public Request<T> addHeader( @Nonnull String header, @Nonnull String value ) { checkNotNull( header ); checkNotNull( value ); filler.addHeader( header, value ); return this; }
InsertRequest( @Nonnull Class<T> resource, @Nullable Identifier parentKey, @Nonnull RestFacadeAdapter adapter, @Nonnull InsertExecutorAdaptee adaptee, @Nonnull Object remoteRequest ) { this.resource = checkNotNull( resource ); this.parentKey = parentKey; this.adapter = checkNotNull( adapter ); this.adaptee = checkNotNull( adaptee ); this.remoteRequest = checkNotNull( remoteRequest ); this.params = new HashMap<>(); this.filler = new GoogleRequestHeaders( remoteRequest ); }
@Override public List<T> finish( @Nullable Map<String, Object> parameters, @Nullable Locale locale ) { if ( parameters != null ) { params.putAll( parameters ); } filler.acceptLanguage( locale ); if ( token != null ) { filler.authorization( token ); } return adapter.callbackExecuteList( adaptee, remoteRequest, resource, params, locale, start, length, orderBy, ascending ); }
@Override public Request<T> addHeader( @Nonnull String header, @Nonnull String value ) { checkNotNull( header ); checkNotNull( value ); filler.addHeader( header, value ); return this; }
private DeleteRequest( @Nullable Class<T> resource, @Nonnull Object identifier, @Nonnull RestFacadeAdapter adapter, @Nonnull DeleteExecutorAdaptee adaptee, @Nonnull Object remoteRequest ) { this.resource = resource; this.identifier = checkNotNull( identifier ); this.adapter = checkNotNull( adapter ); this.adaptee = checkNotNull( adaptee ); this.remoteRequest = checkNotNull( remoteRequest ); this.params = new HashMap<>(); this.filler = new GoogleRequestHeaders( remoteRequest ); }
@Override public T finish( @Nullable Map<String, Object> parameters, @Nullable Locale locale ) { if ( remoteRequest == null ) { try { return resource.newInstance(); } catch ( InstantiationException | IllegalAccessException e ) { throw new ClientErrorException( e.getMessage() ); } } if ( parameters != null ) { params.putAll( parameters ); } filler.acceptLanguage( locale ); if ( token != null ) { filler.authorization( token ); } return adapter.callbackNewInstance( adaptee, remoteRequest, resource, params, locale ); }