Example #1
0
        public async Task DeleteAsync(TEntity entity, CancellationToken ct = default)
        {
            Guard.NotNull(entity, nameof(entity));

            await DeleteAsync(entity.Id, ct);
        }
Example #2
0
        public Task <TEntity> ChangeStatusAsync(TEntity entity, string status, CancellationToken ct = default)
        {
            Guard.NotNull(entity, nameof(entity));

            return(ChangeStatusAsync(entity.Id, status, ct));
        }
Example #3
0
        public Task DeleteAsync(string id, CancellationToken ct = default)
        {
            Guard.NotNullOrEmpty(id, nameof(id));

            return(RequestAsync(HttpMethod.Delete, BuildSchemaUrl($"{id}/", false), ct: ct));
        }
Example #4
0
        public Task <List <BulkResult> > BulkUpdateAsync(BulkUpdate update, CancellationToken ct = default)
        {
            Guard.NotNull(update, nameof(update));

            return(RequestJsonAsync <List <BulkResult> >(HttpMethod.Post, BuildSchemaUrl("bulk", false), update.ToContent(), ct: ct));
        }
Example #5
0
        public Task <TEntity> PatchAsync <TPatch>(TEntity entity, TPatch patch, CancellationToken ct = default)
        {
            Guard.NotNull(entity, nameof(entity));

            return(PatchAsync(entity.Id, patch, ct));
        }
Example #6
0
        public Task <TEntity> UpsertAsync(TEntity entity, bool publish = false, CancellationToken ct = default)
        {
            Guard.NotNull(entity, nameof(entity));

            return(UpsertAsync(entity.Id, entity.Data, publish, ct));
        }
Example #7
0
        public Task <TEntity> UpdateAsync(TEntity entity, CancellationToken ct = default)
        {
            Guard.NotNull(entity, nameof(entity));

            return(UpdateAsync(entity.Id, entity.Data, ct));
        }
Example #8
0
        public Task <TEntity> DeleteDraftAsync(string id, CancellationToken ct = default)
        {
            Guard.NotNullOrEmpty(id, nameof(id));

            return(RequestJsonAsync <TEntity>(HttpMethod.Delete, BuildSchemaUrl($"{id}/draft", false), ct: ct));
        }
Example #9
0
        public Task <TEntity> DeleteDraftAsync(TEntity entity, CancellationToken ct = default)
        {
            Guard.NotNull(entity, nameof(entity));

            return(DeleteDraftAsync(entity.Id, ct));
        }
Example #10
0
        public Task <TEntity> CreateAsync(TData data, string id, bool publish = false, CancellationToken ct = default)
        {
            Guard.NotNull(data, nameof(data));

            return(RequestJsonAsync <TEntity>(HttpMethod.Post, BuildSchemaUrl($"?publish={publish}&id={id ?? string.Empty}", false), data.ToContent(), ct: ct));
        }
Example #11
0
        public Task <TEntity> GetAsync(string id, QueryContext context = null, CancellationToken ct = default)
        {
            Guard.NotNullOrEmpty(id, nameof(id));

            return(RequestJsonAsync <TEntity>(HttpMethod.Get, BuildSchemaUrl($"{id}/", true, context), null, context, ct));
        }
        public Task DeleteAsync(string id)
        {
            Guard.NotNullOrEmpty(id, nameof(id));

            return(RequestAsync(HttpMethod.Delete, $"{id}/"));
        }
        public Task RestoreAsync(string id)
        {
            Guard.NotNullOrEmpty(id, nameof(id));

            return(RequestAsync(HttpMethod.Put, $"{id}/restore/"));
        }
        public Task UnpublishAsync(string id)
        {
            Guard.NotNullOrEmpty(id, nameof(id));

            return(RequestAsync(HttpMethod.Put, $"{id}/unpublish/"));
        }