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

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

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

            return(RequestAsync(HttpMethod.Delete, BuildSchemaUrl($"{id}/", false), ct: ct));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 7
0
        public Task <TEntity> UpdateAsync(TEntity entity, CancellationToken ct = default)
        {
            Guard.NotNull(entity, nameof(entity));

            return(UpdateAsync(entity.Id, entity.Data, ct));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 9
0
        public Task <TEntity> DeleteDraftAsync(TEntity entity, CancellationToken ct = default)
        {
            Guard.NotNull(entity, nameof(entity));

            return(DeleteDraftAsync(entity.Id, ct));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 12
0
        public Task DeleteAsync(string id)
        {
            Guard.NotNullOrEmpty(id, nameof(id));

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

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

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