Skip to content

Commit

Permalink
feat: add BatchDeleteNodeTags
Browse files Browse the repository at this point in the history
implement ENG-4817
  • Loading branch information
cowan-macady committed Oct 8, 2024
1 parent b9d25f4 commit e3e1f14
Show file tree
Hide file tree
Showing 24 changed files with 2,138 additions and 618 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ default_stages: [commit, push]
fail_fast: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: check-case-conflict
Expand Down
65 changes: 65 additions & 0 deletions examples/ingest/cmd/batch_delete_node_tags.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright (c) 2024 IndyKite
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package cmd

import (
"context"
"fmt"
"log"

"github.com/spf13/cobra"

ingestpb "github.com/indykite/indykite-sdk-go/gen/indykite/ingest/v1beta3"
)

// batch delete node tag represents the command for deleting up to 10 tags
var batchDeleteNodeTagsCmd = &cobra.Command{
Use: "batch_delete_node_tags",
Short: "Delete bunch of records using the IndyKite Ingest API",
Long: `Delete bunch of records using the IndyKite Ingest API.`,
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {

nodeMatch1 := &ingestpb.NodeMatch{
ExternalId: "741258",
Type: "Person",
}

nodeMatch2 := &ingestpb.NodeMatch{
ExternalId: "789456",
Type: "Car",
}

nodeTags := []*ingestpb.DeleteData_NodeTagMatch{
{
Match: nodeMatch1,
Tags: []string{"Sitea", "Siteb"},
},
{
Match: nodeMatch2,
Tags: []string{"Sitea", "Siteb"},
},
}
resp, err := client.BatchDeleteNodeTags(context.Background(), nodeTags)
if err != nil {
log.Fatalf("failed to invoke operation on IndyKite Client %v", err)
}
fmt.Println(jsonp.Format(resp))
},
}

func init() {
rootCmd.AddCommand(batchDeleteNodeTagsCmd)
}
6 changes: 4 additions & 2 deletions examples/ingest/cmd/batch_upsert_nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,16 @@ var batchUpsertNodesCmd = &cobra.Command{
Type: "first_name",
Value: &objects.Value{
Type: &objects.Value_StringValue{
StringValue: "elias",
StringValue: "colias",
},
},
},
},
Tags: []string{"Sitea", "Siteb"},
}

node2 := &knowledgeobjects.Node{
ExternalId: "963258",
ExternalId: "789456",
Type: "Car",
IsIdentity: false,
Properties: []*knowledgeobjects.Property{
Expand All @@ -90,6 +91,7 @@ var batchUpsertNodesCmd = &cobra.Command{
},
},
},
Tags: []string{"Sitea", "Siteb"},
}

nodes := []*knowledgeobjects.Node{
Expand Down
Loading

0 comments on commit e3e1f14

Please sign in to comment.