![]() With the IAsyncEnumerable overload for these endpoints, we can iterate over items that are returned. This gets cumbersome rather quickly, which is why API endpoints that return a Batch also have an overload that supports IAsyncEnumerable. To retrieve more To-Do items, we will have to make additional API calls. The resulting batch will contain one page of results. For example, retrieving a profile from the team directory will retrieve all top level properties, such as Id, Username, About, and more:Ĭonsole. Top-level Properties by Defaultīy default, JetBrains.Space will retrieve all top level properties from the Space API. In JetBrains.Space, we will need to specify the properties we want to retrieve as well. To request this hierarchy, we need to query $fields=name(firstName,lastName).īeing able to retrieve just the information our integration requires, helps in reducing payload size, and results in a better integration performance overall. As an example, a user profile has a name field of type TD_ProfileName, which in turn has a firstName and lastName field. The API response will then only return those fields.įields can be primitive values (integers, strings, booleans. When we want to retrieve a user's id and about description, we can set the $fields parameter in an API request to $fields=id,about. In the HTTP API Playground, we can toggle checkboxes to include/exclude fields from the result. Backgroundįor most requests, we can shape the results we want to retrieve from the API. ![]() In this section, we will cover partial requests and shaping response contents. Service ClientĬlients for endpoints are mapped to the top level of endpoints we can find in the HTTP API Playground:Īs an example, the top level Team Directory has a client class named TeamDirector圜lient, with methods that correspond to endpoints seen in the HTTP API Playground. It is recommended to limit the scope to just those permissions that are needed by your application.Įxamples of available scopes are available in the Space documentation. Warning: By default, JetBrains.Space uses the ** scope ( PermissionScope.All), which requests all available scopes. On a Connection instance, use the Scope property to specify the scope required by an application. Scope is a mechanism in OAuth 2.0 to limit an application's access to a user's account. Tip: The Space ASP.NET Core authentication provider (in the package) includes support for the Implicit Flow. JetBrains.Space does not handle retrieving an access token that can be used with BearerTokenConnection or RefreshTokenConnection. RefreshTokenConnection - Extends BearerTokenConnection and automatically refreshes tokens using the Refresh Token Flow.This is typically used by applications that act on behalf of a user. BearerTokenConnection - Uses a bearer token obtained using other flows, or a personal token.This is typically used by a Space application that acts on behalf of itself. ClientCredentialsConnection - Supports the Client Credentials Flow.A connection keeps track of the Space organization URL, and registers the required JSON serializers that are used under the hood.Ĭonnection has several implementations that can be used to authenticate and work with Space: Authentication and ConnectionĬommunication with Space is handled by the Connection base class. The package provides necessary types to connect to and interact with the Space API. To retrieve nested properties, check nested properties. The memberProfile will expose top level properties, such as Id, Username, About, and more. Var memberProfile = await teamDirector圜lient. Create a ConnectionĪfter installing in our project, we can use the Client ID and Client Secret of our Space application to create a ClientCredentialsConnection against our Space organization: Make sure to enable the Client Credentials Flow in your application's Authentication settings. There are various application types, all supporting different authentication flows.įor this example, we will use a Client application. We will need to register an application to work with the Space API. Let's have a look at how we can start working with. - Authentication provider that integrates with ASP.NET Core.Space attachment proxy for images and files in a Space organization (experimental).Helpers for Space Applications webhooks (experimental).An extension method for IServiceCollection to register all JetBrains.Space clients as ASP.NET Core services.- Helpers for using JetBrains.Space with ASP.NET Core, such as:.- The generated client code to work with the Space API.These can be installed to satisfy additional integration requirements. ![]() Dotnet add package -version 2.0.0-beta.*
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |