Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Api\SetSiteLink Class Reference

API module to associate a page on a site with a Wikibase entity or remove an already made such association. More...

+ Inheritance diagram for Wikibase\Repo\Api\SetSiteLink:
+ Collaboration diagram for Wikibase\Repo\Api\SetSiteLink:

Public Member Functions

 __construct (ApiMain $mainModule, string $moduleName, SiteLinkChangeOpFactory $siteLinkChangeOpFactory, SiteLinkBadgeChangeOpSerializationValidator $badgeSerializationValidator, SiteLinkPageNormalizer $siteLinkPageNormalizer, SiteLinkTargetProvider $siteLinkTargetProvider, bool $federatedPropertiesEnabled, array $sandboxEntityIds)
 
 isWriteMode ()
 
 needsToken ()
 
- Public Member Functions inherited from Wikibase\Repo\Api\ModifyEntity
 __construct (ApiMain $mainModule, string $moduleName, bool $federatedPropertiesEnabled, string $modulePrefix='')
 
 setServices (SiteLinkGlobalIdentifiersProvider $siteLinkGlobalIdentifiersProvider)
 
 execute ()
 
 isFreshIdAssigned ()
 Return whether a fresh id is assigned or not.
 

Static Public Member Functions

static factory (ApiMain $mainModule, string $moduleName, ChangeOpFactoryProvider $changeOpFactoryProvider, SettingsArray $repoSettings, SiteLinkBadgeChangeOpSerializationValidator $siteLinkBadgeChangeOpSerializationValidator, SiteLinkPageNormalizer $siteLinkPageNormalizer, SiteLinkTargetProvider $siteLinkTargetProvider)
 

Protected Member Functions

 modifyEntity (EntityDocument $entity, ChangeOp $changeOp, array $preparedParameters)
 Actually modify the entity.
 
 getChangeOp (array $preparedParameters, EntityDocument $entity)
 
 getAllowedParams ()
 
 getExamplesMessages ()
 
- Protected Member Functions inherited from Wikibase\Repo\Api\ModifyEntity
 getTitleLookup ()
 
 getResultBuilder ()
 
 createSummary (array $params)
 Create a new Summary instance suitable for representing the action performed by this module.
 
 applyChangeOp (ChangeOp $changeOp, EntityDocument $entity, Summary $summary=null)
 Applies the given ChangeOp to the given Entity.
 
 prepareParameters (array $params)
 
 validateEntitySpecificParameters (array $preparedParameters, EntityDocument $entity, int $baseRevId)
 
 validateParameters (array $params)
 Make sure the required parameters are provided and that they are valid.
 

Protected Attributes

 $siteLinkTargetProvider
 
- Protected Attributes inherited from Wikibase\Repo\Api\ModifyEntity
 $stringNormalizer
 
 $siteLinkGlobalIdentifiersProvider
 
 $siteLinkGroups
 
 $badgeItems
 
 $errorReporter
 
 $enabledEntityTypes
 

Private Member Functions

 shouldRemove (array $params)
 Checks whether the link should be removed based on params.
 
 getLinkTitleFromExistingSiteLink (EntityDocument $entity, string $linksite)
 
 parseSiteLinkBadges (array $badges)
 
 getBadgeItemIds (array $badges)
 

Private Attributes

 $siteLinkChangeOpFactory
 
 $badgeSerializationValidator
 
 $siteLinkPageNormalizer
 
 $sandboxEntityIds
 

Detailed Description

API module to associate a page on a site with a Wikibase entity or remove an already made such association.

Requires API write mode to be enabled.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Api\SetSiteLink::__construct ( ApiMain $mainModule,
string $moduleName,
SiteLinkChangeOpFactory $siteLinkChangeOpFactory,
SiteLinkBadgeChangeOpSerializationValidator $badgeSerializationValidator,
SiteLinkPageNormalizer $siteLinkPageNormalizer,
SiteLinkTargetProvider $siteLinkTargetProvider,
bool $federatedPropertiesEnabled,
array $sandboxEntityIds )

Member Function Documentation

◆ factory()

static Wikibase\Repo\Api\SetSiteLink::factory ( ApiMain $mainModule,
string $moduleName,
ChangeOpFactoryProvider $changeOpFactoryProvider,
SettingsArray $repoSettings,
SiteLinkBadgeChangeOpSerializationValidator $siteLinkBadgeChangeOpSerializationValidator,
SiteLinkPageNormalizer $siteLinkPageNormalizer,
SiteLinkTargetProvider $siteLinkTargetProvider )
static

◆ getAllowedParams()

Wikibase\Repo\Api\SetSiteLink::getAllowedParams ( )
protected

Reimplemented from Wikibase\Repo\Api\ModifyEntity.

◆ getBadgeItemIds()

Wikibase\Repo\Api\SetSiteLink::getBadgeItemIds ( array $badges)
private

◆ getChangeOp()

Wikibase\Repo\Api\SetSiteLink::getChangeOp ( array $preparedParameters,
EntityDocument $entity )
protected
Parameters
array$preparedParameters
EntityDocument$entity
Returns
ChangeOp

Reimplemented from Wikibase\Repo\Api\ModifyEntity.

◆ getExamplesMessages()

Wikibase\Repo\Api\SetSiteLink::getExamplesMessages ( )
protected

◆ getLinkTitleFromExistingSiteLink()

Wikibase\Repo\Api\SetSiteLink::getLinkTitleFromExistingSiteLink ( EntityDocument $entity,
string $linksite )
private

◆ isWriteMode()

Wikibase\Repo\Api\SetSiteLink::isWriteMode ( )
See also
ApiBase::isWriteMode()
Returns
bool Always true.

◆ modifyEntity()

Wikibase\Repo\Api\SetSiteLink::modifyEntity ( EntityDocument $entity,
ChangeOp $changeOp,
array $preparedParameters )
protected

Actually modify the entity.

Parameters
EntityDocument$entity
ChangeOp$changeOp
array$preparedParameters
Returns
Summary|null a summary of the modification, or null to indicate failure.

Reimplemented from Wikibase\Repo\Api\ModifyEntity.

◆ needsToken()

Wikibase\Repo\Api\SetSiteLink::needsToken ( )
See also
ApiBase::needsToken
Returns
string

◆ parseSiteLinkBadges()

Wikibase\Repo\Api\SetSiteLink::parseSiteLinkBadges ( array $badges)
private

◆ shouldRemove()

Wikibase\Repo\Api\SetSiteLink::shouldRemove ( array $params)
private

Checks whether the link should be removed based on params.

Parameters
array$params
Returns
bool

Member Data Documentation

◆ $badgeSerializationValidator

Wikibase\Repo\Api\SetSiteLink::$badgeSerializationValidator
private

◆ $sandboxEntityIds

Wikibase\Repo\Api\SetSiteLink::$sandboxEntityIds
private

◆ $siteLinkChangeOpFactory

Wikibase\Repo\Api\SetSiteLink::$siteLinkChangeOpFactory
private

◆ $siteLinkPageNormalizer

Wikibase\Repo\Api\SetSiteLink::$siteLinkPageNormalizer
private

◆ $siteLinkTargetProvider

Wikibase\Repo\Api\SetSiteLink::$siteLinkTargetProvider
protected

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