Skip to content

Commit 3e88096

Browse files
committed
Copy client classes into android project to remove external dependency
1 parent c711e76 commit 3e88096

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3727
-2
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright (c) 2015 ServiceStack LLC. All rights reserved.
2+
// License: https://servicestack.net/bsd-license.txt
3+
4+
package net.servicestack.client;
5+
6+
import java.lang.annotation.Retention;
7+
import java.lang.annotation.RetentionPolicy;
8+
9+
@Retention(RetentionPolicy.RUNTIME)
10+
public @interface Api {
11+
String value() default "";
12+
13+
public String Description() default "";
14+
}
15+
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Copyright (c) 2015 ServiceStack LLC. All rights reserved.
2+
// License: https://servicestack.net/bsd-license.txt
3+
4+
package net.servicestack.client;
5+
6+
import java.lang.annotation.Retention;
7+
import java.lang.annotation.RetentionPolicy;
8+
9+
@Retention(RetentionPolicy.RUNTIME)
10+
public @interface ApiMember {
11+
12+
/// <summary>
13+
/// Gets or sets verb to which applies attribute. By default applies to all verbs.
14+
/// </summary>
15+
public String Verb() default "";
16+
17+
/// <summary>
18+
/// Gets or sets parameter type: It can be only one of the following: path, query, body, form, or header.
19+
/// </summary>
20+
public String ParameterType() default "";
21+
22+
/// <summary>
23+
/// Gets or sets unique name for the parameter. Each name must be unique, even if they are associated with different paramType values.
24+
/// </summary>
25+
/// <remarks>
26+
/// <para>
27+
/// Other notes on the name field:
28+
/// If paramType is body, the name is used only for UI and codegeneration.
29+
/// If paramType is path, the name field must correspond to the associated path segment from the path field in the api object.
30+
/// If paramType is query, the name field corresponds to the query param name.
31+
/// </para>
32+
/// </remarks>
33+
public String Name() default "";
34+
35+
/// <summary>
36+
/// Gets or sets the human-readable description for the parameter.
37+
/// </summary>
38+
public String Description() default "";
39+
40+
/// <summary>
41+
/// For path, query, and header paramTypes, this field must be a primitive. For body, this can be a complex or container datatype.
42+
/// </summary>
43+
public String DataType() default "";
44+
45+
/// <summary>
46+
/// For path, this is always true. Otherwise, this field tells the client whether or not the field must be supplied.
47+
/// </summary>
48+
public boolean IsRequired() default false;
49+
50+
/// <summary>
51+
/// For query params, this specifies that a comma-separated list of values can be passed to the API. For path and body types, this field cannot be true.
52+
/// </summary>
53+
public boolean AllowMultiple() default false;
54+
55+
/// <summary>
56+
/// Gets or sets route to which applies attribute, matches using StartsWith. By default applies to all routes.
57+
/// </summary>
58+
public String Route() default "";
59+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright (c) 2015 ServiceStack LLC. All rights reserved.
2+
// License: https://servicestack.net/bsd-license.txt
3+
4+
package net.servicestack.client;
5+
6+
import java.lang.annotation.Retention;
7+
import java.lang.annotation.RetentionPolicy;
8+
9+
@Retention(RetentionPolicy.RUNTIME)
10+
public @interface ApiResponse {
11+
12+
public int StatusCode() default 0;
13+
14+
public String Description() default "";
15+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright (c) 2015 ServiceStack LLC. All rights reserved.
2+
// License: https://servicestack.net/bsd-license.txt
3+
4+
package net.servicestack.client;
5+
6+
public abstract class AsyncResult<T> {
7+
T result;
8+
boolean completed = false;
9+
Exception ex;
10+
11+
public final T getResult(){ return result; }
12+
public final void setResult(T value) {
13+
completed = true;
14+
result = value;
15+
}
16+
17+
public final Exception getError() { return ex; }
18+
public final void setError(Exception value) {
19+
completed = true;
20+
ex = value;
21+
}
22+
23+
public final void completeResult(T value){
24+
try {
25+
if (ex == null){
26+
setResult(value);
27+
success(value);
28+
}
29+
else {
30+
error(ex);
31+
}
32+
} finally {
33+
complete();
34+
}
35+
}
36+
37+
public void success(T response){}
38+
public void error(Exception ex){}
39+
public void complete(){}
40+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright (c) 2015 ServiceStack LLC. All rights reserved.
2+
// License: https://servicestack.net/bsd-license.txt
3+
4+
package net.servicestack.client;
5+
6+
public abstract class AsyncResultVoid {
7+
boolean completed = false;
8+
Exception ex;
9+
10+
public final Exception getError() { return ex; }
11+
public final void setError(Exception value) {
12+
completed = true;
13+
ex = value;
14+
}
15+
16+
public final void completeResult(){
17+
try {
18+
if (ex == null){
19+
success();
20+
}
21+
else {
22+
error(ex);
23+
}
24+
} finally {
25+
complete();
26+
}
27+
}
28+
29+
public void success(){}
30+
public void error(Exception ex){}
31+
public void complete(){}
32+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright (c) 2015 ServiceStack LLC. All rights reserved.
2+
// License: https://servicestack.net/bsd-license.txt
3+
4+
package net.servicestack.client;
5+
6+
import java.lang.reflect.Type;
7+
import java.net.HttpURLConnection;
8+
import java.util.Map;
9+
10+
public interface AsyncServiceClient {
11+
<T> void sendAsync(IReturn<T> request, final AsyncResult<T> asyncResult);
12+
void sendAsync(IReturnVoid request, final AsyncResultVoid asyncResult);
13+
14+
<T> void getAsync(IReturn<T> request, final AsyncResult<T> asyncResult);
15+
void getAsync(IReturnVoid request, final AsyncResultVoid asyncResult);
16+
<T> void getAsync(IReturn<T> request, final Map<String, String> queryParams, final AsyncResult<T> asyncResult);
17+
<T> void getAsync(String path, final Class responseType, final AsyncResult<T> asyncResult);
18+
<T> void getAsync(String path, final Type responseType, final AsyncResult<T> asyncResult);
19+
void getAsync(String path, final AsyncResult<byte[]> asyncResult);
20+
21+
<T> void postAsync(IReturn<T> request, final AsyncResult<T> asyncResult);
22+
void postAsync(IReturnVoid request, final AsyncResultVoid asyncResult);
23+
<T> void postAsync(String path, final Object request, final Class responseType, final AsyncResult<T> asyncResult);
24+
<T> void postAsync(String path, final Object request, final Type responseType, final AsyncResult<T> asyncResult);
25+
<T> void postAsync(String path, final byte[] requestBody, final String contentType, final Class responseType, final AsyncResult<T> asyncResult);
26+
<T> void postAsync(String path, final byte[] requestBody, final String contentType, final Type responseType, final AsyncResult<T> asyncResult);
27+
void postAsync(String path, final byte[] requestBody, final String contentType, final AsyncResult<byte[]> asyncResult);
28+
29+
<T> void putAsync(IReturn<T> request, final AsyncResult<T> asyncResult);
30+
void putAsync(IReturnVoid request, final AsyncResultVoid asyncResult);
31+
<T> void putAsync(String path, final Object request, final Class responseType, final AsyncResult<T> asyncResult);
32+
<T> void putAsync(String path, final Object request, final Type responseType, final AsyncResult<T> asyncResult);
33+
<T> void putAsync(String path, final byte[] requestBody, final String contentType, final Class responseType, final AsyncResult<T> asyncResult);
34+
<T> void putAsync(String path, final byte[] requestBody, final String contentType, final Type responseType, final AsyncResult<T> asyncResult);
35+
void putAsync(String path, final byte[] requestBody, final String contentType, final AsyncResult<byte[]> asyncResult);
36+
37+
<T> void deleteAsync(IReturn<T> request, final AsyncResult<T> asyncResult);
38+
void deleteAsync(IReturnVoid request, final AsyncResultVoid asyncResult);
39+
<T> void deleteAsync(IReturn<T> request, final Map<String, String> queryParams, final AsyncResult<T> asyncResult);
40+
<T> void deleteAsync(String path, final Class responseType, final AsyncResult<T> asyncResult);
41+
<T> void deleteAsync(String path, final Type responseType, final AsyncResult<T> asyncResult);
42+
void deleteAsync(String path, final AsyncResult<byte[]> asyncResult);
43+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright (c) 2015 ServiceStack LLC. All rights reserved.
2+
// License: https://servicestack.net/bsd-license.txt
3+
4+
package net.servicestack.client;
5+
6+
import java.lang.annotation.Retention;
7+
import java.lang.annotation.RetentionPolicy;
8+
9+
@Retention(RetentionPolicy.RUNTIME)
10+
public @interface AutoQueryViewer {
11+
public String Title() default "";
12+
public String Description() default "";
13+
public String IconUrl() default "";
14+
public String BrandUrl() default "";
15+
public String BrandImageUrl() default "";
16+
public String TextColor() default "";
17+
public String LinkColor() default "";
18+
public String BackgroundColor() default "";
19+
public String BackgroundImageUrl() default "";
20+
public String DefaultSearchField() default "";
21+
public String DefaultSearchType() default "";
22+
public String DefaultSearchText() default "";
23+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) 2015 ServiceStack LLC. All rights reserved.
2+
// License: https://servicestack.net/bsd-license.txt
3+
4+
package net.servicestack.client;
5+
6+
import java.lang.annotation.Retention;
7+
import java.lang.annotation.RetentionPolicy;
8+
9+
@Retention(RetentionPolicy.RUNTIME)
10+
public @interface AutoQueryViewerField {
11+
public String Title() default "";
12+
public String Description() default "";
13+
public boolean HideInSummary() default false;
14+
public String ValueFormat () default "";
15+
public String LayoutHint() default "";
16+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright (c) 2015 ServiceStack LLC. All rights reserved.
2+
// License: https://servicestack.net/bsd-license.txt
3+
4+
package net.servicestack.client;
5+
6+
import java.net.HttpURLConnection;
7+
8+
public interface ConnectionFilter {
9+
public void exec(HttpURLConnection conn);
10+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright (c) 2015 ServiceStack LLC. All rights reserved.
2+
// License: https://servicestack.net/bsd-license.txt
3+
4+
package net.servicestack.client;
5+
6+
import java.lang.annotation.Retention;
7+
import java.lang.annotation.RetentionPolicy;
8+
9+
@Retention(RetentionPolicy.RUNTIME)
10+
public @interface DataContract {
11+
public String value() default "";
12+
13+
public String Name() default "";
14+
public String Namespace() default "";
15+
}

0 commit comments

Comments
 (0)