Skip to content

Commit

Permalink
adds changelog entry. format code
Browse files Browse the repository at this point in the history
  • Loading branch information
andrueastman committed Sep 25, 2024
1 parent 64a4b43 commit b91a70a
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 58 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.13.0] - 2024-09-25

### Changed

- Adds extension methods for make serializing easier [#338](https://github.com/microsoft/kiota-dotnet/issues/338).

## [1.12.4] - 2024-09-05

Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<!-- Common default project properties for ALL projects-->
<PropertyGroup>
<VersionPrefix>1.12.4</VersionPrefix>
<VersionPrefix>1.13.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<!-- This is overidden in test projects by setting to true-->
<IsTestProject>false</IsTestProject>
Expand Down
114 changes: 57 additions & 57 deletions src/abstractions/serialization/ParsableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,67 +15,67 @@ namespace Microsoft.Kiota.Serialization;
/// </summary>
public static class ParsableExtensions
{
/// <summary>
/// Serializes the given object into a stream based on the content type.
/// </summary>
/// <param name="contentType">Content type to serialize the object t </param>
/// <param name="value">The object to serialize.</param>
/// <param name="serializeOnlyChangedValues">If this object uses the <see cref="Microsoft.Kiota.Abstractions.Store.IBackingStore"/>, use this to control if you want all properties or just the changed once.</param>
/// <returns>The serialized representation as a stream.</returns>
public static Stream SerializeAsStream<T>(this T value, string contentType, bool serializeOnlyChangedValues = false) where T : IParsable
=> KiotaSerializer.SerializeAsStream(contentType, value, serializeOnlyChangedValues);
/// <summary>
/// Serializes the given object into a stream based on the content type.
/// </summary>
/// <param name="contentType">Content type to serialize the object t </param>
/// <param name="value">The object to serialize.</param>
/// <param name="serializeOnlyChangedValues">If this object uses the <see cref="Microsoft.Kiota.Abstractions.Store.IBackingStore"/>, use this to control if you want all properties or just the changed once.</param>
/// <returns>The serialized representation as a stream.</returns>
public static Stream SerializeAsStream<T>(this T value, string contentType, bool serializeOnlyChangedValues = false) where T : IParsable
=> KiotaSerializer.SerializeAsStream(contentType, value, serializeOnlyChangedValues);


/// <summary>
/// Serializes the given object into a string based on the content type.
/// </summary>
/// <param name="contentType">Content type to serialize the object to </param>
/// <param name="value">The object to serialize.</param>
/// <param name="serializeOnlyChangedValues">If this object uses the <see cref="Microsoft.Kiota.Abstractions.Store.IBackingStore"/>, use this to control if you want all properties or just the changed once.</param>
/// <param name="cancellationToken">Cancel the request during execution.</param>
/// <returns>The serialized representation as a string.</returns>
public static async Task<string> SerializeAsStringAsync<T>(this T value, string contentType, bool serializeOnlyChangedValues = false, CancellationToken cancellationToken = default) where T : IParsable
=> await KiotaSerializer.SerializeAsStringAsync(contentType, value, serializeOnlyChangedValues, cancellationToken);
/// <summary>
/// Serializes the given object into a string based on the content type.
/// </summary>
/// <param name="contentType">Content type to serialize the object to </param>
/// <param name="value">The object to serialize.</param>
/// <param name="serializeOnlyChangedValues">If this object uses the <see cref="Microsoft.Kiota.Abstractions.Store.IBackingStore"/>, use this to control if you want all properties or just the changed once.</param>
/// <param name="cancellationToken">Cancel the request during execution.</param>
/// <returns>The serialized representation as a string.</returns>
public static async Task<string> SerializeAsStringAsync<T>(this T value, string contentType, bool serializeOnlyChangedValues = false, CancellationToken cancellationToken = default) where T : IParsable
=> await KiotaSerializer.SerializeAsStringAsync(contentType, value, serializeOnlyChangedValues, cancellationToken);

/// <summary>
/// Serializes the given collection into a stream based on the content type.
/// </summary>
/// <param name="contentType">Content type to serialize the object t </param>
/// <param name="value">The object to serialize.</param>
/// <param name="serializeOnlyChangedValues">If this object uses the <see cref="Microsoft.Kiota.Abstractions.Store.IBackingStore"/>, use this to control if you want all properties or just the changed once.</param>
/// <returns>The serialized representation as a stream.</returns>
public static Stream SerializeAsStream<T>(this IEnumerable<T> value, string contentType, bool serializeOnlyChangedValues = false) where T : IParsable
=> KiotaSerializer.SerializeAsStream(contentType, value, serializeOnlyChangedValues);
/// <summary>
/// Serializes the given collection into a stream based on the content type.
/// </summary>
/// <param name="contentType">Content type to serialize the object t </param>
/// <param name="value">The object to serialize.</param>
/// <param name="serializeOnlyChangedValues">If this object uses the <see cref="Microsoft.Kiota.Abstractions.Store.IBackingStore"/>, use this to control if you want all properties or just the changed once.</param>
/// <returns>The serialized representation as a stream.</returns>
public static Stream SerializeAsStream<T>(this IEnumerable<T> value, string contentType, bool serializeOnlyChangedValues = false) where T : IParsable
=> KiotaSerializer.SerializeAsStream(contentType, value, serializeOnlyChangedValues);

/// <summary>
/// Serializes the given collection into a string based on the content type.
/// </summary>
/// <param name="contentType">Content type to serialize the object to.</param>
/// <param name="value">The object to serialize.</param>
/// <param name="serializeOnlyChangedValues">If this object uses the <see cref="Microsoft.Kiota.Abstractions.Store.IBackingStore"/>, use this to control if you want all properties or just the changed once.</param>
/// <param name="cancellationToken">Cancel the request during execution.</param>
/// <returns>The serialized representation as a string.</returns>
public static async Task<string> SerializeAsStringAsync<T>(this IEnumerable<T> value, string contentType, bool serializeOnlyChangedValues = false, CancellationToken cancellationToken = default) where T : IParsable
=> await KiotaSerializer.SerializeAsStringAsync(contentType, value, serializeOnlyChangedValues, cancellationToken);
/// <summary>
/// Serializes the given collection into a string based on the content type.
/// </summary>
/// <param name="contentType">Content type to serialize the object to.</param>
/// <param name="value">The object to serialize.</param>
/// <param name="serializeOnlyChangedValues">If this object uses the <see cref="Microsoft.Kiota.Abstractions.Store.IBackingStore"/>, use this to control if you want all properties or just the changed once.</param>
/// <param name="cancellationToken">Cancel the request during execution.</param>
/// <returns>The serialized representation as a string.</returns>
public static async Task<string> SerializeAsStringAsync<T>(this IEnumerable<T> value, string contentType, bool serializeOnlyChangedValues = false, CancellationToken cancellationToken = default) where T : IParsable
=> await KiotaSerializer.SerializeAsStringAsync(contentType, value, serializeOnlyChangedValues, cancellationToken);

/// <summary>
/// Serializes the given collection into a stream based on the content type.
/// </summary>
/// <param name="contentType">Content type to serialize the object t </param>
/// <param name="value">The object to serialize.</param>
/// <param name="serializeOnlyChangedValues">If this object uses the <see cref="Microsoft.Kiota.Abstractions.Store.IBackingStore"/>, use this to control if you want all properties or just the changed once.</param>
/// <returns>The serialized representation as a stream.</returns>
public static Stream SerializeAsStream<T>(this T[] value, string contentType, bool serializeOnlyChangedValues = false) where T : IParsable
=> KiotaSerializer.SerializeAsStream(contentType, value, serializeOnlyChangedValues);
/// <summary>
/// Serializes the given collection into a stream based on the content type.
/// </summary>
/// <param name="contentType">Content type to serialize the object t </param>
/// <param name="value">The object to serialize.</param>
/// <param name="serializeOnlyChangedValues">If this object uses the <see cref="Microsoft.Kiota.Abstractions.Store.IBackingStore"/>, use this to control if you want all properties or just the changed once.</param>
/// <returns>The serialized representation as a stream.</returns>
public static Stream SerializeAsStream<T>(this T[] value, string contentType, bool serializeOnlyChangedValues = false) where T : IParsable
=> KiotaSerializer.SerializeAsStream(contentType, value, serializeOnlyChangedValues);

/// <summary>
/// Serializes the given collection into a string based on the content type.
/// </summary>
/// <param name="contentType">Content type to serialize the object to.</param>
/// <param name="value">The object to serialize.</param>
/// <param name="serializeOnlyChangedValues">If this object uses the <see cref="Microsoft.Kiota.Abstractions.Store.IBackingStore"/>, use this to control if you want all properties or just the changed once.</param>
/// <param name="cancellationToken">Cancel the request during execution.</param>
/// <returns>The serialized representation as a string.</returns>
public static async Task<string> SerializeAsStringAsync<T>(this T[] value, string contentType, bool serializeOnlyChangedValues = false, CancellationToken cancellationToken = default) where T : IParsable
=> await KiotaSerializer.SerializeAsStringAsync(contentType, value, serializeOnlyChangedValues, cancellationToken);
/// <summary>
/// Serializes the given collection into a string based on the content type.
/// </summary>
/// <param name="contentType">Content type to serialize the object to.</param>
/// <param name="value">The object to serialize.</param>
/// <param name="serializeOnlyChangedValues">If this object uses the <see cref="Microsoft.Kiota.Abstractions.Store.IBackingStore"/>, use this to control if you want all properties or just the changed once.</param>
/// <param name="cancellationToken">Cancel the request during execution.</param>
/// <returns>The serialized representation as a string.</returns>
public static async Task<string> SerializeAsStringAsync<T>(this T[] value, string contentType, bool serializeOnlyChangedValues = false, CancellationToken cancellationToken = default) where T : IParsable
=> await KiotaSerializer.SerializeAsStringAsync(contentType, value, serializeOnlyChangedValues, cancellationToken);
}

0 comments on commit b91a70a

Please sign in to comment.