Exemplo n.º 1
0
 public FilesDomainService(IFilesClient filesClient, IFoldersClient foldersClient,
                           ILogger <FilesDomainService> logger, IMapper mapper, IUrlClient urlClient, IImageRepository imageRepository)
 {
     this.filesClient     = filesClient;
     this.foldersClient   = foldersClient;
     this.logger          = logger;
     this.mapper          = mapper;
     this.urlClient       = urlClient;
     this.imageRepository = imageRepository;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new <see cref="Gw2WebApiV2Client"/>.
        /// </summary>
        /// <param name="connection">The connection used to make requests, see <see cref="IConnection"/>.</param>
        /// <param name="gw2Client">The Guild Wars 2 client.</param>
        /// <exception cref="ArgumentNullException"><paramref name="connection"/> or <paramref name="gw2Client"/> is <c>null</c>.</exception>
        protected internal Gw2WebApiV2Client(IConnection connection, IGw2Client gw2Client)
            : base(connection, gw2Client)
        {
            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }
            if (gw2Client == null)
            {
                throw new ArgumentNullException(nameof(gw2Client));
            }

            this.account        = new AccountClient(connection, gw2Client);
            this.achievements   = new AchievementsClient(connection, gw2Client);
            this.backstory      = new BackstoryClient(connection, gw2Client);
            this.build          = new BuildClient(connection, gw2Client);
            this.characters     = new CharactersClient(connection, gw2Client);
            this.colors         = new ColorsClient(connection, gw2Client);
            this.commerce       = new CommerceClient(connection, gw2Client);
            this.continents     = new ContinentsClient(connection, gw2Client);
            this.createSubtoken = new CreateSubtokenClient(connection, gw2Client);
            this.currencies     = new CurrenciesClient(connection, gw2Client);
            this.dailyCrafting  = new DailyCraftingClient(connection, gw2Client);
            this.dungeons       = new DungeonsClient(connection, gw2Client);
            this.emblem         = new EmblemClient(connection, gw2Client);
            this.emotes         = new EmotesClient(connection, gw2Client);
            this.files          = new FilesClient(connection, gw2Client);
            this.finishers      = new FinishersClient(connection, gw2Client);
            this.gliders        = new GlidersClient(connection, gw2Client);
            this.guild          = new GuildClient(connection, gw2Client);
            this.home           = new HomeClient(connection, gw2Client);
            this.items          = new ItemsClient(connection, gw2Client);
            this.itemstats      = new ItemstatsClient(connection, gw2Client);
            this.legends        = new LegendsClient(connection, gw2Client);
            this.mailCarriers   = new MailCarriersClient(connection, gw2Client);
            this.mapChests      = new MapChestsClient(connection, gw2Client);
            this.maps           = new MapsClient(connection, gw2Client);
            this.masteries      = new MasteriesClient(connection, gw2Client);
            this.materials      = new MaterialsClient(connection, gw2Client);
            this.minis          = new MinisClient(connection, gw2Client);
            this.mounts         = new MountsClient(connection, gw2Client);
            this.novelties      = new NoveltiesClient(connection, gw2Client);
            this.outfits        = new OutfitsClient(connection, gw2Client);
            this.pets           = new PetsClient(connection, gw2Client);
            this.professions    = new ProfessionsClient(connection, gw2Client);
            this.pvp            = new PvpClient(connection, gw2Client);
            this.quaggans       = new QuaggansClient(connection, gw2Client);
            this.quests         = new QuestsClient(connection, gw2Client);
            this.races          = new RacesClient(connection, gw2Client);
            this.raids          = new RaidsClient(connection, gw2Client);
            this.recipes        = new RecipesClient(connection, gw2Client);
            this.skills         = new SkillsClient(connection, gw2Client);
            this.tokenInfo      = new TokenInfoClient(connection, gw2Client);
            this.worldBosses    = new WorldBossesClient(connection, gw2Client);
        }
Exemplo n.º 3
0
        public static async Task <Stream> DownloadFileAsync([NotNull] this IFilesClient client, [NotNull] string path, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }
            if (String.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentNullException(nameof(path));
            }

            Link link = await client.GetDownloadLinkAsync(path, cancellationToken).ConfigureAwait(false);

            return(await client.DownloadAsync(link, cancellationToken).ConfigureAwait(false));
        }
Exemplo n.º 4
0
        public static async Task UploadFileAsync([NotNull] this IFilesClient client, [NotNull] string path, bool overwrite, [NotNull] Stream file, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }
            if (String.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentNullException(nameof(path));
            }
            if (file == null)
            {
                throw new ArgumentNullException(nameof(file));
            }

            Link link = await client.GetUploadLinkAsync(path, overwrite, cancellationToken).ConfigureAwait(false);

            await client.UploadAsync(link, file, cancellationToken).ConfigureAwait(false);
        }
Exemplo n.º 5
0
        public static async Task DownloadFileAsync([NotNull] this IFilesClient client, [NotNull] string path, [NotNull] string localFile, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }
            if (String.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentNullException(nameof(path));
            }
            if (String.IsNullOrWhiteSpace(localFile))
            {
                throw new ArgumentNullException(nameof(localFile));
            }

            Stream data = await DownloadFileAsync(client, path, cancellationToken).ConfigureAwait(false);

            using (var file = new FileStream(localFile, FileMode.CreateNew, FileAccess.Write, FileShare.ReadWrite))
            {
                await data.CopyToAsync(file, bufferSize : 81920 /*keep default*/, cancellationToken : cancellationToken).ConfigureAwait(false);
            }
        }
Exemplo n.º 6
0
        public static async Task UploadFileAsync([NotNull] this IFilesClient client, [NotNull] string path, bool overwrite, [NotNull] string localFile, CancellationToken cancellationToken)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }
            if (String.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentNullException(nameof(path));
            }
            if (String.IsNullOrWhiteSpace(localFile))
            {
                throw new ArgumentNullException(nameof(localFile));
            }

            Link link = await client.GetUploadLinkAsync(path, overwrite, cancellationToken).ConfigureAwait(false);

            using (var file = new FileStream(localFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                await client.UploadAsync(link, file, cancellationToken).ConfigureAwait(false);
            }
        }
Exemplo n.º 7
0
 public FilesClientTests()
 {
     _client = _RepositoryClientTests.RepositoryClient.Files;
 }
Exemplo n.º 8
0
 public FilesClientTests()
 {
     _client = _RepositoryClientTests.RepositoryClient.Files;
 }