Create a new memory entry
client.MemoryLayers.Entries.New(ctx, memoryLayerID, body) (*MemoryEntryDetail, error)
POST/v1/memory_layers/{memoryLayerId}/entries
Creates a new entry in a memory layer. Returns the detail view, including the resolved content body.
Create a new memory entry
package main
import (
"context"
"fmt"
"github.com/cadenya/cadenya-go"
"github.com/cadenya/cadenya-go/option"
"github.com/cadenya/cadenya-go/shared"
)
func main() {
client := cadenya.NewClient(
option.WithAPIKey("My API Key"),
)
memoryEntryDetail, err := client.MemoryLayers.Entries.New(
context.TODO(),
"memoryLayerId",
cadenya.MemoryLayerEntryNewParams{
Metadata: cadenya.F(shared.CreateResourceMetadataParam{
Name: cadenya.F("name"),
}),
Spec: cadenya.F(cadenya.MemoryEntryCreateSpecParam{
Key: cadenya.F("key"),
}),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", memoryEntryDetail.Content)
}
{
"content": "content",
"metadata": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"spec": {
"key": "key",
"description": "description",
"title": "title"
},
"info": {
"createdBy": {
"metadata": {
"id": "id",
"accountId": "accountId",
"name": "name",
"profileId": "profileId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"spec": {
"type": "PROFILE_TYPE_USER",
"email": "email",
"name": "name"
}
},
"memoryLayer": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
}
}
}Returns Examples
{
"content": "content",
"metadata": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"spec": {
"key": "key",
"description": "description",
"title": "title"
},
"info": {
"createdBy": {
"metadata": {
"id": "id",
"accountId": "accountId",
"name": "name",
"profileId": "profileId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"spec": {
"type": "PROFILE_TYPE_USER",
"email": "email",
"name": "name"
}
},
"memoryLayer": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
}
}
}