예제 #1
0
        public async System.Threading.Tasks.Task <HttpResponseMessage> UpdateDeviceCode(string userCode = default(string), Models.ConData.DeviceCode deviceCode = default(Models.ConData.DeviceCode))
        {
            var uri = new Uri(baseUri, $"DeviceCodes('{HttpUtility.UrlEncode(userCode)}')");

            var httpRequestMessage = new HttpRequestMessage(HttpMethod.Patch, uri);

            httpRequestMessage.Content = new StringContent(ODataJsonSerializer.Serialize(deviceCode), Encoding.UTF8, "application/json");

            OnUpdateDeviceCode(httpRequestMessage);
            return(await httpClient.SendAsync(httpRequestMessage));
        }
예제 #2
0
        public async System.Threading.Tasks.Task <Models.ConData.DeviceCode> CreateDeviceCode(Models.ConData.DeviceCode deviceCode = default(Models.ConData.DeviceCode))
        {
            var uri = new Uri(baseUri, $"DeviceCodes");

            var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, uri);

            httpRequestMessage.Content = new StringContent(ODataJsonSerializer.Serialize(deviceCode), Encoding.UTF8, "application/json");

            OnCreateDeviceCode(httpRequestMessage);

            var response = await httpClient.SendAsync(httpRequestMessage);

            return(await response.ReadAsync <Models.ConData.DeviceCode>());
        }