Comments (6)
The dev
branch should be fixed, can you try it?
from synology.
Hi, thanks for your help.
I just downloaded the dev branch, built it, and added the references to my project (removed NuGet packages first). But the problem still exists. :-(
My usings are:
> using System;
> using Synology;
> using Synology.Api;
> using Synology.DownloadStation;
> using Newtonsoft.Json;
from synology.
The issue is still on GetInfo method?
from synology.
Yeah, the exception message still looks the same:
None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Synology.Api.Info.InfoRequest' can be invoked with the available services and parameters:
Cannot resolve parameter 'Synology.Classes.SynologyApi api' of constructor 'Void .ctor(SynologyApi)'
from synology.
Pushed to dev branch a fix, I tested it with my Synology and everything is OK except for some 404 on FileStation APIs.
The code is this:
using System;
using Newtonsoft.Json;
using Synology.Api.Auth.Parameters;
using Synology.Api.Auth.Results;
using Synology.Classes;
using Synology.DownloadStation.Task.Parameters;
using Synology.FileStation.FileShare.Parameters;
using Synology.FileStation.VirtualFolder.Parameters;
namespace Synology.TestConsole
{
public class Program
{
public static void Main(string[] args)
{
using (var syno = new SynologyConnection(LoginData.Url))
{
DoConnection(syno);
}
}
public static void DownloadStationTests(SynologyConnection syno)
{
Console.WriteLine("DS Info");
var dsResInfo = syno.DownloadStation().Info().GetInfo();
Console.WriteLine(JsonConvert.SerializeObject(dsResInfo));
Console.WriteLine("DS Config");
var dsResConfig = syno.DownloadStation().Info().Config();
Console.WriteLine(JsonConvert.SerializeObject(dsResConfig));
Console.WriteLine("DS Schedule Config");
var dsResSchedule = syno.DownloadStation().Schedule().Config();
Console.WriteLine(JsonConvert.SerializeObject(dsResSchedule));
Console.WriteLine("DS Task List");
var dsResTasks = syno.DownloadStation().Task().List(new TaskListParameters
{
Additional = TaskDetailsType.Detail | TaskDetailsType.Transfer | TaskDetailsType.File | TaskDetailsType.Tracker | TaskDetailsType.Peer
});
Console.WriteLine(JsonConvert.SerializeObject(dsResTasks));
}
public static void FileStationTests(SynologyConnection syno)
{
Console.WriteLine("FS Info");
var fsResInfo = syno.FileStation().Info().GetInfo();
Console.WriteLine(JsonConvert.SerializeObject(fsResInfo));
Console.WriteLine("FS List Share");
var fsResShares = syno.FileStation().FileShare().ListShare(FileShareDetailsType.RealPath | FileShareDetailsType.Size | FileShareDetailsType.Owner | FileShareDetailsType.Time | FileShareDetailsType.Perm | FileShareDetailsType.VolumeStatus | FileShareDetailsType.MountPointType);
Console.WriteLine(JsonConvert.SerializeObject(fsResShares));
Console.WriteLine("FS List");
var fsResList = syno.FileStation().FileShare().List("/downloads", null, FileType.All, null, FileDetailsType.RealPath | FileDetailsType.Size | FileDetailsType.Owner | FileDetailsType.Time | FileDetailsType.Perm | FileDetailsType.Type | FileDetailsType.MountPointType);
Console.WriteLine(JsonConvert.SerializeObject(fsResList));
Console.WriteLine("FS Info");
var fsResFileInfo = syno.FileStation().FileShare().Info("/downloads/.apdisk", FileDetailsType.RealPath | FileDetailsType.Size | FileDetailsType.Owner | FileDetailsType.Time | FileDetailsType.Perm | FileDetailsType.Type | FileDetailsType.MountPointType);
Console.WriteLine(JsonConvert.SerializeObject(fsResFileInfo));
Console.WriteLine("FS VF List");
var fsVfResList = syno.FileStation().VirtualFolder().List(VirtualFolderDetailsType.RealPath | VirtualFolderDetailsType.Owner | VirtualFolderDetailsType.Time | VirtualFolderDetailsType.Perm | VirtualFolderDetailsType.MountPointType | VirtualFolderDetailsType.VolumeStatus);
Console.WriteLine(JsonConvert.SerializeObject(fsVfResList));
}
public static void GetOtp(SynologyConnection syno, ref ResultData<AuthResult> resLogin)
{
do
{
Console.Write("Otp Code: ");
var otp = Console.ReadLine();
if (string.IsNullOrWhiteSpace(otp))
{
resLogin.Error = new ResultError { Code = 404 };
continue;
}
resLogin = syno.Api().Auth().Login(new LoginParameters
{
Username = LoginData.Username,
Password = LoginData.Password,
OtpCode = otp
});
Console.WriteLine(JsonConvert.SerializeObject(resLogin));
}
while (resLogin.Error != null && resLogin.Error.Code == 404);
}
public static void DoConnection(SynologyConnection syno)
{
Console.WriteLine("Info");
var resInfo = syno.Api().Info().GetInfo();
Console.WriteLine(JsonConvert.SerializeObject(resInfo));
Console.WriteLine("Auth Login");
var resLogin = syno.Api().Auth().Login(new LoginParameters
{
Username = LoginData.Username,
Password = LoginData.Password
});
Console.WriteLine(JsonConvert.SerializeObject(resLogin));
if (resLogin.Error == null || (resLogin.Error != null && resLogin.Error.Code == 403))
{
if (resLogin.Error != null && resLogin.Error.Code == 403)
{
GetOtp(syno, ref resLogin);
}
if (resLogin.Error == null)
{
DownloadStationTests(syno);
//FileStationTests(syno);
Console.WriteLine("Auth Logout");
var resLogout = syno.Api().Auth().Logout();
Console.WriteLine(JsonConvert.SerializeObject(resLogout));
}
}
Console.ReadLine();
}
}
}
The usings are automatically resolved, nothing added manually.
Let me know if you still have the issue, about FS APIs I'll open another issue
from synology.
Awesome, it seems to work now.
Thank you very much!
from synology.
Related Issues (20)
- Issue with Login API? HOT 16
- Result should use public Interfaces and not classes
- Complete Test Web Application
- FileStation().Rename().RenameAync() only works when there is one item to rename and brackets removed from URL
- FileStation().CopyMove().StartAsync() only moves and can move when there are no brackets from URL
- [BUG] encode query parameters
- Empty IUploadRequest Interface? HOT 1
- Create objects to replace parameters list in requests
- 404 on FileStation APIs with DSM 6
- Get API data from Syno.API.Info
- Download Station 2 APIs
- Support pre DSM 6.0 systems
- Manage Syno.API.Info for every API and retrieve the cgi and the version
- Convert projects to PCL HOT 4
- AudioStation API
- VideoStation API
- Write Wiki and Documentation
- Add missing comments to code
- Add Application Settings Connection Parameters
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from synology.