Пример #1
0
        public Task <IApiResponse <OptimizeResult> > Optimize(byte[] image, string filename,
                                                              IOptimizeSetUploadRequest optimizeRequest, CancellationToken cancellationToken)
        {
            filename.ThrowIfNullOrEmpty("filename");

            var message = _connection.ExecuteUpload <OptimizeResult>(new KrakenApiRequest(optimizeRequest, "v1/upload"),
                                                                     image, filename, cancellationToken);

            return(message);
        }
Пример #2
0
        public Task <IApiResponse <OptimizeResult> > Optimize(string filePath,
                                                              IOptimizeSetUploadRequest optimizeRequest, CancellationToken cancellationToken)
        {
            filePath.ThrowIfNullOrEmpty("filePath");
            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException();
            }

            var file = File.ReadAllBytes(filePath);

            var message = _connection.ExecuteUpload <OptimizeResult>(new KrakenApiRequest(optimizeRequest, "v1/upload"),
                                                                     file, filePath, cancellationToken);

            return(message);
        }
Пример #3
0
 public Task <IApiResponse <OptimizeResult> > Optimize(string filePath, IOptimizeSetUploadRequest optimizeRequest)
 {
     return(Optimize(filePath, optimizeRequest, default(CancellationToken)));
 }
Пример #4
0
 public Task <IApiResponse <OptimizeResult> > Optimize(byte[] image, string filename,
                                                       IOptimizeSetUploadRequest optimizeRequest)
 {
     return(Optimize(image, filename, optimizeRequest, default(CancellationToken)));
 }