C#
Changelog
Every release of the package, newest first.
0.0.1
The first release of the .NET SDK, the Nextmail package on NuGet. It targets net8.0 and netstandard2.0, is safe to trim and to compile ahead of time, and on .NET 8 and later it has no dependencies. It has a method for each of the 684 methods of the TypeScript SDK, in the same 53 namespaces and under the same names in PascalCase with an Async suffix. They cover everything from sending and reading mail to contacts, broadcasts, automations, the calendar, booking pages, tasks and the settings of a workspace, and a parity check proves that each one sends the same request as its TypeScript twin.
new NextmailClient()readsNEXTMAIL_API_KEY,NEXTMAIL_ACCESS_TOKENandNEXTMAIL_BASE_URL, andNextmailOptionstakesApiKey,AccessToken,AccessTokenProvider,BaseUrl,Timeout,MaxRetries,HttpClient,UserAgentandHeaders. The client has a property for every namespace, such asEmails,ThreadsandDomains, and it is safe to share between threads.- Every method is asynchronous, ends in
Asyncand takes aCancellationTokenlast. A request body is aBody, or anyIReadOnlyDictionary<string, object?>, whose keys keep the camelCase names of the API, and aBodygoes out in the order its keys were added. Options are named arguments such aslimit:,cursor:andidempotencyKey:, and a response comes back as aJsonObject. - Every paginated resource has
ListAsync, which returns onePage,ListAllAsync, which returns every item, andIterateAsync, which returns anIAsyncEnumerable<JsonObject>that fetches the next page only when it gets there. - An API refusal throws
NextmailApiException, withStatus,ErrorType,Code,Param,RequestIdand checks such asIsValidation,IsNotFoundandIsStepUpRequiredto use in awhenfilter. No response at all throwsNextmailNetworkException, withIsTimeoutwhen the deadline passed, and both derive fromNextmailException. A mistake in the call itself throwsArgumentExceptionbefore anything is sent. - Reads, sends and every write that is safe to repeat are retried on 408, 500, 502, 503 and 504 with backoff, and on a 429 only when its
Retry-Afteris a minute or less. Every send carries an idempotency key that its retries reuse, andidempotencyKey:sets your own. AccessTokentakes an OAuth access token, andAccessTokenProvidera function that returns one before every request, so the token can be renewed without a new client. When a change made with a token needs a verification code, the call throws withIsStepUpRequired, andSecurity.BeginStepUpAsyncandVerifyStepUpAsyncprovide one.NextmailClient.VerifyWebhookSignature()checks a webhook delivery in constant time, refuses one more than five minutes old and returns the event.NextmailClient.CreateTempMail()opens disposable inboxes with no credential, andclient.Raw.RequestAsync()calls an endpoint no method wraps, with the credential, timeout and retries of the client.NextmailClient.ToBase64(),IsApiKey(),IsAccessToken(),IsSealed(),ResolveLanguage(),LanguageByCode()andIsRtlLanguage()are the helpers of the TypeScript SDK, and every set of values the API uses is a class inNextmail.Constants.- The client sends a credential over plain
http:only to a server on this machine, refuses a request path that leaves the API origin and never prints a credential. It never disposes anHttpClientit was handed, and shares one for the whole process when given none.
Google Workspace