Create a new memory layer
client.MemoryLayers.New(ctx, body) (*MemoryLayer, error)
POST/v1/memory_layers
Create a new memory layer
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"),
)
memoryLayer, err := client.MemoryLayers.New(context.TODO(), cadenya.MemoryLayerNewParams{
Metadata: cadenya.F(shared.CreateResourceMetadataParam{
Name: cadenya.F("name"),
}),
Spec: cadenya.F(cadenya.MemoryLayerSpecParam{
Type: cadenya.F(cadenya.MemoryLayerSpecTypeMemoryLayerTypeUnspecified),
}),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", memoryLayer.Metadata)
}
{
"metadata": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"spec": {
"type": "MEMORY_LAYER_TYPE_UNSPECIFIED",
"description": "description",
"expiresAt": "2019-12-27T18:11:19.117Z",
"systemManaged": true
},
"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"
}
},
"entryCount": 0,
"lastUsedAt": "2019-12-27T18:11:19.117Z"
}
}Returns Examples
{
"metadata": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"spec": {
"type": "MEMORY_LAYER_TYPE_UNSPECIFIED",
"description": "description",
"expiresAt": "2019-12-27T18:11:19.117Z",
"systemManaged": true
},
"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"
}
},
"entryCount": 0,
"lastUsedAt": "2019-12-27T18:11:19.117Z"
}
}