
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
github.com/goh-chunlin/go-onedrive
go-onedrive is a Golang client library for accessing the Microsoft OneDrive REST API.
This project is inspired by a few open-source projects, especially the go-github project from Google.
Currently, go-onedrive requires Golang version 1.15 or greater. go-onedrive tracks Golang version support policy. I'll do my best not to break older versions of Golang if I don't have to, but due to tooling constraints, I don't always test older versions.
Module support was introduced in Go 1.15. Starting from Go 1.16, module-aware mode is enabled by default. Hence, I'll assume the module-aware mode is enabled when using this library.
In the go.mod file, please make sure the correct package with the correct version is used.
...
require (
github.com/goh-chunlin/go-onedrive v1.1.1
...
)
The current latest version should be v1.1.1 (updated on 17th July 2021, as shown on the Releases page).
In other go source files, you can then import the go-onedrive library as follows.
import "github.com/goh-chunlin/go-onedrive/onedrive"
Construct a new OneDrive client, then use the various services on the client to access different parts of the OneDrive API. For example:
ctx := context.Background()
ts := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: "..."},
)
tc := oauth2.NewClient(ctx, ts)
client := onedrive.NewClient(tc)
// list all OneDrive drives for the current logged in user
drives, err := onedrive.Drives.List(ctx)
NOTE: Using the context package, one can easily pass cancelation signals and deadlines to various services of the client for handling a request. In case there is no context available, then context.Background()
can be used as a starting point.
The go-onedrive library does not directly handle authentication. Instead, when creating a new client, pass an http.Client
that can handle authentication for you. The easiest and recommended way to do this is using the oauth2
library.
Note that when using an authenticated Client, all calls made by the client will include the specified OAuth token. Therefore, authenticated clients should almost never be shared between different users.
See the oauth2 docs for complete instructions on using that library.
This library is being initially developed as a library for my personal project as listed below.
Hence, API methods will likely be implemented in the order that they are needed by my personal project. However, I still welcome you to contribute to this project to support the following features.
Special thanks go to the following projects for providing useful references which help me in the development of this library.
This library is distributed under the GPL-3.0 License found in the LICENSE file.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.