Skip to content

Commit

Permalink
fix: Add missing fields to Sign Template Signer (box/box-openapi#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
box-sdk-build committed Aug 22, 2024
1 parent 474e393 commit ca7b5f1
Show file tree
Hide file tree
Showing 17 changed files with 147 additions and 73 deletions.
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "6dfffba", "specHash": "da821cd", "version": "1.0.0" }
{ "engineHash": "6dfffba", "specHash": "57614c2", "version": "1.0.0" }
2 changes: 1 addition & 1 deletion Box.Sdk.Gen.Tests.Integration/Test/Ai/AiManagerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public async System.Threading.Tasks.Task TestAskAiMultipleItems() {
[TestMethod]
public async System.Threading.Tasks.Task TestAiTextGenWithDialogueHistory() {
FileFull fileToAsk = await new CommonsManager().UploadNewFileAsync();
AiResponse response = await client.Ai.CreateAiTextGenAsync(requestBody: new AiTextGen(prompt: "Parapharse the document.s", items: Array.AsReadOnly(new [] {new AiTextGenItemsField() { Id = fileToAsk.Id, Type = AiTextGenItemsTypeField.File, Content = "The Earth goes around the sun. Sun rises in the East in the morning." }})) { DialogueHistory = Array.AsReadOnly(new [] {new AiDialogueHistory() { Prompt = "What does the earth go around?", Answer = "The sun", CreatedAt = Utils.DateTimeFromString(dateTime: "2021-01-01T00:00:00Z") },new AiDialogueHistory() { Prompt = "On Earth, where does the sun rise?", Answer = "East", CreatedAt = Utils.DateTimeFromString(dateTime: "2021-01-01T00:00:00Z") }}) });
AiResponse response = await client.Ai.CreateAiTextGenAsync(requestBody: new AiTextGen(prompt: "Parapharse the document.s", items: Array.AsReadOnly(new [] {new AiTextGenItemsField(id: fileToAsk.Id, type: AiTextGenItemsTypeField.File) { Content = "The Earth goes around the sun. Sun rises in the East in the morning." }})) { DialogueHistory = Array.AsReadOnly(new [] {new AiDialogueHistory() { Prompt = "What does the earth go around?", Answer = "The sun", CreatedAt = Utils.DateTimeFromString(dateTime: "2021-01-01T00:00:00Z") },new AiDialogueHistory() { Prompt = "On Earth, where does the sun rise?", Answer = "East", CreatedAt = Utils.DateTimeFromString(dateTime: "2021-01-01T00:00:00Z") }}) });
Assert.IsTrue(response.Answer.Contains("sun"));
Assert.IsTrue(response.CompletionReason == "done");
await client.Files.DeleteFileByIdAsync(fileId: fileToAsk.Id);
Expand Down
4 changes: 2 additions & 2 deletions Box.Sdk.Gen/Schemas/AiAgentAsk/AiAgentAsk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public class AiAgentAsk {
public AiAgentLongTextTool? LongText { get; init; }

[JsonPropertyName("basic_text")]
public AiAgentBasicTextToolAsk? BasicText { get; init; }
public AiAgentBasicTextTool? BasicText { get; init; }

[JsonPropertyName("long_text_multi")]
public AiAgentLongTextTool? LongTextMulti { get; init; }

[JsonPropertyName("basic_text_multi")]
public AiAgentBasicTextToolAsk? BasicTextMulti { get; init; }
public AiAgentBasicTextTool? BasicTextMulti { get; init; }

public AiAgentAsk(AiAgentAskTypeField type = AiAgentAskTypeField.AiAgentAsk) {
Type = type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
using Box.Sdk.Gen.Schemas;

namespace Box.Sdk.Gen.Schemas {
public class AiAgentBasicGenTool : AiAgentLongTextTool {
public class AiAgentBasicGenTool : AiAgentLongTextToolTextGen {
/// <summary>
/// How the content should be included in a request to the LLM.
/// When passing this parameter, you must include `{content}`.
/// Input for `{content}` is optional, depending on the use.
/// </summary>
[JsonPropertyName("content_template")]
public string? ContentTemplate { get; init; }
Expand Down
27 changes: 27 additions & 0 deletions Box.Sdk.Gen/Schemas/AiAgentBasicTextTool/AiAgentBasicTextTool.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Box.Sdk.Gen;
using System.Text.Json.Serialization;
using Box.Sdk.Gen.Schemas;

namespace Box.Sdk.Gen.Schemas {
public class AiAgentBasicTextTool : AiAgentBasicTextToolBase {
/// <summary>
/// System messages try to help the LLM "understand" its role and what it is supposed to do.
/// </summary>
[JsonPropertyName("system_message")]
public string? SystemMessage { get; init; }

/// <summary>
/// The prompt template contains contextual information of the request and the user prompt.
///
/// When passing `prompt_template` parameters, you **must include** inputs for `{user_question}` and `{content}`.
///
/// Input for `{current_date}` is optional, depending on the use.
/// </summary>
[JsonPropertyName("prompt_template")]
public string? PromptTemplate { get; init; }

public AiAgentBasicTextTool() {

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,13 @@
using Box.Sdk.Gen.Schemas;

namespace Box.Sdk.Gen.Schemas {
public class AiAgentBasicTextToolAsk {
public class AiAgentBasicTextToolBase {
/// <summary>
/// The model used for the AI Agent for basic text.
/// </summary>
[JsonPropertyName("model")]
public string? Model { get; init; }

/// <summary>
/// System messages try to help the LLM "understand" its role and what it is supposed to do.
/// </summary>
[JsonPropertyName("system_message")]
public string? SystemMessage { get; init; }

/// <summary>
/// The prompt template contains contextual information of the request and the user prompt.
///
/// When passing `prompt_template` parameters, you **must include** inputs for `{current_date}`, `{user_question}`, and `{content}`.
/// </summary>
[JsonPropertyName("prompt_template")]
public string? PromptTemplate { get; init; }

/// <summary>
/// The number of tokens for completion.
/// </summary>
Expand All @@ -36,7 +22,7 @@ public class AiAgentBasicTextToolAsk {
[JsonPropertyName("llm_endpoint_params")]
public AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi? LlmEndpointParams { get; init; }

public AiAgentBasicTextToolAsk() {
public AiAgentBasicTextToolBase() {

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@
using Box.Sdk.Gen.Schemas;

namespace Box.Sdk.Gen.Schemas {
public class AiAgentBasicTextToolTextGen {
/// <summary>
/// The model to be used for the AI Agent for basic text.
/// </summary>
[JsonPropertyName("model")]
public string? Model { get; init; }

public class AiAgentBasicTextToolTextGen : AiAgentBasicTextToolBase {
/// <summary>
/// System messages try to help the LLM "understand" its role and what it is supposed to do.
/// This parameter requires using `{current_date}`.
/// Input for `{current_date}` is optional, depending on the use.
/// </summary>
[JsonPropertyName("system_message")]
public string? SystemMessage { get; init; }
Expand All @@ -21,20 +15,11 @@ public class AiAgentBasicTextToolTextGen {
/// The prompt template contains contextual information of the request and the user prompt.
///
/// When using the `prompt_template` parameter, you **must include** input for `{user_question}`.
/// Inputs for `{current_date}` and`{content}` are optional, depending on the use.
/// Inputs for `{current_date}` and `{content}` are optional, depending on the use.
/// </summary>
[JsonPropertyName("prompt_template")]
public string? PromptTemplate { get; init; }

/// <summary>
/// The number of tokens for completion.
/// </summary>
[JsonPropertyName("num_tokens_for_completion")]
public long? NumTokensForCompletion { get; init; }

[JsonPropertyName("llm_endpoint_params")]
public AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi? LlmEndpointParams { get; init; }

public AiAgentBasicTextToolTextGen() {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Box.Sdk.Gen.Schemas;

namespace Box.Sdk.Gen.Schemas {
public class AiAgentLongTextTool : AiAgentBasicTextToolTextGen {
public class AiAgentLongTextTool : AiAgentBasicTextTool {
[JsonPropertyName("embeddings")]
public AiAgentLongTextToolEmbeddingsField? Embeddings { get; init; }

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Box.Sdk.Gen;
using System.Text.Json.Serialization;
using Box.Sdk.Gen.Schemas;

namespace Box.Sdk.Gen.Schemas {
public class AiAgentLongTextToolTextGen : AiAgentBasicTextToolTextGen {
[JsonPropertyName("embeddings")]
public AiAgentLongTextToolTextGenEmbeddingsField? Embeddings { get; init; }

public AiAgentLongTextToolTextGen() {

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Box.Sdk.Gen;
using System.Text.Json.Serialization;
using Box.Sdk.Gen.Schemas;

namespace Box.Sdk.Gen.Schemas {
public class AiAgentLongTextToolTextGenEmbeddingsField {
/// <summary>
/// The model used for the AI Agent for calculating embeddings.
/// </summary>
[JsonPropertyName("model")]
public string? Model { get; init; }

[JsonPropertyName("strategy")]
public AiAgentLongTextToolTextGenEmbeddingsStrategyField? Strategy { get; init; }

public AiAgentLongTextToolTextGenEmbeddingsField() {

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Box.Sdk.Gen;
using System.Text.Json.Serialization;
using Box.Sdk.Gen.Schemas;

namespace Box.Sdk.Gen.Schemas {
public class AiAgentLongTextToolTextGenEmbeddingsStrategyField {
/// <summary>
/// The strategy used for the AI Agent for calculating embeddings.
/// </summary>
[JsonPropertyName("id")]
public string? Id { get; init; }

/// <summary>
/// The number of tokens per chunk.
/// </summary>
[JsonPropertyName("num_tokens_per_chunk")]
public long? NumTokensPerChunk { get; init; }

public AiAgentLongTextToolTextGenEmbeddingsStrategyField() {

}
}
}
2 changes: 1 addition & 1 deletion Box.Sdk.Gen/Schemas/AiTextGen/AiTextGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class AiTextGen {
public IReadOnlyList<AiTextGenItemsField> Items { get; }

/// <summary>
/// The history of prompts and answers previously passed to the LLM. This provides additional context to the LLM in generating the response.
/// The history of prompts and answers previously passed to the LLM. This parameter provides the additional context to the LLM when generating the response.
/// </summary>
[JsonPropertyName("dialogue_history")]
public IReadOnlyList<AiDialogueHistory>? DialogueHistory { get; init; }
Expand Down
17 changes: 12 additions & 5 deletions Box.Sdk.Gen/Schemas/AiTextGen/AiTextGenItemsField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,33 @@
namespace Box.Sdk.Gen.Schemas {
public class AiTextGenItemsField {
/// <summary>
/// The id of the item.
/// The ID of the item.
/// </summary>
[JsonPropertyName("id")]
public string? Id { get; init; }
public string Id { get; }

/// <summary>
/// The type of the item.
/// </summary>
[JsonPropertyName("type")]
[JsonConverter(typeof(StringEnumConverter<AiTextGenItemsTypeField>))]
public StringEnum<AiTextGenItemsTypeField>? Type { get; init; }
public StringEnum<AiTextGenItemsTypeField> Type { get; }

/// <summary>
/// The content to use as context for generating new text or editing existing text.
/// </summary>
[JsonPropertyName("content")]
public string? Content { get; init; }

public AiTextGenItemsField() {

public AiTextGenItemsField(string id, AiTextGenItemsTypeField type = AiTextGenItemsTypeField.File) {
Id = id;
Type = type;
}

[JsonConstructorAttribute]
internal AiTextGenItemsField(string id, StringEnum<AiTextGenItemsTypeField> type) {
Id = id;
Type = AiTextGenItemsTypeField.File;
}
}
}
40 changes: 20 additions & 20 deletions Box.Sdk.Gen/Schemas/IntegrationMapping/IntegrationMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@

namespace Box.Sdk.Gen.Schemas {
public class IntegrationMapping : IntegrationMappingBase {
/// <summary>
/// Identifies the Box partner app,
/// with which the mapping is associated.
/// Currently only supports Slack.
/// (part of the composite key together with `id`)
/// </summary>
[JsonPropertyName("integration_type")]
[JsonConverter(typeof(StringEnumConverter<IntegrationMappingIntegrationTypeField>))]
public StringEnum<IntegrationMappingIntegrationTypeField>? IntegrationType { get; init; }

/// <summary>
/// Mapped item object for Slack or Teams
/// </summary>
[JsonPropertyName("partner_item")]
public IntegrationMappingPartnerItemSlackUnion PartnerItem { get; }

/// <summary>
/// The Box folder, to which the object from the
/// partner app domain (referenced in `partner_item_id`) is mapped
Expand Down Expand Up @@ -49,31 +65,15 @@ public class IntegrationMapping : IntegrationMappingBase {
[JsonPropertyName("modified_at")]
public System.DateTimeOffset? ModifiedAt { get; init; }

/// <summary>
/// Identifies the Box partner app,
/// with which the mapping is associated.
/// Currently only supports Slack.
/// (part of the composite key together with `id`)
/// </summary>
[JsonPropertyName("integration_type")]
[JsonConverter(typeof(StringEnumConverter<IntegrationMappingIntegrationTypeField>))]
public StringEnum<IntegrationMappingIntegrationTypeField>? IntegrationType { get; init; }

/// <summary>
/// Mapped item object for Slack or Teams
/// </summary>
[JsonPropertyName("partner_item")]
public IntegrationMappingPartnerItemSlackUnion PartnerItem { get; }

public IntegrationMapping(string id, FolderMini boxItem, IntegrationMappingPartnerItemSlackUnion partnerItem, IntegrationMappingBaseTypeField type = IntegrationMappingBaseTypeField.IntegrationMapping) : base(id, type) {
BoxItem = boxItem;
public IntegrationMapping(string id, IntegrationMappingPartnerItemSlackUnion partnerItem, FolderMini boxItem, IntegrationMappingBaseTypeField type = IntegrationMappingBaseTypeField.IntegrationMapping) : base(id, type) {
PartnerItem = partnerItem;
BoxItem = boxItem;
}

[JsonConstructorAttribute]
internal IntegrationMapping(string id, FolderMini boxItem, IntegrationMappingPartnerItemSlackUnion partnerItem, StringEnum<IntegrationMappingBaseTypeField> type) : base(id, type ?? new StringEnum<IntegrationMappingBaseTypeField>(IntegrationMappingBaseTypeField.IntegrationMapping)) {
BoxItem = boxItem;
internal IntegrationMapping(string id, IntegrationMappingPartnerItemSlackUnion partnerItem, FolderMini boxItem, StringEnum<IntegrationMappingBaseTypeField> type) : base(id, type ?? new StringEnum<IntegrationMappingBaseTypeField>(IntegrationMappingBaseTypeField.IntegrationMapping)) {
PartnerItem = partnerItem;
BoxItem = boxItem;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@

namespace Box.Sdk.Gen.Schemas {
public class IntegrationMappingSlackCreateRequest {
[JsonPropertyName("partner_item")]
public IntegrationMappingPartnerItemSlack PartnerItem { get; }

[JsonPropertyName("box_item")]
public IntegrationMappingBoxItemSlack BoxItem { get; }

[JsonPropertyName("options")]
public IntegrationMappingSlackOptions? Options { get; init; }

[JsonPropertyName("partner_item")]
public IntegrationMappingPartnerItemSlack PartnerItem { get; }

public IntegrationMappingSlackCreateRequest(IntegrationMappingBoxItemSlack boxItem, IntegrationMappingPartnerItemSlack partnerItem) {
BoxItem = boxItem;
public IntegrationMappingSlackCreateRequest(IntegrationMappingPartnerItemSlack partnerItem, IntegrationMappingBoxItemSlack boxItem) {
PartnerItem = partnerItem;
BoxItem = boxItem;
}
}
}
12 changes: 12 additions & 0 deletions Box.Sdk.Gen/Schemas/TemplateSigner/TemplateSigner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ public class TemplateSigner {
[JsonPropertyName("signer_group_id")]
public string? SignerGroupId { get; init; }

/// <summary>
/// A placeholder label for the signer set by the template creator to differentiate between signers.
/// </summary>
[JsonPropertyName("label")]
public string? Label { get; init; }

/// <summary>
/// An identifier for the signer. This can be used to identify a signer within the template.
/// </summary>
[JsonPropertyName("public_id")]
public string? PublicId { get; init; }

public TemplateSigner() {

}
Expand Down
2 changes: 1 addition & 1 deletion docs/Ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ See the endpoint docs at

<!-- sample post_ai_text_gen -->
```
await client.Ai.CreateAiTextGenAsync(requestBody: new AiTextGen(prompt: "Parapharse the document.s", items: Array.AsReadOnly(new [] {new AiTextGenItemsField() { Id = fileToAsk.Id, Type = AiTextGenItemsTypeField.File, Content = "The Earth goes around the sun. Sun rises in the East in the morning." }})) { DialogueHistory = Array.AsReadOnly(new [] {new AiDialogueHistory() { Prompt = "What does the earth go around?", Answer = "The sun", CreatedAt = Utils.DateTimeFromString(dateTime: "2021-01-01T00:00:00Z") },new AiDialogueHistory() { Prompt = "On Earth, where does the sun rise?", Answer = "East", CreatedAt = Utils.DateTimeFromString(dateTime: "2021-01-01T00:00:00Z") }}) });
await client.Ai.CreateAiTextGenAsync(requestBody: new AiTextGen(prompt: "Parapharse the document.s", items: Array.AsReadOnly(new [] {new AiTextGenItemsField(id: fileToAsk.Id, type: AiTextGenItemsTypeField.File) { Content = "The Earth goes around the sun. Sun rises in the East in the morning." }})) { DialogueHistory = Array.AsReadOnly(new [] {new AiDialogueHistory() { Prompt = "What does the earth go around?", Answer = "The sun", CreatedAt = Utils.DateTimeFromString(dateTime: "2021-01-01T00:00:00Z") },new AiDialogueHistory() { Prompt = "On Earth, where does the sun rise?", Answer = "East", CreatedAt = Utils.DateTimeFromString(dateTime: "2021-01-01T00:00:00Z") }}) });
```

### Arguments
Expand Down

0 comments on commit ca7b5f1

Please sign in to comment.