pcgeek86 / PSGitHub

This PowerShell module contains commands to manage GitHub through its REST API.
MIT License
182 stars 39 forks source link

Token function errors #47

Closed CollinChaffin closed 4 years ago

CollinChaffin commented 6 years ago

Before submitting your issue for the PSGitHub project, please take a moment to provide the following details:

Issue:

Even after setting defaultparametervalues as shown in README, get-githubgist produces this:

WARNING: The command 'Get-GitHubToken' is obsolete. Tokens should be provided through the -Token parameter or $PSDefaultParameterValues
WARNING: The command 'Get-GitHubToken' is obsolete. Tokens should be provided through the -Token parameter or $PSDefaultParameterValues
Invoke-RestMethod : {"message":"Requires authentication","documentation_url":"https://developer.github.com/v3/users/#get-the-authenticated-user"}
At C:\Program Files\WindowsPowerShell\Modules\PSGitHub\0.14.92\Functions\Private\Invoke-GitHubApi.ps1:81 char:5
+     Invoke-RestMethod @ApiRequest;
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Cannot find an overload for "new" and the argument count: "2".
At C:\Program Files\WindowsPowerShell\Modules\PSGitHub\0.14.92\Functions\Public\Get-GitHubGist.ps1:89 char:9
+         [GitHubGist]::new($Result.name, $Result.description);
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

Cannot find an overload for "new" and the argument count: "2".
At C:\Program Files\WindowsPowerShell\Modules\PSGitHub\0.14.92\Functions\Public\Get-GitHubGist.ps1:89 char:9
+         [GitHubGist]::new($Result.name, $Result.description);
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

Cannot find an overload for "new" and the argument count: "2".
At C:\Program Files\WindowsPowerShell\Modules\PSGitHub\0.14.92\Functions\Public\Get-GitHubGist.ps1:89 char:9
+         [GitHubGist]::new($Result.name, $Result.description);
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

Cannot find an overload for "new" and the argument count: "2".
At C:\Program Files\WindowsPowerShell\Modules\PSGitHub\0.14.92\Functions\Public\Get-GitHubGist.ps1:89 char:9
+         [GitHubGist]::new($Result.name, $Result.description);
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

Cannot find an overload for "new" and the argument count: "2".
At C:\Program Files\WindowsPowerShell\Modules\PSGitHub\0.14.92\Functions\Public\Get-GitHubGist.ps1:89 char:9
+         [GitHubGist]::new($Result.name, $Result.description);
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

Cannot find an overload for "new" and the argument count: "2".
At C:\Program Files\WindowsPowerShell\Modules\PSGitHub\0.14.92\Functions\Public\Get-GitHubGist.ps1:89 char:9
+         [GitHubGist]::new($Result.name, $Result.description);
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

Cannot find an overload for "new" and the argument count: "2".
At C:\Program Files\WindowsPowerShell\Modules\PSGitHub\0.14.92\Functions\Public\Get-GitHubGist.ps1:89 char:9
+         [GitHubGist]::new($Result.name, $Result.description);
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

Cannot find an overload for "new" and the argument count: "2".
At C:\Program Files\WindowsPowerShell\Modules\PSGitHub\0.14.92\Functions\Public\Get-GitHubGist.ps1:89 char:9
+         [GitHubGist]::new($Result.name, $Result.description);
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

....Repeatedly and ultimately does not work at all. Without tearing through all this code why is a module you wrote is telling me the operator that a private/proprietary function is "obsolete" (yet executes with a terminating error) without providing an alternative, and one step further since it's all your module, if get-githubtoken is obsolute and totally broken, why on earth are you not only including it in a release from just a couple weeks ago, but then still referencing/calling it as the default in the functions such as get-githubgist?

Sorry but I'm desperately trying to figure out the direction it's taking (even to just patch it myself) so if you can provide a bit of insight as to, in addition to simply telling the operator that the token function is broken, plan to replace it, abandon it, etc. that would help greatly.

TIA!

felixfbecker commented 4 years ago

@CollinCuffin I believe this issue is resolved in newest versions of PSGitHub. If I run Get-GitHubGist -Owner felixfbecker I do not get the error you posted (but I don't see the exact command you ran in the issue description).

To answer your question:

why is a module you wrote is telling me the operator that a private/proprietary function is "obsolete" (yet executes with a terminating error) without providing an alternative, and one step further since it's all your module, if get-githubtoken is obsolute and totally broken, why on earth are you not only including it in a release from just a couple weeks ago, but then still referencing/calling it as the default in the functions such as get-githubgist?

For backwards-compatibility. We can't require everyone to immediately update the way they pass tokens and this lets the old way still work while giving a hint it should be updated. The prefix "The command 'Get-GitHubToken' is obsolete." comes from PowerShell and cannot be customized, but the suffix "Tokens should be provided through the -Token parameter or $PSDefaultParameterValues" is custom and does give you the alternative. That the function gave you an error was obviously a bug and not intended.

In the future, please keep a friendly tone in GitHub issues, everything you are using here is free work of volunteers and you are always welcome to improve it yourself 🙂