Class OctokitHelper
- Namespace
- SunamoOctokit
- Assembly
- SunamoOctokit.dll
Helper class for interacting with GitHub API through Octokit library.
public class OctokitHelper : IAuthenticate<object>
- Inheritance
-
OctokitHelper
- Implements
- Inherited Members
- Extension Methods
Properties
GitHubClient
Gets or sets the GitHub client instance used for API communication.
public GitHubClient GitHubClient { get; set; }
Property Value
- GitHubClient
Methods
BasicAuthenticate(string, string)
Authenticates using basic credentials (login and password).
public object BasicAuthenticate(string login, string password)
Parameters
Returns
- object
Always returns null.
CreateRepository(string)
Creates a new public repository on GitHub with MIT license.
public ResultWithExceptionOctokit<Repository> CreateRepository(string repositoryName)
Parameters
repositoryNamestringThe name of the repository to create.
Returns
- ResultWithExceptionOctokit<Repository>
A result containing the created repository or an exception message.
GetAccountRepositories(string, bool)
Gets repositories for the specified account or the current authenticated user.
When isIncludingPrivate is true, fetches repositories for the specified account.
When false, fetches all repositories for the currently authenticated user.
public Task<IReadOnlyList<Repository>> GetAccountRepositories(string account, bool isIncludingPrivate)
Parameters
accountstringThe GitHub account name to fetch repositories for.
isIncludingPrivateboolWhen true, fetches repositories for the specified account. When false, fetches all repositories for the currently authenticated user.
Returns
- Task<IReadOnlyList<Repository>>
A read-only list of repositories.
Initialize(string)
Initializes the GitHub client with the specified application name.
public IAuthenticate<object> Initialize(string appName)
Parameters
appNamestringThe application name used in the product header for API requests.
Returns
- IAuthenticate<object>
The current instance as IAuthenticate<T>.
TokenAuthenticate(string)
Authenticates using a personal access token.
public object TokenAuthenticate(string token)
Parameters
tokenstringThe GitHub personal access token.
Returns
- object
Always returns null.