File tree Expand file tree Collapse file tree 6 files changed +26
-1
lines changed
Expand file tree Collapse file tree 6 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,28 @@ import {ExpressionQualifier} from "../qualifiers/expression/ExpressionQualifier"
88 * Defines a new user variable with the given value.
99 * @memberOf Actions
1010 * @namespace Variable
11+ * @example
12+ * import {Cloudinary} from "@cloudinary/base/instance/Cloudinary";
13+ * import {
14+ * set,
15+ * setAssetReference,
16+ * setFromContext,
17+ * setFromMetadata
18+ * } from "@cloudinary/base/actions/variable";
19+ * import {scale} from "@cloudinary/base/actions/resize";
20+ *
21+ * const yourCldInstance = new Cloudinary({cloud:{cloudName:'demo'}});
22+ *
23+ * const image = yourCldInstance.image('woman');
24+ * image
25+ * .addVariable(set('foo1', 100))
26+ * .addVariable(setAssetReference('foo2', 'val'))
27+ * .addVariable(setFromContext('foo3', 'val'))
28+ * .addVariable(setFromMetadata('foo4', 'val'))
29+ * .resize(scale().width('$foo1').height('$foo2'))
1130 */
1231
32+
1333/**
1434 * @summary action
1535 * @description Sets a new user variable with the given value.
Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ import {ExpressionQualifier} from "../../qualifiers/expression/ExpressionQualifi
55/**
66 * @description Sets a user-defined variable.
77 * @memberOf Actions.Variable
8- * @extends {Variable.VariableAction }
8+ * @extends Variable.VariableAction
9+ * @see Visit {@link Actions.Variable|Variable} for an example
910 */
1011class SetAction extends VariableAction {
1112 constructor ( name : string , value : number | string | string [ ] | number [ ] | ExpressionQualifier ) {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import VariableAction from "./VariableAction";
44 * @description Sets a user-defined variable from a file reference.
55 * @memberOf Actions.Variable
66 * @extends {Variable.VariableAction }
7+ * @see Visit {@link Actions.Variable|Variable} for an example
78 */
89class SetAssetReferenceAction extends VariableAction {
910 constructor ( name : string , value : string ) {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import VariableAction from "./VariableAction";
44 * @description Sets a user-defined variable from contextual metadata.
55 * @memberOf Actions.Variable
66 * @extends {Variable.VariableAction }
7+ * @see Visit {@link Actions.Variable|Variable} for an example
78 */
89class SetFromContextAction extends VariableAction {
910 constructor ( name : string , value : string ) {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import VariableAction from "./VariableAction";
44 * @description Sets a user-defined variable from structured metadata.
55 * @memberOf Actions.Variable
66 * @extends {Variable.VariableAction }
7+ * @see Visit {@link Actions.Variable|Variable} for an example
78 */
89class SetFromMetadataAction extends VariableAction {
910 constructor ( name : string , value : string ) {
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ type TypeVariableValue = number | string | ExpressionQualifier;
99 * @description Defines an new user variable.
1010 * @memberOf Actions.Variable
1111 * @extends SDK.Action
12+ * @see Visit {@link Actions.Variable|Variable} for an example
1213 */
1314class VariableAction extends Action {
1415 private isFloat = false ;
You can’t perform that action at this time.
0 commit comments