hostinger-api-sdk 1.68.0 → 2.0.0
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/README.md +2 -2
- package/api.ts +210 -12
- package/base.ts +1 -1
- package/common.ts +1 -1
- package/configuration.ts +2 -2
- package/dist/api.d.ts +158 -13
- package/dist/api.js +119 -14
- package/dist/base.d.ts +1 -1
- package/dist/base.js +1 -1
- package/dist/common.d.ts +1 -1
- package/dist/common.js +1 -1
- package/dist/configuration.d.ts +1 -1
- package/dist/configuration.js +2 -2
- package/dist/esm/api.d.ts +158 -13
- package/dist/esm/api.js +110 -5
- package/dist/esm/base.d.ts +1 -1
- package/dist/esm/base.js +1 -1
- package/dist/esm/common.d.ts +1 -1
- package/dist/esm/common.js +1 -1
- package/dist/esm/configuration.d.ts +1 -1
- package/dist/esm/configuration.js +2 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/docs/WordPressAIContentApi.md +70 -3
- package/docs/WordPressV1ContentGeneratedImageResource.md +27 -0
- package/docs/WordPressV1ContentGeneratedImagesResource.md +3 -3
- package/docs/WordPressV1ContentGenerationResource.md +27 -0
- package/docs/WordPressV1ContentGenerationResourceResult.md +23 -0
- package/index.ts +1 -1
- package/package.json +1 -1
|
@@ -5,11 +5,12 @@ All URIs are relative to *https://developers.hostinger.com*
|
|
|
5
5
|
|Method | HTTP request | Description|
|
|
6
6
|
|------------- | ------------- | -------------|
|
|
7
7
|
|[**generateImagesV1**](#generateimagesv1) | **POST** /api/hosting/v1/accounts/{username}/wordpress/{software}/content/images/generate | Generate images|
|
|
8
|
+
|[**getGenerationResultV1**](#getgenerationresultv1) | **GET** /api/hosting/v1/accounts/{username}/wordpress/{software}/content/generations/{generation_id} | Get generation result|
|
|
8
9
|
|
|
9
10
|
# **generateImagesV1**
|
|
10
|
-
>
|
|
11
|
+
> WordPressV1ContentGenerationResource generateImagesV1(wordPressV1ContentGenerateImagesRequest)
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
Start generating one or more images from a prompt and an image type for the specified WordPress installation. The generation runs asynchronously: the response is returned right away with `status: in-progress` and a `generation_id`. Poll GET /api/hosting/v1/accounts/{username}/wordpress/{software}/content/generations/{generation_id} every few seconds until `status` is `completed` or `failed`. A completed generation returns temporary image URLs together with the time they expire; download the images before then. Images match the requested aspect ratio and are never smaller than the requested size; logos are transparent images cropped to the mark. Only one image generation can run per installation at a time: while one is still in progress the endpoint returns 409 without the ID of the running generation, so a caller that did not receive the `202` has to wait for it to finish (up to a few minutes) before starting a new one. The endpoint is limited to 10 requests per minute. Provide the WordPress installation (software) identifier in the path. It can be obtained from GET /api/hosting/v1/wordpress/installations (the `id` field).
|
|
13
14
|
|
|
14
15
|
### Example
|
|
15
16
|
|
|
@@ -45,7 +46,7 @@ const { status, data } = await apiInstance.generateImagesV1(
|
|
|
45
46
|
|
|
46
47
|
### Return type
|
|
47
48
|
|
|
48
|
-
**
|
|
49
|
+
**WordPressV1ContentGenerationResource**
|
|
49
50
|
|
|
50
51
|
### Authorization
|
|
51
52
|
|
|
@@ -57,12 +58,78 @@ const { status, data } = await apiInstance.generateImagesV1(
|
|
|
57
58
|
- **Accept**: application/json
|
|
58
59
|
|
|
59
60
|
|
|
61
|
+
### HTTP response details
|
|
62
|
+
| Status code | Description | Response headers |
|
|
63
|
+
|-------------|-------------|------------------|
|
|
64
|
+
|**202** | Accepted response | - |
|
|
65
|
+
|**422** | Validation error response | - |
|
|
66
|
+
|**401** | Unauthenticated response | - |
|
|
67
|
+
|**404** | Error response | - |
|
|
68
|
+
|**409** | Conflict response. `Retry-After`, when present, is the number of seconds to wait before retrying. | * Retry-After - Seconds to wait before retrying the request <br> |
|
|
69
|
+
|**500** | Error response | - |
|
|
70
|
+
|
|
71
|
+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
|
72
|
+
|
|
73
|
+
# **getGenerationResultV1**
|
|
74
|
+
> WordPressV1ContentGenerationResource getGenerationResultV1()
|
|
75
|
+
|
|
76
|
+
Get the result of an AI content generation started for the specified WordPress installation, such as an image generation started with POST /api/hosting/v1/accounts/{username}/wordpress/{software}/content/images/generate. While the generation is still running only `status: in-progress` is returned; poll every few seconds. Once `completed`, `result` holds the generated content shaped according to `type`: temporary image URLs together with the time they expire for `image-generation`, or the generated website document for `website-generation` (started from the Hostinger WordPress plugin). A `failed` generation has no `result`. Unknown or expired generation IDs return 404. Provide the WordPress installation (software) identifier in the path. It can be obtained from GET /api/hosting/v1/wordpress/installations (the `id` field).
|
|
77
|
+
|
|
78
|
+
### Example
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
import {
|
|
82
|
+
WordPressAIContentApi,
|
|
83
|
+
Configuration
|
|
84
|
+
} from '@hostinger/sdk';
|
|
85
|
+
|
|
86
|
+
const configuration = new Configuration();
|
|
87
|
+
const apiInstance = new WordPressAIContentApi(configuration);
|
|
88
|
+
|
|
89
|
+
let username: string; // (default to undefined)
|
|
90
|
+
let software: string; //WordPress installation (software) identifier (default to undefined)
|
|
91
|
+
let generationId: string; //Generation ID returned when the generation was started (default to undefined)
|
|
92
|
+
let type: 'website-generation' | 'image-generation'; //Generation type to look up. When omitted, every generation type is checked. (optional) (default to undefined)
|
|
93
|
+
|
|
94
|
+
const { status, data } = await apiInstance.getGenerationResultV1(
|
|
95
|
+
username,
|
|
96
|
+
software,
|
|
97
|
+
generationId,
|
|
98
|
+
type
|
|
99
|
+
);
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Parameters
|
|
103
|
+
|
|
104
|
+
|Name | Type | Description | Notes|
|
|
105
|
+
|------------- | ------------- | ------------- | -------------|
|
|
106
|
+
| **username** | [**string**] | | defaults to undefined|
|
|
107
|
+
| **software** | [**string**] | WordPress installation (software) identifier | defaults to undefined|
|
|
108
|
+
| **generationId** | [**string**] | Generation ID returned when the generation was started | defaults to undefined|
|
|
109
|
+
| **type** | [**'website-generation' | 'image-generation'**]**Array<'website-generation' | 'image-generation'>** | Generation type to look up. When omitted, every generation type is checked. | (optional) defaults to undefined|
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
### Return type
|
|
113
|
+
|
|
114
|
+
**WordPressV1ContentGenerationResource**
|
|
115
|
+
|
|
116
|
+
### Authorization
|
|
117
|
+
|
|
118
|
+
[apiToken](../README.md#apiToken)
|
|
119
|
+
|
|
120
|
+
### HTTP request headers
|
|
121
|
+
|
|
122
|
+
- **Content-Type**: Not defined
|
|
123
|
+
- **Accept**: application/json
|
|
124
|
+
|
|
125
|
+
|
|
60
126
|
### HTTP response details
|
|
61
127
|
| Status code | Description | Response headers |
|
|
62
128
|
|-------------|-------------|------------------|
|
|
63
129
|
|**200** | Success response | - |
|
|
64
130
|
|**422** | Validation error response | - |
|
|
65
131
|
|**401** | Unauthenticated response | - |
|
|
132
|
+
|**404** | Error response | - |
|
|
66
133
|
|**500** | Error response | - |
|
|
67
134
|
|
|
68
135
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# WordPressV1ContentGeneratedImageResource
|
|
2
|
+
|
|
3
|
+
Single image generated by the AI image generator.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type | Description | Notes
|
|
8
|
+
------------ | ------------- | ------------- | -------------
|
|
9
|
+
**url** | **string** | Temporary URL of the generated image, valid until the `expires_at` time of the result | [default to undefined]
|
|
10
|
+
**width** | **number** | Image width in pixels | [default to undefined]
|
|
11
|
+
**height** | **number** | Image height in pixels | [default to undefined]
|
|
12
|
+
**content_type** | **string** | MIME type of the image | [default to undefined]
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { WordPressV1ContentGeneratedImageResource } from '@hostinger/sdk';
|
|
18
|
+
|
|
19
|
+
const instance: WordPressV1ContentGeneratedImageResource = {
|
|
20
|
+
url,
|
|
21
|
+
width,
|
|
22
|
+
height,
|
|
23
|
+
content_type,
|
|
24
|
+
};
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
@@ -6,8 +6,8 @@ Images generated by the AI image generator.
|
|
|
6
6
|
|
|
7
7
|
Name | Type | Description | Notes
|
|
8
8
|
------------ | ------------- | ------------- | -------------
|
|
9
|
-
**images** | **Array<
|
|
10
|
-
**
|
|
9
|
+
**images** | [**Array<WordPressV1ContentGeneratedImageResource>**](WordPressV1ContentGeneratedImageResource.md) | Generated images, each available at a temporary URL | [default to undefined]
|
|
10
|
+
**expires_at** | **string** | Time after which the image URLs stop working. Download the images before then. | [default to undefined]
|
|
11
11
|
|
|
12
12
|
## Example
|
|
13
13
|
|
|
@@ -16,7 +16,7 @@ import { WordPressV1ContentGeneratedImagesResource } from '@hostinger/sdk';
|
|
|
16
16
|
|
|
17
17
|
const instance: WordPressV1ContentGeneratedImagesResource = {
|
|
18
18
|
images,
|
|
19
|
-
|
|
19
|
+
expires_at,
|
|
20
20
|
};
|
|
21
21
|
```
|
|
22
22
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# WordPressV1ContentGenerationResource
|
|
2
|
+
|
|
3
|
+
State of an AI content generation and, once completed, its result.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type | Description | Notes
|
|
8
|
+
------------ | ------------- | ------------- | -------------
|
|
9
|
+
**generation_id** | **string** | Generation ID (UUID) used to poll for the result | [default to undefined]
|
|
10
|
+
**type** | **string** | Kind of generation, determines the shape of `result` | [default to undefined]
|
|
11
|
+
**status** | **string** | `in-progress` while the generation is still running, `completed` once `result` is available, `failed` when the generation stopped without a result. | [default to undefined]
|
|
12
|
+
**result** | [**WordPressV1ContentGenerationResourceResult**](WordPressV1ContentGenerationResourceResult.md) | | [default to undefined]
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { WordPressV1ContentGenerationResource } from '@hostinger/sdk';
|
|
18
|
+
|
|
19
|
+
const instance: WordPressV1ContentGenerationResource = {
|
|
20
|
+
generation_id,
|
|
21
|
+
type,
|
|
22
|
+
status,
|
|
23
|
+
result,
|
|
24
|
+
};
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# WordPressV1ContentGenerationResourceResult
|
|
2
|
+
|
|
3
|
+
Generated content, `null` until the status is `completed`. For `image-generation` it is the generated images object; for `website-generation` it is the generated website document.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type | Description | Notes
|
|
8
|
+
------------ | ------------- | ------------- | -------------
|
|
9
|
+
**images** | [**Array<WordPressV1ContentGeneratedImageResource>**](WordPressV1ContentGeneratedImageResource.md) | Generated images, each available at a temporary URL | [default to undefined]
|
|
10
|
+
**expires_at** | **string** | Time after which the image URLs stop working. Download the images before then. | [default to undefined]
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import { WordPressV1ContentGenerationResourceResult } from '@hostinger/sdk';
|
|
16
|
+
|
|
17
|
+
const instance: WordPressV1ContentGenerationResourceResult = {
|
|
18
|
+
images,
|
|
19
|
+
expires_at,
|
|
20
|
+
};
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
package/index.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Hostinger API
|
|
5
5
|
*
|
|
6
|
-
* API Version:
|
|
6
|
+
* API Version: 2.0.0
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This file is auto-generated, DO NOT EDIT THIS FILE MANUALLY!
|
|
9
9
|
* If you want to contribute or request a new feature, please create an issue or pull request on https://github.com/hostinger/api
|