Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 57 additions & 1 deletion sdk/dotnet/Timr.Api/Endpoints/TaskApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public interface ITaskApi : IApi
/// <summary>
/// The <see cref="ICreateTaskApiResponse"/>
/// </summary>
public interface ICreateTaskApiResponse : Timr.Api.Client.IApiResponse, ICreated<Timr.Api.Model.Task?>, IBadRequest<Timr.Api.Model.Error?>, IConflict<Timr.Api.Model.Error?>, IUnprocessableContent<Timr.Api.Model.Error?>
public interface ICreateTaskApiResponse : Timr.Api.Client.IApiResponse, ICreated<Timr.Api.Model.Task?>, IBadRequest<Timr.Api.Model.Error?>, IForbidden<Timr.Api.Model.Error?>, IConflict<Timr.Api.Model.Error?>, IUnprocessableContent<Timr.Api.Model.Error?>
{
/// <summary>
/// Returns true if the response is 201 Created
Expand All @@ -234,6 +234,12 @@ public interface ICreateTaskApiResponse : Timr.Api.Client.IApiResponse, ICreated
/// <returns></returns>
bool IsBadRequest { get; }

/// <summary>
/// Returns true if the response is 403 Forbidden
/// </summary>
/// <returns></returns>
bool IsForbidden { get; }

/// <summary>
/// Returns true if the response is 409 Conflict
/// </summary>
Expand Down Expand Up @@ -868,6 +874,56 @@ public bool TryBadRequest([NotNullWhen(true)]out Timr.Api.Model.Error? result)
return result != null;
}

/// <summary>
/// Returns true if the response is 403 Forbidden
/// </summary>
/// <returns></returns>
public bool IsForbidden => 403 == (int)StatusCode;

/// <summary>
/// Deserializes the response if the response is 403 Forbidden
/// </summary>
/// <returns></returns>
public Timr.Api.Model.Error? Forbidden()
{
bool suppressDefault = false;
Timr.Api.Model.Error? result = null;
OnForbidden(ref suppressDefault, ref result);
if (!suppressDefault)
result = DefaultForbidden();
return result;
}

private Timr.Api.Model.Error? DefaultForbidden()
{
// NOTICE: Consider this AsModel template deprecated. Implement the appropriate partial method instead
return IsForbidden
? System.Text.Json.JsonSerializer.Deserialize<Timr.Api.Model.Error>(RawContent, _jsonSerializerOptions)
: null;
}

partial void OnForbidden(ref bool suppressDefault, ref Timr.Api.Model.Error? result);

/// <summary>
/// Returns true if the response is 403 Forbidden and the deserialized response is not null
/// </summary>
/// <param name="result"></param>
/// <returns></returns>
public bool TryForbidden([NotNullWhen(true)]out Timr.Api.Model.Error? result)
{
result = null;

try
{
result = Forbidden();
} catch (Exception e)
{
OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)403);
}

return result != null;
}

/// <summary>
/// Returns true if the response is 409 Conflict
/// </summary>
Expand Down
58 changes: 57 additions & 1 deletion sdk/dotnet/Timr.Api/Endpoints/TaskToUserAssignmentApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public interface IGetTaskToUserAssignmentApiResponse : Timr.Api.Client.IApiRespo
/// <summary>
/// The <see cref="IUpsertTaskToUserAssignmentApiResponse"/>
/// </summary>
public interface IUpsertTaskToUserAssignmentApiResponse : Timr.Api.Client.IApiResponse, IOk<Timr.Api.Model.TaskToUserAssignment?>, ICreated<Timr.Api.Model.TaskToUserAssignment?>, IBadRequest<Timr.Api.Model.Error?>, IConflict<Timr.Api.Model.Error?>, IUnprocessableContent<Timr.Api.Model.Error?>
public interface IUpsertTaskToUserAssignmentApiResponse : Timr.Api.Client.IApiResponse, IOk<Timr.Api.Model.TaskToUserAssignment?>, ICreated<Timr.Api.Model.TaskToUserAssignment?>, IBadRequest<Timr.Api.Model.Error?>, IForbidden<Timr.Api.Model.Error?>, IConflict<Timr.Api.Model.Error?>, IUnprocessableContent<Timr.Api.Model.Error?>
{
/// <summary>
/// Returns true if the response is 200 Ok
Expand All @@ -248,6 +248,12 @@ public interface IUpsertTaskToUserAssignmentApiResponse : Timr.Api.Client.IApiRe
/// <returns></returns>
bool IsBadRequest { get; }

/// <summary>
/// Returns true if the response is 403 Forbidden
/// </summary>
/// <returns></returns>
bool IsForbidden { get; }

/// <summary>
/// Returns true if the response is 409 Conflict
/// </summary>
Expand Down Expand Up @@ -1966,6 +1972,56 @@ public bool TryBadRequest([NotNullWhen(true)]out Timr.Api.Model.Error? result)
return result != null;
}

/// <summary>
/// Returns true if the response is 403 Forbidden
/// </summary>
/// <returns></returns>
public bool IsForbidden => 403 == (int)StatusCode;

/// <summary>
/// Deserializes the response if the response is 403 Forbidden
/// </summary>
/// <returns></returns>
public Timr.Api.Model.Error? Forbidden()
{
bool suppressDefault = false;
Timr.Api.Model.Error? result = null;
OnForbidden(ref suppressDefault, ref result);
if (!suppressDefault)
result = DefaultForbidden();
return result;
}

private Timr.Api.Model.Error? DefaultForbidden()
{
// NOTICE: Consider this AsModel template deprecated. Implement the appropriate partial method instead
return IsForbidden
? System.Text.Json.JsonSerializer.Deserialize<Timr.Api.Model.Error>(RawContent, _jsonSerializerOptions)
: null;
}

partial void OnForbidden(ref bool suppressDefault, ref Timr.Api.Model.Error? result);

/// <summary>
/// Returns true if the response is 403 Forbidden and the deserialized response is not null
/// </summary>
/// <param name="result"></param>
/// <returns></returns>
public bool TryForbidden([NotNullWhen(true)]out Timr.Api.Model.Error? result)
{
result = null;

try
{
result = Forbidden();
} catch (Exception e)
{
OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)403);
}

return result != null;
}

/// <summary>
/// Returns true if the response is 409 Conflict
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion sdk/dotnet/Timr.Api/Model/Accounts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
namespace Timr.Api.Model
{
/// <summary>
/// Accounts
/// Account balances for a user. &#x60;time_account&#x60; is omitted for trust-based working time; &#x60;overtime_surcharge_accounts&#x60; requires the Overtime Allowance feature; &#x60;vacation_account&#x60; is omitted when the balance has no vacation account. Omitted balances do not mean zero. When no balance exists for the requested day, the response can be empty.
/// </summary>
public partial class Accounts : IValidatableObject
{
Expand Down
2 changes: 1 addition & 1 deletion sdk/dotnet/Timr.Api/Model/Task.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
namespace Timr.Api.Model
{
/// <summary>
/// A task, placed in the tree by &#x60;parent_task&#x60;, with the full path from the root in &#x60;breadcrumbs&#x60;. &#x60;bookable&#x60; and &#x60;billable&#x60; control recording and invoicing; &#x60;lock_date&#x60;, time windows and location constrain what may be recorded.
/// A task, placed in the tree by &#x60;parent_task&#x60;, with the full path from the root in &#x60;breadcrumbs&#x60;. &#x60;bookable&#x60; and &#x60;billable&#x60; control recording and invoicing; &#x60;lock_date&#x60;, time windows and location constrain what may be recorded. Budget fields (&#x60;budget_*&#x60;) require the Budgets feature and administrator or task-leader access to this task, including overall task leaders. Task-leader access also requires Corporate Features. Otherwise these fields are omitted without an error; omission does not mean no budget is configured. &#x60;lock_date&#x60; requires Task Locking; &#x60;earliest_start_time&#x60; and &#x60;latest_end_time&#x60; require Recording Restrictions; &#x60;location_restriction_radius_meters&#x60; requires Geofence. These fields are otherwise omitted. &#x60;location&#x60; requires Task Locations, or Geofence when budget details are visible.
/// </summary>
public partial class Task : IValidatableObject
{
Expand Down
2 changes: 1 addition & 1 deletion sdk/dotnet/Timr.Api/Model/TaskBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
namespace Timr.Api.Model
{
/// <summary>
/// TaskBase
/// Common task fields. Task administration requires the Administrator or Task Manager role. Budget fields additionally require the Budgets feature and administrator or task-leader authorization; task leaders also need Corporate Features. Supplying a budget field without this authorization, including false or null for nullable fields, rejects the entire request with HTTP 403.
/// </summary>
public partial class TaskBase : IValidatableObject
{
Expand Down
2 changes: 1 addition & 1 deletion sdk/dotnet/Timr.Api/Model/TaskCreate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
namespace Timr.Api.Model
{
/// <summary>
/// TaskCreate
/// For budget writes, task-leader authorization is based on the Task Leader or Overall Task Leader role. Budget visibility in the response is checked separately against the created task.
/// </summary>
public partial class TaskCreate : IValidatableObject
{
Expand Down
2 changes: 1 addition & 1 deletion sdk/dotnet/Timr.Api/Model/TaskReduced.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
namespace Timr.Api.Model
{
/// <summary>
/// TaskReduced
/// A task with recording-related details. &#x60;budget_planning_type&#x60; is omitted unless the Budgets feature and administrator or task-leader access to the task are available; task leaders also need Corporate Features. &#x60;lock_date&#x60; requires Task Locking; &#x60;earliest_start_time&#x60; and &#x60;latest_end_time&#x60; require Recording Restrictions; &#x60;location&#x60; requires Task Locations; &#x60;location_restriction_radius_meters&#x60; requires Geofence. Fields whose requirements are not met are omitted without an error; omission does not mean no value is configured.
/// </summary>
public partial class TaskReduced : IValidatableObject
{
Expand Down
5 changes: 3 additions & 2 deletions sdk/dotnet/Timr.Api/Model/TaskToUserAssignment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public partial class TaskToUserAssignment : IValidatableObject
/// <param name="user">user</param>
/// <param name="recordingLock">recordingLock</param>
/// <param name="automaticallyAssigned">automaticallyAssigned</param>
/// <param name="hoursPlanned">hoursPlanned</param>
/// <param name="hoursPlanned">Omitted without an error or warning unless the Budgets feature and administrator or task-leader access to this task are available. Task-leader access also requires Corporate Features. An omitted field does not mean no budget is configured.</param>
[JsonConstructor]
public TaskToUserAssignment(UserPartial user, RecordingLockType recordingLock, bool automaticallyAssigned, Option<decimal?> hoursPlanned = default)
{
Expand Down Expand Up @@ -75,8 +75,9 @@ public TaskToUserAssignment(UserPartial user, RecordingLockType recordingLock, b
public Option<decimal?> HoursPlannedOption { get; private set; }

/// <summary>
/// Gets or Sets HoursPlanned
/// Omitted without an error or warning unless the Budgets feature and administrator or task-leader access to this task are available. Task-leader access also requires Corporate Features. An omitted field does not mean no budget is configured.
/// </summary>
/// <value>Omitted without an error or warning unless the Budgets feature and administrator or task-leader access to this task are available. Task-leader access also requires Corporate Features. An omitted field does not mean no budget is configured.</value>
[JsonPropertyName("hours_planned")]
public decimal? HoursPlanned { get { return this.HoursPlannedOption.Value; } set { this.HoursPlannedOption = new(value); } }

Expand Down
10 changes: 6 additions & 4 deletions sdk/dotnet/Timr.Api/Model/TaskToUserAssignmentUpsert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public partial class TaskToUserAssignmentUpsert : IValidatableObject
/// <summary>
/// Initializes a new instance of the <see cref="TaskToUserAssignmentUpsert" /> class.
/// </summary>
/// <param name="hoursPlanned">hoursPlanned</param>
/// <param name="recordingLock">recordingLock</param>
/// <param name="hoursPlanned">Requires the Budgets feature and administrator or task-leader access to this task, including overall task leaders. Task leaders also need Corporate Features. Supplying this field without permission, including null to clear it, rejects the entire assignment request with HTTP 403. Omit it to leave the budget unchanged.</param>
/// <param name="recordingLock">Supplying a value other than &#x60;recordable&#x60;, including null, requires administrator or task-leader access to the task; otherwise the entire request is rejected with HTTP 403. Task leaders need Corporate Features. Omitted or null values leave the recording lock unchanged.</param>
[JsonConstructor]
public TaskToUserAssignmentUpsert(Option<decimal?> hoursPlanned = default, Option<RecordingLockType?> recordingLock = default)
{
Expand All @@ -53,8 +53,9 @@ public TaskToUserAssignmentUpsert(Option<decimal?> hoursPlanned = default, Optio
public Option<RecordingLockType?> RecordingLockOption { get; private set; }

/// <summary>
/// Gets or Sets RecordingLock
/// Supplying a value other than &#x60;recordable&#x60;, including null, requires administrator or task-leader access to the task; otherwise the entire request is rejected with HTTP 403. Task leaders need Corporate Features. Omitted or null values leave the recording lock unchanged.
/// </summary>
/// <value>Supplying a value other than &#x60;recordable&#x60;, including null, requires administrator or task-leader access to the task; otherwise the entire request is rejected with HTTP 403. Task leaders need Corporate Features. Omitted or null values leave the recording lock unchanged.</value>
[JsonPropertyName("recording_lock")]
public RecordingLockType? RecordingLock { get { return this.RecordingLockOption.Value; } set { this.RecordingLockOption = new(value); } }

Expand All @@ -66,8 +67,9 @@ public TaskToUserAssignmentUpsert(Option<decimal?> hoursPlanned = default, Optio
public Option<decimal?> HoursPlannedOption { get; private set; }

/// <summary>
/// Gets or Sets HoursPlanned
/// Requires the Budgets feature and administrator or task-leader access to this task, including overall task leaders. Task leaders also need Corporate Features. Supplying this field without permission, including null to clear it, rejects the entire assignment request with HTTP 403. Omit it to leave the budget unchanged.
/// </summary>
/// <value>Requires the Budgets feature and administrator or task-leader access to this task, including overall task leaders. Task leaders also need Corporate Features. Supplying this field without permission, including null to clear it, rejects the entire assignment request with HTTP 403. Omit it to leave the budget unchanged.</value>
[JsonPropertyName("hours_planned")]
public decimal? HoursPlanned { get { return this.HoursPlannedOption.Value; } set { this.HoursPlannedOption = new(value); } }

Expand Down
8 changes: 4 additions & 4 deletions sdk/dotnet/Timr.Api/Model/TaskUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
namespace Timr.Api.Model
{
/// <summary>
/// TaskUpdate
/// For budget writes, task-leader authorization is checked for this task, including overall task leadership.
/// </summary>
public partial class TaskUpdate : IValidatableObject
{
Expand Down Expand Up @@ -58,7 +58,7 @@ public partial class TaskUpdate : IValidatableObject
/// <param name="customField2">you can configure custom fields for tasks in the settings of timr under Administration/Settings/Tasks. To add a new custom field, simply choose a name for the field.</param>
/// <param name="customField3">you can configure custom fields for tasks in the settings of timr under Administration/Settings/Tasks. To add a new custom field, simply choose a name for the field.</param>
/// <param name="metadata">metadata</param>
/// <param name="budgetUpdateProjectTimes">this property is used to decide whether existing project times that have been booked to this task should be updated with the changed budget. If budget_planning type or budget_hourly_rate are set, this property must also be set. Based on this, the budgets of the existing project times are then recalculated or not. </param>
/// <param name="budgetUpdateProjectTimes">Whether to recalculate existing project times after a budget change. Required when budget_planning_type or budget_hourly_rate is supplied. The same budget permissions apply, including false.</param>
[JsonConstructor]
public TaskUpdate(Option<string?> name = default, Option<string?> parentTaskId = default, Option<string?> externalId = default, Option<string?> description = default, Option<string?> descriptionExternal = default, Option<bool?> bookable = default, Option<bool?> billable = default, Option<bool?> projectTimeNotesRequired = default, Option<DateOnly?> startDate = default, Option<DateOnly?> endDate = default, Option<DateOnly?> lockDate = default, Option<string?> earliestStartTime = default, Option<string?> latestEndTime = default, Option<BudgetPlanningTypeRequest?> budgetPlanningType = default, Option<decimal?> budgetHoursPlanned = default, Option<decimal?> budgetHourlyRate = default, Option<decimal?> budgetPlanned = default, Option<bool?> budgetIncludeNonBillableProjectTimes = default, Option<bool?> locationInherited = default, Option<TaskLocation?> location = default, Option<int?> locationRestrictionRadiusMeters = default, Option<string?> customField1 = default, Option<string?> customField2 = default, Option<string?> customField3 = default, Option<Dictionary<string, Object>?> metadata = default, Option<bool?> budgetUpdateProjectTimes = default)
{
Expand Down Expand Up @@ -447,9 +447,9 @@ public TaskUpdate(Option<string?> name = default, Option<string?> parentTaskId =
public Option<bool?> BudgetUpdateProjectTimesOption { get; private set; }

/// <summary>
/// this property is used to decide whether existing project times that have been booked to this task should be updated with the changed budget. If budget_planning type or budget_hourly_rate are set, this property must also be set. Based on this, the budgets of the existing project times are then recalculated or not.
/// Whether to recalculate existing project times after a budget change. Required when budget_planning_type or budget_hourly_rate is supplied. The same budget permissions apply, including false.
/// </summary>
/// <value>this property is used to decide whether existing project times that have been booked to this task should be updated with the changed budget. If budget_planning type or budget_hourly_rate are set, this property must also be set. Based on this, the budgets of the existing project times are then recalculated or not. </value>
/// <value>Whether to recalculate existing project times after a budget change. Required when budget_planning_type or budget_hourly_rate is supplied. The same budget permissions apply, including false.</value>
[JsonPropertyName("budget_update_project_times")]
public bool? BudgetUpdateProjectTimes { get { return this.BudgetUpdateProjectTimesOption.Value; } set { this.BudgetUpdateProjectTimesOption = new(value); } }

Expand Down
Loading
Loading