Developer-friendly & type-safe Csharp SDK specifically catered to leverage StackOne.Client API.
Documents: The documentation for the StackOne Unified API - DOCUMENTS
To add the NuGet package to a .NET project:
dotnet add package StackOneHQ.ClientTo add a reference to a local instance of the SDK in a .NET project:
dotnet add reference src/StackOneHQ/Client/StackOneHQ.Client.csprojusing StackOneHQ.Client;
using StackOneHQ.Client.Models.Components;
using StackOneHQ.Client.Models.Requests;
using System;
var sdk = new StackOneHQClient(security: new Security() {
Username = "",
Password = "",
});
HrisListEmployeesRequest req = new HrisListEmployeesRequest() {
XAccountId = "<id>",
Fields = "id,remote_id,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,documents,created_at,updated_at,benefits,employee_number,national_identity_number,national_identity_numbers,skills",
Filter = new HrisListEmployeesFilter() {
UpdatedAfter = System.DateTime.Parse("2020-01-01T00:00:00.000Z"),
},
Expand = "company,employments,work_location,home_location,groups,skills",
Include = "avatar_url,avatar,custom_fields,job_description,benefits",
};
HrisListEmployeesResponse? res = await sdk.Hris.Employees.ListAsync(req);
while(res != null)
{
// handle items
res = await res.Next!();
}This SDK supports the following security scheme globally:
| Name | Type | Scheme |
|---|---|---|
UsernamePassword |
http | HTTP Basic |
You can set the security parameters through the security optional parameter when initializing the SDK client instance. For example:
using StackOneHQ.Client;
using StackOneHQ.Client.Models.Components;
using System.Collections.Generic;
var sdk = new StackOneHQClient(security: new Security() {
Username = "",
Password = "",
});
ConnectSessionCreate req = new ConnectSessionCreate() {
Categories = new List<ConnectSessionCreateCategory>() {
ConnectSessionCreateCategory.Ats,
ConnectSessionCreateCategory.Hris,
ConnectSessionCreateCategory.Ticketing,
ConnectSessionCreateCategory.Crm,
ConnectSessionCreateCategory.Iam,
ConnectSessionCreateCategory.Marketing,
ConnectSessionCreateCategory.Lms,
ConnectSessionCreateCategory.Iam,
ConnectSessionCreateCategory.Documents,
ConnectSessionCreateCategory.Ticketing,
ConnectSessionCreateCategory.Screening,
ConnectSessionCreateCategory.Messaging,
ConnectSessionCreateCategory.Accounting,
},
OriginOwnerId = "<id>",
OriginOwnerName = "<value>",
};
var res = await sdk.ConnectSessions.CreateAsync(req);
// handle responseAvailable methods
- List - List Accounts
- Get - Get Account
- Delete - Delete Account
- Update - Update Account
- GetMeta - Get Account Meta Information
- GetScorecard - Get Application Scorecard
- ListApplications - List Applications
- Get - Get Application
- GetApplicationChanges - List Application Changes
- ListApplicationNotes - List Application Notes
- CreateApplicationNote - Create Application Note
- GetNote - Get Application Note
- UpdateNote - Update Application Note
- DocumentsUpload - Upload Application Document
- GetDocument - Get Application Document
- ListCandidates - List Candidates
- UpdateCandidate - Update Candidate
- CreateNote - Create Candidate Note
- GetCandidateNote - Get Candidate Note
- ListJobCustomFieldDefinitions - List Job Custom Field Definitions
- GetDepartments - List Departments
- ListJobs - List Jobs
- CreateJob - Create Job
- UpdateJob - Update Job
- GetUser - Get User
- ListJobPostings - List Job Postings
- OrderAssessments - Order Assessments Request
- AssessmentsUpdateResult - Update Assessments Result
- UpdateBackgroundCheckPackage - Update Background Check Package
- OrderBackgroundCheck - Order Background Check Request
- UpdateBackgroundCheckResult - Update Background Check Result
- Create - Create Application
- Update - Update Application
- ListOffers - List Application Offers
- Move - Move Application
- Reject - Reject Application
- GetOffer - Get Application Offer
- ScorecardsList - List Application Scorecards
- ListScheduledInterviews - List Applications scheduled interviews
- GetScheduledInterview - Get Applications scheduled interview
- DownloadDocument - Download Application Document
- ListCustomFieldDefinitions - List Application Custom Field Definitions
- GetCustomFieldDefinition - Get Application Custom Field Definition
- List - List Application Documents
- PackagesList - List Assessments Packages
- GetResults - Get Assessments Results
- Get - Get Assessments Package
- PackagesList - List Background Check Packages
- CreatePackage - Create Background Check Package
- GetResults - Get Background Check Results
- Get - Get Background Check Package
- Get - Get Candidate Custom Field Definition
- List - List Candidate Notes
- ListCandidates - List Candidate Custom Field Definitions
- GetJob - Get Job Custom Field Definition
- Get - Get Department
- Get - Get Application Document Category
- List - List Interviews
- Get - Get Job Posting
- Get - Get Job
- List - List Users
- DeletePackage - Delete Background Check Package
- Create - Create Connect Session
- Authenticate - Authenticate Connect Session
- List - List Courses
- GetContact - Get Contact
- UpdateContact - Update Contact (early access)
- ListAccounts - List Accounts
- GetAccount - Get Account
- ListApplicationCategories - List Application Document Categories
- UploadFile - Upload File
- List - List Drives
- Get - Get Drive
- GetCompanies - List Companies
- GetCompany - Get Company
- GetEmployeeCustomFieldDefinition - Get employee Custom Field Definition
- GetEmployee - Get Employee
- ListEmployeeTimeOffRequests - List Employee Time Off Requests
- GetEmployeeTimeOffRequest - Get Employees Time Off Request
- CancelEmployeeTimeOff - Cancel Employee Time Off Request
- UpdateEmployeeTimeOffRequest - Update Employee Time Off Request
- UploadEmployeeDocument - Upload Employee Document
- ListEmployeeDocuments - List Employee Documents
- GetEmployeeDocument - Get Employee Document
- ListEmployeeTimeOffBalances - List Employee Time Off Balances
- GetEmployeeTimeOffBalance - Get Employee Time Off Balance
- GetEmployment - Get Employment
- GetGroup - Get Group
- GetTeamGroup - Get Team Group
- GetLocation - Get Work Location
- ListPositions - List Positions
- GetPosition - Get Position
- ListTimeEntries - List Time Entries
- GetTimeEntry - Get Time Entry
- GetTimeOffRequest - Get time off request
- ListShifts - List Shifts
ListTimeOffTypes- List time off types⚠️ Deprecated- ListTimeOffPolicies - List Time Off Policies
- GetTimeOffPolicy - Get Time Off Policy
- ListBenefits - List benefits
- CreateEmployeeSkill - Create Employee Skill
- GetEmployeeTask - Get Employee Task
- GetTask - Get Task
- Get - Get Benefit
- Get - Get Company Group
- Get - Get Department Group
- ListCustomFieldDefinitions - List employee Custom Field Definitions
- List - List Employees
- Create - Create Employee
- Update - Update Employee
- Invite - Invite Employee
- CreateTimeOff - Create Employee Time Off Request
- BatchUploadDocument - Batch Upload Employee Document
- WorkEligibilityList - List Employee Work Eligibility
- CreateWorkEligibilityRequest - Create Employee Work Eligibility Request
- GetWorkEligibility - Get Employees Work Eligibility
- CreateEmployment - Create Employee Employment
- GetEmployment - Get Employee Employment
- ListTimeOffPolicies - List Assigned Time Off Policies
- GetSkill - Get Employee Skill
- Download - Download Employee Document
- List - List Employee Skills
- List - List Employee Tasks
- UpdateRequest - Update Employee Work Eligibility Request
- List - List Employments
- List - List Groups
- ListDepartments - List Department Groups
- ListCostCenters - List Cost Center Groups
- ListTeams - List Team Groups
- ListDivisions - List Division Groups
- List - List Companies Groups
- Get - Get Cost Center Group
- Get - Get Division Group
- List - List Work Locations
- Get - Get Shift
- List - List Tasks
- List - List time off requests
Get- Get time off type⚠️ Deprecated
- DeleteUser - Delete User
- ListRoles - List Roles
- GetRole - Get Role
- GetGroup - Get Group
- ListPolicies - List Policies
- List - List Groups
- Get - Get Policy
- Get - Get Interview
- GetCourse - Get Course
- ListUserAssignments - List User Assignments
- BatchUpsertContent - Batch Upsert Content
- ListContent - List Content
- CreateUserCompletion - Create User Completion
- GetUserCompletion - Get User Completion
- DeleteUserCompletion - Delete User Completion
- GetCategory - Get Category
- ListUsers - List Users
- GetUser - Get User
- ListSkills - List Skills
- List - List Categories
- Get - Get Skill
- ListCompletions - List User Completions
- Get - Get User Assignment
- TemplatesListEmail - List Email Templates
- CreateEmailTemplate - Create Email Templates
- GetEmailTemplate - Get Email Templates
- UpdateEmailTemplate - Update Email Templates
- TemplatesListInApp - List In-App Templates
- CreateInAppTemplate - Create In-App Template
- ListSmsTemplates - List SMS Templates
- CreateSmsTemplate - Create SMS Template
- UpdateSmsTemplate - Update SMS Template
ListOmniChannelTemplates- List Omni-Channel Templates⚠️ DeprecatedGetOmniChannelTemplate- Get Omni-Channel Template⚠️ DeprecatedUpdateOmniChannelTemplate- Update Omni-Channel Template⚠️ Deprecated- TemplatesListPush - List Push Templates
- UpdatePushTemplate - Update Push Template
- ListContentBlocks - List Content Blocks
- CreateContentBlock - Create Content Block
- GetContentBlock - Get Content Blocks
- Update - Update Content Block
CreateOmniChannel- Create Omni-Channel Template⚠️ Deprecated- CreatePush - Create Push Template
- GetPush - Get Push Template
- Get - Get SMS Template
- Perform - Proxy Request
- ListSteps - List Step Logs
- Get - Get Log
- List - List Logs
- ListPlatformLogs - List Platform Logs
- GetUser - Get User
- DownloadAttachment - Download Attachment
- ListTicketTypes - List Ticket Types
- GetTicketType - Get Ticket Type
- ListProjects - List Projects
- GetProject - Get Project
- ListProjectComponents - List Project Components
- GetProjectComponent - Get Project Component
- ListProjectTicketTypes - List Project Ticket Types
- Get - Get Comment
- List - List Tickets
- Create - Create Ticket
- Get - Get Ticket
- Update - Update Ticket
- ListAttachments - List Attachments
- ListStatuses - List Ticket Statuses
- Get - Get Attachment
- List - List Comments
- List - List Users
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
returned response object will have a Next method that can be called to pull down the next group of results. If the
return value of Next is null, then there are no more pages to be fetched.
Here's an example of one such pagination call:
using StackOneHQ.Client;
using StackOneHQ.Client.Models.Components;
using StackOneHQ.Client.Models.Requests;
using System;
var sdk = new StackOneHQClient(security: new Security() {
Username = "",
Password = "",
});
HrisListCompaniesRequest req = new HrisListCompaniesRequest() {
XAccountId = "<id>",
Fields = "id,remote_id,name,full_name,display_name,created_at,updated_at",
Filter = new HrisListCompaniesFilter() {
UpdatedAfter = System.DateTime.Parse("2020-01-01T00:00:00.000Z"),
},
};
HrisListCompaniesResponse? res = await sdk.Hris.GetCompaniesAsync(req);
while(res != null)
{
// handle items
res = await res.Next!();
}Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, simply pass a RetryConfig to the call:
using StackOneHQ.Client;
using StackOneHQ.Client.Models.Components;
using System.Collections.Generic;
var sdk = new StackOneHQClient(security: new Security() {
Username = "",
Password = "",
});
ConnectSessionCreate req = new ConnectSessionCreate() {
Categories = new List<ConnectSessionCreateCategory>() {
ConnectSessionCreateCategory.Ats,
ConnectSessionCreateCategory.Hris,
ConnectSessionCreateCategory.Ticketing,
ConnectSessionCreateCategory.Crm,
ConnectSessionCreateCategory.Iam,
ConnectSessionCreateCategory.Marketing,
ConnectSessionCreateCategory.Lms,
ConnectSessionCreateCategory.Iam,
ConnectSessionCreateCategory.Documents,
ConnectSessionCreateCategory.Ticketing,
ConnectSessionCreateCategory.Screening,
ConnectSessionCreateCategory.Messaging,
ConnectSessionCreateCategory.Accounting,
},
OriginOwnerId = "<id>",
OriginOwnerName = "<value>",
};
var res = await sdk.ConnectSessions.CreateAsync(
retryConfig: new RetryConfig(
strategy: RetryConfig.RetryStrategy.BACKOFF,
backoff: new BackoffStrategy(
initialIntervalMs: 1L,
maxIntervalMs: 50L,
maxElapsedTimeMs: 100L,
exponent: 1.1
),
retryConnectionErrors: false
),
request: req
);
// handle responseIf you'd like to override the default retry strategy for all operations that support retries, you can use the RetryConfig optional parameter when intitializing the SDK:
using StackOneHQ.Client;
using StackOneHQ.Client.Models.Components;
using System.Collections.Generic;
var sdk = new StackOneHQClient(
retryConfig: new RetryConfig(
strategy: RetryConfig.RetryStrategy.BACKOFF,
backoff: new BackoffStrategy(
initialIntervalMs: 1L,
maxIntervalMs: 50L,
maxElapsedTimeMs: 100L,
exponent: 1.1
),
retryConnectionErrors: false
),
security: new Security() {
Username = "",
Password = "",
}
);
ConnectSessionCreate req = new ConnectSessionCreate() {
Categories = new List<ConnectSessionCreateCategory>() {
ConnectSessionCreateCategory.Ats,
ConnectSessionCreateCategory.Hris,
ConnectSessionCreateCategory.Ticketing,
ConnectSessionCreateCategory.Crm,
ConnectSessionCreateCategory.Iam,
ConnectSessionCreateCategory.Marketing,
ConnectSessionCreateCategory.Lms,
ConnectSessionCreateCategory.Iam,
ConnectSessionCreateCategory.Documents,
ConnectSessionCreateCategory.Ticketing,
ConnectSessionCreateCategory.Screening,
ConnectSessionCreateCategory.Messaging,
ConnectSessionCreateCategory.Accounting,
},
OriginOwnerId = "<id>",
OriginOwnerName = "<value>",
};
var res = await sdk.ConnectSessions.CreateAsync(req);
// handle responseHandling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.
By default, an API error will raise a StackOneHQ.Client.Models.Errors.APIException exception, which has the following properties:
| Property | Type | Description |
|---|---|---|
Message |
string | The error message |
Request |
HttpRequestMessage | The HTTP request |
Response |
HttpResponseMessage | The HTTP response |
When custom error responses are specified for an operation, the SDK may also throw their associated exceptions. You can refer to respective Errors tables in SDK docs for more details on possible exception types for each operation. For example, the CreateAsync method throws the following exceptions:
| 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.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 | */* |
using StackOneHQ.Client;
using StackOneHQ.Client.Models.Components;
using StackOneHQ.Client.Models.Errors;
using System.Collections.Generic;
var sdk = new StackOneHQClient(security: new Security() {
Username = "",
Password = "",
});
try
{
ConnectSessionCreate req = new ConnectSessionCreate() {
Categories = new List<ConnectSessionCreateCategory>() {
ConnectSessionCreateCategory.Ats,
ConnectSessionCreateCategory.Hris,
ConnectSessionCreateCategory.Ticketing,
ConnectSessionCreateCategory.Crm,
ConnectSessionCreateCategory.Iam,
ConnectSessionCreateCategory.Marketing,
ConnectSessionCreateCategory.Lms,
ConnectSessionCreateCategory.Iam,
ConnectSessionCreateCategory.Documents,
ConnectSessionCreateCategory.Ticketing,
ConnectSessionCreateCategory.Screening,
ConnectSessionCreateCategory.Messaging,
ConnectSessionCreateCategory.Accounting,
},
OriginOwnerId = "<id>",
OriginOwnerName = "<value>",
};
var res = await sdk.ConnectSessions.CreateAsync(req);
// handle response
}
catch (Exception ex)
{
if (ex is BadRequestResponseException)
{
// Handle exception data
throw;
}
else if (ex is UnauthorizedResponseException)
{
// Handle exception data
throw;
}
else if (ex is ForbiddenResponseException)
{
// Handle exception data
throw;
}
else if (ex is NotFoundResponseException)
{
// Handle exception data
throw;
}
else if (ex is RequestTimedOutResponseException)
{
// Handle exception data
throw;
}
else if (ex is ConflictResponseException)
{
// Handle exception data
throw;
}
else if (ex is UnprocessableEntityResponseException)
{
// Handle exception data
throw;
}
else if (ex is TooManyRequestsResponseException)
{
// Handle exception data
throw;
}
else if (ex is InternalServerErrorResponse)
{
// Handle exception data
throw;
}
else if (ex is NotImplementedResponseException)
{
// Handle exception data
throw;
}
else if (ex is BadGatewayResponseException)
{
// Handle exception data
throw;
}
else if (ex is StackOneHQ.Client.Models.Errors.APIException)
{
// Handle default exception
throw;
}
}The default server can be overridden globally by passing a URL to the serverUrl: string optional parameter when initializing the SDK client instance. For example:
using StackOneHQ.Client;
using StackOneHQ.Client.Models.Components;
using System.Collections.Generic;
var sdk = new StackOneHQClient(
serverUrl: "https://api.stackone.com",
security: new Security() {
Username = "",
Password = "",
}
);
ConnectSessionCreate req = new ConnectSessionCreate() {
Categories = new List<ConnectSessionCreateCategory>() {
ConnectSessionCreateCategory.Ats,
ConnectSessionCreateCategory.Hris,
ConnectSessionCreateCategory.Ticketing,
ConnectSessionCreateCategory.Crm,
ConnectSessionCreateCategory.Iam,
ConnectSessionCreateCategory.Marketing,
ConnectSessionCreateCategory.Lms,
ConnectSessionCreateCategory.Iam,
ConnectSessionCreateCategory.Documents,
ConnectSessionCreateCategory.Ticketing,
ConnectSessionCreateCategory.Screening,
ConnectSessionCreateCategory.Messaging,
ConnectSessionCreateCategory.Accounting,
},
OriginOwnerId = "<id>",
OriginOwnerName = "<value>",
};
var res = await sdk.ConnectSessions.CreateAsync(req);
// handle responseThis SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.