Skip to content

Commit 6b1b9fd

Browse files
committed
Update examples to use JsonApiClient
1 parent 67d022d commit 6b1b9fd

28 files changed

+35
-35
lines changed

MyApp/_includes/jwt-service-clients.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ automatically supports fetching new JWT Bearer Tokens & transparently Auto Retry
1111
#### C#, F# & VB .NET Service Clients
1212

1313
```csharp
14-
var client = new JsonServiceClient(baseUrl);
14+
var client = new JsonApiClient(baseUrl);
1515
var authRequest = new Authenticate {
1616
provider = "credentials",
1717
UserName = userName,

MyApp/_pages/advantages-of-message-based-web-services.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,14 @@ But even without this, ServiceStack services are just as consumable as any other
230230
The earlier typed API example of creating a new TODO in C#:
231231

232232
```csharp
233-
var client = new JsonServiceClient(baseUrl);
233+
var client = new JsonApiClient(baseUrl);
234234
Todo createdTodo = client.Post(new Todo { Content = "New Todo", Order = 1 });
235235
```
236236

237237
Is like this in [TypeScript](/typescript-add-servicestack-reference):
238238

239239
```ts
240-
var client = new JsonServiceClient(baseUrl);
240+
var client = new JsonApiClient(baseUrl);
241241
var request = Todo();
242242
request.Content = "New Todo";
243243
request.Order = 1;

MyApp/_pages/api-design.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ public class Contact { ... }
338338
Which can used in any ServiceClient with:
339339

340340
```csharp
341-
var client = new JsonServiceClient(BaseUri);
341+
var client = new JsonApiClient(BaseUri);
342342
List<Contact> response = client.Get(new GetContacts());
343343
```
344344

@@ -351,7 +351,7 @@ can alternatively choose to use [Add ServiceStack Reference](/csharp-add-service
351351
alternative way to get the Services typed DTOs on the client. In both cases the exact same source code is used to call the Services:
352352

353353
```csharp
354-
var client = new JsonServiceClient(BaseUri);
354+
var client = new JsonApiClient(BaseUri);
355355
var response = client.Get(new GetContacts());
356356
```
357357

MyApp/_pages/auth/api-key-authprovider.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ curl https://api.stripe.com/v1/charges -H "Authorization: Bearer yDOr26HsxyhpuRB
8787
Both of these methods are built into most HTTP Clients. Here are a few different ways which you can send them using ServiceStack's [.NET Service Clients](/csharp-client):
8888

8989
```csharp
90-
var client = new JsonServiceClient(baseUrl) {
90+
var client = new JsonApiClient(baseUrl) {
9191
Credentials = new NetworkCredential(apiKey, "")
9292
};
9393

MyApp/_pages/auth/auth-repository.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ More examples of this are in [ManageRolesTests.cs](https://github.com/ServiceSta
391391
Super Users with the **Admin** role or Requests with an [AdminAuthSecret](/debugging#authsecret) can call the built-in `/assignroles` and `/unassignroles` Services to add Roles/Permissions to existing users from an external Request, e.g:
392392

393393
```csharp
394-
var client = new JsonServiceClient(baseUrl);
394+
var client = new JsonApiClient(baseUrl);
395395
var response = client.Post(new AssignRoles
396396
{
397397
UserName = userName,

MyApp/_pages/auth/authentication-and-authorization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ On the client you can use the [C#/.NET Service Clients](/csharp-client) to easil
501501
To authenticate using your `CustomCredentialsAuthProvider` by POST'ing a `Authenticate` Request, e.g:
502502

503503
```csharp
504-
var client = new JsonServiceClient(BaseUrl);
504+
var client = new JsonApiClient(BaseUrl);
505505

506506
var authResponse = client.Post(new Authenticate {
507507
provider = CredentialsAuthProvider.Name, //= credentials

MyApp/_pages/auth/encrypted-messaging.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ It's safer instead to download the public key over a trusted `https://` url wher
4848
Since `GetPublicKey` is just a ServiceStack Service it's easily downloadable using a Service Client:
4949

5050
```csharp
51-
var client = new JsonServiceClient(BaseUrl);
51+
var client = new JsonApiClient(BaseUrl);
5252
string publicKeyXml = client.Get(new GetPublicKey());
5353
```
5454

@@ -68,7 +68,7 @@ To help with verification the SHA256 Hash of the PublicKey is returned in `X-Pub
6868
Once they have the Server's Public Key, clients can use it to get an `EncryptedServiceClient` via the `GetEncryptedClient()` extension method on `JsonServiceClient` or new `JsonHttpClient`, e.g:
6969

7070
```csharp
71-
var client = new JsonServiceClient(BaseUrl);
71+
var client = new JsonApiClient(BaseUrl);
7272
IEncryptedClient encryptedClient = client.GetEncryptedClient(publicKeyXml);
7373
```
7474

MyApp/_pages/auth/identityserver.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public async Task<IActionResult> CallServiceClient()
251251
{
252252
var accessToken = await HttpContext.GetTokenAsync("access_token");
253253

254-
var client = new JsonServiceClient("https://localhost:5001/") {
254+
var client = new JsonApiClient("https://localhost:5001/") {
255255
BearerToken = accessToken
256256
};
257257
var response = await client.GetAsync(new GetIdentity());

MyApp/_pages/auth/jwt-authprovider.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ The JWT Auth Provider defaults to `RequireSecureConnection=true` which mandates
117117
JWT Tokens can be sent using the Bearer Token support in all HTTP and Service Clients:
118118

119119
```csharp
120-
var client = new JsonServiceClient(baseUrl) {
120+
var client = new JsonApiClient(baseUrl) {
121121
BearerToken = jwtToken
122122
};
123123

MyApp/_pages/auto-batched-requests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Thanks to it's [message-based design](/advantages-of-message-based-web-services)
1414
This is enabled in all [.NET Service Clients](/csharp-client) via the new `SendAll()` and `SendAllOneWay()` API's, e.g:
1515

1616
```csharp
17-
var client = new JsonServiceClient(BaseUrl);
17+
var client = new JsonApiClient(BaseUrl);
1818
var requests = new[]
1919
{
2020
new Request { Id = 1, Name = "Foo" },

MyApp/_pages/autoquery/crud.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public class CreateRockstarResponse
9191
When ServiceStack starts it generates the implementation for this Service, which can now insert Rockstars using your populated Request DTO:
9292

9393
```csharp
94-
var client = new JsonServiceClient(baseUrl);
94+
var client = new JsonApiClient(baseUrl);
9595

9696
client.Post(new CreateRockstar {
9797
FirstName = "Kurt",

MyApp/_pages/autoquery/rdbms.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1445,7 +1445,7 @@ public class CustomAutoQueryServices(IAutoQueryDb autoQuery) : Service
14451445
As AutoQuery Services are normal ServiceStack Services they can re-use the existing Service Client support for [Auto Batched Requests](/auto-batched-requests), e.g:
14461446

14471447
```csharp
1448-
var client = new JsonServiceClient(BaseUrl);
1448+
var client = new JsonApiClient(BaseUrl);
14491449
var response = client.SendAll(new CreateItem[] { ... });
14501450
```
14511451

MyApp/_pages/csharp-client.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ builder.Services.AddBlazorApiClient(builder.Configuration["ApiBaseUrl"] ?? build
5050
All ServiceStack's C# clients share the same interfaces and are created by passing in the **Base URI** of your ServiceStack service in the clients constructor, e.g. if your ServiceStack instance was hosted on the root path `/` on the **5001** custom port:
5151

5252
```csharp
53-
var client = new JsonServiceClient("https://host:5001");
53+
var client = new JsonApiClient("https://host:5001");
5454
```
5555

5656
Or if hosted on the `/custom` custom path:
5757

5858
```csharp
59-
var client = new JsonServiceClient("https://host/custom/");
59+
var client = new JsonApiClient("https://host/custom/");
6060
```
6161

6262
### Recommended ServiceClient for .NET 6+#

MyApp/_pages/error-handling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ All Exceptions get injected into the `ResponseStatus` property of your Response
3737
```csharp
3838
try
3939
{
40-
var client = new JsonServiceClient(BaseUri);
40+
var client = new JsonApiClient(BaseUri);
4141
var response = client.Send<UserResponse>(new User());
4242
}
4343
catch (WebServiceException webEx)

MyApp/_pages/fsharp-add-servicestack-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ As there's no configuration stored about the ServiceStack Reference you might be
3535
Just like with C#, F# Native Types can be used in ServiceStack's [Generic Service Clients](/csharp-client) providing and end-to-end Typed API whose PCL support also allows F# to be used in [mobile clients apps](https://github.com/ServiceStackApps/HelloMobile) without having to share compiled DTOs:
3636

3737
```fsharp
38-
let client = new JsonServiceClient("https://blazor-vue.web-templates.io")
38+
let client = new JsonApiClient("https://blazor-vue.web-templates.io")
3939
let response = client.Get(new SearchQuestions(
4040
Tags = new List<string>([ "redis"; "ormlite" ])))
4141

MyApp/_pages/grpc/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ code-gen, etc is required to maintain its simple code-first development model ut
122122
end-to-end Typed API utilizing smart, rich .NET generic Service Clients:
123123

124124
```csharp
125-
//IRestServiceClient client = new JsonServiceClient(BaseUrl);
125+
//IRestServiceClient client = new JsonApiClient(BaseUrl);
126126
IRestServiceClient client = new GrpcServiceClient(BaseUrl);
127127
var response = await client.GetAsync(new GetTodos());
128128
```

MyApp/_pages/howto-write-unit-integration-tests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public class CustomerRestExample
126126
[Test]
127127
public void Run_Customer_REST_Example()
128128
{
129-
var client = new JsonServiceClient(BaseUri);
129+
var client = new JsonApiClient(BaseUri);
130130

131131
//GET /customers
132132
var all = client.Get(new GetCustomers());

MyApp/_pages/messaging.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ mqServer.DisablePriorityQueues = true;
270270
Using the `SendOneWay()` Service Client APIs will publish DTO's to the `/oneway` [Pre-defined Route](/routing#pre-defined-routes):
271271

272272
```csharp
273-
var client = new JsonServiceClient(BaseUrl);
273+
var client = new JsonApiClient(BaseUrl);
274274
client.SendOneWay(new RequestDto { ... }); //POST's to /json/oneway/RequestDto
275275
```
276276

@@ -481,7 +481,7 @@ new AppHost().Start("http://localhost:1337/");
481481
Then on the Client we can authenticate using UserName/Password credentials using the HTTP [Service Client](/csharp-client), e.g:
482482

483483
```csharp
484-
var client = new JsonServiceClient("http://localhost:1337/");
484+
var client = new JsonApiClient("http://localhost:1337/");
485485

486486
var response = client.Post(new Authenticate {
487487
UserName = "mythz",

MyApp/_pages/multitenancy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ public class MultiTenantService : Service
374374
Calling this Service with a different `TenantId` value changes which database the Service is configured with:
375375

376376
```csharp
377-
var client = new JsonServiceClient(Config.AbsoluteBaseUri);
377+
var client = new JsonApiClient(Config.AbsoluteBaseUri);
378378

379379
var response = client.Get(new GetTenant()); //= Company: Masters inc.
380380

MyApp/_pages/netcore-localhost-cert.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ Now after restarting your browser to reset its SSL caches you'll be able to use
227227
As .NET has access your OS's trusted certificates you'll be able to access the custom domains without additional configuration:
228228

229229
```csharp
230-
var client = new JsonServiceClient("https://dev.servicestack.com:5001"); //.NET HttpWebRequest
230+
var client = new JsonApiClient("https://dev.servicestack.com:5001"); //.NET HttpWebRequest
231231
var response = await client.GetAsync(new Hello { Name = "World" });
232232

233233
var client = new JsonHttpClient("https://dev.servicestack.com:5001"); //.NET HttpClient

MyApp/_pages/post-command.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ dotnet add package ServiceStack.Client
280280
Which together with the above C# DTOs enables its optimal end-to-end typed API:
281281

282282
```csharp
283-
var client = new JsonServiceClient("https://techstacks.io");
283+
var client = new JsonApiClient("https://techstacks.io");
284284

285285
client.Send(new LockTechStack { TechnologyStackId = id, IsLocked = true });
286286
```

MyApp/_pages/proxy-feature.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ x csharp https://external.domain.com/techstacks
4343
The resulting DTOs can be used with any [.NET Service Client](/csharp-client#built-in-clients), configured with the proxy endpoint as the **BaseUrl**:
4444

4545
```csharp
46-
var client = new JsonServiceClient("https://external.domain.com/techstacks");
46+
var client = new JsonApiClient("https://external.domain.com/techstacks");
4747

4848
var request = new GetTechnology { Slug = "ServiceStack" };
4949
var response = client.Get(request);
@@ -55,7 +55,7 @@ Another potential use-case is to have the proxy act like a facade to access mult
5555
```csharp
5656
var authRequest = new Authenticate { ... };
5757

58-
var marketingClient = new JsonServiceClient("https://external.domain.com/marketing");
58+
var marketingClient = new JsonApiClient("https://external.domain.com/marketing");
5959
var authResponse = marketingClient.Post(authRequest);
6060

6161
var financeClient = new JsonHttpClient("https://external.domain.com/finance");

MyApp/_pages/soap-support.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ var response = client.Send(new GetCustomers());
6969
Although if you could use a generic ServiceClient, you'd typically be better off using the other cleaner and faster endpoints like JSON instead:
7070

7171
```csharp
72-
var client = new JsonServiceClient(BaseUrl);
72+
var client = new JsonApiClient(BaseUrl);
7373

7474
var response = client.Get(new GetCustomers());
7575
```

MyApp/_pages/testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public class CustomerRestExample
108108
[Test]
109109
public void Can_GET_and_Create_Customers()
110110
{
111-
var client = new JsonServiceClient(BaseUri);
111+
var client = new JsonApiClient(BaseUri);
112112

113113
//GET /customers
114114
var all = client.Get(new GetCustomers());

MyApp/_pages/validation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ All Exceptions gets injected into the ResponseStatus property of your Response D
6868
```csharp
6969
try
7070
{
71-
var client = new JsonServiceClient(BaseUri);
71+
var client = new JsonApiClient(BaseUri);
7272
var response = client.Send<UserResponse>(new User());
7373
}
7474
catch (WebServiceException webEx)

MyApp/_pages/vbnet-add-servicestack-reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ If your server has been updated and you want to update to client DTOs, simply ri
3333
Async Example:
3434

3535
```vb
36-
Dim client = New JsonServiceClient("https://techstacks.io")
36+
Dim client = new JsonApiClient("https://techstacks.io")
3737

3838
Dim response = Await client.SendAsync(New AppOverview())
3939
response.PrintDump()
@@ -42,7 +42,7 @@ response.PrintDump()
4242
Sync Example:
4343

4444
```vb
45-
Dim client = New JsonServiceClient("https://techstacks.io")
45+
Dim client = new JsonApiClient("https://techstacks.io")
4646

4747
Dim response = client.Send(New AppOverview())
4848
response.PrintDump()

MyApp/_pages/why-servicestack.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public class CustomerService : Service
253253
No code-gen required, can re-use above Server DTOs:
254254

255255
```csharp
256-
var client = new JsonServiceClient(BaseUri);
256+
var client = new JsonApiClient(BaseUri);
257257

258258
//GET /customers
259259
var all = client.Get(new GetCustomers()); // Count = 0

MyApp/_pages/your-first-webservice-explained.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class HelloService : Service
5353
Thanks to the above `IReturn<T>` interface marker you'll be able to use the terse, typed Service Client APIs, e.g:
5454

5555
```csharp
56-
var client = new JsonServiceClient(BaseUri);
56+
var client = new JsonApiClient(BaseUri);
5757

5858
HelloResponse response = client.Get(new Hello { Name = "World" });
5959
```

0 commit comments

Comments
 (0)