public void ChangeRoute(string route) { request.Url = Device.RuntimePlatform == Device.Android ? AppResources.ApiUrlAndroid : AppResources.ApiUrl; request.AppendPathSegment(route); }
public Search(IFlurlRequest req, string searchTerm, int page, string[] searchCategory, string[] searchFilter) { this.req = req; this.searchTerm = searchTerm; this.page = page; this.searchCategory = searchCategory; this.searchFilter = searchFilter; req .AppendPathSegment("search") .SetQueryParam("searchTerm", searchTerm) .SetQueryParam("searchCategory", "all") .SetQueryParam("searchFilters", "[]") .SetQueryParam("page", page); }
public async Task <bool> CreateAsync(Action <IndexInfo <TSource> > index, CancellationToken cancellationToken = default) { object message = _createMessage(index); IFlurlRequest request = _database.NewRequest(); IndexSaveResponse response = await request .AppendPathSegment("_index") .PostJsonAsync(message, cancellationToken) .ReceiveJson <IndexSaveResponse>() .SendRequestAsync() .ConfigureAwait(false); return("created" == response.Result); }
public async Task <bool> CreateOrUpdateAsync(Action <IndexInfo <TSource> > index, CancellationToken cancellationToken = default) { IFlurlRequest request = _database.NewRequest(); IndexDesignResponse response = await request .AppendPathSegment("_index") .GetJsonAsync <IndexDesignResponse>() .SendRequestAsync() .ConfigureAwait(false); var message = _createMessage(index); var currentIndex = response.Indexes.FirstOrDefault(x => x.Name == message.Name); if (currentIndex != null) { await Delete(currentIndex.DDoc, currentIndex.Name, cancellationToken).ConfigureAwait(false); } return(await CreateAsync(index, cancellationToken).ConfigureAwait(false)); }
public async Task <T> GetById <T>(object id) { IFlurlRequest request = getPath(); return(await request.AppendPathSegment($"/{id}").GetJsonAsync <T>()); }
public void ChangeRoute(string route) { request.Url = Settings.Default.ApiUrl; request.AppendPathSegment(route); }