Stud.IP  6.0
JsonApiController Class Reference
Inheritance diagram for JsonApiController:
ActivityStreamShow AdmissionRulesCreate AdmissionRulesDelete AdmissionRulesIndex AdmissionRulesShow AdmissionRulesUpdate AvailableCoursesIndex CourseSetsCreate CourseSetsDelete CourseSetsShow CourseSetsUpdate AvatarofRangeDelete AvatarOfRangeShow CommentsByThreadIndex CommentsCreate CommentsDelete CommentsIndex CommentsShow CommentsUpdate ThreadsCreate ThreadsIndex ThreadsShow ThreadsUpdate ClipboardItemsCreate ClipboardItemsDelete ClipboardItemsShow ClipboardsCreate ClipboardsDelete ClipboardsUpdate ByUserIndex ConfigValuesShow ConfigValuesUpdate BlocksByRangeIndex BlockShow BookingsBySlotIndex BookingsCreate BookingsDelete BookingsShow SlotsByBlockIndex SlotShow ByUserIndex CourseMembershipsShow CourseMembershipsUpdate CoursesByModuleComponentsIndex CoursesByUserIndex CoursesIndex CoursesMembershipsIndex CoursesShow SemClassesIndex SemClassesShow SemTypesBySemClassIndex SemTypesIndex SemTypesShow StatusGroupsOfCourses BlockCommentsCreate BlockCommentsDelete BlockCommentsOfBlocksIndex BlockCommentsShow BlockCommentsUpdate BlockFeedbacksCreate BlockFeedbacksDelete BlockFeedbacksOfBlocksIndex BlockFeedbacksShow BlockFeedbacksUpdate BlocksCreate BlocksDelete BlocksIndex BlocksListFiles BlocksShow BlocksUpdate BookmarkedStructuralElementsIndex ChildrenOfStructuralElementsIndex ClipboardsCreate ClipboardsDelete ClipboardsIndex ClipboardsShow ClipboardsUpdate ContainersCreate ContainersDelete ContainersIndex ContainersShow ContainersUpdate CoursesUnitsIndex CoursewareInstancesShow CoursewareInstancesUpdate DescendantsOfStructuralElementsIndex ProcessesCreate ProcessesDelete ProcessesIndex ProcessesShow ProcessesUpdate ReviewsByTaskIndex ReviewsCreate ReviewsDelete ReviewsIndex ReviewsOfProcessesIndex ReviewsShow ReviewsUpdate PublicLinksCreate PublicLinksDelete PublicLinksIndex PublicLinksShow PublicLinksUpdate PublicStructuralElementsIndex PublicStructuralElementsShow StructuralElementCommentsCreate StructuralElementCommentsDelete StructuralElementCommentsOfStructuralElementsIndex StructuralElementCommentsShow StructuralElementCommentsUpdate StructuralElementFeedbackCreate StructuralElementFeedbackDelete StructuralElementFeedbackOfStructuralElementsIndex StructuralElementFeedbackShow StructuralElementFeedbackUpdate StructuralElementsCreate StructuralElementsDelete StructuralElementsIndex StructuralElementsReleasedIndex StructuralElementsSharedIndex StructuralElementsShow StructuralElementsUpdate TaskFeedbackCreate TaskFeedbackDelete TaskFeedbackShow TaskFeedbackUpdate TaskGroupsCreate TaskGroupsDelete TaskGroupsShow TaskGroupsUpdate TasksDelete TasksIndex TasksShow TasksUpdate TemplatesCreate TemplatesDelete TemplatesIndex TemplatesShow TemplatesUpdate UnitsCreate UnitsDelete UnitsIndex UnitsShow UnitsSort UnitsUpdate UserDataFieldOfBlocksShow UserDataFieldsShow UserDataFieldsUpdate UserProgressesShow UserProgressesUpdate UserProgressOfBlocksShow UsersBookmarkedStructuralElementsIndex UsersClipboardsDelete UsersClipboardsIndex UsersUnitsIndex DatafieldsIndex DiscoveryIndex CourseEventsIndex UserEventsIndex FeedbackElementsByCourseIndex FeedbackElementsByFileRefIndex FeedbackElementsByFolderIndex FeedbackElementsCreate FeedbackElementsDelete FeedbackElementsShow FeedbackElementsUpdate FeedbackEntriesCreate FeedbackEntriesDelete FeedbackEntriesIndex FeedbackEntriesShow FeedbackEntriesUpdate AbstractRangeIndex FileRefsCreate FileRefsDelete FileRefsOfFilesShow FileRefsShow FileRefsUpdate FilesShow FoldersDelete FoldersShow FoldersUpdate RangeFileRefsCreate RangeFoldersCreate SubfilerefsIndex SubfoldersIndex TermsOfUseIndex TermsOfUseShow AbstractEntriesCreate ForumCategoriesCreate ForumCategoriesDelete ForumCategoriesIndex ForumCategoriesShow ForumCategoriesUpdate ForumCategoryEntriesIndex ForumEntriesDelete ForumEntriesShow ForumEntriesUpdate ForumEntryEntriesIndex ByUserIndex InstituteMembershipsShow InstituteMembershipsIndex InstitutesIndex InstitutesShow StatusGroupsOfInstitutes LtiToolsIndex LtiToolsShow MassMailMessagesIndex MassMailPermissionsIndex MassMailPermissionsShow BoxController MessageCreate MessageDelete MessageShow MessageUpdate ComponentsByCoursesOfStudyIndex ComponentVersionsShow CourseOfStudyComponentsShow CoursesOfStudyIndex CoursesOfStudyShow DegreesByCoursesOfStudyShow DegreesIndex DegreesShow ModuleComponentsByModuleIndex ModuleComponentsShow ModulesIndex ModulesShow SubjectsByCourseOfStudyComponentsShow SubjectsIndex SubjectsShow VersionsByCourseOfStudyComponentsIndex AbstractNewsCreate ByCourseIndex ByCurrentUser ByUserIndex CommentCreate CommentsDelete CommentsIndex CommentsShow GlobalNewsShow NewsDelete NewsShow NewsUpdate ChildrenOfRangeTreeNode CoursesOfRangeTreeNode InstituteOfRangeTreeNode ParentOfRangeTreeNode RangeTreeShow RelationshipsController ScheduleEntriesShow SeminarCycleDatesShow UserScheduleShow SemestersIndex SemestersShow StatusgroupShow StockImagesCreate StockImagesDelete StockImagesIndex StockImagesShow StockImagesUpdate PropertiesIndex ChildrenOfStudyAreas CoursesOfStudyAreas InstituteOfStudyAreas ParentOfStudyAreas StudyAreasIndex StudyAreasShow ChildrenOfTreeNode CoursesOfTreeNode TreeShow UserFilterFieldsIndex UserFilterFieldsShow UserFiltersCreate UserFiltersDelete UserFiltersShow UserFiltersUpdate ContactsIndex UsersDelete UsersIndex UsersShow ChildrenIndex DescendantsIndex WikiCreate WikiDelete WikiIndex WikiShow WikiUpdate

Public Member Functions

 __construct (protected \Slim\App $app, protected ContainerInterface $container, protected FactoryInterface $factory, protected EncoderInterface $encoder, protected SchemaContainerInterface $schemaContainer, protected QueryParserInterface $queryParser, protected ResponseFactoryInterface $responseFactory, HeaderParametersParserInterface $headerParametersParser)
 
 getUser (Request $request)
 

Protected Member Functions

 getCodeResponse (int $statusCode, array $headers=[])
 
 getMetaResponse ($meta, $statusCode=ResponsesInterface::HTTP_OK, array $headers=[])
 
 getContentResponse ( $data, $statusCode=ResponsesInterface::HTTP_OK, $links=[], $meta=[], array $headers=[])
 
 getIdentifiersResponse ($data, $links=[], $meta=[], array $headers=[])
 
 getPaginatedIdentifiersResponse ( $data, $total, $links=[], $meta=[], array $headers=[])
 
 getCreatedResponse ($resource, $links=[], $meta=[], array $headers=[])
 
 getPaginatedContentResponse ( $data, $total, $statusCode=ResponsesInterface::HTTP_OK, $links=[], $meta=[], array $headers=[])
 
 getQueryParameters ()
 
 getOffsetAndLimit ($offsetDefault=0, $limitDefault=30)
 
 getSchema ($resource)
 
 getResponses (array $links=[], array $meta=[])
 

Protected Attributes

 $allowUnrecognizedParams = false
 
 $allowedIncludePaths = []
 
 $allowedFieldSetTypes = null
 
 $allowedSortFields = []
 
 $allowedPagingParameters = []
 
 $allowedFilteringParameters = []
 

Detailed Description

Ein JsonApiController ist die einfachste Möglichkeit, eine eigene JSON-API-Route zu erstellen.

Dazu erstellt man eine Unterklasse von JsonApiController und kann darin __invoke oder andere Methoden definieren und diese in der RouteMap registrieren.

Wenn man auf den JsonApiController verzichten möchte, muss man den JsonApiTrait in seiner eigenen Lösung einbinden und außerdem den Dependency Container als Instanzvariabel $this->container eintragen und die Methode JsonApiTrait::initJsonApiSupport aufrufen.

Diese Klasse hier übernimmt all diese Aufgaben selbst.

See also

Constructor & Destructor Documentation

◆ __construct()

__construct ( protected \Slim\App  $app,
protected ContainerInterface  $container,
protected FactoryInterface  $factory,
protected EncoderInterface  $encoder,
protected SchemaContainerInterface  $schemaContainer,
protected QueryParserInterface  $queryParser,
protected ResponseFactoryInterface  $responseFactory,
HeaderParametersParserInterface  $headerParametersParser 
)

Der Konstruktor.

Member Function Documentation

◆ getCodeResponse()

getCodeResponse ( int  $statusCode,
array  $headers = [] 
)
protected

Get response with HTTP code only.

◆ getContentResponse()

getContentResponse (   $data,
  $statusCode = ResponsesInterface::HTTP_OK,
  $links = [],
  $meta = [],
array  $headers = [] 
)
protected

Get response with regular JSON API Document in body.

Parameters
object | array$data
int$statusCode
array | null$links
mixed$meta

◆ getCreatedResponse()

getCreatedResponse (   $resource,
  $links = [],
  $meta = [],
array  $headers = [] 
)
protected
Parameters
object$resource
array | null$links
mixed$meta

◆ getIdentifiersResponse()

getIdentifiersResponse (   $data,
  $links = [],
  $meta = [],
array  $headers = [] 
)
protected

Get response with only resource identifiers.

Parameters
object | array$data
array | null$links
mixed$meta

◆ getMetaResponse()

getMetaResponse (   $meta,
  $statusCode = ResponsesInterface::HTTP_OK,
array  $headers = [] 
)
protected

Get response with meta information only.

Parameters
array | object$metaMeta information
int$statusCode

◆ getOffsetAndLimit()

getOffsetAndLimit (   $offsetDefault = 0,
  $limitDefault = 30 
)
protected

◆ getPaginatedContentResponse()

getPaginatedContentResponse (   $data,
  $total,
  $statusCode = ResponsesInterface::HTTP_OK,
  $links = [],
  $meta = [],
array  $headers = [] 
)
protected
Parameters
object | array$data
?int$total
int$statusCode
array | null$links
mixed$meta

◆ getPaginatedIdentifiersResponse()

getPaginatedIdentifiersResponse (   $data,
  $total,
  $links = [],
  $meta = [],
array  $headers = [] 
)
protected

Get response with paginated resource identifiers.

Parameters
object | array$data
?int$total
array | null$links
mixed$meta

◆ getQueryParameters()

getQueryParameters ( )
protected

◆ getResponses()

getResponses ( array  $links = [],
array  $meta = [] 
)
protected

◆ getSchema()

getSchema (   $resource)
protected

Gibt das Schema zu einer beliebigen Ressource zurück.

Parameters
mixed$resourcedie Ressource, zu der das Schema geliefert werden soll
Returns
SchemaInterface das Schema zur Ressource

◆ getUser()

getUser ( Request  $request)

Gibt null oder das User-Objekt des "eingeloggten" Nutzers zurück.

Parameters
Request$requestRequest der eingehende Request
Returns
null| entweder null oder das User-Objekt des "eingeloggten" Nutzers

Field Documentation

◆ $allowedFieldSetTypes

$allowedFieldSetTypes = null
protected

◆ $allowedFilteringParameters

$allowedFilteringParameters = []
protected

◆ $allowedIncludePaths

$allowedIncludePaths = []
protected

◆ $allowedPagingParameters

$allowedPagingParameters = []
protected

◆ $allowedSortFields

$allowedSortFields = []
protected

◆ $allowUnrecognizedParams

$allowUnrecognizedParams = false
protected

The documentation for this class was generated from the following file: