You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 16/umbraco-cms/customizing/foundation/fetching-data/custom-generated-client.md
+8-4Lines changed: 8 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,15 +4,19 @@ description: Learn how to create a custom generated client with TypeScript types
4
4
5
5
# Custom Generated Client
6
6
7
-
The Umbraco Backoffice provides a built-in HTTP client that you can use to make network requests. This client is colloquially known as the Umbraco HTTP Client. It is generated using **@hey-api/openapi-ts** around the OpenAPI specification and is available through the `@umbraco-cms/backoffice/http-client` package.
7
+
Umbraco uses [@hey-api/openapi-ts](https://heyapi.dev/openapi-ts/get-started)to generate its HTTP client for the OpenAPI specification of the Management API. It is available through the `@umbraco-cms/backoffice/http-client` package.
8
8
9
9
{% content-ref url="http-client.md" %}
10
10
[http-client.md](http-client.md)
11
11
{% endcontent-ref %}
12
12
13
-
The HTTP client is generated using the [@hey-api/openapi-ts](https://heyapi.dev/openapi-ts/get-started) library. This library allows anyone to generate a TypeScript client from an OpenAPI specification. The generated client provides a convenient way to make requests to that specific API with type-safety without having to manually write the requests yourself. You can consider generating a client. This can save you a lot of time and effort when working with custom API controllers.
13
+
The following examples will show you how to generate a client from an OpenAPI specification and how to use it in your project. We use the **@hey-api/openapi-ts** library, but the same principles apply to any other library that generates a TypeScript client.
14
14
15
-
If you want to generate your own client, you can use the following command:
15
+
## Generate your own client
16
+
17
+
The generated client provides a convenient way to make requests to that specific API with type-safety without having to manually write the requests yourself. You can consider generating a client. This can save you a lot of time and effort when working with custom API controllers.
18
+
19
+
To get started, you can install the generator using the following command:
This will generate a TypeScript client in the `./my-client` folder. You can then import the client into your project and use it to make requests to the Management API.
28
32
29
-
###Connecting to the Management API
33
+
## Connecting to the Management API
30
34
31
35
You will need to set up a few configuration options in order to connect to the Management API. The following options are required:
0 commit comments