Skip to content

Commit e626e8e

Browse files
committed
docs: doc update
1 parent 4cdefe4 commit e626e8e

File tree

5 files changed

+73
-74
lines changed

5 files changed

+73
-74
lines changed

docs/docfx.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
"src": "../src",
88
"files": [
99
"NetCoreForce.Client/*.csproj",
10-
"NetCoreForce.Models/*.csproj",
11-
"NetCoreForce.ModelGenerator/*.csproj"
10+
"NetCoreForce.Models/*.csproj"
1211
]
1312
}
1413
],

docs/getting-started.md

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,72 @@
1-
# Getting Started
1+
# Getting Started
2+
3+
4+
5+
### Basic Usage Example
6+
7+
```csharp
8+
///Initialize the authentication client
9+
AuthenticationClient auth = new AuthenticationClient();
10+
11+
//Pass in the login information
12+
await auth.UsernamePasswordAsync("your-client-id", "your-client-secret", "your-username", "your-password", "token-endpoint-url");
13+
14+
//the AuthenticationClient object will then contain the instance URL and access token to be used in each of the API calls
15+
ForceClient client = new ForceClient(auth.AccessInfo.InstanceUrl, auth.ApiVersion, auth.AccessInfo.AccessToken);
16+
17+
//Retrieve an object by Id
18+
SfAccount acct = await client.GetObjectById<SfAccount>(SfAccount.SObjectTypeName, "001i000002C8QTI");
19+
//Modify the record and update
20+
acct.Description = "Updated Description";
21+
await client.UpdateRecord<SfAccount>(SfAccount.SObjectTypeName, acct.Id, acct);
22+
//Delete the record
23+
await client.DeleteRecord(SfAccount.SObjectTypeName, acct.Id);
24+
25+
//Get the results of a SOQL query
26+
List<SfCase> cases = await client.Query<SfCase>("SELECT Id,CaseNumber,Account.Name,Contact.Name FROM Case");
27+
```
28+
29+
### Nested Query Results
30+
31+
When you include related objects in a SOQL query:
32+
```
33+
SELECT Id,CaseNumber,Account.Name,Contact.Name FROM Case
34+
```
35+
36+
And get the results via the client, you can then access the related objects and fields included in the query in a fluent manner.
37+
```csharp
38+
List<SfCase> cases = await client.Query<SfCase>("SELECT Id,CaseNumber,Account.Name,Contact.Name FROM Case");
39+
SfCase firstCase = cases[0];
40+
string caseNumber = firstCase.CaseNumber;
41+
string caseAccountName = firstCase.Account.Name;
42+
string caseContactName = firstCase.Contact.Name;
43+
```
44+
45+
Nested queries are not fully supported - the subquery results will not be complete if they exceed the batch size as the NextRecordsUrl in the subquery results is not being acted upon. Instead use the relationship syntax in the example above.
46+
```
47+
// *NOT* fully supported
48+
"SELECT Id,CaseNumber, (Select Contact.Name from Account) FROM Case"
49+
```
50+
51+
### Asynchronous Batch Processing
52+
53+
Query<T> method will retrieve the full result set before returning. By default, results are returned in batches of 2000.
54+
In cases where you are working with large result sets, you may want to use QueryAsync<T> to retrieve the batches asynchronously for better performance.
55+
56+
```csharp
57+
// First create the async enumerable. At this point, no query has been executed.
58+
// batchSize can be omitted to use the default (usually 2000), or given a custom value between 200 and 2000.
59+
IAsyncEnumerable<SfContact> contactsEnumerable = client.QueryAsync<SfContact>("SELECT Id, Name FROM Contact ", batchSize: 200);
60+
61+
// Get the enumerator, in a using block for proper disposal
62+
await using (IAsyncEnumerator<SfContact> contactsEnumerator = contactsEnumerable.GetAsyncEnumerator())
63+
{
64+
// MoveNext() will execute the query and get the first batch of results.
65+
// Once the inital result batch has been exhausted, the remaining batches, if any, will be retrieved.
66+
while (await contactsEnumerator.MoveNextAsync())
67+
{
68+
SfContact contact = contactsEnumerator.Current;
69+
// process your results
70+
}
71+
}
72+
```

docs/index.md

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -67,71 +67,3 @@ Feedback and suggestions welcome.
6767
Licensed under the MIT license.
6868

6969

70-
### Basic Usage Example
71-
72-
```csharp
73-
///Initialize the authentication client
74-
AuthenticationClient auth = new AuthenticationClient();
75-
76-
//Pass in the login information
77-
await auth.UsernamePasswordAsync("your-client-id", "your-client-secret", "your-username", "your-password", "token-endpoint-url");
78-
79-
//the AuthenticationClient object will then contain the instance URL and access token to be used in each of the API calls
80-
ForceClient client = new ForceClient(auth.AccessInfo.InstanceUrl, auth.ApiVersion, auth.AccessInfo.AccessToken);
81-
82-
//Retrieve an object by Id
83-
SfAccount acct = await client.GetObjectById<SfAccount>(SfAccount.SObjectTypeName, "001i000002C8QTI");
84-
//Modify the record and update
85-
acct.Description = "Updated Description";
86-
await client.UpdateRecord<SfAccount>(SfAccount.SObjectTypeName, acct.Id, acct);
87-
//Delete the record
88-
await client.DeleteRecord(SfAccount.SObjectTypeName, acct.Id);
89-
90-
//Get the results of a SOQL query
91-
List<SfCase> cases = await client.Query<SfCase>("SELECT Id,CaseNumber,Account.Name,Contact.Name FROM Case");
92-
```
93-
94-
### Nested Query Results
95-
96-
When you include related objects in a SOQL query:
97-
```
98-
SELECT Id,CaseNumber,Account.Name,Contact.Name FROM Case
99-
```
100-
101-
And get the results via the client, you can then access the related objects and fields included in the query in a fluent manner.
102-
```csharp
103-
List<SfCase> cases = await client.Query<SfCase>("SELECT Id,CaseNumber,Account.Name,Contact.Name FROM Case");
104-
SfCase firstCase = cases[0];
105-
string caseNumber = firstCase.CaseNumber;
106-
string caseAccountName = firstCase.Account.Name;
107-
string caseContactName = firstCase.Contact.Name;
108-
```
109-
110-
Nested queries are not fully supported - the subquery results will not be complete if they exceed the batch size as the NextRecordsUrl in the subquery results is not being acted upon. Instead use the relationship syntax in the example above.
111-
```
112-
// *NOT* fully supported
113-
"SELECT Id,CaseNumber, (Select Contact.Name from Account) FROM Case"
114-
```
115-
116-
### Asynchronous Batch Processing
117-
118-
Query<T> method will retrieve the full result set before returning. By default, results are returned in batches of 2000.
119-
In cases where you are working with large result sets, you may want to use QueryAsync<T> to retrieve the batches asynchronously for better performance.
120-
121-
```csharp
122-
// First create the async enumerable. At this point, no query has been executed.
123-
// batchSize can be omitted to use the default (usually 2000), or given a custom value between 200 and 2000.
124-
IAsyncEnumerable<SfContact> contactsEnumerable = client.QueryAsync<SfContact>("SELECT Id, Name FROM Contact ", batchSize: 200);
125-
126-
// Get the enumerator, in a using block for proper disposal
127-
await using (IAsyncEnumerator<SfContact> contactsEnumerator = contactsEnumerable.GetAsyncEnumerator())
128-
{
129-
// MoveNext() will execute the query and get the first batch of results.
130-
// Once the inital result batch has been exhausted, the remaining batches, if any, will be retrieved.
131-
while (await contactsEnumerator.MoveNextAsync())
132-
{
133-
SfContact contact = contactsEnumerator.Current;
134-
// process your results
135-
}
136-
}
137-
```

docs/introduction.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/toc.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
- name: Introduction
2-
href: introduction.md
31
- name: Getting Started
42
href: getting-started.md

0 commit comments

Comments
 (0)