Difference between revisions of "Development:Prana Breath API/Collections:Motivators"

From Olekdia Wiki
(Created page with "<code>motivators</code> - Collection that gives the control over motivators in the app.<br/> __TOC__ <div class="api-table long-code"> == Prefix == * <cod...")
 
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<code>motivators</code> - Collection that gives the control over [[Motivators_tab|motivators]] in the app.<br/>
+
<code>motivators</code> - Сollection that gives control over [[Motivators_tab|motivators]] in the app.<br/>
  
 
__TOC__
 
__TOC__
Line 6: Line 6:
 
== Prefix ==
 
== Prefix ==
 
* <code>pranabreath://</code> - Case-insensitive.  
 
* <code>pranabreath://</code> - Case-insensitive.  
* <code><nowiki>https://olekdia.com/pranabreath/</nowiki></code> - Case-sensitive.  
+
* <code><nowiki>https://pranabreath.olekdia.com/</nowiki></code> - Case-sensitive.  
* <code><nowiki>https://pranabreath.page.link/?link=https://olekdia.com/pranabreath/</nowiki></code> - Case-sensitive.  
+
* <code><nowiki>https://pranabreath.page.link/?link=https://pranabreath.olekdia.com/</nowiki></code> - Case-sensitive.  
  
 
== Syntax ==
 
== Syntax ==
* <code>pranabreath://trainings/item?cmd=[Command]</code> - Case-insensitive.  
+
* <code>pranabreath://motivators/item?cmd=[Command]</code> - Case-insensitive.  
* <code>pranabreath://Trainings/item?[Parameter]=[Value]</code>
+
* <code>pranabreath://motivators/item?[Parameter]=[Value]</code>
* <code>pranabreath://trainings/item?cmd=[Command]&[Parameter1]=[Value1]&[Parameter2]=[Value2]</code>
+
* <code><nowiki>https://pranabreath.olekdia.com/motivators?cmd=[Command]&[Parameter]=[Value]</nowiki></code> - Case-sensitive.
* <code><nowiki>https://olekdia.com/pranabreath/trainings?cmd=[Command]&[Parameter]=[Value]</nowiki></code> - Case-sensitive.
 
  
 
== Commands ==
 
== Commands ==
Line 24: Line 23:
 
==='''list'''===
 
==='''list'''===
 
| Returns training list. Currently it is used only in console for retrieving a training list.
 
| Returns training list. Currently it is used only in console for retrieving a training list.
* <code>pranabreath://trainings?cmd=list</code>  
+
* <code>pranabreath://motivators?cmd=list</code>  
 
<pre>
 
<pre>
pos id public_id name
+
id name
1        Clear mind
+
"Start from Monday" - is that familiar?
2        Relax
+
No more reasons to delay!
3        Calming
+
Find the time for your health!
4        Power
+
The work will still be there, so pause and breath!
5        Harmony
+
Remember, how's that - to breathe freely?
5  6  6        Anti-stress
+
It's time to invest in your health!
6   7 7        Anti-appetite
+
...
7  8  8        Cigarette replace
 
8  9  11        Bhastrika
 
 
</pre>
 
</pre>
* <code>pranabreath://trainings</code> - It is a default command if ''collection'' is defined without an ''item'', so if we omit the ''command'' it will return the same result.
+
* <code>pranabreath://motivators</code> - It is a default command if ''collection'' is defined without an ''item'', so if we omit the ''command'' it will return the same result.
 
|-
 
|-
 
|  
 
|  
 
==='''create'''===
 
==='''create'''===
| Create the training with certain [[#Parameters|parameters]]. If training with such name already exists - new training will not be created. Instead all parameters will be applied to existing training.
+
| Create the motivator with certain [[#Parameters|parameters]]. If motivator with such message already exists - new motivator will be created anyway.
* <code>pranabreath://trainings?cmd=create&name=Serenity&trng_type=1</code> - Create [[Training_kind#Meditation|meditation]] named "Serenity".
+
* <code>pranabreath://motivators?cmd=create&message=TWF5IHRoZSBGb3JjZSBiZSB3aXRoIHlvdSE%3D</code> - Create new motivator. The message should be [https://en.wikipedia.org/wiki/Base64 Base64] encoded for the URL safety.
* <code>pranabreath://trainings?cmd=create&name=4_7_8_Breathing&dur_prep_time=5000&trng_cycles={"mValues":[{"mInhaleUnit":4,"mRetainUnit":7,"mExhaleUnit":8,"mMethodsBitSet":129,"mSecPerUnit":1000}],"mKeys":[0,]}</code> - Create training named "4_7_8_Breathing", with 5 seconds [[Preparing time|preparing time]], and 4:7:8:0 [[Ratio_of_breath_cycle|ratio]].
+
* <code>pranabreath://motivators?cmd=create&message=TWF5IHRoZSBGb3JjZSBiZSB3aXRoIHlvdSE%3D,SGVhbHRoIGlzIGxpdHRsZSBidXQgcmVndWxhciBlZmZvcnRz</code> - Create multiple quantity of motivators, comma-separated each.
 +
|-
 +
|
  
|-
 
|
 
 
==='''delete'''===
 
==='''delete'''===
| Delete the selected training. If there is no selected training - nothing happens.
+
| Delete the selected motivator. If there is no selected motivator - nothing happens.
* <code>pranabreath://trngs/14?cmd=delete</code> - Delete the training with id equals 14.
+
* <code>pranabreath://motivators/14?cmd=delete</code> - Delete the motivator with id equals 14.
* <code>pranabreath://trngs/Relax?cmd=delete</code> - Delete [[Relax]] training.
 
 
|}
 
|}
  
Line 60: Line 56:
 
|-
 
|-
 
|  
 
|  
==='''name'''===
+
==='''message'''===
| Name of the training.  
+
or '''name'''
* <code>pranabreath://trainings/Power?name=Energy</code> - Rename "Power" training to "Energy".
+
| The message of the motivator itself.
* <code>https://olekdia.com/pranabreath/Trainings/5?name=Balance</code> - Rename training with ID equals 5, set name as "Balance".
+
* <code>pranabreath://motivators/11?name=TWF5IHRoZSBGb3JjZSBiZSB3aXRoIHlvdSE%3D</code> - Replace message of the motivator with id equals 11 with the text "May the Force be with you!". Again, the message should be [https://en.wikipedia.org/wiki/Base64 Base64] encoded for the URL safety.
 +
* <code><nowiki>https://pranabreath.olekdia.com/motivators?cmd=create&name=TWF5IHRoZSBGb3JjZSBiZSB3aXRoIHlvdSE%3D</nowiki></code> - Create a motivator with this message.
 
|}
 
|}
 
</div>
 
</div>
  
{{DISPLAYTITLE:<span style="position:absolute; top:-9999px;">Development:</span>Prana Breath API/Collections:Trainings}}
+
{{DISPLAYTITLE:<span style="position:absolute; top:-9999px;">Development:</span>Prana Breath API/Collections:Motivators}}
 
[[Category:Dev{{#translation:}}|^Prana Breath^]]
 
[[Category:Dev{{#translation:}}|^Prana Breath^]]

Latest revision as of 16:06, 1 April 2019

motivators - Сollection that gives control over motivators in the app.

Prefix

  • pranabreath:// - Case-insensitive.
  • https://pranabreath.olekdia.com/ - Case-sensitive.
  • https://pranabreath.page.link/?link=https://pranabreath.olekdia.com/ - Case-sensitive.

Syntax

  • pranabreath://motivators/item?cmd=[Command] - Case-insensitive.
  • pranabreath://motivators/item?[Parameter]=[Value]
  • https://pranabreath.olekdia.com/motivators?cmd=[Command]&[Parameter]=[Value] - Case-sensitive.

Commands

Command Description

list

Returns training list. Currently it is used only in console for retrieving a training list.
  • pranabreath://motivators?cmd=list
id name
1  "Start from Monday" - is that familiar?
2  No more reasons to delay!
3  Find the time for your health!
4  The work will still be there, so pause and breath!
5  Remember, how's that - to breathe freely?
6  It's time to invest in your health!
...
  • pranabreath://motivators - It is a default command if collection is defined without an item, so if we omit the command it will return the same result.

create

Create the motivator with certain parameters. If motivator with such message already exists - new motivator will be created anyway.
  • pranabreath://motivators?cmd=create&message=TWF5IHRoZSBGb3JjZSBiZSB3aXRoIHlvdSE%3D - Create new motivator. The message should be Base64 encoded for the URL safety.
  • pranabreath://motivators?cmd=create&message=TWF5IHRoZSBGb3JjZSBiZSB3aXRoIHlvdSE%3D,SGVhbHRoIGlzIGxpdHRsZSBidXQgcmVndWxhciBlZmZvcnRz - Create multiple quantity of motivators, comma-separated each.

delete

Delete the selected motivator. If there is no selected motivator - nothing happens.
  • pranabreath://motivators/14?cmd=delete - Delete the motivator with id equals 14.

Parameters

Parameter Description

message

or name

The message of the motivator itself.
  • pranabreath://motivators/11?name=TWF5IHRoZSBGb3JjZSBiZSB3aXRoIHlvdSE%3D - Replace message of the motivator with id equals 11 with the text "May the Force be with you!". Again, the message should be Base64 encoded for the URL safety.
  • https://pranabreath.olekdia.com/motivators?cmd=create&name=TWF5IHRoZSBGb3JjZSBiZSB3aXRoIHlvdSE%3D - Create a motivator with this message.