Exemplo n.º 1
0
        public async Task UpdateAttributes(
            Guid layoutGuid,
            PlacementsSelector selector,
            string?identification = null,
            List <AttributeValuePart>?valueParts = null)
        {
            var url     = ApiPrefix + $"/layouts/{layoutGuid}/Placements/Attributes";
            var request = new
            {
                Selector       = selector,
                Identification = identification,
                ValueParts     = valueParts
            };
            var content  = CreateJsonContent(request);
            var response = await _client.PutAsync(url, content);

            if (!response.IsSuccessStatusCode)
            {
                throw new Exception(await response.Content.ReadAsStringAsync());
            }
        }
Exemplo n.º 2
0
        public async Task UpdateMarkedForDeletion(
            Guid layoutGuid,
            PlacementsSelector selector,
            bool markedForDeletion)
        {
            var url           = ApiPrefix + $"/layouts/{layoutGuid}/Placements/Attributes";
            var deletionValue = markedForDeletion ? "X" : string.Empty;
            var request       = new
            {
                Selector     = selector,
                DataLanguage = "en-US",
                ValueParts   = new[]
                {
                    new { Name = "MarkedForDeletion", Language = default(string), Value = deletionValue, Index = default(int), Description = default(string) }
                }
            };
            var content  = CreateJsonContent(request);
            var response = await _client.PutAsync(url, content);

            if (!response.IsSuccessStatusCode)
            {
                throw new Exception(await response.Content.ReadAsStringAsync());
            }
        }