PHP Interface Webiny\Component\Rest\Interfaces\VersionInterface

The interfaces must be only implemented on the class that your are sending to: Rest::registerClass method. Other versions don't need to implement the interface, since from the main class we can get to all of the versions, and it's easier for you to maintain one file.
显示文件 Open project: Webiny/Framework

Public Methods

Method Description
getAllVersions ( ) : array Returns a list of all version, where the key is the version, and value is the namespace.
getCurrentVersion ( ) : string Returns the current api version. For example, you might have the latest version in a "beta" state, so you wish to keep your users using the latest stable versions.
getLatestVersion ( ) : string Returns the latest (highest) available api version.

Method Details

getAllVersions() public static method

Example: [ '1.0' => 'MyApp/Apis/Cms/Page/V1x1/', '1.2' => 'MyApp/Apis/Cms/Page/V1x2/', '2.0' => 'MyApp/Apis/Cms/Page/', ] How you organize your namespace is up to you.
public static getAllVersions ( ) : array
return array

getCurrentVersion() public static method

Users can still access the latest version if the specify the latest version number or "latest" as a version name in the X-Webiny-Rest-Version header. Version should be in format of A.B, for example: 1.1
public static getCurrentVersion ( ) : string
return string

getLatestVersion() public static method

Version should be in format of A.B, for example: 1.1
public static getLatestVersion ( ) : string
return string