mirror of https://github.com/vitalif/grive2
Add new_rev switch support to drive v2 api client
parent
ca4a0b6b80
commit
3b9aa4f2aa
|
@ -70,7 +70,7 @@ bool Syncer2::EditContent( Resource *res, bool new_rev )
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Upload( res ) ;
|
return Upload( res, new_rev ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Syncer2::Create( Resource *res )
|
bool Syncer2::Create( Resource *res )
|
||||||
|
@ -86,7 +86,7 @@ bool Syncer2::Create( Resource *res )
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Upload( res );
|
return Upload( res, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Syncer2::Move( Resource* res, Resource* newParentRes, std::string newFilename )
|
bool Syncer2::Move( Resource* res, Resource* newParentRes, std::string newFilename )
|
||||||
|
@ -140,7 +140,7 @@ std::string to_string( uint64_t n )
|
||||||
return s.str();
|
return s.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Syncer2::Upload( Resource *res )
|
bool Syncer2::Upload( Resource *res, bool new_rev )
|
||||||
{
|
{
|
||||||
Val meta;
|
Val meta;
|
||||||
meta.Add( "title", Val( res->Name() ) );
|
meta.Add( "title", Val( res->Name() ) );
|
||||||
|
@ -196,7 +196,8 @@ bool Syncer2::Upload( Resource *res )
|
||||||
http::ValResponse vrsp;
|
http::ValResponse vrsp;
|
||||||
m_http->Request(
|
m_http->Request(
|
||||||
res->ResourceID().empty() ? "POST" : "PUT",
|
res->ResourceID().empty() ? "POST" : "PUT",
|
||||||
upload_base + ( res->ResourceID().empty() ? "" : "/" + res->ResourceID() ) + "?uploadType=multipart",
|
upload_base + ( res->ResourceID().empty() ? "" : "/" + res->ResourceID() ) +
|
||||||
|
"?uploadType=multipart&newRevision=" + ( new_rev ? "true" : "false" ),
|
||||||
&multipart, &vrsp, hdr
|
&multipart, &vrsp, hdr
|
||||||
) ;
|
) ;
|
||||||
valr = vrsp.Response() ;
|
valr = vrsp.Response() ;
|
||||||
|
|
|
@ -46,7 +46,7 @@ public :
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
bool Upload( Resource *res );
|
bool Upload( Resource *res, bool new_rev );
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue