mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-04 23:12:18 +02:00
added createByPath
This commit is contained in:
parent
61c5ea7789
commit
84f6d59813
|
@ -186,7 +186,6 @@ final class OneDriveApi
|
||||||
if (eTag) http.addRequestHeader("If-Match", eTag);
|
if (eTag) http.addRequestHeader("If-Match", eTag);
|
||||||
http.addRequestHeader("Content-Type", "application/json");
|
http.addRequestHeader("Content-Type", "application/json");
|
||||||
auto result = patch(url, data.toString());
|
auto result = patch(url, data.toString());
|
||||||
http.clearRequestHeaders();
|
|
||||||
// remove the headers
|
// remove the headers
|
||||||
setAccessToken(accessToken);
|
setAccessToken(accessToken);
|
||||||
return result;
|
return result;
|
||||||
|
@ -203,6 +202,17 @@ final class OneDriveApi
|
||||||
if (eTag) setAccessToken(accessToken);
|
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)
|
private void redeemToken(const(char)[] authCode)
|
||||||
{
|
{
|
||||||
string postData = "client_id=" ~ clientId ~ "&redirect_url=" ~ redirectUrl ~ "&client_secret=" ~ clientSecret;
|
string postData = "client_id=" ~ clientId ~ "&redirect_url=" ~ redirectUrl ~ "&client_secret=" ~ clientSecret;
|
||||||
|
|
Loading…
Reference in a new issue