From 3be52e7ab84141bd34021068d2eac3da3ba33ce0 Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 22 Nov 2023 19:47:23 +0800 Subject: [PATCH] chore: migrate shortcut analytics --- api/v2/shortcut_service.go | 74 +++ frontend/web/src/components/AnalyticsView.tsx | 21 +- frontend/web/src/helpers/api.ts | 4 - frontend/web/src/types/analytics.d.ts | 20 - frontend/web/src/types/common.d.ts | 13 - proto/api/v2/shortcut_service.proto | 21 + proto/gen/api/v2/README.md | 52 +++ proto/gen/api/v2/shortcut_service.pb.go | 428 ++++++++++++++---- proto/gen/api/v2/shortcut_service.pb.gw.go | 103 +++++ proto/gen/api/v2/shortcut_service_grpc.pb.go | 49 +- proto/gen/store/README.md | 19 + proto/gen/store/activity.pb.go | 118 ++++- proto/store/activity.proto | 7 + 13 files changed, 772 insertions(+), 157 deletions(-) delete mode 100644 frontend/web/src/types/analytics.d.ts delete mode 100644 frontend/web/src/types/common.d.ts diff --git a/api/v2/shortcut_service.go b/api/v2/shortcut_service.go index d4f06e0..00d37f2 100644 --- a/api/v2/shortcut_service.go +++ b/api/v2/shortcut_service.go @@ -6,7 +6,9 @@ import ( "strings" "time" + "github.com/mssola/useragent" "github.com/pkg/errors" + "golang.org/x/exp/slices" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/encoding/protojson" @@ -14,6 +16,7 @@ import ( apiv2pb "github.com/boojack/slash/proto/gen/api/v2" storepb "github.com/boojack/slash/proto/gen/store" + "github.com/boojack/slash/server/metric" "github.com/boojack/slash/store" ) @@ -218,6 +221,77 @@ func (s *APIV2Service) DeleteShortcut(ctx context.Context, request *apiv2pb.Dele return response, nil } +func (s *APIV2Service) GetShortcutAnalytics(ctx context.Context, request *apiv2pb.GetShortcutAnalyticsRequest) (*apiv2pb.GetShortcutAnalyticsResponse, error) { + shortcut, err := s.Store.GetShortcut(ctx, &store.FindShortcut{ + ID: &request.Id, + }) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get shortcut by name: %v", err) + } + if shortcut == nil { + return nil, status.Errorf(codes.NotFound, "shortcut not found") + } + + activities, err := s.Store.ListActivities(ctx, &store.FindActivity{ + Type: store.ActivityShortcutView, + Where: []string{fmt.Sprintf("json_extract(payload, '$.shortcutId') = %d", request.Id)}, + }) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get activities, err: %v", err) + } + + referenceMap := make(map[string]int32) + deviceMap := make(map[string]int32) + browserMap := make(map[string]int32) + for _, activity := range activities { + payload := &storepb.ActivityShorcutViewPayload{} + if err := protojson.Unmarshal([]byte(activity.Payload), payload); err != nil { + return nil, status.Error(codes.Internal, fmt.Sprintf("failed to unmarshal payload, err: %v", err)) + } + + if _, ok := referenceMap[payload.Referer]; !ok { + referenceMap[payload.Referer] = 0 + } + referenceMap[payload.Referer]++ + + ua := useragent.New(payload.UserAgent) + deviceName := ua.OSInfo().Name + browserName, _ := ua.Browser() + + if _, ok := deviceMap[deviceName]; !ok { + deviceMap[deviceName] = 0 + } + deviceMap[deviceName]++ + + if _, ok := browserMap[browserName]; !ok { + browserMap[browserName] = 0 + } + browserMap[browserName]++ + } + + metric.Enqueue("shortcut analytics") + response := &apiv2pb.GetShortcutAnalyticsResponse{ + References: mapToAnalyticsSlice(referenceMap), + Devices: mapToAnalyticsSlice(deviceMap), + Browsers: mapToAnalyticsSlice(browserMap), + } + return response, nil +} + +func mapToAnalyticsSlice(m map[string]int32) []*apiv2pb.GetShortcutAnalyticsResponse_AnalyticsItem { + analyticsSlice := make([]*apiv2pb.GetShortcutAnalyticsResponse_AnalyticsItem, 0) + for key, value := range m { + analyticsSlice = append(analyticsSlice, &apiv2pb.GetShortcutAnalyticsResponse_AnalyticsItem{ + Name: key, + Count: value, + }) + } + slices.SortFunc(analyticsSlice, func(i, j *apiv2pb.GetShortcutAnalyticsResponse_AnalyticsItem) int { + return int(i.Count - j.Count) + }) + return analyticsSlice +} + func (s *APIV2Service) createShortcutCreateActivity(ctx context.Context, shortcut *storepb.Shortcut) error { payload := &storepb.ActivityShorcutCreatePayload{ ShortcutId: shortcut.Id, diff --git a/frontend/web/src/components/AnalyticsView.tsx b/frontend/web/src/components/AnalyticsView.tsx index c03f062..e979c82 100644 --- a/frontend/web/src/components/AnalyticsView.tsx +++ b/frontend/web/src/components/AnalyticsView.tsx @@ -1,7 +1,8 @@ import classNames from "classnames"; import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; -import * as api from "../helpers/api"; +import { shortcutServiceClient } from "@/grpcweb"; +import { GetShortcutAnalyticsResponse } from "@/types/proto/api/v2/shortcut_service"; import Icon from "./Icon"; interface Props { @@ -12,12 +13,12 @@ interface Props { const AnalyticsView: React.FC = (props: Props) => { const { shortcutId, className } = props; const { t } = useTranslation(); - const [analytics, setAnalytics] = useState(null); + const [analytics, setAnalytics] = useState(null); const [selectedDeviceTab, setSelectedDeviceTab] = useState<"os" | "browser">("browser"); useEffect(() => { - api.getShortcutAnalytics(shortcutId).then(({ data }) => { - setAnalytics(data); + shortcutServiceClient.getShortcutAnalytics({ id: shortcutId }).then((response) => { + setAnalytics(response); }); }, []); @@ -34,13 +35,13 @@ const AnalyticsView: React.FC = (props: Props) => { {t("analytics.visitors")}
- {analytics.referenceData.length === 0 && ( + {analytics.references.length === 0 && (

No data found.

)} - {analytics.referenceData.map((reference) => ( + {analytics.references.map((reference) => (
{reference.name ? ( @@ -95,13 +96,13 @@ const AnalyticsView: React.FC = (props: Props) => { {t("analytics.visitors")}
- {analytics.browserData.length === 0 && ( + {analytics.browsers.length === 0 && (

No data found.

)} - {analytics.browserData.map((reference) => ( + {analytics.browsers.map((reference) => (
{reference.name || "Unknown"} @@ -118,13 +119,13 @@ const AnalyticsView: React.FC = (props: Props) => { {t("analytics.visitors")}
- {analytics.deviceData.length === 0 && ( + {analytics.devices.length === 0 && (

No data found.

)} - {analytics.deviceData.map((device) => ( + {analytics.devices.map((device) => (
{device.name || "Unknown"} {device.count} diff --git a/frontend/web/src/helpers/api.ts b/frontend/web/src/helpers/api.ts index 035f199..ca97b20 100644 --- a/frontend/web/src/helpers/api.ts +++ b/frontend/web/src/helpers/api.ts @@ -18,7 +18,3 @@ export function signup(email: string, nickname: string, password: string) { export function signout() { return axios.post("/api/v1/auth/logout"); } - -export function getShortcutAnalytics(shortcutId: number) { - return axios.get(`/api/v1/shortcut/${shortcutId}/analytics`); -} diff --git a/frontend/web/src/types/analytics.d.ts b/frontend/web/src/types/analytics.d.ts deleted file mode 100644 index 3b1b0f7..0000000 --- a/frontend/web/src/types/analytics.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -interface ReferenceInfo { - name: string; - count: number; -} - -interface DeviceInfo { - name: string; - count: number; -} - -interface BrowserInfo { - name: string; - count: number; -} - -interface AnalysisData { - referenceData: ReferenceInfo[]; - deviceData: DeviceInfo[]; - browserData: BrowserInfo[]; -} diff --git a/frontend/web/src/types/common.d.ts b/frontend/web/src/types/common.d.ts deleted file mode 100644 index 9126342..0000000 --- a/frontend/web/src/types/common.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -type BasicType = undefined | null | boolean | number | string | Record | Array; - -type DateStamp = number; - -type TimeStamp = number; - -type FunctionType = (...args: unknown[]) => unknown; - -interface KVObject { - [key: string]: T; -} - -type Option = T | undefined; diff --git a/proto/api/v2/shortcut_service.proto b/proto/api/v2/shortcut_service.proto index 146ff45..010b820 100644 --- a/proto/api/v2/shortcut_service.proto +++ b/proto/api/v2/shortcut_service.proto @@ -40,6 +40,11 @@ service ShortcutService { option (google.api.http) = {delete: "/api/v2/shortcuts/{id}"}; option (google.api.method_signature) = "id"; } + // GetShortcutAnalytics returns the analytics for a shortcut. + rpc GetShortcutAnalytics(GetShortcutAnalyticsRequest) returns (GetShortcutAnalyticsResponse) { + option (google.api.http) = {get: "/api/v2/shortcuts/{id}/analytics"}; + option (google.api.method_signature) = "id"; + } } message Shortcut { @@ -115,3 +120,19 @@ message DeleteShortcutRequest { } message DeleteShortcutResponse {} + +message GetShortcutAnalyticsRequest { + int32 id = 1; +} + +message GetShortcutAnalyticsResponse { + message AnalyticsItem { + string name = 1; + int32 count = 2; + } + repeated AnalyticsItem references = 1; + + repeated AnalyticsItem devices = 2; + + repeated AnalyticsItem browsers = 3; +} diff --git a/proto/gen/api/v2/README.md b/proto/gen/api/v2/README.md index 30a79e7..5d38c6c 100644 --- a/proto/gen/api/v2/README.md +++ b/proto/gen/api/v2/README.md @@ -29,6 +29,9 @@ - [CreateShortcutResponse](#slash-api-v2-CreateShortcutResponse) - [DeleteShortcutRequest](#slash-api-v2-DeleteShortcutRequest) - [DeleteShortcutResponse](#slash-api-v2-DeleteShortcutResponse) + - [GetShortcutAnalyticsRequest](#slash-api-v2-GetShortcutAnalyticsRequest) + - [GetShortcutAnalyticsResponse](#slash-api-v2-GetShortcutAnalyticsResponse) + - [GetShortcutAnalyticsResponse.AnalyticsItem](#slash-api-v2-GetShortcutAnalyticsResponse-AnalyticsItem) - [GetShortcutRequest](#slash-api-v2-GetShortcutRequest) - [GetShortcutResponse](#slash-api-v2-GetShortcutResponse) - [ListShortcutsRequest](#slash-api-v2-ListShortcutsRequest) @@ -434,6 +437,54 @@ + + +### GetShortcutAnalyticsRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int32](#int32) | | | + + + + + + + + +### GetShortcutAnalyticsResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| references | [GetShortcutAnalyticsResponse.AnalyticsItem](#slash-api-v2-GetShortcutAnalyticsResponse-AnalyticsItem) | repeated | | +| devices | [GetShortcutAnalyticsResponse.AnalyticsItem](#slash-api-v2-GetShortcutAnalyticsResponse-AnalyticsItem) | repeated | | +| browsers | [GetShortcutAnalyticsResponse.AnalyticsItem](#slash-api-v2-GetShortcutAnalyticsResponse-AnalyticsItem) | repeated | | + + + + + + + + +### GetShortcutAnalyticsResponse.AnalyticsItem + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| name | [string](#string) | | | +| count | [int32](#int32) | | | + + + + + + ### GetShortcutRequest @@ -582,6 +633,7 @@ | CreateShortcut | [CreateShortcutRequest](#slash-api-v2-CreateShortcutRequest) | [CreateShortcutResponse](#slash-api-v2-CreateShortcutResponse) | CreateShortcut creates a shortcut. | | UpdateShortcut | [UpdateShortcutRequest](#slash-api-v2-UpdateShortcutRequest) | [UpdateShortcutResponse](#slash-api-v2-UpdateShortcutResponse) | UpdateShortcut updates a shortcut. | | DeleteShortcut | [DeleteShortcutRequest](#slash-api-v2-DeleteShortcutRequest) | [DeleteShortcutResponse](#slash-api-v2-DeleteShortcutResponse) | DeleteShortcut deletes a shortcut by id. | +| GetShortcutAnalytics | [GetShortcutAnalyticsRequest](#slash-api-v2-GetShortcutAnalyticsRequest) | [GetShortcutAnalyticsResponse](#slash-api-v2-GetShortcutAnalyticsResponse) | GetShortcutAnalytics returns the analytics for a shortcut. | diff --git a/proto/gen/api/v2/shortcut_service.pb.go b/proto/gen/api/v2/shortcut_service.pb.go index a4f3c26..83a1240 100644 --- a/proto/gen/api/v2/shortcut_service.pb.go +++ b/proto/gen/api/v2/shortcut_service.pb.go @@ -689,6 +689,171 @@ func (*DeleteShortcutResponse) Descriptor() ([]byte, []int) { return file_api_v2_shortcut_service_proto_rawDescGZIP(), []int{11} } +type GetShortcutAnalyticsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetShortcutAnalyticsRequest) Reset() { + *x = GetShortcutAnalyticsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_shortcut_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetShortcutAnalyticsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetShortcutAnalyticsRequest) ProtoMessage() {} + +func (x *GetShortcutAnalyticsRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_shortcut_service_proto_msgTypes[12] + 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 GetShortcutAnalyticsRequest.ProtoReflect.Descriptor instead. +func (*GetShortcutAnalyticsRequest) Descriptor() ([]byte, []int) { + return file_api_v2_shortcut_service_proto_rawDescGZIP(), []int{12} +} + +func (x *GetShortcutAnalyticsRequest) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +type GetShortcutAnalyticsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + References []*GetShortcutAnalyticsResponse_AnalyticsItem `protobuf:"bytes,1,rep,name=references,proto3" json:"references,omitempty"` + Devices []*GetShortcutAnalyticsResponse_AnalyticsItem `protobuf:"bytes,2,rep,name=devices,proto3" json:"devices,omitempty"` + Browsers []*GetShortcutAnalyticsResponse_AnalyticsItem `protobuf:"bytes,3,rep,name=browsers,proto3" json:"browsers,omitempty"` +} + +func (x *GetShortcutAnalyticsResponse) Reset() { + *x = GetShortcutAnalyticsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_shortcut_service_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetShortcutAnalyticsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetShortcutAnalyticsResponse) ProtoMessage() {} + +func (x *GetShortcutAnalyticsResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_shortcut_service_proto_msgTypes[13] + 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 GetShortcutAnalyticsResponse.ProtoReflect.Descriptor instead. +func (*GetShortcutAnalyticsResponse) Descriptor() ([]byte, []int) { + return file_api_v2_shortcut_service_proto_rawDescGZIP(), []int{13} +} + +func (x *GetShortcutAnalyticsResponse) GetReferences() []*GetShortcutAnalyticsResponse_AnalyticsItem { + if x != nil { + return x.References + } + return nil +} + +func (x *GetShortcutAnalyticsResponse) GetDevices() []*GetShortcutAnalyticsResponse_AnalyticsItem { + if x != nil { + return x.Devices + } + return nil +} + +func (x *GetShortcutAnalyticsResponse) GetBrowsers() []*GetShortcutAnalyticsResponse_AnalyticsItem { + if x != nil { + return x.Browsers + } + return nil +} + +type GetShortcutAnalyticsResponse_AnalyticsItem struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Count int32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` +} + +func (x *GetShortcutAnalyticsResponse_AnalyticsItem) Reset() { + *x = GetShortcutAnalyticsResponse_AnalyticsItem{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_shortcut_service_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetShortcutAnalyticsResponse_AnalyticsItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetShortcutAnalyticsResponse_AnalyticsItem) ProtoMessage() {} + +func (x *GetShortcutAnalyticsResponse_AnalyticsItem) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_shortcut_service_proto_msgTypes[14] + 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 GetShortcutAnalyticsResponse_AnalyticsItem.ProtoReflect.Descriptor instead. +func (*GetShortcutAnalyticsResponse_AnalyticsItem) Descriptor() ([]byte, []int) { + return file_api_v2_shortcut_service_proto_rawDescGZIP(), []int{13, 0} +} + +func (x *GetShortcutAnalyticsResponse_AnalyticsItem) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GetShortcutAnalyticsResponse_AnalyticsItem) GetCount() int32 { + if x != nil { + return x.Count + } + return 0 +} + var File_api_v2_shortcut_service_proto protoreflect.FileDescriptor var file_api_v2_shortcut_service_proto_rawDesc = []byte{ @@ -782,62 +947,97 @@ var file_api_v2_shortcut_service_proto_rawDesc = []byte{ 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x18, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, - 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, - 0xad, 0x05, 0x0a, 0x0f, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x12, 0x73, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, - 0x63, 0x75, 0x74, 0x73, 0x12, 0x22, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x6f, 0x72, - 0x74, 0x63, 0x75, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x73, - 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x73, 0x12, 0x77, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x53, - 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x12, 0x20, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, - 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x73, 0x6c, 0x61, 0x73, - 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x6f, 0x72, - 0x74, 0x63, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, 0xda, 0x41, - 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x76, 0x32, 0x2f, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, - 0x7d, 0x12, 0x80, 0x01, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x68, 0x6f, 0x72, - 0x74, 0x63, 0x75, 0x74, 0x12, 0x23, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, - 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x73, 0x6c, 0x61, 0x73, - 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x3a, 0x08, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, - 0x74, 0x22, 0x11, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x68, 0x6f, 0x72, 0x74, - 0x63, 0x75, 0x74, 0x73, 0x12, 0xa5, 0x01, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, - 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x12, 0x23, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x68, 0x6f, - 0x72, 0x74, 0x63, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x73, - 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x48, 0xda, 0x41, 0x14, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x2c, - 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x2b, 0x3a, 0x08, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x1a, 0x1f, 0x2f, 0x61, 0x70, + 0x2d, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x41, 0x6e, + 0x61, 0x6c, 0x79, 0x74, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0xdd, + 0x02, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x41, 0x6e, + 0x61, 0x6c, 0x79, 0x74, 0x69, 0x63, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x58, 0x0a, 0x0a, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x41, 0x6e, + 0x61, 0x6c, 0x79, 0x74, 0x69, 0x63, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, + 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x74, 0x69, 0x63, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x0a, 0x72, + 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x52, 0x0a, 0x07, 0x64, 0x65, 0x76, + 0x69, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x73, 0x6c, 0x61, + 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x6f, + 0x72, 0x74, 0x63, 0x75, 0x74, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x74, 0x69, 0x63, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x74, 0x69, 0x63, 0x73, + 0x49, 0x74, 0x65, 0x6d, 0x52, 0x07, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x54, 0x0a, + 0x08, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x38, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, + 0x65, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x74, + 0x69, 0x63, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x41, 0x6e, 0x61, 0x6c, + 0x79, 0x74, 0x69, 0x63, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x08, 0x62, 0x72, 0x6f, 0x77, 0x73, + 0x65, 0x72, 0x73, 0x1a, 0x39, 0x0a, 0x0d, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x74, 0x69, 0x63, 0x73, + 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x32, 0xcc, + 0x06, 0x0a, 0x0f, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x73, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, + 0x75, 0x74, 0x73, 0x12, 0x22, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, + 0x63, 0x75, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x68, + 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x73, 0x12, 0x77, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x53, 0x68, + 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x12, 0x20, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, + 0x63, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, 0xda, 0x41, 0x02, + 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x32, 0x2f, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, + 0x12, 0x80, 0x01, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x68, 0x6f, 0x72, 0x74, + 0x63, 0x75, 0x74, 0x12, 0x23, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x68, + 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x3a, 0x08, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, + 0x22, 0x11, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x63, + 0x75, 0x74, 0x73, 0x12, 0xa5, 0x01, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x68, + 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x12, 0x23, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x68, 0x6f, 0x72, + 0x74, 0x63, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x73, 0x6c, + 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x48, 0xda, 0x41, 0x14, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x2c, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, + 0x3a, 0x08, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x1a, 0x1f, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x73, 0x2f, 0x7b, 0x73, + 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x2e, 0x69, 0x64, 0x7d, 0x12, 0x80, 0x01, 0x0a, 0x0e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x12, 0x23, + 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, 0xda, 0x41, 0x02, 0x69, 0x64, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, + 0x73, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x9c, + 0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x41, 0x6e, + 0x61, 0x6c, 0x79, 0x74, 0x69, 0x63, 0x73, 0x12, 0x29, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, + 0x75, 0x74, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x74, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x41, 0x6e, 0x61, + 0x6c, 0x79, 0x74, 0x69, 0x63, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, + 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x73, 0x2f, 0x7b, - 0x73, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x2e, 0x69, 0x64, 0x7d, 0x12, 0x80, 0x01, 0x0a, - 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x12, - 0x23, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, - 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, 0xda, 0x41, 0x02, 0x69, - 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, - 0x2f, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x42, - 0xab, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x42, 0x14, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 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, + 0x69, 0x64, 0x7d, 0x2f, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x74, 0x69, 0x63, 0x73, 0x42, 0xab, 0x01, + 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x42, 0x14, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 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 ( @@ -852,53 +1052,61 @@ func file_api_v2_shortcut_service_proto_rawDescGZIP() []byte { return file_api_v2_shortcut_service_proto_rawDescData } -var file_api_v2_shortcut_service_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_api_v2_shortcut_service_proto_msgTypes = make([]protoimpl.MessageInfo, 15) var file_api_v2_shortcut_service_proto_goTypes = []interface{}{ - (*Shortcut)(nil), // 0: slash.api.v2.Shortcut - (*OpenGraphMetadata)(nil), // 1: slash.api.v2.OpenGraphMetadata - (*ListShortcutsRequest)(nil), // 2: slash.api.v2.ListShortcutsRequest - (*ListShortcutsResponse)(nil), // 3: slash.api.v2.ListShortcutsResponse - (*GetShortcutRequest)(nil), // 4: slash.api.v2.GetShortcutRequest - (*GetShortcutResponse)(nil), // 5: slash.api.v2.GetShortcutResponse - (*CreateShortcutRequest)(nil), // 6: slash.api.v2.CreateShortcutRequest - (*CreateShortcutResponse)(nil), // 7: slash.api.v2.CreateShortcutResponse - (*UpdateShortcutRequest)(nil), // 8: slash.api.v2.UpdateShortcutRequest - (*UpdateShortcutResponse)(nil), // 9: slash.api.v2.UpdateShortcutResponse - (*DeleteShortcutRequest)(nil), // 10: slash.api.v2.DeleteShortcutRequest - (*DeleteShortcutResponse)(nil), // 11: slash.api.v2.DeleteShortcutResponse - (*timestamppb.Timestamp)(nil), // 12: google.protobuf.Timestamp - (RowStatus)(0), // 13: slash.api.v2.RowStatus - (Visibility)(0), // 14: slash.api.v2.Visibility - (*fieldmaskpb.FieldMask)(nil), // 15: google.protobuf.FieldMask + (*Shortcut)(nil), // 0: slash.api.v2.Shortcut + (*OpenGraphMetadata)(nil), // 1: slash.api.v2.OpenGraphMetadata + (*ListShortcutsRequest)(nil), // 2: slash.api.v2.ListShortcutsRequest + (*ListShortcutsResponse)(nil), // 3: slash.api.v2.ListShortcutsResponse + (*GetShortcutRequest)(nil), // 4: slash.api.v2.GetShortcutRequest + (*GetShortcutResponse)(nil), // 5: slash.api.v2.GetShortcutResponse + (*CreateShortcutRequest)(nil), // 6: slash.api.v2.CreateShortcutRequest + (*CreateShortcutResponse)(nil), // 7: slash.api.v2.CreateShortcutResponse + (*UpdateShortcutRequest)(nil), // 8: slash.api.v2.UpdateShortcutRequest + (*UpdateShortcutResponse)(nil), // 9: slash.api.v2.UpdateShortcutResponse + (*DeleteShortcutRequest)(nil), // 10: slash.api.v2.DeleteShortcutRequest + (*DeleteShortcutResponse)(nil), // 11: slash.api.v2.DeleteShortcutResponse + (*GetShortcutAnalyticsRequest)(nil), // 12: slash.api.v2.GetShortcutAnalyticsRequest + (*GetShortcutAnalyticsResponse)(nil), // 13: slash.api.v2.GetShortcutAnalyticsResponse + (*GetShortcutAnalyticsResponse_AnalyticsItem)(nil), // 14: slash.api.v2.GetShortcutAnalyticsResponse.AnalyticsItem + (*timestamppb.Timestamp)(nil), // 15: google.protobuf.Timestamp + (RowStatus)(0), // 16: slash.api.v2.RowStatus + (Visibility)(0), // 17: slash.api.v2.Visibility + (*fieldmaskpb.FieldMask)(nil), // 18: google.protobuf.FieldMask } var file_api_v2_shortcut_service_proto_depIdxs = []int32{ - 12, // 0: slash.api.v2.Shortcut.created_time:type_name -> google.protobuf.Timestamp - 12, // 1: slash.api.v2.Shortcut.updated_time:type_name -> google.protobuf.Timestamp - 13, // 2: slash.api.v2.Shortcut.row_status:type_name -> slash.api.v2.RowStatus - 14, // 3: slash.api.v2.Shortcut.visibility:type_name -> slash.api.v2.Visibility + 15, // 0: slash.api.v2.Shortcut.created_time:type_name -> google.protobuf.Timestamp + 15, // 1: slash.api.v2.Shortcut.updated_time:type_name -> google.protobuf.Timestamp + 16, // 2: slash.api.v2.Shortcut.row_status:type_name -> slash.api.v2.RowStatus + 17, // 3: slash.api.v2.Shortcut.visibility:type_name -> slash.api.v2.Visibility 1, // 4: slash.api.v2.Shortcut.og_metadata:type_name -> slash.api.v2.OpenGraphMetadata 0, // 5: slash.api.v2.ListShortcutsResponse.shortcuts:type_name -> slash.api.v2.Shortcut 0, // 6: slash.api.v2.GetShortcutResponse.shortcut:type_name -> slash.api.v2.Shortcut 0, // 7: slash.api.v2.CreateShortcutRequest.shortcut:type_name -> slash.api.v2.Shortcut 0, // 8: slash.api.v2.CreateShortcutResponse.shortcut:type_name -> slash.api.v2.Shortcut 0, // 9: slash.api.v2.UpdateShortcutRequest.shortcut:type_name -> slash.api.v2.Shortcut - 15, // 10: slash.api.v2.UpdateShortcutRequest.update_mask:type_name -> google.protobuf.FieldMask + 18, // 10: slash.api.v2.UpdateShortcutRequest.update_mask:type_name -> google.protobuf.FieldMask 0, // 11: slash.api.v2.UpdateShortcutResponse.shortcut:type_name -> slash.api.v2.Shortcut - 2, // 12: slash.api.v2.ShortcutService.ListShortcuts:input_type -> slash.api.v2.ListShortcutsRequest - 4, // 13: slash.api.v2.ShortcutService.GetShortcut:input_type -> slash.api.v2.GetShortcutRequest - 6, // 14: slash.api.v2.ShortcutService.CreateShortcut:input_type -> slash.api.v2.CreateShortcutRequest - 8, // 15: slash.api.v2.ShortcutService.UpdateShortcut:input_type -> slash.api.v2.UpdateShortcutRequest - 10, // 16: slash.api.v2.ShortcutService.DeleteShortcut:input_type -> slash.api.v2.DeleteShortcutRequest - 3, // 17: slash.api.v2.ShortcutService.ListShortcuts:output_type -> slash.api.v2.ListShortcutsResponse - 5, // 18: slash.api.v2.ShortcutService.GetShortcut:output_type -> slash.api.v2.GetShortcutResponse - 7, // 19: slash.api.v2.ShortcutService.CreateShortcut:output_type -> slash.api.v2.CreateShortcutResponse - 9, // 20: slash.api.v2.ShortcutService.UpdateShortcut:output_type -> slash.api.v2.UpdateShortcutResponse - 11, // 21: slash.api.v2.ShortcutService.DeleteShortcut:output_type -> slash.api.v2.DeleteShortcutResponse - 17, // [17:22] is the sub-list for method output_type - 12, // [12:17] is the sub-list for method input_type - 12, // [12:12] is the sub-list for extension type_name - 12, // [12:12] is the sub-list for extension extendee - 0, // [0:12] is the sub-list for field type_name + 14, // 12: slash.api.v2.GetShortcutAnalyticsResponse.references:type_name -> slash.api.v2.GetShortcutAnalyticsResponse.AnalyticsItem + 14, // 13: slash.api.v2.GetShortcutAnalyticsResponse.devices:type_name -> slash.api.v2.GetShortcutAnalyticsResponse.AnalyticsItem + 14, // 14: slash.api.v2.GetShortcutAnalyticsResponse.browsers:type_name -> slash.api.v2.GetShortcutAnalyticsResponse.AnalyticsItem + 2, // 15: slash.api.v2.ShortcutService.ListShortcuts:input_type -> slash.api.v2.ListShortcutsRequest + 4, // 16: slash.api.v2.ShortcutService.GetShortcut:input_type -> slash.api.v2.GetShortcutRequest + 6, // 17: slash.api.v2.ShortcutService.CreateShortcut:input_type -> slash.api.v2.CreateShortcutRequest + 8, // 18: slash.api.v2.ShortcutService.UpdateShortcut:input_type -> slash.api.v2.UpdateShortcutRequest + 10, // 19: slash.api.v2.ShortcutService.DeleteShortcut:input_type -> slash.api.v2.DeleteShortcutRequest + 12, // 20: slash.api.v2.ShortcutService.GetShortcutAnalytics:input_type -> slash.api.v2.GetShortcutAnalyticsRequest + 3, // 21: slash.api.v2.ShortcutService.ListShortcuts:output_type -> slash.api.v2.ListShortcutsResponse + 5, // 22: slash.api.v2.ShortcutService.GetShortcut:output_type -> slash.api.v2.GetShortcutResponse + 7, // 23: slash.api.v2.ShortcutService.CreateShortcut:output_type -> slash.api.v2.CreateShortcutResponse + 9, // 24: slash.api.v2.ShortcutService.UpdateShortcut:output_type -> slash.api.v2.UpdateShortcutResponse + 11, // 25: slash.api.v2.ShortcutService.DeleteShortcut:output_type -> slash.api.v2.DeleteShortcutResponse + 13, // 26: slash.api.v2.ShortcutService.GetShortcutAnalytics:output_type -> slash.api.v2.GetShortcutAnalyticsResponse + 21, // [21:27] is the sub-list for method output_type + 15, // [15:21] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name } func init() { file_api_v2_shortcut_service_proto_init() } @@ -1052,6 +1260,42 @@ func file_api_v2_shortcut_service_proto_init() { return nil } } + file_api_v2_shortcut_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetShortcutAnalyticsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_shortcut_service_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetShortcutAnalyticsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_shortcut_service_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetShortcutAnalyticsResponse_AnalyticsItem); 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{ @@ -1059,7 +1303,7 @@ func file_api_v2_shortcut_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_api_v2_shortcut_service_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 15, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/gen/api/v2/shortcut_service.pb.gw.go b/proto/gen/api/v2/shortcut_service.pb.gw.go index 257817a..82ab319 100644 --- a/proto/gen/api/v2/shortcut_service.pb.gw.go +++ b/proto/gen/api/v2/shortcut_service.pb.gw.go @@ -273,6 +273,58 @@ func local_request_ShortcutService_DeleteShortcut_0(ctx context.Context, marshal } +func request_ShortcutService_GetShortcutAnalytics_0(ctx context.Context, marshaler runtime.Marshaler, client ShortcutServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetShortcutAnalyticsRequest + 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.GetShortcutAnalytics(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ShortcutService_GetShortcutAnalytics_0(ctx context.Context, marshaler runtime.Marshaler, server ShortcutServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetShortcutAnalyticsRequest + 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.GetShortcutAnalytics(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterShortcutServiceHandlerServer registers the http handlers for service ShortcutService to "mux". // UnaryRPC :call ShortcutServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -404,6 +456,31 @@ func RegisterShortcutServiceHandlerServer(ctx context.Context, mux *runtime.Serv }) + mux.Handle("GET", pattern_ShortcutService_GetShortcutAnalytics_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.ShortcutService/GetShortcutAnalytics", runtime.WithHTTPPathPattern("/api/v2/shortcuts/{id}/analytics")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ShortcutService_GetShortcutAnalytics_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_ShortcutService_GetShortcutAnalytics_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -555,6 +632,28 @@ func RegisterShortcutServiceHandlerClient(ctx context.Context, mux *runtime.Serv }) + mux.Handle("GET", pattern_ShortcutService_GetShortcutAnalytics_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.ShortcutService/GetShortcutAnalytics", runtime.WithHTTPPathPattern("/api/v2/shortcuts/{id}/analytics")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ShortcutService_GetShortcutAnalytics_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_ShortcutService_GetShortcutAnalytics_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -568,6 +667,8 @@ var ( pattern_ShortcutService_UpdateShortcut_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v2", "shortcuts", "shortcut.id"}, "")) pattern_ShortcutService_DeleteShortcut_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v2", "shortcuts", "id"}, "")) + + pattern_ShortcutService_GetShortcutAnalytics_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"api", "v2", "shortcuts", "id", "analytics"}, "")) ) var ( @@ -580,4 +681,6 @@ var ( forward_ShortcutService_UpdateShortcut_0 = runtime.ForwardResponseMessage forward_ShortcutService_DeleteShortcut_0 = runtime.ForwardResponseMessage + + forward_ShortcutService_GetShortcutAnalytics_0 = runtime.ForwardResponseMessage ) diff --git a/proto/gen/api/v2/shortcut_service_grpc.pb.go b/proto/gen/api/v2/shortcut_service_grpc.pb.go index 57da759..83ff16e 100644 --- a/proto/gen/api/v2/shortcut_service_grpc.pb.go +++ b/proto/gen/api/v2/shortcut_service_grpc.pb.go @@ -19,11 +19,12 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - ShortcutService_ListShortcuts_FullMethodName = "/slash.api.v2.ShortcutService/ListShortcuts" - ShortcutService_GetShortcut_FullMethodName = "/slash.api.v2.ShortcutService/GetShortcut" - ShortcutService_CreateShortcut_FullMethodName = "/slash.api.v2.ShortcutService/CreateShortcut" - ShortcutService_UpdateShortcut_FullMethodName = "/slash.api.v2.ShortcutService/UpdateShortcut" - ShortcutService_DeleteShortcut_FullMethodName = "/slash.api.v2.ShortcutService/DeleteShortcut" + ShortcutService_ListShortcuts_FullMethodName = "/slash.api.v2.ShortcutService/ListShortcuts" + ShortcutService_GetShortcut_FullMethodName = "/slash.api.v2.ShortcutService/GetShortcut" + ShortcutService_CreateShortcut_FullMethodName = "/slash.api.v2.ShortcutService/CreateShortcut" + ShortcutService_UpdateShortcut_FullMethodName = "/slash.api.v2.ShortcutService/UpdateShortcut" + ShortcutService_DeleteShortcut_FullMethodName = "/slash.api.v2.ShortcutService/DeleteShortcut" + ShortcutService_GetShortcutAnalytics_FullMethodName = "/slash.api.v2.ShortcutService/GetShortcutAnalytics" ) // ShortcutServiceClient is the client API for ShortcutService service. @@ -40,6 +41,8 @@ type ShortcutServiceClient interface { UpdateShortcut(ctx context.Context, in *UpdateShortcutRequest, opts ...grpc.CallOption) (*UpdateShortcutResponse, error) // DeleteShortcut deletes a shortcut by id. DeleteShortcut(ctx context.Context, in *DeleteShortcutRequest, opts ...grpc.CallOption) (*DeleteShortcutResponse, error) + // GetShortcutAnalytics returns the analytics for a shortcut. + GetShortcutAnalytics(ctx context.Context, in *GetShortcutAnalyticsRequest, opts ...grpc.CallOption) (*GetShortcutAnalyticsResponse, error) } type shortcutServiceClient struct { @@ -95,6 +98,15 @@ func (c *shortcutServiceClient) DeleteShortcut(ctx context.Context, in *DeleteSh return out, nil } +func (c *shortcutServiceClient) GetShortcutAnalytics(ctx context.Context, in *GetShortcutAnalyticsRequest, opts ...grpc.CallOption) (*GetShortcutAnalyticsResponse, error) { + out := new(GetShortcutAnalyticsResponse) + err := c.cc.Invoke(ctx, ShortcutService_GetShortcutAnalytics_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ShortcutServiceServer is the server API for ShortcutService service. // All implementations must embed UnimplementedShortcutServiceServer // for forward compatibility @@ -109,6 +121,8 @@ type ShortcutServiceServer interface { UpdateShortcut(context.Context, *UpdateShortcutRequest) (*UpdateShortcutResponse, error) // DeleteShortcut deletes a shortcut by id. DeleteShortcut(context.Context, *DeleteShortcutRequest) (*DeleteShortcutResponse, error) + // GetShortcutAnalytics returns the analytics for a shortcut. + GetShortcutAnalytics(context.Context, *GetShortcutAnalyticsRequest) (*GetShortcutAnalyticsResponse, error) mustEmbedUnimplementedShortcutServiceServer() } @@ -131,6 +145,9 @@ func (UnimplementedShortcutServiceServer) UpdateShortcut(context.Context, *Updat func (UnimplementedShortcutServiceServer) DeleteShortcut(context.Context, *DeleteShortcutRequest) (*DeleteShortcutResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DeleteShortcut not implemented") } +func (UnimplementedShortcutServiceServer) GetShortcutAnalytics(context.Context, *GetShortcutAnalyticsRequest) (*GetShortcutAnalyticsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetShortcutAnalytics not implemented") +} func (UnimplementedShortcutServiceServer) mustEmbedUnimplementedShortcutServiceServer() {} // UnsafeShortcutServiceServer may be embedded to opt out of forward compatibility for this service. @@ -234,6 +251,24 @@ func _ShortcutService_DeleteShortcut_Handler(srv interface{}, ctx context.Contex return interceptor(ctx, in, info, handler) } +func _ShortcutService_GetShortcutAnalytics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetShortcutAnalyticsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ShortcutServiceServer).GetShortcutAnalytics(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ShortcutService_GetShortcutAnalytics_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ShortcutServiceServer).GetShortcutAnalytics(ctx, req.(*GetShortcutAnalyticsRequest)) + } + return interceptor(ctx, in, info, handler) +} + // ShortcutService_ServiceDesc is the grpc.ServiceDesc for ShortcutService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -261,6 +296,10 @@ var ShortcutService_ServiceDesc = grpc.ServiceDesc{ MethodName: "DeleteShortcut", Handler: _ShortcutService_DeleteShortcut_Handler, }, + { + MethodName: "GetShortcutAnalytics", + Handler: _ShortcutService_GetShortcutAnalytics_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "api/v2/shortcut_service.proto", diff --git a/proto/gen/store/README.md b/proto/gen/store/README.md index 93ab1f7..8ea64d4 100644 --- a/proto/gen/store/README.md +++ b/proto/gen/store/README.md @@ -5,6 +5,7 @@ - [store/activity.proto](#store_activity-proto) - [ActivityShorcutCreatePayload](#slash-store-ActivityShorcutCreatePayload) + - [ActivityShorcutViewPayload](#slash-store-ActivityShorcutViewPayload) - [store/common.proto](#store_common-proto) - [RowStatus](#slash-store-RowStatus) @@ -57,6 +58,24 @@ + + + +### ActivityShorcutViewPayload + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| shortcut_id | [int32](#int32) | | | +| ip | [string](#string) | | | +| referer | [string](#string) | | | +| user_agent | [string](#string) | | | + + + + + diff --git a/proto/gen/store/activity.pb.go b/proto/gen/store/activity.pb.go index 4f6abf9..0c0a27b 100644 --- a/proto/gen/store/activity.pb.go +++ b/proto/gen/store/activity.pb.go @@ -67,6 +67,77 @@ func (x *ActivityShorcutCreatePayload) GetShortcutId() int32 { return 0 } +type ActivityShorcutViewPayload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ShortcutId int32 `protobuf:"varint,1,opt,name=shortcut_id,json=shortcutId,proto3" json:"shortcut_id,omitempty"` + Ip string `protobuf:"bytes,2,opt,name=ip,proto3" json:"ip,omitempty"` + Referer string `protobuf:"bytes,3,opt,name=referer,proto3" json:"referer,omitempty"` + UserAgent string `protobuf:"bytes,4,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"` +} + +func (x *ActivityShorcutViewPayload) Reset() { + *x = ActivityShorcutViewPayload{} + if protoimpl.UnsafeEnabled { + mi := &file_store_activity_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ActivityShorcutViewPayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ActivityShorcutViewPayload) ProtoMessage() {} + +func (x *ActivityShorcutViewPayload) ProtoReflect() protoreflect.Message { + mi := &file_store_activity_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 ActivityShorcutViewPayload.ProtoReflect.Descriptor instead. +func (*ActivityShorcutViewPayload) Descriptor() ([]byte, []int) { + return file_store_activity_proto_rawDescGZIP(), []int{1} +} + +func (x *ActivityShorcutViewPayload) GetShortcutId() int32 { + if x != nil { + return x.ShortcutId + } + return 0 +} + +func (x *ActivityShorcutViewPayload) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +func (x *ActivityShorcutViewPayload) GetReferer() string { + if x != nil { + return x.Referer + } + return "" +} + +func (x *ActivityShorcutViewPayload) GetUserAgent() string { + if x != nil { + return x.UserAgent + } + return "" +} + var File_store_activity_proto protoreflect.FileDescriptor var file_store_activity_proto_rawDesc = []byte{ @@ -76,17 +147,25 @@ var file_store_activity_proto_rawDesc = []byte{ 0x68, 0x6f, 0x72, 0x63, 0x75, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x63, - 0x75, 0x74, 0x49, 0x64, 0x42, 0x97, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61, - 0x73, 0x68, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x0d, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, - 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 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, 0x73, 0x74, - 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, 0x53, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x53, 0x6c, 0x61, 0x73, - 0x68, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, - 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x53, 0x74, - 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x74, 0x49, 0x64, 0x22, 0x86, 0x01, 0x0a, 0x1a, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, + 0x79, 0x53, 0x68, 0x6f, 0x72, 0x63, 0x75, 0x74, 0x56, 0x69, 0x65, 0x77, 0x50, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x63, + 0x75, 0x74, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x72, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x72, 0x12, 0x1d, + 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x75, 0x73, 0x65, 0x72, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x42, 0x97, 0x01, + 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x73, 0x74, 0x6f, 0x72, + 0x65, 0x42, 0x0d, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x28, 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, 0x73, 0x74, 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, 0x53, + 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, + 0xca, 0x02, 0x0b, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, 0x02, + 0x17, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, + 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -101,9 +180,10 @@ func file_store_activity_proto_rawDescGZIP() []byte { return file_store_activity_proto_rawDescData } -var file_store_activity_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_store_activity_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_store_activity_proto_goTypes = []interface{}{ (*ActivityShorcutCreatePayload)(nil), // 0: slash.store.ActivityShorcutCreatePayload + (*ActivityShorcutViewPayload)(nil), // 1: slash.store.ActivityShorcutViewPayload } var file_store_activity_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type @@ -131,6 +211,18 @@ func file_store_activity_proto_init() { return nil } } + file_store_activity_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ActivityShorcutViewPayload); 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{ @@ -138,7 +230,7 @@ func file_store_activity_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_store_activity_proto_rawDesc, NumEnums: 0, - NumMessages: 1, + NumMessages: 2, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/store/activity.proto b/proto/store/activity.proto index 0039d22..ee8d849 100644 --- a/proto/store/activity.proto +++ b/proto/store/activity.proto @@ -7,3 +7,10 @@ option go_package = "gen/store"; message ActivityShorcutCreatePayload { int32 shortcut_id = 1; } + +message ActivityShorcutViewPayload { + int32 shortcut_id = 1; + string ip = 2; + string referer = 3; + string user_agent = 4; +}