package dtos import "fmt" type HasObjectKey interface { GetObjectKey() string } func ExtractObjectKeyFromRequest(dto any) (string, error) { v, ok := dto.(HasObjectKey) if !ok { return "", fmt.Errorf("dto of type %T does not implement HasObjectKey interface", dto) } return v.GetObjectKey(), nil }