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

Add AddRangeExpand method to BaseOptions #1643

Merged
merged 1 commit into from
Jun 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/Stripe.net/Services/_base/BaseOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ public void AddExpand(string value)
this.Expand.Add(value);
}

/// <summary>
/// Adds a collection of <c>expand</c> values to the request, to request expansion of
/// specific fields in the response. When requesting expansions in a list request, don't
/// forget to prefix the field names with <c>data.</c>.
/// </summary>
/// <param name="values">The collection of names of the fields to expand.</param>
public void AddRangeExpand(IEnumerable<string> values)
{
if (this.Expand == null)
{
this.Expand = new List<string>();
}

this.Expand.AddRange(values);
}

/// <summary>
/// Adds an extra parameter to the request. This can be useful if you need to use
/// parameters not available in regular options classes, e.g. for beta features.
Expand Down
5 changes: 1 addition & 4 deletions src/Stripe.net/Services/_base/Service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,7 @@ protected BaseOptions SetupOptions(BaseOptions options, bool isListMethod)
}

options = options ?? new BaseOptions();
foreach (var expansion in serviceExpansions)
{
options.AddExpand(expansion);
}
options.AddRangeExpand(serviceExpansions);

return options;
}
Expand Down