Skip to content

Latest commit

 

History

History
1245 lines (910 loc) · 51.5 KB

File metadata and controls

1245 lines (910 loc) · 51.5 KB

cloudflare_dart.api.WorkerScriptApi

Load the API package

import 'package:cloudflare_dart/api.dart';

All URIs are relative to https://api.cloudflare.com/client/v4

Method HTTP request Description
workerAssetsUpload POST /accounts/{account_id}/workers/assets/upload Upload Assets
workerDeleteScriptSecret DELETE /accounts/{account_id}/workers/scripts/{script_name}/secrets/{secret_name} Delete script secret
workerGetScriptSecret GET /accounts/{account_id}/workers/scripts/{script_name}/secrets/{secret_name} Get secret binding
workerListScriptSecrets GET /accounts/{account_id}/workers/scripts/{script_name}/secrets List script secrets
workerPutScriptSecret PUT /accounts/{account_id}/workers/scripts/{script_name}/secrets Add script secret
workerScriptDeleteSubdomain DELETE /accounts/{account_id}/workers/scripts/{script_name}/subdomain Delete Worker subdomain
workerScriptDeleteWorker DELETE /accounts/{account_id}/workers/scripts/{script_name} Delete Worker
workerScriptDownloadWorker GET /accounts/{account_id}/workers/scripts/{script_name} Download Worker
workerScriptFetchUsageModel GET /accounts/{account_id}/workers/scripts/{script_name}/usage-model Fetch Usage Model
workerScriptGetContent GET /accounts/{account_id}/workers/scripts/{script_name}/content/v2 Get script content
workerScriptGetSettings GET /accounts/{account_id}/workers/scripts/{script_name}/settings Get Settings
workerScriptGetSubdomain GET /accounts/{account_id}/workers/scripts/{script_name}/subdomain Get Worker subdomain
workerScriptListWorkers GET /accounts/{account_id}/workers/scripts List Workers
workerScriptPatchSettings PATCH /accounts/{account_id}/workers/scripts/{script_name}/settings Patch Settings
workerScriptPostSubdomain POST /accounts/{account_id}/workers/scripts/{script_name}/subdomain Post Worker subdomain
workerScriptPutContent PUT /accounts/{account_id}/workers/scripts/{script_name}/content Put script content
workerScriptSearchWorkers GET /accounts/{account_id}/workers/scripts-search Search Workers
workerScriptSettingsGetSettings GET /accounts/{account_id}/workers/scripts/{script_name}/script-settings Get Script Settings
workerScriptSettingsPatchSettings PATCH /accounts/{account_id}/workers/scripts/{script_name}/script-settings Patch Script Settings
workerScriptUpdateCreateAssetsUploadSession POST /accounts/{account_id}/workers/scripts/{script_name}/assets-upload-session Create Assets Upload Session
workerScriptUpdateUsageModel PUT /accounts/{account_id}/workers/scripts/{script_name}/usage-model Update Usage Model
workerScriptUploadWorkerModule PUT /accounts/{account_id}/workers/scripts/{script_name} Upload Worker Module

workerAssetsUpload

WorkersCompletedUploadAssetsResponse workerAssetsUpload(accountId, base64)

Upload Assets

Upload assets ahead of creating a Worker version. To learn more about the direct uploads of assets, see https://developers.cloudflare.com/workers/static-assets/direct-upload/.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: user_service_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('user_service_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('user_service_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final bool base64 = true; // bool | 

try {
    final response = api.workerAssetsUpload(accountId, base64);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerAssetsUpload: $e\n');
}

Parameters

Name Type Description Notes
accountId String
base64 bool

Return type

WorkersCompletedUploadAssetsResponse

Authorization

user_service_key, api_key, api_token, api_email

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerDeleteScriptSecret

WorkersApiResponseNullResult workerDeleteScriptSecret(accountId, scriptName, secretName, urlEncoded)

Delete script secret

Remove a secret from a script.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String scriptName = scriptName_example; // String | 
final String secretName = secretName_example; // String | 
final bool urlEncoded = true; // bool | 

try {
    final response = api.workerDeleteScriptSecret(accountId, scriptName, secretName, urlEncoded);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerDeleteScriptSecret: $e\n');
}

Parameters

Name Type Description Notes
accountId String
scriptName String
secretName String
urlEncoded bool [optional]

Return type

WorkersApiResponseNullResult

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerGetScriptSecret

WorkerPutScriptSecret200Response workerGetScriptSecret(accountId, scriptName, secretName, urlEncoded)

Get secret binding

Get a given secret binding (value omitted) on a script.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String scriptName = scriptName_example; // String | 
final String secretName = secretName_example; // String | 
final bool urlEncoded = true; // bool | 

try {
    final response = api.workerGetScriptSecret(accountId, scriptName, secretName, urlEncoded);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerGetScriptSecret: $e\n');
}

Parameters

Name Type Description Notes
accountId String
scriptName String
secretName String
urlEncoded bool [optional]

Return type

WorkerPutScriptSecret200Response

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerListScriptSecrets

WorkerListScriptSecrets200Response workerListScriptSecrets(accountId, scriptName)

List script secrets

List secrets bound to a script.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String scriptName = scriptName_example; // String | 

try {
    final response = api.workerListScriptSecrets(accountId, scriptName);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerListScriptSecrets: $e\n');
}

Parameters

Name Type Description Notes
accountId String
scriptName String

Return type

WorkerListScriptSecrets200Response

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerPutScriptSecret

WorkerPutScriptSecret200Response workerPutScriptSecret(accountId, scriptName, workersSecret)

Add script secret

Add a secret to a script.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String scriptName = scriptName_example; // String | 
final WorkersSecret workersSecret = ; // WorkersSecret | 

try {
    final response = api.workerPutScriptSecret(accountId, scriptName, workersSecret);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerPutScriptSecret: $e\n');
}

Parameters

Name Type Description Notes
accountId String
scriptName String
workersSecret WorkersSecret

Return type

WorkerPutScriptSecret200Response

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerScriptDeleteSubdomain

WorkerScriptGetSubdomain200Response workerScriptDeleteSubdomain(accountId, scriptName)

Delete Worker subdomain

Disable all workers.dev subdomains for a Worker.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String scriptName = scriptName_example; // String | 

try {
    final response = api.workerScriptDeleteSubdomain(accountId, scriptName);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerScriptDeleteSubdomain: $e\n');
}

Parameters

Name Type Description Notes
accountId String
scriptName String

Return type

WorkerScriptGetSubdomain200Response

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerScriptDeleteWorker

WorkersApiResponseNullResult workerScriptDeleteWorker(accountId, scriptName, force)

Delete Worker

Delete your worker. This call has no response body on a successful delete.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String scriptName = scriptName_example; // String | 
final bool force = true; // bool | If set to true, delete will not be stopped by associated service binding, durable object, or other binding. Any of these associated bindings/durable objects will be deleted along with the script.

try {
    final response = api.workerScriptDeleteWorker(accountId, scriptName, force);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerScriptDeleteWorker: $e\n');
}

Parameters

Name Type Description Notes
accountId String
scriptName String
force bool If set to true, delete will not be stopped by associated service binding, durable object, or other binding. Any of these associated bindings/durable objects will be deleted along with the script. [optional]

Return type

WorkersApiResponseNullResult

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerScriptDownloadWorker

String workerScriptDownloadWorker(accountId, scriptName)

Download Worker

Fetch raw script content for your worker. Note this is the original script content, not JSON encoded.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String scriptName = scriptName_example; // String | 

try {
    final response = api.workerScriptDownloadWorker(accountId, scriptName);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerScriptDownloadWorker: $e\n');
}

Parameters

Name Type Description Notes
accountId String
scriptName String

Return type

String

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/javascript, multipart/form-data, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerScriptFetchUsageModel

WorkersUsageModelResponse workerScriptFetchUsageModel(accountId, scriptName)

Fetch Usage Model

Fetches the Usage Model for a given Worker.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String scriptName = scriptName_example; // String | 

try {
    final response = api.workerScriptFetchUsageModel(accountId, scriptName);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerScriptFetchUsageModel: $e\n');
}

Parameters

Name Type Description Notes
accountId String
scriptName String

Return type

WorkersUsageModelResponse

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerScriptGetContent

String workerScriptGetContent(accountId, scriptName)

Get script content

Fetch script content only.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String scriptName = scriptName_example; // String | 

try {
    final response = api.workerScriptGetContent(accountId, scriptName);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerScriptGetContent: $e\n');
}

Parameters

Name Type Description Notes
accountId String
scriptName String

Return type

String

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: Not defined
  • Accept: string, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerScriptGetSettings

WorkersScriptAndVersionSettingsResponse workerScriptGetSettings(accountId, scriptName)

Get Settings

Get metadata and config, such as bindings or usage model.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String scriptName = scriptName_example; // String | 

try {
    final response = api.workerScriptGetSettings(accountId, scriptName);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerScriptGetSettings: $e\n');
}

Parameters

Name Type Description Notes
accountId String
scriptName String

Return type

WorkersScriptAndVersionSettingsResponse

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerScriptGetSubdomain

WorkerScriptGetSubdomain200Response workerScriptGetSubdomain(accountId, scriptName)

Get Worker subdomain

Get if the Worker is available on the workers.dev subdomain.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String scriptName = scriptName_example; // String | 

try {
    final response = api.workerScriptGetSubdomain(accountId, scriptName);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerScriptGetSubdomain: $e\n');
}

Parameters

Name Type Description Notes
accountId String
scriptName String

Return type

WorkerScriptGetSubdomain200Response

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerScriptListWorkers

WorkersScriptResponseCollection workerScriptListWorkers(accountId, tags)

List Workers

Fetch a list of uploaded workers.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String tags = production:yes,staging:no; // String | Filter scripts by tags. Format: comma-separated list of tag:allowed pairs where allowed is 'yes' or 'no'.

try {
    final response = api.workerScriptListWorkers(accountId, tags);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerScriptListWorkers: $e\n');
}

Parameters

Name Type Description Notes
accountId String
tags String Filter scripts by tags. Format: comma-separated list of tag:allowed pairs where allowed is 'yes' or 'no'. [optional]

Return type

WorkersScriptResponseCollection

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerScriptPatchSettings

WorkersScriptAndVersionSettingsResponse workerScriptPatchSettings(accountId, scriptName, settings)

Patch Settings

Patch metadata or config, such as bindings or usage model.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String scriptName = scriptName_example; // String | 
final WorkersScriptAndVersionSettingsItem settings = ; // WorkersScriptAndVersionSettingsItem | 

try {
    final response = api.workerScriptPatchSettings(accountId, scriptName, settings);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerScriptPatchSettings: $e\n');
}

Parameters

Name Type Description Notes
accountId String
scriptName String
settings WorkersScriptAndVersionSettingsItem [optional]

Return type

WorkersScriptAndVersionSettingsResponse

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerScriptPostSubdomain

WorkerScriptGetSubdomain200Response workerScriptPostSubdomain(accountId, scriptName, workerScriptPostSubdomainRequest)

Post Worker subdomain

Enable or disable the Worker on the workers.dev subdomain.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String scriptName = scriptName_example; // String | 
final WorkerScriptPostSubdomainRequest workerScriptPostSubdomainRequest = ; // WorkerScriptPostSubdomainRequest | 

try {
    final response = api.workerScriptPostSubdomain(accountId, scriptName, workerScriptPostSubdomainRequest);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerScriptPostSubdomain: $e\n');
}

Parameters

Name Type Description Notes
accountId String
scriptName String
workerScriptPostSubdomainRequest WorkerScriptPostSubdomainRequest

Return type

WorkerScriptGetSubdomain200Response

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerScriptPutContent

WorkersScriptResponseSingle workerScriptPutContent(accountId, scriptName, metadata, CF_WORKER_BODY_PART, CF_WORKER_MAIN_MODULE_PART, files)

Put script content

Put script content without touching config or metadata.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String scriptName = scriptName_example; // String | 
final WorkerScriptPutContentRequestMetadata metadata = ; // WorkerScriptPutContentRequestMetadata | 
final String CF_WORKER_BODY_PART = CF_WORKER_BODY_PART_example; // String | The multipart name of a script upload part containing script content in service worker format. Alternative to including in a metadata part.
final String CF_WORKER_MAIN_MODULE_PART = CF_WORKER_MAIN_MODULE_PART_example; // String | The multipart name of a script upload part containing script content in es module format. Alternative to including in a metadata part.
final BuiltList<MultipartFile> files = /path/to/file.txt; // BuiltList<MultipartFile> | An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.<br/>Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`.

try {
    final response = api.workerScriptPutContent(accountId, scriptName, metadata, CF_WORKER_BODY_PART, CF_WORKER_MAIN_MODULE_PART, files);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerScriptPutContent: $e\n');
}

Parameters

Name Type Description Notes
accountId String
scriptName String
metadata WorkerScriptPutContentRequestMetadata
CF_WORKER_BODY_PART String The multipart name of a script upload part containing script content in service worker format. Alternative to including in a metadata part. [optional]
CF_WORKER_MAIN_MODULE_PART String The multipart name of a script upload part containing script content in es module format. Alternative to including in a metadata part. [optional]
files BuiltList<MultipartFile> An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as main_module or body_part by filename.
Possible Content-Type(s) are: application/javascript+module, text/javascript+module, application/javascript, text/javascript, text/x-python, text/x-python-requirement, application/wasm, text/plain, application/octet-stream, application/source-map.
[optional]

Return type

WorkersScriptResponseSingle

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerScriptSearchWorkers

WorkerScriptSearchWorkers200Response workerScriptSearchWorkers(accountId, name, id, orderBy, page, perPage)

Search Workers

Search for Workers in an account.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String name = my-worker; // String | 
final String id = bdf3567828824b74aadd550004cf4913; // String | 
final String orderBy = created_on; // String | 
final int page = 56; // int | Current page.
final int perPage = 56; // int | Items per page.

try {
    final response = api.workerScriptSearchWorkers(accountId, name, id, orderBy, page, perPage);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerScriptSearchWorkers: $e\n');
}

Parameters

Name Type Description Notes
accountId String
name String [optional]
id String [optional]
orderBy String [optional] [default to 'name']
page int Current page. [optional] [default to 1]
perPage int Items per page. [optional] [default to 10]

Return type

WorkerScriptSearchWorkers200Response

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerScriptSettingsGetSettings

WorkersScriptSettingsResponse workerScriptSettingsGetSettings(accountId, scriptName)

Get Script Settings

Get script-level settings when using Worker Versions. Includes Logpush and Tail Consumers.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String scriptName = scriptName_example; // String | 

try {
    final response = api.workerScriptSettingsGetSettings(accountId, scriptName);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerScriptSettingsGetSettings: $e\n');
}

Parameters

Name Type Description Notes
accountId String
scriptName String

Return type

WorkersScriptSettingsResponse

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerScriptSettingsPatchSettings

WorkersScriptSettingsResponse workerScriptSettingsPatchSettings(accountId, scriptName, workersScriptSettingsItem)

Patch Script Settings

Patch script-level settings when using Worker Versions. Including but not limited to Logpush and Tail Consumers.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String scriptName = scriptName_example; // String | 
final WorkersScriptSettingsItem workersScriptSettingsItem = ; // WorkersScriptSettingsItem | 

try {
    final response = api.workerScriptSettingsPatchSettings(accountId, scriptName, workersScriptSettingsItem);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerScriptSettingsPatchSettings: $e\n');
}

Parameters

Name Type Description Notes
accountId String
scriptName String
workersScriptSettingsItem WorkersScriptSettingsItem

Return type

WorkersScriptSettingsResponse

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerScriptUpdateCreateAssetsUploadSession

WorkersCreateAssetsUploadSessionResponse workerScriptUpdateCreateAssetsUploadSession(accountId, scriptName, workersCreateAssetsUploadSessionObject)

Create Assets Upload Session

Start uploading a collection of assets for use in a Worker version. To learn more about the direct uploads of assets, see https://developers.cloudflare.com/workers/static-assets/direct-upload/.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String scriptName = scriptName_example; // String | 
final WorkersCreateAssetsUploadSessionObject workersCreateAssetsUploadSessionObject = ; // WorkersCreateAssetsUploadSessionObject | 

try {
    final response = api.workerScriptUpdateCreateAssetsUploadSession(accountId, scriptName, workersCreateAssetsUploadSessionObject);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerScriptUpdateCreateAssetsUploadSession: $e\n');
}

Parameters

Name Type Description Notes
accountId String
scriptName String
workersCreateAssetsUploadSessionObject WorkersCreateAssetsUploadSessionObject

Return type

WorkersCreateAssetsUploadSessionResponse

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerScriptUpdateUsageModel

WorkersUsageModelResponse workerScriptUpdateUsageModel(accountId, scriptName, workerScriptUpdateUsageModelRequest)

Update Usage Model

Updates the Usage Model for a given Worker. Requires a Workers Paid subscription.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String scriptName = scriptName_example; // String | 
final WorkerScriptUpdateUsageModelRequest workerScriptUpdateUsageModelRequest = ; // WorkerScriptUpdateUsageModelRequest | 

try {
    final response = api.workerScriptUpdateUsageModel(accountId, scriptName, workerScriptUpdateUsageModelRequest);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerScriptUpdateUsageModel: $e\n');
}

Parameters

Name Type Description Notes
accountId String
scriptName String
workerScriptUpdateUsageModelRequest WorkerScriptUpdateUsageModelRequest

Return type

WorkersUsageModelResponse

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

workerScriptUploadWorkerModule

NamespaceWorkerScriptUploadWorkerModule200Response workerScriptUploadWorkerModule(accountId, scriptName, body)

Upload Worker Module

Upload a worker module. You can find more about the multipart metadata on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/.

Example

import 'package:cloudflare_dart/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_email
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_email').apiKeyPrefix = 'Bearer';

final api = CloudflareDart().getWorkerScriptApi();
final String accountId = accountId_example; // String | 
final String scriptName = scriptName_example; // String | 
final String body = body_example; // String | 

try {
    final response = api.workerScriptUploadWorkerModule(accountId, scriptName, body);
    print(response);
} catch on DioException (e) {
    print('Exception when calling WorkerScriptApi->workerScriptUploadWorkerModule: $e\n');
}

Parameters

Name Type Description Notes
accountId String
scriptName String
body String

Return type

NamespaceWorkerScriptUploadWorkerModule200Response

Authorization

api_key, api_token, api_email

HTTP request headers

  • Content-Type: application/javascript, multipart/form-data, text/javascript
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]