SynologyClient 0.4.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package SynologyClient --version 0.4.0
NuGet\Install-Package SynologyClient -Version 0.4.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SynologyClient" Version="0.4.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SynologyClient --version 0.4.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SynologyClient, 0.4.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SynologyClient as a Cake Addin #addin nuget:?package=SynologyClient&version=0.4.0 // Install SynologyClient as a Cake Tool #tool nuget:?package=SynologyClient&version=0.4.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Synology Client
This is a .Net implementation of the https API for Synology File Station based on Synology File Station Official API available at synology.com.
Most functions and parameters are commented.
Check out the example and feel free to ask if you are unsure about anything.
NuGet
Features
- Connect
- Login, Logout
- List shared drives
- List files and directories
- Get file info
- Download
- Upload
- Get thumbnails
Planned features
- File sharing
Example
using Synology.DataTypes;
using Synology;
using System.Drawing;
// Connecting and logging in
Client client = new("https://nas.quickconnect.to", 5001, TimeSpan.FromSeconds(10));
if (!client.API.Connect().Result.success)
return;
if (!client.API.Login("user", "password").Result.success)
return;
// Getting drives
Response<SharedDriveList> sharedDriveResponse = client.FileStation.ListSharedDrives([]).Result;
Console.WriteLine("Recieved " + sharedDriveResponse.data.shares.Count + " shared drives");
// Getting files
Response<FileList> listResponse = client.FileStation.List("/Pictures", []).Result;
Console.WriteLine("Recieved " + listResponse.data.files.Count + " files");
// Getting info about specific files
Response<FileList> info = client.FileStation.Info(["/Home/note.txt"], [ ListAdditionalParameters.size ]).Result;
Console.WriteLine("File size is " + info.data.files.Last().additional.size);
// Downloading a file
Response<byte[]> downloadResponse = client.FileStation.Download("/Pictures/picture.png").Result;
Console.WriteLine("Downloaded " + downloadResponse.data.Length + " bytes");
// Getting a thumbnail
Response<byte[]> thumbResponse = client.FileStation.Thumbnail("/Pictures/landscape.jpg").Result;
Image image = Image.FromStream(new MemoryStream(thumbResponse.data));
image.Save("C://landscape_thumbnail.jpg");
Console.WriteLine("Thumbnail created!");
// Uploading a file
byte[] bytes = File.ReadAllBytes("C://video.mp4");
Response<HttpResponseMessage> uploadResponse = client.FileStation.Upload("/Pictures", "video.mp4", bytes).Result;
if (uploadResponse.success)
Console.WriteLine("File uploaded!");
// Logging out
client.API.Logout();
License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.