-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Hubs Beta (box/box-openapi#453)
- Loading branch information
1 parent
873a6bc
commit fa91123
Showing
20 changed files
with
579 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{ "engineHash": "2994c4a", "specHash": "739d87b", "version": "1.1.0" } | ||
{ "engineHash": "2994c4a", "specHash": "6ca858e", "version": "1.1.0" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
Box.Sdk.Gen/Managers/AppItemAssociations/AppItemAssociationsManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
using Box.Sdk.Gen; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using Box.Sdk.Gen.Internal; | ||
using Box.Sdk.Gen.Schemas; | ||
|
||
namespace Box.Sdk.Gen.Managers { | ||
public class AppItemAssociationsManager : IAppItemAssociationsManager { | ||
public IAuthentication? Auth { get; init; } | ||
|
||
public NetworkSession NetworkSession { get; } | ||
|
||
public AppItemAssociationsManager(NetworkSession? networkSession = default) { | ||
NetworkSession = networkSession ?? new NetworkSession(); | ||
} | ||
/// <summary> | ||
/// **This is a beta feature, which means that its availability might be limited.** | ||
/// Returns all app items the file is associated with. This includes app items | ||
/// associated with ancestors of the file. Assuming the context user has access | ||
/// to the file, the type/ids are revealed even if the context user does not | ||
/// have **View** permission on the app item. | ||
/// </summary> | ||
/// <param name="fileId"> | ||
/// The unique identifier that represents a file. | ||
/// | ||
/// The ID for any file can be determined | ||
/// by visiting a file in the web application | ||
/// and copying the ID from the URL. For example, | ||
/// for the URL `https://*.app.box.com/files/123` | ||
/// the `file_id` is `123`. | ||
/// Example: "12345" | ||
/// </param> | ||
/// <param name="queryParams"> | ||
/// Query parameters of getFileAppItemAssociations method | ||
/// </param> | ||
/// <param name="headers"> | ||
/// Headers of getFileAppItemAssociations method | ||
/// </param> | ||
/// <param name="cancellationToken"> | ||
/// Token used for request cancellation. | ||
/// </param> | ||
public async System.Threading.Tasks.Task<AppItemAssociations> GetFileAppItemAssociationsAsync(string fileId, GetFileAppItemAssociationsQueryParams? queryParams = default, GetFileAppItemAssociationsHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) { | ||
queryParams = queryParams ?? new GetFileAppItemAssociationsQueryParams(); | ||
headers = headers ?? new GetFileAppItemAssociationsHeaders(); | ||
Dictionary<string, string> queryParamsMap = Utils.PrepareParams(map: new Dictionary<string, string?>() { { "limit", StringUtils.ToStringRepresentation(queryParams.Limit) }, { "marker", StringUtils.ToStringRepresentation(queryParams.Marker) }, { "application_type", StringUtils.ToStringRepresentation(queryParams.ApplicationType) } }); | ||
Dictionary<string, string> headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary<string, string?>() { }, headers.ExtraHeaders)); | ||
FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/files/", StringUtils.ToStringRepresentation(fileId), "/app_item_associations"), networkSession: this.NetworkSession) { Method = "GET", Parameters = queryParamsMap, Headers = headersMap, ResponseFormat = "json", Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); | ||
return SimpleJsonSerializer.Deserialize<AppItemAssociations>(response.Data); | ||
} | ||
|
||
/// <summary> | ||
/// **This is a beta feature, which means that its availability might be limited.** | ||
/// Returns all app items the folder is associated with. This includes app items | ||
/// associated with ancestors of the folder. Assuming the context user has access | ||
/// to the folder, the type/ids are revealed even if the context user does not | ||
/// have **View** permission on the app item. | ||
/// </summary> | ||
/// <param name="folderId"> | ||
/// The unique identifier that represent a folder. | ||
/// | ||
/// The ID for any folder can be determined | ||
/// by visiting this folder in the web application | ||
/// and copying the ID from the URL. For example, | ||
/// for the URL `https://*.app.box.com/folder/123` | ||
/// the `folder_id` is `123`. | ||
/// | ||
/// The root folder of a Box account is | ||
/// always represented by the ID `0`. | ||
/// Example: "12345" | ||
/// </param> | ||
/// <param name="queryParams"> | ||
/// Query parameters of getFolderAppItemAssociations method | ||
/// </param> | ||
/// <param name="headers"> | ||
/// Headers of getFolderAppItemAssociations method | ||
/// </param> | ||
/// <param name="cancellationToken"> | ||
/// Token used for request cancellation. | ||
/// </param> | ||
public async System.Threading.Tasks.Task<AppItemAssociations> GetFolderAppItemAssociationsAsync(string folderId, GetFolderAppItemAssociationsQueryParams? queryParams = default, GetFolderAppItemAssociationsHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) { | ||
queryParams = queryParams ?? new GetFolderAppItemAssociationsQueryParams(); | ||
headers = headers ?? new GetFolderAppItemAssociationsHeaders(); | ||
Dictionary<string, string> queryParamsMap = Utils.PrepareParams(map: new Dictionary<string, string?>() { { "limit", StringUtils.ToStringRepresentation(queryParams.Limit) }, { "marker", StringUtils.ToStringRepresentation(queryParams.Marker) }, { "application_type", StringUtils.ToStringRepresentation(queryParams.ApplicationType) } }); | ||
Dictionary<string, string> headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary<string, string?>() { }, headers.ExtraHeaders)); | ||
FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/folders/", StringUtils.ToStringRepresentation(folderId), "/app_item_associations"), networkSession: this.NetworkSession) { Method = "GET", Parameters = queryParamsMap, Headers = headersMap, ResponseFormat = "json", Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); | ||
return SimpleJsonSerializer.Deserialize<AppItemAssociations>(response.Data); | ||
} | ||
|
||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Box.Sdk.Gen/Managers/AppItemAssociations/GetFileAppItemAssociationsHeaders.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Box.Sdk.Gen; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using Box.Sdk.Gen.Schemas; | ||
using Box.Sdk.Gen.Internal; | ||
|
||
namespace Box.Sdk.Gen.Managers { | ||
public class GetFileAppItemAssociationsHeaders { | ||
/// <summary> | ||
/// Extra headers that will be included in the HTTP request. | ||
/// </summary> | ||
public Dictionary<string, string?> ExtraHeaders { get; } | ||
|
||
public GetFileAppItemAssociationsHeaders(Dictionary<string, string?>? extraHeaders = default) { | ||
ExtraHeaders = extraHeaders ?? new Dictionary<string, string?>() { }; | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
Box.Sdk.Gen/Managers/AppItemAssociations/GetFileAppItemAssociationsQueryParams.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Box.Sdk.Gen; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using Box.Sdk.Gen.Schemas; | ||
using Box.Sdk.Gen.Internal; | ||
|
||
namespace Box.Sdk.Gen.Managers { | ||
public class GetFileAppItemAssociationsQueryParams { | ||
/// <summary> | ||
/// The maximum number of items to return per page. | ||
/// </summary> | ||
public long? Limit { get; init; } | ||
|
||
/// <summary> | ||
/// Defines the position marker at which to begin returning results. This is | ||
/// used when paginating using marker-based pagination. | ||
/// | ||
/// This requires `usemarker` to be set to `true`. | ||
/// </summary> | ||
public string? Marker { get; init; } | ||
|
||
/// <summary> | ||
/// If given, only return app items for this application type | ||
/// </summary> | ||
public string? ApplicationType { get; init; } | ||
|
||
public GetFileAppItemAssociationsQueryParams() { | ||
|
||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Box.Sdk.Gen/Managers/AppItemAssociations/GetFolderAppItemAssociationsHeaders.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Box.Sdk.Gen; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using Box.Sdk.Gen.Schemas; | ||
using Box.Sdk.Gen.Internal; | ||
|
||
namespace Box.Sdk.Gen.Managers { | ||
public class GetFolderAppItemAssociationsHeaders { | ||
/// <summary> | ||
/// Extra headers that will be included in the HTTP request. | ||
/// </summary> | ||
public Dictionary<string, string?> ExtraHeaders { get; } | ||
|
||
public GetFolderAppItemAssociationsHeaders(Dictionary<string, string?>? extraHeaders = default) { | ||
ExtraHeaders = extraHeaders ?? new Dictionary<string, string?>() { }; | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
Box.Sdk.Gen/Managers/AppItemAssociations/GetFolderAppItemAssociationsQueryParams.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Box.Sdk.Gen; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using Box.Sdk.Gen.Schemas; | ||
using Box.Sdk.Gen.Internal; | ||
|
||
namespace Box.Sdk.Gen.Managers { | ||
public class GetFolderAppItemAssociationsQueryParams { | ||
/// <summary> | ||
/// The maximum number of items to return per page. | ||
/// </summary> | ||
public long? Limit { get; init; } | ||
|
||
/// <summary> | ||
/// Defines the position marker at which to begin returning results. This is | ||
/// used when paginating using marker-based pagination. | ||
/// | ||
/// This requires `usemarker` to be set to `true`. | ||
/// </summary> | ||
public string? Marker { get; init; } | ||
|
||
/// <summary> | ||
/// If given, returns only app items for this application type | ||
/// </summary> | ||
public string? ApplicationType { get; init; } | ||
|
||
public GetFolderAppItemAssociationsQueryParams() { | ||
|
||
} | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
Box.Sdk.Gen/Managers/AppItemAssociations/IAppItemAssociationsManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
using Box.Sdk.Gen; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using Box.Sdk.Gen.Schemas; | ||
using Box.Sdk.Gen.Internal; | ||
|
||
namespace Box.Sdk.Gen.Managers { | ||
public interface IAppItemAssociationsManager { | ||
/// <summary> | ||
/// **This is a beta feature, which means that its availability might be limited.** | ||
/// Returns all app items the file is associated with. This includes app items | ||
/// associated with ancestors of the file. Assuming the context user has access | ||
/// to the file, the type/ids are revealed even if the context user does not | ||
/// have **View** permission on the app item. | ||
/// </summary> | ||
/// <param name="fileId"> | ||
/// The unique identifier that represents a file. | ||
/// | ||
/// The ID for any file can be determined | ||
/// by visiting a file in the web application | ||
/// and copying the ID from the URL. For example, | ||
/// for the URL `https://*.app.box.com/files/123` | ||
/// the `file_id` is `123`. | ||
/// Example: "12345" | ||
/// </param> | ||
/// <param name="queryParams"> | ||
/// Query parameters of getFileAppItemAssociations method | ||
/// </param> | ||
/// <param name="headers"> | ||
/// Headers of getFileAppItemAssociations method | ||
/// </param> | ||
/// <param name="cancellationToken"> | ||
/// Token used for request cancellation. | ||
/// </param> | ||
public System.Threading.Tasks.Task<AppItemAssociations> GetFileAppItemAssociationsAsync(string fileId, GetFileAppItemAssociationsQueryParams? queryParams = default, GetFileAppItemAssociationsHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); | ||
|
||
/// <summary> | ||
/// **This is a beta feature, which means that its availability might be limited.** | ||
/// Returns all app items the folder is associated with. This includes app items | ||
/// associated with ancestors of the folder. Assuming the context user has access | ||
/// to the folder, the type/ids are revealed even if the context user does not | ||
/// have **View** permission on the app item. | ||
/// </summary> | ||
/// <param name="folderId"> | ||
/// The unique identifier that represent a folder. | ||
/// | ||
/// The ID for any folder can be determined | ||
/// by visiting this folder in the web application | ||
/// and copying the ID from the URL. For example, | ||
/// for the URL `https://*.app.box.com/folder/123` | ||
/// the `folder_id` is `123`. | ||
/// | ||
/// The root folder of a Box account is | ||
/// always represented by the ID `0`. | ||
/// Example: "12345" | ||
/// </param> | ||
/// <param name="queryParams"> | ||
/// Query parameters of getFolderAppItemAssociations method | ||
/// </param> | ||
/// <param name="headers"> | ||
/// Headers of getFolderAppItemAssociations method | ||
/// </param> | ||
/// <param name="cancellationToken"> | ||
/// Token used for request cancellation. | ||
/// </param> | ||
public System.Threading.Tasks.Task<AppItemAssociations> GetFolderAppItemAssociationsAsync(string folderId, GetFolderAppItemAssociationsQueryParams? queryParams = default, GetFolderAppItemAssociationsHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Box.Sdk.Gen; | ||
using System.Text.Json.Serialization; | ||
using Box.Sdk.Gen.Internal; | ||
|
||
namespace Box.Sdk.Gen.Schemas { | ||
public class AppItem { | ||
/// <summary> | ||
/// The unique identifier for this app item. | ||
/// </summary> | ||
[JsonPropertyName("id")] | ||
public string Id { get; } | ||
|
||
/// <summary> | ||
/// `app_item` | ||
/// </summary> | ||
[JsonPropertyName("type")] | ||
[JsonConverter(typeof(StringEnumConverter<AppItemTypeField>))] | ||
public StringEnum<AppItemTypeField> Type { get; } | ||
|
||
/// <summary> | ||
/// The type of the app that owns this app item. | ||
/// </summary> | ||
[JsonPropertyName("application_type")] | ||
public string ApplicationType { get; } | ||
|
||
public AppItem(string id, string applicationType, AppItemTypeField type = AppItemTypeField.AppItem) { | ||
Id = id; | ||
Type = type; | ||
ApplicationType = applicationType; | ||
} | ||
|
||
[JsonConstructorAttribute] | ||
internal AppItem(string id, string applicationType, StringEnum<AppItemTypeField> type) { | ||
Id = id; | ||
Type = AppItemTypeField.AppItem; | ||
ApplicationType = applicationType; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using System.ComponentModel; | ||
|
||
namespace Box.Sdk.Gen.Schemas { | ||
public enum AppItemTypeField { | ||
[Description("app_item")] | ||
AppItem | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
Box.Sdk.Gen/Schemas/AppItemAssociation/AppItemAssociation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using Box.Sdk.Gen; | ||
using System.Text.Json.Serialization; | ||
using Box.Sdk.Gen.Internal; | ||
using Box.Sdk.Gen.Schemas; | ||
|
||
namespace Box.Sdk.Gen.Schemas { | ||
public class AppItemAssociation { | ||
/// <summary> | ||
/// The unique identifier for this app item association. | ||
/// </summary> | ||
[JsonPropertyName("id")] | ||
public string Id { get; } | ||
|
||
/// <summary> | ||
/// `app_item_association` | ||
/// </summary> | ||
[JsonPropertyName("type")] | ||
[JsonConverter(typeof(StringEnumConverter<AppItemAssociationTypeField>))] | ||
public StringEnum<AppItemAssociationTypeField> Type { get; } | ||
|
||
[JsonPropertyName("app_item")] | ||
public AppItem AppItem { get; } | ||
|
||
[JsonPropertyName("item")] | ||
public FileBaseOrFolderBaseOrWebLinkBase Item { get; } | ||
|
||
public AppItemAssociation(string id, AppItem appItem, FileBaseOrFolderBaseOrWebLinkBase item, AppItemAssociationTypeField type = AppItemAssociationTypeField.AppItemAssociation) { | ||
Id = id; | ||
Type = type; | ||
AppItem = appItem; | ||
Item = item; | ||
} | ||
|
||
[JsonConstructorAttribute] | ||
internal AppItemAssociation(string id, AppItem appItem, FileBaseOrFolderBaseOrWebLinkBase item, StringEnum<AppItemAssociationTypeField> type) { | ||
Id = id; | ||
Type = AppItemAssociationTypeField.AppItemAssociation; | ||
AppItem = appItem; | ||
Item = item; | ||
} | ||
} | ||
} |
Oops, something went wrong.