Skip to content

Commit 629055f

Browse files
committed
Re-organize the package spec
1 parent 14f89dd commit 629055f

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

Diff for: docs/spec/spec.md

+37-37
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ The conforming implementation of the specification is released and included in t
2424
* 2.1.2 [Initialization](#212-initialization)
2525
* 2.1.3 [Methods](#213-methods)
2626
* 2.2. [Service](#22-service)
27-
* 2.2.1. [Methods](#221-methods)
28-
* 2.2.1.1. [onRegisterTopic](#2211-onregistertopic)
29-
* 2.2.1.2. [onDeregisterTopic](#2212-onderegistertopic)
30-
* 2.2.1.3. [onEventMessage](#2213-oneventmessage)
31-
* 2.2.1.4. [onSubscription](#2214-onsubscription)
32-
* 2.2.1.5. [onSubscriptionValidation](#2215-onsubscriptionvalidation)
33-
* 2.2.1.6. [onSubscriptionIntentVerified](#2216-onsubscriptionintentverified)
34-
* 2.2.1.7. [onUnsubscritpion](#2217-onunsubscritpion)
35-
* 2.2.1.8. [onUnsubscriptionValidation](#2218-onunsubscriptionvalidation)
36-
* 2.2.1.9. [onUnsubscriptionIntenVerified](#2219-onunsubscriptionintenverified)
37-
* 2.2.1. [Annotation](#222-annotation)
27+
* 2.2.1. [Annotation](#221-annotation)
28+
* 2.2.2. [Methods](#222-methods)
29+
* 2.2.2.1. [onRegisterTopic](#2221-onregistertopic)
30+
* 2.2.2.2. [onDeregisterTopic](#2222-onderegistertopic)
31+
* 2.2.2.3. [onEventMessage](#2223-oneventmessage)
32+
* 2.2.2.4. [onSubscription](#2224-onsubscription)
33+
* 2.2.2.5. [onSubscriptionValidation](#2225-onsubscriptionvalidation)
34+
* 2.2.2.6. [onSubscriptionIntentVerified](#2226-onsubscriptionintentverified)
35+
* 2.2.2.7. [onUnsubscritpion](#2227-onunsubscritpion)
36+
* 2.2.2.8. [onUnsubscriptionValidation](#2228-onunsubscriptionvalidation)
37+
* 2.2.2.9. [onUnsubscriptionIntenVerified](#2229-onunsubscriptionintenverified)
3838
* 2.3. [Hub Client](#23-hub-client)
3939
* 2.3.1. [Initialization](#231-initialization)
4040
* 2.3.2. [Distribute Content](#232-distribute-content)
@@ -213,9 +213,25 @@ public type Service distinct service object {
213213
};
214214
```
215215

216-
#### 2.2.1. Methods
216+
#### 2.2.1. Annotation
217217

218-
##### 2.2.1.1. onRegisterTopic
218+
Apart from the listener level configurations a `hub` will require few additional configurations. Hence, there should be
219+
`websubhub:ServiceConfig` a service-level-annotation for `websubhub:Service` which contains
220+
`websubhub:ServiceConfiguration` record.
221+
```ballerina
222+
# Configuration for a WebSub Hub service.
223+
#
224+
# + leaseSeconds - The period for which the subscription is expected to be active in the `hub`
225+
# + webHookConfig - HTTP client configurations for subscription/unsubscription intent verification
226+
public type ServiceConfiguration record {|
227+
int leaseSeconds?;
228+
ClientConfiguration webHookConfig?;
229+
|};
230+
```
231+
232+
#### 2.2.2. Methods
233+
234+
##### 2.2.2.1. onRegisterTopic
219235

220236
This remote method is invoked when the `publisher` sends a request to register a `topic` to the `hub`.
221237
```ballerina
@@ -228,7 +244,7 @@ remote function onRegisterTopic(websubhub:TopicRegistration msg)
228244
returns websubhub:TopicRegistrationSuccess|websubhub:TopicRegistrationError|error;
229245
```
230246

231-
##### 2.2.1.2. onDeregisterTopic
247+
##### 2.2.2.2. onDeregisterTopic
232248

233249
This remote method is invoked when the `publisher` sends a request to remove a `topic` from the `hub`.
234250
```ballerina
@@ -241,7 +257,7 @@ remote function onDeregisterTopic(websubhub:TopicDeregistration msg)
241257
returns websubhub:TopicDeregistrationSuccess|websubhub:TopicDeregistrationError|error;
242258
```
243259

244-
##### 2.2.1.3. onEventMessage
260+
##### 2.2.2.3. onEventMessage
245261

246262
This remote method is invoked when the `publisher` sends a request to notify the `hub` about content update for a
247263
`topic`.
@@ -255,7 +271,7 @@ remote function onUpdateMessage(websubhub:UpdateMessage msg)
255271
returns websubhub:Acknowledgement|websubhub:UpdateMessageError|error;
256272
```
257273

258-
##### 2.2.1.4. onSubscription
274+
##### 2.2.2.4. onSubscription
259275

260276
This remote method is invoked when the `subscriber` sends a request to subscribe for a `topic` in the `hub`. (This is an
261277
optional remote method.)
@@ -273,7 +289,7 @@ remote function onSubscription(websubhub:Subscription msg)
273289
websubhub:InternalSubscriptionError|error;
274290
```
275291

276-
##### 2.2.1.5. onSubscriptionValidation
292+
##### 2.2.2.5. onSubscriptionValidation
277293

278294
This remote method is invoked when subscription request from the `subscriber` is accepted from the `hub`. `hub` could
279295
enforce additional validation for the subscription request when this method is invoked. If the validations are failed
@@ -288,7 +304,7 @@ remote function onSubscriptionValidation(websubhub:Subscription msg)
288304
returns websubhub:SubscriptionDeniedError|error?;
289305
```
290306

291-
##### 2.2.1.6. onSubscriptionIntentVerified
307+
##### 2.2.2.6. onSubscriptionIntentVerified
292308

293309
This remote method is invoked after the `hub` verifies the subscription request.
294310
```ballerina
@@ -299,7 +315,7 @@ This remote method is invoked after the `hub` verifies the subscription request.
299315
remote function onSubscriptionIntentVerified(websubhub:VerifiedSubscription msg) returns error?;
300316
```
301317

302-
##### 2.2.1.7. onUnsubscritpion
318+
##### 2.2.2.7. onUnsubscritpion
303319

304320
This remote method is invoked when the `subscriber` sends a request to unsubscribe from a `topic` in the `hub`. (This is
305321
an optional remote method.)
@@ -315,7 +331,7 @@ remote function onUnsubscription(websubhub:Unsubscription msg)
315331
websubhub:InternalUnsubscriptionError|error;
316332
```
317333

318-
##### 2.2.1.8. onUnsubscriptionValidation
334+
##### 2.2.2.8. onUnsubscriptionValidation
319335

320336
This remote method is invoked when unsubscription request from the `subscriber` is accepted from the `hub`. `hub` could
321337
enforce additional validation for the unsubscription request when this method is invoked. If the validations are failed
@@ -330,7 +346,7 @@ remote function onUnsubscriptionValidation(websubhub:Unsubscription msg)
330346
returns websubhub:UnsubscriptionDeniedError|error?;
331347
```
332348

333-
##### 2.2.1.9. onUnsubscriptionIntenVerified
349+
##### 2.2.2.9. onUnsubscriptionIntenVerified
334350

335351
This remote method is invoked after the `hub` verifies the unsubscription request.
336352
```ballerina
@@ -359,22 +375,6 @@ This is due to the limited information in the WebSub specification on the relati
359375
In the event of a bad request from the `publisher` or the `subscriber`, the WebSubHub dispatcher will automatically send
360376
back the appropriate response to the client.
361377

362-
#### 2.2.2. Annotation
363-
364-
Apart from the listener level configurations a `hub` will require few additional configurations. Hence, there should be
365-
`websubhub:ServiceConfig` a service-level-annotation for `websubhub:Service` which contains
366-
`websubhub:ServiceConfiguration` record.
367-
```ballerina
368-
# Configuration for a WebSub Hub service.
369-
#
370-
# + leaseSeconds - The period for which the subscription is expected to be active in the `hub`
371-
# + webHookConfig - HTTP client configurations for subscription/unsubscription intent verification
372-
public type ServiceConfiguration record {|
373-
int leaseSeconds?;
374-
ClientConfiguration webHookConfig?;
375-
|};
376-
```
377-
378378
### 2.3. Hub Client
379379

380380
In accordance with the [WebSub specification](https://www.w3.org/TR/websub/#content-distribution), `WebSubHub` package

0 commit comments

Comments
 (0)