Skip to content

Commit 9c434fc

Browse files
authored
Merge pull request #61 from microsoftgraph/iambmelt/working
Android v1.1.0
2 parents 4173311 + 9fdf985 commit 9c434fc

File tree

54 files changed

+493
-279
lines changed

Some content is hidden

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

54 files changed

+493
-279
lines changed

Templates/Android/BaseModel.template.tt

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,10 @@
1313
<# } #>
1414
<#+
1515

16-
/// Is this request type a post?
17-
public bool IsPostRequestType(OdcmMethod method) {
18-
return method.IsAction()
19-
&& null != method.Parameters
20-
&& method.Parameters.Any();
21-
}
22-
2316
/// Choose an intermediate class type based on GETs/POSTs
2417
public string RequestBuilderSuperClass(OdcmObject currentType) {
25-
var isPostAction =
26-
IsPostRequestType(
27-
currentType.AsOdcmMethod()
28-
);
29-
30-
string superClass;
31-
32-
if (isPostAction) {
33-
superClass = "BasePostMethodRequestBuilder";
34-
} else {
35-
superClass = "BaseGetMethodRequestBuilder";
36-
}
37-
38-
return superClass;
18+
return currentType.AsOdcmMethod().IsFunction ?
19+
"BaseFunctionRequestBuilder" : "BaseActionRequestBuilder";
3920
}
4021

4122
/// <summary>
@@ -376,15 +357,37 @@
376357

377358
/// The Type of this param, as a string
378359
public string ParamType(OdcmParameter c) {
360+
var typeString = c.Type.GetTypeString();
379361
if (c.IsCollection){
380-
return String.Format("List<{0}>", c.Type.GetTypeString());
362+
typeString = String.Format("List<{0}>", c.Type.GetTypeString());
363+
} else if (typeString.Equals("Stream")) {
364+
365+
// Excel introduced the use of "Edm.Stream" types
366+
// normally this would be addressed at the TypeHelper level
367+
// but because streams will use different data containers
368+
// for outgoing vs. incoming streams I'm going to apply the type
369+
// here. Outbound Streams will use byte[]
370+
371+
typeString = "byte[]";
381372
}
382-
return c.Type.GetTypeString();
373+
return typeString;
383374
}
384375

385376
public string ReturnType(OdcmObject c) {
386-
if (c.AsOdcmMethod().ReturnType != null) {
387-
return c.AsOdcmMethod().ReturnType.Name.ToUpperFirstChar();
377+
var returnType = c.AsOdcmMethod().ReturnType;
378+
if (returnType != null) {
379+
var returnTypeString = returnType.GetTypeString();
380+
381+
// Excel introduced the use of "Edm.Stream" types
382+
// normally this would be addressed at the TypeHelper level
383+
// but because streams will use different data containers
384+
// for outgoing vs. incoming streams I'm going to apply the type
385+
// here. Inbound Streams will use java.io.InputStream
386+
387+
if (returnTypeString.Equals("Stream")) {
388+
returnTypeString = "java.io.InputStream";
389+
}
390+
return returnTypeString;
388391
}
389392
return "Void";
390393
}
@@ -619,14 +622,15 @@ public {1} {2}{3}{4} {{";
619622
* The {0}.
620623
*/
621624
@SerializedName(""{1}"")
622-
public {4}{2} {3};
625+
@Expose
626+
public {2} {3};
623627

624628
";
625629
var collectionFormat =
626630
@" /**
627631
* The {0}.
628632
*/
629-
public transient {4}{2} {3};
633+
public transient {2} {3};
630634

631635
";
632636

@@ -635,7 +639,6 @@ public {1} {2}{3}{4} {{";
635639
var propertyName = property.Name.ToUpperFirstChar();
636640
var propertyType = "";
637641
var propertyFormat = format;
638-
var shouldFullyQualify = TypeHelperAndroid.ReservedNames.Contains(propertyName);
639642
if (property.IsCollection)
640643
{
641644
if (!property.IsNavigation())
@@ -657,8 +660,7 @@ public {1} {2}{3}{4} {{";
657660
propertyName.SplitCamelCase(),
658661
property.Name,
659662
propertyType,
660-
property.SanitizePropertyName().ToLowerFirstChar(),
661-
shouldFullyQualify ? "com.microsoft.graph.extensions." : "");
663+
property.SanitizePropertyName().ToLowerFirstChar());
662664
}
663665
return sb.ToString();
664666
}
@@ -672,6 +674,7 @@ public {1} {2}{3}{4} {{";
672674
* The {0}.
673675
*/
674676
@SerializedName(""{1}"")
677+
@Expose
675678
public {2} {3};
676679

677680
";

Templates/Android/extensions/EntityCollectionReferenceRequestBuilder.java.tt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
*
1414
* @param requestUrl The request url
1515
* @param client The service client
16-
* @param options The options for this request
16+
* @param requestOptions The options for this request
1717
*/
18-
public <#=TypeCollectionReferenceRequestBuilder(c)#>(final String requestUrl, final <#=IBaseClientType()#> client, final List<Option> options) {
19-
super(requestUrl, client, options);
18+
public <#=TypeCollectionReferenceRequestBuilder(c)#>(final String requestUrl, final <#=IBaseClientType()#> client, final List<Option> requestOptions) {
19+
super(requestUrl, client, requestOptions);
2020
}
2121
}

Templates/Android/extensions/EntityCollectionRequest.java.tt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
*
1414
* @param requestUrl The request url
1515
* @param client The service client
16-
* @param options The options for this request
16+
* @param requestOptions The options for this request
1717
*/
18-
public <#=TypeCollectionRequest(c)#>(final String requestUrl, final <#=IBaseClientType()#> client, final List<Option> options) {
19-
super(requestUrl, client, options);
18+
public <#=TypeCollectionRequest(c)#>(final String requestUrl, final <#=IBaseClientType()#> client, final List<Option> requestOptions) {
19+
super(requestUrl, client, requestOptions);
2020
}
2121
}

Templates/Android/extensions/EntityCollectionRequestBuilder.java.tt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
*
1414
* @param requestUrl The request url
1515
* @param client The service client
16-
* @param options The options for this request
16+
* @param requestOptions The options for this request
1717
*/
18-
public <#=TypeCollectionRequestBuilder(c)#>(final String requestUrl, final <#=IBaseClientType()#> client, final List<Option> options) {
19-
super(requestUrl, client, options);
18+
public <#=TypeCollectionRequestBuilder(c)#>(final String requestUrl, final <#=IBaseClientType()#> client, final List<Option> requestOptions) {
19+
super(requestUrl, client, requestOptions);
2020
}
2121
}

Templates/Android/extensions/EntityCollectionWithReferencesRequest.java.tt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
*
1414
* @param requestUrl The request url
1515
* @param client The service client
16-
* @param options The options for this request
16+
* @param requestOptions The options for this request
1717
*/
18-
public <#=TypeCollectionWithReferencesRequest(c)#>(final String requestUrl, final <#=IBaseClientType()#> client, final List<Option> options) {
19-
super(requestUrl, client, options);
18+
public <#=TypeCollectionWithReferencesRequest(c)#>(final String requestUrl, final <#=IBaseClientType()#> client, final List<Option> requestOptions) {
19+
super(requestUrl, client, requestOptions);
2020
}
2121
}

Templates/Android/extensions/EntityCollectionWithReferencesRequestBuilder.java.tt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
*
1414
* @param requestUrl The request url
1515
* @param client The service client
16-
* @param options The options for this request
16+
* @param requestOptions The options for this request
1717
*/
18-
public <#=TypeCollectionWithReferencesRequestBuilder(c)#>(final String requestUrl, final <#=IBaseClientType()#> client, final List<Option> options) {
19-
super(requestUrl, client, options);
18+
public <#=TypeCollectionWithReferencesRequestBuilder(c)#>(final String requestUrl, final <#=IBaseClientType()#> client, final List<Option> requestOptions) {
19+
super(requestUrl, client, requestOptions);
2020
}
2121
}

Templates/Android/extensions/EntityReferenceRequest.java.tt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
*
1414
* @param requestUrl The request url
1515
* @param client The service client
16-
* @param options The options for this request
16+
* @param requestOptions The options for this request
1717
*/
18-
public <#=TypeReferenceRequest(c)#>(final String requestUrl, final <#=IBaseClientType()#> client, final List<Option> options) {
19-
super(requestUrl, client, options);
18+
public <#=TypeReferenceRequest(c)#>(final String requestUrl, final <#=IBaseClientType()#> client, final List<Option> requestOptions) {
19+
super(requestUrl, client, requestOptions);
2020
}
2121
}

Templates/Android/extensions/EntityReferenceRequestBuilder.java.tt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
*
1414
* @param requestUrl The request url
1515
* @param client The service client
16-
* @param options The options for this request
16+
* @param requestOptions The options for this request
1717
*/
18-
public <#=TypeReferenceRequestBuilder(c)#>(final String requestUrl, final <#=IBaseClientType()#> client, final List<Option> options) {
19-
super(requestUrl, client, options);
18+
public <#=TypeReferenceRequestBuilder(c)#>(final String requestUrl, final <#=IBaseClientType()#> client, final List<Option> requestOptions) {
19+
super(requestUrl, client, requestOptions);
2020
}
2121
}

Templates/Android/extensions/EntityRequest.java.tt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
*
1515
* @param requestUrl The request url
1616
* @param client The service client
17-
* @param options The options for this request
17+
* @param requestOptions The options for this request
1818
* @param responseClass The class of the reponse
1919
*/
2020
public <#=TypeRequest(c)#>(final String requestUrl,
2121
final <#=IBaseClientType()#> client,
22-
final List<Option> options,
22+
final List<Option> requestOptions,
2323
final Class responseClass) {
24-
super(requestUrl, client, options, responseClass);
24+
super(requestUrl, client, requestOptions, responseClass);
2525
}
2626
<# } #>
2727

@@ -30,9 +30,9 @@
3030
*
3131
* @param requestUrl The request url
3232
* @param client The service client
33-
* @param options The options for this request
33+
* @param requestOptions The options for this request
3434
*/
35-
public <#=TypeRequest(c)#>(final String requestUrl, final <#=IBaseClientType()#> client, final List<Option> options) {
36-
super(requestUrl, client, options, <#=ClassTypeName(c)#>.class);
35+
public <#=TypeRequest(c)#>(final String requestUrl, final <#=IBaseClientType()#> client, final List<Option> requestOptions) {
36+
super(requestUrl, client, requestOptions, <#=ClassTypeName(c)#>.class);
3737
}
3838
}

Templates/Android/extensions/EntityRequestBuilder.java.tt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
*
1414
* @param requestUrl The request url
1515
* @param client The service client
16-
* @param options The options for this request
16+
* @param requestOptions The options for this request
1717
*/
18-
public <#=TypeRequestBuilder(c)#>(final String requestUrl, final <#=IBaseClientType()#> client, final List<Option> options) {
19-
super(requestUrl, client, options);
18+
public <#=TypeRequestBuilder(c)#>(final String requestUrl, final <#=IBaseClientType()#> client, final List<Option> requestOptions) {
19+
super(requestUrl, client, requestOptions);
2020
}
2121
}

0 commit comments

Comments
 (0)