Invoke-TCGdexRequest

SYNOPSIS

Makes an API request to the TCGdex API

SYNTAX

__AllParameterSets

Invoke-TCGdexRequest [[-Method] <string>] [-ResourceURI] <string> [[-UriFilter] <hashtable>]
 [[-Language] <string>] [-AllResults] [-NoCache]

ALIASES

This cmdlet has the following aliases,

  • Get-TCGdexResource

DESCRIPTION

The Invoke-TCGdexRequest cmdlet invokes an API request to the TCGdex API

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

The TCGdex API is a public read-only API, only GET requests are sent and no API key is used. The request uri is built from the base URI, the language, & the resource uri:

<BaseURI>/<Language>/<ResourceURI>?<UriFilter>
https://api.tcgdex.net/v2/en/cards?name=eq%3APikachu

Successful responses are cached in memory for one hour by request uri, use -NoCache to neither read from nor write to the cache. Failed requests (429 & 5xx) are retried

EXAMPLES

EXAMPLE 1

Invoke-TCGdexRequest -ResourceURI '/cards' -UriFilter @{ name = 'eq:Pikachu' }

Returns the cards named Pikachu

EXAMPLE 2

Invoke-TCGdexRequest -ResourceURI '/sets' -UriFilter @{ 'pagination:itemsPerPage' = 50 } -AllResults

Returns every set by requesting every page of the results

EXAMPLE 3

Invoke-TCGdexRequest -ResourceURI '/cards/swsh3-136' -Language 'fr' -NoCache

Returns the French data of a card without using the response cache

PARAMETERS

-AllResults

Returns all items from an endpoint by requesting every page (pagination:page) of the results

When pagination:itemsPerPage is not defined 100 items are requested with each page

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

-Language

Defines the language of the data to return

When not defined the language set by Add-TCGdexLanguage (default: en) is used

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 3
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Method

Defines the type of API method to use

Allowed values: ‘GET’

Type: System.String
DefaultValue: GET
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-NoCache

Neither reads from nor writes to the in-memory response cache

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: ''

-ResourceURI

Defines the resource uri (url) path to use when creating the API call

The path is appended to the base URI & language, such as /cards or /sets/swsh3

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases:
- Resource
ParameterSets:
- Name: (All)
  Position: 1
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-UriFilter

Hashtable of query string parameters to append to the resource uri

Use the API names of the parameters, such as name, sort:field, or pagination:page. Arrays are joined with a pipe (|) which TCGdex uses to match any of the values

Type: System.Collections.Hashtable
DefaultValue: ''
SupportsWildcards: false
Aliases:
- Filters
ParameterSets:
- Name: (All)
  Position: 2
  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