Ejemplo n.º 1
0
 public function __invoke(Request $request, Response $response, callable $out = null)
 {
     $responseBuilder = new CASSResponseBuilder($response);
     try {
         $resolver = $this->commandService->createResolverBuilder()->attachDirect('by-id', GetByIdCommand::class)->attachDirect('by-sid', GetBySIDCommand::class)->attachDirect('create', CreateCommand::class)->attachDirect('delete', DeleteCommand::class)->attachDirect('edit', EditCommand::class)->attachDirect('image-upload', ImageUploadCommand::class)->attachDirect('image-delete', ImageDeleteCommand::class)->attachDirect('set-public-options', SetPublicOptionsCommand::class)->attachDirect('backdrop-upload', BackdropUploadCommand::class, 'POST')->attachDirect('backdrop-none', BackdropNoneCommand::class, 'POST')->attachDirect('backdrop-preset', BackdropPresetCommand::class, 'POST')->attachDirect('backdrop-color', BackdropColorCommand::class, 'POST')->resolve($request);
         return $resolver->run($request, $responseBuilder);
     } catch (CollectionNotFoundException $e) {
         return $responseBuilder->setError($e)->setStatusNotFound()->build();
     }
 }
Ejemplo n.º 2
0
 public function __invoke(Request $request, Response $response, callable $out = null)
 {
     $responseBuilder = new CASSResponseBuilder($response);
     $resolver = $this->commandService->createResolverBuilder()->attachDirect('change-password', ChangePasswordCommand::class)->attachDirect('request-delete', DeleteRequestCommand::class)->attachDirect('cancel-request-delete', CancelDeleteRequestCommand::class)->attachDirect('switch', SwitchToProfileCommand::class)->attachDirect('current', GetCurrentAccountCommand::class)->resolve($request);
     try {
         return $resolver->run($request, $responseBuilder);
     } catch (AccountNotFoundException $e) {
         return $responseBuilder->setStatusNotFound()->build();
     }
 }
Ejemplo n.º 3
0
 public function __invoke(Request $request, Response $response, callable $out = null) : ResponseInterface
 {
     $responseBuilder = new CASSResponseBuilder($response);
     try {
         $resolver = $this->commandService->createResolverBuilder()->attachDirect('profile', ProfileCommand::class)->attachDirect('collection', CollectionCommand::class)->attachDirect('community', CommunityCommand::class)->attachDirect('public-profiles', PublicProfilesCommand::class)->attachDirect('public-experts', PublicExpertsCommand::class)->attachDirect('public-content', PublicContentCommand::class)->attachDirect('public-discussions', PublicDiscussionsCommand::class)->attachDirect('public-communities', PublicCommunitiesCommand::class)->attachDirect('public-collections', PublicCollectionsCommand::class)->resolve($request);
         return $resolver->run($request, $responseBuilder);
     } catch (AbstractFeedException $e) {
         return $responseBuilder->setError($e)->setStatusBadRequest()->build();
     }
 }
Ejemplo n.º 4
0
 public function __invoke(Request $request, Response $response, callable $out = null)
 {
     $responseBuilder = new CASSResponseBuilder($response);
     try {
         $resolver = $this->commandService->createResolverBuilder()->attachDirect('create', CreateCommand::class)->attachDirect('delete', DeleteCommand::class)->attachDirect('edit', EditCommand::class)->attachDirect('get', GetCommand::class)->resolve($request);
         return $resolver->run($request, $responseBuilder);
     } catch (CollectionNotFoundException $e) {
         $responseBuilder->setStatusNotFound()->setError($e);
     } catch (ProfileNotFoundException $e) {
         $responseBuilder->setStatusNotFound()->setError($e);
     } catch (PostNotFoundException $e) {
         $responseBuilder->setStatusNotFound()->setError($e);
     }
     return $responseBuilder->build();
 }
Ejemplo n.º 5
0
 public function __invoke(Request $request, Response $response, callable $out = null)
 {
     $responseBuilder = new CASSResponseBuilder($response);
     $resolver = $this->commandService->createResolverBuilder()->attachDirect('sign-in', SignInCommand::class)->attachDirect('sign-up', SignUpCommand::class)->attachDirect('sign-out', SignOutCommand::class);
     foreach (self::OAUTH2_PROVIDERS as $provider => $commandClassName) {
         $resolver->attachCallable(function (Request $request) use($resolver, $provider) {
             return $request->getAttribute('command') === 'oauth' && $request->getAttribute('provider') === $provider;
         }, $commandClassName);
     }
     try {
         return $resolver->resolve($request)->run($request, $responseBuilder);
     } catch (AccountNotFoundException $e) {
         return $responseBuilder->setStatusNotFound()->build();
     }
 }
 public function __invoke(Request $request, Response $response, callable $out = null)
 {
     $responseBuilder = new CASSResponseBuilder($response);
     $resolver = $this->commandService->createResolverBuilder()->attachDirect('join', JoinCommand::class)->attachDirect('leave', LeaveCommand::class)->attachDirect('joined-communities', ListCommand::class)->resolve($request);
     return $resolver->run($request, $responseBuilder);
 }
Ejemplo n.º 7
0
 public function __invoke(Request $request, Response $response, callable $out = NULL)
 {
     $responseBuilder = new CASSResponseBuilder($response);
     $resolver = $this->commandService->createResolverBuilder()->attachDirect("create", CreateCommand::class)->attachDirect("delete", DeleteCommand::class)->attachDirect("get", GetCommand::class)->attachDirect('by-sid', GetBySIDCommand::class)->attachDirect("greetings-as", GreetingsAsCommand::class)->attachDirect("image-upload", ImageUploadCommand::class)->attachDirect('image-delete', ImageDeleteCommand::class)->attachDirect("edit-personal", EditPersonalCommand::class)->attachDirect("expert-in", ExpertInPutCommand::class, 'PUT')->attachDirect('interesting-in', InterestingInPutCommand::class, 'PUT')->attachDirect('set-gender', SetGenderCommand::class)->attachDirect('birthday', SetBirthdayCommand::class, 'POST')->attachDirect('birthday', UnsetBirthdayCommand::class, 'DELETE')->attachDirect('backdrop-upload', BackdropUploadCommand::class, 'POST')->attachDirect('backdrop-none', BackdropNoneCommand::class, 'POST')->attachDirect('backdrop-preset', BackdropPresetCommand::class, 'POST')->attachDirect('backdrop-color', BackdropColorCommand::class, 'POST')->resolve($request);
     return $resolver->run($request, $responseBuilder);
 }
Ejemplo n.º 8
0
 public function __invoke(Request $request, Response $response, callable $out = NULL)
 {
     $responseBuilder = new CASSResponseBuilder($response);
     $resolver = $this->commandService->createResolverBuilder()->attachDirect('room-create', CreateRoomCommand::class, 'PUT')->resolve($request);
     return $resolver->run($request, $responseBuilder);
 }
Ejemplo n.º 9
0
 public function __invoke(Request $request, Response $response, callable $out = NULL)
 {
     $responseBuilder = new CASSResponseBuilder($response);
     $resolver = $this->commandService->createResolverBuilder()->attachDirect('profile-send', SendProfileMessageCommand::class, 'PUT')->attachDirect('profile-send-profile', ProfileSendProfileMessageCommand::class, 'PUT')->attachDirect('get-messages', GetProfileMessagesCommand::class, 'POST')->resolve($request);
     return $resolver->run($request, $responseBuilder);
 }
Ejemplo n.º 10
0
 public function __invoke(Request $request, Response $response, callable $out = null)
 {
     $responseBuilder = new CASSResponseBuilder($response);
     $resolver = $this->commandService->createResolverBuilder()->attachDirect('upload', UploadCommand::class)->attachDirect('link', LinkCommand::class)->resolve($request);
     return $resolver->run($request, $responseBuilder);
 }
Ejemplo n.º 11
0
 public function __invoke(Request $request, Response $response, callable $out = NULL)
 {
     $responseBuilder = new CASSResponseBuilder($response);
     $resolver = $this->commandService->createResolverBuilder()->attachDirect("create", CreateCommand::class)->attachDirect("feedback-response", CreateFeedbackResponseCommand::class)->attachDirect("cancel", DeleteCommand::class)->attachDirect("mark-as-read", MarkAsReadCommand::class)->attachDirect("get", GetCommand::class)->attachDirect("list", ListCommand::class)->resolve($request);
     return $resolver->run($request, $responseBuilder);
 }
 public function __invoke(Request $request, Response $response, callable $out = null)
 {
     $responseBuilder = new CASSResponseBuilder($response);
     $resolver = $this->commandService->createResolverBuilder()->attachDirect('activate', ActivateFeatureCommand::class)->attachDirect('is-activated', IsFeatureActivatedCommand::class)->attachDirect('deactivate', DeactivateFeatureCommand::class)->resolve($request);
     return $resolver->run($request, $responseBuilder);
 }
Ejemplo n.º 13
0
 public function __invoke(Request $request, Response $response, callable $out = null)
 {
     $responseBuilder = new CASSResponseBuilder($response);
     $resolver = $this->commandService->createResolverBuilder()->attachDirect('create', CreateCommand::class)->attachDirect('delete', DeleteCommand::class)->attachDirect('get', GetCommand::class)->attachDirect('list-all', ListAllCommand::class)->attachDirect('move', MoveCommand::class)->attachDirect('tree', TreeCommand::class)->attachDirect('update', UpdateCommand::class);
     return $resolver->resolve($request)->run($request, $responseBuilder);
 }
Ejemplo n.º 14
0
 public function __invoke(Request $request, Response $response, callable $out = null)
 {
     $responseBuilder = new CASSResponseBuilder($response);
     $resolver = $this->commandService->createResolverBuilder()->attachDirect('get-colors', GetColorsCommand::class)->attachDirect('get-palettes', GetPalettesCommand::class)->resolve($request);
     return $resolver->run($request, $responseBuilder);
 }
Ejemplo n.º 15
0
 public function __invoke(Request $request, Response $response, callable $out = NULL)
 {
     $responseBuilder = new CASSResponseBuilder($response);
     $resolver = $this->commandService->createResolverBuilder()->attachDirect("subscribe-theme", SubscribeThemeCommand::class, 'PUT')->attachDirect("unsubscribe-theme", UnSubscribeThemeCommand::class, 'DELETE')->attachDirect("list-themes", ListSubscribedThemesCommand::class, 'POST')->attachDirect("subscribe-profile", SubscribeProfileCommand::class, 'PUT')->attachDirect("unsubscribe-profile", UnSubscribeProfileCommand::class, 'DELETE')->attachDirect("list-profiles", ListSubscribedProfilesCommand::class, 'POST')->attachDirect("subscribe-collection", SubscribeCollectionCommand::class, 'PUT')->attachDirect("unsubscribe-collection", UnSubscribeCollectionCommand::class, 'DELETE')->attachDirect("list-collections", ListSubscribedCollectionsCommand::class, 'POST')->attachDirect("subscribe-community", SubscribeCommunityCommand::class, 'PUT')->attachDirect("unsubscribe-community", UnSubscribeCommunityCommand::class, 'DELETE')->attachDirect("list-communities", ListSubscribedCommunitiesCommand::class, 'POST')->resolve($request);
     return $resolver->run($request, $responseBuilder);
 }