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: manifestgenerate.go
    path of file: ./repos/aether-app/aether-core/aether/backend/responsegenerator
    
    the code of the file until where you have to start completion: // Backend > ResponseGenerator > ManifestGenerate
// This file contains the manifest generation logic from given main entities.

package responsegenerator

import (
	// "fmt"
	"aether-core/aether/io/api"
	// "aether-core/aether/io/persistence"
	"aether-core/aether/services/globals"
	"aether-core/aether/services/logging"
	"aether-core/aether/services/toolbox"
	// "aether-core/aether/services/randomhashgen"
	// "encoding/json"
	// "errors"
	"fmt"
	// "github.com/davecgh/go-spew/spew"
	// "io/ioutil"
	// "os"
	// "strconv"
	// "strings"
	// "time"
)

type unbakedManifestItem struct {
	Fingerprint api.Fingerprint
	LastUpdate  api.Timestamp
	Page        uint64
}

func createUnbakedManifestItem(entity api.Provable, pageNo uint64) unbakedManifestItem {
	return unbakedManifestItem{
		Fingerprint: entity.GetFingerprint(),
		LastUpdate:  entity.GetLastUpdate(),
		Page:        pageNo,
	}
}

type unbakedManifestCarrier struct {
	BoardManifests      []unbakedManifestItem
	ThreadManifests     []unbakedManifestItem
	PostManifests       []unbakedManifestItem
	VoteManifests       []unbakedManifestItem
	KeyManifests        []unbakedManifestItem
	TruststateManifests []unbakedManifestItem
	AddressManifests    []unbakedManifestItem
}

// pgNoExistsInSlice looks whether a certain page number was ever created in this manifest slice. This isn't super efficient, but also not a hot path. Page numbers rarely go above 10
    
func bakeManifests(manifestPages *[]api.ApiResponse, entityCounts *[]api.EntityCount, filters *[]api.Filter, foldername string, isPOST bool, respType string, entityType string) {
	if respType == "addresses" {
		return // addresses do not generate manifests.
	}
	protv := globals.BackendConfig.GetProtURLVersion()
	// Create directory
	var manifestdir string
	if isPOST {
		manifestdir = fmt.Sprint(globals.BackendConfig.GetCachesDirectory(), "/", protv, "/responses/", foldername, "/manifest")
	} else {
		if respType == "addresses" {
			manifestdir = fmt.Sprint(globals.BackendConfig.GetCachesDirectory(), "/", protv, "/", respType, "/", foldername, "/manifest")
		} else {
			manifestdir = fmt.Sprint(globals.BackendConfig.GetCachesDirectory(), "/", protv, "/c0/", respType, "/", foldername, "/manifest")
		}
	}
	toolbox.CreatePath(manifestdir)
	for key, val := range *manifestPages {
		// Add counts
		val.Caching.EntityCounts = *entityCounts
		// Add filters
		if filters != nil {
			val.Filters = *filters
		}
		val.Entity = entityType
		val.Endpoint = "manifest"
		if isPOST {
			val.Endpoint = fmt.Sprint(val.Endpoint, "_post")
		}
		// Sign
		signingErr := val.CreateSignature(globals.BackendConfig.GetBackendKeyPair())
		if signingErr != nil {
			logging.Log(1, fmt.Sprintf("This page of the manifest of a multiple-page post response failed to be page-signed. Error: %#v Page: %#v\n", signingErr, val))
		}
		// Convert to JSON
		manifestJsonResp, err := val.ToJSON()
		if err != nil {
			logging.Log(1, fmt.Sprintf("This page of the manifest of a multiple-page post response failed to convert to JSON. Error: %#v\n", err))
		}
		// Save to disk
		filename := fmt.Sprint(key, ".json")
		saveFileToDisk(manifestJsonResp, manifestdir, filename)
	}
}