Get a verified code sample
Returns the code sample the GunSpec API reference prints for an endpoint in one language, exactly as printed, with when it was last checked against production. Languages: curl, javascript (TypeScript with fetch), python (requests), unity, unreal, godot, sdk-typescript and sdk-python for the official SDKs. Use this tool when the user wants code that calls the GunSpec API, and give them the sample as returned rather than writing one. Replace your_key with the user's key as the keyNote says.
Anwendungsbeispiel
- 1
Eine Person fragt
- Show me how to list firearms from the GunSpec API in Python.
- 2
Der Assistent ruft das Tool auf
tools/calljson{ "name": "gunspec_code_sample", "arguments": { "path": "/v1/firearms", "method": "GET", "language": "python" }} - 3
Der Server antwortet
Für dieses Tool liegt noch keine erfasste Antwort vor.
Zugehörige Referenzen
Argumente
- stringerforderlich
The endpoint path, e.g. "/v1/firearms" or "/v1/firearms/{id}".
- Gesendet als
- ?path=
- string
HTTP method, when the path answers more than one.
- Akzeptiert
- Gesendet als
- ?method=
- stringerforderlich
The language or SDK the sample is wanted in.
- Akzeptiert
- Gesendet als
- ?language=
Jedes Argument wird als der angegebene Parameter an GET /v1/docs/samples gesendet. Dieselbe Anfrage lässt sich also mit deinem Schlüssel direkt an die API stellen, wenn du bestimmen möchtest, was zurückkommt.