osuny-owl 1.0.1-alpha → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +51 -12
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -116,15 +116,54 @@ export class OsunyOwl {
116
116
  }
117
117
 
118
118
  export class OsunyUtility{
119
+
120
+ /**
121
+ *
122
+ * @param {string} title **(Required)** Title to display
123
+ * @param {*} migration_identifier **(Required)** A unique migration identifier
124
+ * @param {*} position **(Required)** The position of the block. The first element positionned in a post has the value : 0
125
+ * @param {*} layout (Optional) Layout of the block. By default set to 1. 1 = classic, 2 = collapsed,
126
+ * @returns Osuny's Communication::Block (Title) object
127
+ */
128
+ static createTitle(title, migration_identifier, position, layout = 1){
129
+ let layout_title;
130
+
131
+ switch (layout) {
132
+ case 1:
133
+ layout_title = "classic"
134
+ break;
135
+
136
+ case 2:
137
+ layout_title = "collapsed"
138
+ break;
139
+
140
+ default:
141
+ layout_title = "classic"
142
+ break;
143
+ }
144
+
145
+ return {
146
+ "id": null,
147
+ "migration_identifier": migration_identifier,
148
+ "template_kind": "title",
149
+ "title": title,
150
+ "position": position,
151
+ "published": true,
152
+ "html_class": null,
153
+ "data": {
154
+ "layout": layout_title
155
+ }
156
+ }
157
+ }
119
158
 
120
159
  /**
121
160
  * Create a chapter Block to include in an Osuny's post
122
161
  *
123
- * @param {string} text - (Required) Main text of the chapter
124
- * @param {string} migration_identifier - (Required) a unique migration identifier
125
- * @param {number} position - (Required) The position of the block. The first element positionned in a post has the value : 0
126
- * @param {string} title - (Optional) Title of the block, will be displayed as h3 on the website
127
- * @param {number} layout - Layout of the block. By default set to 1. 1 = no_background, 2 = alt_background, 3 = accent_background
162
+ * @param {string} text **(Required)** Main text of the chapter
163
+ * @param {string} migration_identifier **(Required)** a unique migration identifier
164
+ * @param {number} position **(Required)** The position of the block. The first element positionned in a post has the value : 0
165
+ * @param {string} title (Optional) Title of the block, will be displayed as h3 on the website
166
+ * @param {number} layout Layout of the block. By default set to 1. 1 = no_background, 2 = alt_background, 3 = accent_background
128
167
  * @returns Osuny's Communication::Block (Chapter) object
129
168
  */
130
169
 
@@ -168,7 +207,7 @@ export class OsunyUtility{
168
207
  /**
169
208
  * Create a Datatable Block to include in an Osuny's Post
170
209
  *
171
- * @param {Array} table_data (Required) Array of objects with the following form
210
+ * @param {Array} table_data **(Required)** Array of objects with the following form
172
211
  * ```
173
212
  * { cells: [
174
213
  * "value_1",
@@ -177,9 +216,9 @@ export class OsunyUtility{
177
216
  * }
178
217
  * ```
179
218
  * - The number of strings in a "cells" array is representative of each cell in a row.
180
- * @param {Array} table_headers (Required) Array of strings with all the columns header of the datatable
181
- * @param {string} migration_identifier (Required) a unique migration identifier
182
- * @param {number} position (Required) The position of the block. The first element positionned in a post has the value : 0
219
+ * @param {Array} table_headers **(Required)** Array of strings with all the columns header of the datatable
220
+ * @param {string} migration_identifier **(Required)** a unique migration identifier
221
+ * @param {number} position **(Required)** The position of the block. The first element positionned in a post has the value : 0
183
222
  * @param {string} title (Optional) Title of the block, will be displayed as h3 on the website
184
223
  * @param {boolean} alphabetical (Optional) Sort the datable in alphabetical order if set to true. False by default
185
224
  * @param {string} caption (Optional) Set the datable caption (usualy after the table). Set to an empty string by default.
@@ -208,9 +247,9 @@ export class OsunyUtility{
208
247
  /**
209
248
  * Create a Video Block to include in an Osuny's Post
210
249
  *
211
- * @param {string} video_url (Required) The actual url of the video
212
- * @param {string} migration_identifier (Required) A unique migration identifier
213
- * @param {number} position (Required) Position of the block in the post
250
+ * @param {string} video_url **(Required)** The actual url of the video
251
+ * @param {string} migration_identifier (**Required)** A unique migration identifier
252
+ * @param {number} position **(Required)** Position of the block in the post
214
253
  * @param {string} video_title Title of the video, will be displayed alongside the media
215
254
  * @param {string} video_desc Description of the video, will be displayed as a paragraph alongside the media
216
255
  * @param {string} video_transc (Recommended) Transcription of the video
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "osuny-owl",
3
- "version": "1.0.1-alpha",
3
+ "version": "1.1.0",
4
4
  "description": "Osuny Owl is an object that can go talk to the Osuny API, to create post or other osuny components from a large amount of data",
5
5
  "keywords": [
6
6
  "osuny",