Skip to content

Instantly share code, notes, and snippets.

@jeduan

jeduan/Info.plist

Created Feb 9, 2020
Embed
What would you like to do?
PokeAPI Launchbar Action
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIconFile</key>
<string>com.spotify.client</string>
<key>LBTextInputTitle</key>
<string>Spotify</string>
<key>CFBundleIdentifier</key>
<string>com.kyleacarson.LaunchBar.action.SearchSpotify</string>
<key>CFBundleName</key>
<string>Search Spotify</string>
<key>CFBundleVersion</key>
<string>2.0</string>
<key>LBDescription</key>
<dict>
<key>LBAuthor</key>
<string>Kyle Carson</string>
<key>LBSummary</key>
<string>Search Spotify (with predictions!)</string>
<key>LBTwitter</key>
<string>@kyleacarson</string>
</dict>
<key>LBScripts</key>
<dict>
<key>LBSuggestionsScript</key>
<dict>
<key>LBLiveFeedbackEnabled</key>
<true/>
<key>LBScriptName</key>
<string>suggestion.js</string>
<key>LBBackgroundKillEnabled</key>
<true/>
</dict>
<key>LBDefaultScript</key>
<dict>
<key>LBScriptName</key>
<string>default.js</string>
</dict>
</dict>
<key>LBAssociatedApplication</key>
<string>com.spotify.client</string>
<key>LBArgument</key>
<string>songs, artists, albums</string>
<key>LBRequiresArgument</key>
<true/>
<key>LBResult</key>
<string>opens Spotify</string>
<key>LBAcceptedArgumentTypes</key>
<array>
<string>string</string>
</array>
</dict>
</plist>
function runWithString(string) {
const query = encodeURIComponent(string)
const url = `https://pokeapi.co/api/v2/pokemon/${query}`
const result = HTTP.getJSON(url);
if (!result.data) {
return [];
}
const data = [
`Name: ${result.data.name}`,
`Number: ${result.data.id}`,
];
const types = result.data.types;
if (types) {
const arr = [];
for (type of types) {
arr.push(type.type.name);
}
data.push(`Type: ${arr.join(' / ')}`);
}
return data
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment