Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 5.24.0 #2095

Merged
merged 10 commits into from
Aug 24, 2023
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ and this project does adheres to [Semantic Versioning](https://semver.org/spec/v

## [Unreleased]

## [5.22.0] - 2023-08-16
## [5.24.0] - 2023-08-23

- Adds GraphServiceClient constructor for use with a `TokenCredential` and a `HttpClient`.
- Fix for incorrect discriminator in DirectoryObject type (https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/2084).
- Fix for incorrect property names when the reserved names matched the type name (https://github.com/microsoft/kiota/pull/3107).
- Fix for missing PlannerCheckListItem and PlannerExternalReference models (https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/2050).
- Latest metadata updates from 22nd August 2023.

## [5.23.0] - 2023-08-16

- Fix for incorrect property names when the reserved names matched the type name (https://github.com/microsoft/kiota/pull/3107).
- Latest metadata updates from 15th August 2023.
Expand Down
2 changes: 1 addition & 1 deletion docs/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ catch (ODataError odataError)
You can check the status code that caused the error as below.

```csharp
catch (ODataError odataError) when (odataError.ResponseStatusCode.Equals(HttpStatusCode.NotFound))
catch (ODataError odataError) when (odataError.ResponseStatusCode == (int)HttpStatusCode.NotFound)
{
// Handle 404 status code
}
Expand Down
49 changes: 48 additions & 1 deletion docs/upgrade-to-v5.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,53 @@ await pageIterator.IterateAsync();

```

### `$skipToken` and `$deltaToken` query parameters in delta requests
Given the API guidance [here](https://github.com/microsoft/api-guidelines/blob/vNext/graph/patterns/change-tracking.md#considerations), the metadata used to generate the SDK does not include the `$skipToken` and `$deltaToken` query parameters.
The entire url is documented as opaque and the change of the url structure (e.g. using alternative query parameters) is not considered a breaking change.
Due to this, urls returned from a delta response should be used entirely by either

1. Using the inbuilt request builders to make subsequent requests from the `@odata.nexlink`(OdataDeltaLink property) or `@odata.deltaLink`(OdataNextLink property) returned from the delta request.
```cs
// make the first request
var deltaResponse = await graphClient.Groups.Delta.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Select = new string[] { "displayName", "description", "mailNickname" };
});

// use the deltaResponse.OdataDeltaLink/deltaResponse.OdataNextLink to make the next request.
var deltaRequest = new Microsoft.Graph.Beta.Groups.Delta.DeltaRequestBuilder(deltaResponse.OdataDeltaLink, graphClient.RequestAdapter);
var secondDeltaResponse = await deltaRequest.GetAsync();
```
1. Using the PageIterator
```cs
//fetch the first page of groups
var deltaResponse = await graphClient.Groups.Delta.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Select = new string[] { "displayName", "description", "mailNickname" };
});

// create a list to hold the groups
var groups = new List<Group>();
// create a page iterator to iterate through the pages of the response
var pageIterator = PageIterator<Group, Microsoft.Graph.Beta.Groups.Delta.DeltaResponse>.CreatePageIterator(graphClient, deltaResponse, group =>
{
groups.Add(group);
return true;
});

// This will iterate follow through the odata.nextLink until the last page is reached with an odata.deltaLink
await pageIterator.IterateAsync();

if (pageIterator.State == PagingState.Delta)
{
await Task.Delay(30000);// wait for some time for changes to occur.
// call delta again with the deltaLink to get the next page of results
Console.WriteLine("Calling delta again with deltaLink");
Console.WriteLine("DeltaLink url is: " + pageIterator.Deltalink);
await pageIterator.IterateAsync();
}
```

### Error handling
Errors and exceptions from the new generated version will be exception classed derived from the [ApiException](https://github.com/microsoft/kiota-abstractions-dotnet/blob/8a136e509c7a71ef889643f047938bdbc3c752be/src/ApiException.cs#L11) class from the Kiota abstrations library.
Typically, this will be an instance of [OdataError](https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/6d1a78fe1ca7d883667b5f231395651e24581653/src/Microsoft.Graph/Generated/Models/ODataErrors/ODataError.cs#L9) and can be handled as below.
Expand Down Expand Up @@ -226,7 +273,7 @@ var children = await graphServiceClient.Drives[userDriveId].Items["itemId"].Chil

> NOTE: /drive/root is a shorthand for /drive/items/root so the `itemId` can be replaced with `root` to make a call to get the root folder.

```
```cs
// List children in the root drive
var children = await graphServiceClient.Drives[userDriveId].Items["root"].Children.GetAsync();
```
Expand Down
23 changes: 23 additions & 0 deletions src/Microsoft.Graph/Extensions/PlannerAssignment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,25 @@ public string OrderHint {
set { BackingStore?.Set("orderHint", value); }
}
#endif
/// <summary>Read-only. User ID by which this is last modified.</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public IdentitySet? AssignedBy {
get { return BackingStore?.Get<IdentitySet>("assignedBy"); }
set { BackingStore?.Set("assignedBy", value); }
}
#nullable restore
#else
public IdentitySet AssignedBy {
get { return BackingStore?.Get<IdentitySet>("assignedBy"); }
set { BackingStore?.Set("assignedBy", value); }
}
#endif

public DateTimeOffset? AssignedDateTime {
get { return BackingStore?.Get<DateTimeOffset?>("assignedDateTime"); }
set { BackingStore?.Set("assignedDateTime", value); }
}
/// <summary>
/// Instantiates a new auditActivityInitiator and sets the default values.
/// </summary>
Expand All @@ -70,6 +89,8 @@ public IDictionary<string, Action<IParseNode>> GetFieldDeserializers() {
return new Dictionary<string, Action<IParseNode>> {
{"@odata.type", n => { OdataType = n.GetStringValue(); } },
{"orderHint", n => { OrderHint = n.GetStringValue(); } },
{"assignedBy", n => { AssignedBy = n.GetObjectValue(IdentitySet.CreateFromDiscriminatorValue); } },
{"assignedDateTime", n => { AssignedDateTime = n.GetDateTimeOffsetValue(); } },
};
}
/// <summary>
Expand All @@ -80,6 +101,8 @@ public void Serialize(ISerializationWriter writer) {
_ = writer ?? throw new ArgumentNullException(nameof(writer));
writer.WriteStringValue("@odata.type", OdataType);
writer.WriteStringValue("orderHint", OrderHint);
writer.WriteObjectValue("assignedBy", AssignedBy);
writer.WriteDateTimeOffsetValue("assignedDateTime", AssignedDateTime);
writer.WriteAdditionalData(AdditionalData);
}
}
130 changes: 130 additions & 0 deletions src/Microsoft.Graph/Extensions/PlannerCheckListItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------

using Microsoft.Kiota.Abstractions.Serialization;
using Microsoft.Kiota.Abstractions.Store;
using System;
using System.Collections.Generic;

namespace Microsoft.Graph.Models;

public class PlannerCheckListItem: IAdditionalDataHolder, IBackedModel, IParsable
{
/// <summary>Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.</summary>
public IDictionary<string, object> AdditionalData {
get { return BackingStore?.Get<IDictionary<string, object>>("additionalData"); }
set { BackingStore?.Set("additionalData", value); }
}
/// <summary>Stores model information.</summary>
public IBackingStore BackingStore { get; private set; }
/// <summary>The OdataType property</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public string? OdataType {
get { return BackingStore?.Get<string?>("@odata.type"); }
set { BackingStore?.Set("@odata.type", value); }
}
#nullable restore
#else
public string OdataType {
get { return BackingStore?.Get<string>("@odata.type"); }
set { BackingStore?.Set("@odata.type", value); }
}
#endif
/// <summary>Value is true if the item is checked and false otherwise.</summary>
public bool? IsChecked {
get { return BackingStore?.Get<bool>("isChecked"); }
set { BackingStore?.Set("isChecked", value); }
}
/// <summary>Read-only. User ID by which this is last modified.</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public IdentitySet? LastModifiedBy {
get { return BackingStore?.Get<IdentitySet>("lastModifiedBy"); }
set { BackingStore?.Set("lastModifiedBy", value); }
}
#nullable restore
#else
public IdentitySet LastModifiedBy {
get { return BackingStore?.Get<IdentitySet>("lastModifiedBy"); }
set { BackingStore?.Set("lastModifiedBy", value); }
}
#endif
/// <summary>Read-only. Date and time at which this is last modified. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z.</summary>
public DateTimeOffset? LastModifiedDateTime {
get { return BackingStore?.Get<DateTimeOffset?>("lastModifiedDateTime"); }
set { BackingStore?.Set("lastModifiedDateTime", value); }
}
/// <summary>Used to set the relative order of items in the checklist. The format is defined as outlined here..</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public string? OrderHint {
get { return BackingStore?.Get<string?>("orderHint"); }
set { BackingStore?.Set("orderHint", value); }
}
#nullable restore
#else
public string OrderHint {
get { return BackingStore?.Get<string>("orderHint"); }
set { BackingStore?.Set("orderHint", value); }
}
#endif
/// <summary>Title of the checklist item.</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public string? Title {
get { return BackingStore?.Get<string?>("title"); }
set { BackingStore?.Set("title", value); }
}
#nullable restore
#else
public string Title {
get { return BackingStore?.Get<string>("title"); }
set { BackingStore?.Set("title", value); }
}
#endif
/// <summary>
/// Instantiates a new auditActivityInitiator and sets the default values.
/// </summary>
public PlannerCheckListItem() {
BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore();
AdditionalData = new Dictionary<string, object>();
OdataType = "#microsoft.graph.plannerChecklistItem";
}
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// </summary>
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
public static PlannerCheckListItem CreateFromDiscriminatorValue(IParseNode parseNode) {
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
return new PlannerCheckListItem();
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
public IDictionary<string, Action<IParseNode>> GetFieldDeserializers() {
return new Dictionary<string, Action<IParseNode>> {
{"@odata.type", n => { OdataType = n.GetStringValue(); } },
{"isChecked", n => { IsChecked = n.GetBoolValue(); } },
{"lastModifiedBy", n => { LastModifiedBy = n.GetObjectValue(IdentitySet.CreateFromDiscriminatorValue); } },
{"lastModifiedDateTime", n => { LastModifiedDateTime = n.GetDateTimeOffsetValue(); } },
{"orderHint", n => { OrderHint = n.GetStringValue(); } },
{"title", n => { Title = n.GetStringValue(); } },
};
}
/// <summary>
/// Serializes information the current object
/// </summary>
/// <param name="writer">Serialization writer to use to serialize this model</param>
public void Serialize(ISerializationWriter writer) {
_ = writer ?? throw new ArgumentNullException(nameof(writer));
writer.WriteStringValue("@odata.type", OdataType);
writer.WriteBoolValue("isChecked", IsChecked);
writer.WriteObjectValue("lastModifiedBy", LastModifiedBy);
writer.WriteDateTimeOffsetValue("lastModifiedDateTime", LastModifiedDateTime);
writer.WriteStringValue("orderHint", OrderHint);
writer.WriteStringValue("title", Title);
writer.WriteAdditionalData(AdditionalData);
}
}
Loading