Skip to content

Commit c1632fc

Browse files
Review: remove duplicate parts with the official API docs
1 parent e351dc5 commit c1632fc

1 file changed

Lines changed: 2 additions & 130 deletions

File tree

  • content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/pluggable-widgets/pluggable-widgets-client-apis

content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/pluggable-widgets/pluggable-widgets-client-apis/_index.md

Lines changed: 2 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -493,50 +493,12 @@ if (selection.type === "Single") {
493493

494494
The Mendix Platform exposes a `mendix/session` module for inspecting the current user session. It is available in both web and native.
495495

496-
```ts
497-
import { getUserId, getUserName, getUserRoleNames, isGuest, getCSRFToken } from "mendix/session";
498-
```
499-
500-
#### getUserId {#getuserid}
501-
502-
Returns the current user's GUID as a `string`.
496+
For instance, `getUserId` returns the current user's GUID as a `string`.
503497

504498
```ts
505499
function getUserId(): GUID;
506500
```
507501

508-
#### getUserName {#getusername}
509-
510-
Returns the `Name` attribute of the current user.
511-
512-
```ts
513-
function getUserName(): string;
514-
```
515-
516-
#### getUserRoleNames {#getuserrolenames}
517-
518-
Returns the names of the current user's roles.
519-
520-
```ts
521-
function getUserRoleNames(): string[];
522-
```
523-
524-
#### isGuest {#isguest}
525-
526-
Returns `true` if the current session is anonymous, `false` otherwise.
527-
528-
```ts
529-
function isGuest(): boolean;
530-
```
531-
532-
#### getCSRFToken {#getcsrftoken}
533-
534-
Returns the CSRF token for the current session.
535-
536-
```ts
537-
function getCSRFToken(): string;
538-
```
539-
540502
---
541503

542504
### Parser {#parser}
@@ -558,97 +520,7 @@ interface FormatValueConfig {
558520
}
559521
```
560522

561-
#### formatValue {#formatvalue}
562-
563-
Converts a value to its locale-formatted string representation.
564-
565-
```ts
566-
function formatValue(value: unknown, type: AttributeType, config?: FormatValueConfig): string;
567-
```
568-
569-
| Parameter | Type | Description |
570-
|:----------|:--------------------|:------------------------------------------------------------------------------------------------------------|
571-
| `value` | `unknown` | The value to format. |
572-
| `type` | `AttributeType` | The attribute type to use when interpreting the value (for example `"Decimal"`, `"DateTime"`, `"Boolean"`). |
573-
| `config` | `FormatValueConfig` | Optional formatting configuration. |
574-
575-
**Configuration options:**
576-
577-
* `config.selector` — for date conversions: format only the `"date"`, `"time"`, or `"datetime"` part.
578-
* `config.datePattern` — for date conversions: a custom date pattern (see the date pattern table below).
579-
* `config.places` — for numeric conversions: number of decimal digits to display (`-1` to keep original precision).
580-
* `config.groups` — for numeric conversions: whether to include group separators.
581-
582-
```ts
583-
formatValue(Big(3000), "Decimal", { places: 2 }); // "3,000.00"
584-
formatValue(+new Date(1980, 7, 23), "DateTime", { datePattern: "dd-MM-yyyy" }); // "23-08-1980"
585-
```
586-
587-
#### parseValue {#parsevalue}
588-
589-
Converts a locale-formatted string back to a typed value.
590-
591-
```ts
592-
function parseValue(value: string, type: AttributeType, config?: FormatValueConfig): Option<AttributeValue>;
593-
```
594-
595-
| Parameter | Type | Description |
596-
|:----------|:--------------------|:-------------------------------------------------------------------|
597-
| `value` | `string` | The string to parse. |
598-
| `type` | `AttributeType` | The attribute type to use when interpreting the value. |
599-
| `config` | `FormatValueConfig` | Optional formatting configuration (same options as `formatValue`). |
600-
601-
The return type depends on the attribute type:
602-
603-
| Attribute Type | Return Type |
604-
|:-----------------------------|:------------|
605-
| `Integer`, `Long`, `Decimal` | `Big` |
606-
| `AutoNumber` | `string` |
607-
| `DateTime` | `Date` |
608-
| `Enum` | `string` |
609-
| `String` | `string` |
610-
| `Boolean` | `boolean` |
611-
612-
If the string cannot be parsed, the function returns `undefined`.
613-
614-
```ts
615-
parseValue("3,000.00", "Decimal"); // Big(3000)
616-
parseValue("23-8-1980", "DateTime", { datePattern: "dd-M-yyyy" }); // Date(1980, 7, 23)
617-
```
618-
619-
#### Date Pattern Reference {#date-pattern}
620-
621-
The `datePattern` option accepts a string composed of the following tokens:
622-
623-
| Letter | Date or Time Component | Examples |
624-
|:-------|:----------------------------------------------------|:---------|
625-
| `M` | Month in year, digit | 1 |
626-
| `MM` | Month in year, digit with leading zero | 01 |
627-
| `MMM` | Month in year, abbreviated (context sensitive) | Nov |
628-
| `MMMM` | Month in year (context sensitive) | November |
629-
| `L` | Month in year, digit (standalone) | 1 |
630-
| `LL` | Month in year, digit with leading zero (standalone) | 01 |
631-
| `LLL` | Month in year, abbreviated (standalone) | Nov |
632-
| `LLLL` | Month in year (standalone) | November |
633-
| `yy` | Year, two digits | 01 |
634-
| `yyyy` | Year, four digits | 2001 |
635-
| `G` | Era designator | AD |
636-
| `E` | Day name in week, abbreviated | Tue |
637-
| `EEEE` | Day name in week | Tuesday |
638-
| `u` | Day of week (1 = Monday, …, 7 = Sunday) | 5 |
639-
| `w` | Week in year | 11 |
640-
| `W` | Week in month | 2 |
641-
| `D` | Day in year | 133 |
642-
| `d` | Day in month | 7 |
643-
| `F` | Day of week in month | 1 |
644-
| `a` | AM/PM marker | PM |
645-
| `H` | Hour in day (0–23) | 0 |
646-
| `k` | Hour in day (1–24) | 24 |
647-
| `K` | Hour in AM/PM (0–11) | 0 |
648-
| `h` | Hour in AM/PM (1–12) | 12 |
649-
| `m` | Minute in hour | 24 |
650-
| `s` | Second in minute | 50 |
651-
| `S` | Millisecond | 201 |
523+
For the reference of the API, you can refer to the [API documentation](/apidocs-mxsdk/apidocs/pluggable-widgets-client-apis-parser/).
652524

653525
### Icon {#icon}
654526

0 commit comments

Comments
 (0)