Skip to content
Last updated


title: Lost Invention Mission


Lost Invention Mission

The Lost Invention Mission is an interactive guide that helps users understand how to utilize the API for retrieving information about lost inventions. This document provides step-by-step instructions and code samples in both TypeScript and Python.

Before You Begin

Make sure you have the following before you start:

  • Your API key
  • The base API URL

Configure Your API Key and Base URL

To interact with the API, you need to set your API key and base URL. You can do this in the code samples provided below.

Add Steps for Left Panel

Define a section in the left panel by wrapping content with the step tag. Each step must have a unique id.

Step 1: Set Up Your Environment

Step 2: Configure API Key and Base URL

Step 3: Make API Requests

Chunks for Right Panel

Use chunk annotations to control which lines are highlighted in the right panel when a step becomes active in a code walkthrough.

TypeScript SDK Implementation

sdk.ts
export async function fetchInventions(apiKey: string, baseUrl: string) {
    const response = await fetch(`${baseUrl}/inventions`, {
        headers: {
            'Authorization': `Bearer ${apiKey}`
        }
    });
    return response.json();
}

TypeScript Usage Example

usage.ts
import { fetchInventions } from './sdk';

const apiKey = 'YOUR_API_KEY';
const baseUrl = 'YOUR_BASE_API_URL';

fetchInventions(apiKey, baseUrl).then(data => {
    console.log(data);
});

Python SDK Implementation

sdk.py
import requests

def fetch_inventions(api_key, base_url):
    response = requests.get(f"{base_url}/inventions", headers={
        'Authorization': f'Bearer {api_key}'
    })
    return response.json()

Python Usage Example

usage.py
from sdk import fetch_inventions

api_key = 'YOUR_API_KEY'
base_url = 'YOUR_BASE_API_URL'

data = fetch_inventions(api_key, base_url)
print(data)

Resources

  • Refer to the README files in the _filesets/typescript and _filesets/python directories for installation instructions and additional details on running the scripts.