forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Rest API metadata event. Added swagger doc (openemr#4817)
In order to make sure that a module REST resource shows up in the FHIR metadata api and to allow us to override service classes in the metadata we needed a new event. Made a change to the fhir readme to explain how to register with swagger.
- Loading branch information
Showing
4 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
namespace OpenEMR\Events\RestApiExtend; | ||
|
||
class RestApiResourceServiceEvent | ||
{ | ||
/** | ||
* Used whenever the service for a rest api resource needs to be returned for metadata or other kind of resource purposes | ||
*/ | ||
const EVENT_HANDLE = 'restapi.service.get'; | ||
|
||
/** | ||
* @var string The API resource that we need to locate a service for | ||
*/ | ||
private $resource; | ||
|
||
/** | ||
* @var string The original system resource for service | ||
*/ | ||
private $serviceClass; | ||
|
||
public function __construct($resource, $serviceClass) | ||
{ | ||
$this->resource = $resource; | ||
$this->serviceClass = $serviceClass; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getResource(): string | ||
{ | ||
return $this->resource; | ||
} | ||
|
||
/** | ||
* @param string $resource | ||
* @return RestApiResourceServiceEvent | ||
*/ | ||
public function setResource(string $resource): RestApiResourceServiceEvent | ||
{ | ||
$this->resource = $resource; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getServiceClass(): ?string | ||
{ | ||
return $this->serviceClass; | ||
} | ||
|
||
/** | ||
* @param string $serviceClass | ||
* @return RestApiResourceServiceEvent | ||
*/ | ||
public function setServiceClass(?string $serviceClass): RestApiResourceServiceEvent | ||
{ | ||
$this->serviceClass = $serviceClass; | ||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters