diff --git a/frontend/types/proto/api/v2/user_setting_service_pb.d.ts b/frontend/types/proto/api/v2/user_setting_service_pb.d.ts new file mode 100644 index 0000000..b74fb3b --- /dev/null +++ b/frontend/types/proto/api/v2/user_setting_service_pb.d.ts @@ -0,0 +1,146 @@ +// @generated by protoc-gen-es v1.3.0 +// @generated from file api/v2/user_setting_service.proto (package slash.api.v2, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from message slash.api.v2.UserSetting + */ +export declare class UserSetting extends Message { + /** + * id is the user id. + * + * @generated from field: int32 id = 1; + */ + id: number; + + /** + * locale is the user locale. + * + * @generated from field: string locale = 2; + */ + locale: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "slash.api.v2.UserSetting"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): UserSetting; + + static fromJson(jsonValue: JsonValue, options?: Partial): UserSetting; + + static fromJsonString(jsonString: string, options?: Partial): UserSetting; + + static equals(a: UserSetting | PlainMessage | undefined, b: UserSetting | PlainMessage | undefined): boolean; +} + +/** + * @generated from message slash.api.v2.GetUserSettingRequest + */ +export declare class GetUserSettingRequest extends Message { + /** + * id is the user id. + * + * @generated from field: int32 id = 1; + */ + id: number; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "slash.api.v2.GetUserSettingRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): GetUserSettingRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): GetUserSettingRequest; + + static fromJsonString(jsonString: string, options?: Partial): GetUserSettingRequest; + + static equals(a: GetUserSettingRequest | PlainMessage | undefined, b: GetUserSettingRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message slash.api.v2.GetUserSettingResponse + */ +export declare class GetUserSettingResponse extends Message { + /** + * @generated from field: slash.api.v2.UserSetting user_setting = 1; + */ + userSetting?: UserSetting; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "slash.api.v2.GetUserSettingResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): GetUserSettingResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): GetUserSettingResponse; + + static fromJsonString(jsonString: string, options?: Partial): GetUserSettingResponse; + + static equals(a: GetUserSettingResponse | PlainMessage | undefined, b: GetUserSettingResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message slash.api.v2.UpdateUserSettingRequest + */ +export declare class UpdateUserSettingRequest extends Message { + /** + * id is the user id. + * + * @generated from field: int32 id = 1; + */ + id: number; + + /** + * @generated from field: slash.api.v2.UserSetting user_setting = 2; + */ + userSetting?: UserSetting; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "slash.api.v2.UpdateUserSettingRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): UpdateUserSettingRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): UpdateUserSettingRequest; + + static fromJsonString(jsonString: string, options?: Partial): UpdateUserSettingRequest; + + static equals(a: UpdateUserSettingRequest | PlainMessage | undefined, b: UpdateUserSettingRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message slash.api.v2.UpdateUserSettingResponse + */ +export declare class UpdateUserSettingResponse extends Message { + /** + * @generated from field: slash.api.v2.UserSetting user_setting = 1; + */ + userSetting?: UserSetting; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "slash.api.v2.UpdateUserSettingResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): UpdateUserSettingResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): UpdateUserSettingResponse; + + static fromJsonString(jsonString: string, options?: Partial): UpdateUserSettingResponse; + + static equals(a: UpdateUserSettingResponse | PlainMessage | undefined, b: UpdateUserSettingResponse | PlainMessage | undefined): boolean; +} + diff --git a/frontend/types/proto/api/v2/user_setting_service_pb.js b/frontend/types/proto/api/v2/user_setting_service_pb.js new file mode 100644 index 0000000..b7faf22 --- /dev/null +++ b/frontend/types/proto/api/v2/user_setting_service_pb.js @@ -0,0 +1,59 @@ +// @generated by protoc-gen-es v1.3.0 +// @generated from file api/v2/user_setting_service.proto (package slash.api.v2, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from message slash.api.v2.UserSetting + */ +export const UserSetting = proto3.makeMessageType( + "slash.api.v2.UserSetting", + () => [ + { no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + { no: 2, name: "locale", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ], +); + +/** + * @generated from message slash.api.v2.GetUserSettingRequest + */ +export const GetUserSettingRequest = proto3.makeMessageType( + "slash.api.v2.GetUserSettingRequest", + () => [ + { no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + ], +); + +/** + * @generated from message slash.api.v2.GetUserSettingResponse + */ +export const GetUserSettingResponse = proto3.makeMessageType( + "slash.api.v2.GetUserSettingResponse", + () => [ + { no: 1, name: "user_setting", kind: "message", T: UserSetting }, + ], +); + +/** + * @generated from message slash.api.v2.UpdateUserSettingRequest + */ +export const UpdateUserSettingRequest = proto3.makeMessageType( + "slash.api.v2.UpdateUserSettingRequest", + () => [ + { no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + { no: 2, name: "user_setting", kind: "message", T: UserSetting }, + ], +); + +/** + * @generated from message slash.api.v2.UpdateUserSettingResponse + */ +export const UpdateUserSettingResponse = proto3.makeMessageType( + "slash.api.v2.UpdateUserSettingResponse", + () => [ + { no: 1, name: "user_setting", kind: "message", T: UserSetting }, + ], +); + diff --git a/proto/api/v2/user_setting_service.proto b/proto/api/v2/user_setting_service.proto new file mode 100644 index 0000000..a672b81 --- /dev/null +++ b/proto/api/v2/user_setting_service.proto @@ -0,0 +1,52 @@ +syntax = "proto3"; + +package slash.api.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; + +option go_package = "gen/api/v2"; + +service UserSettingService { + // GetUserSetting returns the user setting. + rpc GetUserSetting(GetUserSettingRequest) returns (GetUserSettingResponse) { + option (google.api.http) = {get: "/api/v2/user/{id}/setting"}; + option (google.api.method_signature) = "id"; + } + // UpdateUserSetting updates the user setting. + rpc UpdateUserSetting(UpdateUserSettingRequest) returns (UpdateUserSettingResponse) { + option (google.api.http) = { + put: "/api/v2/user/{id}/settins" + body: "*" + }; + option (google.api.method_signature) = "id"; + } +} + +message UserSetting { + // id is the user id. + int32 id = 1; + + // locale is the user locale. + string locale = 2; +} + +message GetUserSettingRequest { + // id is the user id. + int32 id = 1; +} + +message GetUserSettingResponse { + UserSetting user_setting = 1; +} + +message UpdateUserSettingRequest { + // id is the user id. + int32 id = 1; + + UserSetting user_setting = 2; +} + +message UpdateUserSettingResponse { + UserSetting user_setting = 1; +} diff --git a/proto/gen/api/v2/README.md b/proto/gen/api/v2/README.md index 0f6b4c9..65a3001 100644 --- a/proto/gen/api/v2/README.md +++ b/proto/gen/api/v2/README.md @@ -44,6 +44,15 @@ - [UserService](#slash-api-v2-UserService) +- [api/v2/user_setting_service.proto](#api_v2_user_setting_service-proto) + - [GetUserSettingRequest](#slash-api-v2-GetUserSettingRequest) + - [GetUserSettingResponse](#slash-api-v2-GetUserSettingResponse) + - [UpdateUserSettingRequest](#slash-api-v2-UpdateUserSettingRequest) + - [UpdateUserSettingResponse](#slash-api-v2-UpdateUserSettingResponse) + - [UserSetting](#slash-api-v2-UserSetting) + + - [UserSettingService](#slash-api-v2-UserSettingService) + - [Scalar Value Types](#scalar-value-types) @@ -555,6 +564,110 @@ + +

Top

+ +## api/v2/user_setting_service.proto + + + + + +### GetUserSettingRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int32](#int32) | | id is the user id. | + + + + + + + + +### GetUserSettingResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| user_setting | [UserSetting](#slash-api-v2-UserSetting) | | | + + + + + + + + +### UpdateUserSettingRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int32](#int32) | | id is the user id. | +| user_setting | [UserSetting](#slash-api-v2-UserSetting) | | | + + + + + + + + +### UpdateUserSettingResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| user_setting | [UserSetting](#slash-api-v2-UserSetting) | | | + + + + + + + + +### UserSetting + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int32](#int32) | | id is the user id. | +| locale | [string](#string) | | locale is the user locale. | + + + + + + + + + + + + + + +### UserSettingService + + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| GetUserSetting | [GetUserSettingRequest](#slash-api-v2-GetUserSettingRequest) | [GetUserSettingResponse](#slash-api-v2-GetUserSettingResponse) | GetUserSetting returns the user setting. | +| UpdateUserSetting | [UpdateUserSettingRequest](#slash-api-v2-UpdateUserSettingRequest) | [UpdateUserSettingResponse](#slash-api-v2-UpdateUserSettingResponse) | UpdateUserSetting updates the user setting. | + + + + + ## Scalar Value Types | .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | diff --git a/proto/gen/api/v2/user_setting_service.pb.go b/proto/gen/api/v2/user_setting_service.pb.go new file mode 100644 index 0000000..d5a4406 --- /dev/null +++ b/proto/gen/api/v2/user_setting_service.pb.go @@ -0,0 +1,465 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: api/v2/user_setting_service.proto + +package apiv2 + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +type UserSetting struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // id is the user id. + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // locale is the user locale. + Locale string `protobuf:"bytes,2,opt,name=locale,proto3" json:"locale,omitempty"` +} + +func (x *UserSetting) Reset() { + *x = UserSetting{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_user_setting_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserSetting) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserSetting) ProtoMessage() {} + +func (x *UserSetting) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_user_setting_service_proto_msgTypes[0] + 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 UserSetting.ProtoReflect.Descriptor instead. +func (*UserSetting) Descriptor() ([]byte, []int) { + return file_api_v2_user_setting_service_proto_rawDescGZIP(), []int{0} +} + +func (x *UserSetting) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *UserSetting) GetLocale() string { + if x != nil { + return x.Locale + } + return "" +} + +type GetUserSettingRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // id is the user id. + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetUserSettingRequest) Reset() { + *x = GetUserSettingRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_user_setting_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUserSettingRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserSettingRequest) ProtoMessage() {} + +func (x *GetUserSettingRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_user_setting_service_proto_msgTypes[1] + 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 GetUserSettingRequest.ProtoReflect.Descriptor instead. +func (*GetUserSettingRequest) Descriptor() ([]byte, []int) { + return file_api_v2_user_setting_service_proto_rawDescGZIP(), []int{1} +} + +func (x *GetUserSettingRequest) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +type GetUserSettingResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserSetting *UserSetting `protobuf:"bytes,1,opt,name=user_setting,json=userSetting,proto3" json:"user_setting,omitempty"` +} + +func (x *GetUserSettingResponse) Reset() { + *x = GetUserSettingResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_user_setting_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUserSettingResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserSettingResponse) ProtoMessage() {} + +func (x *GetUserSettingResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_user_setting_service_proto_msgTypes[2] + 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 GetUserSettingResponse.ProtoReflect.Descriptor instead. +func (*GetUserSettingResponse) Descriptor() ([]byte, []int) { + return file_api_v2_user_setting_service_proto_rawDescGZIP(), []int{2} +} + +func (x *GetUserSettingResponse) GetUserSetting() *UserSetting { + if x != nil { + return x.UserSetting + } + return nil +} + +type UpdateUserSettingRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // id is the user id. + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + UserSetting *UserSetting `protobuf:"bytes,2,opt,name=user_setting,json=userSetting,proto3" json:"user_setting,omitempty"` +} + +func (x *UpdateUserSettingRequest) Reset() { + *x = UpdateUserSettingRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_user_setting_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateUserSettingRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserSettingRequest) ProtoMessage() {} + +func (x *UpdateUserSettingRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_user_setting_service_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 UpdateUserSettingRequest.ProtoReflect.Descriptor instead. +func (*UpdateUserSettingRequest) Descriptor() ([]byte, []int) { + return file_api_v2_user_setting_service_proto_rawDescGZIP(), []int{3} +} + +func (x *UpdateUserSettingRequest) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *UpdateUserSettingRequest) GetUserSetting() *UserSetting { + if x != nil { + return x.UserSetting + } + return nil +} + +type UpdateUserSettingResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserSetting *UserSetting `protobuf:"bytes,1,opt,name=user_setting,json=userSetting,proto3" json:"user_setting,omitempty"` +} + +func (x *UpdateUserSettingResponse) Reset() { + *x = UpdateUserSettingResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_user_setting_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateUserSettingResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserSettingResponse) ProtoMessage() {} + +func (x *UpdateUserSettingResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_user_setting_service_proto_msgTypes[4] + 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 UpdateUserSettingResponse.ProtoReflect.Descriptor instead. +func (*UpdateUserSettingResponse) Descriptor() ([]byte, []int) { + return file_api_v2_user_setting_service_proto_rawDescGZIP(), []int{4} +} + +func (x *UpdateUserSettingResponse) GetUserSetting() *UserSetting { + if x != nil { + return x.UserSetting + } + return nil +} + +var File_api_v2_user_setting_service_proto protoreflect.FileDescriptor + +var file_api_v2_user_setting_service_proto_rawDesc = []byte{ + 0x0a, 0x21, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, + 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x35, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x22, + 0x27, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, + 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x56, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x55, + 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, + 0x69, 0x6e, 0x67, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x22, 0x68, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3c, 0x0a, 0x0c, + 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x0b, 0x75, + 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x59, 0x0a, 0x19, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, + 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x73, 0x65, + 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0xac, 0x02, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x83, 0x01, 0x0a, + 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, + 0x23, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, + 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0xda, 0x41, 0x02, 0x69, + 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x12, 0x19, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, + 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x12, 0x8f, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x26, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, + 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x27, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, + 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0xda, 0x41, 0x02, 0x69, 0x64, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x3a, 0x01, 0x2a, 0x1a, 0x19, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x76, 0x32, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x73, 0x42, 0xae, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61, + 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x42, 0x17, 0x55, 0x73, 0x65, 0x72, 0x53, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x62, 0x6f, 0x6f, 0x6a, 0x61, 0x63, 0x6b, 0x2f, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x3b, + 0x61, 0x70, 0x69, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x53, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x53, 0x6c, + 0x61, 0x73, 0x68, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c, 0x53, 0x6c, 0x61, + 0x73, 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x18, 0x53, 0x6c, 0x61, 0x73, + 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x3a, 0x3a, 0x41, 0x70, + 0x69, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_api_v2_user_setting_service_proto_rawDescOnce sync.Once + file_api_v2_user_setting_service_proto_rawDescData = file_api_v2_user_setting_service_proto_rawDesc +) + +func file_api_v2_user_setting_service_proto_rawDescGZIP() []byte { + file_api_v2_user_setting_service_proto_rawDescOnce.Do(func() { + file_api_v2_user_setting_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_v2_user_setting_service_proto_rawDescData) + }) + return file_api_v2_user_setting_service_proto_rawDescData +} + +var file_api_v2_user_setting_service_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_api_v2_user_setting_service_proto_goTypes = []interface{}{ + (*UserSetting)(nil), // 0: slash.api.v2.UserSetting + (*GetUserSettingRequest)(nil), // 1: slash.api.v2.GetUserSettingRequest + (*GetUserSettingResponse)(nil), // 2: slash.api.v2.GetUserSettingResponse + (*UpdateUserSettingRequest)(nil), // 3: slash.api.v2.UpdateUserSettingRequest + (*UpdateUserSettingResponse)(nil), // 4: slash.api.v2.UpdateUserSettingResponse +} +var file_api_v2_user_setting_service_proto_depIdxs = []int32{ + 0, // 0: slash.api.v2.GetUserSettingResponse.user_setting:type_name -> slash.api.v2.UserSetting + 0, // 1: slash.api.v2.UpdateUserSettingRequest.user_setting:type_name -> slash.api.v2.UserSetting + 0, // 2: slash.api.v2.UpdateUserSettingResponse.user_setting:type_name -> slash.api.v2.UserSetting + 1, // 3: slash.api.v2.UserSettingService.GetUserSetting:input_type -> slash.api.v2.GetUserSettingRequest + 3, // 4: slash.api.v2.UserSettingService.UpdateUserSetting:input_type -> slash.api.v2.UpdateUserSettingRequest + 2, // 5: slash.api.v2.UserSettingService.GetUserSetting:output_type -> slash.api.v2.GetUserSettingResponse + 4, // 6: slash.api.v2.UserSettingService.UpdateUserSetting:output_type -> slash.api.v2.UpdateUserSettingResponse + 5, // [5:7] is the sub-list for method output_type + 3, // [3:5] 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 +} + +func init() { file_api_v2_user_setting_service_proto_init() } +func file_api_v2_user_setting_service_proto_init() { + if File_api_v2_user_setting_service_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_api_v2_user_setting_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserSetting); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_user_setting_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUserSettingRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_user_setting_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUserSettingResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_user_setting_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateUserSettingRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_user_setting_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateUserSettingResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_v2_user_setting_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_v2_user_setting_service_proto_goTypes, + DependencyIndexes: file_api_v2_user_setting_service_proto_depIdxs, + MessageInfos: file_api_v2_user_setting_service_proto_msgTypes, + }.Build() + File_api_v2_user_setting_service_proto = out.File + file_api_v2_user_setting_service_proto_rawDesc = nil + file_api_v2_user_setting_service_proto_goTypes = nil + file_api_v2_user_setting_service_proto_depIdxs = nil +} diff --git a/proto/gen/api/v2/user_setting_service.pb.gw.go b/proto/gen/api/v2/user_setting_service.pb.gw.go new file mode 100644 index 0000000..bfae62b --- /dev/null +++ b/proto/gen/api/v2/user_setting_service.pb.gw.go @@ -0,0 +1,308 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: api/v2/user_setting_service.proto + +/* +Package apiv2 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package apiv2 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_UserSettingService_GetUserSetting_0(ctx context.Context, marshaler runtime.Marshaler, client UserSettingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetUserSettingRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.Int32(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := client.GetUserSetting(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_UserSettingService_GetUserSetting_0(ctx context.Context, marshaler runtime.Marshaler, server UserSettingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetUserSettingRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.Int32(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := server.GetUserSetting(ctx, &protoReq) + return msg, metadata, err + +} + +func request_UserSettingService_UpdateUserSetting_0(ctx context.Context, marshaler runtime.Marshaler, client UserSettingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateUserSettingRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.Int32(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := client.UpdateUserSetting(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_UserSettingService_UpdateUserSetting_0(ctx context.Context, marshaler runtime.Marshaler, server UserSettingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateUserSettingRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.Int32(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := server.UpdateUserSetting(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterUserSettingServiceHandlerServer registers the http handlers for service UserSettingService to "mux". +// UnaryRPC :call UserSettingServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterUserSettingServiceHandlerFromEndpoint instead. +func RegisterUserSettingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserSettingServiceServer) error { + + mux.Handle("GET", pattern_UserSettingService_GetUserSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/slash.api.v2.UserSettingService/GetUserSetting", runtime.WithHTTPPathPattern("/api/v2/user/{id}/setting")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserSettingService_GetUserSetting_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_UserSettingService_GetUserSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_UserSettingService_UpdateUserSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/slash.api.v2.UserSettingService/UpdateUserSetting", runtime.WithHTTPPathPattern("/api/v2/user/{id}/settins")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserSettingService_UpdateUserSetting_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_UserSettingService_UpdateUserSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterUserSettingServiceHandlerFromEndpoint is same as RegisterUserSettingServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterUserSettingServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterUserSettingServiceHandler(ctx, mux, conn) +} + +// RegisterUserSettingServiceHandler registers the http handlers for service UserSettingService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterUserSettingServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterUserSettingServiceHandlerClient(ctx, mux, NewUserSettingServiceClient(conn)) +} + +// RegisterUserSettingServiceHandlerClient registers the http handlers for service UserSettingService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserSettingServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserSettingServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "UserSettingServiceClient" to call the correct interceptors. +func RegisterUserSettingServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserSettingServiceClient) error { + + mux.Handle("GET", pattern_UserSettingService_GetUserSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/slash.api.v2.UserSettingService/GetUserSetting", runtime.WithHTTPPathPattern("/api/v2/user/{id}/setting")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserSettingService_GetUserSetting_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_UserSettingService_GetUserSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_UserSettingService_UpdateUserSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/slash.api.v2.UserSettingService/UpdateUserSetting", runtime.WithHTTPPathPattern("/api/v2/user/{id}/settins")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserSettingService_UpdateUserSetting_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_UserSettingService_UpdateUserSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_UserSettingService_GetUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"api", "v2", "user", "id", "setting"}, "")) + + pattern_UserSettingService_UpdateUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"api", "v2", "user", "id", "settins"}, "")) +) + +var ( + forward_UserSettingService_GetUserSetting_0 = runtime.ForwardResponseMessage + + forward_UserSettingService_UpdateUserSetting_0 = runtime.ForwardResponseMessage +) diff --git a/proto/gen/api/v2/user_setting_service_grpc.pb.go b/proto/gen/api/v2/user_setting_service_grpc.pb.go new file mode 100644 index 0000000..078d919 --- /dev/null +++ b/proto/gen/api/v2/user_setting_service_grpc.pb.go @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: api/v2/user_setting_service.proto + +package apiv2 + +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.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + UserSettingService_GetUserSetting_FullMethodName = "/slash.api.v2.UserSettingService/GetUserSetting" + UserSettingService_UpdateUserSetting_FullMethodName = "/slash.api.v2.UserSettingService/UpdateUserSetting" +) + +// UserSettingServiceClient is the client API for UserSettingService 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 UserSettingServiceClient interface { + // GetUserSetting returns the user setting. + GetUserSetting(ctx context.Context, in *GetUserSettingRequest, opts ...grpc.CallOption) (*GetUserSettingResponse, error) + // UpdateUserSetting updates the user setting. + UpdateUserSetting(ctx context.Context, in *UpdateUserSettingRequest, opts ...grpc.CallOption) (*UpdateUserSettingResponse, error) +} + +type userSettingServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewUserSettingServiceClient(cc grpc.ClientConnInterface) UserSettingServiceClient { + return &userSettingServiceClient{cc} +} + +func (c *userSettingServiceClient) GetUserSetting(ctx context.Context, in *GetUserSettingRequest, opts ...grpc.CallOption) (*GetUserSettingResponse, error) { + out := new(GetUserSettingResponse) + err := c.cc.Invoke(ctx, UserSettingService_GetUserSetting_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userSettingServiceClient) UpdateUserSetting(ctx context.Context, in *UpdateUserSettingRequest, opts ...grpc.CallOption) (*UpdateUserSettingResponse, error) { + out := new(UpdateUserSettingResponse) + err := c.cc.Invoke(ctx, UserSettingService_UpdateUserSetting_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// UserSettingServiceServer is the server API for UserSettingService service. +// All implementations must embed UnimplementedUserSettingServiceServer +// for forward compatibility +type UserSettingServiceServer interface { + // GetUserSetting returns the user setting. + GetUserSetting(context.Context, *GetUserSettingRequest) (*GetUserSettingResponse, error) + // UpdateUserSetting updates the user setting. + UpdateUserSetting(context.Context, *UpdateUserSettingRequest) (*UpdateUserSettingResponse, error) + mustEmbedUnimplementedUserSettingServiceServer() +} + +// UnimplementedUserSettingServiceServer must be embedded to have forward compatible implementations. +type UnimplementedUserSettingServiceServer struct { +} + +func (UnimplementedUserSettingServiceServer) GetUserSetting(context.Context, *GetUserSettingRequest) (*GetUserSettingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetUserSetting not implemented") +} +func (UnimplementedUserSettingServiceServer) UpdateUserSetting(context.Context, *UpdateUserSettingRequest) (*UpdateUserSettingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateUserSetting not implemented") +} +func (UnimplementedUserSettingServiceServer) mustEmbedUnimplementedUserSettingServiceServer() {} + +// UnsafeUserSettingServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to UserSettingServiceServer will +// result in compilation errors. +type UnsafeUserSettingServiceServer interface { + mustEmbedUnimplementedUserSettingServiceServer() +} + +func RegisterUserSettingServiceServer(s grpc.ServiceRegistrar, srv UserSettingServiceServer) { + s.RegisterService(&UserSettingService_ServiceDesc, srv) +} + +func _UserSettingService_GetUserSetting_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserSettingRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserSettingServiceServer).GetUserSetting(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserSettingService_GetUserSetting_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserSettingServiceServer).GetUserSetting(ctx, req.(*GetUserSettingRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserSettingService_UpdateUserSetting_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserSettingRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserSettingServiceServer).UpdateUserSetting(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserSettingService_UpdateUserSetting_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserSettingServiceServer).UpdateUserSetting(ctx, req.(*UpdateUserSettingRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// UserSettingService_ServiceDesc is the grpc.ServiceDesc for UserSettingService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var UserSettingService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "slash.api.v2.UserSettingService", + HandlerType: (*UserSettingServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetUserSetting", + Handler: _UserSettingService_GetUserSetting_Handler, + }, + { + MethodName: "UpdateUserSetting", + Handler: _UserSettingService_UpdateUserSetting_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api/v2/user_setting_service.proto", +}