feat: scalar-typescript-sdk-go@0.2.6#6
Open
marclave wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scalar API
Generated Go SDK for Scalar API.
API for managing Scalar platform resources.
TypeScript SDK
For TypeScript, we provide a SDK that makes using our API even easier.
Install
Get a Scalar API key
Create an API key in your Scalar account:
.env, for example:Exchange your API key for an access token
The personal token is not an access token. Exchange it first with
postv1AuthExchange.If you use the personal token directly for authenticated API calls, the API returns
401 Invalid authentication token.Use the access token
Construct a second client with bearer auth. Use this authenticated client for API calls.
Notes
new Scalar()).Read more
Contents
Installation
Usage
The examples in the following sections assume a
clientconfigured as shown above.See the API reference for every available operation.
Authentication
Pass credentials to the generated client constructor. Environment variables are read automatically when supported by the target runtime.
option.WithBearerAuthstring | providerDeclared schemes:
BearerAuthbearer tokenErrors
Non-success responses return generated API errors. Error objects expose status, headers, response body, and request metadata where the target runtime supports it.
Documented error statuses:
400,401,403,404,422,500.Client Options
Configure the generated client by setting any of these options when you create it.
option.WithBearerAuthfunc(string) option.RequestOptionos.Getenv("BEARER_AUTH")option.WithEnvironmentProductionfunc() option.RequestOptionoption.WithEnvironmentLocalfunc() option.RequestOptionoption.WithBaseURLfunc(string) option.RequestOptionos.Getenv("SCALAR_BASE_URL")option.WithTimeoutfunc(time.Duration) option.RequestOptionoption.WithMaxRetriesfunc(int) option.RequestOption2option.WithHTTPClientfunc(option.HTTPClient) option.RequestOptionRequest Options
option.WithHeaderfunc(string, string) option.RequestOptionoption.WithQueryfunc(string, string) option.RequestOptionoption.WithRequestBodyfunc(string, any) option.RequestOptionoption.WithResponseIntofunc(**http.Response) option.RequestOptionoption.WithResponseBodyIntofunc(any) option.RequestOptionRetries and Timeouts
Generated clients support request timeouts and retry temporary failures such as network errors, 408, 409, 429, and 5xx responses. Retry delays honor
Retry-Afterheaders when present. Tune the retry and timeout client options shown above, or override them per request.Helpers
option.WithResponseInto(&raw)to capture the underlying*http.Responsefor a request.String,Int,Bool,Float,Time,Opt, andPtrhelpers when setting optional params.Logging
option.WithMiddleware(...)to add request logging or tracing.Requirements
Powered by Scalar.
Contributions
This SDK is generated programmatically. Manual edits to generated files will be
overwritten on the next build.
SDK created by Scalar