Partager via


DevCenterClient.GetProjectsAsync Method

Definition

Overloads

GetProjectsAsync(RequestContext)

[Protocol Method] Lists all projects.

GetProjectsAsync(CancellationToken)

Lists all projects.

GetProjectsAsync(String, Nullable<Int32>, RequestContext)

[Protocol Method] Lists all projects.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.

GetProjectsAsync(RequestContext)

Source:
DevCenterClient.cs

[Protocol Method] Lists all projects.

public virtual Azure.AsyncPageable<BinaryData> GetProjectsAsync (Azure.RequestContext context);
abstract member GetProjectsAsync : Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetProjectsAsync : Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetProjectsAsync (context As RequestContext) As AsyncPageable(Of BinaryData)

Parameters

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The AsyncPageable<T> from the service containing a list of BinaryData objects. Details of the body schema for each item in the collection are in the Remarks section below.

Exceptions

Service returned a non-success status code.

Examples

This sample shows how to call GetProjectsAsync and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DevCenterClient client = new DevCenterClient(endpoint, credential);

await foreach (BinaryData item in client.GetProjectsAsync(null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("name").ToString());
}

This sample shows how to call GetProjectsAsync with all parameters and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DevCenterClient client = new DevCenterClient(endpoint, credential);

await foreach (BinaryData item in client.GetProjectsAsync(null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("name").ToString());
    Console.WriteLine(result.GetProperty("description").ToString());
    Console.WriteLine(result.GetProperty("maxDevBoxesPerUser").ToString());
}

Applies to

GetProjectsAsync(CancellationToken)

Source:
DevCenterClient.cs

Lists all projects.

public virtual Azure.AsyncPageable<Azure.Developer.DevCenter.Models.DevCenterProject> GetProjectsAsync (System.Threading.CancellationToken cancellationToken = default);
abstract member GetProjectsAsync : System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Developer.DevCenter.Models.DevCenterProject>
override this.GetProjectsAsync : System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Developer.DevCenter.Models.DevCenterProject>
Public Overridable Function GetProjectsAsync (Optional cancellationToken As CancellationToken = Nothing) As AsyncPageable(Of DevCenterProject)

Parameters

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Examples

This sample shows how to call GetProjectsAsync.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DevCenterClient client = new DevCenterClient(endpoint, credential);

await foreach (DevCenterProject item in client.GetProjectsAsync())
{
}

This sample shows how to call GetProjectsAsync with all parameters.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DevCenterClient client = new DevCenterClient(endpoint, credential);

await foreach (DevCenterProject item in client.GetProjectsAsync())
{
}

Applies to

GetProjectsAsync(String, Nullable<Int32>, RequestContext)

Source:
DevCenterClient.cs

[Protocol Method] Lists all projects.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual Azure.AsyncPageable<BinaryData> GetProjectsAsync (string filter, int? maxCount, Azure.RequestContext context);
abstract member GetProjectsAsync : string * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetProjectsAsync : string * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetProjectsAsync (filter As String, maxCount As Nullable(Of Integer), context As RequestContext) As AsyncPageable(Of BinaryData)

Parameters

filter
String

An OData filter clause to apply to the operation.

maxCount
Nullable<Int32>

The maximum number of resources to return from the operation. Example: 'top=10'.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The AsyncPageable<T> from the service containing a list of BinaryData objects. Details of the body schema for each item in the collection are in the Remarks section below.

Exceptions

Service returned a non-success status code.

Examples

This sample shows how to call GetProjectsAsync and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DevCenterClient client = new DevCenterClient(endpoint, credential);

await foreach (BinaryData item in client.GetProjectsAsync(null, null, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("name").ToString());
}

This sample shows how to call GetProjectsAsync with all parameters and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DevCenterClient client = new DevCenterClient(endpoint, credential);

await foreach (BinaryData item in client.GetProjectsAsync("<filter>", 1234, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("name").ToString());
    Console.WriteLine(result.GetProperty("description").ToString());
    Console.WriteLine(result.GetProperty("maxDevBoxesPerUser").ToString());
}

Remarks

Below is the JSON schema for one item in the pageable response.

Response Body:

Schema for ProjectListResultValue:

{
  name: string, # Optional. Name of the project
  description: string, # Optional. Description of the project.
}

Applies to