You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: sys_plugins_runtimes.go
    path of file: ./repos/vault/api
    
    the code of the file until where you have to start completion: // Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package api

import (
	"context"
	"errors"
	"fmt"
	"net/http"

	"github.com/mitchellh/mapstructure"
)

// GetPluginRuntimeInput
    
func (c *Sys) ListPluginRuntimes(ctx context.Context, input *ListPluginRuntimesInput) (*ListPluginRuntimesResponse, error) {
	ctx, cancelFunc := c.c.withConfiguredTimeout(ctx)
	defer cancelFunc()

	if input != nil && input.Type == PluginRuntimeTypeUnsupported {
		return nil, fmt.Errorf("%q is not a supported runtime type", input.Type.String())
	}

	resp, err := c.c.rawRequestWithContext(ctx, c.c.NewRequest(http.MethodGet, "/v1/sys/plugins/runtimes/catalog"))
	if err != nil && resp == nil {
		return nil, err
	}
	if resp == nil {
		return nil, nil
	}
	defer resp.Body.Close()

	secret, err := ParseSecret(resp.Body)
	if err != nil {
		return nil, err
	}
	if secret == nil || secret.Data == nil {
		return nil, errors.New("data from server response is empty")
	}
	if _, ok := secret.Data["runtimes"]; !ok {
		return nil, fmt.Errorf("data from server response does not contain runtimes")
	}

	var runtimes []PluginRuntimeDetails
	if err = mapstructure.Decode(secret.Data["runtimes"], &runtimes); err != nil {
		return nil, err
	}

	// return all runtimes in the catalog
	if input == nil {
		return &ListPluginRuntimesResponse{Runtimes: runtimes}, nil
	}

	result := &ListPluginRuntimesResponse{
		Runtimes: []PluginRuntimeDetails{},
	}
	for _, runtime := range runtimes {
		if runtime.Type == input.Type.String() {
			result.Runtimes = append(result.Runtimes, runtime)
		}
	}
	return result, nil
}