feat(components): following retrieval api

master
Xeronith 2022-12-12 19:46:43 +03:30
rodzic e2eceffeb4
commit 66c386942d
17 zmienionych plików z 451 dodań i 14 usunięć

Wyświetl plik

@ -18,6 +18,7 @@ func (factory *httpHandlerFactory) Handlers() []IHttpHandler {
FollowActorHandler(), // │ G . /u/:username/follow
AuthorizeInteractionHandler(), // │ G . /authorize_interaction
GetFollowersHandler(), // │ G . /u/:username/followers
GetFollowingHandler(), // │ G . /u/:username/following
}
}

Wyświetl plik

@ -0,0 +1,45 @@
package handlers
import (
"net/http"
. "github.com/xeronith/diamante/contracts/network/http"
pipeline "github.com/xeronith/diamante/network/http"
. "rail.town/infrastructure/components/api/protobuf"
. "rail.town/infrastructure/components/contracts"
)
type getFollowingHandler struct {
}
func GetFollowingHandler() IHttpHandler {
return &getFollowingHandler{}
}
func (handler *getFollowingHandler) Method() string {
return http.MethodGet
}
func (handler *getFollowingHandler) Path() string {
return "/u/:username/following"
}
func (handler *getFollowingHandler) HandlerFunc() HttpHandlerFunc {
return func(x IServerDispatcher) error {
request := &GetFollowingRequest{}
result := &GetFollowingResult{}
onRequestUnmarshalled := func(request *GetFollowingRequest) {
request.Username = x.Param("username")
}
return pipeline.Handle(x,
"get_following",
GET_FOLLOWING_REQUEST,
GET_FOLLOWING_RESULT,
request, result,
onRequestUnmarshalled,
false,
)
}
}

Wyświetl plik

@ -19,6 +19,7 @@ func (factory *operationFactory) Operations() []IOperation {
FollowActorOperation(),
AuthorizeInteractionOperation(),
GetFollowersOperation(),
GetFollowingOperation(),
}
}

Wyświetl plik

@ -0,0 +1,51 @@
package operations
import (
. "github.com/xeronith/diamante/contracts/operation"
. "github.com/xeronith/diamante/contracts/service"
. "github.com/xeronith/diamante/contracts/system"
. "github.com/xeronith/diamante/operation"
. "rail.town/infrastructure/components/api/protobuf"
. "rail.town/infrastructure/components/api/services"
. "rail.town/infrastructure/components/contracts"
)
type getFollowingOperation struct {
Operation
run func(IContext, *GetFollowingRequest) (*GetFollowingResult, error)
}
func GetFollowingOperation() IOperation {
return &getFollowingOperation{
run: GetFollowingService,
}
}
func (operation *getFollowingOperation) Id() (ID, ID) {
return GET_FOLLOWING_REQUEST, GET_FOLLOWING_RESULT
}
func (operation *getFollowingOperation) InputContainer() Pointer {
return new(GetFollowingRequest)
}
func (operation *getFollowingOperation) OutputContainer() Pointer {
return new(GetFollowingResult)
}
func (operation *getFollowingOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
return operation.run(context, payload.(*GetFollowingRequest))
}
/*
func (operation *getFollowingOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
var (
TIME_LIMIT_WARNING Duration = 20_000_000
TIME_LIMIT_ALERT Duration = 35_000_000
TIME_LIMIT_CRITICAL Duration = 50_000_000
)
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
}
*/

Wyświetl plik

@ -1576,6 +1576,142 @@ func (x *GetFollowersResult) GetFirst() string {
return ""
}
// API: GetFollowing
// -----------------------------------------------------------
type GetFollowingRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
}
func (x *GetFollowingRequest) Reset() {
*x = GetFollowingRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_spis_proto_msgTypes[26]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetFollowingRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetFollowingRequest) ProtoMessage() {}
func (x *GetFollowingRequest) ProtoReflect() protoreflect.Message {
mi := &file_spis_proto_msgTypes[26]
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 GetFollowingRequest.ProtoReflect.Descriptor instead.
func (*GetFollowingRequest) Descriptor() ([]byte, []int) {
return file_spis_proto_rawDescGZIP(), []int{26}
}
func (x *GetFollowingRequest) GetUsername() string {
if x != nil {
return x.Username
}
return ""
}
type GetFollowingResult struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Context string `protobuf:"bytes,1,opt,name=context,json=@context,proto3" json:"context,omitempty"`
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
TotalItems int32 `protobuf:"varint,4,opt,name=totalItems,proto3" json:"totalItems,omitempty"`
OrderedItems []string `protobuf:"bytes,5,rep,name=orderedItems,proto3" json:"orderedItems,omitempty"`
First string `protobuf:"bytes,6,opt,name=first,proto3" json:"first,omitempty"`
}
func (x *GetFollowingResult) Reset() {
*x = GetFollowingResult{}
if protoimpl.UnsafeEnabled {
mi := &file_spis_proto_msgTypes[27]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetFollowingResult) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetFollowingResult) ProtoMessage() {}
func (x *GetFollowingResult) ProtoReflect() protoreflect.Message {
mi := &file_spis_proto_msgTypes[27]
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 GetFollowingResult.ProtoReflect.Descriptor instead.
func (*GetFollowingResult) Descriptor() ([]byte, []int) {
return file_spis_proto_rawDescGZIP(), []int{27}
}
func (x *GetFollowingResult) GetContext() string {
if x != nil {
return x.Context
}
return ""
}
func (x *GetFollowingResult) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *GetFollowingResult) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *GetFollowingResult) GetTotalItems() int32 {
if x != nil {
return x.TotalItems
}
return 0
}
func (x *GetFollowingResult) GetOrderedItems() []string {
if x != nil {
return x.OrderedItems
}
return nil
}
func (x *GetFollowingResult) GetFirst() string {
if x != nil {
return x.First
}
return ""
}
var File_spis_proto protoreflect.FileDescriptor
var file_spis_proto_rawDesc = []byte{
@ -1726,8 +1862,22 @@ var file_spis_proto_rawDesc = []byte{
0x74, 0x65, 0x6d, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x65, 0x64, 0x49,
0x74, 0x65, 0x6d, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x72, 0x64, 0x65,
0x72, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x69, 0x72, 0x73,
0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x66, 0x69, 0x72, 0x73, 0x74, 0x42, 0x04,
0x5a, 0x02, 0x2e, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x66, 0x69, 0x72, 0x73, 0x74, 0x22, 0x31,
0x0a, 0x13, 0x47, 0x65, 0x74, 0x46, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d,
0x65, 0x22, 0xad, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x46, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69,
0x6e, 0x67, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x19, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74,
0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x40, 0x63, 0x6f, 0x6e, 0x74,
0x65, 0x78, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c,
0x49, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, 0x6f, 0x74,
0x61, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x6f, 0x72, 0x64, 0x65, 0x72,
0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x6f,
0x72, 0x64, 0x65, 0x72, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x66,
0x69, 0x72, 0x73, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x66, 0x69, 0x72, 0x73,
0x74, 0x42, 0x04, 0x5a, 0x02, 0x2e, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -1742,7 +1892,7 @@ func file_spis_proto_rawDescGZIP() []byte {
return file_spis_proto_rawDescData
}
var file_spis_proto_msgTypes = make([]protoimpl.MessageInfo, 26)
var file_spis_proto_msgTypes = make([]protoimpl.MessageInfo, 28)
var file_spis_proto_goTypes = []interface{}{
(*SystemCallRequest)(nil), // 0: protobuf.SystemCallRequest
(*SystemCallResult)(nil), // 1: protobuf.SystemCallResult
@ -1770,18 +1920,20 @@ var file_spis_proto_goTypes = []interface{}{
(*AuthorizeInteractionResult)(nil), // 23: protobuf.AuthorizeInteractionResult
(*GetFollowersRequest)(nil), // 24: protobuf.GetFollowersRequest
(*GetFollowersResult)(nil), // 25: protobuf.GetFollowersResult
(*Document)(nil), // 26: protobuf.Document
(*ActivityPubLink)(nil), // 27: protobuf.ActivityPubLink
(*ActivityPubMedia)(nil), // 28: protobuf.ActivityPubMedia
(*ActivityPubPublicKey)(nil), // 29: protobuf.ActivityPubPublicKey
(*GetFollowingRequest)(nil), // 26: protobuf.GetFollowingRequest
(*GetFollowingResult)(nil), // 27: protobuf.GetFollowingResult
(*Document)(nil), // 28: protobuf.Document
(*ActivityPubLink)(nil), // 29: protobuf.ActivityPubLink
(*ActivityPubMedia)(nil), // 30: protobuf.ActivityPubMedia
(*ActivityPubPublicKey)(nil), // 31: protobuf.ActivityPubPublicKey
}
var file_spis_proto_depIdxs = []int32{
26, // 0: protobuf.EchoRequest.document:type_name -> protobuf.Document
26, // 1: protobuf.EchoResult.document:type_name -> protobuf.Document
27, // 2: protobuf.WebfingerResult.links:type_name -> protobuf.ActivityPubLink
28, // 3: protobuf.GetActorResult.icon:type_name -> protobuf.ActivityPubMedia
28, // 4: protobuf.GetActorResult.image:type_name -> protobuf.ActivityPubMedia
29, // 5: protobuf.GetActorResult.publicKey:type_name -> protobuf.ActivityPubPublicKey
28, // 0: protobuf.EchoRequest.document:type_name -> protobuf.Document
28, // 1: protobuf.EchoResult.document:type_name -> protobuf.Document
29, // 2: protobuf.WebfingerResult.links:type_name -> protobuf.ActivityPubLink
30, // 3: protobuf.GetActorResult.icon:type_name -> protobuf.ActivityPubMedia
30, // 4: protobuf.GetActorResult.image:type_name -> protobuf.ActivityPubMedia
31, // 5: protobuf.GetActorResult.publicKey:type_name -> protobuf.ActivityPubPublicKey
6, // [6:6] is the sub-list for method output_type
6, // [6:6] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
@ -2108,6 +2260,30 @@ func file_spis_proto_init() {
return nil
}
}
file_spis_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetFollowingRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_spis_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetFollowingResult); 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{
@ -2115,7 +2291,7 @@ func file_spis_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_spis_proto_rawDesc,
NumEnums: 0,
NumMessages: 26,
NumMessages: 28,
NumExtensions: 0,
NumServices: 0,
},

Wyświetl plik

@ -175,4 +175,19 @@ message GetFollowersResult {
string first = 0x00000006;
}
// API: GetFollowing
//-----------------------------------------------------------
message GetFollowingRequest {
string username = 0x00000001;
}
message GetFollowingResult {
string context = 0x00000001 [json_name = "@context"];
string id = 0x00000002;
string type = 0x00000003;
int32 totalItems = 0x00000004;
repeated string orderedItems = 0x00000005;
string first = 0x00000006;
}
//-----------------------------------------------------------

Wyświetl plik

@ -0,0 +1,34 @@
package services
import (
. "github.com/xeronith/diamante/contracts/service"
. "rail.town/infrastructure/components/api/protobuf"
. "rail.town/infrastructure/components/contracts"
"rail.town/infrastructure/components/core"
)
// noinspection GoUnusedParameter
func GetFollowingService(context IContext, input *GetFollowingRequest) (result *GetFollowingResult, err error) {
conductor := core.Conductor
_ = GET_FOLLOWING_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "get_following", input, result, err)
defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_following", input, result, err) }()
_result, _err := conductor.GetFollowing(input.Username, context.Identity())
if _err != nil {
err = _err
return nil, err
}
_ = _result
result = context.ResultContainer().(*GetFollowingResult)
result.Context = _result.Context()
result.Id = _result.Id()
result.Type = _result.Type()
result.TotalItems = _result.TotalItems()
result.OrderedItems = _result.OrderedItems()
result.First = _result.First()
return result, nil
}

Wyświetl plik

@ -19,4 +19,5 @@ type IApi interface {
FollowActor(*FollowActorRequest) (*FollowActorResult, error)
AuthorizeInteraction(*AuthorizeInteractionRequest) (*AuthorizeInteractionResult, error)
GetFollowers(*GetFollowersRequest) (*GetFollowersResult, error)
GetFollowing(*GetFollowingRequest) (*GetFollowingResult, error)
}

Wyświetl plik

@ -55,6 +55,10 @@ const (
//GetFollowersOperation
GET_FOLLOWERS_REQUEST = 0x3F20FD65
GET_FOLLOWERS_RESULT = 0x7F3E2EB5
//GetFollowingOperation
GET_FOLLOWING_REQUEST = 0xF9841DB9
GET_FOLLOWING_RESULT = 0xD707408F
)
var OPCODES = Opcodes{
@ -83,4 +87,6 @@ var OPCODES = Opcodes{
0xB38E936F: "AuthorizeInteraction",
0x3F20FD65: "GET_FOLLOWERS",
0x7F3E2EB5: "GetFollowers",
0xF9841DB9: "GET_FOLLOWING",
0xD707408F: "GetFollowing",
}

Wyświetl plik

@ -66,6 +66,7 @@ type (
FollowActor(username string, acct string, editor Identity) (IFollowActorResult, error)
AuthorizeInteraction(uri string, editor Identity) (IAuthorizeInteractionResult, error)
GetFollowers(username string, editor Identity) (IGetFollowersResult, error)
GetFollowing(username string, editor Identity) (IGetFollowingResult, error)
}
IEchoResult interface {
@ -147,4 +148,13 @@ type (
OrderedItems() []string
First() string
}
IGetFollowingResult interface {
Context() string
Id() string
Type() string
TotalItems() int32
OrderedItems() []string
First() string
}
)

Wyświetl plik

@ -269,6 +269,7 @@ type (
FollowActor(username string, acct string, editor Identity) (IFollowActorResult, error)
AuthorizeInteraction(uri string, editor Identity) (IAuthorizeInteractionResult, error)
GetFollowers(username string, editor Identity) (IGetFollowersResult, error)
GetFollowing(username string, editor Identity) (IGetFollowingResult, error)
NewDocument(id int64, content string) (IDocument, error)
NewSystemSchedule(id int64, enabled bool, config string) (ISystemSchedule, error)
@ -299,6 +300,7 @@ type (
NewFollowActorResult(url string, ignored interface{}) IFollowActorResult
NewAuthorizeInteractionResult(uri string, success bool, ignored interface{}) IAuthorizeInteractionResult
NewGetFollowersResult(context string, id string, type_ string, totalItems int32, orderedItems []string, first string, ignored interface{}) IGetFollowersResult
NewGetFollowingResult(context string, id string, type_ string, totalItems int32, orderedItems []string, first string, ignored interface{}) IGetFollowingResult
}
ISystemComponent interface {

Wyświetl plik

@ -1043,6 +1043,7 @@ type IDispatcher interface {
FollowActor(username string, acct string) (IFollowActorResult, error)
AuthorizeInteraction(uri string) (IAuthorizeInteractionResult, error)
GetFollowers(username string) (IGetFollowersResult, error)
GetFollowing(username string) (IGetFollowingResult, error)
// NewDocument creates a new 'Document' instance using the provided property values.
NewDocument(id int64, content string) (IDocument, error)
@ -1136,6 +1137,8 @@ type IDispatcher interface {
NewAuthorizeInteractionResult(uri string, success bool) IAuthorizeInteractionResult
// NewGetFollowersResult creates a new result container for 'Get Followers' system action.
NewGetFollowersResult(context string, id string, type_ string, totalItems int32, orderedItems []string, first string) IGetFollowersResult
// NewGetFollowingResult creates a new result container for 'Get Following' system action.
NewGetFollowingResult(context string, id string, type_ string, totalItems int32, orderedItems []string, first string) IGetFollowingResult
// Assert asserts the provided condition and panics if the assertion is not valid.
Assert(condition bool) IAssertionResult
// AssertNoError panics if the provided error is not nil.

Wyświetl plik

@ -135,6 +135,16 @@ func (api *api) GetFollowers(request *GetFollowersRequest) (*GetFollowersResult,
}
}
func (api *api) GetFollowing(request *GetFollowingRequest) (*GetFollowingResult, error) {
result, err := api.call(GET_FOLLOWING_REQUEST, request)
if err != nil {
return nil, err
} else {
return result.(*GetFollowingResult), nil
}
}
func init() {
API_RESULT[SYSTEM_CALL_RESULT] = SystemCallResult{}
API_RESULT[ECHO_RESULT] = EchoResult{}
@ -149,4 +159,5 @@ func init() {
API_RESULT[FOLLOW_ACTOR_RESULT] = FollowActorResult{}
API_RESULT[AUTHORIZE_INTERACTION_RESULT] = AuthorizeInteractionResult{}
API_RESULT[GET_FOLLOWERS_RESULT] = GetFollowersResult{}
API_RESULT[GET_FOLLOWING_RESULT] = GetFollowingResult{}
}

Wyświetl plik

@ -1143,6 +1143,10 @@ func (conductor *conductor) GetFollowers(username string, editor Identity) (IGet
return conductor.spiManager.GetFollowers(username, editor)
}
func (conductor *conductor) GetFollowing(username string, editor Identity) (IGetFollowingResult, error) {
return conductor.spiManager.GetFollowing(username, editor)
}
func (conductor *conductor) NewDocument(id int64, content string) (IDocument, error) {
return NewDocument(id, content)
}
@ -1259,6 +1263,10 @@ func (conductor *conductor) NewGetFollowersResult(context string, id string, typ
return NewGetFollowersResult(context, id, type_, totalItems, orderedItems, first, nil)
}
func (conductor *conductor) NewGetFollowingResult(context string, id string, type_ string, totalItems int32, orderedItems []string, first string, _ interface{}) IGetFollowingResult {
return NewGetFollowingResult(context, id, type_, totalItems, orderedItems, first, nil)
}
func (conductor *conductor) LogRemoteCall(context IContext, eventType uint32, source string, input, result interface{}, err error) {
errorMessage := ""
if err != nil {

Wyświetl plik

@ -282,3 +282,7 @@ func (dispatcher *dispatcher) AuthorizeInteraction(uri string) (IAuthorizeIntera
func (dispatcher *dispatcher) GetFollowers(username string) (IGetFollowersResult, error) {
return dispatcher.conductor.SpiManager().GetFollowers(username, dispatcher.identity)
}
func (dispatcher *dispatcher) GetFollowing(username string) (IGetFollowingResult, error) {
return dispatcher.conductor.SpiManager().GetFollowing(username, dispatcher.identity)
}

Wyświetl plik

@ -844,3 +844,68 @@ func (manager *spiManager) GetFollowers(username string, editor Identity) (resul
return result, nil
}
}
//region IGetFollowingResult Implementation
type getFollowingResult struct {
context string
id string
type_ string
totalItems int32
orderedItems []string
first string
}
func NewGetFollowingResult(context string, id string, type_ string, totalItems int32, orderedItems []string, first string, _ interface{}) IGetFollowingResult {
return &getFollowingResult{
context: context,
id: id,
type_: type_,
totalItems: totalItems,
orderedItems: orderedItems,
first: first,
}
}
func (result getFollowingResult) Context() string {
return result.context
}
func (result getFollowingResult) Id() string {
return result.id
}
func (result getFollowingResult) Type() string {
return result.type_
}
func (result getFollowingResult) TotalItems() int32 {
return result.totalItems
}
func (result getFollowingResult) OrderedItems() []string {
return result.orderedItems
}
func (result getFollowingResult) First() string {
return result.first
}
//endregion
func (manager *spiManager) GetFollowing(username string, editor Identity) (result IGetFollowingResult, err error) {
defer func() {
if reason := recover(); reason != nil {
err = manager.Error(reason)
}
}()
editor.Lock(GET_FOLLOWING_REQUEST)
defer editor.Unlock(GET_FOLLOWING_REQUEST)
if result, err = commands.GetFollowing(NewDispatcher(Conductor, editor), username); err != nil {
return nil, err
} else {
return result, nil
}
}

Wyświetl plik

@ -52,4 +52,8 @@ func (dispatcher *dispatcher) NewGetFollowersResult(context string, id string, t
return NewGetFollowersResult(context, id, type_, totalItems, orderedItems, first, nil)
}
func (dispatcher *dispatcher) NewGetFollowingResult(context string, id string, type_ string, totalItems int32, orderedItems []string, first string) IGetFollowingResult {
return NewGetFollowingResult(context, id, type_, totalItems, orderedItems, first, nil)
}
//endregion