Wilson Mar bio photo

Wilson Mar

Hello!

Calendar YouTube Github

LinkedIn

How I got in front of the GraphQL and PowerShell parade.

US (English)   Norsk (Norwegian)   Español (Spanish)   Français (French)   Deutsch (German)   Italiano   Português   Estonian   اَلْعَرَبِيَّةُ (Egypt Arabic)   Napali   中文 (简体) Chinese (Simplified)   日本語 Japanese   한국어 Korean

Overview

GraphQL is eating REST API, and GitHub is at the front of the parade of famous users.

GitHub has two API’s, both considered industry-standards others would do well to emulate:

I couldn’t find a PSGallery module for referencing GitHub’s GraphQL, so I set out to create one when that’s what Karol Kaczmarek suggested I do.


GitHub’s GraphQL

  1. DONE: Sign up at https://github.com/prerelease/agreement

  2. Contact Early Support team

    https://github.com/contact?form%5Bsubject%5D=Early+Access+Program

GraphQL based on REST

  1. What’s the name?

    “PowerShellForGitHubGraphQL” ???

    “PowerShellForGitHubQL” ???

  2. Download as zip

    This is based on the PowerShell module which calls GitHub REST APIs in PowerShell:

    https://github.com/powershell/PowerShellForGitHub

  3. Modify all “PowerShellForGitHub” to “PowerShellForGitHubGraphQL”.

    • README.md

    • LICENSE

    • See http://www.appveyor.com/docs/appveyor-yml

    • .psd1 module manifest
    • .psm1
  4. Rename modules:

    • GitHubAnalytics.psm1 to GitHubQLAnalytics.psm1 ???
  5. Get agreement from existing authors.

    Karol: Make them commiters? If so, mention contact info in README?

  6. Consolidate:

    • GitHubTokens.psm1
    • etc.

    https://github.com/pcgeek86/PSGitHub by Trevor Sullivan

    • .github/CONTRIBUTING.md
    • .github/ISSUE_TEMPLATE.md
    • .github/PULL_REQUEST_TEMPLATE.md
    • .gitattributes
    • .gitignore
    • TabCompleters/GitHub.Repositories.ps1

    https://github.com/Iristyle/Posh-GitHub written Ethan J. Brown installed by Chocolately.

    • .editorconfig
    • GitHub-Mark.png
    • powershell_logo.png
    • Posh-GitHub-Profile-readme.md
  7. Consolidate modules:

    TODO: Merge from other repos?

    https://github.com/pcgeek86/PSGitHub by Trevor Sullivan

    • Classes/GitHubGist.ps1
    • Classes/GitHubIssue.ps1
    • Classes/GitHubRepository.ps1
    • Functions/Private/Get-GitHubToken.ps1
    • Functions/Private/Invoke-GitHubApi.ps1
    • Functions/Public/Find-GitHubRepository.ps1
    • Functions/Public/Get-GitHubAssignee.ps1
    • Functions/Public/Get-GitHubAuthenticatedUser.ps1
    • Functions/Public/Get-GitHubGist.ps1
    • Functions/Public/Get-GitHubMilestone.ps1
    • Functions/Public/New-GitHubGist.ps1
    • Functions/Public/New-GitHubIssue.ps1
    • Functions/Public/New-GitHubRepository.ps1
    • Functions/Public/Remove-GitHubGist.ps1
    • Functions/Public/Remove-GitHubRepository.ps1
    • Functions/Public/Save-GitHubGist.ps1
    • Functions/Public/Set-GitHubAuthenticatedUser.ps1
    • Functions/Public/Set-GitHubGist.ps1
    • Functions/Public/Set-GitHubIssue.ps1
    • Functions/Public/Set-GitHubRepository.ps1
    • Functions/Public/Set-GitHubToken.ps1
    • Functions/Public/Test-GitHubAssignee.ps1
    • Tests/Unit/psgithub.tests.ps1

    https://github.com/davidobrien1985/githubconnect by David O’Brien

    • Public/authentication.ps1
    • Public/branch.ps1
    • Public/organisation.ps1
    • Public/pullrequest.ps1
    • Public/repository.ps1
    • Public/teams.ps1
    • Public/webhook.ps1

    https://github.com/Iristyle/Posh-GitHub written Ethan J. Brown installed by Chocolately.

    • Posh-GitHub-Profile.ps1
  8. Get Appyveyor build project:

    https://www.appveyor.com/

  9. Improve README

    Mention https://www.appveyor.com/ build server in the cloud

    Mention https://www.powershellgallery.com/

  10. Define License:

    https://github.com/PowerShell/PowerShellForGitHubGraphQL/blob/master/LICENSE

  11. Define README:

    https://github.com/PowerShell/PowerShellForGitHubGraphQL/blob/master/README.md

    Continue from Posh-GitHub:

  12. Define repo at:

    https://github.com/PowerShell/PowerShellForGitHubGraphQL/

    Title: Microsoft PowerShell wrapper for GitHub’s GraphQL API

    TODO: Karol?

  13. Construct for PSGallery:

    Follow http://www.systemcentercentral.com/day-19-creating-online-powershellget-repository/

    From: PowerShell Package Management Archictecture 2016

  14. Register-ModuleSource - Add to PSGallery:

  15. List the many fields in metadata for module PowerShellForGitHubGraphQL:

    $response.GetEnumerator() | ?{ $_.Name -eq "PowerShellForGitHubGraphQL" } | format-list
    

    The response:

    Name                       : PowerShellForGitHubGraphQL
    Version                    : 0.1.0
    Type                       : Module
    Description                : PowerShell wrapper for GitHub GraphQL API
    Author                     : Microsoft Corporation
    CompanyName                : PowerShellTeam
    Copyright                  : (c) 2016 Microsoft Corporation. All rights 
                              reserved.
    PublishedDate              : 7/27/16 8:33:44 PM
    InstalledDate              : 
    UpdatedDate                : 
    LicenseUri                 : https://github.com/PowerShell/PowerShellForGitHubGraphQL/
                              blob/master/LICENSE
    ProjectUri                 : https://github.com/PowerShell/PowerShellForGitHubGraphQL
    IconUri                    : 
    Tags                       : {GitHub, GraphQL, API, PowerShell, PSModule}
    Includes                   : {Cmdlet, Workflow, Function, DscResource...}
    PowerShellGetFormatVersion : 
    ReleaseNotes               : 
    Dependencies               : {}
    RepositorySourceLocation   : https://www.powershellgallery.com/api/v2/
    Repository                 : PSGallery
    PackageManagementProvider  : NuGet
    AdditionalMetadata         : {developmentDependency, FileList, 
                              isLatestVersion, IsPrerelease...}
    

Publicity

https://github.com/chentsulin/awesome-graphql


New README

Environment Variables

Cmdlets are set to use the following environment variables as defaults

GITHUB_OAUTH_TOKEN - Required for all cmdlets - use New-GitHubOAuthToken to establish a token and automatically set this variable for the current user

GITHUB_USERNAME - Can be optionally set to specify a global default user - use the Set-GitHubUserName helper

GITHUB_ORGANIZATION - Can be optionally set to specify a global default organization - use the Set-GitHubOrganization helper

Last Command Output

A Powershell object created from the incoming JSON is always stored in the variable $GITHUB_API_OUTPUT after each call to the GitHub API

More on API Microservices

This is one of a series:

More about Git & GitHub

This is one of a series on Git and GitHub:

  1. Git and GitHub videos

  2. Why Git? (file-based backups vs Git clone)
  3. Git Markdown text

  4. Git basics (script)
  5. Git whoops (correct mistakes)
  6. Git messages (in commits)

  7. Git command shortcuts
  8. Git custom commands

  9. Git-client based workflows

  10. Git HEAD (Commitish references)

  11. Git interactive merge (imerge)
  12. Git patch
  13. Git rebase

  14. Git utilities
  15. Git-signing

  16. Git hooks
  17. GitHub data security
  18. TFS vs GitHub

  19. GitHub actions for automation JavaScript
  20. GitHub REST API
  21. GitHub GraphQL API
  22. GitHub PowerShell API Programming
  23. GitHub GraphQL PowerShell Module