From f65bcfa9dcb29accc9a5ba020b324397c780a62d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabio=20Jos=C3=A9?= Date: Wed, 14 Nov 2018 22:44:04 -0200 Subject: [PATCH] Update the project structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabio José --- README.md | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 44e766b..47eb0a9 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,10 @@ Javascript SDK for CloudEvents ```text ├── index.js ├── lib +│   ├── bindings +│   │   └── http +│   │   └── structured_0_1.js │   ├── cloudevent.js -│   ├── jsonformatter.js │   ├── format │   │   └── json_0_1.js │   └── specs @@ -20,12 +22,18 @@ Javascript SDK for CloudEvents ├── README.md └── test ├── cloudevent_spec_0_1.js - └── cloudevent_spec_0_2.js - + ├── cloudevent_spec_0_2.js + └── http_binding_0_1.js ``` * `index.js`: library exports +* `lib/bindings`: every binding implementation goes here + +* `lib/bindings/http`: every http binding implementation goes here + +* `lib/bindings/http/structured_0_1.js`: implementation of structured HTTP Binding + * `lib/cloudevent.js`: implementation of Cloudevent, an interface * `lib/format/`: every format implementation goes here @@ -100,10 +108,27 @@ Every Spec class must implement these methods to work properly. Spec(Cloudevent) /* - * Check the spec constraints, throwing an error if do not pass. + * Checks the spec constraints, throwing an error if do not pass. */ Spec.check() +``` +## `Binding` classes + +Every Binding class must implement these methods to work properly. + +```js + +/* + * The constructor must receives the map of configurations. + */ +Binding(config) + +/* + * Emits the event using an instance of Cloudevent. + */ +Binding.emit(cloudevent) + ``` # How to use