Skip to content

Latest commit

 

History

History
206 lines (161 loc) · 19.4 KB

File metadata and controls

206 lines (161 loc) · 19.4 KB

Iam.Users

Overview

Available Operations

List

List Users

Example Usage

using StackOneHQ.Client;
using StackOneHQ.Client.Models.Components;
using StackOneHQ.Client.Models.Requests;
using System;

var sdk = new StackOneHQClient(security: new Security() {
    Username = "",
    Password = "",
});

IamListUsersRequest req = new IamListUsersRequest() {
    XAccountId = "<id>",
    Fields = "id,remote_id,first_name,last_name,name,primary_email_address,username,roles,groups,status,avatar,is_bot_user,last_active_at,last_login_at,created_at,updated_at,multi_factor_enabled,unified_custom_fields",
    Filter = new IamListUsersFilter() {
        UpdatedAfter = System.DateTime.Parse("2020-01-01T00:00:00.000Z"),
    },
    Expand = "roles,groups",
    Prefer = "heartbeat",
};

IamListUsersResponse? res = await sdk.Iam.Users.ListAsync(req);

while(res != null)
{
    // handle items

    res = await res.Next!();
}

Parameters

Parameter Type Required Description
request IamListUsersRequest ✔️ The request object to use for the request.

Response

IamListUsersResponse

Errors

Error Type Status Code Content Type
StackOneHQ.Client.Models.Errors.BadRequestResponseException 400 application/json
StackOneHQ.Client.Models.Errors.UnauthorizedResponseException 401 application/json
StackOneHQ.Client.Models.Errors.ForbiddenResponseException 403 application/json
StackOneHQ.Client.Models.Errors.NotFoundResponseException 404 application/json
StackOneHQ.Client.Models.Errors.RequestTimedOutResponseException 408 application/json
StackOneHQ.Client.Models.Errors.ConflictResponseException 409 application/json
StackOneHQ.Client.Models.Errors.PreconditionFailedResponseException 412 application/json
StackOneHQ.Client.Models.Errors.UnprocessableEntityResponseException 422 application/json
StackOneHQ.Client.Models.Errors.TooManyRequestsResponseException 429 application/json
StackOneHQ.Client.Models.Errors.InternalServerErrorResponse 500 application/json
StackOneHQ.Client.Models.Errors.NotImplementedResponseException 501 application/json
StackOneHQ.Client.Models.Errors.BadGatewayResponseException 502 application/json
StackOneHQ.Client.Models.Errors.APIException 4XX, 5XX */*

Get

Get User

Example Usage

using StackOneHQ.Client;
using StackOneHQ.Client.Models.Components;
using StackOneHQ.Client.Models.Requests;

var sdk = new StackOneHQClient(security: new Security() {
    Username = "",
    Password = "",
});

IamGetUserRequest req = new IamGetUserRequest() {
    XAccountId = "<id>",
    Id = "<id>",
    Fields = "id,remote_id,first_name,last_name,name,primary_email_address,username,roles,groups,status,avatar,is_bot_user,last_active_at,last_login_at,created_at,updated_at,multi_factor_enabled,unified_custom_fields",
    Expand = "roles,groups",
    Prefer = "heartbeat",
};

var res = await sdk.Iam.Users.GetAsync(req);

// handle response

Parameters

Parameter Type Required Description
request IamGetUserRequest ✔️ The request object to use for the request.

Response

IamGetUserResponse

Errors

Error Type Status Code Content Type
StackOneHQ.Client.Models.Errors.BadRequestResponseException 400 application/json
StackOneHQ.Client.Models.Errors.UnauthorizedResponseException 401 application/json
StackOneHQ.Client.Models.Errors.ForbiddenResponseException 403 application/json
StackOneHQ.Client.Models.Errors.NotFoundResponseException 404 application/json
StackOneHQ.Client.Models.Errors.RequestTimedOutResponseException 408 application/json
StackOneHQ.Client.Models.Errors.ConflictResponseException 409 application/json
StackOneHQ.Client.Models.Errors.PreconditionFailedResponseException 412 application/json
StackOneHQ.Client.Models.Errors.UnprocessableEntityResponseException 422 application/json
StackOneHQ.Client.Models.Errors.TooManyRequestsResponseException 429 application/json
StackOneHQ.Client.Models.Errors.InternalServerErrorResponse 500 application/json
StackOneHQ.Client.Models.Errors.NotImplementedResponseException 501 application/json
StackOneHQ.Client.Models.Errors.BadGatewayResponseException 502 application/json
StackOneHQ.Client.Models.Errors.APIException 4XX, 5XX */*

Update

Update User

Example Usage

using StackOneHQ.Client;
using StackOneHQ.Client.Models.Components;
using System.Collections.Generic;

var sdk = new StackOneHQClient(security: new Security() {
    Username = "",
    Password = "",
});

var res = await sdk.Iam.Users.UpdateAsync(
    xAccountId: "<id>",
    id: "<id>",
    iamUpdateUserRequestDto: new IamUpdateUserRequestDto() {
        PrimaryEmailAddress = "han@stackone.com",
        FirstName = "Han",
        LastName = "Solo",
        Name = "Han Solo",
        Username = "hansolo1977",
        IsBotUser = IamUpdateUserRequestDtoIsBotUserUnion.CreateBoolean(
            true
        ),
        Status = new IamUpdateUserRequestDtoStatus() {
            Value = IamUpdateUserRequestDtoValue.Enabled,
        },
        Passthrough = new Dictionary<string, object>() {
            { "other_known_names", "John Doe" },
        },
    },
    prefer: "heartbeat"
);

// handle response

Parameters

Parameter Type Required Description Example
XAccountId string ✔️ The account identifier
Id string ✔️ N/A
IamUpdateUserRequestDto IamUpdateUserRequestDto ✔️ N/A
Prefer string Set to "heartbeat" to enable keep-alive newline heartbeats during long-running requests. Response includes Preference-Applied: heartbeat header when honored. (RFC 7240) heartbeat

Response

IamUpdateUserResponse

Errors

Error Type Status Code Content Type
StackOneHQ.Client.Models.Errors.BadRequestResponseException 400 application/json
StackOneHQ.Client.Models.Errors.UnauthorizedResponseException 401 application/json
StackOneHQ.Client.Models.Errors.ForbiddenResponseException 403 application/json
StackOneHQ.Client.Models.Errors.NotFoundResponseException 404 application/json
StackOneHQ.Client.Models.Errors.RequestTimedOutResponseException 408 application/json
StackOneHQ.Client.Models.Errors.ConflictResponseException 409 application/json
StackOneHQ.Client.Models.Errors.PreconditionFailedResponseException 412 application/json
StackOneHQ.Client.Models.Errors.UnprocessableEntityResponseException 422 application/json
StackOneHQ.Client.Models.Errors.TooManyRequestsResponseException 429 application/json
StackOneHQ.Client.Models.Errors.InternalServerErrorResponse 500 application/json
StackOneHQ.Client.Models.Errors.NotImplementedResponseException 501 application/json
StackOneHQ.Client.Models.Errors.BadGatewayResponseException 502 application/json
StackOneHQ.Client.Models.Errors.APIException 4XX, 5XX */*