en-US/FreeDadJokes/FreeDadJokes-Help.xml

<?xml version="1.0" encoding="utf-8"?>
<helpItems xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" schema="maml" xmlns="http://msh">
  <command:command>
    <command:details>
      <command:name>Get-DadJoke</command:name>
      <maml:description>
        <maml:para>Retrieves and displays a random dad joke from a predefined API.</maml:para>
      </maml:description>
      <command:verb>Get</command:verb>
      <command:noun>DadJoke</command:noun>
    </command:details>
    <maml:description>
      <maml:para>The Get-DadJoke function fetches a random dad joke from a hardcoded API endpoint (official-joke-api.appspot.com) and displays it in a readable format. It first tests the API availability using Test-JokeAPI, then retrieves the joke using Request-DadJoke. The joke is output as two separate lines: setup and punchline.</maml:para>
    </maml:description>
    <command:syntax>
      <command:syntaxItem>
        <maml:name>Get-DadJoke</maml:name>
      </command:syntaxItem>
    </command:syntax>
    <command:parameters />
    <command:inputTypes>
      <command:inputType>
        <dev:type>
          <dev:name>None. You cannot pipe input to this function.</dev:name>
        </dev:type>
        <maml:description>
          <maml:para>{{ Fill in the Description }}</maml:para>
        </maml:description>
      </command:inputType>
    </command:inputTypes>
    <command:returnValues>
      <command:returnValue>
        <dev:type>
          <dev:name>System.String</dev:name>
        </dev:type>
        <maml:description>
          <maml:para>Outputs two strings to the pipeline: the joke setup followed by the punchline.

{{ Fill in the Description }}</maml:para>
        </maml:description>
      </command:returnValue>
    </command:returnValues>
    <maml:alertSet>
      <maml:alert>
        <maml:para>Author: Michael Free
Date Created: February 10, 2024
Module Name: FreeDadJokes

DEPENDENCIES:
- This function depends on Test-JokeAPI and Request-DadJoke functions.
- Ensure both dependent functions are loaded before using Get-DadJoke.

API INFORMATION:
- Uses: https://official-joke-api.appspot.com/random_joke
- This is a free, no-authentication-required API.
- The API returns JSON with 'setup' and 'punchline' properties.

ERROR HANDLING:
- The function will throw an error if either Test-JokeAPI or Request-DadJoke fails.
- Consider adding a fallback mechanism or cached jokes for offline scenarios.</maml:para>
      </maml:alert>
    </maml:alertSet>
    <command:examples>
      <command:example>
        <maml:title>--------- EXAMPLE 1 ---------</maml:title>
        <maml:introduction>
          <maml:para>Get-DadJoke
Why don't scientists trust atoms?
Because they make up everything!</maml:para>
          <maml:para>&#x80;</maml:para>
          <maml:para>This example shows the basic usage of Get-DadJoke.</maml:para>
        </maml:introduction>
        <dev:code />
        <dev:remarks />
      </command:example>
      <command:example>
        <maml:title>--------- EXAMPLE 2 ---------</maml:title>
        <maml:introduction>
          <maml:para>$jokeLines = Get-DadJoke
PS C:\&gt; $jokeLines[0]
Why don't scientists trust atoms?
PS C:\&gt; $jokeLines[1]
Because they make up everything!</maml:para>
          <maml:para>&#x80;</maml:para>
          <maml:para>This example captures the output as an array of strings.</maml:para>
        </maml:introduction>
        <dev:code />
        <dev:remarks />
      </command:example>
    </command:examples>
    <command:relatedLinks>
      <maml:navigationLink>
        <maml:linkText>Online Version</maml:linkText>
        <command:uri />
      </maml:navigationLink>
    </command:relatedLinks>
  </command:command>
</helpItems>