Skip to content

Commit 97b015e

Browse files
committed
Implement remaining overloads on AndroidServiceClient
1 parent 6aaffbf commit 97b015e

File tree

3 files changed

+227
-6
lines changed

3 files changed

+227
-6
lines changed

src/AndroidClient/android/src/main/java/net/servicestack/android/AndroidServiceClient.java

Lines changed: 163 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,16 @@ protected void onPostExecute(T response) {
8686
}, request);
8787
}
8888

89+
@Override
90+
public <T> void sendAsync(IReturn<T> request, AsyncSuccess<T> success) {
91+
sendAsync(request, success, null);
92+
}
93+
94+
@Override
95+
public <T> void sendAsync(IReturn<T> request, AsyncSuccess<T> success, AsyncError error) {
96+
sendAsync(request, createAsyncResult(success, error));
97+
}
98+
8999
@Override
90100
public void sendAsync(IReturnVoid request, final AsyncResultVoid asyncResult) {
91101
final AndroidServiceClient client = this;
@@ -108,7 +118,18 @@ protected void onPostExecute(Void noResponse) {
108118
}, request);
109119
}
110120

121+
@Override
122+
public void sendAsync(IReturnVoid request, AsyncSuccessVoid success) {
123+
sendAsync(request, success, null);
124+
}
125+
126+
@Override
127+
public void sendAsync(IReturnVoid request, AsyncSuccessVoid success, AsyncError error) {
128+
sendAsync(request, createAsyncResultVoid(success, error));
129+
}
130+
111131
/* GET */
132+
@Override
112133
public <T> void getAsync(IReturn<T> request, final AsyncResult<T> asyncResult){
113134
final AndroidServiceClient client = this;
114135
execTask(new AsyncTask<IReturn<T>, Void, T>() {
@@ -130,10 +151,12 @@ protected void onPostExecute(T response) {
130151
}, request);
131152
}
132153

154+
@Override
133155
public <T> void getAsync(IReturn<T> request, final AsyncSuccess<T> successCallback) {
134156
getAsync(request, successCallback, null);
135157
}
136158

159+
@Override
137160
public <T> void getAsync(IReturn<T> request, final AsyncSuccess<T> success, final AsyncError error){
138161
getAsync(request, createAsyncResult(success, error));
139162
}
@@ -161,15 +184,16 @@ protected void onPostExecute(Void noResponse) {
161184
}
162185

163186
@Override
164-
public <T> void getAsync(IReturnVoid request, final AsyncSuccessVoid success) {
187+
public void getAsync(IReturnVoid request, final AsyncSuccessVoid success) {
165188
getAsync(request, success, null);
166189
}
167190

168191
@Override
169-
public <T> void getAsync(IReturnVoid request, AsyncSuccessVoid success, AsyncError error) {
192+
public void getAsync(IReturnVoid request, final AsyncSuccessVoid success, final AsyncError error) {
170193
getAsync(request, createAsyncResultVoid(success, error));
171194
}
172195

196+
@Override
173197
public <T> void getAsync(IReturn<T> request, final Map<String, String> queryParams, final AsyncResult<T> asyncResult){
174198
final AndroidServiceClient client = this;
175199
execTask(new AsyncTask<IReturn<T>, Void, T>() {
@@ -196,6 +220,7 @@ public <T> void getAsync(IReturn<T> request, Map<String, String> queryParams, As
196220
getAsync(request, queryParams, createAsyncResult(success, null));
197221
}
198222

223+
@Override
199224
public <T> void getAsync(String path, final Class responseType, final AsyncResult<T> asyncResult) {
200225
final AndroidServiceClient client = this;
201226
execTask(new AsyncTask<String, Void, T>() {
@@ -249,6 +274,7 @@ public <T> void getAsync(String path, Type responseType, AsyncSuccess<T> success
249274
getAsync(path, responseType, createAsyncResult(success, null));
250275
}
251276

277+
@Override
252278
public void getAsync(String path, final AsyncResult<byte[]> asyncResult) {
253279
final AndroidServiceClient client = this;
254280
execTask(new AsyncTask<String, Void, byte[]>() {
@@ -299,6 +325,16 @@ protected void onPostExecute(T response) {
299325
}, request);
300326
}
301327

328+
@Override
329+
public <T> void postAsync(IReturn<T> request, AsyncSuccess<T> success) {
330+
postAsync(request, success, null);
331+
}
332+
333+
@Override
334+
public <T> void postAsync(IReturn<T> request, AsyncSuccess<T> success, AsyncError error) {
335+
postAsync(request, createAsyncResult(success, error));
336+
}
337+
302338
@Override
303339
public void postAsync(IReturnVoid request, final AsyncResultVoid asyncResult) {
304340
final AndroidServiceClient client = this;
@@ -321,6 +357,16 @@ protected void onPostExecute(Void noResponse) {
321357
}, request);
322358
}
323359

360+
@Override
361+
public void postAsync(IReturnVoid request, AsyncSuccessVoid success) {
362+
postAsync(request, success, null);
363+
}
364+
365+
@Override
366+
public void postAsync(IReturnVoid request, AsyncSuccessVoid success, AsyncError error) {
367+
postAsync(request, createAsyncResultVoid(success, error));
368+
}
369+
324370
@Override
325371
public <T> void postAsync(String path, final Object request, final Class responseType, final AsyncResult<T> asyncResult) {
326372
final AndroidServiceClient client = this;
@@ -343,6 +389,11 @@ protected void onPostExecute(T response) {
343389
}, path);
344390
}
345391

392+
@Override
393+
public <T> void postAsync(String path, Object request, Class responseType, AsyncSuccess<T> success) {
394+
postAsync(path, request, responseType, createAsyncResult(success, null));
395+
}
396+
346397
@Override
347398
public <T> void postAsync(String path, final Object request, final Type responseType, final AsyncResult<T> asyncResult) {
348399
final AndroidServiceClient client = this;
@@ -365,6 +416,11 @@ protected void onPostExecute(T response) {
365416
}, path);
366417
}
367418

419+
@Override
420+
public <T> void postAsync(String path, Object request, Type responseType, AsyncSuccess<T> success) {
421+
postAsync(path, request, responseType, createAsyncResult(success, null));
422+
}
423+
368424
@Override
369425
public <T> void postAsync(String path, final byte[] requestBody, final String contentType, final Class responseType, final AsyncResult<T> asyncResult) {
370426
final AndroidServiceClient client = this;
@@ -387,6 +443,11 @@ protected void onPostExecute(T response) {
387443
}, path);
388444
}
389445

446+
@Override
447+
public <T> void postAsync(String path, byte[] requestBody, String contentType, Class responseType, AsyncSuccess<T> success) {
448+
postAsync(path, requestBody, contentType, responseType, createAsyncResult(success, null));
449+
}
450+
390451
@Override
391452
public <T> void postAsync(String path, final byte[] requestBody, final String contentType, final Type responseType, final AsyncResult<T> asyncResult) {
392453
final AndroidServiceClient client = this;
@@ -409,6 +470,11 @@ protected void onPostExecute(T response) {
409470
}, path);
410471
}
411472

473+
@Override
474+
public <T> void postAsync(String path, byte[] requestBody, String contentType, Type responseType, AsyncSuccess<T> success) {
475+
postAsync(path, requestBody, contentType, responseType, createAsyncResult(success, null));
476+
}
477+
412478
@Override
413479
public void postAsync(String path, final byte[] requestBody, final String contentType, final AsyncResult<byte[]> asyncResult) {
414480
final AndroidServiceClient client = this;
@@ -432,6 +498,11 @@ protected void onPostExecute(byte[] bytes) {
432498
}, path);
433499
}
434500

501+
@Override
502+
public void postAsync(String path, byte[] requestBody, String contentType, AsyncSuccess<byte[]> success) {
503+
postAsync(path, requestBody, contentType, createAsyncResult(success, null));
504+
}
505+
435506
/* PUT */
436507

437508
@Override
@@ -456,6 +527,17 @@ protected void onPostExecute(T response) {
456527
}, request);
457528
}
458529

530+
@Override
531+
public <T> void putAsync(IReturn<T> request, AsyncSuccess<T> success) {
532+
putAsync(request, success, null);
533+
}
534+
535+
@Override
536+
public <T> void putAsync(IReturn<T> request, AsyncSuccess<T> success, AsyncError error) {
537+
putAsync(request, createAsyncResult(success, error));
538+
539+
}
540+
459541
@Override
460542
public void putAsync(IReturnVoid request, final AsyncResultVoid asyncResult) {
461543
final AndroidServiceClient client = this;
@@ -478,6 +560,16 @@ protected void onPostExecute(Void noResponse) {
478560
}, request);
479561
}
480562

563+
@Override
564+
public void putAsync(IReturnVoid request, AsyncSuccessVoid success) {
565+
putAsync(request, success, null);
566+
}
567+
568+
@Override
569+
public void putAsync(IReturnVoid request, AsyncSuccessVoid success, AsyncError error) {
570+
putAsync(request, createAsyncResultVoid(success, error));
571+
}
572+
481573
@Override
482574
public <T> void putAsync(String path, final Object request, final Class responseType, final AsyncResult<T> asyncResult) {
483575
final AndroidServiceClient client = this;
@@ -500,6 +592,11 @@ protected void onPostExecute(T response) {
500592
}, path);
501593
}
502594

595+
@Override
596+
public <T> void putAsync(String path, Object request, Class responseType, AsyncSuccess<T> success) {
597+
putAsync(path, request, responseType, createAsyncResult(success, null));
598+
}
599+
503600
@Override
504601
public <T> void putAsync(String path, final Object request, final Type responseType, final AsyncResult<T> asyncResult) {
505602
final AndroidServiceClient client = this;
@@ -522,6 +619,11 @@ protected void onPostExecute(T response) {
522619
}, path);
523620
}
524621

622+
@Override
623+
public <T> void putAsync(String path, Object request, Type responseType, AsyncSuccess<T> success) {
624+
putAsync(path, request, responseType, createAsyncResult(success, null));
625+
}
626+
525627
@Override
526628
public <T> void putAsync(String path, final byte[] requestBody, final String contentType, final Class responseType, final AsyncResult<T> asyncResult) {
527629
final AndroidServiceClient client = this;
@@ -544,6 +646,11 @@ protected void onPostExecute(T response) {
544646
}, path);
545647
}
546648

649+
@Override
650+
public <T> void putAsync(String path, byte[] requestBody, String contentType, Class responseType, AsyncSuccess<T> success) {
651+
putAsync(path, requestBody, contentType, responseType, createAsyncResult(success, null));
652+
}
653+
547654
@Override
548655
public <T> void putAsync(String path, final byte[] requestBody, final String contentType, final Type responseType, final AsyncResult<T> asyncResult) {
549656
final AndroidServiceClient client = this;
@@ -566,6 +673,11 @@ protected void onPostExecute(T response) {
566673
}, path);
567674
}
568675

676+
@Override
677+
public <T> void putAsync(String path, byte[] requestBody, String contentType, Type responseType, AsyncSuccess<T> success) {
678+
putAsync(path, requestBody, contentType, responseType, createAsyncResult(success, null));
679+
}
680+
569681
@Override
570682
public void putAsync(String path, final byte[] requestBody, final String contentType, final AsyncResult<byte[]> asyncResult) {
571683
final AndroidServiceClient client = this;
@@ -589,8 +701,14 @@ protected void onPostExecute(byte[] bytes) {
589701
}, path);
590702
}
591703

704+
@Override
705+
public void putAsync(String path, byte[] requestBody, String contentType, AsyncSuccess<byte[]> success) {
706+
putAsync(path, requestBody, contentType, createAsyncResult(success, null));
707+
}
708+
592709
/* DELETE */
593710

711+
@Override
594712
public <T> void deleteAsync(IReturn<T> request, final AsyncResult<T> asyncResult){
595713
final AndroidServiceClient client = this;
596714
execTask(new AsyncTask<IReturn<T>, Void, T>() {
@@ -612,6 +730,16 @@ protected void onPostExecute(T response) {
612730
}, request);
613731
}
614732

733+
@Override
734+
public <T> void deleteAsync(IReturn<T> request, AsyncSuccess<T> success) {
735+
deleteAsync(request, success, null);
736+
}
737+
738+
@Override
739+
public <T> void deleteAsync(IReturn<T> request, AsyncSuccess<T> success, AsyncError error) {
740+
deleteAsync(request, createAsyncResult(success, error));
741+
}
742+
615743
@Override
616744
public void deleteAsync(IReturnVoid request, final AsyncResultVoid asyncResult) {
617745
final AndroidServiceClient client = this;
@@ -634,6 +762,17 @@ protected void onPostExecute(Void noResponse) {
634762
}, request);
635763
}
636764

765+
@Override
766+
public void deleteAsync(IReturnVoid request, AsyncSuccessVoid success) {
767+
deleteAsync(request, success, null);
768+
}
769+
770+
@Override
771+
public void deleteAsync(IReturnVoid request, AsyncSuccessVoid success, AsyncError error) {
772+
deleteAsync(request, createAsyncResultVoid(success, error));
773+
}
774+
775+
@Override
637776
public <T> void deleteAsync(IReturn<T> request, final Map<String, String> queryParams, final AsyncResult<T> asyncResult){
638777
final AndroidServiceClient client = this;
639778
execTask(new AsyncTask<IReturn<T>, Void, T>() {
@@ -655,6 +794,12 @@ protected void onPostExecute(T response) {
655794
}, request);
656795
}
657796

797+
@Override
798+
public <T> void deleteAsync(IReturn<T> request, Map<String, String> queryParams, AsyncSuccess<T> success) {
799+
deleteAsync(request, queryParams, createAsyncResult(success, null));
800+
}
801+
802+
@Override
658803
public <T> void deleteAsync(String path, final Class responseType, final AsyncResult<T> asyncResult) {
659804
final AndroidServiceClient client = this;
660805
execTask(new AsyncTask<String, Void, T>() {
@@ -676,6 +821,11 @@ protected void onPostExecute(T response) {
676821
}, path);
677822
}
678823

824+
@Override
825+
public <T> void deleteAsync(String path, Class responseType, AsyncSuccess<T> success) {
826+
deleteAsync(path, responseType, createAsyncResult(success, null));
827+
}
828+
679829
@Override
680830
public <T> void deleteAsync(String path, final Type responseType, final AsyncResult<T> asyncResult) {
681831
final AndroidServiceClient client = this;
@@ -698,6 +848,12 @@ protected void onPostExecute(T response) {
698848
}, path);
699849
}
700850

851+
@Override
852+
public <T> void deleteAsync(String path, Type responseType, AsyncSuccess<T> success) {
853+
deleteAsync(path, responseType, createAsyncResult(success, null));
854+
}
855+
856+
@Override
701857
public void deleteAsync(String path, final AsyncResult<byte[]> asyncResult) {
702858
final AndroidServiceClient client = this;
703859
execTask(new AsyncTask<String, Void, byte[]>() {
@@ -719,4 +875,9 @@ protected void onPostExecute(byte[] bytes) {
719875

720876
}, path);
721877
}
878+
879+
@Override
880+
public void deleteAsync(String path, AsyncSuccess<byte[]> success) {
881+
deleteAsync(path, createAsyncResult(success, null));
882+
}
722883
}

0 commit comments

Comments
 (0)