Table of Contents

Interface IKasClient

Namespace
KASserver
Assembly
KASserver.Client.dll

High-level client for the ALL-INKL.COM KAS API. Authentication, session handling and flood throttling are handled transparently.

public interface IKasClient

Methods

AddAccountAsync(AddAccount, CancellationToken)

Creates a subaccount (add_account). Requires a superuser login.

Task<string> AddAccountAsync(AddAccount account, CancellationToken cancellationToken = default)

Parameters

account AddAccount

The subaccount to create.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<string>

The account_login of the created subaccount, as returned by KAS.

Exceptions

KasApiException

The KAS API returned a fault or did not return an account login.

AddDnsRecordAsync(AddDnsRecord, CancellationToken)

Creates a DNS resource record (add_dns_settings).

Task<string> AddDnsRecordAsync(AddDnsRecord record, CancellationToken cancellationToken = default)

Parameters

record AddDnsRecord

The record to create.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<string>

The technical record_id generated by KAS, required for subsequent update/delete calls.

Remarks

Requires the account's DNS-settings permission; without it KAS faults with dns_settings_not_allowed. The same applies to UpdateDnsRecordAsync(string, UpdateDnsRecord, CancellationToken), DeleteDnsRecordAsync(string, CancellationToken) and ResetDnsSettingsAsync(string, string?, CancellationToken).

Exceptions

KasApiException

The KAS API returned a fault or did not return a record id.

AddDynDnsUserAsync(AddDynDnsUser, CancellationToken)

Creates a DynDNS user (add_ddnsuser) that can update the A/AAAA record of {Label}.{Zone} via DynDNS.

Task<string> AddDynDnsUserAsync(AddDynDnsUser user, CancellationToken cancellationToken = default)

Parameters

user AddDynDnsUser

The DynDNS user to create.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<string>

The technical DynDNS login generated by KAS, required for subsequent update/delete calls.

Exceptions

KasApiException

The KAS API returned a fault or did not return a DynDNS login.

AddMailAccountAsync(AddMailAccount, CancellationToken)

Creates a mailbox (add_mailaccount).

Task<string> AddMailAccountAsync(AddMailAccount account, CancellationToken cancellationToken = default)

Parameters

account AddMailAccount

The mailbox to create.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<string>

The technical mail login generated by KAS (e.g. m07f821c), required for subsequent update/delete calls.

Exceptions

KasApiException

The KAS API returned a fault or did not return a mail login.

AddMailForwardAsync(AddMailForward, CancellationToken)

Creates a mail forward (add_mailforward).

Task AddMailForwardAsync(AddMailForward forward, CancellationToken cancellationToken = default)

Parameters

forward AddMailForward

The forward to create.

cancellationToken CancellationToken

A cancellation token.

Returns

Task

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

AddSubdomainAsync(AddSubdomain, CancellationToken)

Creates a subdomain (add_subdomain). The new host is {SubdomainName}.{DomainName}.

Task<string> AddSubdomainAsync(AddSubdomain subdomain, CancellationToken cancellationToken = default)

Parameters

subdomain AddSubdomain

The subdomain to create.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<string>

The full host name of the created subdomain ({SubdomainName}.{DomainName}), used to address it in subsequent update/delete/get calls.

Remarks

KAS provisions the subdomain asynchronously: it reports in_progress = TRUE for a short while after creation, and UpdateSubdomainAsync(string, UpdateSubdomain, CancellationToken) is rejected with an in_progress fault until that clears.

Exceptions

KasApiException

The KAS API returned a fault or did not return a subdomain name.

DeleteAccountAsync(string, CancellationToken)

Deletes a subaccount (delete_account). Requires a superuser login. Irreversible: removes the subaccount including all of its resources.

Task DeleteAccountAsync(string accountLogin, CancellationToken cancellationToken = default)

Parameters

accountLogin string

The subaccount login (e.g. w01abcde).

cancellationToken CancellationToken

A cancellation token.

Returns

Task

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

DeleteDnsRecordAsync(string, CancellationToken)

Deletes a DNS resource record (delete_dns_settings). Identified by its record_id.

Task DeleteDnsRecordAsync(string recordId, CancellationToken cancellationToken = default)

Parameters

recordId string

The technical record id, as returned by AddDnsRecordAsync(AddDnsRecord, CancellationToken) or GetDnsRecordsAsync(string, CancellationToken).

cancellationToken CancellationToken

A cancellation token.

Returns

Task

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

DeleteDynDnsUserAsync(string, CancellationToken)

Deletes a DynDNS user (delete_ddnsuser). Identified by its dyndns_login.

Task DeleteDynDnsUserAsync(string dyndnsLogin, CancellationToken cancellationToken = default)

Parameters

dyndnsLogin string

The DynDNS login.

cancellationToken CancellationToken

A cancellation token.

Returns

Task

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

DeleteMailAccountAsync(string, CancellationToken)

Deletes a mailbox (delete_mailaccount). Identified by the mail_login, not the address.

Task DeleteMailAccountAsync(string mailLogin, CancellationToken cancellationToken = default)

Parameters

mailLogin string

The technical mail login (e.g. m07f821c).

cancellationToken CancellationToken

A cancellation token.

Returns

Task

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

DeleteMailForwardAsync(string, CancellationToken)

Deletes a mail forward (delete_mailforward). Identified by the full forwarding address.

Task DeleteMailForwardAsync(string mailForward, CancellationToken cancellationToken = default)

Parameters

mailForward string

The full forwarding address, e.g. info@example.com.

cancellationToken CancellationToken

A cancellation token.

Returns

Task

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

DeleteSubdomainAsync(string, CancellationToken)

Deletes a subdomain (delete_subdomain). Identified by its host name.

Task DeleteSubdomainAsync(string subdomainName, CancellationToken cancellationToken = default)

Parameters

subdomainName string

The subdomain host name, e.g. shop.example.com.

cancellationToken CancellationToken

A cancellation token.

Returns

Task

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

GetAccountAsync(string, CancellationToken)

Reads a single subaccount by its login (get_accounts with an account_login filter). Requires a superuser login.

Task<SubAccount?> GetAccountAsync(string accountLogin, CancellationToken cancellationToken = default)

Parameters

accountLogin string

The subaccount login (e.g. w01abcde).

cancellationToken CancellationToken

A cancellation token.

Returns

Task<SubAccount>

The subaccount, or null when no account matches the login.

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

GetAccountResourcesAsync(CancellationToken)

Reads the account resource quotas (get_accountresources).

Task<IReadOnlyDictionary<string, object?>> GetAccountResourcesAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A cancellation token.

Returns

Task<IReadOnlyDictionary<string, object>>

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

GetAccountResourcesTypedAsync(CancellationToken)

Reads the account resource quotas as a typed model (get_accountresources).

Task<AccountResources> GetAccountResourcesTypedAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A cancellation token.

Returns

Task<AccountResources>

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

GetAccountSettingsAsync(CancellationToken)

Reads the account settings (get_accountsettings).

Task<IReadOnlyDictionary<string, object?>> GetAccountSettingsAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A cancellation token.

Returns

Task<IReadOnlyDictionary<string, object>>

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

GetAccountSettingsTypedAsync(CancellationToken)

Reads the account settings as a typed model (get_accountsettings).

Task<AccountSettings> GetAccountSettingsTypedAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A cancellation token.

Returns

Task<AccountSettings>

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

GetAccountsAsync(CancellationToken)

Lists the subaccounts (get_accounts). Requires a superuser login.

Task<IReadOnlyList<SubAccount>> GetAccountsAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A cancellation token.

Returns

Task<IReadOnlyList<SubAccount>>

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

GetDnsRecordAsync(string, string, CancellationToken)

Reads a single DNS resource record by its id (get_dns_settings with a record_id filter). A missing trailing dot on zoneHost is added automatically.

Task<DnsRecord?> GetDnsRecordAsync(string zoneHost, string recordId, CancellationToken cancellationToken = default)

Parameters

zoneHost string

The DNS zone the record belongs to, e.g. example.com.

recordId string

The technical record id to look up.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<DnsRecord>

The matching record, or null when no record matches the id.

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

GetDnsRecordsAsync(string, CancellationToken)

Lists the DNS resource records of a zone (get_dns_settings). A missing trailing dot on zoneHost is added automatically.

Task<IReadOnlyList<DnsRecord>> GetDnsRecordsAsync(string zoneHost, CancellationToken cancellationToken = default)

Parameters

zoneHost string

The DNS zone, e.g. example.com (or example.com.).

cancellationToken CancellationToken

A cancellation token.

Returns

Task<IReadOnlyList<DnsRecord>>

The resource records of the zone.

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

GetDomainsAsync(CancellationToken)

Lists the domains on the account (get_domains).

Task<IReadOnlyList<IReadOnlyDictionary<string, object?>>> GetDomainsAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A cancellation token.

Returns

Task<IReadOnlyList<IReadOnlyDictionary<string, object>>>

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

GetDynDnsUserAsync(string, CancellationToken)

Reads a single DynDNS user by its login (get_ddnsusers with a ddns_login filter).

Task<DynDnsUser?> GetDynDnsUserAsync(string dyndnsLogin, CancellationToken cancellationToken = default)

Parameters

dyndnsLogin string

The DynDNS login.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<DynDnsUser>

The DynDNS user, or null when no user matches the login.

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

GetDynDnsUsersAsync(CancellationToken)

Lists the DynDNS users on the account (get_ddnsusers).

Task<IReadOnlyList<DynDnsUser>> GetDynDnsUsersAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A cancellation token.

Returns

Task<IReadOnlyList<DynDnsUser>>

The DynDNS users on the account.

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

GetMailAccountsAsync(CancellationToken)

Lists the mailboxes on the account (get_mailaccounts).

Task<IReadOnlyList<MailAccount>> GetMailAccountsAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A cancellation token.

Returns

Task<IReadOnlyList<MailAccount>>

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

GetMailForwardsAsync(CancellationToken)

Lists the mail forwards on the account (get_mailforwards).

Task<IReadOnlyList<MailForward>> GetMailForwardsAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A cancellation token.

Returns

Task<IReadOnlyList<MailForward>>

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

GetSubdomainAsync(string, CancellationToken)

Reads a single subdomain by its host name (get_subdomains with a subdomain_name filter).

Task<Subdomain?> GetSubdomainAsync(string subdomainName, CancellationToken cancellationToken = default)

Parameters

subdomainName string

The subdomain host name, e.g. shop.example.com.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<Subdomain>

The matching subdomain, or null when no subdomain matches the name.

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

GetSubdomainsAsync(CancellationToken)

Lists the subdomains on the account (get_subdomains).

Task<IReadOnlyList<Subdomain>> GetSubdomainsAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A cancellation token.

Returns

Task<IReadOnlyList<Subdomain>>

The subdomains on the account.

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

MoveSubdomainAsync(string, string, string, CancellationToken)

Moves a subdomain between accounts (move_subdomain). Identified by its host name.

Task MoveSubdomainAsync(string subdomainName, string sourceAccount, string targetAccount, CancellationToken cancellationToken = default)

Parameters

subdomainName string

The subdomain host name, e.g. shop.example.com.

sourceAccount string

The source account the subdomain currently belongs to (source_account).

targetAccount string

The target account the subdomain is moved to (target_account).

cancellationToken CancellationToken

A cancellation token.

Returns

Task

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

RequestAsync(string, IReadOnlyDictionary<string, object?>?, CancellationToken)

Invokes any KAS action directly and returns the parsed response. Use this as an escape hatch for actions that do not yet have a typed wrapper.

Task<KasResponse> RequestAsync(string action, IReadOnlyDictionary<string, object?>? parameters = null, CancellationToken cancellationToken = default)

Parameters

action string

The KAS action name, e.g. get_dns_settings.

parameters IReadOnlyDictionary<string, object>

The action parameters.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<KasResponse>

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

ResetDnsSettingsAsync(string, string?, CancellationToken)

Resets the DNS settings of a whole zone to the KAS defaults (reset_dns_settings). Destructive: discards all custom resource records of the zone. A missing trailing dot on zoneHost is added automatically.

Task ResetDnsSettingsAsync(string zoneHost, string? nameserver = null, CancellationToken cancellationToken = default)

Parameters

zoneHost string

The DNS zone to reset, e.g. example.com.

nameserver string

The name server to apply (nameserver); when null the KAS default ns5.kasserver.com is used.

cancellationToken CancellationToken

A cancellation token.

Returns

Task

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

UpdateAccountAsync(string, UpdateAccount, CancellationToken)

Edits a subaccount (update_account). Identified by its account_login. Requires a superuser login.

Task UpdateAccountAsync(string accountLogin, UpdateAccount changes, CancellationToken cancellationToken = default)

Parameters

accountLogin string

The subaccount login (e.g. w01abcde).

changes UpdateAccount

The fields to change; unset fields are left unchanged.

cancellationToken CancellationToken

A cancellation token.

Returns

Task

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

UpdateAccountSettingsAsync(UpdateAccountSettings, CancellationToken)

Edits your own account settings (update_accountsettings).

Task UpdateAccountSettingsAsync(UpdateAccountSettings changes, CancellationToken cancellationToken = default)

Parameters

changes UpdateAccountSettings

The fields to change; unset fields are left unchanged.

cancellationToken CancellationToken

A cancellation token.

Returns

Task

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

UpdateChownAsync(UpdateChown, CancellationToken)

Changes ownership of a path (update_chown). Requires a superuser login.

Task UpdateChownAsync(UpdateChown chown, CancellationToken cancellationToken = default)

Parameters

chown UpdateChown

The path, new owner and recursion flag.

cancellationToken CancellationToken

A cancellation token.

Returns

Task

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

UpdateDnsRecordAsync(string, UpdateDnsRecord, CancellationToken)

Edits a DNS resource record (update_dns_settings). Identified by its record_id. The record type cannot be changed via this action.

Task UpdateDnsRecordAsync(string recordId, UpdateDnsRecord changes, CancellationToken cancellationToken = default)

Parameters

recordId string

The technical record id, as returned by AddDnsRecordAsync(AddDnsRecord, CancellationToken) or GetDnsRecordsAsync(string, CancellationToken).

changes UpdateDnsRecord

The fields to change; unset fields are left unchanged.

cancellationToken CancellationToken

A cancellation token.

Returns

Task

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

UpdateDynDnsUserAsync(string, UpdateDynDnsUser, CancellationToken)

Edits a DynDNS user (update_ddnsuser). Identified by its dyndns_login.

Task UpdateDynDnsUserAsync(string dyndnsLogin, UpdateDynDnsUser changes, CancellationToken cancellationToken = default)

Parameters

dyndnsLogin string

The DynDNS login, as returned by AddDynDnsUserAsync(AddDynDnsUser, CancellationToken) or GetDynDnsUsersAsync(CancellationToken).

changes UpdateDynDnsUser

The fields to change; unset fields are left unchanged.

cancellationToken CancellationToken

A cancellation token.

Returns

Task

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

UpdateMailAccountAsync(string, UpdateMailAccount, CancellationToken)

Edits a mailbox (update_mailaccount). Identified by the technical mail_login.

Task UpdateMailAccountAsync(string mailLogin, UpdateMailAccount changes, CancellationToken cancellationToken = default)

Parameters

mailLogin string

The technical mail login (e.g. m07f821c), as returned by AddMailAccountAsync(AddMailAccount, CancellationToken).

changes UpdateMailAccount

The fields to change; unset fields are left unchanged.

cancellationToken CancellationToken

A cancellation token.

Returns

Task

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

UpdateMailAccountPasswordAsync(string, string, CancellationToken)

Changes a mailbox password (update_mailaccount) — a convenience wrapper over UpdateMailAccountAsync(string, UpdateMailAccount, CancellationToken). Identified by the technical mail_login.

Task UpdateMailAccountPasswordAsync(string mailLogin, string newPassword, CancellationToken cancellationToken = default)

Parameters

mailLogin string

The technical mail login (e.g. m07f821c).

newPassword string

The new mailbox password.

cancellationToken CancellationToken

A cancellation token.

Returns

Task

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

UpdateSubdomainAsync(string, UpdateSubdomain, CancellationToken)

Edits a subdomain (update_subdomain). Identified by its host name.

Task UpdateSubdomainAsync(string subdomainName, UpdateSubdomain changes, CancellationToken cancellationToken = default)

Parameters

subdomainName string

The subdomain host name, e.g. shop.example.com.

changes UpdateSubdomain

The fields to change; unset fields are left unchanged.

cancellationToken CancellationToken

A cancellation token.

Returns

Task

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.

UpdateSuperuserSettingsAsync(string, UpdateSuperuserSettings, CancellationToken)

Edits the superuser-controlled settings (SSH access/keys) of a subaccount (update_superusersettings). May only be executed by the main account.

Task UpdateSuperuserSettingsAsync(string accountLogin, UpdateSuperuserSettings changes, CancellationToken cancellationToken = default)

Parameters

accountLogin string

The subaccount login to edit (e.g. w01abcde).

changes UpdateSuperuserSettings

The fields to change; unset fields are left unchanged.

cancellationToken CancellationToken

A cancellation token.

Returns

Task

Exceptions

KasApiException

The KAS API returned a fault or an uninterpretable response.