diff --git a/pkg/locales/errors.go b/pkg/locales/errors.go new file mode 100644 index 0000000000000000000000000000000000000000..ae52101e85a04c1166b9ba452af896119cc02bfe --- /dev/null +++ b/pkg/locales/errors.go @@ -0,0 +1,8 @@ +package locales + +import "git.perx.ru/perxis/perxis-go/pkg/service" + +var ( + ErrNotFound = service.ErrNotFound + ErrAlreadyExists = service.ErrAlreadyExists +) diff --git a/pkg/locales/events.go b/pkg/locales/events.go index b7c4c3dc23e7993196ccc773d35e633a5e29ff27..fe9c8d95ed4be12f129c17ec8a6cedb672024f15 100644 --- a/pkg/locales/events.go +++ b/pkg/locales/events.go @@ -2,5 +2,6 @@ package locales const ( EventCreate = "locales.create" + EventUpdate = "locales.update" EventDelete = "locales.delete" ) diff --git a/pkg/locales/locale.go b/pkg/locales/locale.go index d3cc43c6c625a5090d975409d7aa2beb16eefc3a..107c7d9cb987da65a7156d1d3df2ae5e447bc48d 100644 --- a/pkg/locales/locale.go +++ b/pkg/locales/locale.go @@ -1,7 +1,23 @@ package locales +const ( + DefaultID = "default" // DefaultID идентификатор локали РїРѕ умолчанию + DefaultDirection = "ltr" // DefaultDirection направление РїРёСЃСЊРјР° РїРѕ умолчанию +) + type Locale struct { - ID string `json:"id" bson:"_id"` // (Пример: "en", "en-US") - SpaceID string `json:"spaceId" bson:"-"` - Name string `json:"name" bson:"name"` // (Пример: "English", "English (US)" ) + ID string `json:"id" bson:"_id"` // Рдентификатор локали, генерируется автоматически. Для локали РїРѕ умолчанию устанавливается как "default". + SpaceID string `json:"spaceId" bson:"-"` // Рдентификатор пространства. + Name string `json:"name" bson:"name"` // Название локали. Опционально, заполняется автоматически (Пример: russian, english) + NativeName string `json:"native_name" bson:"native_name"` // Название локали РЅР° языке локали. Опционально, заполняется автоматически (Пример: Р СѓСЃСЃРєРёР№, English) + Code string `json:"code" bson:"code"` // РљРѕРґ локали https://en.wikipedia.org/wiki/IETF_language_tag + Fallback string `json:"fallback" bson:"fallback"` // Рдентификатор локали, который будет использоваться РїСЂРё отсутствии перевода + Direction string `json:"direction" bson:"direction"` // Направление РїРёСЃСЊРјР° - слева направо (ltr) или справа налево (rtl). РџРѕ умолчанию устанавливается ltr. + Weight int `json:"weight" bson:"weight"` // Вес локали. + NoPublish bool `json:"no_publish" bson:"no_publish"` // РќРµ публиковать контент данной локали. РќРµ будет доступен контент через Delivery API. (РєСЂРѕРјРµ default) + Disabled bool `json:"disabled" bson:"disabled"` // Запретить использование локали. Нельзя создавать Рё редактировать контент для данной локали (РєСЂРѕРјРµ default) +} + +func (locale Locale) IsDefault() bool { + return locale.ID == DefaultID } diff --git a/pkg/locales/middleware/access_logging_middleware.go b/pkg/locales/middleware/access_logging_middleware.go index eabb71c37756d0a7d39d6abe217f394036a69922..ab31fc8c81ec51af35e63ab8eadbc400a9b717db 100644 --- a/pkg/locales/middleware/access_logging_middleware.go +++ b/pkg/locales/middleware/access_logging_middleware.go @@ -87,3 +87,21 @@ func (m *accessLoggingMiddleware) List(ctx context.Context, spaceId string) (loc return locales, err } + +func (m *accessLoggingMiddleware) Update(ctx context.Context, locale *locales.Locale) (err error) { + begin := time.Now() + + m.logger.Debug("Update.Request", + zap.Reflect("principal", auth.GetPrincipal(ctx)), + zap.Reflect("locale", locale), + ) + + err = m.next.Update(ctx, locale) + + m.logger.Debug("Update.Response", + zap.Duration("time", time.Since(begin)), + zap.Error(err), + ) + + return err +} diff --git a/pkg/locales/middleware/caching_middleware.go b/pkg/locales/middleware/caching_middleware.go index 13928a5166f2187e85a5e7da63861509e3f69d3a..5b370b99d004e005b622f39eec0fa2006cd08c94 100644 --- a/pkg/locales/middleware/caching_middleware.go +++ b/pkg/locales/middleware/caching_middleware.go @@ -30,6 +30,15 @@ func (m cachingMiddleware) Create(ctx context.Context, locale *service.Locale) ( return loc, err } +func (m cachingMiddleware) Update(ctx context.Context, locale *service.Locale) (err error) { + + err = m.next.Update(ctx, locale) + if err == nil { + _ = m.cache.Remove(locale.SpaceID) + } + return err +} + func (m cachingMiddleware) List(ctx context.Context, spaceId string) (locales []*service.Locale, err error) { value, e := m.cache.Get(spaceId) diff --git a/pkg/locales/middleware/caching_middleware_test.go b/pkg/locales/middleware/caching_middleware_test.go index 281aa49611a83e4a0a28f1064dbf5fe149dd29f3..c738c98756adeb172fc2e648eea714d826b9ba73 100644 --- a/pkg/locales/middleware/caching_middleware_test.go +++ b/pkg/locales/middleware/caching_middleware_test.go @@ -103,6 +103,38 @@ func TestLocalesCache(t *testing.T) { loc.AssertExpectations(t) }) + t.Run("After Update", func(t *testing.T) { + loc := &locmocks.Locales{} + + svc := CachingMiddleware(cache.NewMemoryCache(size, ttl))(loc) + + loc.On("List", mock.Anything, spaceID).Return([]*locales.Locale{{ID: loc1, Name: "name1", SpaceID: spaceID}}, nil).Once() + + vl1, err := svc.List(ctx, spaceID) + require.NoError(t, err) + + vl2, err := svc.List(ctx, spaceID) + require.NoError(t, err) + assert.Same(t, vl1[0], vl2[0], "Ожидается что РїСЂРё повторном запросе объекты Р±СѓРґСѓС‚ получены РёР· кэша.") + + loc.On("Update", mock.Anything, mock.Anything).Return(nil).Once() + + err = svc.Update(ctx, &locales.Locale{ID: loc2, Name: "name2", SpaceID: spaceID}) + require.NoError(t, err) + + loc.On("List", mock.Anything, spaceID). + Return([]*locales.Locale{ + {ID: loc1, Name: "name1", SpaceID: spaceID}, + {ID: loc2, Name: "name2", SpaceID: spaceID}, + }, nil).Once() + + vl3, err := svc.List(ctx, spaceID) + require.NoError(t, err) + assert.Len(t, vl3, 2, "Ожидается что после обновления объекта данные Р±СѓРґСѓС‚ удалены РёР· кеша Рё получены РёР· сервиса.") + + loc.AssertExpectations(t) + }) + t.Run("After TTL expired", func(t *testing.T) { loc := &locmocks.Locales{} diff --git a/pkg/locales/middleware/error_logging_middleware.go b/pkg/locales/middleware/error_logging_middleware.go index a00f23a29aa8b5330e1097c670e6cc0edf5b9983..0dd4ae2e6748c35fa7a0592c274a9dfeb86f5d7b 100644 --- a/pkg/locales/middleware/error_logging_middleware.go +++ b/pkg/locales/middleware/error_logging_middleware.go @@ -58,3 +58,13 @@ func (m *errorLoggingMiddleware) List(ctx context.Context, spaceId string) (loca }() return m.next.List(ctx, spaceId) } + +func (m *errorLoggingMiddleware) Update(ctx context.Context, locale *locales.Locale) (err error) { + logger := m.logger + defer func() { + if err != nil { + logger.Warn("response error", zap.Error(err)) + } + }() + return m.next.Update(ctx, locale) +} diff --git a/pkg/locales/middleware/logging_middleware.go b/pkg/locales/middleware/logging_middleware.go index 8244557a64d79f0ad57659a5708979e48f209693..2b6bfea5281a89bf9050094fe2d631fed200c9a4 100644 --- a/pkg/locales/middleware/logging_middleware.go +++ b/pkg/locales/middleware/logging_middleware.go @@ -39,6 +39,23 @@ func (m *loggingMiddleware) Create(ctx context.Context, locale *locales.Locale) return created, err } +func (m *loggingMiddleware) Update(ctx context.Context, locale *locales.Locale) (err error) { + logger := m.logger.With( + logzap.Caller(ctx), + logzap.Event(locales.EventUpdate), + logzap.Object(locale), + ) + + err = m.next.Update(ctx, locale) + if err != nil { + logger.Error("Failed to update", zap.Error(err), logzap.Channels(logzap.Userlog, logzap.Syslog)) + return + } + + logger.Info("Locale updated", logzap.Channels(logzap.Userlog)) + return err +} + func (m *loggingMiddleware) List(ctx context.Context, spaceId string) (locales []*locales.Locale, err error) { logger := m.logger.With( logzap.Caller(ctx), diff --git a/pkg/locales/middleware/recovering_middleware.go b/pkg/locales/middleware/recovering_middleware.go index 3229e52394d207361d608744b5dcf73585142958..85f14bdbe6493c40c24c91bf539e33b9ca7e397b 100644 --- a/pkg/locales/middleware/recovering_middleware.go +++ b/pkg/locales/middleware/recovering_middleware.go @@ -65,3 +65,15 @@ func (m *recoveringMiddleware) List(ctx context.Context, spaceId string) (locale return m.next.List(ctx, spaceId) } + +func (m *recoveringMiddleware) Update(ctx context.Context, locale *locales.Locale) (err error) { + logger := m.logger + defer func() { + if r := recover(); r != nil { + logger.Error("panic", zap.Error(fmt.Errorf("%v", r))) + err = fmt.Errorf("%v", r) + } + }() + + return m.next.Update(ctx, locale) +} diff --git a/pkg/locales/middleware/telemetry_middleware.go b/pkg/locales/middleware/telemetry_middleware.go index 4efc5293b78781aaa5d8cbf77f4da82c714a6137..98fe346ea000409be27bfd21fccc6723ed09851b 100644 --- a/pkg/locales/middleware/telemetry_middleware.go +++ b/pkg/locales/middleware/telemetry_middleware.go @@ -1,10 +1,10 @@ // Code generated by gowrap. DO NOT EDIT. -// template: ..\..\..\assets\templates\middleware\telemetry +// template: ../../../assets/templates/middleware/telemetry // gowrap: http://github.com/hexdigest/gowrap package middleware -//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/locales -i Locales -t ..\..\..\assets\templates\middleware\telemetry -o telemetry_middleware.go -l "" +//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/locales -i Locales -t ../../../assets/templates/middleware/telemetry -o telemetry_middleware.go -l "" // source template: https://github.com/hexdigest/gowrap/blob/master/templates/opentelemetry @@ -149,3 +149,36 @@ func (_d telemetryMiddleware) List(ctx context.Context, spaceId string) (locales }() return _d.Locales.List(ctx, spaceId) } + +// Update implements locales.Locales +func (_d telemetryMiddleware) Update(ctx context.Context, locale *locales.Locale) (err error) { + attributes := otelmetric.WithAttributeSet(attribute.NewSet( + attribute.String("service", "Locales"), + attribute.String("method", "Update"), + )) + + _d.requestMetrics.Total.Add(ctx, 1, attributes) + + start := time.Now() + ctx, _span := otel.Tracer(_d._instance).Start(ctx, "Locales.Update") + + defer func() { + _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) + + if _d._spanDecorator != nil { + _d._spanDecorator(_span, map[string]interface{}{ + "ctx": ctx, + "locale": locale}, map[string]interface{}{ + "err": err}) + } else if err != nil { + _d.requestMetrics.FailedTotal.Add(ctx, 1, attributes) + + _span.RecordError(err) + _span.SetAttributes(attribute.String("event", "error")) + _span.SetAttributes(attribute.String("message", err.Error())) + } + + _span.End() + }() + return _d.Locales.Update(ctx, locale) +} diff --git a/pkg/locales/mocks/Locales.go b/pkg/locales/mocks/Locales.go index 491406c5c3fa577050ee0f1a097b89419b17bf42..6519e3cc9b5e02895fa22b778c15437737f606de 100644 --- a/pkg/locales/mocks/Locales.go +++ b/pkg/locales/mocks/Locales.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.15.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -18,7 +18,15 @@ type Locales struct { func (_m *Locales) Create(ctx context.Context, locale *locales.Locale) (*locales.Locale, error) { ret := _m.Called(ctx, locale) + if len(ret) == 0 { + panic("no return value specified for Create") + } + var r0 *locales.Locale + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *locales.Locale) (*locales.Locale, error)); ok { + return rf(ctx, locale) + } if rf, ok := ret.Get(0).(func(context.Context, *locales.Locale) *locales.Locale); ok { r0 = rf(ctx, locale) } else { @@ -27,7 +35,6 @@ func (_m *Locales) Create(ctx context.Context, locale *locales.Locale) (*locales } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *locales.Locale) error); ok { r1 = rf(ctx, locale) } else { @@ -41,6 +48,10 @@ func (_m *Locales) Create(ctx context.Context, locale *locales.Locale) (*locales func (_m *Locales) Delete(ctx context.Context, spaceId string, localeId string) error { ret := _m.Called(ctx, spaceId, localeId) + if len(ret) == 0 { + panic("no return value specified for Delete") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { r0 = rf(ctx, spaceId, localeId) @@ -55,7 +66,15 @@ func (_m *Locales) Delete(ctx context.Context, spaceId string, localeId string) func (_m *Locales) List(ctx context.Context, spaceId string) ([]*locales.Locale, error) { ret := _m.Called(ctx, spaceId) + if len(ret) == 0 { + panic("no return value specified for List") + } + var r0 []*locales.Locale + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) ([]*locales.Locale, error)); ok { + return rf(ctx, spaceId) + } if rf, ok := ret.Get(0).(func(context.Context, string) []*locales.Locale); ok { r0 = rf(ctx, spaceId) } else { @@ -64,7 +83,6 @@ func (_m *Locales) List(ctx context.Context, spaceId string) ([]*locales.Locale, } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { r1 = rf(ctx, spaceId) } else { @@ -74,13 +92,30 @@ func (_m *Locales) List(ctx context.Context, spaceId string) ([]*locales.Locale, return r0, r1 } -type mockConstructorTestingTNewLocales interface { - mock.TestingT - Cleanup(func()) +// Update provides a mock function with given fields: ctx, locale +func (_m *Locales) Update(ctx context.Context, locale *locales.Locale) error { + ret := _m.Called(ctx, locale) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, *locales.Locale) error); ok { + r0 = rf(ctx, locale) + } else { + r0 = ret.Error(0) + } + + return r0 } // NewLocales creates a new instance of Locales. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewLocales(t mockConstructorTestingTNewLocales) *Locales { +// The first argument is typically a *testing.T value. +func NewLocales(t interface { + mock.TestingT + Cleanup(func()) +}) *Locales { mock := &Locales{} mock.Mock.Test(t) diff --git a/pkg/locales/mocks/Storage.go b/pkg/locales/mocks/Storage.go index d37bd81cf7011e2498768c76102bb71a689eaf84..42946781b45c100bfb962fde0a2f6098699cec80 100644 --- a/pkg/locales/mocks/Storage.go +++ b/pkg/locales/mocks/Storage.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.15.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -20,7 +20,15 @@ type Storage struct { func (_m *Storage) Create(ctx context.Context, locale *locales.Locale) (*locales.Locale, error) { ret := _m.Called(ctx, locale) + if len(ret) == 0 { + panic("no return value specified for Create") + } + var r0 *locales.Locale + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *locales.Locale) (*locales.Locale, error)); ok { + return rf(ctx, locale) + } if rf, ok := ret.Get(0).(func(context.Context, *locales.Locale) *locales.Locale); ok { r0 = rf(ctx, locale) } else { @@ -29,7 +37,6 @@ func (_m *Storage) Create(ctx context.Context, locale *locales.Locale) (*locales } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *locales.Locale) error); ok { r1 = rf(ctx, locale) } else { @@ -43,14 +50,21 @@ func (_m *Storage) Create(ctx context.Context, locale *locales.Locale) (*locales func (_m *Storage) Delete(ctx context.Context, spaceID string, filter *locales.Filter) (int, error) { ret := _m.Called(ctx, spaceID, filter) + if len(ret) == 0 { + panic("no return value specified for Delete") + } + var r0 int + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, *locales.Filter) (int, error)); ok { + return rf(ctx, spaceID, filter) + } if rf, ok := ret.Get(0).(func(context.Context, string, *locales.Filter) int); ok { r0 = rf(ctx, spaceID, filter) } else { r0 = ret.Get(0).(int) } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, string, *locales.Filter) error); ok { r1 = rf(ctx, spaceID, filter) } else { @@ -64,7 +78,16 @@ func (_m *Storage) Delete(ctx context.Context, spaceID string, filter *locales.F func (_m *Storage) Find(ctx context.Context, spaceID string, filter *locales.Filter, opts *options.FindOptions) ([]*locales.Locale, int, error) { ret := _m.Called(ctx, spaceID, filter, opts) + if len(ret) == 0 { + panic("no return value specified for Find") + } + var r0 []*locales.Locale + var r1 int + var r2 error + if rf, ok := ret.Get(0).(func(context.Context, string, *locales.Filter, *options.FindOptions) ([]*locales.Locale, int, error)); ok { + return rf(ctx, spaceID, filter, opts) + } if rf, ok := ret.Get(0).(func(context.Context, string, *locales.Filter, *options.FindOptions) []*locales.Locale); ok { r0 = rf(ctx, spaceID, filter, opts) } else { @@ -73,14 +96,12 @@ func (_m *Storage) Find(ctx context.Context, spaceID string, filter *locales.Fil } } - var r1 int if rf, ok := ret.Get(1).(func(context.Context, string, *locales.Filter, *options.FindOptions) int); ok { r1 = rf(ctx, spaceID, filter, opts) } else { r1 = ret.Get(1).(int) } - var r2 error if rf, ok := ret.Get(2).(func(context.Context, string, *locales.Filter, *options.FindOptions) error); ok { r2 = rf(ctx, spaceID, filter, opts) } else { @@ -94,6 +115,10 @@ func (_m *Storage) Find(ctx context.Context, spaceID string, filter *locales.Fil func (_m *Storage) Reset(ctx context.Context, spaceID string) error { ret := _m.Called(ctx, spaceID) + if len(ret) == 0 { + panic("no return value specified for Reset") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { r0 = rf(ctx, spaceID) @@ -104,13 +129,30 @@ func (_m *Storage) Reset(ctx context.Context, spaceID string) error { return r0 } -type mockConstructorTestingTNewStorage interface { - mock.TestingT - Cleanup(func()) +// Update provides a mock function with given fields: ctx, locale +func (_m *Storage) Update(ctx context.Context, locale *locales.Locale) error { + ret := _m.Called(ctx, locale) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, *locales.Locale) error); ok { + r0 = rf(ctx, locale) + } else { + r0 = ret.Error(0) + } + + return r0 } // NewStorage creates a new instance of Storage. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewStorage(t mockConstructorTestingTNewStorage) *Storage { +// The first argument is typically a *testing.T value. +func NewStorage(t interface { + mock.TestingT + Cleanup(func()) +}) *Storage { mock := &Storage{} mock.Mock.Test(t) diff --git a/pkg/locales/service.go b/pkg/locales/service.go index 7724d7f7ecdb2f4733d97bff01113d105adabdeb..ba303e13f671a700a5518ca1b200cb48dcad5695 100644 --- a/pkg/locales/service.go +++ b/pkg/locales/service.go @@ -9,6 +9,7 @@ import ( // @grpc-addr content.locales.Locales type Locales interface { Create(ctx context.Context, locale *Locale) (created *Locale, err error) + Update(ctx context.Context, locale *Locale) (err error) List(ctx context.Context, spaceId string) (locales []*Locale, err error) Delete(ctx context.Context, spaceId, localeId string) (err error) } diff --git a/pkg/locales/storage.go b/pkg/locales/storage.go index c345706c5925119cf3eb84a07f91e57ff764f46f..facbb380e33d5f5e92e778cb54873b4d5fca4746 100644 --- a/pkg/locales/storage.go +++ b/pkg/locales/storage.go @@ -10,11 +10,18 @@ type Storage interface { Reset(ctx context.Context, spaceID string) error Create(ctx context.Context, locale *Locale) (created *Locale, err error) + Update(ctx context.Context, locale *Locale) (err error) Find(ctx context.Context, spaceID string, filter *Filter, opts *options.FindOptions) (locales []*Locale, total int, err error) Delete(ctx context.Context, spaceID string, filter *Filter) (total int, err error) } type Filter struct { - ID []string - Name []string + ID []string `json:"id"` + Name []string `json:"name"` + NativeName []string `json:"native_name"` + Code []string `json:"code"` + Fallback []string `json:"fallback"` + Direction []string `json:"direction"` + NoPublish *bool `json:"no_publish"` + Disabled *bool `json:"disabled"` } diff --git a/pkg/locales/transport/client.go b/pkg/locales/transport/client.go index 7aa15eda1f74110ad9b602e31f4e9889c971720a..1aa9dc5169737c91ef96c981405ec6dbcea048c2 100644 --- a/pkg/locales/transport/client.go +++ b/pkg/locales/transport/client.go @@ -17,6 +17,15 @@ func (set EndpointsSet) Create(arg0 context.Context, arg1 *locales.Locale) (res0 return response.(*CreateResponse).Created, res1 } +func (set EndpointsSet) Update(arg0 context.Context, arg1 *locales.Locale) (res1 error) { + request := UpdateRequest{Locale: arg1} + _, res1 = set.UpdateEndpoint(arg0, &request) + if res1 != nil { + return + } + return res1 +} + func (set EndpointsSet) List(arg0 context.Context, arg1 string) (res0 []*locales.Locale, res1 error) { request := ListRequest{SpaceId: arg1} response, res1 := set.ListEndpoint(arg0, &request) @@ -28,8 +37,8 @@ func (set EndpointsSet) List(arg0 context.Context, arg1 string) (res0 []*locales func (set EndpointsSet) Delete(arg0 context.Context, arg1 string, arg2 string) (res0 error) { request := DeleteRequest{ - LocaleId: arg2, - SpaceId: arg1, + Id: arg2, + SpaceId: arg1, } _, res0 = set.DeleteEndpoint(arg0, &request) if res0 != nil { diff --git a/pkg/locales/transport/endpoints.microgen.go b/pkg/locales/transport/endpoints.microgen.go index ffca7318747104f8b58af332e90646f8cc6a8b9c..44dca7f2185e630db610b4ec162cfa125de97d49 100644 --- a/pkg/locales/transport/endpoints.microgen.go +++ b/pkg/locales/transport/endpoints.microgen.go @@ -7,6 +7,7 @@ import endpoint "github.com/go-kit/kit/endpoint" // EndpointsSet implements Locales API and used for transport purposes. type EndpointsSet struct { CreateEndpoint endpoint.Endpoint + UpdateEndpoint endpoint.Endpoint ListEndpoint endpoint.Endpoint DeleteEndpoint endpoint.Endpoint } diff --git a/pkg/locales/transport/exchanges.microgen.go b/pkg/locales/transport/exchanges.microgen.go index a07204e13a233fd7bae40c74e9984061871a92b7..14a4f1a6492f172de8f2b3df62ae6f632804f62f 100644 --- a/pkg/locales/transport/exchanges.microgen.go +++ b/pkg/locales/transport/exchanges.microgen.go @@ -12,6 +12,12 @@ type ( Created *locales.Locale `json:"created"` } + UpdateRequest struct { + Locale *locales.Locale `json:"locale"` + } + // Formal exchange type, please do not delete. + UpdateResponse struct{} + ListRequest struct { SpaceId string `json:"space_id"` } @@ -20,8 +26,8 @@ type ( } DeleteRequest struct { - SpaceId string `json:"space_id"` - LocaleId string `json:"locale_id"` + Id string `json:"id"` + SpaceId string `json:"space_id"` } // Formal exchange type, please do not delete. DeleteResponse struct{} diff --git a/pkg/locales/transport/grpc/client.go b/pkg/locales/transport/grpc/client.go index 8c1687cd77db13c1353b1b82cc26e191f519df14..877400ddeeaa54b265e43407bff4a9df548ff1be 100644 --- a/pkg/locales/transport/grpc/client.go +++ b/pkg/locales/transport/grpc/client.go @@ -13,6 +13,7 @@ func NewClient(conn *grpc.ClientConn, opts ...grpckit.ClientOption) transport.En c := NewGRPCClient(conn, "", opts...) return transport.EndpointsSet{ CreateEndpoint: grpcerr.ClientMiddleware(c.CreateEndpoint), + UpdateEndpoint: grpcerr.ClientMiddleware(c.UpdateEndpoint), DeleteEndpoint: grpcerr.ClientMiddleware(c.DeleteEndpoint), ListEndpoint: grpcerr.ClientMiddleware(c.ListEndpoint), } diff --git a/pkg/locales/transport/grpc/client.microgen.go b/pkg/locales/transport/grpc/client.microgen.go index 214cdf463436c71195457305de39516bd24e20d0..a8c0b9fcb06a8ed08edf72e495ceb240e2e53b80 100644 --- a/pkg/locales/transport/grpc/client.microgen.go +++ b/pkg/locales/transport/grpc/client.microgen.go @@ -22,6 +22,13 @@ func NewGRPCClient(conn *grpc.ClientConn, addr string, opts ...grpckit.ClientOpt pb.CreateResponse{}, opts..., ).Endpoint(), + UpdateEndpoint: grpckit.NewClient( + conn, addr, "Update", + _Encode_Update_Request, + _Decode_Update_Response, + empty.Empty{}, + opts..., + ).Endpoint(), DeleteEndpoint: grpckit.NewClient( conn, addr, "Delete", _Encode_Delete_Request, diff --git a/pkg/locales/transport/grpc/protobuf_endpoint_converters.microgen.go b/pkg/locales/transport/grpc/protobuf_endpoint_converters.microgen.go index f8124ba307afb6caa42b881a0c5778f465bf6f0f..c9c534131bf7e3be03bce9aeadfa3957d252ae2f 100644 --- a/pkg/locales/transport/grpc/protobuf_endpoint_converters.microgen.go +++ b/pkg/locales/transport/grpc/protobuf_endpoint_converters.microgen.go @@ -24,6 +24,18 @@ func _Encode_Create_Request(ctx context.Context, request interface{}) (interface return &pb.CreateRequest{Locale: pbLocale}, nil } +func _Encode_Update_Request(ctx context.Context, request interface{}) (interface{}, error) { + if request == nil { + return nil, errors.New("nil UpdateRequest") + } + req := request.(*transport.UpdateRequest) + pbLocale, err := PtrLocaleToProto(req.Locale) + if err != nil { + return nil, err + } + return &pb.UpdateRequest{Locale: pbLocale}, nil +} + func _Encode_List_Request(ctx context.Context, request interface{}) (interface{}, error) { if request == nil { return nil, errors.New("nil ListRequest") @@ -38,8 +50,8 @@ func _Encode_Delete_Request(ctx context.Context, request interface{}) (interface } req := request.(*transport.DeleteRequest) return &pb.DeleteRequest{ - LocaleId: req.LocaleId, - SpaceId: req.SpaceId, + Id: req.Id, + SpaceId: req.SpaceId, }, nil } @@ -55,6 +67,10 @@ func _Encode_Create_Response(ctx context.Context, response interface{}) (interfa return &pb.CreateResponse{Locale: respLocale}, nil } +func _Encode_Update_Response(ctx context.Context, response interface{}) (interface{}, error) { + return &empty.Empty{}, nil +} + func _Encode_List_Response(ctx context.Context, response interface{}) (interface{}, error) { if response == nil { return nil, errors.New("nil ListResponse") @@ -83,6 +99,18 @@ func _Decode_Create_Request(ctx context.Context, request interface{}) (interface return &transport.CreateRequest{Locale: locale}, nil } +func _Decode_Update_Request(ctx context.Context, request interface{}) (interface{}, error) { + if request == nil { + return nil, errors.New("nil UpdateRequest") + } + req := request.(*pb.UpdateRequest) + locale, err := ProtoToPtrLocale(req.Locale) + if err != nil { + return nil, err + } + return &transport.UpdateRequest{Locale: locale}, nil +} + func _Decode_List_Request(ctx context.Context, request interface{}) (interface{}, error) { if request == nil { return nil, errors.New("nil ListRequest") @@ -97,8 +125,8 @@ func _Decode_Delete_Request(ctx context.Context, request interface{}) (interface } req := request.(*pb.DeleteRequest) return &transport.DeleteRequest{ - LocaleId: string(req.LocaleId), - SpaceId: string(req.SpaceId), + Id: string(req.Id), + SpaceId: string(req.SpaceId), }, nil } @@ -114,6 +142,10 @@ func _Decode_Create_Response(ctx context.Context, response interface{}) (interfa return &transport.CreateResponse{Created: respLocale}, nil } +func _Decode_Update_Response(ctx context.Context, response interface{}) (interface{}, error) { + return &empty.Empty{}, nil +} + func _Decode_List_Response(ctx context.Context, response interface{}) (interface{}, error) { if response == nil { return nil, errors.New("nil ListResponse") diff --git a/pkg/locales/transport/grpc/protobuf_type_converters.microgen.go b/pkg/locales/transport/grpc/protobuf_type_converters.microgen.go index 6dca0bb8afa68dfe3fa17b53d315f3716c48ae36..529783bb217c13014e8d490a232c46b73844fafe 100644 --- a/pkg/locales/transport/grpc/protobuf_type_converters.microgen.go +++ b/pkg/locales/transport/grpc/protobuf_type_converters.microgen.go @@ -13,14 +13,36 @@ func PtrLocaleToProto(locale *service.Locale) (*pb.Locale, error) { if locale == nil { return nil, nil } - return &pb.Locale{Id: locale.ID, Name: locale.Name, SpaceId: locale.SpaceID}, nil + return &pb.Locale{ + Id: locale.ID, + SpaceId: locale.SpaceID, + Name: locale.Name, + NativeName: locale.NativeName, + Code: locale.Code, + Fallback: locale.Fallback, + Direction: locale.Direction, + Weight: int64(locale.Weight), + NoPublish: locale.NoPublish, + Disabled: locale.Disabled, + }, nil } func ProtoToPtrLocale(protoLocale *pb.Locale) (*service.Locale, error) { if protoLocale == nil { return nil, nil } - return &service.Locale{ID: protoLocale.Id, Name: protoLocale.Name, SpaceID: protoLocale.SpaceId}, nil + return &service.Locale{ + ID: protoLocale.Id, + SpaceID: protoLocale.SpaceId, + Name: protoLocale.Name, + NativeName: protoLocale.NativeName, + Code: protoLocale.Code, + Fallback: protoLocale.Fallback, + Direction: protoLocale.Direction, + Weight: int(protoLocale.Weight), + NoPublish: protoLocale.NoPublish, + Disabled: protoLocale.Disabled, + }, nil } func ListPtrLocaleToProto(locales []*service.Locale) ([]*pb.Locale, error) { diff --git a/pkg/locales/transport/grpc/server.go b/pkg/locales/transport/grpc/server.go index 7e7667cf0a0bd00e0affbf79fa682f98d2df650c..ca4f95aeff638c95da871d40b9ce999b1b108299 100644 --- a/pkg/locales/transport/grpc/server.go +++ b/pkg/locales/transport/grpc/server.go @@ -12,6 +12,7 @@ func NewServer(svc locales.Locales, opts ...grpckit.ServerOption) pb.LocalesServ eps := transport.Endpoints(svc) eps = transport.EndpointsSet{ CreateEndpoint: grpcerr.ServerMiddleware(eps.CreateEndpoint), + UpdateEndpoint: grpcerr.ServerMiddleware(eps.UpdateEndpoint), DeleteEndpoint: grpcerr.ServerMiddleware(eps.DeleteEndpoint), ListEndpoint: grpcerr.ServerMiddleware(eps.ListEndpoint), } diff --git a/pkg/locales/transport/grpc/server.microgen.go b/pkg/locales/transport/grpc/server.microgen.go index fe25ca1a7b676599d5d09463cdbb6c11aba87939..80778f883bafb2aba5d926526b162cded6db53a7 100644 --- a/pkg/locales/transport/grpc/server.microgen.go +++ b/pkg/locales/transport/grpc/server.microgen.go @@ -13,6 +13,7 @@ import ( type localesServer struct { create grpc.Handler + update grpc.Handler list grpc.Handler delete grpc.Handler @@ -27,6 +28,12 @@ func NewGRPCServer(endpoints *transport.EndpointsSet, opts ...grpc.ServerOption) _Encode_Create_Response, opts..., ), + update: grpc.NewServer( + endpoints.UpdateEndpoint, + _Decode_Update_Request, + _Encode_Update_Response, + opts..., + ), delete: grpc.NewServer( endpoints.DeleteEndpoint, _Decode_Delete_Request, @@ -50,6 +57,14 @@ func (S *localesServer) Create(ctx context.Context, req *pb.CreateRequest) (*pb. return resp.(*pb.CreateResponse), nil } +func (S *localesServer) Update(ctx context.Context, req *pb.UpdateRequest) (*empty.Empty, error) { + _, resp, err := S.update.ServeGRPC(ctx, req) + if err != nil { + return nil, err + } + return resp.(*empty.Empty), nil +} + func (S *localesServer) List(ctx context.Context, req *pb.ListRequest) (*pb.ListResponse, error) { _, resp, err := S.list.ServeGRPC(ctx, req) if err != nil { diff --git a/pkg/locales/transport/server.microgen.go b/pkg/locales/transport/server.microgen.go index 5ce815dcb52415a93ddfeb095f99e22fb14c4492..081edcd5c304fa5526e031181e80c78903b1e707 100644 --- a/pkg/locales/transport/server.microgen.go +++ b/pkg/locales/transport/server.microgen.go @@ -12,6 +12,7 @@ import ( func Endpoints(svc locales.Locales) EndpointsSet { return EndpointsSet{ CreateEndpoint: CreateEndpoint(svc), + UpdateEndpoint: UpdateEndpoint(svc), DeleteEndpoint: DeleteEndpoint(svc), ListEndpoint: ListEndpoint(svc), } @@ -25,6 +26,14 @@ func CreateEndpoint(svc locales.Locales) endpoint.Endpoint { } } +func UpdateEndpoint(svc locales.Locales) endpoint.Endpoint { + return func(arg0 context.Context, request interface{}) (interface{}, error) { + req := request.(*UpdateRequest) + res1 := svc.Update(arg0, req.Locale) + return &UpdateResponse{}, res1 + } +} + func ListEndpoint(svc locales.Locales) endpoint.Endpoint { return func(arg0 context.Context, request interface{}) (interface{}, error) { req := request.(*ListRequest) @@ -36,7 +45,7 @@ func ListEndpoint(svc locales.Locales) endpoint.Endpoint { func DeleteEndpoint(svc locales.Locales) endpoint.Endpoint { return func(arg0 context.Context, request interface{}) (interface{}, error) { req := request.(*DeleteRequest) - res0 := svc.Delete(arg0, req.SpaceId, req.LocaleId) + res0 := svc.Delete(arg0, req.SpaceId, req.Id) return &DeleteResponse{}, res0 } } diff --git a/proto/locales/locales.pb.go b/proto/locales/locales.pb.go index 6ed197b9a1d42660f0211daaaba01f7334ff93df..023d2ef4d9c25cc079475adb27729a4daaf9a422 100644 --- a/proto/locales/locales.pb.go +++ b/proto/locales/locales.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 -// protoc v4.24.3 +// protoc-gen-go v1.34.1 +// protoc v5.26.1 // source: locales/locales.proto package locales @@ -26,9 +26,16 @@ type Locale struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - SpaceId string `protobuf:"bytes,2,opt,name=space_id,json=spaceId,proto3" json:"space_id,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // Рдентификатор локали, генерируется автоматически. Для локали РїРѕ умолчанию устанавливается как "default". + SpaceId string `protobuf:"bytes,2,opt,name=space_id,json=spaceId,proto3" json:"space_id,omitempty"` // Рдентификатор пространства. + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` // Название локали. Опционально, заполняется автоматически (Пример: russian, english) + NativeName string `protobuf:"bytes,4,opt,name=native_name,json=nativeName,proto3" json:"native_name,omitempty"` // Название локали РЅР° языке локали. Опционально, заполняется автоматически (Пример: Р СѓСЃСЃРєРёР№, English) + Code string `protobuf:"bytes,5,opt,name=code,proto3" json:"code,omitempty"` // РљРѕРґ локали https://en.wikipedia.org/wiki/IETF_language_tag + Fallback string `protobuf:"bytes,6,opt,name=fallback,proto3" json:"fallback,omitempty"` // Рдентификатор локали, который будет использоваться РїСЂРё отсутствии перевода + Direction string `protobuf:"bytes,7,opt,name=direction,proto3" json:"direction,omitempty"` // Направление РїРёСЃСЊРјР° - слева направо (ltr) или справа налево (rtl). РџРѕ умолчанию устанавливается ltr. + Weight int64 `protobuf:"varint,8,opt,name=weight,proto3" json:"weight,omitempty"` // Вес локали. + NoPublish bool `protobuf:"varint,100,opt,name=no_publish,json=noPublish,proto3" json:"no_publish,omitempty"` // РќРµ публиковать контент данной локали. РќРµ будет доступен контент через Delivery API. (РєСЂРѕРјРµ default) + Disabled bool `protobuf:"varint,101,opt,name=disabled,proto3" json:"disabled,omitempty"` // Запретить использование локали. Нельзя создавать Рё редактировать контент для данной локали (РєСЂРѕРјРµ default) } func (x *Locale) Reset() { @@ -84,6 +91,55 @@ func (x *Locale) GetName() string { return "" } +func (x *Locale) GetNativeName() string { + if x != nil { + return x.NativeName + } + return "" +} + +func (x *Locale) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +func (x *Locale) GetFallback() string { + if x != nil { + return x.Fallback + } + return "" +} + +func (x *Locale) GetDirection() string { + if x != nil { + return x.Direction + } + return "" +} + +func (x *Locale) GetWeight() int64 { + if x != nil { + return x.Weight + } + return 0 +} + +func (x *Locale) GetNoPublish() bool { + if x != nil { + return x.NoPublish + } + return false +} + +func (x *Locale) GetDisabled() bool { + if x != nil { + return x.Disabled + } + return false +} + type CreateRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -178,6 +234,53 @@ func (x *CreateResponse) GetLocale() *Locale { return nil } +type UpdateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Locale *Locale `protobuf:"bytes,1,opt,name=locale,proto3" json:"locale,omitempty"` +} + +func (x *UpdateRequest) Reset() { + *x = UpdateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_locales_locales_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateRequest) ProtoMessage() {} + +func (x *UpdateRequest) ProtoReflect() protoreflect.Message { + mi := &file_locales_locales_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead. +func (*UpdateRequest) Descriptor() ([]byte, []int) { + return file_locales_locales_proto_rawDescGZIP(), []int{3} +} + +func (x *UpdateRequest) GetLocale() *Locale { + if x != nil { + return x.Locale + } + return nil +} + type ListRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -189,7 +292,7 @@ type ListRequest struct { func (x *ListRequest) Reset() { *x = ListRequest{} if protoimpl.UnsafeEnabled { - mi := &file_locales_locales_proto_msgTypes[3] + mi := &file_locales_locales_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -202,7 +305,7 @@ func (x *ListRequest) String() string { func (*ListRequest) ProtoMessage() {} func (x *ListRequest) ProtoReflect() protoreflect.Message { - mi := &file_locales_locales_proto_msgTypes[3] + mi := &file_locales_locales_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -215,7 +318,7 @@ func (x *ListRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListRequest.ProtoReflect.Descriptor instead. func (*ListRequest) Descriptor() ([]byte, []int) { - return file_locales_locales_proto_rawDescGZIP(), []int{3} + return file_locales_locales_proto_rawDescGZIP(), []int{4} } func (x *ListRequest) GetSpaceId() string { @@ -236,7 +339,7 @@ type ListResponse struct { func (x *ListResponse) Reset() { *x = ListResponse{} if protoimpl.UnsafeEnabled { - mi := &file_locales_locales_proto_msgTypes[4] + mi := &file_locales_locales_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -249,7 +352,7 @@ func (x *ListResponse) String() string { func (*ListResponse) ProtoMessage() {} func (x *ListResponse) ProtoReflect() protoreflect.Message { - mi := &file_locales_locales_proto_msgTypes[4] + mi := &file_locales_locales_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -262,7 +365,7 @@ func (x *ListResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListResponse.ProtoReflect.Descriptor instead. func (*ListResponse) Descriptor() ([]byte, []int) { - return file_locales_locales_proto_rawDescGZIP(), []int{4} + return file_locales_locales_proto_rawDescGZIP(), []int{5} } func (x *ListResponse) GetLocales() []*Locale { @@ -277,14 +380,14 @@ type DeleteRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - SpaceId string `protobuf:"bytes,1,opt,name=space_id,json=spaceId,proto3" json:"space_id,omitempty"` - LocaleId string `protobuf:"bytes,2,opt,name=locale_id,json=localeId,proto3" json:"locale_id,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + SpaceId string `protobuf:"bytes,2,opt,name=space_id,json=spaceId,proto3" json:"space_id,omitempty"` } func (x *DeleteRequest) Reset() { *x = DeleteRequest{} if protoimpl.UnsafeEnabled { - mi := &file_locales_locales_proto_msgTypes[5] + mi := &file_locales_locales_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -297,7 +400,7 @@ func (x *DeleteRequest) String() string { func (*DeleteRequest) ProtoMessage() {} func (x *DeleteRequest) ProtoReflect() protoreflect.Message { - mi := &file_locales_locales_proto_msgTypes[5] + mi := &file_locales_locales_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -310,19 +413,19 @@ func (x *DeleteRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead. func (*DeleteRequest) Descriptor() ([]byte, []int) { - return file_locales_locales_proto_rawDescGZIP(), []int{5} + return file_locales_locales_proto_rawDescGZIP(), []int{6} } -func (x *DeleteRequest) GetSpaceId() string { +func (x *DeleteRequest) GetId() string { if x != nil { - return x.SpaceId + return x.Id } return "" } -func (x *DeleteRequest) GetLocaleId() string { +func (x *DeleteRequest) GetSpaceId() string { if x != nil { - return x.LocaleId + return x.SpaceId } return "" } @@ -334,49 +437,69 @@ var file_locales_locales_proto_rawDesc = []byte{ 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x47, 0x0a, 0x06, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, - 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x40, - 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x2f, 0x0a, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, - 0x73, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x52, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, - 0x22, 0x41, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x89, 0x02, 0x0a, 0x06, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x65, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x1f, 0x0a, 0x0b, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, + 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, + 0x0a, 0x06, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, + 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x6f, 0x5f, 0x70, 0x75, 0x62, + 0x6c, 0x69, 0x73, 0x68, 0x18, 0x64, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x6e, 0x6f, 0x50, 0x75, + 0x62, 0x6c, 0x69, 0x73, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x18, 0x65, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x22, 0x40, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x2f, 0x0a, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x52, 0x06, 0x6c, 0x6f, 0x63, - 0x61, 0x6c, 0x65, 0x22, 0x28, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x22, 0x41, 0x0a, - 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, - 0x07, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x73, - 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x52, 0x07, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x73, - 0x22, 0x47, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, - 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x49, 0x64, 0x32, 0xe1, 0x01, 0x0a, 0x07, 0x4c, 0x6f, - 0x63, 0x61, 0x6c, 0x65, 0x73, 0x12, 0x4b, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, + 0x61, 0x6c, 0x65, 0x22, 0x41, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, + 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x52, 0x06, + 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x22, 0x40, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2f, 0x0a, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x65, + 0x52, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x22, 0x28, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x49, 0x64, 0x22, 0x41, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x31, 0x0a, 0x07, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x6c, 0x6f, + 0x63, 0x61, 0x6c, 0x65, 0x73, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x52, 0x07, 0x6c, 0x6f, + 0x63, 0x61, 0x6c, 0x65, 0x73, 0x22, 0x3a, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, + 0x64, 0x32, 0xa5, 0x02, 0x0a, 0x07, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x12, 0x4b, 0x0a, + 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x06, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x6c, + 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x45, + 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1c, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x6c, + 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, - 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, - 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x45, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1c, 0x2e, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x2e, 0x4c, 0x69, 0x73, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x06, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2e, 0x6c, 0x6f, - 0x63, 0x61, 0x6c, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, 0x34, 0x5a, - 0x32, 0x67, 0x69, 0x74, 0x2e, 0x70, 0x65, 0x72, 0x78, 0x2e, 0x72, 0x75, 0x2f, 0x70, 0x65, 0x72, - 0x78, 0x69, 0x73, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x3b, 0x6c, 0x6f, 0x63, 0x61, - 0x6c, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, + 0x2e, 0x70, 0x65, 0x72, 0x78, 0x2e, 0x72, 0x75, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2f, + 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x3b, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -391,31 +514,35 @@ func file_locales_locales_proto_rawDescGZIP() []byte { return file_locales_locales_proto_rawDescData } -var file_locales_locales_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_locales_locales_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_locales_locales_proto_goTypes = []interface{}{ (*Locale)(nil), // 0: content.locales.Locale (*CreateRequest)(nil), // 1: content.locales.CreateRequest (*CreateResponse)(nil), // 2: content.locales.CreateResponse - (*ListRequest)(nil), // 3: content.locales.ListRequest - (*ListResponse)(nil), // 4: content.locales.ListResponse - (*DeleteRequest)(nil), // 5: content.locales.DeleteRequest - (*emptypb.Empty)(nil), // 6: google.protobuf.Empty + (*UpdateRequest)(nil), // 3: content.locales.UpdateRequest + (*ListRequest)(nil), // 4: content.locales.ListRequest + (*ListResponse)(nil), // 5: content.locales.ListResponse + (*DeleteRequest)(nil), // 6: content.locales.DeleteRequest + (*emptypb.Empty)(nil), // 7: google.protobuf.Empty } var file_locales_locales_proto_depIdxs = []int32{ 0, // 0: content.locales.CreateRequest.locale:type_name -> content.locales.Locale 0, // 1: content.locales.CreateResponse.locale:type_name -> content.locales.Locale - 0, // 2: content.locales.ListResponse.locales:type_name -> content.locales.Locale - 1, // 3: content.locales.Locales.Create:input_type -> content.locales.CreateRequest - 3, // 4: content.locales.Locales.List:input_type -> content.locales.ListRequest - 5, // 5: content.locales.Locales.Delete:input_type -> content.locales.DeleteRequest - 2, // 6: content.locales.Locales.Create:output_type -> content.locales.CreateResponse - 4, // 7: content.locales.Locales.List:output_type -> content.locales.ListResponse - 6, // 8: content.locales.Locales.Delete:output_type -> google.protobuf.Empty - 6, // [6:9] is the sub-list for method output_type - 3, // [3:6] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 0, // 2: content.locales.UpdateRequest.locale:type_name -> content.locales.Locale + 0, // 3: content.locales.ListResponse.locales:type_name -> content.locales.Locale + 1, // 4: content.locales.Locales.Create:input_type -> content.locales.CreateRequest + 3, // 5: content.locales.Locales.Update:input_type -> content.locales.UpdateRequest + 4, // 6: content.locales.Locales.List:input_type -> content.locales.ListRequest + 6, // 7: content.locales.Locales.Delete:input_type -> content.locales.DeleteRequest + 2, // 8: content.locales.Locales.Create:output_type -> content.locales.CreateResponse + 7, // 9: content.locales.Locales.Update:output_type -> google.protobuf.Empty + 5, // 10: content.locales.Locales.List:output_type -> content.locales.ListResponse + 7, // 11: content.locales.Locales.Delete:output_type -> google.protobuf.Empty + 8, // [8:12] is the sub-list for method output_type + 4, // [4:8] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_locales_locales_proto_init() } @@ -461,7 +588,7 @@ func file_locales_locales_proto_init() { } } file_locales_locales_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListRequest); i { + switch v := v.(*UpdateRequest); i { case 0: return &v.state case 1: @@ -473,7 +600,7 @@ func file_locales_locales_proto_init() { } } file_locales_locales_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListResponse); i { + switch v := v.(*ListRequest); i { case 0: return &v.state case 1: @@ -485,6 +612,18 @@ func file_locales_locales_proto_init() { } } file_locales_locales_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_locales_locales_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeleteRequest); i { case 0: return &v.state @@ -503,7 +642,7 @@ func file_locales_locales_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_locales_locales_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 7, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/locales/locales_grpc.pb.go b/proto/locales/locales_grpc.pb.go index d8f5e712b8b06e5646d56020c1e0cb06ae24545f..d6184e151ac919b0c5bc83004a075b06d78c6116 100644 --- a/proto/locales/locales_grpc.pb.go +++ b/proto/locales/locales_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.3 +// - protoc-gen-go-grpc v1.4.0 +// - protoc v5.26.1 // source: locales/locales.proto package locales @@ -16,11 +16,12 @@ import ( // 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.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.62.0 or later. +const _ = grpc.SupportPackageIsVersion8 const ( Locales_Create_FullMethodName = "/content.locales.Locales/Create" + Locales_Update_FullMethodName = "/content.locales.Locales/Update" Locales_List_FullMethodName = "/content.locales.Locales/List" Locales_Delete_FullMethodName = "/content.locales.Locales/Delete" ) @@ -29,8 +30,13 @@ const ( // // 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 LocalesClient interface { + // Создать локаль Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) + // Обновить локаль + Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + // Получить СЃРїРёСЃРѕРє локалей List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) + // Удалить локаль Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) } @@ -43,8 +49,19 @@ func NewLocalesClient(cc grpc.ClientConnInterface) LocalesClient { } func (c *localesClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(CreateResponse) - err := c.cc.Invoke(ctx, Locales_Create_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Locales_Create_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *localesClient) Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, Locales_Update_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -52,8 +69,9 @@ func (c *localesClient) Create(ctx context.Context, in *CreateRequest, opts ...g } func (c *localesClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ListResponse) - err := c.cc.Invoke(ctx, Locales_List_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Locales_List_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -61,8 +79,9 @@ func (c *localesClient) List(ctx context.Context, in *ListRequest, opts ...grpc. } func (c *localesClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, Locales_Delete_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Locales_Delete_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -73,8 +92,13 @@ func (c *localesClient) Delete(ctx context.Context, in *DeleteRequest, opts ...g // All implementations must embed UnimplementedLocalesServer // for forward compatibility type LocalesServer interface { + // Создать локаль Create(context.Context, *CreateRequest) (*CreateResponse, error) + // Обновить локаль + Update(context.Context, *UpdateRequest) (*emptypb.Empty, error) + // Получить СЃРїРёСЃРѕРє локалей List(context.Context, *ListRequest) (*ListResponse, error) + // Удалить локаль Delete(context.Context, *DeleteRequest) (*emptypb.Empty, error) mustEmbedUnimplementedLocalesServer() } @@ -86,6 +110,9 @@ type UnimplementedLocalesServer struct { func (UnimplementedLocalesServer) Create(context.Context, *CreateRequest) (*CreateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") } +func (UnimplementedLocalesServer) Update(context.Context, *UpdateRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method Update not implemented") +} func (UnimplementedLocalesServer) List(context.Context, *ListRequest) (*ListResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method List not implemented") } @@ -123,6 +150,24 @@ func _Locales_Create_Handler(srv interface{}, ctx context.Context, dec func(inte return interceptor(ctx, in, info, handler) } +func _Locales_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LocalesServer).Update(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Locales_Update_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LocalesServer).Update(ctx, req.(*UpdateRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Locales_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListRequest) if err := dec(in); err != nil { @@ -170,6 +215,10 @@ var Locales_ServiceDesc = grpc.ServiceDesc{ MethodName: "Create", Handler: _Locales_Create_Handler, }, + { + MethodName: "Update", + Handler: _Locales_Update_Handler, + }, { MethodName: "List", Handler: _Locales_List_Handler,