Last active
January 23, 2019 10:13
Revisions
-
msohailismail revised this gist
Jan 23, 2019 . 4 changed files with 270 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,70 @@ // For complete examples and data files, please go to https://github.com/aspose-diagram-cloud/aspose-diagram-cloud-dotnet using Aspose.Diagram.Cloud.SDK.Api; using Aspose.Diagram.Cloud.SDK.Client; using Aspose.Diagram.Cloud.SDK.Model; using Aspose.Storage.Cloud.Sdk.Api; using Aspose.Storage.Cloud.Sdk.Model.Requests; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Aspose.Diagram_Cloud_APIs_Examples { class DiagramExamples { protected ApiClient client; protected Configuration config; protected static OAuthApi oauth2 = null; protected string grantType = "client_credentials"; protected string clientId = ""; // Get App Key and App SID from https://dashboard.aspose.cloud/ protected string clientSecret = ""; // Get App Key and App SID from https://dashboard.aspose.cloud/ protected static string accesstoken; protected string refreshtoken; static void Main(string[] args) { DiagramExamples diagramExamples = new DiagramExamples(); // Get Diagram Document Information diagramExamples.GetDiagram(); } // Get Diagram Document Information private void GetDiagram() { DiagramFileApi instance = new DiagramFileApi(GetConfiguration()); string name = "file_get_1.vdx"; string folder = null; UpdateDataFile(name); var response = instance.DiagramFileGetDiagram(name, "pdf", folder); } private void UpdateDataFile(string filename) { StorageApi StorageApi = new StorageApi(clientSecret, clientId); // Upload document to Cloud Storage PutCreateRequest request = new PutCreateRequest(filename, File.OpenRead(@"c:\Data\" + filename), null, null); StorageApi.PutCreate(request); } private Configuration GetConfiguration() { if (oauth2 == null) { oauth2 = new OAuthApi("https://api.aspose.cloud"); var oauth2response = oauth2.OAuthPost(grantType, clientId, clientSecret); accesstoken = oauth2response.AccessToken; refreshtoken = oauth2response.RefreshToken; } Dictionary<string, string> headerParameters = new Dictionary<string, string>(); headerParameters.Add("Authorization", "Bearer " + accesstoken); client = new ApiClient(); config = new Configuration(client, headerParameters); return config; } } } This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,75 @@ // For complete examples and data files, please go to https://github.com/aspose-diagram-cloud/aspose-diagram-cloud-dotnet using Aspose.Diagram.Cloud.SDK.Api; using Aspose.Diagram.Cloud.SDK.Client; using Aspose.Diagram.Cloud.SDK.Model; using Aspose.Storage.Cloud.Sdk.Api; using Aspose.Storage.Cloud.Sdk.Model.Requests; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Aspose.Diagram_Cloud_APIs_Examples { class DiagramExamples { protected ApiClient client; protected Configuration config; protected static OAuthApi oauth2 = null; protected string grantType = "client_credentials"; protected string clientId = ""; // Get App Key and App SID from https://dashboard.aspose.cloud/ protected string clientSecret = ""; // Get App Key and App SID from https://dashboard.aspose.cloud/ protected static string accesstoken; protected string refreshtoken; static void Main(string[] args) { DiagramExamples diagramExamples = new DiagramExamples(); // Convert Diagram File to Another Format diagramExamples.PostSaveAs(); } // Convert Diagram File to Another Format private void PostSaveAs() { DiagramFileApi instance = new DiagramFileApi(GetConfiguration()); string name = "file_get_1.vdx"; bool isOverwrite = true; string folder = null; FileFormatRequest format = new FileFormatRequest() { Format = "pdf" }; string newfilename = "file_saveas_1.pdf"; UpdateDataFile(name); var response = instance.DiagramFilePostSaveAs(name, format, newfilename, folder, isOverwrite); } private void UpdateDataFile(string filename) { StorageApi StorageApi = new StorageApi(clientSecret, clientId); // Upload document to Cloud Storage PutCreateRequest request = new PutCreateRequest(filename, File.OpenRead(@"c:\Data\" + filename), null, null); StorageApi.PutCreate(request); } private Configuration GetConfiguration() { if (oauth2 == null) { oauth2 = new OAuthApi("https://api.aspose.cloud"); var oauth2response = oauth2.OAuthPost(grantType, clientId, clientSecret); accesstoken = oauth2response.AccessToken; refreshtoken = oauth2response.RefreshToken; } Dictionary<string, string> headerParameters = new Dictionary<string, string>(); headerParameters.Add("Authorization", "Bearer " + accesstoken); client = new ApiClient(); config = new Configuration(client, headerParameters); return config; } } } This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,62 @@ // For complete examples and data files, please go to https://github.com/aspose-diagram-cloud/aspose-diagram-cloud-dotnet using Aspose.Diagram.Cloud.SDK.Api; using Aspose.Diagram.Cloud.SDK.Client; using Aspose.Diagram.Cloud.SDK.Model; using Aspose.Storage.Cloud.Sdk.Api; using Aspose.Storage.Cloud.Sdk.Model.Requests; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Aspose.Diagram_Cloud_APIs_Examples { class DiagramExamples { protected ApiClient client; protected Configuration config; protected static OAuthApi oauth2 = null; protected string grantType = "client_credentials"; protected string clientId = ""; // Get App Key and App SID from https://dashboard.aspose.cloud/ protected string clientSecret = ""; // Get App Key and App SID from https://dashboard.aspose.cloud/ protected static string accesstoken; protected string refreshtoken; static void Main(string[] args) { DiagramExamples diagramExamples = new DiagramExamples(); // Create Diagram File diagramExamples.PutCreate(); } // Create Diagram File private void PutCreate() { DiagramFileApi instance = new DiagramFileApi(GetConfiguration()); string name = "file_get_1.vdx"; bool isOverwrite = true; string folder = null; var response = instance.DiagramFilePutCreate(name, folder, isOverwrite); } private Configuration GetConfiguration() { if (oauth2 == null) { oauth2 = new OAuthApi("https://api.aspose.cloud"); var oauth2response = oauth2.OAuthPost(grantType, clientId, clientSecret); accesstoken = oauth2response.AccessToken; refreshtoken = oauth2response.RefreshToken; } Dictionary<string, string> headerParameters = new Dictionary<string, string>(); headerParameters.Add("Authorization", "Bearer " + accesstoken); client = new ApiClient(); config = new Configuration(client, headerParameters); return config; } } } This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,63 @@ // For complete examples and data files, please go to https://github.com/aspose-diagram-cloud/aspose-diagram-cloud-dotnet using Aspose.Diagram.Cloud.SDK.Api; using Aspose.Diagram.Cloud.SDK.Client; using Aspose.Diagram.Cloud.SDK.Model; using Aspose.Storage.Cloud.Sdk.Api; using Aspose.Storage.Cloud.Sdk.Model.Requests; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Aspose.Diagram_Cloud_APIs_Examples { class DiagramExamples { protected ApiClient client; protected Configuration config; protected static OAuthApi oauth2 = null; protected string grantType = "client_credentials"; protected string clientId = ""; // Get App Key and App SID from https://dashboard.aspose.cloud/ protected string clientSecret = ""; // Get App Key and App SID from https://dashboard.aspose.cloud/ protected static string accesstoken; protected string refreshtoken; static void Main(string[] args) { DiagramExamples diagramExamples = new DiagramExamples(); // Upload Diagram File diagramExamples.PutUpload(); } // Upload Diagram File private void PutUpload() { DiagramFileApi instance = new DiagramFileApi(GetConfiguration()); string name = "123.vsd"; bool isOverwrite = true; string folder = null; string localFilePath = @"c:\Data\123.vsd"; var response = instance.DiagramFilePutUpload(localFilePath, name, folder, isOverwrite); } private Configuration GetConfiguration() { if (oauth2 == null) { oauth2 = new OAuthApi("https://api.aspose.cloud"); var oauth2response = oauth2.OAuthPost(grantType, clientId, clientSecret); accesstoken = oauth2response.AccessToken; refreshtoken = oauth2response.RefreshToken; } Dictionary<string, string> headerParameters = new Dictionary<string, string>(); headerParameters.Add("Authorization", "Bearer " + accesstoken); client = new ApiClient(); config = new Configuration(client, headerParameters); return config; } } } -
aspose-cloud created this gist
Jan 23, 2019 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ The GIST contains .NET Examples of Aspose.Diagram REST APIs.