예제 #1
0
        public string UploadPermanentMedia(IWeChatOAContext context, string filename, string mimeType, string serverFilePath)
        {
            IUploadPermanentImageMediaApi api = new UploadPermanentImageMediaApi(context);

            api.FileName       = filename;
            api.ContentType    = mimeType;
            api.ServerFilePath = serverFilePath;
            var response = api.Execute();

            return(response.Url);
        }
예제 #2
0
        public void TestUploadPermanentImageMediaApi()
        {
            IUploadPermanentImageMediaApi api = new UploadPermanentImageMediaApi(context);

            api.FileName       = "test.jpg";
            api.ContentType    = "image/jpeg";
            api.ServerFilePath = Path.Combine(TestContext.CurrentContext.TestDirectory, "../../test-data/images/IMG_20150427_121714.jpg");
            var response = api.Execute();

            Assert.IsNotNull(response.Url);
            Console.WriteLine(response.Url);
        }