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: io.go
    path of file: ./repos/corteza/server/pkg/envoyx
    
    the code of the file until where you have to start completion: package envoyx

import (
	"context"
	"fmt"
	"io"
	"io/fs"
	"os"
	"path/filepath"
	"strings"

	"github.com/cortezaproject/corteza/server/pkg/envoyx/csv"
	"github.com/cortezaproject/corteza/server/pkg/envoyx/json"
)

func (svc *Service) decodeIo(ctx context.Context, p DecodeParams) (nodes NodeSet, providers []Provider, err error) {
	// Get and validate the reader param
	r, ok := p.Params["reader"]
	if !ok {
		err = fmt.Errorf("cannot decode IO: no reader parameter provided")
		return
	}
	reader, ok := r.(io.Reader)
	if !ok {
		err = fmt.Errorf("cannot decode IO: reader should be io.Reader encoded")
		return
	}

	// Get and validate the mimetype param
	_, ok = p.Params["mime"].(string)
	if !ok {
		// @todo guess mime type
		p.Params["mime"] = "text/yaml"
	}

	// @todo different e
    
func (svc *Service) decodeIo(ctx context.Context, p DecodeParams) (nodes NodeSet, providers []Provider, err error) {
	// Get and validate the reader param
	r, ok := p.Params["reader"]
	if !ok {
		err = fmt.Errorf("cannot decode IO: no reader parameter provided")
		return
	}
	reader, ok := r.(io.Reader)
	if !ok {
		err = fmt.Errorf("cannot decode IO: reader should be io.Reader encoded")
		return
	}

	// Get and validate the mimetype param
	_, ok = p.Params["mime"].(string)
	if !ok {
		// @todo guess mime type
		p.Params["mime"] = "text/yaml"
	}

	// @todo different ext based on mimetype -- currently yaml is the only supported one
	tmpFileName := "*.yaml"
	f, err := os.CreateTemp(os.TempDir(), tmpFileName)
	if err != nil {
		return
	}
	defer f.Close()
	defer os.Remove(f.Name())

	_, err = io.Copy(f, reader)
	if err != nil {
		return
	}

	return svc.decodeFile(ctx, p, os.TempDir(), f.Name())
}