- Introduced new endpoints for contact discovery, including scanning, listing, and managing discovered contacts. - Implemented retry logic for handling missing DAV credentials during contact operations. - Added public share functionality for drive API, allowing users to manage public shares, including upload, delete, and rename operations. - Updated Nextcloud configuration to support public share links and improved error handling for public share permissions. - Enhanced logging and validation across contact and drive APIs for better error tracking and user feedback. - Added tests for new contact matching and ranking functionalities to ensure accuracy and reliability.
34 lines
671 B
Go
34 lines
671 B
Go
package discovery
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/ultisuite/ulti-backend/internal/nextcloud"
|
|
)
|
|
|
|
type ncAdapter struct {
|
|
nc *nextcloud.Client
|
|
}
|
|
|
|
func NewNCAdapter(nc *nextcloud.Client) *ncAdapter {
|
|
return &ncAdapter{nc: nc}
|
|
}
|
|
|
|
func (a *ncAdapter) ListContacts(ctx context.Context, userID, bookPath string) ([]ncContact, error) {
|
|
contacts, err := a.nc.ListContacts(ctx, userID, bookPath)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
out := make([]ncContact, 0, len(contacts))
|
|
for _, c := range contacts {
|
|
out = append(out, ncContact{
|
|
UID: c.UID,
|
|
FullName: c.FullName,
|
|
Email: c.Email,
|
|
Phone: c.Phone,
|
|
Org: c.Org,
|
|
})
|
|
}
|
|
return out, nil
|
|
}
|