diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 2d419c7..6550805 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -3,10 +3,10 @@ id: 599a9576-4665-431e-be1e-44cc13ef28aa management: docChecksum: dd4d04e62622de8f631720b5be68964d docVersion: latest - speakeasyVersion: 1.378.0 - generationVersion: 2.404.3 - releaseVersion: 0.7.1 - configChecksum: 29af96f7ea7470cddf48d91f3b2873ec + speakeasyVersion: 1.385.0 + generationVersion: 2.407.2 + releaseVersion: 0.7.2 + configChecksum: ed711ed185d766c457022634eb07a389 repoURL: https://github.com/LukeHagar/discoursejs.git repoSubDirectory: . installationURL: https://github.com/LukeHagar/discoursejs @@ -16,7 +16,7 @@ features: additionalDependencies: 0.1.0 additionalProperties: 0.1.1 constsAndDefaults: 0.1.11 - core: 3.14.1 + core: 3.14.2 defaultEnabledRetries: 0.1.0 deprecations: 2.81.1 envVarSecurityUsage: 0.1.1 diff --git a/README.md b/README.md index dbf1c94..ffc1299 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,88 @@ + +## Summary + +Discourse API Documentation: This page contains the documentation on how to use Discourse through API calls. + +> Note: For any endpoints not listed you can follow the +[reverse engineer the Discourse API](https://meta.discourse.org/t/-/20576) +guide to figure out how to use an API endpoint. + +### Request Content-Type + +The Content-Type for POST and PUT requests can be set to `application/x-www-form-urlencoded`, +`multipart/form-data`, or `application/json`. + +### Endpoint Names and Response Content-Type + +Most API endpoints provide the same content as their HTML counterparts. For example +the URL `/categories` serves a list of categories, the `/categories.json` API provides the +same information in JSON format. + +Instead of sending API requests to `/categories.json` you may also send them to `/categories` +and add an `Accept: application/json` header to the request to get the JSON response. +Sending requests with the `Accept` header is necessary if you want to use URLs +for related endpoints returned by the API, such as pagination URLs. +These URLs are returned without the `.json` prefix so you need to add the header in +order to get the correct response format. + +### Authentication + +Some endpoints do not require any authentication, pretty much anything else will +require you to be authenticated. + +To become authenticated you will need to create an API Key from the admin panel. + +Once you have your API Key you can pass it in along with your API Username +as an HTTP header like this: + +``` +curl -X GET "http://127.0.0.1:3000/admin/users/list/active.json" \ +-H "Api-Key: 714552c6148e1617aeab526d0606184b94a80ec048fc09894ff1a72b740c5f19" \ +-H "Api-Username: system" +``` + +and this is how POST requests will look: + +``` +curl -X POST "http://127.0.0.1:3000/categories" \ +-H "Content-Type: multipart/form-data;" \ +-H "Api-Key: 714552c6148e1617aeab526d0606184b94a80ec048fc09894ff1a72b740c5f19" \ +-H "Api-Username: system" \ +-F "name=89853c20-4409-e91a-a8ea-f6cdff96aaaa" \ +-F "color=49d9e9" \ +-F "text_color=f0fcfd" +``` + +### Boolean values + +If an endpoint accepts a boolean be sure to specify it as a lowercase +`true` or `false` value unless noted otherwise. + + + +## Table of Contents + +* [SDK Installation](#sdk-installation) +* [Requirements](#requirements) +* [SDK Example Usage](#sdk-example-usage) +* [Available Resources and Operations](#available-resources-and-operations) +* [Standalone functions](#standalone-functions) +* [File uploads](#file-uploads) +* [Retries](#retries) +* [Error Handling](#error-handling) +* [Server Selection](#server-selection) +* [Custom HTTP Client](#custom-http-client) +* [Debugging](#debugging) + + ## SDK Installation +The SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/) or [yarn](https://classic.yarnpkg.com/en/) package managers. + ### NPM ```bash diff --git a/RELEASES.md b/RELEASES.md index d2c813c..8390e31 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -238,4 +238,14 @@ Based on: ### Generated - [typescript v0.7.1] . ### Releases -- [NPM v0.7.1] https://www.npmjs.com/package/@lukehagar/discoursejs/v/0.7.1 - . \ No newline at end of file +- [NPM v0.7.1] https://www.npmjs.com/package/@lukehagar/discoursejs/v/0.7.1 - . + +## 2024-08-31 00:23:16 +### Changes +Based on: +- OpenAPI Doc latest +- Speakeasy CLI 1.385.0 (2.407.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v0.7.2] . +### Releases +- [NPM v0.7.2] https://www.npmjs.com/package/@lukehagar/discoursejs/v/0.7.2 - . \ No newline at end of file diff --git a/gen.yaml b/gen.yaml index 86d72b1..55d4bd5 100644 --- a/gen.yaml +++ b/gen.yaml @@ -11,7 +11,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: false typescript: - version: 0.7.1 + version: 0.7.2 additionalDependencies: dependencies: {} devDependencies: {} diff --git a/jsr.json b/jsr.json index 9e65dee..2935742 100644 --- a/jsr.json +++ b/jsr.json @@ -2,7 +2,7 @@ { "name": "@lukehagar/discoursejs", - "version": "0.7.1", + "version": "0.7.2", "exports": { ".": "./src/index.ts", "./sdk/models/errors": "./src/sdk/models/errors/index.ts", diff --git a/package.json b/package.json index ed00557..e722967 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lukehagar/discoursejs", - "version": "0.7.1", + "version": "0.7.2", "author": "LukeHagar", "main": "./index.js", "sideEffects": false, diff --git a/src/lib/config.ts b/src/lib/config.ts index 2c9328a..efd4e07 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -60,7 +60,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "latest", - sdkVersion: "0.7.1", - genVersion: "2.404.3", - userAgent: "speakeasy-sdk/typescript 0.7.1 2.404.3 latest @lukehagar/discoursejs", + sdkVersion: "0.7.2", + genVersion: "2.407.2", + userAgent: "speakeasy-sdk/typescript 0.7.2 2.407.2 latest @lukehagar/discoursejs", } as const; diff --git a/src/lib/security.ts b/src/lib/security.ts index 94dcf92..d529ec7 100644 --- a/src/lib/security.ts +++ b/src/lib/security.ts @@ -68,13 +68,20 @@ type SecurityInputOAuth2ClientCredentials = { value: { clientID?: string | undefined; clientSecret?: string | undefined } | null | undefined; }; +type SecurityInputCustom = { + type: "http:custom"; + value: any | null | undefined; + fieldName: string; +}; + export type SecurityInput = | SecurityInputBasic | SecurityInputBearer | SecurityInputAPIKey | SecurityInputOAuth2 | SecurityInputOAuth2ClientCredentials - | SecurityInputOIDC; + | SecurityInputOIDC + | SecurityInputCustom; export function resolveSecurity(...options: SecurityInput[][]): SecurityState | null { const state: SecurityState = { @@ -90,6 +97,8 @@ export function resolveSecurity(...options: SecurityInput[][]): SecurityState | return false; } else if (o.type === "http:basic") { return o.value.username != null || o.value.password != null; + } else if (o.type === "http:custom") { + return null; } else if (o.type === "oauth2:client_credentials") { return o.value.clientID != null || o.value.clientSecret != null; } else if (typeof o.value === "string") { @@ -125,6 +134,8 @@ export function resolveSecurity(...options: SecurityInput[][]): SecurityState | case "http:basic": applyBasic(state, spec); break; + case "http:custom": + break; case "http:bearer": applyBearer(state, spec); break;