Skip to content

Commit e6cedcc

Browse files
authored
Merge pull request #263 from 1Password/jill/update-get-item-by-title
Update GetItemByTitle do directly call sdk
2 parents f4d68fa + 3087440 commit e6cedcc

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

internal/onepassword/sdk/client.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,18 @@ func (c *Client) GetItemByTitle(ctx context.Context, title string, vaultUuid str
9696
return nil, fmt.Errorf("found %d item(s) in vault %q with title %q", count, vaultUuid, title)
9797
}
9898

99-
return c.GetItem(ctx, matchedID, vaultUuid)
99+
sdkItem, err := c.sdkClient.Items().Get(ctx, vaultUuid, matchedID)
100+
if err != nil {
101+
return nil, fmt.Errorf("failed to get item using sdk: %w", err)
102+
}
103+
104+
modelItem := &model.Item{}
105+
err = modelItem.FromSDKItemToModel(&sdkItem)
106+
if err != nil {
107+
return nil, fmt.Errorf("sdk.GetItemByTitle failed to convert item using sdk: %w", err)
108+
}
109+
110+
return modelItem, nil
100111
}
101112

102113
func (c *Client) CreateItem(ctx context.Context, item *model.Item, vaultUuid string) (*model.Item, error) {

0 commit comments

Comments
 (0)