public Task<TemporaryMediaCreationResut> CreateTemporaryMediaAsync(FileDescription file)
 {
     return _apiClient.ExecuteAndGetResultAsync<TemporaryMediaCreationResut>(b =>
         b.UseResource("/cgi-bin/media/upload")
          .UseHttps()
          .AddFile("media", file)
     );
 }
 public Task<NewsMaterialImageCreationResult> CreateNewsMaterialImageAsync(FileDescription file)
 {
     return _apiClient.ExecuteAndGetResultAsync<NewsMaterialImageCreationResult>(b =>
         b.UseResource("/cgi-bin/media/uploadimg")
          .UseHttps()
          .AddFile("media", file)
     );
 }
 public Task<MaterialCreationResult> CreateVoiceMaterialAsync(FileDescription file)
 {
     return _apiClient.ExecuteAndGetResultAsync<MaterialCreationResult>(b =>
         b.UseResource("/cgi-bin/material/add_material")
          .UseHttps()
          .UseParameter("type", "voice")
          .AddFile("media", file)
     );
 }
        public Task<MaterialCreationResult> CreateVideoMaterialAsync(FileDescription file, string title, string introduction)
        {
            var description = _jsonSerializer.Serialize(new {
                title = title,
                introduction = introduction
            });

            return _apiClient.ExecuteAndGetResultAsync<MaterialCreationResult>(b =>
                b.UseResource("/cgi-bin/material/add_material")
                 .UseHttps()
                 .UseParameter("type", "video")
                 .Form("description", description)
                 .AddFile("media", file)
            );
        }
예제 #5
0
 public ApiDescriptionBuilder AddFile(string key, FileDescription fileDescription)
 {
     _apiDescription.Files.Add(key, fileDescription);
     return(this);
 }