Set the visibility of a section
cULR
iOS SDK
Android SDK
PHP SDK
JS SDK
Flutter SDK
1
curl https://mburger.cloud/api/blocks/<id>/sections
2
-X POST
3
-H "Accept: application/json"
4
-H "Content-Type: application/x-www-form-urlencoded"
5
-H "X-MBurger-Token: <token>"
6
-H "X-MBurger-Version: 3"
7
-d 'elements[<locale>][<element_type>]=<value>'
8
-d 'visibility'
Copied!
1
var visibilitySettings = MBAdminVisibilitySettings.draft()
2
visibilitySettings = MBAdminVisibilitySettings.visible()
3
// This visibility set the section to be available after 100 seconds
4
visibilitySettings = MBAdminVisibilitySettings.scheduled(availableAt: Date().addingTimeInterval(100))
5
MBAdmin.addSectionToBlock(withBlockId: BLOCK_ID,
6
elements: elements,
7
visibilitySettings: visibilitySettings,
8
success: { sectionId in
9
10
},
11
failure: { error in
12
13
})
Copied!
1
val params = ArrayList<MBAdminGenericParameter>()
2
/*use MBAdminVisibility:
3
* ---- VISIBLE
4
* ---- DRAFT
5
* ---- SCHEDULED: you should add available_at, if -1L or not set uses
6
current time
7
*/
8
params.add(MBAdminVisibilitySettingsParameter(
9
visibility = VISIBILITY, available_at = SECONDS_TIMESTAMP))
10
โ€‹
11
val addSectionListener = object: MBAdminAddSectionListener{
12
override fun onSectionAdded(section_id: Long) {
13
}
14
โ€‹
15
override fun onSectionAddedError(error: String) {
16
}
17
}
18
โ€‹
19
MBurgerAdminTasks.addSection(
20
context = applicationContext,
21
block_id = BLOCK_ID,
22
listener = addSectionListener,
23
params = params,
24
locale = Locale.getDefault().getLanguage());
Copied!
1
// Work in progress
Copied!
1
// POST actions are not available atm on our JS SDK.
2
// If it could be interesting for you, please submit
3
// a feature request here:
4
// https://support.mburger.cloud/hc/en-us/community/topics/360000550497-Feature-Request?
Copied!
1
MBAdminVisibilitySettings visibilitySettings =
2
MBAdminVisibilitySettings.draft();
3
visibilitySettings = MBAdminVisibilitySettings.visible();
4
// This visibility set the section to be available after 100 seconds
5
visibilitySettings = MBAdminVisibilitySettings.scheduled(
6
DateTime.now().add(Duration(seconds: 100)),
7
);
8
await MBAdmin.shared.addSectionToBlock(
9
944,
10
elements,
11
visibilitySettings: visibilitySettings,
12
);
Copied!
Visibility can be set as visible, draft or scheduled. If visibility is set on scheduled, you need to specify
1
available_at
Copied!
โ€‹
Last modified 7mo ago
Copy link