Added primitive search mechanism in backend.
Began implementing search mechanism for frontend.
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Props.Shop.Framework;
|
||||
|
||||
namespace Props.Shop.Ebay
|
||||
@@ -29,13 +30,16 @@ namespace Props.Shop.Ebay
|
||||
|
||||
private HttpClient httpClient;
|
||||
|
||||
public IEnumerable<IOption> Initialize(byte[] data)
|
||||
public void Initialize(string workspaceDir)
|
||||
{
|
||||
httpClient = new HttpClient();
|
||||
configuration = JsonSerializer.Deserialize<Configuration>(data);
|
||||
return new List<IOption>() {
|
||||
new SandboxOption(configuration),
|
||||
};
|
||||
configuration = new Configuration(); // TODO: Implement config persistence.
|
||||
}
|
||||
|
||||
|
||||
public Task InitializeAsync(string workspaceDir)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
@@ -61,7 +65,7 @@ namespace Props.Shop.Ebay
|
||||
return JsonSerializer.SerializeToUtf8Bytes(configuration);
|
||||
}
|
||||
|
||||
public IAsyncEnumerable<ProductListing> Search(string query, Filters filters)
|
||||
public IEnumerable<ProductListing> Search(string query, Filters filters)
|
||||
{
|
||||
// TODO: Implement the search system.
|
||||
throw new NotImplementedException();
|
||||
|
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using Props.Shop.Framework;
|
||||
|
||||
namespace Props.Shop.Ebay
|
||||
{
|
||||
public class SandboxOption : IOption
|
||||
{
|
||||
private Configuration configuration;
|
||||
public string Name => "Ebay Sandbox";
|
||||
|
||||
public string Description => "For development purposes, Ebay Sandbox allows use of Ebay APIs (with exceptions) in a sandbox environment before applying for production use.";
|
||||
|
||||
public bool Required => true;
|
||||
|
||||
public Type Type => typeof(bool);
|
||||
|
||||
internal SandboxOption(Configuration configuration)
|
||||
{
|
||||
this.configuration = configuration;
|
||||
}
|
||||
|
||||
public string GetValue()
|
||||
{
|
||||
return configuration.Sandbox.ToString();
|
||||
}
|
||||
|
||||
public bool SetValue(string value)
|
||||
{
|
||||
bool sandbox = false;
|
||||
bool res = bool.TryParse(value, out sandbox);
|
||||
configuration.Sandbox = sandbox;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user