Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

At a loss for pushing the issue using Create() #1053

Closed
JakesCode opened this issue Dec 31, 2015 · 7 comments
Closed

At a loss for pushing the issue using Create() #1053

JakesCode opened this issue Dec 31, 2015 · 7 comments
Labels
Type: Documentation Improvements or additions to documentation

Comments

@JakesCode
Copy link
Contributor

Don't know if this is the place to ask, but I couldn't find anywhere else to ask a question directly relating to octokit.

I'm developing this app where there's an option to report any issues with it. I've managed to create the Issue using the documentation provided with this:

Form6 issuesBox = new Form6();
issuesBox.ShowDialog();
var createIssue = new NewIssue(issuesBox.issueName);
createIssue.Body = issuesBox.issueMain;
createIssue.Assignee = "JakesCode";

No compile errors, everything worked. Until I tried to use Create;
Firstly, the docs specified this:

var issue = await _issuesClient.Create("octokit", "octokit.net", createIssue);

....where does "_issuesClient" come from? I couldn't find anything in the docs about it and then decided to experiment, eventually discovering that replacing it with Octokit.IssuesClient seemed to include something called "Create", so I went with it.

Currently, the line is this:

var newIssue = await Octokit.IssuesClient.Create("JakesCode", "Biology-Department-Equipment-Requistion-Version-2", createIssue);

....but no matter what I do, I get the error An object reference is required for the non-static field, method, or property 'IssuesClient.Create(string, string, NewIssue)'

Please could you shed some light on this? From what I gather it needs me to pass it 2 strings and a NewIssue, which I have? Reading up on the error doesn't seem to help either as everyone is in a different context to me.

Here is the full method:

public async void gitHubStuff()
        {
            var client = new GitHubClient(new ProductHeaderValue("BDER_For_Windows"));
            var tokenAuth = new Credentials("REDACTED_KEY");
            client.Credentials = tokenAuth;

            var user = await client.User.Get("JakesCode");
            MessageBox.Show(user.Name);
            Form6 issuesBox = new Form6();
            issuesBox.ShowDialog();
            var createIssue = new NewIssue(issuesBox.issueName);
            createIssue.Body = issuesBox.issueMain;
            createIssue.Assignee = "JakesCode";

            var newIssue = await Octokit.IssuesClient.Create("JakesCode", "Biology-Department-Equipment-Requistion-Version-2", createIssue);
        }

Thanks for any help,
Jake

@M-Zuber
Copy link
Contributor

M-Zuber commented Dec 31, 2015

Try:
client.Issue.Create
On mobile so can't be that much more helpful. Apologies

@JakesCode
Copy link
Contributor Author

Thanks, this fixed it.

@shiftkey
Copy link
Member

shiftkey commented Jan 1, 2016

Reopening this to get it addressed in the documentation

@JakesCode
Copy link
Contributor Author

I was just confused as to where "_issuesClient" came from, as I suspect others will/would be - maybe clarifying that would help others.

@shiftkey
Copy link
Member

shiftkey commented Jan 1, 2016

@JakesCode could you link to where in the docs you found this _issuesClient? I think I know the place, but if someone else wants to dive in and fix it first it'd be greatly appreciated...

@JakesCode
Copy link
Contributor Author

@shiftkey Done and done.
#1054

@shiftkey
Copy link
Member

This was merged into master late last week!

http://octokitnet.readthedocs.org/en/latest/issues/

@nickfloyd nickfloyd added Type: Documentation Improvements or additions to documentation and removed category: docs-and-samples labels Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants