(APIEndpoints)
REST APIs for managing ApiEndpoint entities
- DeleteAPIEndpoint - Delete an ApiEndpoint.
- FindAPIEndpoint - Find an ApiEndpoint via its displayName.
- GenerateOpenAPISpecForAPIEndpoint - Generate an OpenAPI specification for a particular ApiEndpoint.
- GeneratePostmanCollectionForAPIEndpoint - Generate a Postman collection for a particular ApiEndpoint.
- GetAllAPIEndpoints - Get all Api endpoints for a particular apiID.
- GetAllForVersionAPIEndpoints - Get all ApiEndpoints for a particular apiID and versionID.
- GetAPIEndpoint - Get an ApiEndpoint.
- UpsertAPIEndpoint - Upsert an ApiEndpoint.
Delete an ApiEndpoint. This will also delete all associated Request Logs (if using a Postgres datastore).
package main
import(
"context"
"log"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go"
"github.com/speakeasy-api/speakeasy-client-sdk-go/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/pkg/models/operations"
)
func main() {
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(""),
)
ctx := context.Background()
res, err := s.APIEndpoints.DeleteAPIEndpoint(ctx, operations.DeleteAPIEndpointRequest{
APIEndpointID: "string",
APIID: "string",
VersionID: "string",
})
if err != nil {
log.Fatal(err)
}
if res.StatusCode == http.StatusOK {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.DeleteAPIEndpointRequest | ✔️ | The request object to use for the request. |
*operations.DeleteAPIEndpointResponse, error
Find an ApiEndpoint via its displayName (set by operationId from a registered OpenAPI schema). This is useful for finding the ID of an ApiEndpoint to use in the /v1/apis/{apiID}/version/{versionID}/api_endpoints/{apiEndpointID} endpoints.
package main
import(
"context"
"log"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go"
"github.com/speakeasy-api/speakeasy-client-sdk-go/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/pkg/models/operations"
)
func main() {
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(""),
)
ctx := context.Background()
res, err := s.APIEndpoints.FindAPIEndpoint(ctx, operations.FindAPIEndpointRequest{
APIID: "string",
DisplayName: "string",
VersionID: "string",
})
if err != nil {
log.Fatal(err)
}
if res.APIEndpoint != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.FindAPIEndpointRequest | ✔️ | The request object to use for the request. |
*operations.FindAPIEndpointResponse, error
This endpoint will generate a new operation in any registered OpenAPI document if the operation does not already exist in the document. Returns the original document and the newly generated document allowing a diff to be performed to see what has changed.
package main
import(
"context"
"log"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go"
"github.com/speakeasy-api/speakeasy-client-sdk-go/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/pkg/models/operations"
)
func main() {
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(""),
)
ctx := context.Background()
res, err := s.APIEndpoints.GenerateOpenAPISpecForAPIEndpoint(ctx, operations.GenerateOpenAPISpecForAPIEndpointRequest{
APIEndpointID: "string",
APIID: "string",
VersionID: "string",
})
if err != nil {
log.Fatal(err)
}
if res.GenerateOpenAPISpecDiff != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GenerateOpenAPISpecForAPIEndpointRequest | ✔️ | The request object to use for the request. |
*operations.GenerateOpenAPISpecForAPIEndpointResponse, error
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.
package main
import(
"context"
"log"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go"
"github.com/speakeasy-api/speakeasy-client-sdk-go/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/pkg/models/operations"
)
func main() {
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(""),
)
ctx := context.Background()
res, err := s.APIEndpoints.GeneratePostmanCollectionForAPIEndpoint(ctx, operations.GeneratePostmanCollectionForAPIEndpointRequest{
APIEndpointID: "string",
APIID: "string",
VersionID: "string",
})
if err != nil {
log.Fatal(err)
}
if res.PostmanCollection != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GeneratePostmanCollectionForAPIEndpointRequest | ✔️ | The request object to use for the request. |
*operations.GeneratePostmanCollectionForAPIEndpointResponse, error
Get all Api endpoints for a particular apiID.
package main
import(
"context"
"log"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go"
"github.com/speakeasy-api/speakeasy-client-sdk-go/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/pkg/models/operations"
)
func main() {
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(""),
)
ctx := context.Background()
res, err := s.APIEndpoints.GetAllAPIEndpoints(ctx, operations.GetAllAPIEndpointsRequest{
APIID: "string",
})
if err != nil {
log.Fatal(err)
}
if res.APIEndpoints != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetAllAPIEndpointsRequest | ✔️ | The request object to use for the request. |
*operations.GetAllAPIEndpointsResponse, error
Get all ApiEndpoints for a particular apiID and versionID.
package main
import(
"context"
"log"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go"
"github.com/speakeasy-api/speakeasy-client-sdk-go/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/pkg/models/operations"
)
func main() {
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(""),
)
ctx := context.Background()
res, err := s.APIEndpoints.GetAllForVersionAPIEndpoints(ctx, operations.GetAllForVersionAPIEndpointsRequest{
APIID: "string",
VersionID: "string",
})
if err != nil {
log.Fatal(err)
}
if res.APIEndpoints != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetAllForVersionAPIEndpointsRequest | ✔️ | The request object to use for the request. |
*operations.GetAllForVersionAPIEndpointsResponse, error
Get an ApiEndpoint.
package main
import(
"context"
"log"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go"
"github.com/speakeasy-api/speakeasy-client-sdk-go/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/pkg/models/operations"
)
func main() {
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(""),
)
ctx := context.Background()
res, err := s.APIEndpoints.GetAPIEndpoint(ctx, operations.GetAPIEndpointRequest{
APIEndpointID: "string",
APIID: "string",
VersionID: "string",
})
if err != nil {
log.Fatal(err)
}
if res.APIEndpoint != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetAPIEndpointRequest | ✔️ | The request object to use for the request. |
*operations.GetAPIEndpointResponse, error
Upsert an ApiEndpoint. If the ApiEndpoint does not exist it will be created, otherwise it will be updated.
package main
import(
"context"
"log"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go"
"github.com/speakeasy-api/speakeasy-client-sdk-go/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/pkg/models/operations"
)
func main() {
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(""),
)
ctx := context.Background()
res, err := s.APIEndpoints.UpsertAPIEndpoint(ctx, operations.UpsertAPIEndpointRequest{
APIEndpointInput: shared.APIEndpointInput{
APIEndpointID: "string",
Description: "Public-key systematic attitude",
DisplayName: "string",
Method: "string",
Path: "/etc/periodic",
VersionID: "string",
},
APIEndpointID: "string",
APIID: "string",
VersionID: "string",
})
if err != nil {
log.Fatal(err)
}
if res.APIEndpoint != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.UpsertAPIEndpointRequest | ✔️ | The request object to use for the request. |