swapi.ps1


<#PSScriptInfo

.VERSION 1.1

.GUID 498776ec-1689-4bdb-a179-12b0a1bf977f

.AUTHOR chris.noring@microsoft.com

.COMPANYNAME Microsoft

.COPYRIGHT

.TAGS starwars, swapi

.LICENSEURI https://mit-license.org

.PROJECTURI

.ICONURI

.EXTERNALMODULEDEPENDENCIES

.REQUIREDSCRIPTS

.EXTERNALSCRIPTDEPENDENCIES

.RELEASENOTES


.PRIVATEDATA

#>


<#

.DESCRIPTION
 Description

#>
 

<#
.SYNOPSIS

Retrieves a planet

.DESCRIPTION

A command that retrieves a planet by id

.PARAMETER Id
Specifies the record you want back

.INPUTS

Id

.OUTPUTS

Object.

.EXAMPLE

PS> Get-Planet 1

#>

Function Get-Planet {
  param (
    [int] $id = 1
  )
  Invoke-RestMethod -Uri http://swapi.dev/api/planets/$id
}

<#
.SYNOPSIS

Retrieves a person

.DESCRIPTION

A command that retrieves a person by id

.PARAMETER Id
Specifies the record you want back

.INPUTS

Id

.OUTPUTS

Object.

.EXAMPLE

PS> Get-Person 1

#>

Function Get-Person {
  param (
    [int] $id = 1
  )
  Invoke-RestMethod -Uri http://swapi.dev/api/people/$id
}


<#
.SYNOPSIS

Retrieves a person

.DESCRIPTION

A command that retrieves a film by id

.PARAMETER Id
Specifies the record you want back

.INPUTS

Id

.OUTPUTS

Object.

.EXAMPLE

PS> Get-Film 1

#>

Function Get-Film {
  param (
    [int] $id = 1
  )
  Invoke-RestMethod -Uri http://swapi.dev/api/films/$id
}

<#
.SYNOPSIS

Retrieves a person

.DESCRIPTION

A command that retrieves a starship by id

.PARAMETER Id
Specifies the record you want back

.INPUTS

Id

.OUTPUTS

Object.

.EXAMPLE

PS> Get-Starship 1

#>

Function Get-Starship {
  param (
    [int] $id = 1
  )
  Invoke-RestMethod -Uri http://swapi.dev/api/starships/$id  
}

<#
.SYNOPSIS

Retrieves a vehicle

.DESCRIPTION

A command that retrieves a vehicle by id

.PARAMETER Id
Specifies the record you want back

.INPUTS

Id

.OUTPUTS

Object.

.EXAMPLE

PS> Get-Vehicle 1

#>

Function Get-Vehicle {
  param (
    [int] $id = 1
  )
  Invoke-RestMethod -Uri https://swapi.dev/api/vehicles/$id  
}

<#
.SYNOPSIS

Retrieves a species

.DESCRIPTION

A command that retrieves a species by id

.PARAMETER Id
Specifies the record you want back

.INPUTS

Id

.OUTPUTS

Object.

.EXAMPLE

PS> Get-Species 1

#>

Function Get-Species {
  param (
    [int] $id = 1
  )
  Invoke-RestMethod -Uri https://swapi.dev/api/species/$id  
}