@@ 122-134 (lines=13) @@ | ||
119 | * |
|
120 | * @throws \RuntimeException |
|
121 | */ |
|
122 | public function deleteRegistration(RegistrationInterface $registration) |
|
123 | { |
|
124 | if (!$registration->getRegistrationId() || !$registration->getETag()) { |
|
125 | throw new \RuntimeException('Registration ID and ETag are mandatory.'); |
|
126 | } |
|
127 | ||
128 | $uri = $registration->buildUri($this->endpoint, $this->hubPath).self::API_VERSION; |
|
129 | ||
130 | $token = $this->generateSasToken($uri); |
|
131 | $headers = array_merge(['Authorization: '.$token], $registration->getHeaders()); |
|
132 | ||
133 | $this->request(self::METHOD_DELETE, $uri, $headers); |
|
134 | } |
|
135 | ||
136 | /** |
|
137 | * Read Registration. |
|
@@ 145-159 (lines=15) @@ | ||
142 | * |
|
143 | * @return mixed |
|
144 | */ |
|
145 | public function readRegistration(RegistrationInterface $registration) |
|
146 | { |
|
147 | if (!$registration->getRegistrationId()) { |
|
148 | throw new \RuntimeException('Registration ID is mandatory.'); |
|
149 | } |
|
150 | ||
151 | $uri = $registration->buildUri($this->endpoint, $this->hubPath).self::API_VERSION; |
|
152 | ||
153 | $token = $this->generateSasToken($uri); |
|
154 | $headers = array_merge(['Authorization: '.$token], $registration->getHeaders()); |
|
155 | ||
156 | $response = $this->request(self::METHOD_GET, $uri, $headers); |
|
157 | ||
158 | return $registration->scrapeResponse($response); |
|
159 | } |
|
160 | ||
161 | /** |
|
162 | * Read All Registrations of a Channel. |