@cparra/apexdocs 2.25.0-alpha.6 → 2.25.0-alpha.9
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.
- package/dist/cli/generate.js +192 -225
- package/dist/index.d.ts +51 -13
- package/examples/plain-markdown/docs/index.md +25 -33
- package/examples/plain-markdown/docs/{Miscellaneous/ns.BaseClass.md → miscellaneous/BaseClass.md} +1 -1
- package/examples/plain-markdown/docs/{Miscellaneous/ns.MultiInheritanceClass.md → miscellaneous/MultiInheritanceClass.md} +5 -6
- package/examples/plain-markdown/docs/{Miscellaneous/ns.SampleException.md → miscellaneous/SampleException.md} +3 -4
- package/examples/plain-markdown/docs/{Miscellaneous/ns.SampleInterface.md → miscellaneous/SampleInterface.md} +22 -29
- package/examples/plain-markdown/docs/{Miscellaneous/ns.Url.md → miscellaneous/Url.md} +32 -43
- package/examples/plain-markdown/docs/sample-enums/SampleEnum.md +36 -0
- package/examples/plain-markdown/docs/{SampleGroup/ns.SampleClass.md → samplegroup/SampleClass.md} +8 -11
- package/examples/vitepress/apexdocs.config.ts +1 -3
- package/examples/vitepress/docs/.vitepress/sidebar.json +18 -18
- package/examples/vitepress/docs/index.md +11 -82
- package/examples/vitepress/docs/{Miscellaneous/apexdocs.BaseClass.md → miscellaneous/BaseClass.md} +1 -1
- package/examples/vitepress/docs/{Miscellaneous/apexdocs.MultiInheritanceClass.md → miscellaneous/MultiInheritanceClass.md} +4 -6
- package/examples/vitepress/docs/{Miscellaneous/apexdocs.SampleException.md → miscellaneous/SampleException.md} +1 -1
- package/examples/vitepress/docs/{Miscellaneous/apexdocs.SampleInterface.md → miscellaneous/SampleInterface.md} +22 -28
- package/examples/vitepress/docs/{Miscellaneous/apexdocs.Url.md → miscellaneous/Url.md} +31 -32
- package/examples/vitepress/docs/sample-enums/SampleEnum.md +40 -0
- package/examples/vitepress/docs/{SampleGroup/apexdocs.SampleClass.md → samplegroup/SampleClass.md} +6 -10
- package/examples/vitepress/force-app/main/default/classes/Url.cls +7 -4
- package/package.json +1 -1
- package/src/application/apex-file-reader.ts +3 -3
- package/src/application/file-writer.ts +5 -9
- package/src/application/generators/markdown.ts +9 -4
- package/src/application/generators/openapi.ts +4 -4
- package/src/core/markdown/__test__/generating-class-docs.spec.ts +11 -3
- package/src/core/markdown/__test__/generating-enum-docs.spec.ts +7 -3
- package/src/core/markdown/__test__/generating-interface-docs.spec.ts +11 -3
- package/src/core/markdown/__test__/generating-reference-guide.spec.ts +3 -7
- package/src/core/markdown/__test__/test-helpers.ts +3 -3
- package/src/core/markdown/adapters/__tests__/interface-adapter.spec.ts +40 -5
- package/src/core/markdown/adapters/apex-types.ts +3 -2
- package/src/core/markdown/adapters/documentables.ts +49 -68
- package/src/core/markdown/adapters/reference-guide.ts +35 -0
- package/src/core/markdown/adapters/renderable-bundle.ts +43 -119
- package/src/core/markdown/adapters/renderable-to-page-data.ts +12 -15
- package/src/core/markdown/adapters/types.d.ts +5 -8
- package/src/core/markdown/generate-docs.ts +99 -42
- package/src/core/markdown/reflection/inheritance-chain-expanion.ts +1 -1
- package/src/core/markdown/reflection/reflect-source.ts +8 -4
- package/src/core/markdown/templates/documentable-partial-template.ts +1 -1
- package/src/core/openapi/manifest-factory.ts +2 -2
- package/src/core/openapi/openapi-type-file.ts +1 -3
- package/src/core/openapi/parser.ts +4 -4
- package/src/core/shared/types.d.ts +52 -14
- package/src/index.ts +2 -1
- package/examples/plain-markdown/docs/Sample-Enums/ns.SampleEnum.md +0 -38
- package/examples/vitepress/docs/Sample-Enums/apexdocs.SampleEnum.md +0 -41
- /package/examples/plain-markdown/docs/{Miscellaneous/ns.ParentInterface.md → miscellaneous/ParentInterface.md} +0 -0
- /package/examples/plain-markdown/docs/{Miscellaneous/ns.ReferencedEnum.md → miscellaneous/ReferencedEnum.md} +0 -0
- /package/examples/vitepress/docs/{Miscellaneous/apexdocs.ParentInterface.md → miscellaneous/ParentInterface.md} +0 -0
- /package/examples/vitepress/docs/{Miscellaneous/apexdocs.ReferencedEnum.md → miscellaneous/ReferencedEnum.md} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { SetOptional } from 'type-fest';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* The configurable hooks that can be used to modify the output of the generator.
|
|
5
|
+
*/
|
|
3
6
|
type ConfigurableHooks = {
|
|
4
7
|
transformReferenceGuide: TransformReferenceGuide;
|
|
5
8
|
transformDocs: TransformDocs;
|
|
6
9
|
transformDocPage: TransformDocPage;
|
|
10
|
+
transformReference: TransformReference;
|
|
7
11
|
};
|
|
8
12
|
|
|
9
13
|
type UserDefinedMarkdownConfig = {
|
|
@@ -17,46 +21,80 @@ type UserDefinedMarkdownConfig = {
|
|
|
17
21
|
includeMetadata: boolean;
|
|
18
22
|
} & Partial<ConfigurableHooks>;
|
|
19
23
|
|
|
24
|
+
type SourceFileMetadata = {
|
|
25
|
+
filePath: string;
|
|
26
|
+
name: string;
|
|
27
|
+
type: 'interface' | 'class' | 'enum';
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type DocPageReference = {
|
|
31
|
+
source: SourceFileMetadata;
|
|
32
|
+
// The name under which the type should be displayed in the documentation.
|
|
33
|
+
// By default, this will match the source.name, but it can be configured by the user.
|
|
34
|
+
displayName: string;
|
|
35
|
+
// The location of the file relative to the root of the documentation.
|
|
36
|
+
pathFromRoot: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
20
39
|
type Frontmatter = string | Record<string, unknown> | null;
|
|
21
40
|
|
|
22
41
|
type ReferenceGuidePageData = {
|
|
23
|
-
directory: string;
|
|
24
42
|
frontmatter: Frontmatter;
|
|
25
43
|
content: string;
|
|
26
|
-
|
|
27
|
-
fileName: string;
|
|
44
|
+
filePath: string;
|
|
28
45
|
};
|
|
29
46
|
|
|
30
47
|
type DocPageData = {
|
|
31
|
-
source:
|
|
32
|
-
filePath: string;
|
|
33
|
-
name: string;
|
|
34
|
-
type: 'interface' | 'class' | 'enum';
|
|
35
|
-
};
|
|
48
|
+
source: SourceFileMetadata;
|
|
36
49
|
group: string | null;
|
|
37
|
-
|
|
38
|
-
fileExtension: string;
|
|
39
|
-
directory: string;
|
|
50
|
+
filePath: string;
|
|
40
51
|
frontmatter: Frontmatter;
|
|
41
52
|
content: string;
|
|
42
53
|
};
|
|
43
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Represents a file to be skipped.
|
|
57
|
+
*/
|
|
44
58
|
type Skip = {
|
|
45
59
|
readonly _tag: 'Skip';
|
|
46
60
|
};
|
|
47
61
|
|
|
48
62
|
// Configurable Hooks
|
|
49
63
|
|
|
64
|
+
type ConfigurableDocPageReference = Omit<DocPageReference, 'source'>;
|
|
65
|
+
|
|
66
|
+
type ConfigurableDocPageData = Omit<DocPageData, 'source' | 'filePath'>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Allows changing where the files are written to.
|
|
70
|
+
*/
|
|
71
|
+
type TransformReference = (
|
|
72
|
+
reference: DocPageReference,
|
|
73
|
+
) => Partial<ConfigurableDocPageReference> | Promise<ConfigurableDocPageReference>;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Allows changing the frontmatter and content of the reference guide, or even if creating a reference
|
|
77
|
+
* guide will be skipped altogether.
|
|
78
|
+
*/
|
|
50
79
|
type TransformReferenceGuide = (
|
|
51
80
|
referenceGuide: ReferenceGuidePageData,
|
|
52
81
|
) => Partial<ReferenceGuidePageData> | Skip | Promise<Partial<ReferenceGuidePageData> | Skip>;
|
|
53
82
|
|
|
83
|
+
/**
|
|
84
|
+
* The main purpose if for allowing for doc pages to be skipped, but it can also be used to change the frontmatter
|
|
85
|
+
* and content of the doc pages.
|
|
86
|
+
*/
|
|
54
87
|
type TransformDocs = (docs: DocPageData[]) => DocPageData[] | Promise<DocPageData[]>;
|
|
55
88
|
|
|
56
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Allows changing the frontmatter and content of the doc pages.
|
|
91
|
+
*/
|
|
92
|
+
type TransformDocPage = (
|
|
93
|
+
doc: DocPageData,
|
|
94
|
+
) => Partial<ConfigurableDocPageData> | Promise<Partial<ConfigurableDocPageData>>;
|
|
57
95
|
|
|
58
96
|
type ConfigurableMarkdownConfig = Omit<SetOptional<UserDefinedMarkdownConfig, 'targetDir' | 'scope' | 'defaultGroupName' | 'includeMetadata' | 'sortMembersAlphabetically'>, 'targetGenerator'>;
|
|
59
97
|
declare function defineMarkdownConfig(config: ConfigurableMarkdownConfig): UserDefinedMarkdownConfig;
|
|
60
98
|
declare function skip(): Skip;
|
|
61
99
|
|
|
62
|
-
export { type ConfigurableHooks, type DocPageData, type ReferenceGuidePageData, defineMarkdownConfig, skip };
|
|
100
|
+
export { type ConfigurableHooks, type DocPageData, type DocPageReference, type ReferenceGuidePageData, defineMarkdownConfig, skip };
|
|
@@ -2,36 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
## Miscellaneous
|
|
4
4
|
|
|
5
|
-
### [
|
|
5
|
+
### [BaseClass](miscellaneous/BaseClass.md)
|
|
6
6
|
|
|
7
|
-
### [
|
|
7
|
+
### [MultiInheritanceClass](miscellaneous/MultiInheritanceClass.md)
|
|
8
8
|
|
|
9
|
-
### [
|
|
9
|
+
### [ParentInterface](miscellaneous/ParentInterface.md)
|
|
10
10
|
|
|
11
|
-
### [
|
|
11
|
+
### [ReferencedEnum](miscellaneous/ReferencedEnum.md)
|
|
12
12
|
|
|
13
|
-
### [
|
|
13
|
+
### [SampleException](miscellaneous/SampleException.md)
|
|
14
14
|
|
|
15
15
|
This is a sample exception.
|
|
16
16
|
|
|
17
|
-
### [
|
|
17
|
+
### [SampleInterface](miscellaneous/SampleInterface.md)
|
|
18
18
|
|
|
19
19
|
This is a sample interface
|
|
20
20
|
|
|
21
|
-
### [
|
|
21
|
+
### [Url](miscellaneous/Url.md)
|
|
22
22
|
|
|
23
23
|
Represents a uniform resource locator (URL) and provides access to parts of the URL.
|
|
24
|
-
|
|
25
24
|
Enables access to the base URL used to access your Salesforce org.
|
|
26
|
-
|
|
25
|
+
|
|
27
26
|
## Usage
|
|
28
|
-
|
|
29
27
|
Use the methods of the `System.URL` class to create links to objects in your organization. Such objects can be files, images,
|
|
30
|
-
|
|
31
28
|
logos, or records that you want to include in external emails, in activities, or in Chatter posts. For example, you can create
|
|
32
|
-
|
|
33
29
|
a link to a file uploaded as an attachment to a Chatter post by concatenating the Salesforce base URL with the file ID:
|
|
34
|
-
|
|
30
|
+
|
|
35
31
|
```apex
|
|
36
32
|
// Get a file uploaded through Chatter.
|
|
37
33
|
ContentDocument doc = [SELECT Id FROM ContentDocument
|
|
@@ -42,76 +38,72 @@ String fullFileURL = URL.getOrgDomainURL().toExternalForm() +
|
|
|
42
38
|
system.debug(fullFileURL);
|
|
43
39
|
```
|
|
44
40
|
|
|
41
|
+
|
|
45
42
|
The following example creates a link to a Salesforce record. The full URL is created by concatenating the Salesforce base
|
|
46
|
-
|
|
47
43
|
URL with the record ID.
|
|
48
|
-
|
|
44
|
+
|
|
49
45
|
```ape
|
|
50
46
|
Account acct = [SELECT Id FROM Account WHERE Name = 'Acme' LIMIT 1];
|
|
51
47
|
String fullRecordURL = URL.getOrgDomainURL().toExternalForm() + '/' + acct.Id;
|
|
52
48
|
```
|
|
53
49
|
|
|
50
|
+
|
|
54
51
|
## Example
|
|
55
|
-
|
|
56
52
|
In this example, the base URL and the full request URL of the current Salesforce server instance are retrieved. Next, a URL
|
|
57
|
-
|
|
58
53
|
pointing to a specific account object is created. Finally, components of the base and full URL are obtained. This example
|
|
59
|
-
|
|
60
54
|
prints out all the results to the debug log output.
|
|
61
|
-
|
|
55
|
+
|
|
62
56
|
```apex
|
|
63
57
|
// Create a new account called Acme that we will create a link for later.
|
|
64
58
|
Account myAccount = new Account(Name='Acme');
|
|
65
59
|
insert myAccount;
|
|
60
|
+
|
|
66
61
|
// Get the base URL.
|
|
67
62
|
String sfdcBaseURL = URL.getOrgDomainURL().toExternalForm();
|
|
68
63
|
System.debug('Base URL: ' + sfdcBaseURL );
|
|
64
|
+
|
|
69
65
|
// Get the URL for the current request.
|
|
70
66
|
String currentRequestURL = URL.getCurrentRequestUrl().toExternalForm();
|
|
71
67
|
System.debug('Current request URL: ' + currentRequestURL);
|
|
68
|
+
|
|
72
69
|
// Create the account URL from the base URL.
|
|
73
70
|
String accountURL = URL.getOrgDomainURL().toExternalForm() +
|
|
74
71
|
'/' + myAccount.Id;
|
|
75
72
|
System.debug('URL of a particular account: ' + accountURL);
|
|
73
|
+
|
|
76
74
|
// Get some parts of the base URL.
|
|
77
75
|
System.debug('Host: ' + URL.getOrgDomainURL().getHost());
|
|
78
76
|
System.debug('Protocol: ' + URL.getOrgDomainURL().getProtocol());
|
|
77
|
+
|
|
79
78
|
// Get the query string of the current request.
|
|
80
79
|
System.debug('Query: ' + URL.getCurrentRequestUrl().getQuery());
|
|
81
80
|
```
|
|
82
81
|
|
|
82
|
+
|
|
83
83
|
## Version Behavior Changes
|
|
84
|
-
|
|
85
84
|
In API version 41.0 and later, Apex URL objects are represented by the java.net.URI type, not the java.net.URL type.
|
|
86
|
-
|
|
87
85
|
The API version in which the URL object was instantiated determines the behavior of subsequent method calls to the
|
|
88
|
-
|
|
89
86
|
specific instance. Salesforce strongly encourages you to use API 41.0 and later versions for fully RFC-compliant URL
|
|
90
|
-
|
|
91
87
|
parsing that includes proper handling of edge cases of complex URL structures. API 41.0 and later versions also enforce
|
|
92
|
-
|
|
93
88
|
that inputs are valid, RFC-compliant URL or URI strings.
|
|
94
|
-
|
|
89
|
+
|
|
95
90
|
* [URL Constructors](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_url.htm#apex_System_URL_constructors)
|
|
96
|
-
|
|
97
91
|
* [URL Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_url.htm#apex_System_URL_methods)
|
|
98
|
-
|
|
92
|
+
|
|
99
93
|
**See Also**
|
|
100
|
-
|
|
101
94
|
* [URL Class](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_url.htm)
|
|
102
95
|
|
|
103
96
|
## Sample Enums
|
|
104
97
|
|
|
105
|
-
### [
|
|
106
|
-
|
|
107
|
-
This is a sample enum. This references [ns.ReferencedEnum](./Miscellaneous/ns.ReferencedEnum.md) .
|
|
98
|
+
### [SampleEnum](sample-enums/SampleEnum.md)
|
|
108
99
|
|
|
100
|
+
This is a sample enum. This references [ReferencedEnum](miscellaneous/ReferencedEnum.md) .
|
|
101
|
+
|
|
109
102
|
This description has several lines
|
|
110
103
|
|
|
111
104
|
## SampleGroup
|
|
112
105
|
|
|
113
|
-
### [
|
|
106
|
+
### [SampleClass](samplegroup/SampleClass.md)
|
|
114
107
|
|
|
115
108
|
aliquip ex sunt officia ullamco anim deserunt magna aliquip nisi eiusmod in sit officia veniam ex
|
|
116
|
-
|
|
117
109
|
deserunt ea officia exercitation laboris enim in duis quis enim eiusmod eu amet cupidatat.
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
ns
|
|
5
5
|
|
|
6
6
|
**Inheritance**
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
[SampleClass](../samplegroup/SampleClass.md) < [BaseClass](../miscellaneous/BaseClass.md)
|
|
8
9
|
|
|
9
10
|
## Fields
|
|
10
11
|
### `sampleEnumFromBase`
|
|
@@ -17,7 +18,7 @@ public sampleEnumFromBase
|
|
|
17
18
|
```
|
|
18
19
|
|
|
19
20
|
#### Type
|
|
20
|
-
[
|
|
21
|
+
[SampleEnum](../sample-enums/SampleEnum.md)
|
|
21
22
|
|
|
22
23
|
## Properties
|
|
23
24
|
### Group Name
|
|
@@ -67,7 +68,5 @@ public virtual String sayHello()
|
|
|
67
68
|
A string value.
|
|
68
69
|
|
|
69
70
|
##### Example
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
sample.doSomething();
|
|
73
|
-
```
|
|
71
|
+
SampleClass sample = new SampleClass();
|
|
72
|
+
sample.doSomething();
|
|
@@ -5,11 +5,9 @@ This is a sample exception.
|
|
|
5
5
|
**Usage**
|
|
6
6
|
|
|
7
7
|
You can use the exception the following way.
|
|
8
|
-
|
|
9
|
-
You can also take a look at [ns.SampleClass](../SampleGroup/ns.SampleClass.md) to see how it is used.
|
|
10
|
-
|
|
8
|
+
You can also take a look at [SampleClass](../samplegroup/SampleClass.md) to see how it is used.
|
|
11
9
|
This is a dangerous HTML tag: <script>alert('Hello');</script>
|
|
12
|
-
|
|
10
|
+
|
|
13
11
|
```apex
|
|
14
12
|
try {
|
|
15
13
|
throw new SampleException();
|
|
@@ -22,4 +20,5 @@ try {
|
|
|
22
20
|
ns
|
|
23
21
|
|
|
24
22
|
**Inheritance**
|
|
23
|
+
|
|
25
24
|
Exception
|
|
@@ -4,33 +4,30 @@
|
|
|
4
4
|
|
|
5
5
|
This is a sample interface
|
|
6
6
|
|
|
7
|
+
**Mermaid**
|
|
8
|
+
|
|
9
|
+
graph TD
|
|
10
|
+
A[SampleInterface] -->|extends| B[ParentInterface]
|
|
11
|
+
B -->|extends| C[GrandParentInterface]
|
|
12
|
+
C -->|extends| D[GreatGrandParentInterface]
|
|
13
|
+
|
|
7
14
|
**Author** John Doe
|
|
8
15
|
|
|
9
16
|
**Date** 2020-01-01
|
|
10
17
|
|
|
11
|
-
**See** [
|
|
18
|
+
**See** [SampleEnum](../sample-enums/SampleEnum.md)
|
|
12
19
|
|
|
13
|
-
**See** [
|
|
20
|
+
**See** [ReferencedEnum](../miscellaneous/ReferencedEnum.md)
|
|
14
21
|
|
|
15
22
|
## Namespace
|
|
16
23
|
ns
|
|
17
24
|
|
|
18
|
-
## Diagram
|
|
19
|
-
```mermaid
|
|
20
|
-
graph TD
|
|
21
|
-
A[SampleInterface] -->|extends| B[ParentInterface]
|
|
22
|
-
B -->|extends| C[GrandParentInterface]
|
|
23
|
-
C -->|extends| D[GreatGrandParentInterface]
|
|
24
|
-
```
|
|
25
|
-
|
|
26
25
|
## Example
|
|
27
|
-
|
|
28
|
-
SampleInterface sampleInterface = new SampleInterface();
|
|
26
|
+
SampleInterface sampleInterface = new SampleInterface();
|
|
29
27
|
sampleInterface.sampleMethod();
|
|
30
|
-
```
|
|
31
28
|
|
|
32
29
|
**Extends**
|
|
33
|
-
[
|
|
30
|
+
[ParentInterface](../miscellaneous/ParentInterface.md)
|
|
34
31
|
|
|
35
32
|
## Methods
|
|
36
33
|
### `sampleMethod()`
|
|
@@ -47,6 +44,13 @@ This is a custom tag
|
|
|
47
44
|
|
|
48
45
|
This is another custom tag
|
|
49
46
|
|
|
47
|
+
**Mermaid**
|
|
48
|
+
|
|
49
|
+
graph TD
|
|
50
|
+
A[SampleInterface] -->|extends| B[ParentInterface]
|
|
51
|
+
B -->|extends| C[GrandParentInterface]
|
|
52
|
+
C -->|extends| D[GreatGrandParentInterface]
|
|
53
|
+
|
|
50
54
|
#### Signature
|
|
51
55
|
```apex
|
|
52
56
|
public String sampleMethod()
|
|
@@ -58,23 +62,13 @@ public String sampleMethod()
|
|
|
58
62
|
Some return value
|
|
59
63
|
|
|
60
64
|
#### Throws
|
|
61
|
-
[
|
|
65
|
+
[SampleException](../miscellaneous/SampleException.md): This is a sample exception
|
|
62
66
|
|
|
63
67
|
AnotherSampleException: This is another sample exception
|
|
64
68
|
|
|
65
|
-
#### Diagram
|
|
66
|
-
```mermaid
|
|
67
|
-
graph TD
|
|
68
|
-
A[SampleInterface] -->|extends| B[ParentInterface]
|
|
69
|
-
B -->|extends| C[GrandParentInterface]
|
|
70
|
-
C -->|extends| D[GreatGrandParentInterface]
|
|
71
|
-
```
|
|
72
|
-
|
|
73
69
|
#### Example
|
|
74
|
-
|
|
75
|
-
SampleInterface sampleInterface = new SampleInterface();
|
|
70
|
+
SampleInterface sampleInterface = new SampleInterface();
|
|
76
71
|
sampleInterface.sampleMethod();
|
|
77
|
-
```
|
|
78
72
|
|
|
79
73
|
---
|
|
80
74
|
|
|
@@ -84,7 +78,6 @@ sampleInterface.sampleMethod();
|
|
|
84
78
|
`DEPRECATED`
|
|
85
79
|
|
|
86
80
|
This is a sample method with parameters
|
|
87
|
-
|
|
88
81
|
Sometimes it won't be possible to find a NonExistent link.
|
|
89
82
|
|
|
90
83
|
#### Signature
|
|
@@ -97,10 +90,10 @@ public SampleEnum sampleMethodWithParams(String param1, Integer param2, SampleEn
|
|
|
97
90
|
|------|------|-------------|
|
|
98
91
|
| param1 | String | This is the first parameter |
|
|
99
92
|
| param2 | Integer | This is the second parameter |
|
|
100
|
-
| theEnum | [
|
|
93
|
+
| theEnum | [SampleEnum](../sample-enums/SampleEnum.md) | This is an enum parameter |
|
|
101
94
|
|
|
102
95
|
#### Return Type
|
|
103
|
-
**[
|
|
96
|
+
**[SampleEnum](../sample-enums/SampleEnum.md)**
|
|
104
97
|
|
|
105
98
|
Some return value
|
|
106
99
|
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
# Url Class
|
|
2
2
|
|
|
3
3
|
Represents a uniform resource locator (URL) and provides access to parts of the URL.
|
|
4
|
-
|
|
5
4
|
Enables access to the base URL used to access your Salesforce org.
|
|
6
|
-
|
|
5
|
+
|
|
7
6
|
## Usage
|
|
8
|
-
|
|
9
7
|
Use the methods of the `System.URL` class to create links to objects in your organization. Such objects can be files, images,
|
|
10
|
-
|
|
11
8
|
logos, or records that you want to include in external emails, in activities, or in Chatter posts. For example, you can create
|
|
12
|
-
|
|
13
9
|
a link to a file uploaded as an attachment to a Chatter post by concatenating the Salesforce base URL with the file ID:
|
|
14
|
-
|
|
10
|
+
|
|
15
11
|
```apex
|
|
16
12
|
// Get a file uploaded through Chatter.
|
|
17
13
|
ContentDocument doc = [SELECT Id FROM ContentDocument
|
|
@@ -22,62 +18,59 @@ String fullFileURL = URL.getOrgDomainURL().toExternalForm() +
|
|
|
22
18
|
system.debug(fullFileURL);
|
|
23
19
|
```
|
|
24
20
|
|
|
21
|
+
|
|
25
22
|
The following example creates a link to a Salesforce record. The full URL is created by concatenating the Salesforce base
|
|
26
|
-
|
|
27
23
|
URL with the record ID.
|
|
28
|
-
|
|
24
|
+
|
|
29
25
|
```ape
|
|
30
26
|
Account acct = [SELECT Id FROM Account WHERE Name = 'Acme' LIMIT 1];
|
|
31
27
|
String fullRecordURL = URL.getOrgDomainURL().toExternalForm() + '/' + acct.Id;
|
|
32
28
|
```
|
|
33
29
|
|
|
30
|
+
|
|
34
31
|
## Example
|
|
35
|
-
|
|
36
32
|
In this example, the base URL and the full request URL of the current Salesforce server instance are retrieved. Next, a URL
|
|
37
|
-
|
|
38
33
|
pointing to a specific account object is created. Finally, components of the base and full URL are obtained. This example
|
|
39
|
-
|
|
40
34
|
prints out all the results to the debug log output.
|
|
41
|
-
|
|
35
|
+
|
|
42
36
|
```apex
|
|
43
37
|
// Create a new account called Acme that we will create a link for later.
|
|
44
38
|
Account myAccount = new Account(Name='Acme');
|
|
45
39
|
insert myAccount;
|
|
40
|
+
|
|
46
41
|
// Get the base URL.
|
|
47
42
|
String sfdcBaseURL = URL.getOrgDomainURL().toExternalForm();
|
|
48
43
|
System.debug('Base URL: ' + sfdcBaseURL );
|
|
44
|
+
|
|
49
45
|
// Get the URL for the current request.
|
|
50
46
|
String currentRequestURL = URL.getCurrentRequestUrl().toExternalForm();
|
|
51
47
|
System.debug('Current request URL: ' + currentRequestURL);
|
|
48
|
+
|
|
52
49
|
// Create the account URL from the base URL.
|
|
53
50
|
String accountURL = URL.getOrgDomainURL().toExternalForm() +
|
|
54
51
|
'/' + myAccount.Id;
|
|
55
52
|
System.debug('URL of a particular account: ' + accountURL);
|
|
53
|
+
|
|
56
54
|
// Get some parts of the base URL.
|
|
57
55
|
System.debug('Host: ' + URL.getOrgDomainURL().getHost());
|
|
58
56
|
System.debug('Protocol: ' + URL.getOrgDomainURL().getProtocol());
|
|
57
|
+
|
|
59
58
|
// Get the query string of the current request.
|
|
60
59
|
System.debug('Query: ' + URL.getCurrentRequestUrl().getQuery());
|
|
61
60
|
```
|
|
62
61
|
|
|
62
|
+
|
|
63
63
|
## Version Behavior Changes
|
|
64
|
-
|
|
65
64
|
In API version 41.0 and later, Apex URL objects are represented by the java.net.URI type, not the java.net.URL type.
|
|
66
|
-
|
|
67
65
|
The API version in which the URL object was instantiated determines the behavior of subsequent method calls to the
|
|
68
|
-
|
|
69
66
|
specific instance. Salesforce strongly encourages you to use API 41.0 and later versions for fully RFC-compliant URL
|
|
70
|
-
|
|
71
67
|
parsing that includes proper handling of edge cases of complex URL structures. API 41.0 and later versions also enforce
|
|
72
|
-
|
|
73
68
|
that inputs are valid, RFC-compliant URL or URI strings.
|
|
74
|
-
|
|
69
|
+
|
|
75
70
|
* [URL Constructors](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_url.htm#apex_System_URL_constructors)
|
|
76
|
-
|
|
77
71
|
* [URL Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_url.htm#apex_System_URL_methods)
|
|
78
|
-
|
|
72
|
+
|
|
79
73
|
**See Also**
|
|
80
|
-
|
|
81
74
|
* [URL Class](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_url.htm)
|
|
82
75
|
|
|
83
76
|
## Namespace
|
|
@@ -107,11 +100,11 @@ Creates a new instance of the URL class by parsing the specified spec within the
|
|
|
107
100
|
**Usage**
|
|
108
101
|
|
|
109
102
|
The new URL is created from the given context URL and the spec argument as described in RFC2396 "Uniform Resource Identifiers : Generic * Syntax" :
|
|
110
|
-
|
|
111
103
|
```xml
|
|
112
104
|
<scheme>://<authority><path>?<query>#<fragment>
|
|
113
105
|
```
|
|
114
106
|
|
|
107
|
+
|
|
115
108
|
For more information about the arguments of this constructor, see the corresponding URL(java.net.URL, java.lang.String) constructor for Java.
|
|
116
109
|
|
|
117
110
|
#### Signature
|
|
@@ -122,7 +115,7 @@ global Url(Url context, String spec)
|
|
|
122
115
|
#### Parameters
|
|
123
116
|
| Name | Type | Description |
|
|
124
117
|
|------|------|-------------|
|
|
125
|
-
| context | [
|
|
118
|
+
| context | [Url](../miscellaneous/Url.md) | The context in which to parse the specification. |
|
|
126
119
|
| spec | String | The string to parse as a URL. |
|
|
127
120
|
|
|
128
121
|
---
|
|
@@ -193,7 +186,7 @@ global static Url getCurrentRequestUrl()
|
|
|
193
186
|
```
|
|
194
187
|
|
|
195
188
|
#### Return Type
|
|
196
|
-
**[
|
|
189
|
+
**[Url](../miscellaneous/Url.md)**
|
|
197
190
|
|
|
198
191
|
The URL of the entire request.
|
|
199
192
|
|
|
@@ -256,12 +249,10 @@ global static String getFileFieldURL(String entityId, String fieldName)
|
|
|
256
249
|
The download URL for the file attachment.
|
|
257
250
|
|
|
258
251
|
#### Example
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
'AttachmentBody');
|
|
264
|
-
```
|
|
252
|
+
String fileURL =
|
|
253
|
+
URL.getFileFieldURL(
|
|
254
|
+
'087000000000123' ,
|
|
255
|
+
'AttachmentBody');
|
|
265
256
|
|
|
266
257
|
---
|
|
267
258
|
|
|
@@ -288,9 +279,9 @@ Returns the canonical URL for your org. For example, https://MyDomainName.my.sal
|
|
|
288
279
|
**Usage**
|
|
289
280
|
|
|
290
281
|
Use getOrgDomainUrl() to interact with Salesforce REST and SOAP APIs in Apex code. Get endpoints for User Interface API calls, for creating and customizing picklist value sets and custom fields, and more.
|
|
291
|
-
|
|
282
|
+
|
|
292
283
|
`getOrgDomainUrl()` can access the domain URL only for the org in which the Apex code is running.
|
|
293
|
-
|
|
284
|
+
|
|
294
285
|
You don't need a RemoteSiteSetting for your org to interact with the Salesforce APIs using domain URLs retrieved with this method.
|
|
295
286
|
|
|
296
287
|
**See Also**
|
|
@@ -303,18 +294,16 @@ global static Url getOrgDomainUrl()
|
|
|
303
294
|
```
|
|
304
295
|
|
|
305
296
|
#### Return Type
|
|
306
|
-
**[
|
|
297
|
+
**[Url](../miscellaneous/Url.md)**
|
|
307
298
|
|
|
308
299
|
getOrgDomainUrl() always returns the login URL for your org, regardless of context. Use that URL when making API calls to your org.
|
|
309
300
|
|
|
310
301
|
#### Example
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
req.
|
|
318
|
-
|
|
319
|
-
HttpResponse res = h.send(req);
|
|
320
|
-
```
|
|
302
|
+
// This example uses the Salesforce REST API to get organization limit values. For information on limits, see Limits in the REST API Developer Guide.
|
|
303
|
+
Http h = new Http();
|
|
304
|
+
HttpRequest req = new HttpRequest();
|
|
305
|
+
req.setEndpoint(Url.getOrgDomainUrl().toExternalForm()
|
|
306
|
+
+ '/services/data/v44.0/limits');
|
|
307
|
+
req.setMethod('GET');
|
|
308
|
+
req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionId());
|
|
309
|
+
HttpResponse res = h.send(req);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# SampleEnum Enum
|
|
2
|
+
|
|
3
|
+
`NAMESPACEACCESSIBLE`
|
|
4
|
+
|
|
5
|
+
This is a sample enum. This references [ReferencedEnum](../miscellaneous/ReferencedEnum.md) .
|
|
6
|
+
|
|
7
|
+
This description has several lines
|
|
8
|
+
|
|
9
|
+
**Some Custom**
|
|
10
|
+
|
|
11
|
+
Test. I can also have a [ReferencedEnum](../miscellaneous/ReferencedEnum.md) here.
|
|
12
|
+
And it can be multiline.
|
|
13
|
+
|
|
14
|
+
**Mermaid**
|
|
15
|
+
|
|
16
|
+
graph TD
|
|
17
|
+
A[SampleEnum] -->|references| B[ReferencedEnum]
|
|
18
|
+
B -->|referenced by| A
|
|
19
|
+
|
|
20
|
+
**Group** Sample Enums
|
|
21
|
+
|
|
22
|
+
**Author** John Doe
|
|
23
|
+
|
|
24
|
+
**Date** 2022-01-01
|
|
25
|
+
|
|
26
|
+
**See** [ReferencedEnum](../miscellaneous/ReferencedEnum.md)
|
|
27
|
+
|
|
28
|
+
## Namespace
|
|
29
|
+
ns
|
|
30
|
+
|
|
31
|
+
## Values
|
|
32
|
+
| Value | Description |
|
|
33
|
+
|-------|-------------|
|
|
34
|
+
| VALUE1 | This is value 1 |
|
|
35
|
+
| VALUE2 | This is value 2 |
|
|
36
|
+
| VALUE3 | This is value 3 |
|
package/examples/plain-markdown/docs/{SampleGroup/ns.SampleClass.md → samplegroup/SampleClass.md}
RENAMED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
`virtual`
|
|
3
3
|
|
|
4
4
|
aliquip ex sunt officia ullamco anim deserunt magna aliquip nisi eiusmod in sit officia veniam ex
|
|
5
|
-
|
|
6
5
|
deserunt ea officia exercitation laboris enim in duis quis enim eiusmod eu amet cupidatat.
|
|
7
6
|
|
|
8
7
|
**Group** SampleGroup
|
|
@@ -11,17 +10,17 @@ deserunt ea officia exercitation laboris enim in duis quis enim eiusmod eu amet
|
|
|
11
10
|
ns
|
|
12
11
|
|
|
13
12
|
## Example
|
|
14
|
-
|
|
15
|
-
SampleClass sample = new SampleClass();
|
|
13
|
+
SampleClass sample = new SampleClass();
|
|
16
14
|
sample.doSomething();
|
|
17
|
-
```
|
|
18
15
|
|
|
19
16
|
**Inheritance**
|
|
20
|
-
|
|
17
|
+
|
|
18
|
+
[BaseClass](../miscellaneous/BaseClass.md)
|
|
21
19
|
|
|
22
20
|
**Implements**
|
|
23
|
-
|
|
24
|
-
[
|
|
21
|
+
|
|
22
|
+
[SampleInterface](../miscellaneous/SampleInterface.md),
|
|
23
|
+
[ParentInterface](../miscellaneous/ParentInterface.md)
|
|
25
24
|
|
|
26
25
|
## Fields
|
|
27
26
|
### Group Name
|
|
@@ -48,7 +47,7 @@ public sampleEnumFromBase
|
|
|
48
47
|
```
|
|
49
48
|
|
|
50
49
|
##### Type
|
|
51
|
-
[
|
|
50
|
+
[SampleEnum](../sample-enums/SampleEnum.md)
|
|
52
51
|
|
|
53
52
|
## Properties
|
|
54
53
|
### Group Name
|
|
@@ -116,10 +115,8 @@ public virtual String sayHello()
|
|
|
116
115
|
A string value.
|
|
117
116
|
|
|
118
117
|
##### Example
|
|
119
|
-
|
|
120
|
-
SampleClass sample = new SampleClass();
|
|
118
|
+
SampleClass sample = new SampleClass();
|
|
121
119
|
sample.doSomething();
|
|
122
|
-
```
|
|
123
120
|
|
|
124
121
|
## Classes
|
|
125
122
|
### SomeInnerClass Class
|