Skip to content

Commit

Permalink
chore(repo): cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AJCJ1 committed Dec 27, 2024
1 parent 8ed5634 commit d2e94cc
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 45 deletions.
10 changes: 5 additions & 5 deletions Example/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
var builder = WebApplication.CreateBuilder(args);

// Add Urlbox to the service container
builder.Services.AddUrlbox(options =>
builder.Services.AddUrlbox(config =>
{
// TODO Replace these with your keys from the dashboard: https://urlbox.com/dashboard/api
options.Key = "YOUR PUBLISHABLE API KEY HERE";
options.Secret = "YOUR SECRET KEY HERE";
config.Key = "YOUR PUBLISHABLE API KEY HERE";
config.Secret = "YOUR SECRET KEY HERE";
// TODO optionally add this in to test out webhooks
options.WebhookSecret = "YOUR WEBHOOK SECRET KEY HERE";
config.WebhookSecret = "YOUR WEBHOOK SECRET KEY HERE";
// if you need to use one of our specific subdomains
// options.BaseUrl = "https://api-eu.urlbox.com";
// config.BaseUrl = "https://api-eu.urlbox.com";
});

var app = builder.Build();
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@ dotnet add package urlbox.sdk.dotnet

Visit [Urlbox](https://urlbox.com) to sign up for a trial. You'll need to visit your [projects](https://urlbox.com/dashboard/projects) page, and gather your Publishable Key, Secret Key, and Webhook Secret key (if you intend on using webhooks).

With a new account you'll only have one project, so visit the project configuration page for it, where you should see something like this:

![The project settings page](Images/projectKeys.png)

## Getting Started - `TakeScreenshot()`

If you want something super simple, initialize an instance of Urlbox with the above credentials, then call our `TakeScreenshot(options)` method with the options of your choosing:
Expand Down
1 change: 0 additions & 1 deletion UrlboxSDK/Factory/UrlboxFactory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

using UrlboxSDK.Config.Resource;

namespace UrlboxSDK.Factory;
Expand Down
64 changes: 30 additions & 34 deletions UrlboxSDK/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Check out our [blog](https://urlbox.com/blog) for more insights on everything sc


# Table Of Contents

<!-- TOC -->
* [Documentation](#documentation)
* [Requirements](#requirements)
Expand All @@ -37,19 +37,19 @@ Check out our [blog](https://urlbox.com/blog) for more insights on everything sc
* [Handling Errors](#handling-errors)
* [Dependency Injection](#dependency-injection)
* [Utility Functions](#utility-functions)
* [`TakeScreenshot(options)`](#takescreenshotoptions)
* [`TakePdf(options)`](#takepdfoptions)
* [`TakeMp4(options)`](#takemp4options)
* [`TakeScreenshotWithMetadata(options)`](#takescreenshotwithmetadataoptions)
* [`ExtractMetadata(options)`](#extractmetadataoptions)
* [`ExtractMarkdown(options)`](#extractmarkdownoptions)
* [`ExtractHtml(options)`](#extracthtmloptions)
* [`ExtractMhtml(options)`](#extractmhtmloptions)
* [`DownloadAsBase64(options)`](#downloadasbase64options-)
* [`DownloadToFile(options, filePath)`](#downloadtofileoptions-filepath-)
* [`GeneratePNGUrl(options)`](#generatepngurloptions-)
* [`GenerateJPEGUrl(options)`](#generatejpegurloptions-)
* [`GeneratePDFUrl(options)`](#generatepdfurloptions-)
* [`TakeScreenshot(options)`](#takescreenshotoptions)
* [`TakePdf(options)`](#takepdfoptions)
* [`TakeMp4(options)`](#takemp4options)
* [`TakeScreenshotWithMetadata(options)`](#takescreenshotwithmetadataoptions)
* [`ExtractMetadata(options)`](#extractmetadataoptions)
* [`ExtractMarkdown(options)`](#extractmarkdownoptions)
* [`ExtractHtml(options)`](#extracthtmloptions)
* [`ExtractMhtml(options)`](#extractmhtmloptions)
* [`DownloadAsBase64(options)`](#downloadasbase64options-)
* [`DownloadToFile(options, filePath)`](#downloadtofileoptions-filepath-)
* [`GeneratePNGUrl(options)`](#generatepngurloptions-)
* [`GenerateJPEGUrl(options)`](#generatejpegurloptions-)
* [`GeneratePDFUrl(options)`](#generatepdfurloptions-)
* [Popular Use Cases](#popular-use-cases)
* [Taking a Full Page Screenshot](#taking-a-full-page-screenshot)
* [Example MP4 (Full Page)](#example-mp4--full-page-)
Expand Down Expand Up @@ -114,10 +114,6 @@ dotnet add package urlbox.sdk.dotnet

Visit [Urlbox](https://urlbox.com) to sign up for a trial. You'll need to visit your [projects](https://urlbox.com/dashboard/projects) page, and gather your Publishable Key, Secret Key, and Webhook Secret key (if you intend on using webhooks).

With a new account you'll only have one project, so visit the project configuration page for it, where you should see something like this:

![The project settings page](Images/projectKeys.png)

## Getting Started - `TakeScreenshot()`

If you want something super simple, initialize an instance of Urlbox with the above credentials, then call our `TakeScreenshot(options)` method with the options of your choosing:
Expand Down Expand Up @@ -160,15 +156,15 @@ If you use the above with your own keys, it will give you back an object with a

***

## Configuring Options
## Configuring Options

Passing options are where the magic comes in. Options are simply extra inputs that we use to adapt the way we take the screenshot, or adapt any of the other steps involved in the rendering process.

>**Note:** Almost all of our options are optional. However, you must at least provide a URL or some HTML in your options in order for us to know what we are rendering for you.
You could, for example, change the way the request is made to your desired URL (like using a proxy server, passing in extra headers, an authorization token or some cookies), or change the way the page looks (like injecting Javascript, highlighting words, or making the background a tasteful fuchsia pink).
You could, for example, change the way the request is made to your desired URL (like using a proxy server, passing in extra headers, an authorization token or some cookies), or change the way the page looks (like injecting Javascript, highlighting words, or making the background a tasteful fuchsia pink).

There are a few ways to retrieve a screenshot from Urlbox, depending on how and when you need it. You could retrieve it as a [raw file](https://urlbox.com/docs/options#response_type) (using `UrlboxOptions.ResponseType(ResponseType.Binary)` ), or by default, as a JSON object with its size and stored location.
There are a few ways to retrieve a screenshot from Urlbox, depending on how and when you need it. You could retrieve it as a [raw file](https://urlbox.com/docs/options#response_type) (using `UrlboxOptions.ResponseType(ResponseType.Binary)` ), or by default, as a JSON object with its size and stored location.

There are a plethora of other options you can use. Checkout the [docs](https://urlbox.com/docs/overview) for more information.

Expand Down Expand Up @@ -461,19 +457,19 @@ Takes a screenshot of any URL or HTML, downloads it and gives back the extracted
### `ExtractMhtml(options)`
Takes a screenshot of any URL or HTML, downloads it and gives back the extracted MHTML file as a string.

### `DownloadAsBase64(options)`
### `DownloadAsBase64(options)`
Gets a render link, runs a GET to that link to render your screenshot, then downloads the screenshot file as a Base64 string.

### `DownloadToFile(options, filePath)`
### `DownloadToFile(options, filePath)`
Gets a render link, runs a GET to that link to render your screenshot, then downloads and stores the screenshot to the given filePath.

### `GeneratePNGUrl(options)`
### `GeneratePNGUrl(options)`
Gets a render link for a screenshot in PNG format.

### `GenerateJPEGUrl(options)`
### `GenerateJPEGUrl(options)`
Gets a render link for a screenshot in JPEG format.

### `GeneratePDFUrl(options)`
### `GeneratePDFUrl(options)`
Gets a render link for a screenshot in PDF format.

# Popular Use Cases
Expand Down Expand Up @@ -544,7 +540,7 @@ SyncUrlboxResponse response = await urlbox.Render(options);

This can save you renders over the month, particularly when tackling websites like tricky social media pages.

If there is a failure, it will give you back a [UrlboxException](#urlboxexception).
If there is a failure, it will give you back a [UrlboxException](#urlboxexception).

## Extracting Markdown/Metadata/HTML

Expand Down Expand Up @@ -671,11 +667,11 @@ Go to your [projects](https://urlbox.com/dashboard/projects) page, select a proj
Urlbox urlbox = Urlbox.FromCredentials("YOUR_KEY", "YOUR_SECRET", "YOUR_WEBHOOK_SECRET");
```

### 3. Make a request through any of our rendering methods.
### 3. Make a request through any of our rendering methods.

The most common use case for a webhook is when you need to use the `/async` endpoint to handle a larger render.

If you're developing locally, we would recommend using a service like [ngrok](https://ngrok.com/), and setting your webhook URL in the options to that ngrok endpoint.
If you're developing locally, we would recommend using a service like [ngrok](https://ngrok.com/), and setting your webhook URL in the options to that ngrok endpoint.

After you've added the endpoint, for example at the endpoint `/webhooks/urlbox`, make a request to that endpoint like this:

Expand Down Expand Up @@ -734,7 +730,7 @@ Below is a brief description of every publicly available method our SDK provides
### Static Methods
- **`static Urlbox FromCredentials(string apiKey, string apiSecret, string webhookSecret)`**
Creates a new instance of the Urlbox class using the specified API key, secret, and optional webhook secret.

- **`static UrlboxOptionsBuilder Options(string? url = null, string? html = null)`**
Creates a new instance of the Urlbox options builder. Requires a URL or HTML in the constructor to get started.

Expand All @@ -761,11 +757,11 @@ Below is a brief description of every publicly available method our SDK provides
- **`Task<AsyncUrlboxResponse> TakeScreenshotWithMetadata(UrlboxOptions options);`**
Asynchronously takes a screenshot and includes metadata in the response.

- **`Task<SyncUrlboxResponse> Render(UrlboxOptions options);`**
- **`Task<SyncUrlboxResponse> Render(UrlboxOptions options);`**
- **`Task<SyncUrlboxResponse> Render(IDictionary<string, object> options);`**
Sends a synchronous request to generate a render with the provided options, returning a direct response.

- **`Task<AsyncUrlboxResponse> RenderAsync(UrlboxOptions options);`**
- **`Task<AsyncUrlboxResponse> RenderAsync(UrlboxOptions options);`**
- **`Task<AsyncUrlboxResponse> RenderAsync(IDictionary<string, object> options);`**
Sends an asynchronous render request, providing a status URL for polling until completion.

Expand Down Expand Up @@ -800,7 +796,7 @@ Below is a brief description of every publicly available method our SDK provides

- **`string GenerateRenderLink(UrlboxOptions options, string format = "png", bool sign = true);`**
Constructs an Urlbox URL for the specified format and options.

- **`string GenerateSignedRenderLink(UrlboxOptions options, string format = "png");`**
Constructs an Urlbox URL for the specified format and options signed with the consumer's secret token.

Expand Down Expand Up @@ -962,7 +958,7 @@ Get rendering!
Methods in previous versions of this SDK that would accept a Dictionary now take a standardised `UrlboxOptions` type.

- 1.0.2 - Further Updates to readme.

- 1.0.1 - Update Readme to replace instances of .io with .com.

- 1.0.0 - First release!
1 change: 0 additions & 1 deletion UrlboxSDK/Response/Resource/ErrorUrlboxResponse.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

using System.Text.Json.Serialization;

namespace UrlboxSDK.Response.Resource;
Expand Down

0 comments on commit d2e94cc

Please sign in to comment.