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
{{ message }}
Repository navigation
Commit 7ac1a09
Browse filesBrowse the repository at this point in the historyBrowse files
Generate one or more images from a prompt and an image type for the specified WordPress installation. Images are returned inline as base64-encoded PNGs. They match the requested aspect ratio and are never smaller than the requested size; logos are transparent PNGs cropped to the mark. Generation is synchronous and can take up to a minute. 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
+
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).
|**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)
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).
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 } =awaitapiInstance.getGenerationResultV1(
|**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)
[[Back to Model list]](../README.md#documentation-for-models)[[Back to API list]](../README.md#documentation-for-api-endpoints)[[Back to README]](../README.md)
**images** | **Array<string>** | Generated images, each encoded as a base64 string | [default to undefined]
10
-
**content_type** | **string** | MIME type shared by all returned images | [default to undefined]
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';
**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]
[[Back to Model list]](../README.md#documentation-for-models)[[Back to API list]](../README.md#documentation-for-api-endpoints)[[Back to README]](../README.md)
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.
**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]
[[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 commit comments