mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-15 20:26:53 +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);
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue