Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Box Sign shared requests (box/box-openapi#504) #384

Merged
merged 6 commits into from
Jan 23, 2025
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
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "b5ed925", "specHash": "99792c6", "version": "1.6.0" }
{ "engineHash": "b5ed925", "specHash": "3dc3f1e", "version": "1.6.0" }
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Box.Sdk.Gen;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System;
using Box.Sdk.Gen.Internal;
using Box.Sdk.Gen.Schemas;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Box.Sdk.Gen;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System;
using Box.Sdk.Gen.Internal;
using Box.Sdk.Gen.Schemas;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Box.Sdk.Gen;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System;
using Box.Sdk.Gen.Internal;
using Box.Sdk.Gen.Schemas;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Box.Sdk.Gen;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System;
using Box.Sdk.Gen.Internal;
using Box.Sdk.Gen.Schemas;

Expand Down
15 changes: 15 additions & 0 deletions Box.Sdk.Gen/Managers/SignRequests/GetSignRequestsQueryParams.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Box.Sdk.Gen;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System;
using Box.Sdk.Gen.Internal;
using Box.Sdk.Gen.Schemas;

Expand All @@ -19,6 +20,20 @@ public class GetSignRequestsQueryParams {
/// </summary>
public long? Limit { get; init; }

/// <summary>
/// A list of sender emails to filter the signature requests by sender.
/// If provided, `shared_requests` must be set to `true`.
/// </summary>
public IReadOnlyList<string>? Senders { get; init; }

/// <summary>
/// If set to `true`, only includes requests that user is not an owner,
/// but user is a collaborator. Collaborator access is determined by the
/// user access level of the sign files of the request.
/// Default is `false`. Must be set to `true` if `senders` are provided.
/// </summary>
public bool? SharedRequests { get; init; }

public GetSignRequestsQueryParams() {

}
Expand Down
1 change: 1 addition & 0 deletions Box.Sdk.Gen/Managers/SignRequests/ISignRequestsManager.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Box.Sdk.Gen;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System;
using Box.Sdk.Gen.Internal;
using Box.Sdk.Gen.Schemas;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Box.Sdk.Gen;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System;
using Box.Sdk.Gen.Internal;
using Box.Sdk.Gen.Schemas;

Expand Down
3 changes: 2 additions & 1 deletion Box.Sdk.Gen/Managers/SignRequests/SignRequestsManager.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Box.Sdk.Gen;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System;
using Box.Sdk.Gen.Internal;
using Box.Sdk.Gen.Schemas;

Expand Down Expand Up @@ -88,7 +89,7 @@ public async System.Threading.Tasks.Task<SignRequest> GetSignRequestByIdAsync(st
public async System.Threading.Tasks.Task<SignRequests> GetSignRequestsAsync(GetSignRequestsQueryParams? queryParams = default, GetSignRequestsHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) {
queryParams = queryParams ?? new GetSignRequestsQueryParams();
headers = headers ?? new GetSignRequestsHeaders();
Dictionary<string, string> queryParamsMap = Utils.PrepareParams(map: new Dictionary<string, string?>() { { "marker", StringUtils.ToStringRepresentation(queryParams.Marker) }, { "limit", StringUtils.ToStringRepresentation(queryParams.Limit) } });
Dictionary<string, string> queryParamsMap = Utils.PrepareParams(map: new Dictionary<string, string?>() { { "marker", StringUtils.ToStringRepresentation(queryParams.Marker) }, { "limit", StringUtils.ToStringRepresentation(queryParams.Limit) }, { "senders", StringUtils.ToStringRepresentation(queryParams.Senders) }, { "shared_requests", StringUtils.ToStringRepresentation(queryParams.SharedRequests) } });
Dictionary<string, string> headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary<string, string?>() { }, headers.ExtraHeaders));
FetchResponse response = await this.NetworkSession.NetworkClient.FetchAsync(options: new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/sign_requests"), method: "GET", responseFormat: Box.Sdk.Gen.ResponseFormat.Json) { Parameters = queryParamsMap, Headers = headersMap, Auth = this.Auth, NetworkSession = this.NetworkSession, CancellationToken = cancellationToken }).ConfigureAwait(false);
return SimpleJsonSerializer.Deserialize<SignRequests>(NullableUtils.Unwrap(response.Data));
Expand Down
36 changes: 36 additions & 0 deletions Box.Sdk.Gen/Schemas/SignRequest/SignRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,30 @@ public class SignRequest : SignRequestBase, ISerializable {
[JsonPropertyName("_isauto_expire_atSet")]
protected bool _isAutoExpireAtSet { get; set; }

[JsonInclude]
[JsonPropertyName("_iscollaborator_levelSet")]
protected bool _isCollaboratorLevelSet { get; set; }

[JsonInclude]
[JsonPropertyName("_issender_emailSet")]
protected bool _isSenderEmailSet { get; set; }

[JsonInclude]
[JsonPropertyName("_issender_idSet")]
protected bool _isSenderIdSet { get; set; }

protected string? _signatureColor { get; set; }

protected string? _prepareUrl { get; set; }

protected System.DateTimeOffset? _autoExpireAt { get; set; }

protected string? _collaboratorLevel { get; set; }

protected string? _senderEmail { get; set; }

protected long? _senderId { get; set; }

/// <summary>
/// object type
/// </summary>
Expand Down Expand Up @@ -95,6 +113,24 @@ public class SignRequest : SignRequestBase, ISerializable {
[JsonPropertyName("parent_folder")]
public FolderMini? ParentFolder { get; init; }

/// <summary>
/// The collaborator level of the user to the sign request. Values can include "owner", "editor", and "viewer"
/// </summary>
[JsonPropertyName("collaborator_level")]
public string? CollaboratorLevel { get => _collaboratorLevel; init { _collaboratorLevel = value; _isCollaboratorLevelSet = true; } }

/// <summary>
/// The email address of the sender of the sign request.
/// </summary>
[JsonPropertyName("sender_email")]
public string? SenderEmail { get => _senderEmail; init { _senderEmail = value; _isSenderEmailSet = true; } }

/// <summary>
/// The user ID of the sender of the sign request.
/// </summary>
[JsonPropertyName("sender_id")]
public long? SenderId { get => _senderId; init { _senderId = value; _isSenderIdSet = true; } }

public SignRequest() {

}
Expand Down
Loading