Пример #1
0
        public async System.Threading.Tasks.Task <HttpResponseMessage> UpdatePersistedGrant(string key = default(string), Models.ConData.PersistedGrant persistedGrant = default(Models.ConData.PersistedGrant))
        {
            var uri = new Uri(baseUri, $"PersistedGrants('{HttpUtility.UrlEncode(key)}')");

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

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

            OnUpdatePersistedGrant(httpRequestMessage);
            return(await httpClient.SendAsync(httpRequestMessage));
        }
Пример #2
0
        public async System.Threading.Tasks.Task <Models.ConData.PersistedGrant> CreatePersistedGrant(Models.ConData.PersistedGrant persistedGrant = default(Models.ConData.PersistedGrant))
        {
            var uri = new Uri(baseUri, $"PersistedGrants");

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

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

            OnCreatePersistedGrant(httpRequestMessage);

            var response = await httpClient.SendAsync(httpRequestMessage);

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