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

chore: obsolete old methods that can be handled with SendAsyc<TResp, TReq>() #326

Merged
merged 7 commits into from
Nov 8, 2023
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
2 changes: 2 additions & 0 deletions src/FMData.Rest/FileMakerRestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ public async Task<IResponse> LogoutAsync()

#region Special Implementations
/// <inheritdoc />
[Obsolete("Use SendAsync<TResponse, TRequest>() instead. See also: https://github.com/fuzzzerd/fmdata/pull/326")]
public override async Task<IEnumerable<T>> FindAsync<T>(
string layout,
Dictionary<string, string> req)
Expand Down Expand Up @@ -308,6 +309,7 @@ public override async Task<IEnumerable<T>> FindAsync<T>(
/// </summary>
/// <param name="req">The find request field/value dictionary to pass into FileMaker server.</param>
/// <returns>A <see cref="Dictionary{String,String}"/> wrapped in a FindResponse containing both record data and portal data.</returns>
[Obsolete("Use SendAsync<TResponse, TRequest>() instead. See also: https://github.com/fuzzzerd/fmdata/pull/326")]
public override async Task<IFindResponse<Dictionary<string, string>>> SendAsync(IFindRequest<Dictionary<string, string>> req)
{
if (string.IsNullOrEmpty(req.Layout)) throw new ArgumentException("Layout is required on the request.");
Expand Down
2 changes: 2 additions & 0 deletions src/FMData.Xml/FileMakerXmlClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,14 @@ public override Task<T> GetByFileMakerIdAsync<T>(string layout, int fileMakerId,
/// <summary>
/// Find a record using a dictionary of input parameters.
/// </summary>
[Obsolete("Use SendAsync<TResponse, TRequest>() instead. See also: https://github.com/fuzzzerd/fmdata/pull/326")]
public override Task<IFindResponse<Dictionary<string, string>>> SendAsync(IFindRequest<Dictionary<string, string>> req)
{
throw new NotImplementedException();
}

/// <inheritdoc />
[Obsolete("Use SendAsync<TResponse, TRequest>() instead. See also: https://github.com/fuzzzerd/fmdata/pull/326")]
public override Task<IEnumerable<T>> FindAsync<T>(
string layout,
Dictionary<string, string> req)
Expand Down
9 changes: 6 additions & 3 deletions src/FMData/FileMakerApiClientBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public Task<ICreateResponse> CreateAsync<T>(
/// </summary>
/// <param name="database">The database to query.</param>
/// <returns>The names of the layouts in the specified database.</returns>
[Obsolete]
[Obsolete("Cannot call Metadata method on different file than open file. https://github.com/fuzzzerd/fmdata/issues/117")]
public Task<IReadOnlyCollection<LayoutListItem>> GetLayoutsAsync(string database)
{
if (database != FileName)
Expand All @@ -288,7 +288,7 @@ public Task<IReadOnlyCollection<LayoutListItem>> GetLayoutsAsync(string database
/// </summary>
/// <param name="database">The database to query.</param>
/// <returns>The names of the scripts in the specified database.</returns>
[Obsolete]
[Obsolete("Cannot call Metadata method on different file than open file. https://github.com/fuzzzerd/fmdata/issues/117")]
public Task<IReadOnlyCollection<ScriptListItem>> GetScriptsAsync(string database)
{
if (database != FileName)
Expand All @@ -311,7 +311,7 @@ public Task<IReadOnlyCollection<ScriptListItem>> GetScriptsAsync(string database
/// <param name="layout">The layout to get data about.</param>
/// <param name="recordId">Optional RecordId, for getting layout data specific to a record. ValueLists, etc.</param>
/// <returns>An instance of the LayoutMetadata class for the specified layout.</returns>
[Obsolete]
[Obsolete("Cannot call Metadata method on different file than open file. https://github.com/fuzzzerd/fmdata/issues/117")]
public Task<LayoutMetadata> GetLayoutAsync(string database, string layout, int? recordId = null)
{
if (database != FileName)
Expand Down Expand Up @@ -628,6 +628,7 @@ public Task<IResponse> DeleteAsync(
/// <summary>
/// Send a Find Record request to the FileMaker API.
/// </summary>
[Obsolete("Use SendAsync<TResponse, TRequest>() instead. See also: https://github.com/fuzzzerd/fmdata/pull/326")]
public abstract Task<IFindResponse<Dictionary<string, string>>> SendAsync(IFindRequest<Dictionary<string, string>> req);

/// <summary>
Expand Down Expand Up @@ -673,7 +674,9 @@ public virtual async Task<IEnumerable<T>> SendAsync<T>(
Func<TResponse, int, object> modId = null) where TResponse : class, new();

#endregion

/// <inheritdoc />
[Obsolete("Use SendAsync<TResponse, TRequest>() instead. See also: https://github.com/fuzzzerd/fmdata/pull/326")]
public abstract Task<IEnumerable<T>> FindAsync<T>(string layout, Dictionary<string, string> req);

/// <summary>
Expand Down
8 changes: 5 additions & 3 deletions src/FMData/IFileMakerApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public interface IFileMakerApiClient
/// </summary>
/// <param name="database">The database to query.</param>
/// <returns>The names of the layouts in the specified database.</returns>
[Obsolete]
[Obsolete("Cannot call Metadata method on different file than open file. https://github.com/fuzzzerd/fmdata/issues/117")]
Task<IReadOnlyCollection<LayoutListItem>> GetLayoutsAsync(string database);

/// <summary>
Expand All @@ -182,7 +182,7 @@ public interface IFileMakerApiClient
/// <param name="layout">The layout to get data about.</param>
/// <param name="recordId">Optional RecordId, for getting layout data specific to a record. ValueLists, etc.</param>
/// <returns>An instance of the LayoutMetadata class for the specified layout.</returns>
[Obsolete]
[Obsolete("Cannot call Metadata method on different file than open file. https://github.com/fuzzzerd/fmdata/issues/117")]
Task<LayoutMetadata> GetLayoutAsync(string database, string layout, int? recordId = null);

/// <summary>
Expand All @@ -198,7 +198,7 @@ public interface IFileMakerApiClient
/// </summary>
/// <param name="database">The database to query.</param>
/// <returns>The names of the scripts in the specified database.</returns>
[Obsolete]
[Obsolete("Cannot call Metadata method on different file than open file. https://github.com/fuzzzerd/fmdata/issues/117")]
Task<IReadOnlyCollection<ScriptListItem>> GetScriptsAsync(string database);

/// <summary>
Expand Down Expand Up @@ -295,6 +295,7 @@ public interface IFileMakerApiClient
/// <param name="layout"></param>
/// <param name="req"></param>
/// <returns></returns>
[Obsolete("Use SendAsync<TResponse, TRequest>() instead. See also: https://github.com/fuzzzerd/fmdata/pull/326")]
Task<IEnumerable<T>> FindAsync<T>(string layout, Dictionary<string, string> req);
#endregion

Expand Down Expand Up @@ -443,6 +444,7 @@ Task<IEditResponse> UpdateContainerAsync(
/// Find a record or records matching the request.
/// </summary>
/// <param name="req">Find request.</param>
[Obsolete("Use SendAsync<TResponse, TRequest>() instead. See also: https://github.com/fuzzzerd/fmdata/pull/326")]
Task<IFindResponse<Dictionary<string, string>>> SendAsync(IFindRequest<Dictionary<string, string>> req);

/// <summary>
Expand Down
6 changes: 5 additions & 1 deletion tests/FMData.Rest.Tests/Find.SendAsync.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace FMData.Rest.Tests
public class FindRequestTests
{
[Fact]
[Obsolete]
public async Task SendAsync_Find_Should_ReturnData()
{
var fdc = FindTestsHelpers.GetMockedFDC();
Expand All @@ -36,6 +37,7 @@ public async Task SendAsync_EmptyFind_ShouldReturnMany()
}

[Fact]
[Obsolete]
public async Task SendAsync_FindWithoutQuery_ShouldConvertToGetRange_AndReturnMany()
{
var fdc = FindTestsHelpers.GetMockedFDC();
Expand All @@ -46,7 +48,8 @@ public async Task SendAsync_FindWithoutQuery_ShouldConvertToGetRange_AndReturnMa
}

[Fact]
public async Task SendAsync_FindWithoutlayout_ShouldThrowArgumentException()
[Obsolete]
public async Task SendAsync_FindWithoutLayout_ShouldThrowArgumentException()
{
var fdc = FindTestsHelpers.GetMockedFDC();

Expand Down Expand Up @@ -166,6 +169,7 @@ public async Task SendAsyncFind_WithoutLayout_ShouldThrow()
}

[Fact]
[Obsolete]
public async Task SendAsync_Dictionary_WithPortals_ShouldHaveData()
{
// arrange
Expand Down