AptiGram.Modules.BackgroundModule.PublishToGitAsync C# (CSharp) Method

PublishToGitAsync() public method

public PublishToGitAsync ( string json ) : System.Threading.Tasks.Task
json string
return System.Threading.Tasks.Task
        public async Task PublishToGitAsync(string json)
        {
            var credentials = new Credentials(ConfigurationManager.AppSettings["github_access_token"]);
            var connection = new Connection(new ProductHeaderValue("aptitud.github.io"))
            {
                Credentials = credentials
            };

            var client = new GitHubClient(connection);

            var contents = await client.Repository.Content.GetAllContents("aptitud", "aptitud.github.io", "instagram.json");
            if (JsonIsSame(contents, json))
                return;

            string fileSha = contents.First().Sha;
            await client.Repository.Content.UpdateFile(
                "aptitud",
                "aptitud.github.io",
                "instagram.json",
                new UpdateFileRequest("Update", json, fileSha));

        }