initial commit

This commit is contained in:
Arnaud Delcasse
2025-10-08 09:09:53 +02:00
commit efccea3f64
16 changed files with 2780 additions and 0 deletions

View File

@@ -0,0 +1,985 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.7
// protoc v6.31.1
// source: saved-search.proto
package gen
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
structpb "google.golang.org/protobuf/types/known/structpb"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// GeoJSON Feature representation for saved searches
type SavedSearchGeoJsonFeature struct {
state protoimpl.MessageState `protogen:"open.v1"`
Serialized string `protobuf:"bytes,1,opt,name=serialized,proto3" json:"serialized,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SavedSearchGeoJsonFeature) Reset() {
*x = SavedSearchGeoJsonFeature{}
mi := &file_saved_search_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SavedSearchGeoJsonFeature) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SavedSearchGeoJsonFeature) ProtoMessage() {}
func (x *SavedSearchGeoJsonFeature) ProtoReflect() protoreflect.Message {
mi := &file_saved_search_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SavedSearchGeoJsonFeature.ProtoReflect.Descriptor instead.
func (*SavedSearchGeoJsonFeature) Descriptor() ([]byte, []int) {
return file_saved_search_proto_rawDescGZIP(), []int{0}
}
func (x *SavedSearchGeoJsonFeature) GetSerialized() string {
if x != nil {
return x.Serialized
}
return ""
}
// Saved search message
type SavedSearch struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
OwnerId string `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"`
Departure *SavedSearchGeoJsonFeature `protobuf:"bytes,3,opt,name=departure,proto3" json:"departure,omitempty"`
Destination *SavedSearchGeoJsonFeature `protobuf:"bytes,4,opt,name=destination,proto3" json:"destination,omitempty"`
Datetime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=datetime,proto3" json:"datetime,omitempty"`
Data *structpb.Struct `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"`
CreatedAt *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SavedSearch) Reset() {
*x = SavedSearch{}
mi := &file_saved_search_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SavedSearch) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SavedSearch) ProtoMessage() {}
func (x *SavedSearch) ProtoReflect() protoreflect.Message {
mi := &file_saved_search_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SavedSearch.ProtoReflect.Descriptor instead.
func (*SavedSearch) Descriptor() ([]byte, []int) {
return file_saved_search_proto_rawDescGZIP(), []int{1}
}
func (x *SavedSearch) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *SavedSearch) GetOwnerId() string {
if x != nil {
return x.OwnerId
}
return ""
}
func (x *SavedSearch) GetDeparture() *SavedSearchGeoJsonFeature {
if x != nil {
return x.Departure
}
return nil
}
func (x *SavedSearch) GetDestination() *SavedSearchGeoJsonFeature {
if x != nil {
return x.Destination
}
return nil
}
func (x *SavedSearch) GetDatetime() *timestamppb.Timestamp {
if x != nil {
return x.Datetime
}
return nil
}
func (x *SavedSearch) GetData() *structpb.Struct {
if x != nil {
return x.Data
}
return nil
}
func (x *SavedSearch) GetCreatedAt() *timestamppb.Timestamp {
if x != nil {
return x.CreatedAt
}
return nil
}
func (x *SavedSearch) GetUpdatedAt() *timestamppb.Timestamp {
if x != nil {
return x.UpdatedAt
}
return nil
}
// Create saved search messages
type CreateSavedSearchRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"`
Departure *SavedSearchGeoJsonFeature `protobuf:"bytes,2,opt,name=departure,proto3" json:"departure,omitempty"`
Destination *SavedSearchGeoJsonFeature `protobuf:"bytes,3,opt,name=destination,proto3" json:"destination,omitempty"`
Datetime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=datetime,proto3" json:"datetime,omitempty"`
Data *structpb.Struct `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CreateSavedSearchRequest) Reset() {
*x = CreateSavedSearchRequest{}
mi := &file_saved_search_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CreateSavedSearchRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreateSavedSearchRequest) ProtoMessage() {}
func (x *CreateSavedSearchRequest) ProtoReflect() protoreflect.Message {
mi := &file_saved_search_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CreateSavedSearchRequest.ProtoReflect.Descriptor instead.
func (*CreateSavedSearchRequest) Descriptor() ([]byte, []int) {
return file_saved_search_proto_rawDescGZIP(), []int{2}
}
func (x *CreateSavedSearchRequest) GetOwnerId() string {
if x != nil {
return x.OwnerId
}
return ""
}
func (x *CreateSavedSearchRequest) GetDeparture() *SavedSearchGeoJsonFeature {
if x != nil {
return x.Departure
}
return nil
}
func (x *CreateSavedSearchRequest) GetDestination() *SavedSearchGeoJsonFeature {
if x != nil {
return x.Destination
}
return nil
}
func (x *CreateSavedSearchRequest) GetDatetime() *timestamppb.Timestamp {
if x != nil {
return x.Datetime
}
return nil
}
func (x *CreateSavedSearchRequest) GetData() *structpb.Struct {
if x != nil {
return x.Data
}
return nil
}
type CreateSavedSearchResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
SavedSearch *SavedSearch `protobuf:"bytes,1,opt,name=saved_search,json=savedSearch,proto3" json:"saved_search,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CreateSavedSearchResponse) Reset() {
*x = CreateSavedSearchResponse{}
mi := &file_saved_search_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CreateSavedSearchResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreateSavedSearchResponse) ProtoMessage() {}
func (x *CreateSavedSearchResponse) ProtoReflect() protoreflect.Message {
mi := &file_saved_search_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CreateSavedSearchResponse.ProtoReflect.Descriptor instead.
func (*CreateSavedSearchResponse) Descriptor() ([]byte, []int) {
return file_saved_search_proto_rawDescGZIP(), []int{3}
}
func (x *CreateSavedSearchResponse) GetSavedSearch() *SavedSearch {
if x != nil {
return x.SavedSearch
}
return nil
}
// Get saved search messages
type GetSavedSearchRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetSavedSearchRequest) Reset() {
*x = GetSavedSearchRequest{}
mi := &file_saved_search_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetSavedSearchRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetSavedSearchRequest) ProtoMessage() {}
func (x *GetSavedSearchRequest) ProtoReflect() protoreflect.Message {
mi := &file_saved_search_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetSavedSearchRequest.ProtoReflect.Descriptor instead.
func (*GetSavedSearchRequest) Descriptor() ([]byte, []int) {
return file_saved_search_proto_rawDescGZIP(), []int{4}
}
func (x *GetSavedSearchRequest) GetId() string {
if x != nil {
return x.Id
}
return ""
}
type GetSavedSearchResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
SavedSearch *SavedSearch `protobuf:"bytes,1,opt,name=saved_search,json=savedSearch,proto3" json:"saved_search,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetSavedSearchResponse) Reset() {
*x = GetSavedSearchResponse{}
mi := &file_saved_search_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetSavedSearchResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetSavedSearchResponse) ProtoMessage() {}
func (x *GetSavedSearchResponse) ProtoReflect() protoreflect.Message {
mi := &file_saved_search_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetSavedSearchResponse.ProtoReflect.Descriptor instead.
func (*GetSavedSearchResponse) Descriptor() ([]byte, []int) {
return file_saved_search_proto_rawDescGZIP(), []int{5}
}
func (x *GetSavedSearchResponse) GetSavedSearch() *SavedSearch {
if x != nil {
return x.SavedSearch
}
return nil
}
// Get saved searches by owner messages
type GetSavedSearchesByOwnerRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetSavedSearchesByOwnerRequest) Reset() {
*x = GetSavedSearchesByOwnerRequest{}
mi := &file_saved_search_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetSavedSearchesByOwnerRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetSavedSearchesByOwnerRequest) ProtoMessage() {}
func (x *GetSavedSearchesByOwnerRequest) ProtoReflect() protoreflect.Message {
mi := &file_saved_search_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetSavedSearchesByOwnerRequest.ProtoReflect.Descriptor instead.
func (*GetSavedSearchesByOwnerRequest) Descriptor() ([]byte, []int) {
return file_saved_search_proto_rawDescGZIP(), []int{6}
}
func (x *GetSavedSearchesByOwnerRequest) GetOwnerId() string {
if x != nil {
return x.OwnerId
}
return ""
}
type GetSavedSearchesByOwnerResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
SavedSearches []*SavedSearch `protobuf:"bytes,1,rep,name=saved_searches,json=savedSearches,proto3" json:"saved_searches,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetSavedSearchesByOwnerResponse) Reset() {
*x = GetSavedSearchesByOwnerResponse{}
mi := &file_saved_search_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetSavedSearchesByOwnerResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetSavedSearchesByOwnerResponse) ProtoMessage() {}
func (x *GetSavedSearchesByOwnerResponse) ProtoReflect() protoreflect.Message {
mi := &file_saved_search_proto_msgTypes[7]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetSavedSearchesByOwnerResponse.ProtoReflect.Descriptor instead.
func (*GetSavedSearchesByOwnerResponse) Descriptor() ([]byte, []int) {
return file_saved_search_proto_rawDescGZIP(), []int{7}
}
func (x *GetSavedSearchesByOwnerResponse) GetSavedSearches() []*SavedSearch {
if x != nil {
return x.SavedSearches
}
return nil
}
// Update saved search messages
type UpdateSavedSearchRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
OwnerId string `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"`
Departure *SavedSearchGeoJsonFeature `protobuf:"bytes,3,opt,name=departure,proto3" json:"departure,omitempty"`
Destination *SavedSearchGeoJsonFeature `protobuf:"bytes,4,opt,name=destination,proto3" json:"destination,omitempty"`
Datetime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=datetime,proto3" json:"datetime,omitempty"`
Data *structpb.Struct `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *UpdateSavedSearchRequest) Reset() {
*x = UpdateSavedSearchRequest{}
mi := &file_saved_search_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *UpdateSavedSearchRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateSavedSearchRequest) ProtoMessage() {}
func (x *UpdateSavedSearchRequest) ProtoReflect() protoreflect.Message {
mi := &file_saved_search_proto_msgTypes[8]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UpdateSavedSearchRequest.ProtoReflect.Descriptor instead.
func (*UpdateSavedSearchRequest) Descriptor() ([]byte, []int) {
return file_saved_search_proto_rawDescGZIP(), []int{8}
}
func (x *UpdateSavedSearchRequest) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *UpdateSavedSearchRequest) GetOwnerId() string {
if x != nil {
return x.OwnerId
}
return ""
}
func (x *UpdateSavedSearchRequest) GetDeparture() *SavedSearchGeoJsonFeature {
if x != nil {
return x.Departure
}
return nil
}
func (x *UpdateSavedSearchRequest) GetDestination() *SavedSearchGeoJsonFeature {
if x != nil {
return x.Destination
}
return nil
}
func (x *UpdateSavedSearchRequest) GetDatetime() *timestamppb.Timestamp {
if x != nil {
return x.Datetime
}
return nil
}
func (x *UpdateSavedSearchRequest) GetData() *structpb.Struct {
if x != nil {
return x.Data
}
return nil
}
type UpdateSavedSearchResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
SavedSearch *SavedSearch `protobuf:"bytes,1,opt,name=saved_search,json=savedSearch,proto3" json:"saved_search,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *UpdateSavedSearchResponse) Reset() {
*x = UpdateSavedSearchResponse{}
mi := &file_saved_search_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *UpdateSavedSearchResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateSavedSearchResponse) ProtoMessage() {}
func (x *UpdateSavedSearchResponse) ProtoReflect() protoreflect.Message {
mi := &file_saved_search_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UpdateSavedSearchResponse.ProtoReflect.Descriptor instead.
func (*UpdateSavedSearchResponse) Descriptor() ([]byte, []int) {
return file_saved_search_proto_rawDescGZIP(), []int{9}
}
func (x *UpdateSavedSearchResponse) GetSavedSearch() *SavedSearch {
if x != nil {
return x.SavedSearch
}
return nil
}
// Delete saved search messages
type DeleteSavedSearchRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
OwnerId string `protobuf:"bytes,2,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *DeleteSavedSearchRequest) Reset() {
*x = DeleteSavedSearchRequest{}
mi := &file_saved_search_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *DeleteSavedSearchRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteSavedSearchRequest) ProtoMessage() {}
func (x *DeleteSavedSearchRequest) ProtoReflect() protoreflect.Message {
mi := &file_saved_search_proto_msgTypes[10]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeleteSavedSearchRequest.ProtoReflect.Descriptor instead.
func (*DeleteSavedSearchRequest) Descriptor() ([]byte, []int) {
return file_saved_search_proto_rawDescGZIP(), []int{10}
}
func (x *DeleteSavedSearchRequest) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *DeleteSavedSearchRequest) GetOwnerId() string {
if x != nil {
return x.OwnerId
}
return ""
}
type DeleteSavedSearchResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *DeleteSavedSearchResponse) Reset() {
*x = DeleteSavedSearchResponse{}
mi := &file_saved_search_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *DeleteSavedSearchResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteSavedSearchResponse) ProtoMessage() {}
func (x *DeleteSavedSearchResponse) ProtoReflect() protoreflect.Message {
mi := &file_saved_search_proto_msgTypes[11]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeleteSavedSearchResponse.ProtoReflect.Descriptor instead.
func (*DeleteSavedSearchResponse) Descriptor() ([]byte, []int) {
return file_saved_search_proto_rawDescGZIP(), []int{11}
}
func (x *DeleteSavedSearchResponse) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
// List saved searches messages
type ListSavedSearchesRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"`
Limit int32 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
Offset int32 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListSavedSearchesRequest) Reset() {
*x = ListSavedSearchesRequest{}
mi := &file_saved_search_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListSavedSearchesRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListSavedSearchesRequest) ProtoMessage() {}
func (x *ListSavedSearchesRequest) ProtoReflect() protoreflect.Message {
mi := &file_saved_search_proto_msgTypes[12]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListSavedSearchesRequest.ProtoReflect.Descriptor instead.
func (*ListSavedSearchesRequest) Descriptor() ([]byte, []int) {
return file_saved_search_proto_rawDescGZIP(), []int{12}
}
func (x *ListSavedSearchesRequest) GetOwnerId() string {
if x != nil {
return x.OwnerId
}
return ""
}
func (x *ListSavedSearchesRequest) GetLimit() int32 {
if x != nil {
return x.Limit
}
return 0
}
func (x *ListSavedSearchesRequest) GetOffset() int32 {
if x != nil {
return x.Offset
}
return 0
}
type ListSavedSearchesResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
SavedSearches []*SavedSearch `protobuf:"bytes,1,rep,name=saved_searches,json=savedSearches,proto3" json:"saved_searches,omitempty"`
Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"`
Limit int32 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"`
Offset int32 `protobuf:"varint,4,opt,name=offset,proto3" json:"offset,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListSavedSearchesResponse) Reset() {
*x = ListSavedSearchesResponse{}
mi := &file_saved_search_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListSavedSearchesResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListSavedSearchesResponse) ProtoMessage() {}
func (x *ListSavedSearchesResponse) ProtoReflect() protoreflect.Message {
mi := &file_saved_search_proto_msgTypes[13]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListSavedSearchesResponse.ProtoReflect.Descriptor instead.
func (*ListSavedSearchesResponse) Descriptor() ([]byte, []int) {
return file_saved_search_proto_rawDescGZIP(), []int{13}
}
func (x *ListSavedSearchesResponse) GetSavedSearches() []*SavedSearch {
if x != nil {
return x.SavedSearches
}
return nil
}
func (x *ListSavedSearchesResponse) GetTotal() int64 {
if x != nil {
return x.Total
}
return 0
}
func (x *ListSavedSearchesResponse) GetLimit() int32 {
if x != nil {
return x.Limit
}
return 0
}
func (x *ListSavedSearchesResponse) GetOffset() int32 {
if x != nil {
return x.Offset
}
return 0
}
var File_saved_search_proto protoreflect.FileDescriptor
const file_saved_search_proto_rawDesc = "" +
"\n" +
"\x12saved-search.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1cgoogle/protobuf/struct.proto\";\n" +
"\x19SavedSearchGeoJsonFeature\x12\x1e\n" +
"\n" +
"serialized\x18\x01 \x01(\tR\n" +
"serialized\"\x8b\x03\n" +
"\vSavedSearch\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\x12\x19\n" +
"\bowner_id\x18\x02 \x01(\tR\aownerId\x128\n" +
"\tdeparture\x18\x03 \x01(\v2\x1a.SavedSearchGeoJsonFeatureR\tdeparture\x12<\n" +
"\vdestination\x18\x04 \x01(\v2\x1a.SavedSearchGeoJsonFeatureR\vdestination\x126\n" +
"\bdatetime\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\bdatetime\x12+\n" +
"\x04data\x18\x06 \x01(\v2\x17.google.protobuf.StructR\x04data\x129\n" +
"\n" +
"created_at\x18\a \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x129\n" +
"\n" +
"updated_at\x18\b \x01(\v2\x1a.google.protobuf.TimestampR\tupdatedAt\"\x92\x02\n" +
"\x18CreateSavedSearchRequest\x12\x19\n" +
"\bowner_id\x18\x01 \x01(\tR\aownerId\x128\n" +
"\tdeparture\x18\x02 \x01(\v2\x1a.SavedSearchGeoJsonFeatureR\tdeparture\x12<\n" +
"\vdestination\x18\x03 \x01(\v2\x1a.SavedSearchGeoJsonFeatureR\vdestination\x126\n" +
"\bdatetime\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\bdatetime\x12+\n" +
"\x04data\x18\x05 \x01(\v2\x17.google.protobuf.StructR\x04data\"L\n" +
"\x19CreateSavedSearchResponse\x12/\n" +
"\fsaved_search\x18\x01 \x01(\v2\f.SavedSearchR\vsavedSearch\"'\n" +
"\x15GetSavedSearchRequest\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\"I\n" +
"\x16GetSavedSearchResponse\x12/\n" +
"\fsaved_search\x18\x01 \x01(\v2\f.SavedSearchR\vsavedSearch\";\n" +
"\x1eGetSavedSearchesByOwnerRequest\x12\x19\n" +
"\bowner_id\x18\x01 \x01(\tR\aownerId\"V\n" +
"\x1fGetSavedSearchesByOwnerResponse\x123\n" +
"\x0esaved_searches\x18\x01 \x03(\v2\f.SavedSearchR\rsavedSearches\"\xa2\x02\n" +
"\x18UpdateSavedSearchRequest\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\x12\x19\n" +
"\bowner_id\x18\x02 \x01(\tR\aownerId\x128\n" +
"\tdeparture\x18\x03 \x01(\v2\x1a.SavedSearchGeoJsonFeatureR\tdeparture\x12<\n" +
"\vdestination\x18\x04 \x01(\v2\x1a.SavedSearchGeoJsonFeatureR\vdestination\x126\n" +
"\bdatetime\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\bdatetime\x12+\n" +
"\x04data\x18\x06 \x01(\v2\x17.google.protobuf.StructR\x04data\"L\n" +
"\x19UpdateSavedSearchResponse\x12/\n" +
"\fsaved_search\x18\x01 \x01(\v2\f.SavedSearchR\vsavedSearch\"E\n" +
"\x18DeleteSavedSearchRequest\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\x12\x19\n" +
"\bowner_id\x18\x02 \x01(\tR\aownerId\"5\n" +
"\x19DeleteSavedSearchResponse\x12\x18\n" +
"\asuccess\x18\x01 \x01(\bR\asuccess\"c\n" +
"\x18ListSavedSearchesRequest\x12\x19\n" +
"\bowner_id\x18\x01 \x01(\tR\aownerId\x12\x14\n" +
"\x05limit\x18\x02 \x01(\x05R\x05limit\x12\x16\n" +
"\x06offset\x18\x03 \x01(\x05R\x06offset\"\x94\x01\n" +
"\x19ListSavedSearchesResponse\x123\n" +
"\x0esaved_searches\x18\x01 \x03(\v2\f.SavedSearchR\rsavedSearches\x12\x14\n" +
"\x05total\x18\x02 \x01(\x03R\x05total\x12\x14\n" +
"\x05limit\x18\x03 \x01(\x05R\x05limit\x12\x16\n" +
"\x06offset\x18\x04 \x01(\x05R\x06offset2\xf1\x03\n" +
"\x12SavedSearchService\x12L\n" +
"\x11CreateSavedSearch\x12\x19.CreateSavedSearchRequest\x1a\x1a.CreateSavedSearchResponse\"\x00\x12C\n" +
"\x0eGetSavedSearch\x12\x16.GetSavedSearchRequest\x1a\x17.GetSavedSearchResponse\"\x00\x12^\n" +
"\x17GetSavedSearchesByOwner\x12\x1f.GetSavedSearchesByOwnerRequest\x1a .GetSavedSearchesByOwnerResponse\"\x00\x12L\n" +
"\x11UpdateSavedSearch\x12\x19.UpdateSavedSearchRequest\x1a\x1a.UpdateSavedSearchResponse\"\x00\x12L\n" +
"\x11DeleteSavedSearch\x12\x19.DeleteSavedSearchRequest\x1a\x1a.DeleteSavedSearchResponse\"\x00\x12L\n" +
"\x11ListSavedSearches\x12\x19.ListSavedSearchesRequest\x1a\x1a.ListSavedSearchesResponse\"\x00BCZAgit.coopgo.io/coopgo-platform/saved-search/servers/grpc/proto/genb\x06proto3"
var (
file_saved_search_proto_rawDescOnce sync.Once
file_saved_search_proto_rawDescData []byte
)
func file_saved_search_proto_rawDescGZIP() []byte {
file_saved_search_proto_rawDescOnce.Do(func() {
file_saved_search_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_saved_search_proto_rawDesc), len(file_saved_search_proto_rawDesc)))
})
return file_saved_search_proto_rawDescData
}
var file_saved_search_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
var file_saved_search_proto_goTypes = []any{
(*SavedSearchGeoJsonFeature)(nil), // 0: SavedSearchGeoJsonFeature
(*SavedSearch)(nil), // 1: SavedSearch
(*CreateSavedSearchRequest)(nil), // 2: CreateSavedSearchRequest
(*CreateSavedSearchResponse)(nil), // 3: CreateSavedSearchResponse
(*GetSavedSearchRequest)(nil), // 4: GetSavedSearchRequest
(*GetSavedSearchResponse)(nil), // 5: GetSavedSearchResponse
(*GetSavedSearchesByOwnerRequest)(nil), // 6: GetSavedSearchesByOwnerRequest
(*GetSavedSearchesByOwnerResponse)(nil), // 7: GetSavedSearchesByOwnerResponse
(*UpdateSavedSearchRequest)(nil), // 8: UpdateSavedSearchRequest
(*UpdateSavedSearchResponse)(nil), // 9: UpdateSavedSearchResponse
(*DeleteSavedSearchRequest)(nil), // 10: DeleteSavedSearchRequest
(*DeleteSavedSearchResponse)(nil), // 11: DeleteSavedSearchResponse
(*ListSavedSearchesRequest)(nil), // 12: ListSavedSearchesRequest
(*ListSavedSearchesResponse)(nil), // 13: ListSavedSearchesResponse
(*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp
(*structpb.Struct)(nil), // 15: google.protobuf.Struct
}
var file_saved_search_proto_depIdxs = []int32{
0, // 0: SavedSearch.departure:type_name -> SavedSearchGeoJsonFeature
0, // 1: SavedSearch.destination:type_name -> SavedSearchGeoJsonFeature
14, // 2: SavedSearch.datetime:type_name -> google.protobuf.Timestamp
15, // 3: SavedSearch.data:type_name -> google.protobuf.Struct
14, // 4: SavedSearch.created_at:type_name -> google.protobuf.Timestamp
14, // 5: SavedSearch.updated_at:type_name -> google.protobuf.Timestamp
0, // 6: CreateSavedSearchRequest.departure:type_name -> SavedSearchGeoJsonFeature
0, // 7: CreateSavedSearchRequest.destination:type_name -> SavedSearchGeoJsonFeature
14, // 8: CreateSavedSearchRequest.datetime:type_name -> google.protobuf.Timestamp
15, // 9: CreateSavedSearchRequest.data:type_name -> google.protobuf.Struct
1, // 10: CreateSavedSearchResponse.saved_search:type_name -> SavedSearch
1, // 11: GetSavedSearchResponse.saved_search:type_name -> SavedSearch
1, // 12: GetSavedSearchesByOwnerResponse.saved_searches:type_name -> SavedSearch
0, // 13: UpdateSavedSearchRequest.departure:type_name -> SavedSearchGeoJsonFeature
0, // 14: UpdateSavedSearchRequest.destination:type_name -> SavedSearchGeoJsonFeature
14, // 15: UpdateSavedSearchRequest.datetime:type_name -> google.protobuf.Timestamp
15, // 16: UpdateSavedSearchRequest.data:type_name -> google.protobuf.Struct
1, // 17: UpdateSavedSearchResponse.saved_search:type_name -> SavedSearch
1, // 18: ListSavedSearchesResponse.saved_searches:type_name -> SavedSearch
2, // 19: SavedSearchService.CreateSavedSearch:input_type -> CreateSavedSearchRequest
4, // 20: SavedSearchService.GetSavedSearch:input_type -> GetSavedSearchRequest
6, // 21: SavedSearchService.GetSavedSearchesByOwner:input_type -> GetSavedSearchesByOwnerRequest
8, // 22: SavedSearchService.UpdateSavedSearch:input_type -> UpdateSavedSearchRequest
10, // 23: SavedSearchService.DeleteSavedSearch:input_type -> DeleteSavedSearchRequest
12, // 24: SavedSearchService.ListSavedSearches:input_type -> ListSavedSearchesRequest
3, // 25: SavedSearchService.CreateSavedSearch:output_type -> CreateSavedSearchResponse
5, // 26: SavedSearchService.GetSavedSearch:output_type -> GetSavedSearchResponse
7, // 27: SavedSearchService.GetSavedSearchesByOwner:output_type -> GetSavedSearchesByOwnerResponse
9, // 28: SavedSearchService.UpdateSavedSearch:output_type -> UpdateSavedSearchResponse
11, // 29: SavedSearchService.DeleteSavedSearch:output_type -> DeleteSavedSearchResponse
13, // 30: SavedSearchService.ListSavedSearches:output_type -> ListSavedSearchesResponse
25, // [25:31] is the sub-list for method output_type
19, // [19:25] is the sub-list for method input_type
19, // [19:19] is the sub-list for extension type_name
19, // [19:19] is the sub-list for extension extendee
0, // [0:19] is the sub-list for field type_name
}
func init() { file_saved_search_proto_init() }
func file_saved_search_proto_init() {
if File_saved_search_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_saved_search_proto_rawDesc), len(file_saved_search_proto_rawDesc)),
NumEnums: 0,
NumMessages: 14,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_saved_search_proto_goTypes,
DependencyIndexes: file_saved_search_proto_depIdxs,
MessageInfos: file_saved_search_proto_msgTypes,
}.Build()
File_saved_search_proto = out.File
file_saved_search_proto_goTypes = nil
file_saved_search_proto_depIdxs = nil
}

View File

@@ -0,0 +1,323 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v6.31.1
// source: saved-search.proto
package gen
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
SavedSearchService_CreateSavedSearch_FullMethodName = "/SavedSearchService/CreateSavedSearch"
SavedSearchService_GetSavedSearch_FullMethodName = "/SavedSearchService/GetSavedSearch"
SavedSearchService_GetSavedSearchesByOwner_FullMethodName = "/SavedSearchService/GetSavedSearchesByOwner"
SavedSearchService_UpdateSavedSearch_FullMethodName = "/SavedSearchService/UpdateSavedSearch"
SavedSearchService_DeleteSavedSearch_FullMethodName = "/SavedSearchService/DeleteSavedSearch"
SavedSearchService_ListSavedSearches_FullMethodName = "/SavedSearchService/ListSavedSearches"
)
// SavedSearchServiceClient is the client API for SavedSearchService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type SavedSearchServiceClient interface {
// Create a new saved search
CreateSavedSearch(ctx context.Context, in *CreateSavedSearchRequest, opts ...grpc.CallOption) (*CreateSavedSearchResponse, error)
// Get a saved search by ID
GetSavedSearch(ctx context.Context, in *GetSavedSearchRequest, opts ...grpc.CallOption) (*GetSavedSearchResponse, error)
// Get all saved searches for a specific owner
GetSavedSearchesByOwner(ctx context.Context, in *GetSavedSearchesByOwnerRequest, opts ...grpc.CallOption) (*GetSavedSearchesByOwnerResponse, error)
// Update an existing saved search
UpdateSavedSearch(ctx context.Context, in *UpdateSavedSearchRequest, opts ...grpc.CallOption) (*UpdateSavedSearchResponse, error)
// Delete a saved search
DeleteSavedSearch(ctx context.Context, in *DeleteSavedSearchRequest, opts ...grpc.CallOption) (*DeleteSavedSearchResponse, error)
// List saved searches with pagination
ListSavedSearches(ctx context.Context, in *ListSavedSearchesRequest, opts ...grpc.CallOption) (*ListSavedSearchesResponse, error)
}
type savedSearchServiceClient struct {
cc grpc.ClientConnInterface
}
func NewSavedSearchServiceClient(cc grpc.ClientConnInterface) SavedSearchServiceClient {
return &savedSearchServiceClient{cc}
}
func (c *savedSearchServiceClient) CreateSavedSearch(ctx context.Context, in *CreateSavedSearchRequest, opts ...grpc.CallOption) (*CreateSavedSearchResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CreateSavedSearchResponse)
err := c.cc.Invoke(ctx, SavedSearchService_CreateSavedSearch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *savedSearchServiceClient) GetSavedSearch(ctx context.Context, in *GetSavedSearchRequest, opts ...grpc.CallOption) (*GetSavedSearchResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetSavedSearchResponse)
err := c.cc.Invoke(ctx, SavedSearchService_GetSavedSearch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *savedSearchServiceClient) GetSavedSearchesByOwner(ctx context.Context, in *GetSavedSearchesByOwnerRequest, opts ...grpc.CallOption) (*GetSavedSearchesByOwnerResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetSavedSearchesByOwnerResponse)
err := c.cc.Invoke(ctx, SavedSearchService_GetSavedSearchesByOwner_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *savedSearchServiceClient) UpdateSavedSearch(ctx context.Context, in *UpdateSavedSearchRequest, opts ...grpc.CallOption) (*UpdateSavedSearchResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UpdateSavedSearchResponse)
err := c.cc.Invoke(ctx, SavedSearchService_UpdateSavedSearch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *savedSearchServiceClient) DeleteSavedSearch(ctx context.Context, in *DeleteSavedSearchRequest, opts ...grpc.CallOption) (*DeleteSavedSearchResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeleteSavedSearchResponse)
err := c.cc.Invoke(ctx, SavedSearchService_DeleteSavedSearch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *savedSearchServiceClient) ListSavedSearches(ctx context.Context, in *ListSavedSearchesRequest, opts ...grpc.CallOption) (*ListSavedSearchesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListSavedSearchesResponse)
err := c.cc.Invoke(ctx, SavedSearchService_ListSavedSearches_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// SavedSearchServiceServer is the server API for SavedSearchService service.
// All implementations must embed UnimplementedSavedSearchServiceServer
// for forward compatibility.
type SavedSearchServiceServer interface {
// Create a new saved search
CreateSavedSearch(context.Context, *CreateSavedSearchRequest) (*CreateSavedSearchResponse, error)
// Get a saved search by ID
GetSavedSearch(context.Context, *GetSavedSearchRequest) (*GetSavedSearchResponse, error)
// Get all saved searches for a specific owner
GetSavedSearchesByOwner(context.Context, *GetSavedSearchesByOwnerRequest) (*GetSavedSearchesByOwnerResponse, error)
// Update an existing saved search
UpdateSavedSearch(context.Context, *UpdateSavedSearchRequest) (*UpdateSavedSearchResponse, error)
// Delete a saved search
DeleteSavedSearch(context.Context, *DeleteSavedSearchRequest) (*DeleteSavedSearchResponse, error)
// List saved searches with pagination
ListSavedSearches(context.Context, *ListSavedSearchesRequest) (*ListSavedSearchesResponse, error)
mustEmbedUnimplementedSavedSearchServiceServer()
}
// UnimplementedSavedSearchServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedSavedSearchServiceServer struct{}
func (UnimplementedSavedSearchServiceServer) CreateSavedSearch(context.Context, *CreateSavedSearchRequest) (*CreateSavedSearchResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateSavedSearch not implemented")
}
func (UnimplementedSavedSearchServiceServer) GetSavedSearch(context.Context, *GetSavedSearchRequest) (*GetSavedSearchResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetSavedSearch not implemented")
}
func (UnimplementedSavedSearchServiceServer) GetSavedSearchesByOwner(context.Context, *GetSavedSearchesByOwnerRequest) (*GetSavedSearchesByOwnerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetSavedSearchesByOwner not implemented")
}
func (UnimplementedSavedSearchServiceServer) UpdateSavedSearch(context.Context, *UpdateSavedSearchRequest) (*UpdateSavedSearchResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateSavedSearch not implemented")
}
func (UnimplementedSavedSearchServiceServer) DeleteSavedSearch(context.Context, *DeleteSavedSearchRequest) (*DeleteSavedSearchResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteSavedSearch not implemented")
}
func (UnimplementedSavedSearchServiceServer) ListSavedSearches(context.Context, *ListSavedSearchesRequest) (*ListSavedSearchesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListSavedSearches not implemented")
}
func (UnimplementedSavedSearchServiceServer) mustEmbedUnimplementedSavedSearchServiceServer() {}
func (UnimplementedSavedSearchServiceServer) testEmbeddedByValue() {}
// UnsafeSavedSearchServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to SavedSearchServiceServer will
// result in compilation errors.
type UnsafeSavedSearchServiceServer interface {
mustEmbedUnimplementedSavedSearchServiceServer()
}
func RegisterSavedSearchServiceServer(s grpc.ServiceRegistrar, srv SavedSearchServiceServer) {
// If the following call pancis, it indicates UnimplementedSavedSearchServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&SavedSearchService_ServiceDesc, srv)
}
func _SavedSearchService_CreateSavedSearch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateSavedSearchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SavedSearchServiceServer).CreateSavedSearch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SavedSearchService_CreateSavedSearch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SavedSearchServiceServer).CreateSavedSearch(ctx, req.(*CreateSavedSearchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SavedSearchService_GetSavedSearch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetSavedSearchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SavedSearchServiceServer).GetSavedSearch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SavedSearchService_GetSavedSearch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SavedSearchServiceServer).GetSavedSearch(ctx, req.(*GetSavedSearchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SavedSearchService_GetSavedSearchesByOwner_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetSavedSearchesByOwnerRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SavedSearchServiceServer).GetSavedSearchesByOwner(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SavedSearchService_GetSavedSearchesByOwner_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SavedSearchServiceServer).GetSavedSearchesByOwner(ctx, req.(*GetSavedSearchesByOwnerRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SavedSearchService_UpdateSavedSearch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateSavedSearchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SavedSearchServiceServer).UpdateSavedSearch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SavedSearchService_UpdateSavedSearch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SavedSearchServiceServer).UpdateSavedSearch(ctx, req.(*UpdateSavedSearchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SavedSearchService_DeleteSavedSearch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteSavedSearchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SavedSearchServiceServer).DeleteSavedSearch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SavedSearchService_DeleteSavedSearch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SavedSearchServiceServer).DeleteSavedSearch(ctx, req.(*DeleteSavedSearchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SavedSearchService_ListSavedSearches_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListSavedSearchesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SavedSearchServiceServer).ListSavedSearches(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SavedSearchService_ListSavedSearches_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SavedSearchServiceServer).ListSavedSearches(ctx, req.(*ListSavedSearchesRequest))
}
return interceptor(ctx, in, info, handler)
}
// SavedSearchService_ServiceDesc is the grpc.ServiceDesc for SavedSearchService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var SavedSearchService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "SavedSearchService",
HandlerType: (*SavedSearchServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreateSavedSearch",
Handler: _SavedSearchService_CreateSavedSearch_Handler,
},
{
MethodName: "GetSavedSearch",
Handler: _SavedSearchService_GetSavedSearch_Handler,
},
{
MethodName: "GetSavedSearchesByOwner",
Handler: _SavedSearchService_GetSavedSearchesByOwner_Handler,
},
{
MethodName: "UpdateSavedSearch",
Handler: _SavedSearchService_UpdateSavedSearch_Handler,
},
{
MethodName: "DeleteSavedSearch",
Handler: _SavedSearchService_DeleteSavedSearch_Handler,
},
{
MethodName: "ListSavedSearches",
Handler: _SavedSearchService_ListSavedSearches_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "saved-search.proto",
}

View File

@@ -0,0 +1,112 @@
syntax = "proto3";
option go_package = "git.coopgo.io/coopgo-platform/saved-search/servers/grpc/proto/gen";
import "google/protobuf/timestamp.proto";
import "google/protobuf/struct.proto";
service SavedSearchService {
// Create a new saved search
rpc CreateSavedSearch(CreateSavedSearchRequest) returns (CreateSavedSearchResponse) {}
// Get a saved search by ID
rpc GetSavedSearch(GetSavedSearchRequest) returns (GetSavedSearchResponse) {}
// Get all saved searches for a specific owner
rpc GetSavedSearchesByOwner(GetSavedSearchesByOwnerRequest) returns (GetSavedSearchesByOwnerResponse) {}
// Update an existing saved search
rpc UpdateSavedSearch(UpdateSavedSearchRequest) returns (UpdateSavedSearchResponse) {}
// Delete a saved search
rpc DeleteSavedSearch(DeleteSavedSearchRequest) returns (DeleteSavedSearchResponse) {}
// List saved searches with pagination
rpc ListSavedSearches(ListSavedSearchesRequest) returns (ListSavedSearchesResponse) {}
}
// GeoJSON Feature representation for saved searches
message SavedSearchGeoJsonFeature {
string serialized = 1;
}
// Saved search message
message SavedSearch {
string id = 1;
string owner_id = 2;
SavedSearchGeoJsonFeature departure = 3;
SavedSearchGeoJsonFeature destination = 4;
google.protobuf.Timestamp datetime = 5;
google.protobuf.Struct data = 6;
google.protobuf.Timestamp created_at = 7;
google.protobuf.Timestamp updated_at = 8;
}
// Create saved search messages
message CreateSavedSearchRequest {
string owner_id = 1;
SavedSearchGeoJsonFeature departure = 2;
SavedSearchGeoJsonFeature destination = 3;
google.protobuf.Timestamp datetime = 4;
google.protobuf.Struct data = 5;
}
message CreateSavedSearchResponse {
SavedSearch saved_search = 1;
}
// Get saved search messages
message GetSavedSearchRequest {
string id = 1;
}
message GetSavedSearchResponse {
SavedSearch saved_search = 1;
}
// Get saved searches by owner messages
message GetSavedSearchesByOwnerRequest {
string owner_id = 1;
}
message GetSavedSearchesByOwnerResponse {
repeated SavedSearch saved_searches = 1;
}
// Update saved search messages
message UpdateSavedSearchRequest {
string id = 1;
string owner_id = 2;
SavedSearchGeoJsonFeature departure = 3;
SavedSearchGeoJsonFeature destination = 4;
google.protobuf.Timestamp datetime = 5;
google.protobuf.Struct data = 6;
}
message UpdateSavedSearchResponse {
SavedSearch saved_search = 1;
}
// Delete saved search messages
message DeleteSavedSearchRequest {
string id = 1;
string owner_id = 2;
}
message DeleteSavedSearchResponse {
bool success = 1;
}
// List saved searches messages
message ListSavedSearchesRequest {
string owner_id = 1;
int32 limit = 2;
int32 offset = 3;
}
message ListSavedSearchesResponse {
repeated SavedSearch saved_searches = 1;
int64 total = 2;
int32 limit = 3;
int32 offset = 4;
}

View File

@@ -0,0 +1,232 @@
package server
import (
"context"
"fmt"
"net"
"git.coopgo.io/coopgo-platform/saved-search/core/service"
"git.coopgo.io/coopgo-platform/saved-search/servers/grpc/proto/gen"
"git.coopgo.io/coopgo-platform/saved-search/servers/grpc/transformers"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/reflection"
"google.golang.org/grpc/status"
)
// SavedSearchServerImpl implements the SavedSearchService gRPC service
type SavedSearchServerImpl struct {
gen.UnimplementedSavedSearchServiceServer
service *service.SavedSearchService
}
// NewSavedSearchServerImpl creates a new SavedSearchServerImpl
func NewSavedSearchServerImpl(service *service.SavedSearchService) *SavedSearchServerImpl {
return &SavedSearchServerImpl{
service: service,
}
}
// CreateSavedSearch creates a new saved search
func (s *SavedSearchServerImpl) CreateSavedSearch(ctx context.Context, req *gen.CreateSavedSearchRequest) (*gen.CreateSavedSearchResponse, error) {
departure, err := transformers.GeoJsonFeatureFromProto(req.Departure)
if err != nil {
log.Error().Err(err).Msg("failed to convert departure")
return nil, status.Errorf(codes.InvalidArgument, "invalid departure: %v", err)
}
destination, err := transformers.GeoJsonFeatureFromProto(req.Destination)
if err != nil {
log.Error().Err(err).Msg("failed to convert destination")
return nil, status.Errorf(codes.InvalidArgument, "invalid destination: %v", err)
}
var data map[string]interface{}
if req.Data != nil {
data = req.Data.AsMap()
}
params := service.CreateSavedSearchParams{
OwnerID: req.OwnerId,
Departure: departure,
Destination: destination,
DateTime: req.Datetime.AsTime(),
Data: data,
}
search, err := s.service.CreateSavedSearch(ctx, params)
if err != nil {
log.Error().Err(err).Msg("failed to create saved search")
return nil, status.Errorf(codes.Internal, "failed to create saved search: %v", err)
}
protoSearch, err := transformers.SavedSearchTypeToProto(search)
if err != nil {
log.Error().Err(err).Msg("failed to convert saved search to proto")
return nil, status.Errorf(codes.Internal, "failed to convert saved search: %v", err)
}
return &gen.CreateSavedSearchResponse{
SavedSearch: protoSearch,
}, nil
}
// GetSavedSearch retrieves a saved search by ID
func (s *SavedSearchServerImpl) GetSavedSearch(ctx context.Context, req *gen.GetSavedSearchRequest) (*gen.GetSavedSearchResponse, error) {
search, err := s.service.GetSavedSearch(ctx, req.Id)
if err != nil {
log.Error().Err(err).Str("id", req.Id).Msg("failed to get saved search")
return nil, status.Errorf(codes.NotFound, "saved search not found: %v", err)
}
protoSearch, err := transformers.SavedSearchTypeToProto(search)
if err != nil {
log.Error().Err(err).Msg("failed to convert saved search to proto")
return nil, status.Errorf(codes.Internal, "failed to convert saved search: %v", err)
}
return &gen.GetSavedSearchResponse{
SavedSearch: protoSearch,
}, nil
}
// GetSavedSearchesByOwner retrieves all saved searches for a specific owner
func (s *SavedSearchServerImpl) GetSavedSearchesByOwner(ctx context.Context, req *gen.GetSavedSearchesByOwnerRequest) (*gen.GetSavedSearchesByOwnerResponse, error) {
searches, err := s.service.GetSavedSearchesByOwner(ctx, req.OwnerId)
if err != nil {
log.Error().Err(err).Str("owner_id", req.OwnerId).Msg("failed to get saved searches by owner")
return nil, status.Errorf(codes.Internal, "failed to get saved searches: %v", err)
}
var protoSearches []*gen.SavedSearch
for _, search := range searches {
protoSearch, err := transformers.SavedSearchTypeToProto(search)
if err != nil {
log.Error().Err(err).Str("id", search.ID).Msg("failed to convert saved search to proto")
continue
}
protoSearches = append(protoSearches, protoSearch)
}
return &gen.GetSavedSearchesByOwnerResponse{
SavedSearches: protoSearches,
}, nil
}
// UpdateSavedSearch updates an existing saved search
func (s *SavedSearchServerImpl) UpdateSavedSearch(ctx context.Context, req *gen.UpdateSavedSearchRequest) (*gen.UpdateSavedSearchResponse, error) {
departure, err := transformers.GeoJsonFeatureFromProto(req.Departure)
if err != nil {
log.Error().Err(err).Msg("failed to convert departure")
return nil, status.Errorf(codes.InvalidArgument, "invalid departure: %v", err)
}
destination, err := transformers.GeoJsonFeatureFromProto(req.Destination)
if err != nil {
log.Error().Err(err).Msg("failed to convert destination")
return nil, status.Errorf(codes.InvalidArgument, "invalid destination: %v", err)
}
var data map[string]interface{}
if req.Data != nil {
data = req.Data.AsMap()
}
params := service.UpdateSavedSearchParams{
ID: req.Id,
OwnerID: req.OwnerId,
Departure: departure,
Destination: destination,
DateTime: req.Datetime.AsTime(),
Data: data,
}
search, err := s.service.UpdateSavedSearch(ctx, params)
if err != nil {
log.Error().Err(err).Str("id", req.Id).Msg("failed to update saved search")
return nil, status.Errorf(codes.Internal, "failed to update saved search: %v", err)
}
protoSearch, err := transformers.SavedSearchTypeToProto(search)
if err != nil {
log.Error().Err(err).Msg("failed to convert saved search to proto")
return nil, status.Errorf(codes.Internal, "failed to convert saved search: %v", err)
}
return &gen.UpdateSavedSearchResponse{
SavedSearch: protoSearch,
}, nil
}
// DeleteSavedSearch deletes a saved search
func (s *SavedSearchServerImpl) DeleteSavedSearch(ctx context.Context, req *gen.DeleteSavedSearchRequest) (*gen.DeleteSavedSearchResponse, error) {
err := s.service.DeleteSavedSearch(ctx, req.Id, req.OwnerId)
if err != nil {
log.Error().Err(err).Str("id", req.Id).Msg("failed to delete saved search")
return nil, status.Errorf(codes.Internal, "failed to delete saved search: %v", err)
}
return &gen.DeleteSavedSearchResponse{
Success: true,
}, nil
}
// ListSavedSearches retrieves paginated saved searches
func (s *SavedSearchServerImpl) ListSavedSearches(ctx context.Context, req *gen.ListSavedSearchesRequest) (*gen.ListSavedSearchesResponse, error) {
params := service.ListSavedSearchesParams{
OwnerID: req.OwnerId,
Limit: int(req.Limit),
Offset: int(req.Offset),
}
result, err := s.service.ListSavedSearches(ctx, params)
if err != nil {
log.Error().Err(err).Str("owner_id", req.OwnerId).Msg("failed to list saved searches")
return nil, status.Errorf(codes.Internal, "failed to list saved searches: %v", err)
}
var protoSearches []*gen.SavedSearch
for _, search := range result.SavedSearches {
protoSearch, err := transformers.SavedSearchTypeToProto(search)
if err != nil {
log.Error().Err(err).Str("id", search.ID).Msg("failed to convert saved search to proto")
continue
}
protoSearches = append(protoSearches, protoSearch)
}
return &gen.ListSavedSearchesResponse{
SavedSearches: protoSearches,
Total: result.Total,
Limit: int32(result.Limit),
Offset: int32(result.Offset),
}, nil
}
// Run starts the gRPC server following solidarity transport pattern
func Run(done chan error, cfg *viper.Viper, savedSearchService *service.SavedSearchService) {
var (
dev_env = cfg.GetBool("dev_env")
address = ":" + cfg.GetString("services.grpc.port")
)
server := grpc.NewServer()
gen.RegisterSavedSearchServiceServer(server, NewSavedSearchServerImpl(savedSearchService))
l, err := net.Listen("tcp", address)
if err != nil {
log.Fatal().Err(err).Msg("could not register saved search grpc server")
return
}
if dev_env {
reflection.Register(server)
}
if err := server.Serve(l); err != nil {
fmt.Println("gRPC service ended")
done <- err
}
}

View File

@@ -0,0 +1,116 @@
package transformers
import (
"encoding/json"
"fmt"
"time"
"git.coopgo.io/coopgo-platform/saved-search/data/types"
"git.coopgo.io/coopgo-platform/saved-search/servers/grpc/proto/gen"
"github.com/paulmach/orb/geojson"
"google.golang.org/protobuf/types/known/structpb"
"google.golang.org/protobuf/types/known/timestamppb"
)
// SavedSearchTypeToProto converts a domain SavedSearch to protobuf SavedSearch
func SavedSearchTypeToProto(search *types.SavedSearch) (*gen.SavedSearch, error) {
if search == nil {
return nil, fmt.Errorf("search cannot be nil")
}
departure, err := GeoJsonFeatureToProto(search.Departure)
if err != nil {
return nil, fmt.Errorf("failed to convert departure: %w", err)
}
destination, err := GeoJsonFeatureToProto(search.Destination)
if err != nil {
return nil, fmt.Errorf("failed to convert destination: %w", err)
}
data, err := structpb.NewStruct(search.Data)
if err != nil {
return nil, fmt.Errorf("failed to convert data: %w", err)
}
return &gen.SavedSearch{
Id: search.ID,
OwnerId: search.OwnerID,
Departure: departure,
Destination: destination,
Datetime: timestamppb.New(search.DateTime),
Data: data,
CreatedAt: timestamppb.New(search.CreatedAt),
UpdatedAt: timestamppb.New(search.UpdatedAt),
}, nil
}
// SavedSearchProtoToType converts a protobuf SavedSearch to domain SavedSearch
func SavedSearchProtoToType(search *gen.SavedSearch) (*types.SavedSearch, error) {
if search == nil {
return nil, fmt.Errorf("search cannot be nil")
}
departure, err := GeoJsonFeatureFromProto(search.Departure)
if err != nil {
return nil, fmt.Errorf("failed to convert departure: %w", err)
}
destination, err := GeoJsonFeatureFromProto(search.Destination)
if err != nil {
return nil, fmt.Errorf("failed to convert destination: %w", err)
}
var data map[string]interface{}
if search.Data != nil {
data = search.Data.AsMap()
} else {
data = make(map[string]interface{})
}
var datetime time.Time
if search.Datetime != nil {
datetime = search.Datetime.AsTime()
}
return &types.SavedSearch{
ID: search.Id,
OwnerID: search.OwnerId,
Departure: departure,
Destination: destination,
DateTime: datetime,
Data: data,
CreatedAt: search.CreatedAt.AsTime(),
UpdatedAt: search.UpdatedAt.AsTime(),
}, nil
}
// GeoJsonFeatureToProto converts a GeoJSON Feature to protobuf SavedSearchGeoJsonFeature
func GeoJsonFeatureToProto(feature *geojson.Feature) (*gen.SavedSearchGeoJsonFeature, error) {
if feature == nil {
return nil, fmt.Errorf("feature cannot be nil")
}
serialized, err := json.Marshal(feature)
if err != nil {
return nil, fmt.Errorf("failed to serialize feature: %w", err)
}
return &gen.SavedSearchGeoJsonFeature{
Serialized: string(serialized),
}, nil
}
// GeoJsonFeatureFromProto converts a protobuf SavedSearchGeoJsonFeature to GeoJSON Feature
func GeoJsonFeatureFromProto(protoFeature *gen.SavedSearchGeoJsonFeature) (*geojson.Feature, error) {
if protoFeature == nil {
return nil, fmt.Errorf("proto feature cannot be nil")
}
var feature geojson.Feature
if err := json.Unmarshal([]byte(protoFeature.Serialized), &feature); err != nil {
return nil, fmt.Errorf("failed to deserialize feature: %w", err)
}
return &feature, nil
}