|
1 | 1 | <# // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. #> |
2 | 2 | <#@ template debug="true" hostspecific="true" language="C#" #> |
| 3 | +<#@ include file="utils.tt" #> |
3 | 4 | <#@ output extension="\\" #> |
4 | 5 | <# |
5 | 6 | CustomT4Host host = (CustomT4Host) Host; |
|
9 | 10 | var entityTypes = model.GetEntityTypes(); |
10 | 11 | var enumTypes = model.GetEnumTypes(); |
11 | 12 | var complexTypes = model.GetComplexTypes(); |
| 13 | + |
| 14 | + var maxLineLength = 180; |
12 | 15 | #> |
13 | | -// Type definitions for the Microsoft Graph <VERSION_STRING> |
14 | | -// Project: https://github.com/microsoftgraph/msgraph-typescript-typings |
| 16 | +// Type definitions for non-npm package microsoft-graph <VERSION_STRING> |
15 | 17 | // Definitions by: Microsoft Graph Team <https://github.com/microsoftgraph> |
16 | 18 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped |
17 | 19 | // TypeScript Version: 2.1 |
18 | 20 |
|
19 | 21 | export as namespace microsoftgraph; |
20 | 22 |
|
21 | | -<# foreach(var enumType in enumTypes) { #> |
| 23 | +<# |
| 24 | + foreach(var enumType in enumTypes) { |
| 25 | +#> |
22 | 26 | export type <#= enumType.Name.UpperCaseFirstChar() #> = <#= enumType.GetEnumValues() #>; |
23 | | -<# } #> |
24 | 27 | <# |
25 | | - foreach(var entityType in entityTypes) |
26 | | - { |
27 | | - var methods = entityType.Methods; |
| 28 | + } |
| 29 | + |
| 30 | + foreach(var entityType in entityTypes) { |
| 31 | + var propCount = entityType.Properties.ToList().Count; |
| 32 | + if(propCount == 0) { |
| 33 | +#> |
| 34 | +// tslint:disable-next-line: no-empty-interface |
| 35 | +<# |
| 36 | + } |
| 37 | +#> |
| 38 | +export interface <#= entityType.Name.UpperCaseFirstChar() #><# |
| 39 | + if (entityType.Base != null) { |
| 40 | +#> |
| 41 | + extends <#= entityType.Base.Name.UpperCaseFirstChar() #><# |
| 42 | + } |
| 43 | +#> {<# |
| 44 | + if(propCount == 0){ |
| 45 | +#>}<# |
| 46 | + } else { |
28 | 47 | #> |
29 | 48 |
|
30 | | -export interface <#= entityType.Name.UpperCaseFirstChar() #><# if (entityType.Base != null) { #> extends <#= entityType.Base.Name.UpperCaseFirstChar() #><# }#> { |
31 | | -<# foreach(var prop in entityType.Properties.ToList()) { #> |
32 | | - <# if (prop.LongDescription != null || prop.Description != null) { #> |
33 | | - /** <#=prop.GetSanitizedLongDescription()#> */ |
34 | | - <# } #> |
35 | | - <#= prop.Name #>?: <#= prop.GetTypeString() #>; |
36 | | -<# } #> |
| 49 | +<# |
| 50 | + foreach(var prop in entityType.Properties.ToList()) { |
| 51 | + if (prop.LongDescription != null || prop.Description != null) { |
| 52 | + List<string> multiLineDescriptions = Utils.splitString(prop.GetSanitizedLongDescription(), maxLineLength); |
| 53 | +#> |
| 54 | + /** |
| 55 | +<# |
| 56 | + foreach(var descriptionLine in multiLineDescriptions) { |
| 57 | +#> |
| 58 | + * <#= descriptionLine #> |
| 59 | +<# |
| 60 | + } |
| 61 | +#> |
| 62 | + */ |
| 63 | +<# |
| 64 | + } |
| 65 | +#> |
| 66 | + <#= prop.Name #>?: <#= prop.GetTypeString() #>; |
| 67 | +<# |
| 68 | + } |
| 69 | +#> |
37 | 70 | } |
38 | 71 | <# |
| 72 | + } |
39 | 73 | } |
| 74 | + |
| 75 | + foreach(var complexType in complexTypes) { |
| 76 | + var propCount = complexType.Properties.Count; |
| 77 | + if(propCount == 0) { |
| 78 | +#> |
| 79 | +// tslint:disable-next-line: no-empty-interface |
| 80 | +<# |
| 81 | + } |
| 82 | +#> |
| 83 | +export interface <#= complexType.Name.UpperCaseFirstChar() #><# |
| 84 | + if (complexType.Base != null) { |
| 85 | +#> |
| 86 | + extends <#= complexType.Base.Name.UpperCaseFirstChar() #><# |
| 87 | + } |
| 88 | +#> {<# |
| 89 | + if(propCount == 0){ |
| 90 | +#>}<# |
| 91 | + } else { |
| 92 | +#> |
| 93 | + |
| 94 | +<# |
| 95 | + foreach(var prop in complexType.Properties) { |
| 96 | + if (prop.LongDescription != null || prop.Description != null) { |
| 97 | + List<string> multiLineDescriptions = Utils.splitString(prop.GetSanitizedLongDescription(), maxLineLength); |
40 | 98 | #> |
| 99 | + /** |
41 | 100 | <# |
42 | | - foreach(var complexType in complexTypes) |
43 | | - { |
| 101 | + foreach(var descriptionLine in multiLineDescriptions) { |
| 102 | +#> |
| 103 | + * <#= descriptionLine #> |
| 104 | +<# |
| 105 | + } |
| 106 | +#> |
| 107 | + */ |
| 108 | +<# |
| 109 | + } |
| 110 | +#> |
| 111 | + <#= prop.Name #>?: <#= prop.GetTypeString() #>; |
| 112 | +<# |
| 113 | + } |
44 | 114 | #> |
45 | | -export interface <#= complexType.Name.UpperCaseFirstChar()#><# if (complexType.Base != null) { #> extends <#= complexType.Base.Name.UpperCaseFirstChar() #><# }#> { |
46 | | -<# foreach(var prop in complexType.Properties) { #> |
47 | | - <# if (prop.LongDescription != null || prop.Description != null) { #> |
48 | | - /** <#=prop.GetSanitizedLongDescription()#> */ |
49 | | - <# } #> |
50 | | - <#= prop.Name #>?: <#= prop.GetTypeString() #>; |
51 | | -<# } #> |
52 | 115 | } |
53 | | -<# } #> |
| 116 | +<# |
| 117 | + } |
| 118 | + } |
| 119 | +#> |
0 commit comments