Skip to content

Commit 7e30749

Browse files
chore: sdk update
1 parent 23d3b4f commit 7e30749

1,044 files changed

Lines changed: 6292 additions & 1163 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 18 additions & 0 deletions
Large diffs are not rendered by default.

docs/AgencyHostingFilesApi.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,116 @@ All URIs are relative to *https://developers.hostinger.com*
44

55
Method | HTTP request | Description
66
------------- | ------------- | -------------
7+
[**generate_upload_urlv1**](AgencyHostingFilesApi.md#generate_upload_urlv1) | **POST** /api/agency-hosting/v1/websites/{website_uid}/files/upload-urls | Generate upload URL
78
[**import_website_from_archive_v1**](AgencyHostingFilesApi.md#import_website_from_archive_v1) | **POST** /api/agency-hosting/v1/websites/{website_uid}/files/import-archive | Import website from archive
89

910

11+
# **generate_upload_urlv1**
12+
> AgencyHostingV1FilesUploadUrlResource generate_upload_urlv1(website_uid)
13+
14+
Generate upload URL
15+
16+
Generate a file browser upload URL with authentication credentials for uploading files
17+
to an Agency Plan website's file storage.
18+
19+
Returns `url`, `auth_key` and `rest_auth_key`. Use these to upload a file to the
20+
website's file storage via the TUS resumable upload protocol (TUS 1.0.0). Send
21+
`X-Auth: {auth_key}` and `X-Auth-Rest: {rest_auth_key}` headers on every request below.
22+
23+
1. Create the upload: `POST` to `{url}/{relative_file_path}?override=true` with headers
24+
`upload-length: {file size in bytes}` and `upload-offset: 0`. Expect `201 Created`.
25+
2. Upload the file: send the file bytes to the same location (any TUS 1.0.0 client, or
26+
`PATCH` requests with an `upload-offset` header tracking progress) until complete.
27+
28+
`relative_file_path` is the destination path inside the website's file storage, e.g.
29+
`app.zip`.
30+
31+
Instead of a TUS client, plain `curl` also works:
32+
```
33+
FILE=app.zip
34+
SIZE=$(stat -f%z "$FILE") # stat -c%s on Linux
35+
36+
curl -i -X POST "{url}/${FILE}?override=true" \
37+
-H "X-Auth: {auth_key}" \
38+
-H "X-Auth-Rest: {rest_auth_key}" \
39+
-H "Tus-Resumable: 1.0.0" \
40+
-H "Upload-Length: ${SIZE}" \
41+
-H "Upload-Offset: 0"
42+
# -> 201 Created
43+
44+
curl -i -X PATCH "{url}/${FILE}?override=true" \
45+
-H "X-Auth: {auth_key}" \
46+
-H "X-Auth-Rest: {rest_auth_key}" \
47+
-H "Tus-Resumable: 1.0.0" \
48+
-H "Content-Type: application/offset+octet-stream" \
49+
-H "Upload-Offset: 0" \
50+
--data-binary "@${FILE}"
51+
# -> 204 No Content, Upload-Offset response header equals SIZE when done
52+
```
53+
54+
### Example
55+
56+
* Bearer Authentication (apiToken):
57+
58+
```python
59+
import hostinger_api
60+
from hostinger_api.models.agency_hosting_v1_files_upload_url_resource import AgencyHostingV1FilesUploadUrlResource
61+
from hostinger_api.rest import ApiException
62+
from pprint import pprint
63+
64+
65+
# Configure Bearer authorization: apiToken
66+
configuration = hostinger_api.Configuration(
67+
access_token = os.environ["BEARER_TOKEN"]
68+
)
69+
70+
# Enter a context with an instance of the API client
71+
with hostinger_api.ApiClient(configuration) as api_client:
72+
# Create an instance of the API class
73+
api_instance = hostinger_api.AgencyHostingFilesApi(api_client)
74+
website_uid = 'zpwlGlp19' # str | Agency Plan website UID
75+
76+
try:
77+
# Generate upload URL
78+
api_response = api_instance.generate_upload_urlv1(website_uid)
79+
print("The response of AgencyHostingFilesApi->generate_upload_urlv1:\n")
80+
pprint(api_response)
81+
except Exception as e:
82+
print("Exception when calling AgencyHostingFilesApi->generate_upload_urlv1: %s\n" % e)
83+
```
84+
85+
86+
87+
### Parameters
88+
89+
90+
Name | Type | Description | Notes
91+
------------- | ------------- | ------------- | -------------
92+
**website_uid** | **str**| Agency Plan website UID |
93+
94+
### Return type
95+
96+
[**AgencyHostingV1FilesUploadUrlResource**](AgencyHostingV1FilesUploadUrlResource.md)
97+
98+
### Authorization
99+
100+
[apiToken](../README.md#apiToken)
101+
102+
### HTTP request headers
103+
104+
- **Content-Type**: Not defined
105+
- **Accept**: application/json
106+
107+
### HTTP response details
108+
109+
| Status code | Description | Response headers |
110+
|-------------|-------------|------------------|
111+
**200** | Success response | - |
112+
**401** | Unauthenticated response | - |
113+
**500** | Error response | - |
114+
115+
[[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)
116+
10117
# **import_website_from_archive_v1**
11118
> CommonSuccessEmptyResource import_website_from_archive_v1(website_uid, agency_hosting_v1_files_import_archive_request)
12119

docs/HostingFilesApi.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,119 @@ All URIs are relative to *https://developers.hostinger.com*
44

55
Method | HTTP request | Description
66
------------- | ------------- | -------------
7+
[**generate_upload_urlv1**](HostingFilesApi.md#generate_upload_urlv1) | **POST** /api/hosting/v1/files/upload-urls | Generate upload URL
78
[**get_website_file_content_v1**](HostingFilesApi.md#get_website_file_content_v1) | **GET** /api/hosting/v1/accounts/{username}/domains/{domain}/files/content | Get website file content
89
[**list_website_files_and_directories_v1**](HostingFilesApi.md#list_website_files_and_directories_v1) | **GET** /api/hosting/v1/accounts/{username}/domains/{domain}/files | List website files and directories
910

1011

12+
# **generate_upload_urlv1**
13+
> HostingV1FilesUploadUrlResource generate_upload_urlv1(hosting_v1_files_generate_upload_url_request)
14+
15+
Generate upload URL
16+
17+
Generate a file browser upload URL with authentication credentials
18+
for uploading files directly to a website's file storage.
19+
20+
Returns `url`, `auth_key` and `rest_auth_key`. Use these to upload a file to the
21+
website's `public_html` directory via the TUS resumable upload protocol (TUS 1.0.0).
22+
Send `X-Auth: {auth_key}` and `X-Auth-Rest: {rest_auth_key}` headers on every request
23+
below.
24+
25+
1. Create the upload: `POST` to `{url}/{relative_file_path}?override=true` with headers
26+
`upload-length: {file size in bytes}` and `upload-offset: 0`. Expect `201 Created`.
27+
2. Upload the file: send the file bytes to the same location (any TUS 1.0.0 client, or
28+
`PATCH` requests with an `upload-offset` header tracking progress) until complete.
29+
30+
`relative_file_path` is the destination path inside `public_html`, e.g. `app.zip`.
31+
32+
Instead of a TUS client, plain `curl` also works:
33+
```
34+
FILE=app.zip
35+
SIZE=$(stat -f%z "$FILE") # stat -c%s on Linux
36+
37+
curl -i -X POST "{url}/${FILE}?override=true" \
38+
-H "X-Auth: {auth_key}" \
39+
-H "X-Auth-Rest: {rest_auth_key}" \
40+
-H "Tus-Resumable: 1.0.0" \
41+
-H "Upload-Length: ${SIZE}" \
42+
-H "Upload-Offset: 0"
43+
# -> 201 Created
44+
45+
curl -i -X PATCH "{url}/${FILE}?override=true" \
46+
-H "X-Auth: {auth_key}" \
47+
-H "X-Auth-Rest: {rest_auth_key}" \
48+
-H "Tus-Resumable: 1.0.0" \
49+
-H "Content-Type: application/offset+octet-stream" \
50+
-H "Upload-Offset: 0" \
51+
--data-binary "@${FILE}"
52+
# -> 204 No Content, Upload-Offset response header equals SIZE when done
53+
```
54+
55+
### Example
56+
57+
* Bearer Authentication (apiToken):
58+
59+
```python
60+
import hostinger_api
61+
from hostinger_api.models.hosting_v1_files_generate_upload_url_request import HostingV1FilesGenerateUploadUrlRequest
62+
from hostinger_api.models.hosting_v1_files_upload_url_resource import HostingV1FilesUploadUrlResource
63+
from hostinger_api.rest import ApiException
64+
from pprint import pprint
65+
66+
67+
# Configure Bearer authorization: apiToken
68+
configuration = hostinger_api.Configuration(
69+
access_token = os.environ["BEARER_TOKEN"]
70+
)
71+
72+
# Enter a context with an instance of the API client
73+
with hostinger_api.ApiClient(configuration) as api_client:
74+
# Create an instance of the API class
75+
api_instance = hostinger_api.HostingFilesApi(api_client)
76+
hosting_v1_files_generate_upload_url_request = hostinger_api.HostingV1FilesGenerateUploadUrlRequest() # HostingV1FilesGenerateUploadUrlRequest |
77+
78+
try:
79+
# Generate upload URL
80+
api_response = api_instance.generate_upload_urlv1(hosting_v1_files_generate_upload_url_request)
81+
print("The response of HostingFilesApi->generate_upload_urlv1:\n")
82+
pprint(api_response)
83+
except Exception as e:
84+
print("Exception when calling HostingFilesApi->generate_upload_urlv1: %s\n" % e)
85+
```
86+
87+
88+
89+
### Parameters
90+
91+
92+
Name | Type | Description | Notes
93+
------------- | ------------- | ------------- | -------------
94+
**hosting_v1_files_generate_upload_url_request** | [**HostingV1FilesGenerateUploadUrlRequest**](HostingV1FilesGenerateUploadUrlRequest.md)| |
95+
96+
### Return type
97+
98+
[**HostingV1FilesUploadUrlResource**](HostingV1FilesUploadUrlResource.md)
99+
100+
### Authorization
101+
102+
[apiToken](../README.md#apiToken)
103+
104+
### HTTP request headers
105+
106+
- **Content-Type**: application/json
107+
- **Accept**: application/json
108+
109+
### HTTP response details
110+
111+
| Status code | Description | Response headers |
112+
|-------------|-------------|------------------|
113+
**200** | Success response | - |
114+
**422** | Validation error response | - |
115+
**401** | Unauthenticated response | - |
116+
**500** | Error response | - |
117+
118+
[[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)
119+
11120
# **get_website_file_content_v1**
12121
> HostingV1FilesFileContentResource get_website_file_content_v1(username, domain, path, from_line=from_line, max_lines=max_lines)
13122

0 commit comments

Comments
 (0)