Invoke-BirdWeatherGraphQLRequest

SYNOPSIS

Makes an API request to BirdWeather GraphQL

SYNTAX

Built (Default)

Invoke-BirdWeatherGraphQLRequest -Path <string[]> -Selection <string> [-Variable <Object[]>]
 [-Connection] [-OperationType <string>] [-OperationName <string>] [-AllResults] [-MaxResults <int>]
 [-Raw]

Document

Invoke-BirdWeatherGraphQLRequest -Query <string> [-QueryVariable <hashtable>] [-Raw]

ALIASES

This cmdlet has the following aliases,

  • Invoke-BWGRequest

DESCRIPTION

The Invoke-BirdWeatherGraphQLRequest cmdlet invokes an API request to the BirdWeather GraphQL API

This is an internal function that is used by all public functions

A request is either built from a field path (Path, Variable, & Selection) or is a GraphQL document that is sent as is (Query & QueryVariable)

Queries are retried when the API is rate limiting or is not available. A mutation is never retried because it could be applied twice

EXAMPLES

EXAMPLE 1

Invoke-BirdWeatherGraphQLRequest -Path 'station' -Variable $Variables -Selection 'id name'

Returns the id & name of a station

EXAMPLE 2

Invoke-BirdWeatherGraphQLRequest -Path 'stations' -Selection 'id name' -Connection -AllResults -MaxResults 500

Returns the first 500 stations by following the pagination cursor

EXAMPLE 3

Invoke-BirdWeatherGraphQLRequest -Query 'query { counts { stations species } }'

Sends the GraphQL document as is

PARAMETERS

-AllResults

Returns all nodes of a connection by following the pagination cursor Ignored for mutations

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Built
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Connection

The last field is a GraphQL connection. The nodes are returned & the AllResults parameter can be used

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Built
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-MaxResults

The maximum number of nodes that are returned when using AllResults By default all nodes are returned

Type: System.Int32
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Built
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-OperationName

The name of the operation

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Built
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-OperationType

The type of the operation Allowed values: ‘Query’, ‘Mutation’

Type: System.String
DefaultValue: Query
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Built
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Path

The names of the nested fields to query, such as ‘station’, ‘detections’ The last field is the one that is returned

Type: System.String[]
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Built
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Query

A GraphQL document that is sent as is

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Document
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-QueryVariable

Hashtable of the variables that are used by the GraphQL document

Type: System.Collections.Hashtable
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Document
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Raw

Returns the full API response (data & errors) instead of only the requested data

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Selection

The selection set of the last field, such as ‘id name’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Built
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Variable

The variables that were created by Get-BirdWeatherGraphQLVariable

Type: System.Object[]
DefaultValue: '@()'
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Built
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

N/A