public async Task <T> Delete(string webApi) { string baseUrl = BaseRestService.GetConnectionStringByName(false); using (RestService <T> restService = new RestService <T>(baseUrl)) { return(await restService.DELETEAsync(webApi)); } }
public async Task <T> GetById(string webApi) { string baseUrl = BaseRestService.GetConnectionStringByName(false); using (RestService <T> restService = new RestService <T>(baseUrl)) { return(await restService.POSTAsync(webApi, null, false)); } }
public async Task <bool> DeleteAuthor(int id) { string baseUrl = BaseRestService.GetConnectionStringByName(false); using (RestService <bool> restService = new RestService <bool>(baseUrl)) { return(await restService.DELETEAsync(webApi)); } }
public async Task <IEnumerable <AuthorListDTO> > GetAllAuthors() { string baseUrl = BaseRestService.GetConnectionStringByName(false); using (RestService <IEnumerable <AuthorListDTO> > restService = new RestService <IEnumerable <AuthorListDTO> >(baseUrl)) { return(await restService.GETAsync(webApi)); } }
public async Task <bool> CreateAuthor(AuthorDTO author, bool isNewItem) { string baseUrl = BaseRestService.GetConnectionStringByName(false); using RestService <bool> restService = new RestService <bool>(baseUrl); if (isNewItem) { return(await restService.POSTAsync(webApi, author, false)); } else { return(await restService.POSTAsync(webApi, author, true)); } }
/// <summary> /// Instantiate a new Scryfall API client. /// </summary> /// <param name="httpClient"></param> /// <param name="clientConfig"></param> /// <param name="cache"></param> public ScryfallApiClient(HttpClient httpClient, ScryfallApiClientConfig clientConfig = null, IMemoryCache cache = null) { if (clientConfig is null) { clientConfig = ScryfallApiClientConfig.GetDefault(); clientConfig.EnableCaching = cache is not null; } var restService = new BaseRestService(httpClient, clientConfig, cache); _cards = new Lazy <ICards>(() => new Cards(restService)); _catalogs = new Lazy <ICatalogs>(() => new Catalogs(restService)); _sets = new Lazy <ISets>(() => new Sets(restService)); _symbology = new Lazy <ISymbology>(() => new Symbology(restService)); }
public async Task <T> Create(T entity, bool isNewItem, string webApi) { string baseUrl = BaseRestService.GetConnectionStringByName(false); using (RestService <T> restService = new RestService <T>(baseUrl)) { if (isNewItem) { return(await restService.POSTAsync(webApi, entity, false)); } else { return(await restService.POSTAsync(webApi, entity, true)); } } }
/// <summary> /// /// </summary> /// <returns></returns> public HttpRequestMessage CreateRequest(BaseRestService service) { HttpRequestMessage request = new HttpRequestMessage(new HttpMethod(StringValueAttribute.GetStringValue(this.HttpMethod)), BuildUrl()); request.Headers.Authorization = new AuthenticationHeaderValue("Basic", Utilities.EncodeCredentials(service.Credentials.ApiKey, service.Credentials.SecretKey)); request.Headers.Add("Y-Client-Type", ".NET"); request.Headers.Add("Y-Client-Info", service.GetType().GetTypeInfo().Assembly.FullName); #if NETSTANDARD1_3 request.Headers.Add("Y-Client-Platform", System.Runtime.InteropServices.RuntimeInformation.OSDescription); #else request.Headers.Add("Y-Client-Platform", System.Environment.OSVersion.ToString()); #endif if (service.CustomHeaders != null && service.CustomHeaders.Count > 0) { foreach (var customHeader in service.CustomHeaders) { request.Headers.Add(customHeader.Key, customHeader.Value); } } return(request); }
/// <summary> /// Constructs a new request. /// </summary> /// <param name="service"></param> /// <param name="body"></param> public SubmitRecordsServiceRequest(BaseRestService service, SubmitRecordsRequest body) : base(service) { _body = body; }
/// <summary> /// Constructs a new request. /// </summary> /// <param name="service"></param> /// <param name="body"></param> public DeleteRecordsServiceRequest(BaseRestService service, DeleteRecordsRequest body) : base(service) { _body = body; }
internal Symbology(BaseRestService restService) { _restService = restService; }
/// <summary> /// /// </summary> /// <param name="service"></param> public WorkflowServiceRequest(BaseRestService service) : base(service) { }
internal Catalogs(BaseRestService restService) { _restService = restService; }
internal BulkData(BaseRestService restService) { _restService = restService; }
/// <summary> /// /// </summary> /// <param name="service"></param> public SmppServiceRequest(BaseRestService service) : base(service) { }
/// <summary> /// Constructs a new RestClientServiceRequest. /// </summary> /// <param name="service">Service</param> public RestClientServiceRequest(BaseRestService service) { _service = service; }
internal Sets(BaseRestService restService) { _restService = restService; }
/// <summary> /// Constructs a new request. /// </summary> /// <param name="service"></param> /// <param name="body"></param> public QueryRecordsServiceRequest(BaseRestService service, QueryRecordsRequest body) : base(service) { _body = body; }
internal Cards(BaseRestService restService) { _restService = restService; }
/// <summary> /// Constructs a new RemoteSimServiceRequest. /// </summary> /// <param name="service"></param> /// <param name="body"></param> public RemoteSimServiceRequest(BaseRestService service, RemoteSimRequest body) : base(service) { _body = body; }