public ConfigTypeListApiModel(ConfigTypeListServiceModel configTypeList)
        {
            this.ConfigTypes = configTypeList.ConfigTypes;

            this.Metadata = new Dictionary <string, string>
            {
                { "$type", $"DevicePropertyList;1" },
                { "$url", $"/v1/deviceproperties" },
            };
        }
        public ConfigTypeListApiModel(ConfigTypeListServiceModel configTypeList)
        {
            this.configTypes = configTypeList.ConfigTypes;

            this.Metadata = new Dictionary <string, string>
            {
                { "$type", $"DevicePropertyList;{Version.NUMBER}" },
                { "$url", $"/{Version.PATH}/deviceproperties" }
            };
        }
Example #3
0
        public async Task UpdateConfigTypeAsync(string customConfigType)
        {
            ConfigTypeListServiceModel list;

            try
            {
                var response = await this.client.GetAsync(PACKAGES_COLLECTION_ID, PACKAGES_CONFIG_TYPE_KEY);

                list = JsonConvert.DeserializeObject <ConfigTypeListServiceModel>(response.Data);
            }
            catch (ResourceNotFoundException)
            {
                log.Debug("Config Types have not been created.", () => { });
                // Create empty Package Config Types
                list = new ConfigTypeListServiceModel();
            }
            list.add(customConfigType);
            await this.client.UpdateAsync(PACKAGES_COLLECTION_ID, PACKAGES_CONFIG_TYPE_KEY, JsonConvert.SerializeObject(list), "*");
        }
        public async Task UpdateConfigTypeAsync(string customConfigType)
        {
            ConfigTypeListServiceModel list;

            try
            {
                var response = await this.client.GetAsync(PackagesCollectionId, PackagesConfigTypeKey);

                list = JsonConvert.DeserializeObject <ConfigTypeListServiceModel>(response.Data);
            }
            catch (ResourceNotFoundException)
            {
                this.logger.LogDebug("Config Types have not been created.");

                // Create empty Package Config Types
                list = new ConfigTypeListServiceModel();
            }

            list.Add(customConfigType);
            await this.client.UpdateAsync(PackagesCollectionId, PackagesConfigTypeKey, JsonConvert.SerializeObject(list), "*");
        }