Skip to content

Commit 9fd681c

Browse files
authored
Merge pull request #1754 from microsoftgraph/kiota/v1.0/pipelinebuild/110595
Generated models and request builders
2 parents d40bef8 + fe0ffad commit 9fd681c

178 files changed

Lines changed: 6346 additions & 297 deletions

File tree

Some content is hidden

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

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ and this project does adheres to [Semantic Versioning](https://semver.org/spec/v
88
## [Unreleased]
99

1010

11+
## [5.3.0] - 2023-03-21
12+
13+
### Added
14+
15+
- Allows checking for status codes without parsing request bodies in batch requests (https://github.com/microsoftgraph/msgraph-sdk-dotnet-core/pull/626)
16+
- Updates kiota abstraction library dependencies to fix serialization errors.
17+
- Metadata fixes for missing expand clauses for messages,calendar and mailfolder endpoints
18+
- Latest metadata updates from 21st March 2023
19+
1120
## [5.2.0] - 2023-03-14
1221

1322
### Added

docs/errors.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ try
1212
}
1313
catch (ODataError odataError)
1414
{
15-
Console.WriteLine(odataError.Error.Code);
16-
Console.WriteLine(odataError.Error.Message);
15+
Console.WriteLine(odataError.Error?.Code);
16+
Console.WriteLine(odataError.Error?.Message);
1717
throw;
1818
}
1919
```
@@ -24,7 +24,7 @@ catch (ODataError odataError)
2424
You can check the status code that caused the error as below.
2525

2626
```csharp
27-
catch (ODataError odataError) when (odataError.ResponseStatusCode.Equals(404))
27+
catch (ODataError odataError) when (odataError.ResponseStatusCode.Equals(HttpStatusCode.NotFound))
2828
{
2929
// Handle 404 status code
3030
}

src/Microsoft.Graph/Enums/GraphErrorCode.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ public enum GraphErrorCode
8080
NameAlreadyExists,
8181
/// The action is not allowed by the system.
8282
NotAllowed,
83+
/// The requested item is not not found.
84+
NotFound,
8385
/// The request is not supported by the system.
8486
NotSupported,
8587
/// Parameter Exceeds Maximum Length.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
// ------------------------------------------------------------------------------
2+
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
3+
// ------------------------------------------------------------------------------
4+
5+
using Microsoft.Kiota.Abstractions.Serialization;
6+
using Microsoft.Kiota.Abstractions.Store;
7+
using System;
8+
using System.Collections.Generic;
9+
10+
namespace Microsoft.Graph.Models;
11+
12+
public class PlannerAssignment: IAdditionalDataHolder, IBackedModel, IParsable
13+
{
14+
/// <summary>Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.</summary>
15+
public IDictionary<string, object> AdditionalData {
16+
get { return BackingStore?.Get<IDictionary<string, object>>("additionalData"); }
17+
set { BackingStore?.Set("additionalData", value); }
18+
}
19+
/// <summary>Stores model information.</summary>
20+
public IBackingStore BackingStore { get; private set; }
21+
/// <summary>The OdataType property</summary>
22+
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
23+
#nullable enable
24+
public string? OdataType {
25+
get { return BackingStore?.Get<string?>("@odata.type"); }
26+
set { BackingStore?.Set("@odata.type", value); }
27+
}
28+
#nullable restore
29+
#else
30+
public string OdataType {
31+
get { return BackingStore?.Get<string>("@odata.type"); }
32+
set { BackingStore?.Set("@odata.type", value); }
33+
}
34+
#endif
35+
/// <summary>The OdataType property</summary>
36+
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
37+
#nullable enable
38+
public string? OrderHint {
39+
get { return BackingStore?.Get<string?>("orderHint"); }
40+
set { BackingStore?.Set("orderHint", value); }
41+
}
42+
#nullable restore
43+
#else
44+
public string OrderHint {
45+
get { return BackingStore?.Get<string>("orderHint"); }
46+
set { BackingStore?.Set("orderHint", value); }
47+
}
48+
#endif
49+
/// <summary>
50+
/// Instantiates a new auditActivityInitiator and sets the default values.
51+
/// </summary>
52+
public PlannerAssignment() {
53+
BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore();
54+
AdditionalData = new Dictionary<string, object>();
55+
OdataType = "#microsoft.graph.plannerAssignment";
56+
OrderHint = "!";
57+
}
58+
/// <summary>
59+
/// Creates a new instance of the appropriate class based on discriminator value
60+
/// </summary>
61+
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
62+
public static PlannerAssignment CreateFromDiscriminatorValue(IParseNode parseNode) {
63+
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
64+
return new PlannerAssignment();
65+
}
66+
/// <summary>
67+
/// The deserialization information for the current model
68+
/// </summary>
69+
public IDictionary<string, Action<IParseNode>> GetFieldDeserializers() {
70+
return new Dictionary<string, Action<IParseNode>> {
71+
{"@odata.type", n => { OdataType = n.GetStringValue(); } },
72+
{"orderHint", n => { OrderHint = n.GetStringValue(); } },
73+
};
74+
}
75+
/// <summary>
76+
/// Serializes information the current object
77+
/// </summary>
78+
/// <param name="writer">Serialization writer to use to serialize this model</param>
79+
public void Serialize(ISerializationWriter writer) {
80+
_ = writer ?? throw new ArgumentNullException(nameof(writer));
81+
writer.WriteStringValue("@odata.type", OdataType);
82+
writer.WriteStringValue("orderHint", OrderHint);
83+
writer.WriteAdditionalData(AdditionalData);
84+
}
85+
}

src/Microsoft.Graph/Generated/Chats/Item/Messages/Item/Replies/RepliesRequestBuilder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ public async Task<ChatMessageCollectionResponse> GetAsync(Action<RepliesRequestB
8484
return await RequestAdapter.SendAsync<ChatMessageCollectionResponse>(requestInfo, ChatMessageCollectionResponse.CreateFromDiscriminatorValue, errorMapping, cancellationToken);
8585
}
8686
/// <summary>
87-
/// Create a new reply to a chatMessage in a specified channel.
88-
/// Find more info here <see href="https://docs.microsoft.com/graph/api/channel-post-messagereply?view=graph-rest-1.0" />
87+
/// Send a new reply to a chatMessage in a specified channel.
88+
/// Find more info here <see href="https://docs.microsoft.com/graph/api/chatmessage-post-replies?view=graph-rest-1.0" />
8989
/// </summary>
9090
/// <param name="body">The request body</param>
9191
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
@@ -132,7 +132,7 @@ public RequestInformation ToGetRequestInformation(Action<RepliesRequestBuilderGe
132132
return requestInfo;
133133
}
134134
/// <summary>
135-
/// Create a new reply to a chatMessage in a specified channel.
135+
/// Send a new reply to a chatMessage in a specified channel.
136136
/// </summary>
137137
/// <param name="body">The request body</param>
138138
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>

src/Microsoft.Graph/Generated/Chats/Item/Messages/MessagesRequestBuilder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ public async Task<ChatMessageCollectionResponse> GetAsync(Action<MessagesRequest
8484
return await RequestAdapter.SendAsync<ChatMessageCollectionResponse>(requestInfo, ChatMessageCollectionResponse.CreateFromDiscriminatorValue, errorMapping, cancellationToken);
8585
}
8686
/// <summary>
87-
/// Send a new chatMessage in the specified channel or a chat.
88-
/// Find more info here <see href="https://docs.microsoft.com/graph/api/chatmessage-post?view=graph-rest-1.0" />
87+
/// Send a new chatMessage in the specified chat. This API can&apos;t create a new chat; you must use the list chats method to retrieve the ID of an existing chat before you can create a chat message.
88+
/// Find more info here <see href="https://docs.microsoft.com/graph/api/chat-post-messages?view=graph-rest-1.0" />
8989
/// </summary>
9090
/// <param name="body">The request body</param>
9191
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
@@ -132,7 +132,7 @@ public RequestInformation ToGetRequestInformation(Action<MessagesRequestBuilderG
132132
return requestInfo;
133133
}
134134
/// <summary>
135-
/// Send a new chatMessage in the specified channel or a chat.
135+
/// Send a new chatMessage in the specified chat. This API can&apos;t create a new chat; you must use the list chats method to retrieve the ID of an existing chat before you can create a chat message.
136136
/// </summary>
137137
/// <param name="body">The request body</param>
138138
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>

src/Microsoft.Graph/Generated/Communications/Calls/Item/Participants/Invite/InviteRequestBuilder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public InviteRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) {
4747
RequestAdapter = requestAdapter;
4848
}
4949
/// <summary>
50-
/// Invite participants to the active call. For more information about how to handle operations, see commsOperation.
51-
/// Find more info here <see href="https://docs.microsoft.com/graph/api/participant-invite?view=graph-rest-1.0" />
50+
/// Delete a specific participant in a call. In some situations, it is appropriate for an application to remove a participant from an active call. This action can be done before or after the participant answers the call. When an active caller is removed, they are immediately dropped from the call with no pre- or post-removal notification. When an invited participant is removed, any outstanding add participant request is canceled.
51+
/// Find more info here <see href="https://docs.microsoft.com/graph/api/participant-delete?view=graph-rest-1.0" />
5252
/// </summary>
5353
/// <param name="body">The request body</param>
5454
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
@@ -69,7 +69,7 @@ public async Task<InviteParticipantsOperation> PostAsync(InvitePostRequestBody b
6969
return await RequestAdapter.SendAsync<InviteParticipantsOperation>(requestInfo, InviteParticipantsOperation.CreateFromDiscriminatorValue, errorMapping, cancellationToken);
7070
}
7171
/// <summary>
72-
/// Invite participants to the active call. For more information about how to handle operations, see commsOperation.
72+
/// Delete a specific participant in a call. In some situations, it is appropriate for an application to remove a participant from an active call. This action can be done before or after the participant answers the call. When an active caller is removed, they are immediately dropped from the call with no pre- or post-removal notification. When an invited participant is removed, any outstanding add participant request is canceled.
7373
/// </summary>
7474
/// <param name="body">The request body</param>
7575
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
using Microsoft.Graph.Models.ODataErrors;
2+
using Microsoft.Kiota.Abstractions;
3+
using Microsoft.Kiota.Abstractions.Serialization;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.IO;
7+
using System.Linq;
8+
using System.Threading;
9+
using System.Threading.Tasks;
10+
namespace Microsoft.Graph.Contacts.Item.MemberOf.GraphAdministrativeUnit.Count {
11+
/// <summary>
12+
/// Provides operations to count the resources in the collection.
13+
/// </summary>
14+
public class CountRequestBuilder {
15+
/// <summary>Path parameters for the request</summary>
16+
private Dictionary<string, object> PathParameters { get; set; }
17+
/// <summary>The request adapter to use to execute the requests.</summary>
18+
private IRequestAdapter RequestAdapter { get; set; }
19+
/// <summary>Url template to use to build the URL for the current request builder</summary>
20+
private string UrlTemplate { get; set; }
21+
/// <summary>
22+
/// Instantiates a new CountRequestBuilder and sets the default values.
23+
/// </summary>
24+
/// <param name="pathParameters">Path parameters for the request</param>
25+
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
26+
public CountRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) {
27+
_ = pathParameters ?? throw new ArgumentNullException(nameof(pathParameters));
28+
_ = requestAdapter ?? throw new ArgumentNullException(nameof(requestAdapter));
29+
UrlTemplate = "{+baseurl}/contacts/{orgContact%2Did}/memberOf/graph.administrativeUnit/$count{?%24search,%24filter}";
30+
var urlTplParams = new Dictionary<string, object>(pathParameters);
31+
PathParameters = urlTplParams;
32+
RequestAdapter = requestAdapter;
33+
}
34+
/// <summary>
35+
/// Instantiates a new CountRequestBuilder and sets the default values.
36+
/// </summary>
37+
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
38+
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
39+
public CountRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) {
40+
if(string.IsNullOrEmpty(rawUrl)) throw new ArgumentNullException(nameof(rawUrl));
41+
_ = requestAdapter ?? throw new ArgumentNullException(nameof(requestAdapter));
42+
UrlTemplate = "{+baseurl}/contacts/{orgContact%2Did}/memberOf/graph.administrativeUnit/$count{?%24search,%24filter}";
43+
var urlTplParams = new Dictionary<string, object>();
44+
if (!string.IsNullOrWhiteSpace(rawUrl)) urlTplParams.Add("request-raw-url", rawUrl);
45+
PathParameters = urlTplParams;
46+
RequestAdapter = requestAdapter;
47+
}
48+
/// <summary>
49+
/// Get the number of the resource
50+
/// </summary>
51+
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
52+
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
53+
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
54+
#nullable enable
55+
public async Task<int?> GetAsync(Action<CountRequestBuilderGetRequestConfiguration>? requestConfiguration = default, CancellationToken cancellationToken = default) {
56+
#nullable restore
57+
#else
58+
public async Task<int?> GetAsync(Action<CountRequestBuilderGetRequestConfiguration> requestConfiguration = default, CancellationToken cancellationToken = default) {
59+
#endif
60+
var requestInfo = ToGetRequestInformation(requestConfiguration);
61+
var errorMapping = new Dictionary<string, ParsableFactory<IParsable>> {
62+
{"4XX", ODataError.CreateFromDiscriminatorValue},
63+
{"5XX", ODataError.CreateFromDiscriminatorValue},
64+
};
65+
return await RequestAdapter.SendPrimitiveAsync<int?>(requestInfo, errorMapping, cancellationToken);
66+
}
67+
/// <summary>
68+
/// Get the number of the resource
69+
/// </summary>
70+
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
71+
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
72+
#nullable enable
73+
public RequestInformation ToGetRequestInformation(Action<CountRequestBuilderGetRequestConfiguration>? requestConfiguration = default) {
74+
#nullable restore
75+
#else
76+
public RequestInformation ToGetRequestInformation(Action<CountRequestBuilderGetRequestConfiguration> requestConfiguration = default) {
77+
#endif
78+
var requestInfo = new RequestInformation {
79+
HttpMethod = Method.GET,
80+
UrlTemplate = UrlTemplate,
81+
PathParameters = PathParameters,
82+
};
83+
requestInfo.Headers.Add("Accept", "text/plain");
84+
if (requestConfiguration != null) {
85+
var requestConfig = new CountRequestBuilderGetRequestConfiguration();
86+
requestConfiguration.Invoke(requestConfig);
87+
requestInfo.AddQueryParameters(requestConfig.QueryParameters);
88+
requestInfo.AddRequestOptions(requestConfig.Options);
89+
requestInfo.AddHeaders(requestConfig.Headers);
90+
}
91+
return requestInfo;
92+
}
93+
/// <summary>
94+
/// Get the number of the resource
95+
/// </summary>
96+
public class CountRequestBuilderGetQueryParameters {
97+
/// <summary>Filter items by property values</summary>
98+
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
99+
#nullable enable
100+
[QueryParameter("%24filter")]
101+
public string? Filter { get; set; }
102+
#nullable restore
103+
#else
104+
[QueryParameter("%24filter")]
105+
public string Filter { get; set; }
106+
#endif
107+
/// <summary>Search items by search phrases</summary>
108+
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
109+
#nullable enable
110+
[QueryParameter("%24search")]
111+
public string? Search { get; set; }
112+
#nullable restore
113+
#else
114+
[QueryParameter("%24search")]
115+
public string Search { get; set; }
116+
#endif
117+
}
118+
/// <summary>
119+
/// Configuration for the request such as headers, query parameters, and middleware options.
120+
/// </summary>
121+
public class CountRequestBuilderGetRequestConfiguration {
122+
/// <summary>Request headers</summary>
123+
public RequestHeaders Headers { get; set; }
124+
/// <summary>Request options</summary>
125+
public IList<IRequestOption> Options { get; set; }
126+
/// <summary>Request query parameters</summary>
127+
public CountRequestBuilderGetQueryParameters QueryParameters { get; set; } = new CountRequestBuilderGetQueryParameters();
128+
/// <summary>
129+
/// Instantiates a new CountRequestBuilderGetRequestConfiguration and sets the default values.
130+
/// </summary>
131+
public CountRequestBuilderGetRequestConfiguration() {
132+
Options = new List<IRequestOption>();
133+
Headers = new RequestHeaders();
134+
}
135+
}
136+
}
137+
}

0 commit comments

Comments
 (0)