Skip to content

Commit

Permalink
RSDK-9338: add optional parameters in data client (viamrobotics#4595)
Browse files Browse the repository at this point in the history
  • Loading branch information
purplenicole730 authored and vijayvuyyuru committed Dec 4, 2024
1 parent 5ab540c commit 9550ff2
Showing 1 changed file with 10 additions and 39 deletions.
49 changes: 10 additions & 39 deletions app/data_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,23 +385,15 @@ func BsonToGo(rawData [][]byte) ([]map[string]interface{}, error) {
}

// TabularDataByFilter queries tabular data and metadata based on given filters.
// Deprecated: This endpoint will be removed in a future version.
func (d *DataClient) TabularDataByFilter(ctx context.Context, opts *DataByFilterOptions) (TabularDataReturn, error) {
dataReq := pb.DataRequest{}
var countOnly, includeInternalData bool
if opts != nil {
dataReq.Filter = filterToProto(opts.Filter)
if opts.Limit != 0 {
dataReq.Limit = uint64(opts.Limit)
}
if opts.Last != "" {
dataReq.Last = opts.Last
}
dataReq.SortOrder = orderToProto(opts.SortOrder)
countOnly = opts.CountOnly
includeInternalData = opts.IncludeInternalData
}
//nolint:deprecated,staticcheck
func (d *DataClient) TabularDataByFilter(
ctx context.Context,
filter Filter,
limit int,
last string,
sortOrder Order,
countOnly bool,
includeInternalData bool,
) (TabularDataReturn, error) {
resp, err := d.dataClient.TabularDataByFilter(ctx, &pb.TabularDataByFilterRequest{
DataRequest: &dataReq,
CountOnly: countOnly,
Expand Down Expand Up @@ -1278,28 +1270,7 @@ func tabularDataFromProto(proto *pb.TabularData, metadata *pb.CaptureMetadata) T
}
}

func exportTabularDataReturnFromProto(proto *pb.ExportTabularDataResponse) *ExportTabularDataReturn {
return &ExportTabularDataReturn{
OrganizationID: proto.OrganizationId,
LocationID: proto.LocationId,
RobotID: proto.RobotId,
RobotName: proto.RobotName,
PartID: proto.PartId,
PartName: proto.PartName,
ComponentName: proto.ComponentName,
ComponentType: proto.ComponentType,
MethodName: proto.MethodName,
TimeCaptured: proto.TimeCaptured.AsTime(),
MethodParameters: methodParamsFromProto(proto.MethodParameters),
Tags: proto.Tags,
Payload: proto.Payload.AsMap(),
}
}

func binaryIDToProto(binaryID *BinaryID) *pb.BinaryID {
if binaryID == nil {
return nil
}
func binaryIDToProto(binaryID BinaryID) *pb.BinaryID {
return &pb.BinaryID{
FileId: binaryID.FileID,
OrganizationId: binaryID.OrganizationID,
Expand Down

0 comments on commit 9550ff2

Please sign in to comment.