Class HttpEdgegapApiClient

Namespace
Unity.Multiplayer.Core

IEdgegapApiClient over Edgegap's v1 REST API (https://api.edgegap.com/v1: app-version upsert, deploy, status and stop). Verify the exact request and response shape against Edgegap's current docs before depending on this for a public launch -- a third-party API's schema can drift after this was written, which is also why the real-provider smoke test is opt-in rather than part of every build.

public sealed class HttpEdgegapApiClient : IEdgegapApiClient, IDisposable
Inheritance
HttpEdgegapApiClient
Implements
Inherited Members

Constructors

HttpEdgegapApiClient(HttpClient, bool)

Uses client as already configured (base address and auth header); disposes it only when ownsClient is true.

public HttpEdgegapApiClient(HttpClient client, bool ownsClient = false)

Parameters

client HttpClient
ownsClient bool

Exceptions

ArgumentNullException

client is null.

HttpEdgegapApiClient(string)

Talks to Edgegap at https://api.edgegap.com/v1/ with apiToken sent as its authorization header.

public HttpEdgegapApiClient(string apiToken)

Parameters

apiToken string

Exceptions

ArgumentException

apiToken is empty.

Methods

DeployAsync(EdgegapDeployRequest, CancellationToken)

Requests a deployment of an app version, for one match.

public Task<EdgegapDeployment> DeployAsync(EdgegapDeployRequest request, CancellationToken cancellationToken = default)

Parameters

request EdgegapDeployRequest
cancellationToken CancellationToken

Returns

Task<EdgegapDeployment>

Dispose()

Disposes the HttpClient if this object created it.

public void Dispose()

EnsureAppVersionAsync(EdgegapAppVersionRequest, CancellationToken)

Creates or updates the app version that points at a GHCR image, so a later DeployAsync(EdgegapDeployRequest, CancellationToken) has something to deploy. Idempotent: calling it again with the same version name and image updates that version in place rather than creating a new one.

public Task EnsureAppVersionAsync(EdgegapAppVersionRequest request, CancellationToken cancellationToken = default)

Parameters

request EdgegapAppVersionRequest
cancellationToken CancellationToken

Returns

Task

GetDeploymentAsync(string, CancellationToken)

The deployment's current status and port mapping.

public Task<EdgegapDeployment> GetDeploymentAsync(string requestId, CancellationToken cancellationToken = default)

Parameters

requestId string
cancellationToken CancellationToken

Returns

Task<EdgegapDeployment>

StopDeploymentAsync(string, CancellationToken)

Stops and tears down a deployment. Safe to call on one already gone.

public Task StopDeploymentAsync(string requestId, CancellationToken cancellationToken = default)

Parameters

requestId string
cancellationToken CancellationToken

Returns

Task