Skip to content

Commit

Permalink
setup edge scripting api base class and api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ToshY committed Nov 17, 2024
1 parent 96f6b12 commit 23c5693
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 0 deletions.
32 changes: 32 additions & 0 deletions docs/edge-scripting-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Edge Scripting API

Edge Scripting is a serverless JavaScript platform built on top of Deno, designed to help developers build, deploy, and run JavaScript applications on our massive global network without worrying about hardware, scaling, or load balancing ever again.

## Setup

```php
<?php

require 'vendor/autoload.php';

use ToshY\BunnyNet\EdgeScriptingAPI;
use ToshY\BunnyNet\Client\BunnyClient;

// Create a BunnyClient using any HTTP client implementing "Psr\Http\Client\ClientInterface".
$bunnyClient = new BunnyClient(
client: new \Symfony\Component\HttpClient\Psr18Client(),
);

// Provide the API key available at the "Account Settings > API" section.
$edgeScriptingApi = new EdgeScriptingAPI(
apiKey: '2cebf4f8-4bff-429f-86f6-bce2c2163d7e89fb0a86-a1b2-463c-a142-11eba8811989',
client: $bunnyClient,
);
```

## Usage

## Reference

* [Edge Scripting API](https://docs.bunny.net/reference/getedgescriptcodeendpoint_getcode)
* [Blog "Introducing Edge Scripting: A better way to build and run applications at the edge!" (07-11-2024)](https://bunny.net/blog/introducing-bunny-edge-scripting-a-better-way-to-build-and-deploy-applications-at-the-edge/)
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ nav:
- Base: base-api.md
- Edge Storage: edge-storage-api.md
- Stream: stream-api.md
- Edge Scripting: edge-scripting-api.md
- Logging: logging-api.md
- Other:
- Image Processing: image-processing.md
Expand Down
24 changes: 24 additions & 0 deletions src/EdgeScriptingAPI.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace ToshY\BunnyNet;

use ToshY\BunnyNet\Client\BunnyClient;
use ToshY\BunnyNet\Enum\Host;

class EdgeScriptingAPI
{
/**
* @param string $apiKey
* @param BunnyClient $client
*/
public function __construct(
protected readonly string $apiKey,
protected readonly BunnyClient $client,
) {
$this->client
->setApiKey($this->apiKey)
->setBaseUrl(Host::API_ENDPOINT);
}
}
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.

0 comments on commit 23c5693

Please sign in to comment.