added createByPath

This commit is contained in:
skilion 2015-09-06 11:06:13 +02:00
parent 61c5ea7789
commit 84f6d59813

View file

@ -186,7 +186,6 @@ final class OneDriveApi
if (eTag) http.addRequestHeader("If-Match", eTag);
http.addRequestHeader("Content-Type", "application/json");
auto result = patch(url, data.toString());
http.clearRequestHeaders();
// remove the headers
setAccessToken(accessToken);
return result;
@ -203,6 +202,17 @@ final class OneDriveApi
if (eTag) setAccessToken(accessToken);
}
//https://dev.onedrive.com/items/create.htm
JSONValue createByPath(const(char)[] parentPath, JSONValue item)
{
char[] url = itemByPathUrl ~ parentPath ~ ":/children";
http.addRequestHeader("Content-Type", "application/json");
auto result = post(url, item.toString());
// remove the if-match header
setAccessToken(accessToken);
return result;
}
private void redeemToken(const(char)[] authCode)
{
string postData = "client_id=" ~ clientId ~ "&redirect_url=" ~ redirectUrl ~ "&client_secret=" ~ clientSecret;