|
1 | 1 | # apiEndpoints
|
2 | 2 |
|
| 3 | +## Overview |
| 4 | + |
3 | 5 | REST APIs for managing ApiEndpoint entities
|
4 | 6 |
|
| 7 | +### Available Operations |
| 8 | + |
| 9 | +* [deleteApiEndpoint](#deleteapiendpoint) - Delete an ApiEndpoint. |
| 10 | +* [findApiEndpoint](#findapiendpoint) - Find an ApiEndpoint via its displayName. |
| 11 | +* [generateOpenApiSpecForApiEndpoint](#generateopenapispecforapiendpoint) - Generate an OpenAPI specification for a particular ApiEndpoint. |
| 12 | +* [generatePostmanCollectionForApiEndpoint](#generatepostmancollectionforapiendpoint) - Generate a Postman collection for a particular ApiEndpoint. |
| 13 | +* [getAllApiEndpoints](#getallapiendpoints) - Get all Api endpoints for a particular apiID. |
| 14 | +* [getAllForVersionApiEndpoints](#getallforversionapiendpoints) - Get all ApiEndpoints for a particular apiID and versionID. |
| 15 | +* [getApiEndpoint](#getapiendpoint) - Get an ApiEndpoint. |
| 16 | +* [upsertApiEndpoint](#upsertapiendpoint) - Upsert an ApiEndpoint. |
| 17 | + |
| 18 | +## deleteApiEndpoint |
| 19 | + |
| 20 | +Delete an ApiEndpoint. This will also delete all associated Request Logs (if using a Postgres datastore). |
| 21 | + |
| 22 | +### Example Usage |
| 23 | + |
| 24 | +```typescript |
| 25 | +import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript"; |
| 26 | +import { DeleteApiEndpointRequest, DeleteApiEndpointResponse } from "@speakeasy-api/speakeasy-client-sdk-typescript/dist/sdk/models/operations"; |
| 27 | +import { AxiosError } from "axios"; |
| 28 | + |
| 29 | +const sdk = new Speakeasy({ |
| 30 | + security: { |
| 31 | + apiKey: "YOUR_API_KEY_HERE", |
| 32 | + }, |
| 33 | +}); |
| 34 | + |
| 35 | +const req: DeleteApiEndpointRequest = { |
| 36 | + apiEndpointID: "delectus", |
| 37 | + apiID: "tempora", |
| 38 | + versionID: "suscipit", |
| 39 | +}; |
| 40 | + |
| 41 | +sdk.apiEndpoints.deleteApiEndpoint(req).then((res: DeleteApiEndpointResponse | AxiosError) => { |
| 42 | + if (res instanceof UsageExamplePostResponse && res.statusCode == 200) { |
| 43 | + // handle response |
| 44 | + } |
| 45 | +}); |
| 46 | +``` |
| 47 | + |
| 48 | +## findApiEndpoint |
| 49 | + |
| 50 | +Find an ApiEndpoint via its displayName (set by operationId from a registered OpenAPI schema). |
| 51 | +This is useful for finding the ID of an ApiEndpoint to use in the /v1/apis/{apiID}/version/{versionID}/api_endpoints/{apiEndpointID} endpoints. |
| 52 | + |
| 53 | +### Example Usage |
| 54 | + |
| 55 | +```typescript |
| 56 | +import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript"; |
| 57 | +import { FindApiEndpointRequest, FindApiEndpointResponse } from "@speakeasy-api/speakeasy-client-sdk-typescript/dist/sdk/models/operations"; |
| 58 | +import { AxiosError } from "axios"; |
| 59 | + |
| 60 | +const sdk = new Speakeasy({ |
| 61 | + security: { |
| 62 | + apiKey: "YOUR_API_KEY_HERE", |
| 63 | + }, |
| 64 | +}); |
| 65 | + |
| 66 | +const req: FindApiEndpointRequest = { |
| 67 | + apiID: "molestiae", |
| 68 | + displayName: "minus", |
| 69 | + versionID: "placeat", |
| 70 | +}; |
| 71 | + |
| 72 | +sdk.apiEndpoints.findApiEndpoint(req).then((res: FindApiEndpointResponse | AxiosError) => { |
| 73 | + if (res instanceof UsageExamplePostResponse && res.statusCode == 200) { |
| 74 | + // handle response |
| 75 | + } |
| 76 | +}); |
| 77 | +``` |
| 78 | + |
| 79 | +## generateOpenApiSpecForApiEndpoint |
| 80 | + |
| 81 | +This endpoint will generate a new operation in any registered OpenAPI document if the operation does not already exist in the document. |
| 82 | +Returns the original document and the newly generated document allowing a diff to be performed to see what has changed. |
| 83 | + |
| 84 | +### Example Usage |
| 85 | + |
| 86 | +```typescript |
| 87 | +import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript"; |
| 88 | +import { |
| 89 | + GenerateOpenApiSpecForApiEndpointRequest, |
| 90 | + GenerateOpenApiSpecForApiEndpointResponse, |
| 91 | +} from "@speakeasy-api/speakeasy-client-sdk-typescript/dist/sdk/models/operations"; |
| 92 | +import { AxiosError } from "axios"; |
| 93 | + |
| 94 | +const sdk = new Speakeasy({ |
| 95 | + security: { |
| 96 | + apiKey: "YOUR_API_KEY_HERE", |
| 97 | + }, |
| 98 | +}); |
| 99 | + |
| 100 | +const req: GenerateOpenApiSpecForApiEndpointRequest = { |
| 101 | + apiEndpointID: "voluptatum", |
| 102 | + apiID: "iusto", |
| 103 | + versionID: "excepturi", |
| 104 | +}; |
| 105 | + |
| 106 | +sdk.apiEndpoints.generateOpenApiSpecForApiEndpoint(req).then((res: GenerateOpenApiSpecForApiEndpointResponse | AxiosError) => { |
| 107 | + if (res instanceof UsageExamplePostResponse && res.statusCode == 200) { |
| 108 | + // handle response |
| 109 | + } |
| 110 | +}); |
| 111 | +``` |
| 112 | + |
| 113 | +## generatePostmanCollectionForApiEndpoint |
| 114 | + |
| 115 | +Generates a postman collection that allows the endpoint to be called from postman variables produced for any path/query/header parameters included in the OpenAPI document. |
| 116 | + |
| 117 | +### Example Usage |
| 118 | + |
| 119 | +```typescript |
| 120 | +import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript"; |
| 121 | +import { |
| 122 | + GeneratePostmanCollectionForApiEndpointRequest, |
| 123 | + GeneratePostmanCollectionForApiEndpointResponse, |
| 124 | +} from "@speakeasy-api/speakeasy-client-sdk-typescript/dist/sdk/models/operations"; |
| 125 | +import { AxiosError } from "axios"; |
| 126 | + |
| 127 | +const sdk = new Speakeasy({ |
| 128 | + security: { |
| 129 | + apiKey: "YOUR_API_KEY_HERE", |
| 130 | + }, |
| 131 | +}); |
| 132 | + |
| 133 | +const req: GeneratePostmanCollectionForApiEndpointRequest = { |
| 134 | + apiEndpointID: "nisi", |
| 135 | + apiID: "recusandae", |
| 136 | + versionID: "temporibus", |
| 137 | +}; |
| 138 | + |
| 139 | +sdk.apiEndpoints.generatePostmanCollectionForApiEndpoint(req).then((res: GeneratePostmanCollectionForApiEndpointResponse | AxiosError) => { |
| 140 | + if (res instanceof UsageExamplePostResponse && res.statusCode == 200) { |
| 141 | + // handle response |
| 142 | + } |
| 143 | +}); |
| 144 | +``` |
| 145 | + |
| 146 | +## getAllApiEndpoints |
| 147 | + |
| 148 | +Get all Api endpoints for a particular apiID. |
| 149 | + |
| 150 | +### Example Usage |
| 151 | + |
| 152 | +```typescript |
| 153 | +import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript"; |
| 154 | +import { GetAllApiEndpointsRequest, GetAllApiEndpointsResponse } from "@speakeasy-api/speakeasy-client-sdk-typescript/dist/sdk/models/operations"; |
| 155 | +import { AxiosError } from "axios"; |
| 156 | + |
| 157 | +const sdk = new Speakeasy({ |
| 158 | + security: { |
| 159 | + apiKey: "YOUR_API_KEY_HERE", |
| 160 | + }, |
| 161 | +}); |
| 162 | + |
| 163 | +const req: GetAllApiEndpointsRequest = { |
| 164 | + apiID: "ab", |
| 165 | +}; |
| 166 | + |
| 167 | +sdk.apiEndpoints.getAllApiEndpoints(req).then((res: GetAllApiEndpointsResponse | AxiosError) => { |
| 168 | + if (res instanceof UsageExamplePostResponse && res.statusCode == 200) { |
| 169 | + // handle response |
| 170 | + } |
| 171 | +}); |
| 172 | +``` |
| 173 | + |
| 174 | +## getAllForVersionApiEndpoints |
| 175 | + |
| 176 | +Get all ApiEndpoints for a particular apiID and versionID. |
| 177 | + |
| 178 | +### Example Usage |
| 179 | + |
| 180 | +```typescript |
| 181 | +import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript"; |
| 182 | +import { GetAllForVersionApiEndpointsRequest, GetAllForVersionApiEndpointsResponse } from "@speakeasy-api/speakeasy-client-sdk-typescript/dist/sdk/models/operations"; |
| 183 | +import { AxiosError } from "axios"; |
| 184 | + |
| 185 | +const sdk = new Speakeasy({ |
| 186 | + security: { |
| 187 | + apiKey: "YOUR_API_KEY_HERE", |
| 188 | + }, |
| 189 | +}); |
| 190 | + |
| 191 | +const req: GetAllForVersionApiEndpointsRequest = { |
| 192 | + apiID: "quis", |
| 193 | + versionID: "veritatis", |
| 194 | +}; |
| 195 | + |
| 196 | +sdk.apiEndpoints.getAllForVersionApiEndpoints(req).then((res: GetAllForVersionApiEndpointsResponse | AxiosError) => { |
| 197 | + if (res instanceof UsageExamplePostResponse && res.statusCode == 200) { |
| 198 | + // handle response |
| 199 | + } |
| 200 | +}); |
| 201 | +``` |
| 202 | + |
| 203 | +## getApiEndpoint |
| 204 | + |
| 205 | +Get an ApiEndpoint. |
| 206 | + |
| 207 | +### Example Usage |
| 208 | + |
| 209 | +```typescript |
| 210 | +import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript"; |
| 211 | +import { GetApiEndpointRequest, GetApiEndpointResponse } from "@speakeasy-api/speakeasy-client-sdk-typescript/dist/sdk/models/operations"; |
| 212 | +import { AxiosError } from "axios"; |
| 213 | + |
| 214 | +const sdk = new Speakeasy({ |
| 215 | + security: { |
| 216 | + apiKey: "YOUR_API_KEY_HERE", |
| 217 | + }, |
| 218 | +}); |
| 219 | + |
| 220 | +const req: GetApiEndpointRequest = { |
| 221 | + apiEndpointID: "deserunt", |
| 222 | + apiID: "perferendis", |
| 223 | + versionID: "ipsam", |
| 224 | +}; |
| 225 | + |
| 226 | +sdk.apiEndpoints.getApiEndpoint(req).then((res: GetApiEndpointResponse | AxiosError) => { |
| 227 | + if (res instanceof UsageExamplePostResponse && res.statusCode == 200) { |
| 228 | + // handle response |
| 229 | + } |
| 230 | +}); |
| 231 | +``` |
| 232 | + |
| 233 | +## upsertApiEndpoint |
| 234 | + |
| 235 | +Upsert an ApiEndpoint. If the ApiEndpoint does not exist it will be created, otherwise it will be updated. |
| 236 | + |
| 237 | +### Example Usage |
| 238 | + |
| 239 | +```typescript |
| 240 | +import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript"; |
| 241 | +import { UpsertApiEndpointRequest, UpsertApiEndpointResponse } from "@speakeasy-api/speakeasy-client-sdk-typescript/dist/sdk/models/operations"; |
| 242 | +import { AxiosError } from "axios"; |
| 243 | + |
| 244 | +const sdk = new Speakeasy({ |
| 245 | + security: { |
| 246 | + apiKey: "YOUR_API_KEY_HERE", |
| 247 | + }, |
| 248 | +}); |
| 249 | + |
| 250 | +const req: UpsertApiEndpointRequest = { |
| 251 | + apiEndpointInput: { |
| 252 | + apiEndpointId: "repellendus", |
| 253 | + description: "sapiente", |
| 254 | + displayName: "quo", |
| 255 | + method: "odit", |
| 256 | + path: "at", |
| 257 | + versionId: "at", |
| 258 | + }, |
| 259 | + apiEndpointID: "maiores", |
| 260 | + apiID: "molestiae", |
| 261 | + versionID: "quod", |
| 262 | +}; |
5 | 263 |
|
6 |
| -* [deleteApiEndpoint](deleteapiendpoint.md) - Delete an ApiEndpoint. |
7 |
| -* [findApiEndpoint](findapiendpoint.md) - Find an ApiEndpoint via its displayName. |
8 |
| -* [generateOpenApiSpecForApiEndpoint](generateopenapispecforapiendpoint.md) - Generate an OpenAPI specification for a particular ApiEndpoint. |
9 |
| -* [generatePostmanCollectionForApiEndpoint](generatepostmancollectionforapiendpoint.md) - Generate a Postman collection for a particular ApiEndpoint. |
10 |
| -* [getAllApiEndpoints](getallapiendpoints.md) - Get all Api endpoints for a particular apiID. |
11 |
| -* [getAllForVersionApiEndpoints](getallforversionapiendpoints.md) - Get all ApiEndpoints for a particular apiID and versionID. |
12 |
| -* [getApiEndpoint](getapiendpoint.md) - Get an ApiEndpoint. |
13 |
| -* [upsertApiEndpoint](upsertapiendpoint.md) - Upsert an ApiEndpoint. |
| 264 | +sdk.apiEndpoints.upsertApiEndpoint(req).then((res: UpsertApiEndpointResponse | AxiosError) => { |
| 265 | + if (res instanceof UsageExamplePostResponse && res.statusCode == 200) { |
| 266 | + // handle response |
| 267 | + } |
| 268 | +}); |
| 269 | +``` |
0 commit comments