From a13eb6ecbf005d948286ae7a600416845d635712 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Mon, 11 Sep 2023 16:39:55 -0400 Subject: [PATCH 01/93] No longer need most of the overrides --- generate-client/swagger-override.json | 44 --------------------------- 1 file changed, 44 deletions(-) diff --git a/generate-client/swagger-override.json b/generate-client/swagger-override.json index 4179489d..ca366fe4 100644 --- a/generate-client/swagger-override.json +++ b/generate-client/swagger-override.json @@ -1,50 +1,6 @@ { "components": { "schemas": { - "PutFieldValsRequest": { - "allOf": [ - { - "$ref": "#/components/schemas/SimpleImportMetadata" - }, - { - "type": "object", - "description": "The request body containing fields that will be assigned to the entry.", - "additionalProperties": false, - "properties": { - "links": { - "type": "array", - "description": "The links that will be assigned to the entry.", - "nullable": true, - "items": { - "$ref": "#/components/schemas/LinkToUpdate" - } - } - } - } - ] - }, - "SimpleImportMetadata": { - "type": "object", - "additionalProperties": false, - "properties": { - "fields": { - "type": "object", - "description": "The fields that will be assigned to the entry.", - "nullable": true, - "additionalProperties": { - "$ref": "#/components/schemas/FieldToUpdate" - } - }, - "tags": { - "type": "array", - "description": "The tags that will be assigned to the entry.", - "nullable": true, - "items": { - "type": "string" - } - } - } - }, "ImportAsyncMetadata": null } } From aa3e02ea402598b5ad862a2c353c4d389cbd5ed2 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Mon, 11 Sep 2023 16:44:49 -0400 Subject: [PATCH 02/93] Remove more overrides --- generate-client/swagger-override.json | 1 - 1 file changed, 1 deletion(-) diff --git a/generate-client/swagger-override.json b/generate-client/swagger-override.json index ca366fe4..eb434563 100644 --- a/generate-client/swagger-override.json +++ b/generate-client/swagger-override.json @@ -1,7 +1,6 @@ { "components": { "schemas": { - "ImportAsyncMetadata": null } } } \ No newline at end of file From 6fc19d11774b50967eec8af55f30a81d20571e4b Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Mon, 11 Sep 2023 17:01:17 -0400 Subject: [PATCH 03/93] Generate clients, lots to fix --- generate-client/swagger.json | 6432 +++++++++-------- src/Clients/RepositoryClients.cs | 10705 +++++++++++++++-------------- 2 files changed, 8768 insertions(+), 8369 deletions(-) diff --git a/generate-client/swagger.json b/generate-client/swagger.json index bb8fdf7b..b4e7068d 100644 --- a/generate-client/swagger.json +++ b/generate-client/swagger.json @@ -3,8 +3,8 @@ "openapi": "3.0.0", "info": { "title": "Laserfiche Repository API", - "description": "Welcome to the Laserfiche API Swagger Playground. You can try out any of our API calls against your live Laserfiche Cloud account. Visit the developer center for more details: https://developer.laserfiche.com

Visit the changelog for the list of changes: /repository/v1/changelog

Build# : c2b48a709248742c8c1c8aa8718ead3d7e893a85_.20230614.5

", - "version": "1" + "description": "Welcome to the Laserfiche API Swagger Playground. You can try out any of our API calls against your live Laserfiche Cloud account. Visit the developer center for more details: https://developer.laserfiche.com

Visit the changelog for the list of changes: /repository/v2/changelog

Build# : cd6b166ea01a3650124d8a563b445058494f881e_.20230901.2

", + "version": "2" }, "servers": [ { @@ -12,17 +12,17 @@ } ], "paths": { - "/v1/Repositories/{repoId}/Entries/{parentEntryId}/{fileName}": { - "post": { + "/v2/Repositories/{repositoryId}/Attributes": { + "get": { "tags": [ - "Entries" + "Attributes" ], - "summary": "Creates a new document in a folder.", - "description": "- Creates a new document in the specified folder with file (no more than 100 MB).\n- Optionally sets metadata and electronic document component.\n- Optional parameter: autoRename (default false). If an entry already exists with the given name, the entry will be automatically renamed. With this route, partial success is possible. The response returns multiple operation (entryCreate operation, setEdoc operation, setLinks operation, etc..) objects, which contain information about any errors that may have occurred during the creation. As long as the entryCreate operation succeeds, the entry will be created, even if all other operations fail.", - "operationId": "ImportDocument", + "summary": "Returns the attribute key value pairs associated with the authenticated user.", + "description": "- Returns the attribute key value pairs associated with the authenticated user. Alternatively, return only the attribute key value pairs that are associated with the \"Everyone\" group.\n- Attribute keys can be used with subsequent calls to get specific attribute values.\n- Optional query parameters: everyone (bool, default false). When true, this route does not return the attributes that are tied to the currently authenticated user, but rather the attributes assigned to the \"Everyone\" group. Note when this is true, the response does not include both the \"Everyone\" groups attribute and the currently authenticated user, but only the \"Everyone\" groups.\n- Default page size: 100. Allowed OData query options: Select, Count, OrderBy, Skip, Top, SkipToken, Prefer.\n- Required OAuth scope: repository.Read", + "operationId": "ListAttributes", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -32,72 +32,83 @@ "x-position": 1 }, { - "name": "parentEntryId", - "in": "path", - "required": true, - "description": "The entry ID of the folder that the document will be created in.", + "name": "everyone", + "in": "query", + "description": "Indicates if attributes associated with the \"Everyone\" group or the currently authenticated user is returned. The default value is false.", "schema": { - "type": "integer", - "format": "int32" + "type": "boolean", + "default": false }, "x-position": 2 }, { - "name": "fileName", - "in": "path", - "required": true, - "description": "The created document's file name.", + "name": "Prefer", + "x-originalName": "prefer", + "in": "header", + "description": "An optional OData header. Can be used to set the maximum page size using odata.maxpagesize.", "schema": { - "type": "string" + "type": "string", + "nullable": true }, "x-position": 3 }, { - "name": "autoRename", + "name": "$select", "in": "query", - "description": "An optional query parameter used to indicate if the new document should be automatically\n renamed if an entry already exists with the given name in the folder. The default value is false.", + "description": "Limits the properties returned in the result.", "schema": { - "type": "boolean" + "type": "string", + "nullable": true }, "x-position": 4 }, { - "name": "culture", + "name": "$orderby", "in": "query", - "description": "An optional query parameter used to indicate the locale that should be used.\n The value should be a standard language tag. This may be used when setting field values with tokens.", + "description": "Specifies the order in which items are returned. The maximum number of expressions is 5.", "schema": { "type": "string", - "default": "", "nullable": true }, - "x-position": 5 + "x-position": 6 + }, + { + "name": "$top", + "in": "query", + "description": "Limits the number of items returned from a collection.", + "schema": { + "type": "integer", + "format": "int32" + }, + "x-position": 7 + }, + { + "name": "$skip", + "in": "query", + "description": "Excludes the specified number of items of the queried collection from the result.", + "schema": { + "type": "integer", + "format": "int32" + }, + "x-position": 8 + }, + { + "name": "$count", + "in": "query", + "description": "Indicates whether the total count of items within a collection are returned in the result.", + "schema": { + "type": "boolean" + }, + "x-position": 9 } ], - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "type": "object", - "properties": { - "electronicDocument": { - "type": "string", - "format": "binary" - }, - "request": { - "$ref": "#/components/schemas/PostEntryWithEdocMetadataRequest" - } - } - } - } - } - }, "responses": { - "201": { - "description": "Document creation is success.", + "200": { + "description": "A collection of attributes associated with the authenticated user.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CreateEntryResult" + "$ref": "#/components/schemas/AttributeCollectionResponse" } } } @@ -107,7 +118,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CreateEntryResult" + "$ref": "#/components/schemas/ProblemDetails" } } } @@ -133,27 +144,7 @@ } }, "404": { - "description": "Parent entry is not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateEntryResult" - } - } - } - }, - "409": { - "description": "Document creation is partial success.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateEntryResult" - } - } - } - }, - "413": { - "description": "Request is too large.", + "description": "Not found.", "content": { "application/json": { "schema": { @@ -171,31 +162,21 @@ } } } - }, - "500": { - "description": "Document creation is complete failure.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateEntryResult" - } - } - } } } } }, - "/v1/Repositories/{repoId}/Attributes": { + "/v2/Repositories/{repositoryId}/Attributes/{attributeKey}": { "get": { "tags": [ "Attributes" ], - "summary": "Returns the attribute key value pairs associated with the authenticated user.", - "description": "- Returns the attribute key value pairs associated with the authenticated user. Alternatively, return only the attribute key value pairs that are associated with the \"Everyone\" group.\n- Attribute keys can be used with subsequent calls to get specific attribute values.\n- Default page size: 100. Allowed OData query options: Select, Count, OrderBy, Skip, Top, SkipToken, Prefer. Optional query parameters: everyone (bool, default false). When true, this route does not return the attributes that are tied to the currently authenticated user, but rather the attributes assigned to the \"Everyone\" group. Note when this is true, the response does not include both the \"Everyone\" groups attribute and the currently authenticated user, but only the \"Everyone\" groups.", - "operationId": "GetTrusteeAttributeKeyValuePairs", + "summary": "Returns an attribute object associated with the authenticated user.", + "description": "- Returns the attribute associated with the key. Alternatively, return the attribute associated with the key within \"Everyone\" group.\n- Optional query parameters: everyone (bool, default false). When true, the server only searches for the attribute value with the given key upon the authenticated users attributes. If false, only the authenticated users attributes will be queried.\n- Required OAuth scope: repository.Read", + "operationId": "GetAttribute", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -205,82 +186,33 @@ "x-position": 1 }, { - "name": "everyone", - "in": "query", - "description": "Boolean value that indicates whether to return attributes key value pairs associated with everyone or the currently authenticated user.", + "name": "attributeKey", + "in": "path", + "required": true, + "description": "The requested attribute key.", "schema": { - "type": "boolean" + "type": "string" }, "x-position": 2 }, { - "name": "Prefer", - "x-originalName": "prefer", - "in": "header", - "description": "An optional OData header. Can be used to set the maximum page size using odata.maxpagesize.", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 3 - }, - { - "name": "$select", - "in": "query", - "description": "Limits the properties returned in the result.", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 4 - }, - { - "name": "$orderby", - "in": "query", - "description": "Specifies the order in which items are returned. The maximum number of expressions is 5.", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 6 - }, - { - "name": "$top", - "in": "query", - "description": "Limits the number of items returned from a collection.", - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 7 - }, - { - "name": "$skip", - "in": "query", - "description": "Excludes the specified number of items of the queried collection from the result.", - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 8 - }, - { - "name": "$count", + "name": "everyone", "in": "query", - "description": "Indicates whether the total count of items within a collection are returned in the result.", + "description": "Indicates if attributes associated with the \"Everyone\" group or the currently authenticated user is returned. The default value is false.", "schema": { - "type": "boolean" + "type": "boolean", + "default": false }, - "x-position": 9 + "x-position": 3 } ], "responses": { "200": { - "description": "Get trustee attribute key value pairs successfully.", + "description": "A single attribute associated with the authenticated user.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ODataValueContextOfListOfAttribute" + "$ref": "#/components/schemas/Attribute" } } } @@ -316,7 +248,7 @@ } }, "404": { - "description": "Not found.", + "description": "Requested attribute key not found.", "content": { "application/json": { "schema": { @@ -338,17 +270,17 @@ } } }, - "/v1/Repositories/{repoId}/Attributes/{attributeKey}": { + "/v2/Repositories/{repositoryId}/AuditReasons": { "get": { "tags": [ - "Attributes" + "AuditReasons" ], - "summary": "Returns an attribute object associated with the authenticated user.", - "description": "- Returns the attribute associated with the key. Alternatively, return the attribute associated with the key within \"Everyone\" group.\n- Optional query parameters: everyone (bool, default false). When true, the server only searches for the attribute value with the given key upon the authenticated users attributes. If false, only the authenticated users attributes will be queried.", - "operationId": "GetTrusteeAttributeValueByKey", + "summary": "Returns the audit reasons associated with the authenticated user.", + "description": "- Returns the audit reasons associated with the authenticated user. Inherited audit reasons are included.\n- Only includes audit reasons associated with available API functionalities, like delete entry and export document.\n- If the authenticated user does not have the appropriate Laserfiche feature right, the audit reasons associated with that feature right will not be included.\n- Required OAuth scope: repository.Read", + "operationId": "ListAuditReasons", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -358,32 +290,73 @@ "x-position": 1 }, { - "name": "attributeKey", - "in": "path", - "required": true, - "description": "The requested attribute key.", + "name": "Prefer", + "x-originalName": "prefer", + "in": "header", + "description": "An optional OData header. Can be used to set the maximum page size using odata.maxpagesize.", "schema": { - "type": "string" + "type": "string", + "nullable": true }, "x-position": 2 }, { - "name": "everyone", + "name": "$select", "in": "query", - "description": "Boolean value that indicates whether to return attributes associated with everyone or the currently authenticated user.", + "description": "Limits the properties returned in the result.", "schema": { - "type": "boolean" + "type": "string", + "nullable": true }, "x-position": 3 + }, + { + "name": "$orderby", + "in": "query", + "description": "Specifies the order in which items are returned. The maximum number of expressions is 5.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 5 + }, + { + "name": "$top", + "in": "query", + "description": "Limits the number of items returned from a collection.", + "schema": { + "type": "integer", + "format": "int32" + }, + "x-position": 6 + }, + { + "name": "$skip", + "in": "query", + "description": "Excludes the specified number of items of the queried collection from the result.", + "schema": { + "type": "integer", + "format": "int32" + }, + "x-position": 7 + }, + { + "name": "$count", + "in": "query", + "description": "Indicates whether the total count of items within a collection are returned in the result.", + "schema": { + "type": "boolean" + }, + "x-position": 8 } ], "responses": { "200": { - "description": "Get trustee attribute value successfully.", + "description": "A collection of audit reasons.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Attribute" + "$ref": "#/components/schemas/AuditReasonCollectionResponse" } } } @@ -419,7 +392,7 @@ } }, "404": { - "description": "Requested attribute key not found.", + "description": "Not found.", "content": { "application/json": { "schema": { @@ -441,17 +414,17 @@ } } }, - "/v1/Repositories/{repoId}/FieldDefinitions/{fieldDefinitionId}": { + "/v2/Repositories/{repositoryId}/FieldDefinitions/{fieldId}": { "get": { "tags": [ "FieldDefinitions" ], "summary": "Returns a single field definition object.", - "description": "- Returns a single field definition associated with the specified ID. \n- Useful when a route provides a minimal amount of details and more information about the specific field definition is needed.\n- Allowed OData query options: Select", - "operationId": "GetFieldDefinitionById", + "description": "- Returns a single field definition associated with the specified ID. \n- Useful when a route provides a minimal amount of details and more information about the specific field definition is needed.\n- Allowed OData query options: Select\n- Required OAuth scope: repository.Read", + "operationId": "GetFieldDefinition", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -461,7 +434,7 @@ "x-position": 1 }, { - "name": "fieldDefinitionId", + "name": "fieldId", "in": "path", "required": true, "description": "The requested field definition ID.", @@ -474,7 +447,7 @@ { "name": "culture", "in": "query", - "description": "An optional query parameter used to indicate the locale that should be used for formatting.\n The value should be a standard language tag.", + "description": "An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag.", "schema": { "type": "string", "default": "", @@ -495,11 +468,11 @@ ], "responses": { "200": { - "description": "Get field definition successfully.", + "description": "A single field definition.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WFieldInfo" + "$ref": "#/components/schemas/FieldDefinition" } } } @@ -557,17 +530,17 @@ } } }, - "/v1/Repositories/{repoId}/FieldDefinitions": { + "/v2/Repositories/{repositoryId}/FieldDefinitions": { "get": { "tags": [ "FieldDefinitions" ], "summary": "Returns the paged listing of the field definitions available in a repository.", - "description": "- Returns a paged listing of field definitions available in the specified repository.\n- Useful when trying to find a list of all field definitions available, rather than only those assigned to a specific entry/template.\n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.", - "operationId": "GetFieldDefinitions", + "description": "- Returns a paged listing of field definitions available in the specified repository.\n- Useful when trying to find a list of all field definitions available, rather than only those assigned to a specific entry/template.\n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.\n- Required OAuth scope: repository.Read", + "operationId": "ListFieldDefinitions", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -590,7 +563,7 @@ { "name": "culture", "in": "query", - "description": "An optional query parameter used to indicate the locale that should be used for formatting.\n The value should be a standard language tag.", + "description": "An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag.", "schema": { "type": "string", "default": "", @@ -650,11 +623,11 @@ ], "responses": { "200": { - "description": "Get field definitions successfully.", + "description": "A collection of field definitions.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ODataValueContextOfIListOfWFieldInfo" + "$ref": "#/components/schemas/FieldDefinitionCollectionResponse" } } } @@ -712,17 +685,17 @@ } } }, - "/v1/Repositories/{repoId}/LinkDefinitions": { + "/v2/Repositories/{repositoryId}/LinkDefinitions": { "get": { "tags": [ "LinkDefinitions" ], "summary": "Returns the link definitions associated with a repository.", - "description": "- Returns the link definitions in the repository.\n- Provide a repository ID and get a paged listing of link definitions available in the repository. Useful when trying to display all link definitions available, not only links assigned to a specific entry.\n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.", - "operationId": "GetLinkDefinitions", + "description": "- Returns the link definitions in the repository.\n- Provide a repository ID and get a paged listing of link definitions available in the repository. Useful when trying to display all link definitions available, not only links assigned to a specific entry.\n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.\n- Required OAuth scope: repository.Read", + "operationId": "ListLinkDefinitions", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -794,11 +767,11 @@ ], "responses": { "200": { - "description": "Get link definitions successfully.", + "description": "A collection of link definitions.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ODataValueContextOfIListOfEntryLinkTypeInfo" + "$ref": "#/components/schemas/LinkDefinitionCollectionResponse" } } } @@ -856,17 +829,17 @@ } } }, - "/v1/Repositories/{repoId}/LinkDefinitions/{linkTypeId}": { + "/v2/Repositories/{repositoryId}/LinkDefinitions/{linkDefinitionId}": { "get": { "tags": [ "LinkDefinitions" ], "summary": "Returns a single link definition object.", - "description": "- Returns a single link definition associated with the specified ID.\n- Provide a link type ID and get the associated link definition. Useful when a route provides a minimal amount of details and more information about the specific link definition is needed.\n- Allowed OData query options: Select", - "operationId": "GetLinkDefinitionById", + "description": "- Returns a single link definition associated with the specified ID.\n- Provide a link definition ID and get the associated link definition. Useful when a route provides a minimal amount of details and more information about the specific link definition is needed.\n- Allowed OData query options: Select\n- Required OAuth scope: repository.Read", + "operationId": "GetLinkDefinition", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -876,10 +849,10 @@ "x-position": 1 }, { - "name": "linkTypeId", + "name": "linkDefinitionId", "in": "path", "required": true, - "description": "The requested link type ID.", + "description": "The requested link definition ID.", "schema": { "type": "integer", "format": "int32" @@ -899,11 +872,11 @@ ], "responses": { "200": { - "description": "Get link definition successfully.", + "description": "A single link definition.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EntryLinkTypeInfo" + "$ref": "#/components/schemas/LinkDefinition" } } } @@ -939,7 +912,7 @@ } }, "404": { - "description": "Requested link type definition ID not found", + "description": "Requested link definition ID not found", "content": { "application/json": { "schema": { @@ -961,17 +934,17 @@ } } }, - "/v1/Repositories/{repoId}/Entries/{entryId}": { - "get": { + "/v2/Repositories/{repositoryId}/Entries/CreateMultipartUploadUrls": { + "post": { "tags": [ "Entries" ], - "summary": "Returns a single entry object.", - "description": "- Returns a single entry object.\n- Provide an entry ID, and get the entry associated with that ID. Useful when detailed information about the entry is required, such as metadata, path information, etc.\n- Allowed OData query options: Select. If the entry is a subtype (Folder, Document, or Shortcut), the entry will automatically be converted to include those model-specific properties.", - "operationId": "GetEntry", + "summary": "Requests Upload URLs to upload a large file in chunks.", + "description": "- Requests Upload URLs to upload a large file in chunks.\n- Returns an UploadId and an array of URLs to which the file chunks should be written in the same order.\n- To request a new batch of Upload URLs for the same file, set the value of UploadId to the one returned when the first batch of Upload URLs was requested. For requesting the first batch of Upload URLs, leave UploadId empty or null.\n- Example: if a file is going to be uploaded in 10 chunks, the 10 Upload URLs can be retrieved by two successive calls to this api, each call requesting 5 Upload URLs. For this, the first call should have StartingPartNumber=1 and NumberOfParts=5, and the second call should have StartingPartNumber=6 and NumberOfParts=5, along with UploadId returned in the first call.\n- Each Upload URL expires after 15 minutes.\n- Each file chunk written to an Upload URL should be at least 5 MB and at most 5 GB. There is no minimum size limit for the last chunk.\n- The value of NumberOfParts must be in the range [1, 100], meaning that in each call to this api, a maximum of 100 Upload URLs can be requested. \n- The total number of Upload URLs for a single file is 1000, which means (StartingPartNumber + NumberOfParts) should be less than or equal to 1001.\n- Required OAuth scope: repository.Write", + "operationId": "CreateMultipartUploadUrls", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -979,36 +952,58 @@ "type": "string" }, "x-position": 1 - }, - { - "name": "entryId", - "in": "path", - "required": true, - "description": "The requested entry ID.", - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 2 - }, - { - "name": "$select", - "in": "query", - "description": "Limits the properties returned in the result.", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 3 } ], + "requestBody": { + "x-name": "request", + "description": "The request body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateMultipartUploadUrlsRequest" + }, + "examples": { + "1": { + "summary": "Request the first batch of URLs", + "description": "The body of the CreateMultipartUploadUrls request for requesting a batch of 5 URLs, as the first batch.", + "value": { + "startingPartNumber": 1, + "numberOfParts": 5, + "fileName": "Sample.pdf", + "mimeType": "application/pdf" + } + }, + "2": { + "summary": "Request the second batch of URLs", + "description": "The body of the CreateMultipartUploadUrls request for requesting a batch of 5 URLs, as the second batch. The value of UploadId should be the same as the one received in the response of the first request. Any value sent for FileName or MimeType is ignored.", + "value": { + "uploadId": "VXBsb2FkSWRGcm9tRmlyc3RSZXF1ZXN0", + "startingPartNumber": 6, + "numberOfParts": 5 + } + }, + "3": { + "summary": "Request the third batch of URLs", + "description": "The body of the CreateMultipartUploadUrls request for requesting a batch of 5 URLs, as the third batch. The value of UploadId should be the same as the one received in the response of the first request. Any value sent for FileName or MimeType is ignored.", + "value": { + "uploadId": "VXBsb2FkSWRGcm9tRmlyc3RSZXF1ZXN0", + "startingPartNumber": 11, + "numberOfParts": 5 + } + } + } + } + }, + "required": true, + "x-position": 2 + }, "responses": { "200": { - "description": "Get entry successfully.", + "description": "A response containing an upload id and an array of upload URLs.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Entry" + "$ref": "#/components/schemas/CreateMultipartUploadUrlsResponse" } } } @@ -1044,7 +1039,17 @@ } }, "404": { - "description": "Requested entry id not found.", + "description": "Requested repository not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "413": { + "description": "Request is too large.", "content": { "application/json": { "schema": { @@ -1064,17 +1069,19 @@ } } } - }, - "delete": { + } + }, + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Folder/ImportUploadedParts": { + "post": { "tags": [ "Entries" ], - "summary": "Deletes an entry asynchronously.", - "description": "- Begins a task to delete an entry, and returns an operationToken.\n- Provide an entry ID, and queue a delete task to remove it from the repository (includes nested objects if the entry is a Folder type). The entry will not be deleted immediately.\n- Optionally include an audit reason ID and comment in the JSON body. This route returns an operationToken, and will run as an asynchronous operation. Check the progress via the Tasks/{operationToken} route.", - "operationId": "DeleteEntryInfo", + "summary": "Starts an asynchronous import task to import a document into a folder.", + "description": "- Imports a new file in the specified folder. The file should be already written (in chunks) to the upload URLs obtained by calling the Upload api.\n- This route does not support partial success.\n- Required OAuth scope: repository.Write", + "operationId": "StartImportUploadedParts", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -1087,33 +1094,44 @@ "name": "entryId", "in": "path", "required": true, - "description": "The requested entry ID.", + "description": "The entry ID of the folder that the document will be created in.", "schema": { "type": "integer", "format": "int32" }, "x-position": 2 + }, + { + "name": "culture", + "in": "query", + "description": "An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. This may be used when setting field values with tokens.", + "schema": { + "type": "string", + "default": "", + "nullable": true + }, + "x-position": 4 } ], "requestBody": { "x-name": "request", - "description": "The submitted audit reason.", + "description": "The request body.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/DeleteEntryWithAuditReason" + "$ref": "#/components/schemas/StartImportUploadedPartsRequest" } } }, "x-position": 3 }, "responses": { - "201": { - "description": "Delete entry operation start successfully.", + "202": { + "description": "A long operation task id.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AcceptedOperation" + "$ref": "#/components/schemas/StartTaskResponse" } } } @@ -1149,7 +1167,7 @@ } }, "404": { - "description": "Not found.", + "description": "Requested repository not found.", "content": { "application/json": { "schema": { @@ -1169,7 +1187,17 @@ } }, "429": { - "description": "Operation limit or request limit reached.", + "description": "Rate limit is reached.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "500": { + "description": "Import operation failed due to an internal server error.", "content": { "application/json": { "schema": { @@ -1179,17 +1207,19 @@ } } } - }, - "patch": { + } + }, + "/v2/Repositories/{repositoryId}/Entries/{entryId}/ExportAsync": { + "post": { "tags": [ "Entries" ], - "summary": "Moves and/or renames an entry.", - "description": "- Moves and/or renames an entry.\n- Move and/or rename an entry by passing in the new parent folder ID or name in the JSON body.\n- Optional parameter: autoRename (default false). If an entry already exists with the given name, the entry will be automatically renamed.", - "operationId": "MoveOrRenameEntry", + "summary": "Starts an asynchronous export task to export an entry.", + "description": "- Starts an asynchronous export operation to export an entry.\n- If successful, it returns a taskId which can be used to check the status of the export operation or download the export result, otherwise, it returns an error.\n- Required OAuth scope: repository.Read", + "operationId": "StartExportEntry", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -1202,7 +1232,7 @@ "name": "entryId", "in": "path", "required": true, - "description": "The requested entry ID.", + "description": "The ID of entry to export.", "schema": { "type": "integer", "format": "int32" @@ -1210,69 +1240,83 @@ "x-position": 2 }, { - "name": "autoRename", - "in": "query", - "description": "An optional query parameter used to indicate if the entry should be automatically\n renamed if another entry already exists with the same name in the folder. The default value is false.", - "schema": { - "type": "boolean" - }, - "x-position": 4 - }, - { - "name": "culture", + "name": "pageRange", "in": "query", - "description": "An optional query parameter used to indicate the locale that should be used.\n The value should be a standard language tag.", + "description": "A comma-separated range of pages to include. Ex: 1,3,4 or 1-3,5-7,9. This value is ignored when part=Edoc.", "schema": { "type": "string", - "default": "", "nullable": true }, - "x-position": 5 + "x-position": 3 } ], "requestBody": { "x-name": "request", - "description": "The request containing the folder ID that the entry will be moved to and the new name\n the entry will be renamed to.", + "description": "The request body.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PatchEntryRequest" + "$ref": "#/components/schemas/StartExportEntryRequest" }, "examples": { "1": { - "summary": "Move an entry", - "description": "We can move an entry by specifying the parent folder id in the request body.", + "summary": "Export the image part of a Laserfiche Document", + "description": "The body of the export request includes:
  1. The audit event information to associate with the export operation.
  2. part: the part of the document to export. Options include: Image, Text, Edoc.
  3. imageOptions: The options applied when exporting as Image.
    • format: the image format to export as. Options include: MultiPageTIFF, SinglePageTIFF, PNG, PDF, JPEG. The default value is MultiPageTIFF. MultiPageTIFF format is a single multi-page TIFF file. SinglePageTIFF format is multiple single-page TIFF files (in a single zip file).
    • jpegCompressionLevel: the quality level for JPEG compression when exporting images. The value must be between 0 and 100 (inclusive). The default value is 70.
    • includeAnnotations: indicates if the annotations need to be included. The default value is true.
    • convertPdfAnnotations: indicates if the annotations on the image need to be converted to PDF annotations when exporting to PDF format. The default value is true. This option is only applicable when exporting to PDF format and includeAnnotations is true.
    • pagePrefix: the page prefix of the individual files, when exporting to multi-file format (e.g.zip). The value must have a length of atmost 10 characters and only valid characters that can be included in file names are allowed. The default value is \", Page \".
    • includeRedactions: indicates if redactions are included. The default value is true.
    • watermark: the watermark element added to the image. This includes the following properties:
      • text: the text of the watermark. The value must be a string with a length of atmost 100 characters and must not be all whitespace characters. Using emojis in the text is not supported.
      • position: the position of the watermark. The default value is DeadCenter. Assuming that the page is divided into a 3x3 grid, then position can be specified using the following values:
        • TopLeft, TopCenter, TopRight, MiddleLeft, DeadCenter, MiddleRight, BottomLeft, BottomCenter, BottomRight
      • rotationAngle: the rotation angle of the watermark. The value must be between 0 and 360 (inclusive). The default value is 0.
      • pageSpanPercentage: the percentage of the page that the watermark spans on. The value must be between 1 and 100 (inclusive). The default value is 50.
", "value": { - "parentId": 123 + "auditReasonId": 0, + "auditReasonComment": "", + "part": "Image", + "imageOptions": { + "format": "MultiPageTIFF", + "jpegCompressionLevel": 70, + "includeAnnotations": true, + "convertPdfAnnotations": true, + "pagePrefix": ", Page ", + "includeRedactions": true, + "watermark": { + "text": "", + "position": "DeadCenter", + "rotationAngle": 0, + "pageSpanPercentage": 50 + } + } } }, "2": { - "summary": "Rename an entry", - "description": "We can rename an entry by specifying the new name of the entry in the request body.", + "summary": "Export the text part of a Laserfiche Document", + "description": "The body of the export request includes:
  1. The audit event information to associate with the export operation.
  2. part: the part of the document to export. Options include: Image, Text, Edoc.
  3. textOptions: The options applied when exporting as Text.
    • includeRedactions: indicates if redactions are included. The default value is true.
    • redactionCharacter: the character that replaces the original character in a redacted text. The value must be a string of length 1 and must not be a whitespace character. The default value is \"X\".
", "value": { - "name": "NewName" + "auditReasonId": 0, + "auditReasonComment": "", + "part": "Text", + "textOptions": { + "includeRedactions": true, + "redactionCharacter": "X" + } } }, "3": { - "summary": "Move and Rename an entry", - "description": "We can move and rename an entry by specifying the parent folder id and the new name of the entry in the request body.", + "summary": "Export the edoc part of a Laserfiche Document", + "description": "The body of the export request includes:
  1. The audit event information to associate with the export operation.
  2. part: the part of the document to export. Options include: Image, Text, Edoc.
", "value": { - "parentId": 123, - "name": "NewName" + "auditReasonId": 0, + "auditReasonComment": "", + "part": "Edoc" } } } } }, - "x-position": 3 + "required": true, + "x-position": 4 }, "responses": { - "200": { - "description": "Moves and/or renames an entry successfully.", + "202": { + "description": "A long operation task id.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Entry" + "$ref": "#/components/schemas/StartTaskResponse" } } } @@ -1308,17 +1352,7 @@ } }, "404": { - "description": "Request entry id not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "409": { - "description": "Entry name conflicts.", + "description": "Requested repository not found.", "content": { "application/json": { "schema": { @@ -1337,8 +1371,8 @@ } } }, - "423": { - "description": "Entry is locked.", + "429": { + "description": "Rate limit is reached.", "content": { "application/json": { "schema": { @@ -1347,8 +1381,8 @@ } } }, - "429": { - "description": "Rate limit is reached.", + "500": { + "description": "Export operation failed due to an internal server error.", "content": { "application/json": { "schema": { @@ -1360,17 +1394,17 @@ } } }, - "/v1/Repositories/{repoId}/Entries/ByPath": { - "get": { + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Folder/CopyAsync": { + "post": { "tags": [ "Entries" ], - "summary": "Returns a single entry object using the entry path.", - "description": "- Returns a single entry object using the entry path.\n- Optional query parameter: fallbackToClosestAncestor. Use the fallbackToClosestAncestor query parameter to return the closest existing ancestor if the initial entry path is not found.", - "operationId": "GetEntryByPath", + "summary": "Starts an asynchronous copy task to copy an entry into a folder.", + "description": "- Copy a new child entry in the designated folder async, and potentially return a taskId.\n- Provide the parent folder ID, and copy an entry as a child of the designated folder.\n- The status of the operation can be checked via the Tasks route.\n- Token substitution in the name of the copied entry is not supported.\n- Required OAuth scope: repository.Write", + "operationId": "StartCopyEntry", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -1380,34 +1414,59 @@ "x-position": 1 }, { - "name": "fullPath", - "in": "query", + "name": "entryId", + "in": "path", "required": true, - "description": "The requested entry path.", + "description": "The folder ID that the entry will be created in.", "schema": { - "type": "string", - "nullable": true + "type": "integer", + "format": "int32" }, "x-position": 2 }, { - "name": "fallbackToClosestAncestor", + "name": "culture", "in": "query", - "description": "An optional query parameter used to indicate whether or not the closest ancestor in the path should be returned if the initial entry path is not found. The default value is false.", + "description": "An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag.", "schema": { - "type": "boolean", - "default": false + "type": "string", + "default": "", + "nullable": true }, - "x-position": 3 + "x-position": 4 } ], + "requestBody": { + "x-name": "request", + "description": "The request body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/StartCopyEntryRequest" + }, + "examples": { + "1": { + "summary": "Copy an entry", + "description": "We can copy an entry (marked by sourceId property) to a destination (marked in URL).", + "value": { + "sourceId": 123, + "name": "CopiedEntry", + "autoRename": false + } + } + } + } + }, + "required": true, + "x-position": 3 + }, "responses": { - "200": { - "description": "Get entry successfully.", + "202": { + "description": "A long operation task id.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/FindEntryResult" + "$ref": "#/components/schemas/StartTaskResponse" } } } @@ -1443,7 +1502,17 @@ } }, "404": { - "description": "Requested entry path not found", + "description": "Requested repository not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "413": { + "description": "Request is too large.", "content": { "application/json": { "schema": { @@ -1453,7 +1522,7 @@ } }, "429": { - "description": "Rate limit is reached.", + "description": "Operation limit or request limit reached.", "content": { "application/json": { "schema": { @@ -1465,17 +1534,17 @@ } } }, - "/v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Folder/children": { - "get": { + "/v2/Repositories/{repositoryId}/Entries/{entryId}": { + "delete": { "tags": [ "Entries" ], - "summary": "Returns the children entries of a folder.", - "description": "- Returns the children entries of a folder in the repository.\n- Provide an entry ID (must be a folder), and get a paged listing of entries in that folder. Used as a way of navigating through the repository.\n- Default page size: 150. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. OData $OrderBy syntax should follow: \"PropertyName direction,PropertyName2 direction\". Sort order can be either value \"asc\" or \"desc\". Optional query parameters: groupByOrderType (bool). This query parameter decides if results are returned in groups based on their entry type. Entries returned in the listing are not automatically converted to their subtype (Folder, Shortcut, Document), so clients who want model-specific information should request it via the GET entry by ID route.\n- Optionally returns field values for the entries in the folder. Each field name needs to be specified in the request. Maximum limit of 10 field names.\n- If field values are requested, only the first value is returned if it is a multi value field.\n- Null or Empty field values should not be used to determine if a field is assigned to the entry.", - "operationId": "GetEntryListing", + "summary": "Starts an asynchronous delete task to delete an entry.", + "description": "- Begins a task to delete an entry, and returns a taskId.\n- Provide an entry ID, and queue a delete task to remove it from the repository (includes nested objects if the entry is a Folder type). The entry will not be deleted immediately.\n- Optionally include an audit reason ID and comment in the JSON body. This route returns a taskId, and will run as an asynchronous operation. Check the progress via the Tasks route.\n- Required OAuth scope: repository.Write", + "operationId": "StartDeleteEntry", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -1488,125 +1557,146 @@ "name": "entryId", "in": "path", "required": true, - "description": "The folder ID.", + "description": "The requested entry ID.", "schema": { "type": "integer", "format": "int32" }, "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The submitted audit reason.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/StartDeleteEntryRequest" + } + } }, - { - "name": "groupByEntryType", - "in": "query", - "description": "An optional query parameter used to indicate if the result should be grouped by entry type or not.", - "schema": { - "type": "boolean" - }, - "x-position": 3 - }, - { - "name": "fields", - "in": "query", - "style": "form", - "explode": true, - "description": "Optional array of field names. Field values corresponding to the given field names will be returned for each entry. ", - "schema": { - "type": "array", - "nullable": true, - "items": { - "type": "string" + "x-position": 3 + }, + "responses": { + "202": { + "description": "A long operation task id.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/StartTaskResponse" + } } - }, - "x-position": 4 + } }, - { - "name": "formatFields", - "in": "query", - "description": "Boolean for if field values should be formatted. Only applicable if Fields are specified.", - "schema": { - "type": "boolean" - }, - "x-position": 5 + "400": { + "description": "Invalid or bad request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } }, - { - "name": "Prefer", - "x-originalName": "prefer", - "in": "header", - "description": "An optional OData header. Can be used to set the maximum page size using odata.maxpagesize.", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 6 + "401": { + "description": "Access token is invalid or expired.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } }, - { - "name": "culture", - "in": "query", - "description": "An optional query parameter used to indicate the locale that should be used for formatting.\n The value should be a standard language tag. The formatFields query parameter must be set to true, otherwise\n culture will not be used for formatting.", - "schema": { - "type": "string", - "default": "", - "nullable": true - }, - "x-position": 7 + "403": { + "description": "Access denied for the operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } }, - { - "name": "$select", - "in": "query", - "description": "Limits the properties returned in the result.", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 8 + "404": { + "description": "Requested repository not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } }, - { - "name": "$orderby", - "in": "query", - "description": "Specifies the order in which items are returned. The maximum number of expressions is 5.", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 10 + "413": { + "description": "Request is too large.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } }, + "429": { + "description": "Operation limit or request limit reached.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + } + } + }, + "get": { + "tags": [ + "Entries" + ], + "summary": "Returns a single entry object.", + "description": "- Returns a single entry object.\n- Provide an entry ID, and get the entry associated with that ID. Useful when detailed information about the entry is required, such as metadata, path information, etc.\n- If the entry is a subtype (Folder, Document, or Shortcut), the entry will automatically be converted to include those model-specific properties.\n- Allowed OData query options: Select.\n- Required OAuth scope: repository.Read", + "operationId": "GetEntry", + "parameters": [ { - "name": "$top", - "in": "query", - "description": "Limits the number of items returned from a collection.", + "name": "repositoryId", + "in": "path", + "required": true, + "description": "The requested repository ID.", "schema": { - "type": "integer", - "format": "int32" + "type": "string" }, - "x-position": 11 + "x-position": 1 }, { - "name": "$skip", - "in": "query", - "description": "Excludes the specified number of items of the queried collection from the result.", + "name": "entryId", + "in": "path", + "required": true, + "description": "The requested entry ID.", "schema": { "type": "integer", "format": "int32" }, - "x-position": 12 + "x-position": 2 }, { - "name": "$count", + "name": "$select", "in": "query", - "description": "Indicates whether the total count of items within a collection are returned in the result.", + "description": "Limits the properties returned in the result.", "schema": { - "type": "boolean" + "type": "string", + "nullable": true }, - "x-position": 13 + "x-position": 3 } ], "responses": { "200": { - "description": "Get the children entries of a Folder successfully.", + "description": "A single entry.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ODataValueContextOfIListOfEntry" + "$ref": "#/components/schemas/Entry" } } } @@ -1642,7 +1732,7 @@ } }, "404": { - "description": "Request entry id not found.", + "description": "Requested entry id not found.", "content": { "application/json": { "schema": { @@ -1663,16 +1753,16 @@ } } }, - "post": { + "patch": { "tags": [ "Entries" ], - "summary": "Creates/copies a new child entry in a folder.", - "description": "- Create/copy a new child entry in the designated folder.\n- Provide the parent folder ID, and based on the request body, copy or create a folder/shortcut as a child entry of the designated folder.\n- Optional parameter: autoRename (default false). If an entry already exists with the given name, the entry will be automatically renamed.", - "operationId": "CreateOrCopyEntry", + "summary": "Update an entry. (Move and/or Rename)", + "description": "- Update an entry. (Move and/or Rename)\n- Move an entry to a new folder by setting the ParentId in the request body.\n- Rename an entry by setting the Name in the request body.\n- Required OAuth scope: repository.Write", + "operationId": "UpdateEntry", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -1685,76 +1775,67 @@ "name": "entryId", "in": "path", "required": true, - "description": "The folder ID that the entry will be created in.", + "description": "The requested entry ID.", "schema": { "type": "integer", "format": "int32" }, "x-position": 2 }, - { - "name": "autoRename", - "in": "query", - "description": "An optional query parameter used to indicate if the new entry should be automatically\n renamed if an entry already exists with the given name in the folder. The default value is false.", - "schema": { - "type": "boolean" - }, - "x-position": 4 - }, { "name": "culture", "in": "query", - "description": "An optional query parameter used to indicate the locale that should be used.\n The value should be a standard language tag.", + "description": "An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag.", "schema": { "type": "string", "default": "", "nullable": true }, - "x-position": 5 + "x-position": 4 } ], "requestBody": { "x-name": "request", - "description": "The entry to create.", + "description": "The request containing the folder ID that the entry will be moved to and the new name the entry will be renamed to.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PostEntryChildrenRequest" + "$ref": "#/components/schemas/UpdateEntryRequest" }, "examples": { "1": { - "summary": "Create a folder", - "description": "We can create a new folder with the given name.", + "summary": "Move an entry", + "description": "We can move an entry by specifying the parent folder id in the request body.", "value": { - "entryType": "Folder", - "name": "NewFolder" + "parentId": 123 } }, "2": { - "summary": "Create a shortcut", - "description": "We can create a new shortcut with the given name to the entry with the targetId.", + "summary": "Rename an entry", + "description": "We can rename an entry by specifying the new name of the entry in the request body.", "value": { - "entryType": "Shortcut", - "name": "NewShortcut", - "targetId": 123 + "name": "NewName", + "autoRename": false } }, "3": { - "summary": "Copy an entry", - "description": "We can copy an entry (marked by sourceId property) to a destination (marked in URL).", + "summary": "Move and Rename an entry", + "description": "We can move and rename an entry by specifying the parent folder id and the new name of the entry in the request body.", "value": { - "sourceId": 123, - "name": "CopiedEntry" + "parentId": 123, + "name": "NewName", + "autoRename": false } } } } }, + "required": true, "x-position": 3 }, "responses": { - "201": { - "description": "Created a new child entry successfully.", + "200": { + "description": "The updated entry.", "content": { "application/json": { "schema": { @@ -1823,6 +1904,16 @@ } } }, + "423": { + "description": "Entry is locked.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, "429": { "description": "Rate limit is reached.", "content": { @@ -1836,17 +1927,17 @@ } } }, - "/v1/Repositories/{repoId}/Entries/{entryId}/fields": { - "get": { + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Folder/Import": { + "post": { "tags": [ "Entries" ], - "summary": "Returns the fields assigned to an entry.", - "description": "- Returns the fields assigned to an entry.\n- Provide an entry ID, and get a paged listing of all fields assigned to that entry.\n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.", - "operationId": "GetFieldValues", + "summary": "Imports a file into a folder (max length: 100 MB).", + "description": "- Import a new document in the specified folder, and optionally assigns metadata.\n- The import may fail if the file is greater than 100 MB or time out if it takes longer than 60 seconds. These values are subject to change at anytime. Use the long operation asynchronous import if you run into these restrictions.\n- Required OAuth scope: repository.Write", + "operationId": "ImportEntry", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -1859,102 +1950,54 @@ "name": "entryId", "in": "path", "required": true, - "description": "The requested entry ID.", + "description": "The entry ID of the folder that the document will be created in.", "schema": { "type": "integer", "format": "int32" }, "x-position": 2 }, - { - "name": "Prefer", - "x-originalName": "prefer", - "in": "header", - "description": "An optional OData header. Can be used to set the maximum page size using odata.maxpagesize.", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 3 - }, - { - "name": "formatValue", - "in": "query", - "description": "An optional query parameter used to indicate if the field values should be formatted.\n The default value is false.", - "schema": { - "type": "boolean", - "default": false - }, - "x-position": 4 - }, { "name": "culture", "in": "query", - "description": "An optional query parameter used to indicate the locale that should be used for formatting.\n The value should be a standard language tag. The formatValue query parameter must be set to true, otherwise\n culture will not be used for formatting.", + "description": "An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. This may be used when setting field values with tokens.", "schema": { "type": "string", "default": "", "nullable": true }, - "x-position": 5 - }, - { - "name": "$select", - "in": "query", - "description": "Limits the properties returned in the result.", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 6 - }, - { - "name": "$orderby", - "in": "query", - "description": "Specifies the order in which items are returned. The maximum number of expressions is 5.", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 8 - }, - { - "name": "$top", - "in": "query", - "description": "Limits the number of items returned from a collection.", - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 9 - }, - { - "name": "$skip", - "in": "query", - "description": "Excludes the specified number of items of the queried collection from the result.", - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 10 - }, - { - "name": "$count", - "in": "query", - "description": "Indicates whether the total count of items within a collection are returned in the result.", - "schema": { - "type": "boolean" - }, - "x-position": 11 + "x-position": 3 } ], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "required": [ + "file", + "request" + ], + "properties": { + "file": { + "type": "string", + "format": "binary" + }, + "request": { + "$ref": "#/components/schemas/ImportEntryRequest" + } + } + } + } + } + }, "responses": { - "200": { - "description": "Get field values successfully.", + "201": { + "description": "The created entry.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ODataValueContextOfIListOfFieldValue" + "$ref": "#/components/schemas/Entry" } } } @@ -1999,8 +2042,28 @@ } } }, - "429": { - "description": "Rate limit is reached.", + "413": { + "description": "Request is too large.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "429": { + "description": "Rate limit is reached.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "500": { + "description": "Document creation is completely failed.", "content": { "application/json": { "schema": { @@ -2010,17 +2073,19 @@ } } } - }, - "put": { + } + }, + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Export": { + "post": { "tags": [ "Entries" ], - "summary": "Updates the field values assigned to an entry.", - "description": "- Update the field values assigned to an entry.\n- Provide the new field values to assign to the entry, and remove/reset all previously assigned field values. \n- This is an overwrite action. The request body must include all desired field values, including any existing field values that should remain assigned to the entry. Field values that are not included in the request will be deleted from the entry. If the field value that is not included is part of a template, it will still be assigned (as required by the template), but its value will be reset.", - "operationId": "AssignFieldValues", + "summary": "Exports an entry.", + "description": "- Export an entry.\n- The export may time out if it takes longer than 60 seconds. This value is subject to change at anytime. Use the long operation asynchronous export if you run into this restriction.\n- Required OAuth scope: repository.Read", + "operationId": "ExportEntry", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -2033,7 +2098,7 @@ "name": "entryId", "in": "path", "required": true, - "description": "The entry ID of the entry that will have its fields updated.", + "description": "The ID of entry to export.", "schema": { "type": "integer", "format": "int32" @@ -2041,39 +2106,83 @@ "x-position": 2 }, { - "name": "culture", + "name": "pageRange", "in": "query", - "description": "An optional query parameter used to indicate the locale that should be used.\n The value should be a standard language tag. This may be used when setting field values with tokens.", + "description": "A comma-separated range of pages to include. Ex: 1,3,4 or 1-3,5-7,9. This value is ignored when exporting as Edoc.", "schema": { "type": "string", - "default": "", "nullable": true }, - "x-position": 4 + "x-position": 3 } ], "requestBody": { - "x-name": "fieldsToUpdate", - "description": "", + "x-name": "request", + "description": "The request body.", "content": { "application/json": { "schema": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/FieldToUpdate" + "$ref": "#/components/schemas/ExportEntryRequest" + }, + "examples": { + "1": { + "summary": "Export the image part of a Laserfiche Document", + "description": "The body of the export request includes:
  1. The audit event information to associate with the export operation.
  2. part: the part of the document to export. Options include: Image, Text, Edoc.
  3. imageOptions: The options applied when exporting as Image.
    • format: the image format to export as. Options include: MultiPageTIFF, SinglePageTIFF, PNG, PDF, JPEG. The default value is MultiPageTIFF. MultiPageTIFF format is a single multi-page TIFF file. SinglePageTIFF format is multiple single-page TIFF files (in a single zip file).
    • jpegCompressionLevel: the quality level for JPEG compression when exporting images. The value must be between 0 and 100 (inclusive). The default value is 70.
    • includeAnnotations: indicates if the annotations need to be included. The default value is true.
    • convertPdfAnnotations: indicates if the annotations on the image need to be converted to PDF annotations when exporting to PDF format. The default value is true. This option is only applicable when exporting to PDF format and includeAnnotations is true.
    • pagePrefix: the page prefix of the individual files, when exporting to multi-file format (e.g.zip). The value must have a length of atmost 10 characters and only valid characters that can be included in file names are allowed. The default value is \", Page \".
    • includeRedactions: indicates if redactions are included. The default value is true.
    • watermark: the watermark element added to the image. This includes the following properties:
      • text: the text of the watermark. The value must be a string with a length of atmost 100 characters and must not be all whitespace characters. Using emojis in the text is not supported.
      • position: the position of the watermark. The default value is DeadCenter. Assuming that the page is divided into a 3x3 grid, then position can be specified using the following values:
        • TopLeft, TopCenter, TopRight, MiddleLeft, DeadCenter, MiddleRight, BottomLeft, BottomCenter, BottomRight
      • rotationAngle: the rotation angle of the watermark. The value must be between 0 and 360 (inclusive). The default value is 0.
      • pageSpanPercentage: the percentage of the page that the watermark spans on. The value must be between 1 and 100 (inclusive). The default value is 50.
", + "value": { + "auditReasonId": 0, + "auditReasonComment": "", + "part": "Image", + "imageOptions": { + "format": "MultiPageTIFF", + "jpegCompressionLevel": 70, + "includeAnnotations": true, + "convertPdfAnnotations": true, + "pagePrefix": ", Page ", + "includeRedactions": true, + "watermark": { + "text": "", + "position": "DeadCenter", + "rotationAngle": 0, + "pageSpanPercentage": 50 + } + } + } + }, + "2": { + "summary": "Export the text part of a Laserfiche Document", + "description": "The body of the export request includes:
  1. The audit event information to associate with the export operation.
  2. part: the part of the document to export. Options include: Image, Text, Edoc.
  3. textOptions: The options applied when exporting as Text.
    • includeRedactions: indicates if redactions are included. The default value is true.
    • redactionCharacter: the character that replaces the original character in a redacted text. The value must be a string of length 1 and must not be a whitespace character. The default value is \"X\".
", + "value": { + "auditReasonId": 0, + "auditReasonComment": "", + "part": "Text", + "textOptions": { + "includeRedactions": true, + "redactionCharacter": "X" + } + } + }, + "3": { + "summary": "Export the edoc part of a Laserfiche Document", + "description": "The body of the export request includes:
  1. The audit event information to associate with the export operation.
  2. part: the part of the document to export. Options include: Image, Text, Edoc.
", + "value": { + "auditReasonId": 0, + "auditReasonComment": "", + "part": "Edoc" + } } } } }, - "x-position": 3 + "required": true, + "x-position": 4 }, "responses": { "200": { - "description": "Update field values successfully.", + "description": "A link to download the exported entry.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ODataValueOfIListOfFieldValue" + "$ref": "#/components/schemas/ExportEntryResponse" } } } @@ -2109,7 +2218,7 @@ } }, "404": { - "description": "Requested entry id not found.", + "description": "Request entry id not found.", "content": { "application/json": { "schema": { @@ -2147,21 +2256,135 @@ } } } + }, + "500": { + "description": "Export operation failed due to an internal server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } } } } }, - "/v1/Repositories/{repoId}/Entries/{entryId}/tags": { + "/v2/Repositories/{repositoryId}/Entries/ByPath": { "get": { "tags": [ "Entries" ], - "summary": "Returns the tags assigned to an entry.", - "description": "- Returns the tags assigned to an entry.\n- Provide an entry ID, and get a paged listing of tags assigned to that entry.\n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.", - "operationId": "GetTagsAssignedToEntry", + "summary": "Returns a single entry object using the entry path.", + "description": "- Returns a single entry object using the entry path.\n- Optional query parameter: fallbackToClosestAncestor. Use the fallbackToClosestAncestor query parameter to return the closest existing ancestor if the initial entry path is not found.\n- Required OAuth scope: repository.Read", + "operationId": "GetEntryByPath", + "parameters": [ + { + "name": "repositoryId", + "in": "path", + "required": true, + "description": "The requested repository ID.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "fullPath", + "in": "query", + "required": true, + "description": "The requested entry path.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "fallbackToClosestAncestor", + "in": "query", + "description": "An optional query parameter used to indicate whether or not the closest ancestor in the path should be returned if the initial entry path is not found. The default value is false.", + "schema": { + "type": "boolean", + "default": false + }, + "x-position": 3 + } + ], + "responses": { + "200": { + "description": "The found entry or ancestor entry.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetEntryByPathResponse" + } + } + } + }, + "400": { + "description": "Invalid or bad request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "401": { + "description": "Access token is invalid or expired.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "403": { + "description": "Access denied for the operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "404": { + "description": "Requested entry path not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "429": { + "description": "Rate limit is reached.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + } + } + } + }, + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Folder/Children": { + "get": { + "tags": [ + "Entries" + ], + "summary": "Returns the children entries of a folder.", + "description": "- Returns the children entries of a folder in the repository.\n- Provide an entry ID (must be a folder), and get a paged listing of entries in that folder. Used as a way of navigating through the repository.\n- Entries returned in the listing are not automatically converted to their subtype (Folder, Shortcut, Document), so clients who want model-specific information should request it via the GET entry by ID route.\n- Optional query parameters: groupByEntryType (bool). This query parameter decides if results are returned in groups based on their entry type. \n- Optionally returns field values for the entries in the folder. Each field name needs to be specified in the request. Maximum limit of 10 field names. If field values are requested, only the first value is returned if it is a multi value field. The remaining field values can be retrieved via the GET fields route. Null or Empty field values should not be used to determine if a field is assigned to the entry.\n- Default page size: 150. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. OData $OrderBy syntax should follow: \"PropertyName direction,PropertyName2 direction\". Sort order can be either value \"asc\" or \"desc\".\n- Required OAuth scope: repository.Read", + "operationId": "ListEntries", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -2174,13 +2397,48 @@ "name": "entryId", "in": "path", "required": true, - "description": "The requested entry ID.", + "description": "The folder ID.", "schema": { "type": "integer", "format": "int32" }, "x-position": 2 }, + { + "name": "groupByEntryType", + "in": "query", + "description": "Indicates if the result should be grouped by entry type or not. The default value is false.", + "schema": { + "type": "boolean", + "default": false + }, + "x-position": 3 + }, + { + "name": "fields", + "in": "query", + "style": "form", + "explode": true, + "description": "Optional array of field names. Field values corresponding to the given field names will be returned for each entry.", + "schema": { + "type": "array", + "nullable": true, + "items": { + "type": "string" + } + }, + "x-position": 4 + }, + { + "name": "formatFieldValues", + "in": "query", + "description": "Indicates if field values should be formatted. Only applicable if Fields are specified. The default value is false.", + "schema": { + "type": "boolean", + "default": false + }, + "x-position": 5 + }, { "name": "Prefer", "x-originalName": "prefer", @@ -2190,7 +2448,18 @@ "type": "string", "nullable": true }, - "x-position": 3 + "x-position": 6 + }, + { + "name": "culture", + "in": "query", + "description": "An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. The formatFieldValues query parameter must be set to true, otherwise culture will not be used for formatting.", + "schema": { + "type": "string", + "default": "", + "nullable": true + }, + "x-position": 7 }, { "name": "$select", @@ -2200,7 +2469,7 @@ "type": "string", "nullable": true }, - "x-position": 4 + "x-position": 8 }, { "name": "$orderby", @@ -2210,7 +2479,7 @@ "type": "string", "nullable": true }, - "x-position": 6 + "x-position": 10 }, { "name": "$top", @@ -2220,7 +2489,7 @@ "type": "integer", "format": "int32" }, - "x-position": 7 + "x-position": 11 }, { "name": "$skip", @@ -2230,7 +2499,7 @@ "type": "integer", "format": "int32" }, - "x-position": 8 + "x-position": 12 }, { "name": "$count", @@ -2239,16 +2508,16 @@ "schema": { "type": "boolean" }, - "x-position": 9 + "x-position": 13 } ], "responses": { "200": { - "description": "Get entry tags successfully.", + "description": "A collection of children entries of a folder.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ODataValueContextOfIListOfWTagInfo" + "$ref": "#/components/schemas/EntryCollectionResponse" } } } @@ -2305,16 +2574,16 @@ } } }, - "put": { + "post": { "tags": [ "Entries" ], - "summary": "Assigns tags to an entry.", - "description": "- Assign tags to an entry.\n- Provide an entry ID and a list of tags to assign to that entry.\n- This is an overwrite action. The request must include all tags to assign to the entry, including existing tags that should remain assigned to the entry.", - "operationId": "AssignTags", + "summary": "Creates a new child entry in a folder.", + "description": "- Create a new child entry in the designated folder.\n- Provide the parent folder ID, and based on the request body, create a folder/shortcut as a child entry of the designated folder.\n- Required OAuth scope: repository.Write", + "operationId": "CreateEntry", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -2327,33 +2596,66 @@ "name": "entryId", "in": "path", "required": true, - "description": "The requested entry ID.", + "description": "The folder ID that the entry will be created in.", "schema": { "type": "integer", "format": "int32" }, "x-position": 2 + }, + { + "name": "culture", + "in": "query", + "description": "An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag.", + "schema": { + "type": "string", + "default": "", + "nullable": true + }, + "x-position": 4 } ], "requestBody": { - "x-name": "tagsToAdd", - "description": "The tags to add.", + "x-name": "request", + "description": "The request body.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PutTagRequest" + "$ref": "#/components/schemas/CreateEntryRequest" + }, + "examples": { + "1": { + "summary": "Create a folder", + "description": "We can create a new folder with the given name.", + "value": { + "entryType": "Folder", + "name": "NewFolder", + "autoRename": false + } + }, + "2": { + "summary": "Create a shortcut", + "description": "We can create a new shortcut with the given name to the entry with the targetId.", + "value": { + "entryType": "Shortcut", + "name": "NewShortcut", + "autoRename": false, + "targetId": 123 + } + } } } }, + "required": true, "x-position": 3 }, "responses": { - "200": { - "description": "Assign tags to an entry successfully.", + "201": { + "description": "The created entry.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ODataValueOfIListOfWTagInfo" + "$ref": "#/components/schemas/Entry" } } } @@ -2389,7 +2691,7 @@ } }, "404": { - "description": "Request id not found.", + "description": "Request entry id not found.", "content": { "application/json": { "schema": { @@ -2398,8 +2700,8 @@ } } }, - "413": { - "description": "Request is too large.", + "409": { + "description": "Entry name conflicts.", "content": { "application/json": { "schema": { @@ -2408,8 +2710,8 @@ } } }, - "423": { - "description": "Entry is locked.", + "413": { + "description": "Request is too large.", "content": { "application/json": { "schema": { @@ -2431,20 +2733,20 @@ } } }, - "/v1/Repositories/{repoId}/Entries/{entryId}/links": { - "put": { + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Fields": { + "get": { "tags": [ "Entries" ], - "summary": "Assigns links to an entry.", - "description": "- Assign links to an entry.\n- Provide an entry ID and a list of links to assign to that entry.\n- This is an overwrite action. The request must include all links to assign to the entry, including existing links that should remain assigned to the entry.", - "operationId": "AssignEntryLinks", + "summary": "Returns the fields assigned to an entry.", + "description": "- Returns the fields assigned to an entry.\n- Provide an entry ID, and get a paged listing of all fields assigned to that entry.\n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.\n- Required OAuth scope: repository.Read", + "operationId": "ListFields", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, - "description": "The request repository ID.", + "description": "The requested repository ID.", "schema": { "type": "string" }, @@ -2460,29 +2762,213 @@ "format": "int32" }, "x-position": 2 + }, + { + "name": "Prefer", + "x-originalName": "prefer", + "in": "header", + "description": "An optional OData header. Can be used to set the maximum page size using odata.maxpagesize.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 3 + }, + { + "name": "formatFieldValues", + "in": "query", + "description": "An optional query parameter used to indicate if the field values should be formatted. The default value is false.", + "schema": { + "type": "boolean", + "default": false + }, + "x-position": 4 + }, + { + "name": "culture", + "in": "query", + "description": "An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. The formatFieldValues query parameter must be set to true, otherwise culture will not be used for formatting.", + "schema": { + "type": "string", + "default": "", + "nullable": true + }, + "x-position": 5 + }, + { + "name": "$select", + "in": "query", + "description": "Limits the properties returned in the result.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 6 + }, + { + "name": "$orderby", + "in": "query", + "description": "Specifies the order in which items are returned. The maximum number of expressions is 5.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 8 + }, + { + "name": "$top", + "in": "query", + "description": "Limits the number of items returned from a collection.", + "schema": { + "type": "integer", + "format": "int32" + }, + "x-position": 9 + }, + { + "name": "$skip", + "in": "query", + "description": "Excludes the specified number of items of the queried collection from the result.", + "schema": { + "type": "integer", + "format": "int32" + }, + "x-position": 10 + }, + { + "name": "$count", + "in": "query", + "description": "Indicates whether the total count of items within a collection are returned in the result.", + "schema": { + "type": "boolean" + }, + "x-position": 11 + } + ], + "responses": { + "200": { + "description": "A collection of fields assigned to the entry.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FieldCollectionResponse" + } + } + } + }, + "400": { + "description": "Invalid or bad request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "401": { + "description": "Access token is invalid or expired.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "403": { + "description": "Access denied for the operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "404": { + "description": "Request entry id not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "429": { + "description": "Rate limit is reached.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + } + } + }, + "put": { + "tags": [ + "Entries" + ], + "summary": "Updates the field values assigned to an entry.", + "description": "- Update the field values assigned to an entry.\n- Provide the new field values to assign to the entry, and remove/reset all previously assigned field values.\n- This is an overwrite action. The request body must include all desired field values, including any existing field values that should remain assigned to the entry. Field values that are not included in the request will be deleted from the entry. If the field value that is not included is part of a template, it will still be assigned (as required by the template), but its value will be reset.\n- Required OAuth scope: repository.Write", + "operationId": "SetFields", + "parameters": [ + { + "name": "repositoryId", + "in": "path", + "required": true, + "description": "The requested repository ID.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "entryId", + "in": "path", + "required": true, + "description": "The entry ID of the entry that will have its fields updated.", + "schema": { + "type": "integer", + "format": "int32" + }, + "x-position": 2 + }, + { + "name": "culture", + "in": "query", + "description": "An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. This may be used when setting field values with tokens.", + "schema": { + "type": "string", + "default": "", + "nullable": true + }, + "x-position": 4 } ], "requestBody": { - "x-name": "linksToAdd", + "x-name": "request", + "description": "The request body.", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PutLinksRequest" - } + "$ref": "#/components/schemas/SetFieldsRequest" } } }, + "required": true, "x-position": 3 }, "responses": { "200": { - "description": "Assign links to an entry successfully.", + "description": "A collection of fields assigned to the entry.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ODataValueOfIListOfWEntryLinkInfo" + "$ref": "#/components/schemas/FieldCollectionResponse" } } } @@ -2518,7 +3004,7 @@ } }, "404": { - "description": "Request entry id not found.", + "description": "Requested entry id not found.", "content": { "application/json": { "schema": { @@ -2558,17 +3044,19 @@ } } } - }, + } + }, + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Tags": { "get": { "tags": [ "Entries" ], - "summary": "Returns the links assigned to an entry.", - "description": "- Returns the links assigned to an entry.\n- Provide an entry ID, and get a paged listing of links assigned to that entry.\n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.", - "operationId": "GetLinkValuesFromEntry", + "summary": "Returns the tags assigned to an entry.", + "description": "- Returns the tags assigned to an entry.\n- Provide an entry ID, and get a paged listing of tags assigned to that entry.\n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.\n- Required OAuth scope: repository.Read", + "operationId": "ListTags", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -2592,7 +3080,7 @@ "name": "Prefer", "x-originalName": "prefer", "in": "header", - "description": "An optional odata header. Can be used to set the maximum page size using odata.maxpagesize.", + "description": "An optional OData header. Can be used to set the maximum page size using odata.maxpagesize.", "schema": { "type": "string", "nullable": true @@ -2651,11 +3139,11 @@ ], "responses": { "200": { - "description": "Get links successfully.", + "description": "A collection of tags assigned to the entry.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ODataValueContextOfIListOfWEntryLinkInfo" + "$ref": "#/components/schemas/TagCollectionResponse" } } } @@ -2711,19 +3199,17 @@ } } } - } - }, - "/v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Folder/CopyAsync": { - "post": { + }, + "put": { "tags": [ "Entries" ], - "summary": "Copies an entry into a folder asynchronously.", - "description": "- Copy a new child entry in the designated folder async, and potentially return an operationToken.\n- Provide the parent folder ID, and copy an entry as a child of the designated folder.\n- Optional parameter: autoRename (default false). If an entry already exists with the given name, the entry will be automatically renamed. \n- The status of the operation can be checked via the Tasks/{operationToken} route.\n- Token substitution in the name of the copied entry is not supported.", - "operationId": "CopyEntryAsync", + "summary": "Assigns tags to an entry.", + "description": "- Assign tags to an entry.\n- Provide an entry ID and a list of tags to assign to that entry.\n- This is an overwrite action. The request must include all tags to assign to the entry, including existing tags that should remain assigned to the entry.\n- Required OAuth scope: repository.Write", + "operationId": "SetTags", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -2736,63 +3222,34 @@ "name": "entryId", "in": "path", "required": true, - "description": "The folder ID that the entry will be created in.", + "description": "The requested entry ID.", "schema": { "type": "integer", "format": "int32" }, "x-position": 2 - }, - { - "name": "autoRename", - "in": "query", - "description": "An optional query parameter used to indicate if the new entry should be automatically\n renamed if an entry already exists with the given name in the folder. The default value is false.", - "schema": { - "type": "boolean" - }, - "x-position": 4 - }, - { - "name": "culture", - "in": "query", - "description": "An optional query parameter used to indicate the locale that should be used.\n The value should be a standard language tag.", - "schema": { - "type": "string", - "default": "", - "nullable": true - }, - "x-position": 5 } ], "requestBody": { "x-name": "request", - "description": "Copy entry request.", + "description": "The tags to add.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CopyAsyncRequest" - }, - "examples": { - "1": { - "summary": "Copy an entry", - "description": "We can copy an entry (marked by sourceId property) to a destination (marked in URL).", - "value": { - "sourceId": 123, - "name": "CopiedEntry" - } - } + "$ref": "#/components/schemas/SetTagsRequest" } } }, + "required": true, "x-position": 3 }, "responses": { - "201": { - "description": "Copy entry operation is started successfully.", + "200": { + "description": "A collection of tags assigned to the entry.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AcceptedOperation" + "$ref": "#/components/schemas/TagCollectionResponse" } } } @@ -2828,7 +3285,7 @@ } }, "404": { - "description": "Not found.", + "description": "Request id not found.", "content": { "application/json": { "schema": { @@ -2847,8 +3304,18 @@ } } }, + "423": { + "description": "Entry is locked.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, "429": { - "description": "Operation limit or request limit reached.", + "description": "Rate limit is reached.", "content": { "application/json": { "schema": { @@ -2860,20 +3327,20 @@ } } }, - "/v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Document/edoc": { - "delete": { + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Links": { + "put": { "tags": [ "Entries" ], - "summary": "Deletes the edoc associated with an entry.", - "description": "- Delete the edoc associated with the provided entry ID.", - "operationId": "DeleteDocument", + "summary": "Assigns links to an entry.", + "description": "- Assign links to an entry.\n- Provide an entry ID and a list of links to assign to that entry.\n- This is an overwrite action. The request must include all links to assign to the entry, including existing links that should remain assigned to the entry.\n- Required OAuth scope: repository.Write", + "operationId": "SetLinks", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, - "description": "The requested repository ID.", + "description": "The request repository ID.", "schema": { "type": "string" }, @@ -2883,7 +3350,7 @@ "name": "entryId", "in": "path", "required": true, - "description": "The requested document ID.", + "description": "The requested entry ID.", "schema": { "type": "integer", "format": "int32" @@ -2891,13 +3358,26 @@ "x-position": 2 } ], + "requestBody": { + "x-name": "request", + "description": "The request body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetLinksRequest" + } + } + }, + "required": true, + "x-position": 3 + }, "responses": { "200": { - "description": "Deleted edoc successfully.", + "description": "A collection of links assigned to the entry.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ODataValueOfBoolean" + "$ref": "#/components/schemas/LinkCollectionResponse" } } } @@ -2942,6 +3422,16 @@ } } }, + "413": { + "description": "Request is too large.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, "423": { "description": "Entry is locked.", "content": { @@ -2964,16 +3454,16 @@ } } }, - "head": { + "get": { "tags": [ "Entries" ], - "summary": "Returns information about the edoc content of an entry.", - "description": "- Returns information about the edoc content of an entry, without downloading the edoc in its entirety.\n- Provide an entry ID, and get back the Content-Type and Content-Length in the response headers.\n- This route does not provide a way to download the actual edoc. Instead, it just gives metadata information about the edoc associated with the entry.\n- If an error occurs, the error message can be found in the X-APIServer-Error HTTP response header.", - "operationId": "GetDocumentContentType", + "summary": "Returns the links assigned to an entry.", + "description": "- Returns the links assigned to an entry.\n- Provide an entry ID, and get a paged listing of links assigned to that entry.\n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.\n- Required OAuth scope: repository.Read", + "operationId": "ListLinks", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -2986,48 +3476,149 @@ "name": "entryId", "in": "path", "required": true, - "description": "The requested document ID.", + "description": "The requested entry ID.", "schema": { "type": "integer", "format": "int32" }, "x-position": 2 + }, + { + "name": "Prefer", + "x-originalName": "prefer", + "in": "header", + "description": "An optional odata header. Can be used to set the maximum page size using odata.maxpagesize.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 3 + }, + { + "name": "$select", + "in": "query", + "description": "Limits the properties returned in the result.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 4 + }, + { + "name": "$orderby", + "in": "query", + "description": "Specifies the order in which items are returned. The maximum number of expressions is 5.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 6 + }, + { + "name": "$top", + "in": "query", + "description": "Limits the number of items returned from a collection.", + "schema": { + "type": "integer", + "format": "int32" + }, + "x-position": 7 + }, + { + "name": "$skip", + "in": "query", + "description": "Excludes the specified number of items of the queried collection from the result.", + "schema": { + "type": "integer", + "format": "int32" + }, + "x-position": 8 + }, + { + "name": "$count", + "in": "query", + "description": "Indicates whether the total count of items within a collection are returned in the result.", + "schema": { + "type": "boolean" + }, + "x-position": 9 } ], "responses": { "200": { - "description": "Get edoc info successfully." + "description": "A collection of links assigned to the entry.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LinkCollectionResponse" + } + } + } }, "400": { - "description": "Invalid or bad request." + "description": "Invalid or bad request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } }, "401": { - "description": "Access token is invalid or expired." + "description": "Access token is invalid or expired.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } }, "403": { - "description": "Access denied for the operation." + "description": "Access denied for the operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } }, "404": { - "description": "Request entry id not found." - }, - "423": { - "description": "Entry is locked." + "description": "Request entry id not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } }, "429": { - "description": "Rate limit is reached." + "description": "Rate limit is reached.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } } } - }, - "get": { + } + }, + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Folder/Copy": { + "post": { "tags": [ "Entries" ], - "summary": "Returns an entry's edoc resource in a stream format.", - "description": "- Returns an entry's edoc resource in a stream format.\n- Provide an entry ID, and get the edoc resource as part of the response content.\n- Optional header: Range. Use the Range header (single range with byte unit) to retrieve partial content of the edoc, rather than the entire edoc.", - "operationId": "ExportDocument", + "summary": "Copies a new child entry in a folder.", + "description": "- Copy a new child entry in the designated folder.\n- Provide the parent folder ID, and based on the request body, copy a child entry of the designated folder.\n- Required OAuth scope: repository.Write", + "operationId": "CopyEntry", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -3040,7 +3631,7 @@ "name": "entryId", "in": "path", "required": true, - "description": "The requested document ID.", + "description": "The folder ID that the entry will be created in.", "schema": { "type": "integer", "format": "int32" @@ -3048,36 +3639,48 @@ "x-position": 2 }, { - "name": "Range", - "x-originalName": "range", - "in": "header", - "description": "An optional header used to retrieve partial content of the edoc. Only supports single\n range with byte unit.", + "name": "culture", + "in": "query", + "description": "An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag.", "schema": { "type": "string", + "default": "", "nullable": true }, - "x-position": 3 + "x-position": 4 } ], - "responses": { - "200": { - "description": "Get edoc successfully.", - "content": { - "application/octet-stream": { - "schema": { - "type": "string", - "format": "binary" + "requestBody": { + "x-name": "request", + "description": "The request body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CopyEntryRequest" + }, + "examples": { + "1": { + "summary": "Copy an entry", + "description": "We can copy an entry (marked by sourceId property) to a destination (marked in URL).", + "value": { + "sourceId": 123, + "name": "CopiedEntry", + "autoRename": false + } } } } }, - "206": { - "description": "Get edoc range successfully.", + "required": true, + "x-position": 3 + }, + "responses": { + "201": { + "description": "The copied entry.", "content": { - "application/octet-stream": { + "application/json": { "schema": { - "type": "string", - "format": "binary" + "$ref": "#/components/schemas/Entry" } } } @@ -3113,7 +3716,7 @@ } }, "404": { - "description": "Request entry id not found.", + "description": "Request entry ID not found.", "content": { "application/json": { "schema": { @@ -3122,8 +3725,18 @@ } } }, - "423": { - "description": "Entry is locked.", + "409": { + "description": "Entry name conflicts.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "413": { + "description": "Request is too large.", "content": { "application/json": { "schema": { @@ -3145,17 +3758,17 @@ } } }, - "/v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Document/pages": { + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Document/Edoc": { "delete": { "tags": [ "Entries" ], - "summary": "Deletes the pages associated with an entry.", - "description": "- Delete the pages associated with the provided entry ID. If no pageRange is specified, all pages will be deleted.\n- Optional parameter: pageRange (default empty). The value should be a comma-seperated string which contains non-overlapping single values, or page ranges. Ex: \"1,2,3\", \"1-3,5\", \"2-7,10-12.\"", - "operationId": "DeletePages", + "summary": "Deletes the edoc associated with an entry.", + "description": "- Delete the edoc associated with the provided entry ID.\n- Required OAuth scope: repository.Write ", + "operationId": "DeleteElectronicDocument", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -3174,25 +3787,15 @@ "format": "int32" }, "x-position": 2 - }, - { - "name": "pageRange", - "in": "query", - "description": "The pages to be deleted.", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 3 } ], "responses": { "200": { - "description": "Deleted pages successfully.", + "description": "The updated entry.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ODataValueOfBoolean" + "$ref": "#/components/schemas/Entry" } } } @@ -3260,17 +3863,17 @@ } } }, - "/v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Document/GetEdocWithAuditReason": { - "post": { + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Document/Pages": { + "delete": { "tags": [ "Entries" ], - "summary": "Returns an entry's edoc resource in a stream format, including an audit reason.", - "description": "- Returns an entry's edoc resource in a stream format while including an audit reason.\n- Provide an entry ID and audit reason/comment in the request body, and get the edoc resource as part of the response content.\n- Optional header: Range. Use the Range header (single range with byte unit) to retrieve partial content of the edoc, rather than the entire edoc. This route is identical to the GET edoc route, but allows clients to include an audit reason when downloading the edoc.", - "operationId": "ExportDocumentWithAuditReason", + "summary": "Deletes the pages associated with an entry.", + "description": "- Delete the pages associated with the provided entry ID. If no pageRange is specified, all pages will be deleted.\n- Optional parameter: pageRange (default empty). The value should be a comma-separated string which contains non-overlapping single values, or page ranges. Ex: \"1,2,3\", \"1-3,5\", \"2-7,10-12.\"\n- Required OAuth scope: repository.Write", + "operationId": "DeletePages", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -3291,47 +3894,23 @@ "x-position": 2 }, { - "name": "Range", - "x-originalName": "range", - "in": "header", - "description": "An optional header used to retrieve partial content of the edoc. Only supports single\n range with byte unit.", + "name": "pageRange", + "in": "query", + "description": "The pages to be deleted.", "schema": { "type": "string", "nullable": true }, - "x-position": 4 + "x-position": 3 } ], - "requestBody": { - "x-name": "request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetEdocWithAuditReasonRequest" - } - } - }, - "x-position": 3 - }, "responses": { "200": { - "description": "Get edoc successfully.", - "content": { - "application/octet-stream": { - "schema": { - "type": "string", - "format": "binary" - } - } - } - }, - "206": { - "description": "Get edoc range successfully.", + "description": "The updated entry.", "content": { - "application/octet-stream": { + "application/json": { "schema": { - "type": "string", - "format": "binary" + "$ref": "#/components/schemas/Entry" } } } @@ -3376,16 +3955,6 @@ } } }, - "413": { - "description": "Request is too large.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, "423": { "description": "Entry is locked.", "content": { @@ -3409,17 +3978,17 @@ } } }, - "/v1/Repositories/{repoId}/Entries/{entryId}/fields/GetDynamicFieldLogicValue": { + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Fields/GetDynamicFieldLogicValue": { "post": { "tags": [ "Entries" ], "summary": "Returns the dynamic field logic values assigned to an entry.", - "description": "- Returns dynamic field logic values with the current values of the fields in the template.\n- Provide an entry ID and field values in the JSON body to get dynamic field logic values.\n Independent and non-dynamic fields in the request body will be ignored, and only related dynamic field logic values for the assigned template will be returned.", - "operationId": "GetDynamicFieldValues", + "description": "- Returns dynamic field logic values with the current values of the fields in the template.\n- Provide an entry ID and field values in the JSON body to get dynamic field logic values.\n- Independent and non-dynamic fields in the request body will be ignored, and only related dynamic field logic values for the assigned template will be returned.\n- Required OAuth scope: repository.Read", + "operationId": "ListDynamicFieldValues", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -3442,18 +4011,20 @@ ], "requestBody": { "x-name": "request", + "description": "The request body.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GetDynamicFieldLogicValueRequest" + "$ref": "#/components/schemas/ListDynamicFieldValuesRequest" } } }, + "required": true, "x-position": 3 }, "responses": { "200": { - "description": "Get dynamic field logic values successfully.", + "description": "A collection of dynamic field values.", "content": { "application/json": { "schema": { @@ -3531,17 +4102,17 @@ } } }, - "/v1/Repositories/{repoId}/Entries/{entryId}/template": { + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Template": { "delete": { "tags": [ "Entries" ], "summary": "Removes the currently assigned template from an entry.", - "description": "- Remove the currently assigned template from the specified entry.\n- Provide an entry ID to clear template value on.\n- If the entry does not have a template assigned, no change will be made.", - "operationId": "DeleteAssignedTemplate", + "description": "- Remove the currently assigned template from the specified entry.\n- Provide an entry ID to clear template value on.\n- If the entry does not have a template assigned, no change will be made.\n- Required OAuth scope: repository.Write", + "operationId": "RemoveTemplate", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -3564,7 +4135,7 @@ ], "responses": { "200": { - "description": "Remove the currently assigned template successfully.", + "description": "The updated entry.", "content": { "application/json": { "schema": { @@ -3640,11 +4211,11 @@ "Entries" ], "summary": "Assigns a template to an entry.", - "description": "- Assign a template to an entry.\n- Provide an entry ID, template name, and a list of template fields to assign to that entry.\n- Only template values will be modified. Any existing independent fields on the entry will not be modified, nor will they be added if included in the request. The only modification to fields will only occur on templated fields. If the previously assigned template includes common template fields as the newly assigned template, the common field values will not be modified.", - "operationId": "WriteTemplateValueToEntry", + "description": "- Assign a template to an entry.\n- Provide an entry ID, template name, and a list of template fields to assign to that entry.\n- Only template values will be modified. Any existing independent fields on the entry will not be modified, nor will they be added if included in the request. The only modification to fields will only occur on templated fields. If the previously assigned template includes common template fields as the newly assigned template, the common field values will not be modified.\n- Required OAuth scope: repository.Write", + "operationId": "SetTemplate", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -3667,7 +4238,7 @@ { "name": "culture", "in": "query", - "description": "An optional query parameter used to indicate the locale that should be used.\n The value should be a standard language tag. This may be used when setting field values with tokens.", + "description": "An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. This may be used when setting field values with tokens.", "schema": { "type": "string", "default": "", @@ -3682,7 +4253,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PutTemplateRequest" + "$ref": "#/components/schemas/SetTemplateRequest" }, "examples": { "1": { @@ -3697,42 +4268,33 @@ "description": "If the template contains fields Today and Address, we can set the template to an entry using the above request with specified fields values.", "value": { "templateName": "sample template 2", - "fields": { - "Today": { + "fields": [ + { + "name": "Today", "values": [ - { - "value": "2020-02-18T00:00:00", - "position": 1 - } + "2020-02-18T00:00:00" ] }, - "Address": { + { + "name": "Address", "values": [ - { - "value": "3545 Long Beach Blvd. Long Beach CA, 90807 U.S.A.", - "position": 1 - }, - { - "value": "306, 1 Valleybrook Drive North York, Toronto, Ontario M3B2S7 CANADA", - "position": 2 - }, - { - "value": "2307, Westlands Centre 20 Westlands Road Quarry Bay, Hong Kong", - "position": 3 - } + "3545 Long Beach Blvd. Long Beach CA, 90807 U.S.A.", + "306, 1 Valleybrook Drive North York, Toronto, Ontario M3B2S7 CANADA", + "2307, Westlands Centre 20 Westlands Road Quarry Bay, Hong Kong" ] } - } + ] } } } } }, + "required": true, "x-position": 3 }, "responses": { "200": { - "description": "Assign a template successfully.", + "description": "The updated entry.", "content": { "application/json": { "schema": { @@ -3814,24 +4376,21 @@ } } }, - "/v1/Repositories": { + "/v2/Repositories": { "get": { "tags": [ "Repositories" ], "summary": "Returns the list of repositories accessible to the user.", - "description": "- Returns the repository resource list that current user has access to.", - "operationId": "GetRepositoryList", + "description": "- Returns the repository resource list that current user has access to.\n- Required OAuth scope: repository.Read", + "operationId": "ListRepositories", "responses": { "200": { - "description": "Get the respository resource list successfully.", + "description": "A collection of respositories.", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RepositoryInfo" - } + "$ref": "#/components/schemas/RepositoryCollectionResponse" } } } @@ -3879,101 +4438,17 @@ } } }, - "/v1/Repositories/{repoId}/AuditReasons": { - "get": { + "/v2/Repositories/{repositoryId}/Searches/SearchAsync": { + "post": { "tags": [ - "AuditReasons" + "Searches" ], - "summary": "Returns the audit reasons associated with the authenticated user.", - "description": "- Returns the audit reasons associated with the authenticated user. Inherited audit reasons are included.\n- Only includes audit reasons associated with available API functionalities, like delete entry and export document.\n- If the authenticated user does not have the appropriate Laserfiche feature right, the audit reasons associated with that feature right will not be included.", - "operationId": "GetAuditReasons", + "summary": "Starts an asynchronous search task.", + "description": "- Runs a search operation on the repository.\n- The status for search operations must be checked via the Tasks route.\n- Optional body parameters: FuzzyType: (default none), which can be used to determine what is considered a match by number of letters or percentage. FuzzyFactor: integer value that determines the degree to which a search will be considered a match (integer value for NumberOfLetters, or int value representing a percentage).\n- Required OAuth scope: repository.Read", + "operationId": "StartSearchEntry", "parameters": [ { - "name": "repoId", - "in": "path", - "required": true, - "description": "The requested repository ID.", - "schema": { - "type": "string" - }, - "x-position": 1 - } - ], - "responses": { - "200": { - "description": "Get audit reasons successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AuditReasons" - } - } - } - }, - "400": { - "description": "Invalid or bad request.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "401": { - "description": "Access token is invalid or expired.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "403": { - "description": "Access denied for the operation.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "Not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "429": { - "description": "Rate limit is reached.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - } - }, - "/v1/Repositories/{repoId}/Searches": { - "post": { - "tags": [ - "Searches" - ], - "summary": "Runs a search in the specified repository.", - "description": "- Runs a search operation on the repository.\n- Optional body parameters: FuzzyType: (default none), which can be used to determine what is considered a match by number of letters or percentage. FuzzyFactor: integer value that determines the degree to which a search will be considered a match (integer value for NumberOfLetters, or int value representing a percentage). The status for search operations must be checked via the Search specific status checking route. ", - "operationId": "CreateSearchOperation", - "parameters": [ - { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -3989,7 +4464,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AdvancedSearchRequest" + "$ref": "#/components/schemas/StartSearchEntryRequest" }, "examples": { "1": { @@ -4013,15 +4488,16 @@ } } }, + "required": true, "x-position": 2 }, "responses": { - "201": { - "description": "Search operation start successfully.", + "202": { + "description": "A long operation task id.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AcceptedOperation" + "$ref": "#/components/schemas/StartTaskResponse" } } } @@ -4057,7 +4533,7 @@ } }, "404": { - "description": "Not found.", + "description": "Requested repository not found.", "content": { "application/json": { "schema": { @@ -4089,17 +4565,17 @@ } } }, - "/v1/Repositories/{repoId}/Searches/{searchToken}": { + "/v2/Repositories/{repositoryId}/Searches/{taskId}/Results": { "get": { "tags": [ "Searches" ], - "summary": "Returns the status of a search operation.", - "description": "- Returns search status.\n- Provide a token (returned in the create search asynchronous route), and get the search status, progress, and any errors that may have occurred. When the search is completed, the Location header can be inspected as a link to the search results.\n- OperationStatus can be one of the following : NotStarted, InProgress, Completed, Failed, or Canceled.", - "operationId": "GetSearchStatus", + "summary": "Returns the results listing associated with a search task.", + "description": "- Returns a search result listing if the search is completed.\n- Search results expire after 5 minutes, but can be refreshed by retrieving the results again.\n- Optional query parameter: groupByOrderType (default false). This query parameter decides whether or not results are returned in groups based on their entry type.\n- Optional query parameter: refresh (default false). If the search listing should be refreshed to show updated values.\n- Optionally returns field values for the entries in the folder. Each field name needs to be specified in the request. Maximum limit of 10 field names. If field values are requested, only the first value is returned if it is a multi value field. The remaining field values can be retrieved via the GET fields route. Null or Empty field values should not be used to determine if a field is assigned to the entry.\n- Default page size: 150. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. OData $OrderBy syntax should follow: \"PropertyName direction,PropertyName2 direction\". sort order can be either \"asc\" or \"desc\".\n- Required OAuth scope: repository.Read", + "operationId": "ListSearchResults", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -4109,43 +4585,139 @@ "x-position": 1 }, { - "name": "searchToken", + "name": "taskId", "in": "path", "required": true, - "description": "The requested searchToken.", + "description": "The requested task ID.", "schema": { "type": "string" }, "x-position": 2 + }, + { + "name": "groupByEntryType", + "in": "query", + "description": "Indicates if the result should be grouped by entry type or not. The default value is false.", + "schema": { + "type": "boolean", + "default": false + }, + "x-position": 3 + }, + { + "name": "refresh", + "in": "query", + "description": "Indicates if the search listing should be refreshed to show updated values. The default value is false.", + "schema": { + "type": "boolean", + "default": false + }, + "x-position": 4 + }, + { + "name": "fields", + "in": "query", + "style": "form", + "explode": true, + "description": "Optional array of field names. Field values corresponding to the given field names will be returned for each search result. ", + "schema": { + "type": "array", + "nullable": true, + "items": { + "type": "string" + } + }, + "x-position": 5 + }, + { + "name": "formatFieldValues", + "in": "query", + "description": "Indicates if field values should be formatted. Only applicable if Fields are specified. The default value is false.", + "schema": { + "type": "boolean", + "default": false + }, + "x-position": 6 + }, + { + "name": "Prefer", + "x-originalName": "prefer", + "in": "header", + "description": "An optional odata header. Can be used to set the maximum page size using odata.maxpagesize.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 7 + }, + { + "name": "culture", + "in": "query", + "description": "An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. The formatFieldValues query parameter must be set to true, otherwise culture will not be used for formatting.", + "schema": { + "type": "string", + "default": "", + "nullable": true + }, + "x-position": 8 + }, + { + "name": "$select", + "in": "query", + "description": "Limits the properties returned in the result.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 9 + }, + { + "name": "$orderby", + "in": "query", + "description": "Specifies the order in which items are returned. The maximum number of expressions is 5.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 11 + }, + { + "name": "$top", + "in": "query", + "description": "Limits the number of items returned from a collection.", + "schema": { + "type": "integer", + "format": "int32" + }, + "x-position": 12 + }, + { + "name": "$skip", + "in": "query", + "description": "Excludes the specified number of items of the queried collection from the result.", + "schema": { + "type": "integer", + "format": "int32" + }, + "x-position": 13 + }, + { + "name": "$count", + "in": "query", + "description": "Indicates whether the total count of items within a collection are returned in the result.", + "schema": { + "type": "boolean" + }, + "x-position": 14 } ], "responses": { "200": { - "description": "Search has failed. Check the errors property to find out why.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OperationProgress" - } - } - } - }, - "201": { - "description": "Search is completed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OperationProgress" - } - } - } - }, - "202": { - "description": "Search is still in progress or not started.", + "description": "A collection of entry search results.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/OperationProgress" + "$ref": "#/components/schemas/EntryCollectionResponse" } } } @@ -4181,7 +4753,7 @@ } }, "404": { - "description": "Request search token not found.", + "description": "Request taskId not found.", "content": { "application/json": { "schema": { @@ -4201,17 +4773,19 @@ } } } - }, - "delete": { + } + }, + "/v2/Repositories/{repositoryId}/Searches/{taskId}/Results/{rowNumber}/ContextHits": { + "get": { "tags": [ "Searches" ], - "summary": "Cancels or closes a search operation.", - "description": "- Cancels a currently running search.\n- Closes a completed search.", - "operationId": "CancelOrCloseSearch", + "summary": "Returns the context hits associated with a search result entry.", + "description": "- Returns the context hits associated with a search result entry.\n- Given a taskId, and rowNumber associated with a search entry in the listing, return the context hits for that entry.\n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.\n- Required OAuth scope: repository.Read", + "operationId": "ListSearchContextHits", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -4221,326 +4795,25 @@ "x-position": 1 }, { - "name": "searchToken", + "name": "taskId", "in": "path", "required": true, - "description": "The requested searchToken.", + "description": "The requested task ID.", "schema": { "type": "string" }, "x-position": 2 - } - ], - "responses": { - "200": { - "description": "Cancel or closed search successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ODataValueOfBoolean" - } - } - } - }, - "400": { - "description": "Invalid or bad request.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } }, - "401": { - "description": "Access token is invalid or expired.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "403": { - "description": "Access denied for the operation.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "Request search token not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "429": { - "description": "Rate limit is reached.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - } - }, - "/v1/Repositories/{repoId}/Searches/{searchToken}/Results": { - "get": { - "tags": [ - "Searches" - ], - "summary": "Returns the results listing associated with a search operation.", - "description": "- Returns a search result listing if the search is completed.\n- Optional query parameter: groupByOrderType (default false). This query parameter decides whether or not results are returned in groups based on their entry type.\n- Optional query parameter: refresh (default false). If the search listing should be refreshed to show updated values.\n- Default page size: 150. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. OData $OrderBy syntax should follow: \"PropertyName direction,PropertyName2 direction\". sort order can be either \"asc\" or \"desc\". Search results expire after 5 minutes, but can be refreshed by retrieving the results again.\n- Optionally returns field values for the entries in the search result listing. Each field name needs to be specified in the request. Maximum limit of 10 field names.\n- If field values are requested, only the first value is returned if it is a multi value field.\n- Null or Empty field values should not be used to determine if a field is assigned to the entry.", - "operationId": "GetSearchResults", - "parameters": [ - { - "name": "repoId", - "in": "path", - "required": true, - "description": "The requested repository ID.", - "schema": { - "type": "string" - }, - "x-position": 1 - }, - { - "name": "searchToken", - "in": "path", - "required": true, - "description": "The requested searchToken.", - "schema": { - "type": "string" - }, - "x-position": 2 - }, - { - "name": "groupByEntryType", - "in": "query", - "description": "An optional query parameter used to indicate if the result should be grouped by entry type or not.", - "schema": { - "type": "boolean" - }, - "x-position": 3 - }, - { - "name": "refresh", - "in": "query", - "description": "If the search listing should be refreshed to show updated values.", - "schema": { - "type": "boolean" - }, - "x-position": 4 - }, - { - "name": "fields", - "in": "query", - "style": "form", - "explode": true, - "description": "Optional array of field names. Field values corresponding to the given field names will be returned for each search result. ", - "schema": { - "type": "array", - "nullable": true, - "items": { - "type": "string" - } - }, - "x-position": 5 - }, - { - "name": "formatFields", - "in": "query", - "description": "Boolean for if field values should be formatted. Only applicable if Fields are specified.", - "schema": { - "type": "boolean" - }, - "x-position": 6 - }, - { - "name": "Prefer", - "x-originalName": "prefer", - "in": "header", - "description": "An optional odata header. Can be used to set the maximum page size using odata.maxpagesize.", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 7 - }, - { - "name": "culture", - "in": "query", - "description": "An optional query parameter used to indicate the locale that should be used for formatting.\n The value should be a standard language tag. The formatFields query parameter must be set to true, otherwise\n culture will not be used for formatting.", - "schema": { - "type": "string", - "default": "", - "nullable": true - }, - "x-position": 8 - }, - { - "name": "$select", - "in": "query", - "description": "Limits the properties returned in the result.", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 9 - }, - { - "name": "$orderby", - "in": "query", - "description": "Specifies the order in which items are returned. The maximum number of expressions is 5.", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 11 - }, - { - "name": "$top", - "in": "query", - "description": "Limits the number of items returned from a collection.", - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 12 - }, - { - "name": "$skip", - "in": "query", - "description": "Excludes the specified number of items of the queried collection from the result.", - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 13 - }, - { - "name": "$count", - "in": "query", - "description": "Indicates whether the total count of items within a collection are returned in the result.", - "schema": { - "type": "boolean" - }, - "x-position": 14 - } - ], - "responses": { - "200": { - "description": "Get search result successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ODataValueContextOfIListOfEntry" - } - } - } - }, - "400": { - "description": "Invalid or bad request.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "401": { - "description": "Access token is invalid or expired.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "403": { - "description": "Access denied for the operation.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "Request search token not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "429": { - "description": "Rate limit is reached.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - } - }, - "/v1/Repositories/{repoId}/Searches/{searchToken}/Results/{rowNumber}/ContextHits": { - "get": { - "tags": [ - "Searches" - ], - "summary": "Returns the context hits associated with a search result entry.", - "description": "- Returns the context hits associated with a search result entry.\n- Given a searchToken, and rowNumber associated with a search entry in the listing, return the context hits for that entry.\n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.", - "operationId": "GetSearchContextHits", - "parameters": [ - { - "name": "repoId", - "in": "path", - "required": true, - "description": "The requested repository ID.", - "schema": { - "type": "string" - }, - "x-position": 1 - }, - { - "name": "searchToken", - "in": "path", - "required": true, - "description": "The requested searchToken.", - "schema": { - "type": "string" - }, - "x-position": 2 - }, - { - "name": "rowNumber", - "in": "path", - "required": true, - "description": "The search result listing row number to get context hits for.", - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 3 + { + "name": "rowNumber", + "in": "path", + "required": true, + "description": "The search result listing row number to get context hits for.", + "schema": { + "type": "integer", + "format": "int32" + }, + "x-position": 3 }, { "name": "Prefer", @@ -4605,11 +4878,11 @@ ], "responses": { "200": { - "description": "Get search context hits successfully.", + "description": "A collection of context hits for a search result.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ODataValueContextOfIListOfContextHit" + "$ref": "#/components/schemas/SearchContextHitCollectionResponse" } } } @@ -4645,7 +4918,7 @@ } }, "404": { - "description": "Request search token not found.", + "description": "Request taskId not found.", "content": { "application/json": { "schema": { @@ -4667,17 +4940,17 @@ } } }, - "/v1/Repositories/{repoId}/SimpleSearches": { + "/v2/Repositories/{repositoryId}/SimpleSearches": { "post": { "tags": [ "SimpleSearches" ], "summary": "Runs a \"simple\" search operation.", - "description": "- Runs a \"simple\" search operation on the repository.\n- Returns a truncated search result listing.\n- Search result listing may be truncated, depending on number of results. Additionally, searches may time out if they take too long. Use the other search route to run full searches.\n- Optionally returns field values for the entries in the search result listing. Each field name needs to be specified in the request. Maximum limit of 10 field names.\n- If field values are requested, only the first value is returned if it is a multi value field.\n- Null or Empty field values should not be used to determine if a field is assigned to the entry.", - "operationId": "CreateSimpleSearchOperation", + "description": "- Runs a \"simple\" search operation on the repository.\n- Returns a truncated search result listing.\n- Search result listing may be truncated, depending on number of results. Additionally, searches may time out if they take too long. Use the other search route to run full searches.\n- Optionally returns field values for the entries in the folder. Each field name needs to be specified in the request. Maximum limit of 10 field names. If field values are requested, only the first value is returned if it is a multi value field. The remaining field values can be retrieved via the GET fields route. Null or Empty field values should not be used to determine if a field is assigned to the entry.\n- Required OAuth scope: repository.Read", + "operationId": "SearchEntry", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -4702,18 +4975,19 @@ "x-position": 2 }, { - "name": "formatFields", + "name": "formatFieldValues", "in": "query", - "description": "Boolean for if field values should be formatted. Only applicable if Fields are specified.", + "description": "Indicates if field values should be formatted. Only applicable if Fields are specified. The default value is false.", "schema": { - "type": "boolean" + "type": "boolean", + "default": false }, "x-position": 3 }, { "name": "culture", "in": "query", - "description": "An optional query parameter used to indicate the locale that should be used for formatting.\n The value should be a standard language tag. The formatFields query parameter must be set to true, otherwise\n culture will not be used for formatting.", + "description": "An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. The formatFieldValues query parameter must be set to true, otherwise culture will not be used for formatting.", "schema": { "type": "string", "default": "", @@ -4752,7 +5026,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SimpleSearchRequest" + "$ref": "#/components/schemas/SearchEntryRequest" }, "examples": { "1": { @@ -4765,28 +5039,26 @@ } } }, + "required": true, "x-position": 4 }, "responses": { "200": { - "description": "Simple search run successfully.", + "description": "A collection of entry search results.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ODataValueContextOfIListOfEntry" + "$ref": "#/components/schemas/EntryCollectionResponse" } } } }, - "204": { - "description": "No search results found." - }, "206": { - "description": "There are more search results.", + "description": "A truncated collection of entry search results.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ODataValueContextOfIListOfEntry" + "$ref": "#/components/schemas/EntryCollectionResponse" } } } @@ -4854,17 +5126,17 @@ } } }, - "/v1/Repositories/{repoId}/TagDefinitions": { + "/v2/Repositories/{repositoryId}/TagDefinitions": { "get": { "tags": [ "TagDefinitions" ], "summary": "Returns the tag definitions associated with a repository.", - "description": "- Returns all tag definitions in the repository.\n- Provide a repository ID and get a paged listing of tag definitions available in the repository. Useful when trying to display all tag definitions available, not only tags assigned to a specific entry.\n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.", - "operationId": "GetTagDefinitions", + "description": "- Returns all tag definitions in the repository.\n- Provide a repository ID and get a paged listing of tag definitions available in the repository. Useful when trying to display all tag definitions available, not only tags assigned to a specific entry.\n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.\n- Required OAuth scope: repository.Read", + "operationId": "ListTagDefinitions", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -4887,7 +5159,7 @@ { "name": "culture", "in": "query", - "description": "An optional query parameter used to indicate the locale that should be used for formatting.\n The value should be a standard language tag.", + "description": "An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag.", "schema": { "type": "string", "default": "", @@ -4947,11 +5219,11 @@ ], "responses": { "200": { - "description": "Get tag definitions successfully.", + "description": "A collection of tag definitions.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ODataValueContextOfIListOfWTagInfo" + "$ref": "#/components/schemas/TagDefinitionCollectionResponse" } } } @@ -5009,17 +5281,17 @@ } } }, - "/v1/Repositories/{repoId}/TagDefinitions/{tagId}": { + "/v2/Repositories/{repositoryId}/TagDefinitions/{tagId}": { "get": { "tags": [ "TagDefinitions" ], "summary": "Returns a single tag definition object.", - "description": "- Returns a single tag definition.\n- Provide a tag definition ID, and get the single tag definition associated with that ID. Useful when another route provides a minimal amount of details, and more information about the specific tag is needed.\n- Allowed OData query options: Select", - "operationId": "GetTagDefinitionById", + "description": "- Returns a single tag definition.\n- Provide a tag definition ID, and get the single tag definition associated with that ID. Useful when another route provides a minimal amount of details, and more information about the specific tag is needed.\n- Allowed OData query options: Select\n- Required OAuth scope: repository.Read", + "operationId": "GetTagDefinition", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -5042,7 +5314,7 @@ { "name": "culture", "in": "query", - "description": "An optional query parameter used to indicate the locale that should be used for formatting.\n The value should be a standard language tag.", + "description": "An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag.", "schema": { "type": "string", "default": "", @@ -5063,11 +5335,11 @@ ], "responses": { "200": { - "description": "Get tag definition successfully.", + "description": "A single tag definition.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WTagInfo" + "$ref": "#/components/schemas/TagDefinition" } } } @@ -5125,17 +5397,17 @@ } } }, - "/v1/Repositories/{repoId}/Tasks/{operationToken}": { + "/v2/Repositories/{repositoryId}/Tasks": { "get": { "tags": [ "Tasks" ], - "summary": "Returns the status of an operation.", - "description": "- Returns the status of an operation.\n- Provide an operationToken (returned in other asynchronous routes) to get the operation status, progress, and any errors that may have occurred. When the operation is completed, the Location header can be inspected as a link to the modified resources (if relevant).\n- OperationStatus can be one of the following values: NotStarted, InProgress, Completed, or Failed.", - "operationId": "GetOperationStatusAndProgress", + "summary": "Returns the status of a set of one or more tasks.", + "description": "- Returns the status of a set of one or more tasks.\n- Provide a comma-separated list of task IDs to get the task status, progress, and any errors that may have occurred.\n- Leave the taskIds query parameter empty, to get the list of all the task IDs associated with the current access token.\n- TaskStatus can be one of the following values: NotStarted, InProgress, Completed, Cancelled, or Failed.\n- This API employs long polling technique and could return the result immediately (e.g. if the export operation is failed or completed successfully) or after atmost 60 seconds.\n- Required OAuth scope: None", + "operationId": "ListTasks", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID", @@ -5145,43 +5417,28 @@ "x-position": 1 }, { - "name": "operationToken", - "in": "path", - "required": true, - "description": "The operation token", + "name": "taskIds", + "in": "query", + "style": "form", + "explode": true, + "description": "An array of task IDs. Leave this parameter empty to get the list of all the tasks associated with the current access token.", "schema": { - "type": "string" + "type": "array", + "nullable": true, + "items": { + "type": "string" + } }, "x-position": 2 } ], "responses": { "200": { - "description": "Get completed or failed operation status with no result successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OperationProgress" - } - } - } - }, - "201": { - "description": "Get completed operation status with operation result url in Location header.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OperationProgress" - } - } - } - }, - "202": { - "description": "Get not started or in progress operation status successfully.", + "description": "A collection of task progresses.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/OperationProgress" + "$ref": "#/components/schemas/TaskCollectionResponse" } } } @@ -5217,7 +5474,7 @@ } }, "404": { - "description": "Request operationToken not found.", + "description": "Repository is not found.", "content": { "application/json": { "schema": { @@ -5242,12 +5499,12 @@ "tags": [ "Tasks" ], - "summary": "Cancels an operation.", - "description": "- Cancels an operation.\n- Provide an operationToken to cancel the operation, if possible. Should be used if an operation was created in error, or is no longer necessary.\n- Rollbacks must be done manually. For example, if a copy operation is started and is halfway complete when canceled, the client application is responsible for cleaning up the files that were successfully copied before the operation was canceled.", - "operationId": "CancelOperation", + "summary": "Starts the cancellation for a set of one or more tasks.", + "description": "- Starts the cancellation for a set of one or more tasks.\n- Provide comma-separated list of task IDs to cancel. Should be used if an operation was created in error, or is no longer necessary.\n- Check the status of the task to determine if the task has been cancelled successfully.\n- Leave the taskIds query parameter empty, to cancel the list of all the task IDs associated with the current access token.\n- Rollbacks must be done manually. For example, if a copy operation is started and is halfway complete when canceled, the client application is responsible for cleaning up the files that were successfully copied before the operation was canceled.\n- Required OAuth scope: None", + "operationId": "CancelTasks", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID", @@ -5257,19 +5514,31 @@ "x-position": 1 }, { - "name": "operationToken", - "in": "path", - "required": true, - "description": "The operation token", + "name": "taskIds", + "in": "query", + "style": "form", + "explode": true, + "description": "An array of task IDs. Leave this parameter empty to cancel the list of all the tasks associated with the current access token.", "schema": { - "type": "string" + "type": "array", + "nullable": true, + "items": { + "type": "string" + } }, "x-position": 2 } ], "responses": { - "204": { - "description": "Cancel operation successfully." + "200": { + "description": "A collection of task cancellation results.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CancelTasksResponse" + } + } + } }, "400": { "description": "Invalid or bad request.", @@ -5302,7 +5571,7 @@ } }, "404": { - "description": "Request operationToken not found.", + "description": "Repository is not found.", "content": { "application/json": { "schema": { @@ -5324,17 +5593,17 @@ } } }, - "/v1/Repositories/{repoId}/TemplateDefinitions": { + "/v2/Repositories/{repositoryId}/TemplateDefinitions": { "get": { "tags": [ "TemplateDefinitions" ], "summary": "Returns the template definitions associated with a repository.", - "description": "- Returns all template definitions (including field definitions) in the repository. If a template name query parameter is given, then a single template definition is returned.\n- Provide a repository ID, and get a paged listing of template definitions available in the repository. Useful when trying to find a list of all template definitions available, rather than a specific one.\n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.", - "operationId": "GetTemplateDefinitions", + "description": "- Returns all template definitions (including field definitions) in the repository. If a template name query parameter is given, then a single template definition is returned.\n- Provide a repository ID, and get a paged listing of template definitions available in the repository. Useful when trying to find a list of all template definitions available, rather than a specific one.\n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.\n- Required OAuth scope: repository.Read", + "operationId": "ListTemplateDefinitions", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -5367,7 +5636,7 @@ { "name": "culture", "in": "query", - "description": "An optional query parameter used to indicate the locale that should be used for formatting.\n The value should be a standard language tag.", + "description": "An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag.", "schema": { "type": "string", "default": "", @@ -5427,11 +5696,11 @@ ], "responses": { "200": { - "description": "Get template definitions successfully.", + "description": "A collection of template definitions.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ODataValueContextOfIListOfWTemplateInfo" + "$ref": "#/components/schemas/TemplateDefinitionCollectionResponse" } } } @@ -5489,17 +5758,17 @@ } } }, - "/v1/Repositories/{repoId}/TemplateDefinitions/{templateId}": { + "/v2/Repositories/{repositoryId}/TemplateDefinitions/{templateId}": { "get": { "tags": [ "TemplateDefinitions" ], "summary": "Returns a single template definition object.", - "description": "- Returns a single template definition (including field definitions, if relevant).\n- Provide a template definition ID, and get the single template definition associated with that ID. Useful when a route provides a minimal amount of details, and more information about the specific template is needed.\n- Allowed OData query options: Select", - "operationId": "GetTemplateDefinitionById", + "description": "- Returns a single template definition (including field definitions, if relevant).\n- Provide a template definition ID, and get the single template definition associated with that ID. Useful when a route provides a minimal amount of details, and more information about the specific template is needed.\n- Allowed OData query options: Select\n- Required OAuth scope: repository.Read", + "operationId": "GetTemplateDefinition", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -5522,7 +5791,7 @@ { "name": "culture", "in": "query", - "description": "An optional query parameter used to indicate the locale that should be used for formatting.\n The value should be a standard language tag.", + "description": "An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag.", "schema": { "type": "string", "default": "", @@ -5543,11 +5812,11 @@ ], "responses": { "200": { - "description": "Get template definition successfully.", + "description": "A single template definition.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WTemplateInfo" + "$ref": "#/components/schemas/TemplateDefinition" } } } @@ -5605,17 +5874,17 @@ } } }, - "/v1/Repositories/{repoId}/TemplateDefinitions/{templateId}/Fields": { + "/v2/Repositories/{repositoryId}/TemplateDefinitions/{templateId}/FieldDefinitions": { "get": { "tags": [ "TemplateDefinitions" ], "summary": "Returns the field definitions assigned to a template definition (by template definition ID).", - "description": "- Returns the field definitions assigned to a template definition.\n- Provide a template definition ID, and get a paged listing of the field definitions assigned to that template. \n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.", - "operationId": "GetTemplateFieldDefinitions", + "description": "- Returns the field definitions assigned to a template definition.\n- Provide a template definition ID, and get a paged listing of the field definitions assigned to that template. \n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.\n- Required OAuth scope: repository.Read", + "operationId": "ListTemplateFieldDefinitionsByTemplateId", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -5649,7 +5918,7 @@ { "name": "culture", "in": "query", - "description": "An optional query parameter used to indicate the locale that should be used for formatting.\n The value should be a standard language tag.", + "description": "An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag.", "schema": { "type": "string", "default": "", @@ -5709,11 +5978,11 @@ ], "responses": { "200": { - "description": "Get template field definitions successfully.", + "description": "A collection of template field definitions.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ODataValueContextOfIListOfTemplateFieldInfo" + "$ref": "#/components/schemas/TemplateFieldDefinitionCollectionResponse" } } } @@ -5771,17 +6040,17 @@ } } }, - "/v1/Repositories/{repoId}/TemplateDefinitions/Fields": { + "/v2/Repositories/{repositoryId}/TemplateDefinitions/FieldDefinitions": { "get": { "tags": [ "TemplateDefinitions" ], "summary": "Returns the field definitions assigned to a template definition (by template definition name).", - "description": "- Returns the field definitions assigned to a template definition.\n- Provide a template definition name, and get a paged listing of the field definitions assigned to that template. \n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.", - "operationId": "GetTemplateFieldDefinitionsByTemplateName", + "description": "- Returns the field definitions assigned to a template definition.\n- Provide a template definition name, and get a paged listing of the field definitions assigned to that template. \n- Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.\n- Required OAuth scope: repository.Read", + "operationId": "ListTemplateFieldDefinitionsByTemplateName", "parameters": [ { - "name": "repoId", + "name": "repositoryId", "in": "path", "required": true, "description": "The requested repository ID.", @@ -5796,8 +6065,7 @@ "required": true, "description": "A required query parameter for the requested template name.", "schema": { - "type": "string", - "nullable": true + "type": "string" }, "x-position": 2 }, @@ -5815,7 +6083,7 @@ { "name": "culture", "in": "query", - "description": "An optional query parameter used to indicate the locale that should be used for formatting.\n The value should be a standard language tag.", + "description": "An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag.", "schema": { "type": "string", "default": "", @@ -5875,11 +6143,11 @@ ], "responses": { "200": { - "description": "Get template field definitions successfully.", + "description": "A collection of template field definitions.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ODataValueContextOfIListOfTemplateFieldInfo" + "$ref": "#/components/schemas/TemplateFieldDefinitionCollectionResponse" } } } @@ -5936,433 +6204,51 @@ } } } - }, - "/v1/Repositories/{repoId}/ServerSession/Invalidate": { - "post": { - "tags": [ - "ServerSession" - ], - "summary": "Deprecated. Do not call this api.", - "description": "- Deprecated.\n- Invalidates the server session.\n- Acts as a \"logout\" operation, and invalidates the session associated with the provided access token. This method should be used when the client wants to clean up the current session.\n- Only available in Laserfiche Cloud.", - "operationId": "InvalidateServerSession", - "parameters": [ - { - "name": "repoId", - "in": "path", - "required": true, - "description": "The requested repository ID.", - "schema": { - "type": "string" - }, - "x-position": 1 - } - ], - "responses": { - "200": { - "description": "Invalidate the server session successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ODataValueOfBoolean" - } - } - } - }, - "400": { - "description": "Invalid or bad request.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "401": { - "description": "Access token is invalid or expired.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "403": { - "description": "Access denied for the operation.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "Not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "429": { - "description": "Rate limit is reached.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - }, - "deprecated": true - } - }, - "/v1/Repositories/{repoId}/ServerSession/Refresh": { - "post": { - "tags": [ - "ServerSession" - ], - "summary": "Deprecated. Do not call this api.", - "description": "- Deprecated.\n- Refreshes the session associated with the access token. This is only necessary if you want to keep the same session alive, otherwise a new session will be automatically created when the session expires.\n- When a client application wants to keep a session alive that has been idle for an hour, this route can be used to refresh the expiration timer associated with the access token.\n- Only available in Laserfiche Cloud.", - "operationId": "RefreshServerSession", - "parameters": [ - { - "name": "repoId", - "in": "path", - "required": true, - "description": "The requested repository ID.", - "schema": { - "type": "string" - }, - "x-position": 1 - } - ], - "responses": { - "200": { - "description": "Refresh the session successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ODataValueOfDateTime" - } - } - } - }, - "400": { - "description": "Invalid or bad request.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "401": { - "description": "Access token is invalid or expired.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "403": { - "description": "Access denied for the operation.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "Not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "429": { - "description": "Rate limit is reached.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - }, - "deprecated": true - } - }, - "/v1/Repositories/{repoId}/ServerSession/Create": { - "post": { - "tags": [ - "ServerSession" - ], - "summary": "Deprecated. Do not call this api.", - "description": "- Deprecated. This function is a no-op, always returns 200.\n- Only available in Laserfiche Cloud.", - "operationId": "CreateServerSession", - "parameters": [ - { - "name": "repoId", - "in": "path", - "required": true, - "description": "The requested repository ID.", - "schema": { - "type": "string" - }, - "x-position": 1 - } - ], - "responses": { - "200": { - "description": "Create the session successfully.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ODataValueOfBoolean" - } - } - } - }, - "401": { - "description": "Access token is invalid or expired.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "403": { - "description": "Access denied for the operation.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - }, - "deprecated": true - } } }, "components": { "schemas": { - "CreateEntryResult": { + "AttributeCollectionResponse": { "type": "object", + "description": "Response containing a collection of Attribute.", "additionalProperties": false, "properties": { - "operations": { - "$ref": "#/components/schemas/CreateEntryOperations" - }, - "documentLink": { + "@odata.nextLink": { "type": "string", - "description": "A link to get the created entry.", + "description": "A URL to retrieve the next page of the requested collection.", + "nullable": true + }, + "@odata.count": { + "type": "integer", + "description": "The total count of items within a collection.", + "format": "int32", "nullable": true + }, + "value": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Attribute" + } } } }, - "CreateEntryOperations": { + "Attribute": { "type": "object", - "description": "The results of each operation needed in order to create the electronic document with optional template and fields.", + "description": "Represents a trustee attribute.", "additionalProperties": false, "properties": { - "entryCreate": { - "$ref": "#/components/schemas/EntryCreate" - }, - "setEdoc": { - "$ref": "#/components/schemas/SetEdoc" - }, - "setTemplate": { - "$ref": "#/components/schemas/SetTemplate" - }, - "setFields": { - "$ref": "#/components/schemas/SetFields" - }, - "setTags": { - "$ref": "#/components/schemas/SetTags" - }, - "setLinks": { - "$ref": "#/components/schemas/SetLinks" - } - } - }, - "EntryCreate": { - "type": "object", - "description": "The result of trying to create the entry.", - "additionalProperties": false, - "properties": { - "exceptions": { - "type": "array", - "description": "The list of exceptions that occured when trying to perform the operation.", - "nullable": true, - "items": { - "$ref": "#/components/schemas/APIServerException" - } - }, - "entryId": { - "type": "integer", - "description": "The id of the created entry. If the id is 0, then the entry was not created.", - "format": "int32" - } - } - }, - "APIServerException": { - "type": "object", - "properties": { - "operationId": { - "type": "string", - "description": "The id of the operation that threw the exception.", - "nullable": true - }, - "message": { - "type": "string", - "description": "The explaination of the exception that occurred.", - "nullable": true - }, - "errorCode": { - "type": "integer", - "description": "The code associated with the exception.", - "format": "int32", - "nullable": true - }, - "errorClass": { - "type": "string", - "description": "The class of exceptions this belongs to.", - "nullable": true - }, - "statusCode": { - "type": "integer", - "description": "The HTTP status code returned.", - "format": "int32", - "nullable": true - }, - "errorSource": { + "key": { "type": "string", - "description": "The source of where the exception occurred.", + "description": "The attribute key.", "nullable": true - } - } - }, - "SetEdoc": { - "type": "object", - "description": "The result of trying to create the electronic document.", - "additionalProperties": false, - "properties": { - "exceptions": { - "type": "array", - "description": "The list of exceptions that occured when trying to perform the operation.", - "nullable": true, - "items": { - "$ref": "#/components/schemas/APIServerException" - } - } - } - }, - "SetTemplate": { - "type": "object", - "description": "The result of trying to assign a template to the entry.", - "additionalProperties": false, - "properties": { - "exceptions": { - "type": "array", - "description": "The list of exceptions that occured when trying to perform the operation.", - "nullable": true, - "items": { - "$ref": "#/components/schemas/APIServerException" - } }, - "template": { + "value": { "type": "string", - "description": "The name of the template assigned to the entry. If this is null, then no template was assigned.", + "description": "The attribute value.", "nullable": true } } }, - "SetFields": { - "type": "object", - "description": "The result of trying to assign fields to the entry.", - "additionalProperties": false, - "properties": { - "exceptions": { - "type": "array", - "description": "The list of exceptions that occured when trying to perform the operation.", - "nullable": true, - "items": { - "$ref": "#/components/schemas/APIServerException" - } - }, - "fieldCount": { - "type": "integer", - "description": "The number of fields assigned to the entry.", - "format": "int32" - } - } - }, - "SetTags": { - "type": "object", - "description": "The result of trying to assign fields to the entry.", - "additionalProperties": false, - "properties": { - "exceptions": { - "type": "array", - "description": "The list of exceptions that occured when trying to perform the operation.", - "nullable": true, - "items": { - "$ref": "#/components/schemas/APIServerException" - } - }, - "assignedTags": { - "type": "array", - "description": "The tags that were assigned to the entry", - "nullable": true, - "items": { - "type": "string" - } - } - } - }, - "SetLinks": { - "type": "object", - "description": "The result of trying to assign a entry link to the entry.", - "additionalProperties": false, - "properties": { - "exceptions": { - "type": "array", - "description": "The list of exceptions that occured when trying to perform the operation.", - "nullable": true, - "items": { - "$ref": "#/components/schemas/APIServerException" - } - }, - "otherEntryIds": { - "type": "array", - "description": "The ids of the other entries linked to the entry", - "nullable": true, - "items": { - "type": "integer", - "format": "int32" - } - } - } - }, "ProblemDetails": { "type": "object", "description": "A machine-readable format for specifying errors in HTTP API responses based on https://tools.ietf.org/html/rfc7807.", @@ -6411,838 +6297,897 @@ "errorCode": { "type": "integer", "description": "The error code.", - "format": "int32" + "format": "int32", + "nullable": true }, "traceId": { "type": "string", "description": "The trace id.", "nullable": true + }, + "instanceDetail": { + "type": "string", + "description": "The instance detail.", + "nullable": true } } }, - "IHeaderDictionary": { + "AuditReasonCollectionResponse": { "type": "object", - "x-abstract": true, + "description": "Response containing a collection of AuditReason.", "additionalProperties": false, "properties": { - "Item": { - "type": "array", - "items": {} + "@odata.nextLink": { + "type": "string", + "description": "A URL to retrieve the next page of the requested collection.", + "nullable": true }, - "ContentLength": { + "@odata.count": { "type": "integer", - "format": "int64", + "description": "The total count of items within a collection.", + "format": "int32", "nullable": true }, - "Accept": { - "type": "array", - "items": {} - }, - "AcceptCharset": { + "value": { "type": "array", - "items": {} + "items": { + "$ref": "#/components/schemas/AuditReason" + } + } + } + }, + "AuditReason": { + "type": "object", + "description": "Represents a user-defined audit reason for an audit event.", + "additionalProperties": false, + "properties": { + "id": { + "type": "integer", + "description": "The audit reason id.", + "format": "int32" }, - "AcceptEncoding": { - "type": "array", - "items": {} + "name": { + "type": "string", + "description": "The audit reason text.", + "nullable": true }, - "AcceptLanguage": { - "type": "array", - "items": {} + "auditEventType": { + "description": "The audit event type for this audit reason.", + "oneOf": [ + { + "$ref": "#/components/schemas/AuditEventType" + } + ] + } + } + }, + "AuditEventType": { + "type": "string", + "description": "Enumeration of Laserfiche audit event types.", + "x-enumNames": [ + "DeleteEntry", + "ExportDocument" + ], + "enum": [ + "DeleteEntry", + "ExportDocument" + ] + }, + "FieldDefinition": { + "type": "object", + "description": "Represents a field definition.", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "description": "The name of the field.", + "nullable": true }, - "AcceptRanges": { - "type": "array", - "items": {} + "displayName": { + "type": "string", + "description": "The localized name of the field.", + "nullable": true }, - "AccessControlAllowCredentials": { - "type": "array", - "items": {} + "id": { + "type": "integer", + "description": "The ID of the field.", + "format": "int32" }, - "AccessControlAllowHeaders": { - "type": "array", - "items": {} + "description": { + "type": "string", + "description": "The description of the field.", + "nullable": true }, - "AccessControlAllowMethods": { - "type": "array", - "items": {} + "fieldType": { + "description": "The type of the field.", + "oneOf": [ + { + "$ref": "#/components/schemas/FieldType" + } + ] }, - "AccessControlAllowOrigin": { - "type": "array", - "items": {} + "length": { + "type": "integer", + "description": "The length of the field for variable length data types.", + "format": "int32" }, - "AccessControlExposeHeaders": { - "type": "array", - "items": {} + "defaultValue": { + "type": "string", + "description": "The default value of the field for new entries that are assigned to a template the represented field is a member of.", + "nullable": true }, - "AccessControlMaxAge": { - "type": "array", - "items": {} + "isMultiValue": { + "type": "boolean", + "description": "A boolean indicating if the represented template field supports multiple values." }, - "AccessControlRequestHeaders": { - "type": "array", - "items": {} + "isRequired": { + "type": "boolean", + "description": "A boolean indicating if the represented field must have a value set on entries assigned to a template that the field is a member of." }, - "AccessControlRequestMethod": { - "type": "array", - "items": {} + "constraint": { + "type": "string", + "description": "The constraint for values stored in the represented field.", + "nullable": true }, - "Age": { - "type": "array", - "items": {} + "constraintError": { + "type": "string", + "description": "The error string that will be returned when the field constraint is violated when setting a value for this field.", + "nullable": true }, - "Allow": { + "listValues": { "type": "array", - "items": {} + "description": "The list of items assigned to the represented field.", + "nullable": true, + "items": { + "type": "string" + } }, - "AltSvc": { - "type": "array", - "items": {} + "format": { + "description": "The display format of the represented field.", + "oneOf": [ + { + "$ref": "#/components/schemas/FieldFormat" + } + ] }, - "Authorization": { - "type": "array", - "items": {} + "currency": { + "type": "string", + "description": "The name of the currency that will be using when formatting the represented field when the Format property is set to the Currency member of the WFieldFormat enumeration.", + "nullable": true }, - "Baggage": { - "type": "array", - "items": {} + "formatPattern": { + "type": "string", + "description": "The custom format pattern for fields that are configured to use a custom format.", + "nullable": true + } + } + }, + "FieldType": { + "type": "string", + "description": "Enumeration of Laserfiche template field types.", + "x-enumNames": [ + "DateTime", + "Blob", + "Date", + "ShortInteger", + "LongInteger", + "List", + "Number", + "String", + "Time" + ], + "enum": [ + "DateTime", + "Blob", + "Date", + "ShortInteger", + "LongInteger", + "List", + "Number", + "String", + "Time" + ] + }, + "FieldFormat": { + "type": "string", + "description": "Enumeration of Laserfiche template field formats.", + "x-enumNames": [ + "None", + "ShortDate", + "LongDate", + "ShortDateTime", + "LongDateTime", + "ShortTime", + "LongTime", + "GeneralNumber", + "Currency", + "Percent", + "Scientific", + "Custom" + ], + "enum": [ + "None", + "ShortDate", + "LongDate", + "ShortDateTime", + "LongDateTime", + "ShortTime", + "LongTime", + "GeneralNumber", + "Currency", + "Percent", + "Scientific", + "Custom" + ] + }, + "FieldDefinitionCollectionResponse": { + "type": "object", + "description": "Response containing a collection of FieldDefinition.", + "additionalProperties": false, + "properties": { + "@odata.nextLink": { + "type": "string", + "description": "A URL to retrieve the next page of the requested collection.", + "nullable": true }, - "CacheControl": { - "type": "array", - "items": {} + "@odata.count": { + "type": "integer", + "description": "The total count of items within a collection.", + "format": "int32", + "nullable": true }, - "Connection": { + "value": { "type": "array", - "items": {} + "items": { + "$ref": "#/components/schemas/FieldDefinition" + } + } + } + }, + "LinkDefinitionCollectionResponse": { + "type": "object", + "description": "Response containing a collection of LinkDefinition.", + "additionalProperties": false, + "properties": { + "@odata.nextLink": { + "type": "string", + "description": "A URL to retrieve the next page of the requested collection.", + "nullable": true }, - "ContentDisposition": { - "type": "array", - "items": {} + "@odata.count": { + "type": "integer", + "description": "The total count of items within a collection.", + "format": "int32", + "nullable": true }, - "ContentEncoding": { + "value": { "type": "array", - "items": {} + "items": { + "$ref": "#/components/schemas/LinkDefinition" + } + } + } + }, + "LinkDefinition": { + "type": "object", + "description": "Represents an entry link definition.", + "additionalProperties": false, + "properties": { + "id": { + "type": "integer", + "description": "The ID of the link definition.", + "format": "int32" }, - "ContentLanguage": { - "type": "array", - "items": {} + "sourceLabel": { + "type": "string", + "description": "The label for the source entry in the link definition.", + "nullable": true }, - "ContentLocation": { - "type": "array", - "items": {} + "targetLabel": { + "type": "string", + "description": "The label for the target entry in the link definition.", + "nullable": true }, - "ContentMD5": { - "type": "array", - "items": {} + "description": { + "type": "string", + "description": "The description of the link definition.", + "nullable": true + } + } + }, + "CreateMultipartUploadUrlsResponse": { + "type": "object", + "description": "Response for CreateMultipartUploadUrls.", + "additionalProperties": false, + "properties": { + "uploadId": { + "type": "string", + "description": "A unique identifier for the whole upload process.", + "nullable": true }, - "ContentRange": { + "urls": { "type": "array", - "items": {} + "description": "A list of URLs to which the file chunk should be written.", + "nullable": true, + "items": { + "type": "string" + } + } + } + }, + "CreateMultipartUploadUrlsRequest": { + "type": "object", + "description": "Request body for creating multipart upload urls.", + "additionalProperties": false, + "required": [ + "numberOfParts" + ], + "properties": { + "uploadId": { + "type": "string", + "description": "A unique identifier for the whole upload process.", + "default": "", + "nullable": true }, - "ContentSecurityPolicy": { - "type": "array", - "items": {} + "startingPartNumber": { + "type": "integer", + "description": "Determines the starting position of the requested parts among all the parts associated with this upload. The default value is 1.", + "format": "int32", + "default": 1 }, - "ContentSecurityPolicyReportOnly": { - "type": "array", - "items": {} + "numberOfParts": { + "type": "integer", + "description": "The value must be in the range [1, 100], meaning that in each call to the CreateMultipartUploadUrls api, a maximum of 100 Upload URLs can be requested. Further, each file chunk written to an Upload URL should be at least 5 MB. There is no minimum size limit for the last chunk.", + "format": "int32" }, - "ContentType": { - "type": "array", - "items": {} + "fileName": { + "type": "string", + "description": "The name of the file to be uploaded. The file extension in the name will be used as the extension of the imported entry.", + "nullable": true }, - "CorrelationContext": { - "type": "array", - "items": {} + "mimeType": { + "type": "string", + "description": "The mime-type of the file to be uploaded.", + "nullable": true + } + } + }, + "StartTaskResponse": { + "type": "object", + "description": "Response containing a long operation task id.", + "additionalProperties": false, + "properties": { + "taskId": { + "type": "string", + "description": "A task ID that can be used to check on the status of the task.", + "nullable": true + } + } + }, + "StartImportUploadedPartsRequest": { + "type": "object", + "description": "Request body for starting an asynchronous import entry task.", + "additionalProperties": false, + "required": [ + "uploadId", + "partETags", + "name" + ], + "properties": { + "uploadId": { + "type": "string", + "description": "The UploadId received when calling the CreateMultipartUploadUrls API to request upload URLs.", + "minLength": 1 }, - "Cookie": { + "partETags": { "type": "array", - "items": {} + "description": "The array of the ETag values received when writing the file chunks into the upload URLs.", + "items": { + "type": "string" + } }, - "Date": { - "type": "array", - "items": {} + "name": { + "type": "string", + "description": "The name for the imported entry.", + "minLength": 1 }, - "ETag": { - "type": "array", - "items": {} + "autoRename": { + "type": "boolean", + "description": "Indicates if the entry should be automatically renamed if an entry already exists with the given name in the folder. The default value is false.", + "default": false }, - "Expires": { - "type": "array", - "items": {} + "pdfOptions": { + "description": "The options applied when importing a PDF.", + "nullable": true, + "oneOf": [ + { + "$ref": "#/components/schemas/ImportEntryRequestPdfOptions" + } + ] }, - "Expect": { - "type": "array", - "items": {} + "importAsElectronicDocument": { + "type": "boolean", + "description": "Indicates if the document should be imported as an electronic document (true) or as image pages (false). The default value is false. This option is only applicable when importing the following document types: txt, tif, tiff, bmp, pcx, jpg, jpeg, gif, png.", + "default": false }, - "From": { - "type": "array", - "items": {} + "metadata": { + "description": "The metadata that will be assigned to the entry.", + "nullable": true, + "oneOf": [ + { + "$ref": "#/components/schemas/ImportEntryRequestMetadata" + } + ] }, - "GrpcAcceptEncoding": { - "type": "array", - "items": {} + "volumeName": { + "type": "string", + "description": "The name of the volume to use. Will use the default parent entry volume if not specified. This is ignored in Laserfiche Cloud.", + "nullable": true + } + } + }, + "ImportEntryRequestPdfOptions": { + "type": "object", + "description": "PDF-related options for importing an entry.", + "additionalProperties": false, + "properties": { + "generateText": { + "type": "boolean", + "description": "Indicates if the import operation should generate text. The default value is false.", + "default": false }, - "GrpcEncoding": { - "type": "array", - "items": {} + "generatePages": { + "type": "boolean", + "description": "Indicates if the import operation should generate image pages. The default value is false.", + "default": false }, - "GrpcMessage": { - "type": "array", - "items": {} - }, - "GrpcStatus": { - "type": "array", - "items": {} - }, - "GrpcTimeout": { - "type": "array", - "items": {} - }, - "Host": { - "type": "array", - "items": {} - }, - "KeepAlive": { - "type": "array", - "items": {} - }, - "IfMatch": { - "type": "array", - "items": {} - }, - "IfModifiedSince": { - "type": "array", - "items": {} - }, - "IfNoneMatch": { - "type": "array", - "items": {} - }, - "IfRange": { - "type": "array", - "items": {} - }, - "IfUnmodifiedSince": { - "type": "array", - "items": {} - }, - "LastModified": { - "type": "array", - "items": {} - }, - "Link": { - "type": "array", - "items": {} - }, - "Location": { - "type": "array", - "items": {} - }, - "MaxForwards": { - "type": "array", - "items": {} - }, - "Origin": { - "type": "array", - "items": {} - }, - "Pragma": { - "type": "array", - "items": {} - }, - "ProxyAuthenticate": { - "type": "array", - "items": {} - }, - "ProxyAuthorization": { - "type": "array", - "items": {} - }, - "ProxyConnection": { - "type": "array", - "items": {} - }, - "Range": { - "type": "array", - "items": {} - }, - "Referer": { - "type": "array", - "items": {} - }, - "RetryAfter": { - "type": "array", - "items": {} - }, - "RequestId": { - "type": "array", - "items": {} - }, - "SecWebSocketAccept": { - "type": "array", - "items": {} - }, - "SecWebSocketKey": { - "type": "array", - "items": {} - }, - "SecWebSocketProtocol": { - "type": "array", - "items": {} - }, - "SecWebSocketVersion": { - "type": "array", - "items": {} - }, - "SecWebSocketExtensions": { - "type": "array", - "items": {} - }, - "Server": { - "type": "array", - "items": {} - }, - "SetCookie": { - "type": "array", - "items": {} - }, - "StrictTransportSecurity": { - "type": "array", - "items": {} - }, - "TE": { - "type": "array", - "items": {} - }, - "Trailer": { - "type": "array", - "items": {} - }, - "TransferEncoding": { - "type": "array", - "items": {} - }, - "Translate": { - "type": "array", - "items": {} - }, - "TraceParent": { - "type": "array", - "items": {} - }, - "TraceState": { - "type": "array", - "items": {} - }, - "Upgrade": { - "type": "array", - "items": {} - }, - "UpgradeInsecureRequests": { - "type": "array", - "items": {} - }, - "UserAgent": { - "type": "array", - "items": {} - }, - "Vary": { - "type": "array", - "items": {} - }, - "Via": { - "type": "array", - "items": {} - }, - "Warning": { - "type": "array", - "items": {} - }, - "WebSocketSubProtocols": { - "type": "array", - "items": {} - }, - "WWWAuthenticate": { - "type": "array", - "items": {} - }, - "XContentTypeOptions": { - "type": "array", - "items": {} - }, - "XFrameOptions": { - "type": "array", - "items": {} + "generatePagesImageType": { + "description": "The image type used when generating image pages. The default value is StandardColor. This option is only applicable when GeneratePages is true.", + "default": "StandardColor", + "oneOf": [ + { + "$ref": "#/components/schemas/GeneratePagesImageType" + } + ] }, - "XPoweredBy": { - "type": "array", - "items": {} + "keepPdfAfterImport": { + "type": "boolean", + "description": "Indicates if the PDF file should be retained as an electronic document after generating image pages. The default value is true. This option is only applicable when GeneratePages is true.", + "default": true + } + } + }, + "GeneratePagesImageType": { + "type": "string", + "description": "Enumeration for the image types when generating pages.", + "x-enumNames": [ + "BlackAndWhite", + "StandardColor", + "HighQualityColor" + ], + "enum": [ + "BlackAndWhite", + "StandardColor", + "HighQualityColor" + ] + }, + "ImportEntryRequestMetadata": { + "type": "object", + "description": "Represents the metadata that will be assigned to the imported entry.", + "additionalProperties": false, + "properties": { + "templateName": { + "type": "string", + "description": "The name of the template assigned to the entry.", + "nullable": true }, - "XRequestedWith": { + "fields": { "type": "array", - "items": {} + "description": "The fields that will be assigned to the entry.", + "nullable": true, + "items": { + "$ref": "#/components/schemas/FieldToUpdate" + } }, - "XUACompatible": { + "tags": { "type": "array", - "items": {} + "description": "The tags that will be assigned to the entry.", + "nullable": true, + "items": { + "type": "string" + } }, - "XXSSProtection": { + "links": { "type": "array", - "items": {} + "description": "The links that will be assigned to the entry.", + "nullable": true, + "items": { + "$ref": "#/components/schemas/LinkToUpdate" + } } } }, "FieldToUpdate": { "type": "object", - "description": "The request body containing fields that will be assigned to the entry.", + "description": "Represents a field that will be assigned to the entry.", "additionalProperties": false, + "required": [ + "name" + ], "properties": { + "name": { + "type": "string", + "description": "The name of the field that will be assigned to the entry.", + "minLength": 1 + }, "values": { "type": "array", "description": "The field values that will be assigned to the field.", "nullable": true, "items": { - "$ref": "#/components/schemas/ValueToUpdate" + "type": "string" } } } }, - "ValueToUpdate": { - "type": "object", - "additionalProperties": false, - "properties": { - "value": { - "type": "string", - "description": "The value assigned to the field at the position specified.", - "nullable": true - }, - "position": { - "type": "integer", - "description": "The position of the value in the field. This is 1-indexed for multi value field. It will be ignored for single value field.", - "format": "int32" - } - } - }, "LinkToUpdate": { "type": "object", + "description": "Represents a link that will be assigned to the entry.", "additionalProperties": false, + "required": [ + "linkDefinitionId", + "otherEntryId" + ], "properties": { - "linkTypeId": { + "linkDefinitionId": { "type": "integer", - "description": "The id of the link assigned to the entry.", + "description": "The id of the link definition to be assigned to the entry.", "format": "int32" }, - "otherSourceId": { + "otherEntryId": { "type": "integer", - "description": "The id of the other source linked to the entry.", + "description": "The id of the other entry to be linked to the entry.", "format": "int32" }, "isSource": { "type": "boolean", - "description": "Whether the entry is the source for the link." - } - } - }, - "PostEntryWithEdocMetadataRequest": { - "type": "object", - "additionalProperties": false, + "description": "Whether the entry is the source for the link. The default value is true.", + "default": true + }, + "customProperties": { + "type": "object", + "description": "Custom properties (key, value pairs) to be added to the link.", + "nullable": true, + "additionalProperties": { + "type": "string" + } + } + } + }, + "StartExportEntryRequest": { + "type": "object", + "description": "Request body for starting an asynchronous export entry task.", + "additionalProperties": false, + "required": [ + "part" + ], "properties": { - "template": { + "auditReasonId": { + "type": "integer", + "description": "The reason id for this audit event.", + "format": "int32" + }, + "auditReasonComment": { "type": "string", - "description": "The name of the template assigned to the entry.", + "description": "The comment for this audit event.", + "default": "", "nullable": true }, - "metadata": { - "$ref": "#/components/schemas/PutFieldValsRequest" + "part": { + "description": "Specifies the part of the document to export.", + "oneOf": [ + { + "$ref": "#/components/schemas/ExportEntryRequestPart" + } + ] }, - "volumeName": { - "type": "string", - "description": "The name of the volume to use. Will use the default parent entry volume if not specified. This is ignored in Laserfiche Cloud.", - "nullable": true + "imageOptions": { + "description": "The options applied when exporting as Image.", + "nullable": true, + "oneOf": [ + { + "$ref": "#/components/schemas/ExportEntryRequestImageOptions" + } + ] + }, + "textOptions": { + "description": "The options applied when exporting as Text.", + "nullable": true, + "oneOf": [ + { + "$ref": "#/components/schemas/ExportEntryRequestTextOptions" + } + ] } } }, - "PutFieldValsRequest": { - "allOf": [ - { - "$ref": "#/components/schemas/SimpleImportMetadata" + "ExportEntryRequestPart": { + "type": "string", + "description": "Enumeration of the entry parts to export.", + "x-enumNames": [ + "Image", + "Text", + "Edoc" + ], + "enum": [ + "Image", + "Text", + "Edoc" + ] + }, + "ExportEntryRequestImageOptions": { + "type": "object", + "description": "Represents the options when exporting the image part of an entry.", + "additionalProperties": false, + "properties": { + "format": { + "description": "The image format to export as. Options include: MultiPageTIFF, SinglePageTIFF, PNG, PDF and JPEG. The default value is MultiPageTIFF. MultiPageTIFF format is a single multi-page TIFF file. SinglePageTIFF format is multiple single-page TIFF files (in a single zip file).", + "default": "MultiPageTIFF", + "oneOf": [ + { + "$ref": "#/components/schemas/ExportEntryRequestImageFormat" + } + ] }, - { - "type": "object", - "description": "The request body containing fields that will be assigned to the entry.", - "additionalProperties": false, - "properties": { - "links": { - "type": "array", - "description": "The links that will be assigned to the entry.", - "nullable": true, - "items": { - "$ref": "#/components/schemas/LinkToUpdate" - } + "jPEGCompressionLevel": { + "type": "integer", + "description": "The quality level for JPEG compression when exporting images. The value must be between 0 and 100 (inclusive). The default value is 70.", + "format": "int32", + "default": 70 + }, + "includeAnnotations": { + "type": "boolean", + "description": "Indicates if the annotations need to be included. The default value is true.", + "default": true + }, + "convertPdfAnnotations": { + "type": "boolean", + "description": "Indicates if the annotations on the image need to be converted to PDF annotations when exporting to PDF format. The default value is true. This option is only applicable when exporting to PDF format and IncludeAnnotations is true.", + "default": true + }, + "pagePrefix": { + "type": "string", + "description": "The page prefix of the individual files, when exporting to multi-file format (e.g.zip). The value must have a length of atmost 10 characters and only valid characters that can be included in file names are allowed. The default value is \", Page \".", + "default": ", Page ", + "nullable": true + }, + "includeRedactions": { + "type": "boolean", + "description": "Indicates if redactions are included. The default value is true.", + "default": true + }, + "watermark": { + "description": "The watermark element added to each image. No watermark will be added by default.", + "nullable": true, + "oneOf": [ + { + "$ref": "#/components/schemas/ExportEntryRequestWatermark" } - } + ] } + } + }, + "ExportEntryRequestImageFormat": { + "type": "string", + "description": "Enumeration of formats when exporting the image part of an entry.", + "x-enumNames": [ + "MultiPageTIFF", + "SinglePageTIFF", + "PNG", + "PDF", + "JPEG" + ], + "enum": [ + "MultiPageTIFF", + "SinglePageTIFF", + "PNG", + "PDF", + "JPEG" ] }, - "ODataValueContextOfListOfAttribute": { - "allOf": [ - { - "$ref": "#/components/schemas/ODataValueOfListOfAttribute" + "ExportEntryRequestWatermark": { + "type": "object", + "description": "Represents the watermark added to the images when exporting an entry.", + "additionalProperties": false, + "properties": { + "text": { + "type": "string", + "description": "The text of the watermark. The value must be a string with a length of atmost 100 characters and must not be all whitespace characters.", + "default": "", + "nullable": true }, - { - "type": "object", - "description": "A wrapper around the ODataValue with extra odata.nextLink and odata.count.", - "additionalProperties": false, - "properties": { - "@odata.nextLink": { - "type": "string", - "description": "It contains a URL that allows retrieving the next subset of the requested collection.", - "nullable": true - }, - "@odata.count": { - "type": "integer", - "description": "It contains the count of a collection of entities or a collection of entity references.", - "format": "int32" + "position": { + "description": "The position of the watermark. The default value is DeadCenter.", + "default": "DeadCenter", + "oneOf": [ + { + "$ref": "#/components/schemas/WatermarkPosition" } - } + ] + }, + "rotationAngle": { + "type": "integer", + "description": "The rotation angle of the watermark. The value must be between 0 and 360 (inclusive). The default value is 0.", + "format": "int32", + "default": 0 + }, + "pageSpanPercentage": { + "type": "integer", + "description": "The percentage of the page that the watermark spans on. The value must be between 1 and 100 (inclusive). The default value is 50.", + "format": "int32", + "default": 50 } + } + }, + "WatermarkPosition": { + "type": "string", + "description": "An enumeration of possible positions on a page for watermarks.", + "x-enumNames": [ + "TopLeft", + "TopCenter", + "TopRight", + "MiddleLeft", + "DeadCenter", + "MiddleRight", + "BottomLeft", + "BottomCenter", + "BottomRight" + ], + "enum": [ + "TopLeft", + "TopCenter", + "TopRight", + "MiddleLeft", + "DeadCenter", + "MiddleRight", + "BottomLeft", + "BottomCenter", + "BottomRight" ] }, - "ODataValueOfListOfAttribute": { + "ExportEntryRequestTextOptions": { "type": "object", + "description": "Represents the options when exporting the text part of an entry.", "additionalProperties": false, "properties": { - "value": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Attribute" - } + "includeRedactions": { + "type": "boolean", + "description": "Indicates if redactions are included. The default value is true.", + "default": true + }, + "redactionCharacter": { + "type": "string", + "description": "The character that replaces the original character in a redacted text. The value must be a string of length 1 and must not be a whitespace character. The default value is 'X'.", + "default": "X", + "nullable": true } } }, - "Attribute": { + "StartCopyEntryRequest": { "type": "object", + "description": "Request body for starting an asynchronous copy entry task.", "additionalProperties": false, + "required": [ + "name", + "sourceId" + ], "properties": { - "key": { + "name": { "type": "string", - "nullable": true + "description": "The name of the entry.", + "minLength": 1 }, - "value": { + "autoRename": { + "type": "boolean", + "description": "Indicates if the entry should be automatically renamed if an entry already exists with the given name in the folder. The default value is false.", + "default": false + }, + "sourceId": { + "type": "integer", + "description": "The source entry Id to copy.", + "format": "int32" + }, + "volumeName": { "type": "string", + "description": "The name of the volume to use. Will use the default parent entry volume if not specified. This is ignored in Laserfiche Cloud.", "nullable": true } } }, - "WFieldInfo": { + "StartDeleteEntryRequest": { "type": "object", + "description": "Request body for starting an asynchronous delete entry task.", "additionalProperties": false, "properties": { - "name": { - "type": "string", - "description": "The name of the field.", + "auditReasonId": { + "type": "integer", + "description": "The reason id for this audit event.", + "format": "int32", "nullable": true }, - "displayName": { + "auditReasonComment": { "type": "string", - "description": "The localized name of the field.", + "description": "The comment for this audit event.", "nullable": true - }, + } + } + }, + "Entry": { + "type": "object", + "description": "Base type for all types which represent entry objects in a Laserfiche repository.", + "x-abstract": true, + "additionalProperties": false, + "properties": { "id": { "type": "integer", - "description": "The ID of the field.", + "description": "The ID of the entry.", "format": "int32" }, - "description": { + "name": { "type": "string", - "description": "The description of the field.", + "description": "The name of the entry.", "nullable": true }, - "fieldType": { - "description": "The type of the field.", - "oneOf": [ - { - "$ref": "#/components/schemas/WFieldType" - } - ] - }, - "length": { + "parentId": { "type": "integer", - "description": "The length of the field for variable length data types.", - "format": "int32" + "description": "The ID of the parent entry.", + "format": "int32", + "nullable": true }, - "defaultValue": { + "fullPath": { "type": "string", - "description": "The default value of the field for new entries that are assigned\nto a template the represented field is a member of.", + "description": "The full path in the Laserfiche repository to the entry.", "nullable": true }, - "isMultiValue": { - "type": "boolean", - "description": "A boolean indicating if the represented template field supports multiple values." - }, - "isRequired": { - "type": "boolean", - "description": "A boolean indicating if the represented field must have a value set\non entries assigned to a template that the field is a member of." - }, - "constraint": { + "folderPath": { "type": "string", - "description": "The constraint for values stored in the represented field.", + "description": "The path in the Laserfiche repository to the parent folder.", "nullable": true }, - "constraintError": { + "creator": { "type": "string", - "description": "The error string that will be returned when the field constraint\nis violated when setting a value for this field.", + "description": "The name of the user that created this entry.", "nullable": true }, - "listValues": { - "type": "array", - "description": "The list of items assigned to the represented field.", - "nullable": true, - "items": { - "type": "string" - } + "creationTime": { + "type": "string", + "description": "The creation time of the entry.", + "format": "date-time" }, - "format": { - "description": "The display format of the represented field.", + "lastModifiedTime": { + "type": "string", + "description": "The last modification time of the entry.", + "format": "date-time" + }, + "entryType": { + "description": "The type of the entry.", "oneOf": [ { - "$ref": "#/components/schemas/WFieldFormat" + "$ref": "#/components/schemas/EntryType" } ] }, - "currency": { - "type": "string", - "description": "The name of the currency that will be using when formatting\nthe represented field when the Format property is set to the\nCurrency member of the WFieldFormat enumeration.", - "nullable": true + "isContainer": { + "type": "boolean", + "description": "A boolean indicating if this entry is a container object; it can have other entries as children." }, - "formatPattern": { + "isLeaf": { + "type": "boolean", + "description": "A boolean indicating if this entry is a leaf object; it cannot have other entries as children." + }, + "templateName": { "type": "string", - "description": "The custom format pattern for fields that are configured to\nuse a custom format.", - "nullable": true - } - } - }, - "WFieldType": { - "type": "string", - "description": "Enumeration of Laserfiche template field types.", - "x-enumNames": [ - "DateTime", - "Blob", - "Date", - "ShortInteger", - "LongInteger", - "List", - "Number", - "String", - "Time" - ], - "enum": [ - "DateTime", - "Blob", - "Date", - "ShortInteger", - "LongInteger", - "List", - "Number", - "String", - "Time" - ] - }, - "WFieldFormat": { - "type": "string", - "description": "Enumeration of Laserfiche template field formats.", - "x-enumNames": [ - "None", - "ShortDate", - "LongDate", - "ShortDateTime", - "LongDateTime", - "ShortTime", - "LongTime", - "GeneralNumber", - "Currency", - "Percent", - "Scientific", - "Custom" - ], - "enum": [ - "None", - "ShortDate", - "LongDate", - "ShortDateTime", - "LongDateTime", - "ShortTime", - "LongTime", - "GeneralNumber", - "Currency", - "Percent", - "Scientific", - "Custom" - ] - }, - "ODataValueContextOfIListOfWFieldInfo": { - "allOf": [ - { - "$ref": "#/components/schemas/ODataValueOfIListOfWFieldInfo" - }, - { - "type": "object", - "description": "A wrapper around the ODataValue with extra odata.nextLink and odata.count.", - "additionalProperties": false, - "properties": { - "@odata.nextLink": { - "type": "string", - "description": "It contains a URL that allows retrieving the next subset of the requested collection.", - "nullable": true - }, - "@odata.count": { - "type": "integer", - "description": "It contains the count of a collection of entities or a collection of entity references.", - "format": "int32" - } - } - } - ] - }, - "ODataValueOfIListOfWFieldInfo": { - "type": "object", - "additionalProperties": false, - "properties": { - "value": { - "type": "array", - "items": { - "$ref": "#/components/schemas/WFieldInfo" - } - } - } - }, - "ODataValueContextOfIListOfEntryLinkTypeInfo": { - "allOf": [ - { - "$ref": "#/components/schemas/ODataValueOfIListOfEntryLinkTypeInfo" - }, - { - "type": "object", - "description": "A wrapper around the ODataValue with extra odata.nextLink and odata.count.", - "additionalProperties": false, - "properties": { - "@odata.nextLink": { - "type": "string", - "description": "It contains a URL that allows retrieving the next subset of the requested collection.", - "nullable": true - }, - "@odata.count": { - "type": "integer", - "description": "It contains the count of a collection of entities or a collection of entity references.", - "format": "int32" - } - } - } - ] - }, - "ODataValueOfIListOfEntryLinkTypeInfo": { - "type": "object", - "additionalProperties": false, - "properties": { - "value": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EntryLinkTypeInfo" - } - } - } - }, - "EntryLinkTypeInfo": { - "type": "object", - "additionalProperties": false, - "properties": { - "linkTypeId": { - "type": "integer", - "description": "The ID of the entry link type.", - "format": "int32" - }, - "sourceLabel": { - "type": "string", - "description": "The label for the source entry in the link type.", - "nullable": true - }, - "targetLabel": { - "type": "string", - "description": "The label for the target entry in the link type.", - "nullable": true - }, - "linkTypeDescription": { - "type": "string", - "description": "The description of the link type.", - "nullable": true - } - } - }, - "Entry": { - "type": "object", - "x-abstract": true, - "additionalProperties": false, - "properties": { - "id": { - "type": "integer", - "description": "The ID of the entry.", - "format": "int32" - }, - "name": { - "type": "string", - "description": "The name of the entry.", - "nullable": true - }, - "parentId": { - "type": "integer", - "description": "The ID of the parent entry.", - "format": "int32", - "nullable": true - }, - "fullPath": { - "type": "string", - "description": "The full path in the Laserfiche repository to the entry.", - "nullable": true - }, - "folderPath": { - "type": "string", - "description": "The path in the Laserfiche repository to the parent folder.", - "nullable": true - }, - "creator": { - "type": "string", - "description": "The name of the user that created this entry.", - "nullable": true - }, - "creationTime": { - "type": "string", - "description": "The creation time of the entry.", - "format": "date-time" - }, - "lastModifiedTime": { - "type": "string", - "description": "The last modification time of the entry.", - "format": "date-time" - }, - "entryType": { - "description": "The type of the entry.", - "oneOf": [ - { - "$ref": "#/components/schemas/EntryType" - } - ] - }, - "isContainer": { - "type": "boolean", - "description": "A boolean indicating if this entry is a container object; it can have other entries as children." - }, - "isLeaf": { - "type": "boolean", - "description": "A boolean indicating if this entry is a leaf object; it cannot have other entries as children." - }, - "templateName": { - "type": "string", - "description": "The name of the template assigned to this entry.", + "description": "The name of the template assigned to this entry.", "nullable": true }, "templateId": { @@ -7266,21 +7211,22 @@ "rowNumber": { "type": "integer", "description": "Row number assigned to this entry in the listing.", - "format": "int32" + "format": "int32", + "nullable": true }, "fields": { "type": "array", "description": "The fields assigned to this entry.", "nullable": true, "items": { - "$ref": "#/components/schemas/EntryFieldValue" + "$ref": "#/components/schemas/Field" } } } }, "EntryType": { "type": "string", - "description": "", + "description": "Enumeration of entry types.", "x-enumNames": [ "Folder", "RecordSeries", @@ -7294,33 +7240,25 @@ "Shortcut" ] }, - "EntryFieldValue": { + "Field": { "type": "object", + "description": "Represents a field set on an entry.", "additionalProperties": false, "properties": { - "fieldName": { + "name": { "type": "string", "description": "The name of the field.", "nullable": true }, - "values": { - "type": "array", - "description": "The values assigned to the field.", - "nullable": true, - "items": { - "type": "object", - "additionalProperties": {} - } - }, "fieldType": { "description": "The type of the field. The possible field types are listed below.", "oneOf": [ { - "$ref": "#/components/schemas/WFieldType" + "$ref": "#/components/schemas/FieldType" } ] }, - "fieldId": { + "id": { "type": "integer", "description": "The ID of the field.", "format": "int32" @@ -7336,6 +7274,20 @@ "hasMoreValues": { "type": "boolean", "description": "A boolean indicating if there are more field values." + }, + "groupId": { + "type": "integer", + "description": "The group id of the multi value field group. If the field is not a part of a multi value field group, then there is no group id.", + "format": "int32", + "nullable": true + }, + "values": { + "type": "array", + "description": "The values assigned to the field.", + "nullable": true, + "items": { + "type": "string" + } } } }, @@ -7346,6 +7298,7 @@ }, { "type": "object", + "description": "Represents a Laserfiche record series.", "additionalProperties": false } ] @@ -7357,11 +7310,12 @@ }, { "type": "object", + "description": "Represents a document in a Laserfiche repository.", "additionalProperties": false, "properties": { - "elecDocumentSize": { + "electronicDocumentSize": { "type": "integer", - "description": "The size of the electronic document attached to the represented document,\nif there is one, in bytes.", + "description": "The size of the electronic document attached to the represented document, if there is one, in bytes.", "format": "int64" }, "extension": { @@ -7394,24 +7348,11 @@ "isUnderVersionControl": { "type": "boolean", "description": "A boolean indicating if the represented document is under version control." - }, - "edoc": { - "description": "The electronic document attached to the represented document.", - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/Edoc" - } - ] } } } ] }, - "Edoc": { - "type": "object", - "additionalProperties": false - }, "Shortcut": { "allOf": [ { @@ -7419,6 +7360,7 @@ }, { "type": "object", + "description": "Represents an entry shortcut in a Laserfiche repository.", "additionalProperties": false, "properties": { "targetId": { @@ -7448,84 +7390,527 @@ { "$ref": "#/components/schemas/Entry" }, - { - "type": "object", - "additionalProperties": false, - "properties": { - "isRecordFolder": { - "type": "boolean", - "description": "A boolean indicating if the folder that this instance represents is known\nto be a record folder." - }, - "isUnderRecordSeries": { - "type": "boolean", - "description": "A boolean indicating if the folder that this instance represents is known\nto directly or indirectly under a record series in the repository." - }, - "children": { - "type": "array", - "description": "The entries in this folder.", - "nullable": true, - "items": { - "$ref": "#/components/schemas/Entry" - } - } - } + { + "type": "object", + "description": "Represents a folder (standard or record folder) in a Laserfiche repository.", + "additionalProperties": false, + "properties": { + "isRecordFolder": { + "type": "boolean", + "description": "A boolean indicating if the folder that this instance represents is known to be a record folder." + }, + "isUnderRecordSeries": { + "type": "boolean", + "description": "A boolean indicating if the folder that this instance represents is known to directly or indirectly under a record series in the repository." + } + } + } + ] + }, + "IHeaderDictionary": { + "type": "object", + "x-abstract": true, + "additionalProperties": false, + "properties": { + "Item": { + "type": "array", + "items": {} + }, + "ContentLength": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "Accept": { + "type": "array", + "items": {} + }, + "AcceptCharset": { + "type": "array", + "items": {} + }, + "AcceptEncoding": { + "type": "array", + "items": {} + }, + "AcceptLanguage": { + "type": "array", + "items": {} + }, + "AcceptRanges": { + "type": "array", + "items": {} + }, + "AccessControlAllowCredentials": { + "type": "array", + "items": {} + }, + "AccessControlAllowHeaders": { + "type": "array", + "items": {} + }, + "AccessControlAllowMethods": { + "type": "array", + "items": {} + }, + "AccessControlAllowOrigin": { + "type": "array", + "items": {} + }, + "AccessControlExposeHeaders": { + "type": "array", + "items": {} + }, + "AccessControlMaxAge": { + "type": "array", + "items": {} + }, + "AccessControlRequestHeaders": { + "type": "array", + "items": {} + }, + "AccessControlRequestMethod": { + "type": "array", + "items": {} + }, + "Age": { + "type": "array", + "items": {} + }, + "Allow": { + "type": "array", + "items": {} + }, + "AltSvc": { + "type": "array", + "items": {} + }, + "Authorization": { + "type": "array", + "items": {} + }, + "Baggage": { + "type": "array", + "items": {} + }, + "CacheControl": { + "type": "array", + "items": {} + }, + "Connection": { + "type": "array", + "items": {} + }, + "ContentDisposition": { + "type": "array", + "items": {} + }, + "ContentEncoding": { + "type": "array", + "items": {} + }, + "ContentLanguage": { + "type": "array", + "items": {} + }, + "ContentLocation": { + "type": "array", + "items": {} + }, + "ContentMD5": { + "type": "array", + "items": {} + }, + "ContentRange": { + "type": "array", + "items": {} + }, + "ContentSecurityPolicy": { + "type": "array", + "items": {} + }, + "ContentSecurityPolicyReportOnly": { + "type": "array", + "items": {} + }, + "ContentType": { + "type": "array", + "items": {} + }, + "CorrelationContext": { + "type": "array", + "items": {} + }, + "Cookie": { + "type": "array", + "items": {} + }, + "Date": { + "type": "array", + "items": {} + }, + "ETag": { + "type": "array", + "items": {} + }, + "Expires": { + "type": "array", + "items": {} + }, + "Expect": { + "type": "array", + "items": {} + }, + "From": { + "type": "array", + "items": {} + }, + "GrpcAcceptEncoding": { + "type": "array", + "items": {} + }, + "GrpcEncoding": { + "type": "array", + "items": {} + }, + "GrpcMessage": { + "type": "array", + "items": {} + }, + "GrpcStatus": { + "type": "array", + "items": {} + }, + "GrpcTimeout": { + "type": "array", + "items": {} + }, + "Host": { + "type": "array", + "items": {} + }, + "KeepAlive": { + "type": "array", + "items": {} + }, + "IfMatch": { + "type": "array", + "items": {} + }, + "IfModifiedSince": { + "type": "array", + "items": {} + }, + "IfNoneMatch": { + "type": "array", + "items": {} + }, + "IfRange": { + "type": "array", + "items": {} + }, + "IfUnmodifiedSince": { + "type": "array", + "items": {} + }, + "LastModified": { + "type": "array", + "items": {} + }, + "Link": { + "type": "array", + "items": {} + }, + "Location": { + "type": "array", + "items": {} + }, + "MaxForwards": { + "type": "array", + "items": {} + }, + "Origin": { + "type": "array", + "items": {} + }, + "Pragma": { + "type": "array", + "items": {} + }, + "ProxyAuthenticate": { + "type": "array", + "items": {} + }, + "ProxyAuthorization": { + "type": "array", + "items": {} + }, + "ProxyConnection": { + "type": "array", + "items": {} + }, + "Range": { + "type": "array", + "items": {} + }, + "Referer": { + "type": "array", + "items": {} + }, + "RetryAfter": { + "type": "array", + "items": {} + }, + "RequestId": { + "type": "array", + "items": {} + }, + "SecWebSocketAccept": { + "type": "array", + "items": {} + }, + "SecWebSocketKey": { + "type": "array", + "items": {} + }, + "SecWebSocketProtocol": { + "type": "array", + "items": {} + }, + "SecWebSocketVersion": { + "type": "array", + "items": {} + }, + "SecWebSocketExtensions": { + "type": "array", + "items": {} + }, + "Server": { + "type": "array", + "items": {} + }, + "SetCookie": { + "type": "array", + "items": {} + }, + "StrictTransportSecurity": { + "type": "array", + "items": {} + }, + "TE": { + "type": "array", + "items": {} + }, + "Trailer": { + "type": "array", + "items": {} + }, + "TransferEncoding": { + "type": "array", + "items": {} + }, + "Translate": { + "type": "array", + "items": {} + }, + "TraceParent": { + "type": "array", + "items": {} + }, + "TraceState": { + "type": "array", + "items": {} + }, + "Upgrade": { + "type": "array", + "items": {} + }, + "UpgradeInsecureRequests": { + "type": "array", + "items": {} + }, + "UserAgent": { + "type": "array", + "items": {} + }, + "Vary": { + "type": "array", + "items": {} + }, + "Via": { + "type": "array", + "items": {} + }, + "Warning": { + "type": "array", + "items": {} + }, + "WebSocketSubProtocols": { + "type": "array", + "items": {} + }, + "WWWAuthenticate": { + "type": "array", + "items": {} + }, + "XContentTypeOptions": { + "type": "array", + "items": {} + }, + "XFrameOptions": { + "type": "array", + "items": {} + }, + "XPoweredBy": { + "type": "array", + "items": {} + }, + "XRequestedWith": { + "type": "array", + "items": {} + }, + "XUACompatible": { + "type": "array", + "items": {} + }, + "XXSSProtection": { + "type": "array", + "items": {} } - ] + } }, - "FindEntryResult": { + "ImportEntryRequest": { "type": "object", + "description": "Request body for importing an entry.", "additionalProperties": false, + "required": [ + "name" + ], "properties": { - "entry": { - "description": "The entry found by path. This property is set if entry is found.", + "name": { + "type": "string", + "description": "The name for the imported entry." + }, + "autoRename": { + "type": "boolean", + "description": "Indicates if the entry should be automatically renamed if an entry already exists with the given name in the folder. The default value is false.", + "default": false + }, + "pdfOptions": { + "description": "The options applied when importing a PDF.", "nullable": true, "oneOf": [ { - "$ref": "#/components/schemas/Entry" + "$ref": "#/components/schemas/ImportEntryRequestPdfOptions" } ] }, - "ancestorEntry": { - "description": "The closest entry ancestor. This property is set if entry is not found and fallbackToClosestAncestor is set to true.", + "importAsElectronicDocument": { + "type": "boolean", + "description": "Indicates if the document should be imported as an electronic document (true) or as image pages (false). The default value is false. This option is only applicable when importing the following document types: txt, tif, tiff, bmp, pcx, jpg, jpeg, gif, png.", + "default": false + }, + "metadata": { + "description": "The metadata that will be assigned to the entry.", "nullable": true, "oneOf": [ { - "$ref": "#/components/schemas/Entry" + "$ref": "#/components/schemas/ImportEntryRequestMetadata" } ] + }, + "volumeName": { + "type": "string", + "description": "The name of the volume to use. Will use the default parent entry volume if not specified. This is ignored in Laserfiche Cloud.", + "nullable": true } } }, - "AcceptedOperation": { + "ExportEntryResponse": { "type": "object", + "description": "Response containing a link to download the exported entry.", "additionalProperties": false, "properties": { - "token": { - "type": "string", - "description": "A token that can be used to check on the status of the operation.", - "nullable": true + "value": { + "type": "string" } } }, - "DeleteEntryWithAuditReason": { + "ExportEntryRequest": { "type": "object", + "description": "Request body for exporting an entry.", "additionalProperties": false, + "required": [ + "part" + ], "properties": { "auditReasonId": { "type": "integer", "description": "The reason id for this audit event.", - "format": "int32", - "nullable": true + "format": "int32" }, - "comment": { + "auditReasonComment": { "type": "string", "description": "The comment for this audit event.", + "default": "", "nullable": true + }, + "part": { + "description": "The part of the document to export. Options include: Image, Text, Edoc.", + "oneOf": [ + { + "$ref": "#/components/schemas/ExportEntryRequestPart" + } + ] + }, + "imageOptions": { + "description": "The options applied when exporting as Image.", + "nullable": true, + "oneOf": [ + { + "$ref": "#/components/schemas/ExportEntryRequestImageOptions" + } + ] + }, + "textOptions": { + "description": "The options applied when exporting as Text.", + "nullable": true, + "oneOf": [ + { + "$ref": "#/components/schemas/ExportEntryRequestTextOptions" + } + ] + } + } + }, + "GetEntryByPathResponse": { + "type": "object", + "description": "Response containing an entry or ancestor entry found by entry path.", + "additionalProperties": false, + "properties": { + "entry": { + "description": "The entry found by path. This property is set if entry is found.", + "nullable": true, + "oneOf": [ + { + "$ref": "#/components/schemas/Entry" + } + ] + }, + "ancestorEntry": { + "description": "The closest entry ancestor. This property is set if entry is not found and fallbackToClosestAncestor is set to true.", + "nullable": true, + "oneOf": [ + { + "$ref": "#/components/schemas/Entry" + } + ] } } }, - "PatchEntryRequest": { + "UpdateEntryRequest": { "type": "object", + "description": "Request body for updating an entry.", "additionalProperties": false, "properties": { "parentId": { @@ -7538,37 +7923,30 @@ "type": "string", "description": "The name that will be assigned to the entry.", "nullable": true - } - } - }, - "ODataValueContextOfIListOfEntry": { - "allOf": [ - { - "$ref": "#/components/schemas/ODataValueOfIListOfEntry" }, - { - "type": "object", - "description": "A wrapper around the ODataValue with extra odata.nextLink and odata.count.", - "additionalProperties": false, - "properties": { - "@odata.nextLink": { - "type": "string", - "description": "It contains a URL that allows retrieving the next subset of the requested collection.", - "nullable": true - }, - "@odata.count": { - "type": "integer", - "description": "It contains the count of a collection of entities or a collection of entity references.", - "format": "int32" - } - } + "autoRename": { + "type": "boolean", + "description": "Indicates if the entry should be automatically renamed if an entry already exists with the given name in the folder. The default value is false.", + "default": false } - ] + } }, - "ODataValueOfIListOfEntry": { + "EntryCollectionResponse": { "type": "object", + "description": "Response containing a collection of Entry.", "additionalProperties": false, "properties": { + "@odata.nextLink": { + "type": "string", + "description": "A URL to retrieve the next page of the requested collection.", + "nullable": true + }, + "@odata.count": { + "type": "integer", + "description": "The total count of items within a collection.", + "format": "int32", + "nullable": true + }, "value": { "type": "array", "items": { @@ -7577,99 +7955,72 @@ } } }, - "ODataValueContextOfIListOfFieldValue": { - "allOf": [ - { - "$ref": "#/components/schemas/ODataValueOfIListOfFieldValue" - }, - { - "type": "object", - "description": "A wrapper around the ODataValue with extra odata.nextLink and odata.count.", - "additionalProperties": false, - "properties": { - "@odata.nextLink": { - "type": "string", - "description": "It contains a URL that allows retrieving the next subset of the requested collection.", - "nullable": true - }, - "@odata.count": { - "type": "integer", - "description": "It contains the count of a collection of entities or a collection of entity references.", - "format": "int32" - } - } - } - ] - }, - "ODataValueOfIListOfFieldValue": { + "FieldCollectionResponse": { "type": "object", + "description": "Response containing a collection of Field.", "additionalProperties": false, "properties": { + "@odata.nextLink": { + "type": "string", + "description": "A URL to retrieve the next page of the requested collection.", + "nullable": true + }, + "@odata.count": { + "type": "integer", + "description": "The total count of items within a collection.", + "format": "int32", + "nullable": true + }, "value": { "type": "array", "items": { - "$ref": "#/components/schemas/FieldValue" + "$ref": "#/components/schemas/Field" } } } }, - "FieldValue": { - "allOf": [ - { - "$ref": "#/components/schemas/EntryFieldValue" - }, - { - "type": "object", - "additionalProperties": false, - "properties": { - "groupId": { - "type": "integer", - "description": "The group id of the multi value field group. If the field is not a part of a multi value field group, then there is no group id.", - "format": "int32", - "nullable": true - } - } - } - ] - }, - "ODataValueContextOfIListOfWTagInfo": { - "allOf": [ - { - "$ref": "#/components/schemas/ODataValueOfIListOfWTagInfo" - }, - { - "type": "object", - "description": "A wrapper around the ODataValue with extra odata.nextLink and odata.count.", - "additionalProperties": false, - "properties": { - "@odata.nextLink": { - "type": "string", - "description": "It contains a URL that allows retrieving the next subset of the requested collection.", - "nullable": true - }, - "@odata.count": { - "type": "integer", - "description": "It contains the count of a collection of entities or a collection of entity references.", - "format": "int32" - } + "SetFieldsRequest": { + "type": "object", + "description": "Request body for assigning fields to an entry.", + "additionalProperties": false, + "properties": { + "fields": { + "type": "array", + "description": "The fields that will be assigned to the entry.", + "nullable": true, + "items": { + "$ref": "#/components/schemas/FieldToUpdate" } } - ] + } }, - "ODataValueOfIListOfWTagInfo": { + "TagCollectionResponse": { "type": "object", + "description": "Response containing a collection of Tag.", "additionalProperties": false, "properties": { + "@odata.nextLink": { + "type": "string", + "description": "A URL to retrieve the next page of the requested collection.", + "nullable": true + }, + "@odata.count": { + "type": "integer", + "description": "The total count of items within a collection.", + "format": "int32", + "nullable": true + }, "value": { "type": "array", "items": { - "$ref": "#/components/schemas/WTagInfo" + "$ref": "#/components/schemas/Tag" } } } }, - "WTagInfo": { + "Tag": { "type": "object", + "description": "Represents a tag set on an entry.", "additionalProperties": false, "properties": { "id": { @@ -7694,34 +8045,35 @@ }, "isSecure": { "type": "boolean", - "description": "A boolean indicating whether or not the tag definition is classified\nas a security tag (true) or an informational tag (false)." + "description": "A boolean indicating whether or not the tag definition is classified as a security tag (true) or an informational tag (false)." }, "watermark": { "description": "The watermark properties associated with the tag definition.", "nullable": true, "oneOf": [ { - "$ref": "#/components/schemas/Watermark" + "$ref": "#/components/schemas/TagDefinitionWatermark" } ] } } }, - "Watermark": { + "TagDefinitionWatermark": { "type": "object", + "description": "Represents a watermark associated with a tag defintion.", "additionalProperties": false, "properties": { - "watermarkText": { + "text": { "type": "string", "description": "The watermark text associated with the tag defintion.", "nullable": true }, - "watermarkTextSize": { + "pageSpanPercentage": { "type": "integer", - "description": "The size of the watermark text, in points, associated with the tag definition.", + "description": "The percentage of the page that the watermark associated with the tag definition spans on.", "format": "int32" }, - "watermarkPosition": { + "position": { "description": "The position of the watermark on the page.", "oneOf": [ { @@ -7729,50 +8081,25 @@ } ] }, - "watermarkRotationAngle": { + "rotationAngle": { "type": "integer", "description": "The rotation angle, in degrees, of the watermark associated with the tag definition.", "format": "int32" }, - "isWatermarkMandatory": { + "isMandatory": { "type": "boolean", "description": "A boolean indicating whether or not the watermark associated with the tag is mandatory." }, - "watermarkIntensity": { + "opacity": { "type": "integer", - "description": "The intensity of the watermark associated with the tag definition. Valid value \nranges from 0 to 100, with -1 as the default values.", + "description": "The opacity of the watermark associated with the tag definition. Valid value ranges from 0 to 100, with -1 as the default values.", "format": "int32" } } }, - "WatermarkPosition": { - "type": "string", - "description": "", - "x-enumNames": [ - "TopLeft", - "TopCenter", - "TopRight", - "MiddleLeft", - "DeadCenter", - "MiddleRight", - "BottomLeft", - "BottomCenter", - "BottomRight" - ], - "enum": [ - "TopLeft", - "TopCenter", - "TopRight", - "MiddleLeft", - "DeadCenter", - "MiddleRight", - "BottomLeft", - "BottomCenter", - "BottomRight" - ] - }, - "PutTagRequest": { + "SetTagsRequest": { "type": "object", + "description": "Request body for assigning tags to an entry.", "additionalProperties": false, "properties": { "tags": { @@ -7785,27 +8112,45 @@ } } }, - "ODataValueOfIListOfWEntryLinkInfo": { + "LinkCollectionResponse": { "type": "object", + "description": "Response containing a collection of Link.", "additionalProperties": false, "properties": { + "@odata.nextLink": { + "type": "string", + "description": "A URL to retrieve the next page of the requested collection.", + "nullable": true + }, + "@odata.count": { + "type": "integer", + "description": "The total count of items within a collection.", + "format": "int32", + "nullable": true + }, "value": { "type": "array", "items": { - "$ref": "#/components/schemas/WEntryLinkInfo" + "$ref": "#/components/schemas/Link" } } } }, - "WEntryLinkInfo": { + "Link": { "type": "object", + "description": "Represents a link between a source entry and a target entry.", "additionalProperties": false, "properties": { - "linkId": { + "id": { "type": "integer", - "description": "The ID of the entry link.", + "description": "The ID of the represented link.", "format": "int32" }, + "description": { + "type": "string", + "description": "The description for the represented link.", + "nullable": true + }, "sourceId": { "type": "integer", "description": "The ID of the source entry of the represented link.", @@ -7818,76 +8163,47 @@ }, "sourceLabel": { "type": "string", - "description": "The label for the source entry in the link type.", - "nullable": true - }, - "targetId": { - "type": "integer", - "description": "The ID of the target entry of the represented link.", - "format": "int32" - }, - "targetFullPath": { - "type": "string", - "description": "The full path to the target entry of the represented link.", - "nullable": true - }, - "targetLabel": { - "type": "string", - "description": "The label for the target entry in the link type.", - "nullable": true - }, - "description": { - "type": "string", - "description": "The descriptive text for the represented entry link.", + "description": "The label for the source entry in the link definition.", "nullable": true }, - "linkTypeDescription": { + "sourceLink": { "type": "string", - "description": "The description of the link type.", + "description": "The navigation link to the source entry.", "nullable": true }, - "linkTypeId": { + "targetId": { "type": "integer", - "description": "The ID of the entry link type.", + "description": "The ID of the target entry of the represented link.", "format": "int32" }, - "linkProperties": { - "type": "object", - "description": "The properties for the entry link.", - "nullable": true, - "additionalProperties": { - "type": "string" - } + "targetFullPath": { + "type": "string", + "description": "The full path to the target entry of the represented link.", + "nullable": true }, - "sourceLink": { + "targetLabel": { "type": "string", - "description": "The navigation link to the source entry.", + "description": "The label for the target entry in the link definition.", "nullable": true }, "targetLink": { "type": "string", "description": "The navigation link to the target entry.", "nullable": true - } - } - }, - "PutLinksRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "targetId": { - "type": "integer", - "description": "The target entry ID to create a link to.", - "format": "int32" }, - "linkTypeId": { + "linkDefinitionId": { "type": "integer", - "description": "The link type ID to create the link with.", + "description": "The ID of the link definition.", "format": "int32" }, + "linkDefinitionDescription": { + "type": "string", + "description": "The description of the link definition.", + "nullable": true + }, "customProperties": { "type": "object", - "description": "Custom properties (key, value pairs) to be added to the link", + "description": "The custom properties for the represented link.", "nullable": true, "additionalProperties": { "type": "string" @@ -7895,45 +8211,76 @@ } } }, - "ODataValueContextOfIListOfWEntryLinkInfo": { - "allOf": [ - { - "$ref": "#/components/schemas/ODataValueOfIListOfWEntryLinkInfo" - }, - { - "type": "object", - "description": "A wrapper around the ODataValue with extra odata.nextLink and odata.count.", - "additionalProperties": false, - "properties": { - "@odata.nextLink": { - "type": "string", - "description": "It contains a URL that allows retrieving the next subset of the requested collection.", - "nullable": true - }, - "@odata.count": { - "type": "integer", - "description": "It contains the count of a collection of entities or a collection of entity references.", - "format": "int32" - } + "SetLinksRequest": { + "type": "object", + "description": "Request body for assigning links to an entry.", + "additionalProperties": false, + "properties": { + "links": { + "type": "array", + "description": "The links that will be assigned to the entry.", + "nullable": true, + "items": { + "$ref": "#/components/schemas/LinkToUpdate" } } - ] + } }, - "PostEntryChildrenRequest": { + "CopyEntryRequest": { "type": "object", + "description": "Request body for copying an entry.", "additionalProperties": false, + "required": [ + "name", + "sourceId" + ], "properties": { "name": { "type": "string", "description": "The name of the entry.", + "minLength": 1 + }, + "autoRename": { + "type": "boolean", + "description": "Indicates if the entry should be automatically renamed if an entry already exists with the given name in the folder. The default value is false.", + "default": false + }, + "sourceId": { + "type": "integer", + "description": "The source entry Id to copy.", + "format": "int32" + }, + "volumeName": { + "type": "string", + "description": "The name of the volume to use. Will use the default parent entry volume if not specified. This is ignored in Laserfiche Cloud.", "nullable": true + } + } + }, + "CreateEntryRequest": { + "type": "object", + "description": "Request body for creating an entry.", + "additionalProperties": false, + "required": [ + "name", + "entryType" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the entry.", + "minLength": 1 + }, + "autoRename": { + "type": "boolean", + "description": "Indicates if the entry should be automatically renamed if an entry already exists with the given name in the folder. The default value is false.", + "default": false }, "entryType": { "description": "The type of the entry.", - "nullable": true, "oneOf": [ { - "$ref": "#/components/schemas/PostEntryChildrenEntryType" + "$ref": "#/components/schemas/CreateEntryRequestEntryType" } ] }, @@ -7942,11 +8289,6 @@ "description": "The TargetId is only needed for creating a shortcut. This will be the entry ID of the shortcut target.", "format": "int32" }, - "sourceId": { - "type": "integer", - "description": "The SourceId is needed for some operations that require a source/destination. One example is the Copy operation.", - "format": "int32" - }, "volumeName": { "type": "string", "description": "The name of the volume to use. Will use the default parent entry volume if not specified. This is ignored in Laserfiche Cloud.", @@ -7954,9 +8296,9 @@ } } }, - "PostEntryChildrenEntryType": { + "CreateEntryRequestEntryType": { "type": "string", - "description": "", + "description": "Enumeration of entry types for CreateEntry.", "x-enumNames": [ "Folder", "Shortcut" @@ -7966,55 +8308,13 @@ "Shortcut" ] }, - "CopyAsyncRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "description": "The name of the entry." - }, - "sourceId": { - "type": "integer", - "description": "The source entry Id to copy.", - "format": "int32" - }, - "volumeName": { - "type": "string", - "description": "The name of the volume to use. Will use the default parent entry volume if not specified. This is ignored in Laserfiche Cloud.", - "nullable": true - } - } - }, - "ODataValueOfBoolean": { - "type": "object", - "additionalProperties": false, - "properties": { - "value": { - "type": "boolean" - } - } - }, - "GetEdocWithAuditReasonRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "auditReasonId": { - "type": "integer", - "description": "The reason id for this audit event.", - "format": "int32", - "nullable": true - }, - "comment": { - "type": "string", - "description": "The comment for this audit event.", - "nullable": true - } - } - }, - "GetDynamicFieldLogicValueRequest": { + "ListDynamicFieldValuesRequest": { "type": "object", + "description": "Request body for listing dynamic field values for an entry.", "additionalProperties": false, + "required": [ + "templateId" + ], "properties": { "templateId": { "type": "integer", @@ -8031,95 +8331,79 @@ } } }, - "PutTemplateRequest": { + "SetTemplateRequest": { "type": "object", + "description": "Request body for assigning a template and template fields to an entry.", "additionalProperties": false, + "required": [ + "templateName" + ], "properties": { "templateName": { "type": "string", "description": "The template that will be assigned to the entry.", - "nullable": true + "minLength": 1 }, "fields": { - "type": "object", + "type": "array", "description": "The template fields that will be assigned to the entry.", "nullable": true, - "additionalProperties": { + "items": { "$ref": "#/components/schemas/FieldToUpdate" } } } }, - "RepositoryInfo": { - "type": "object", - "additionalProperties": false, - "properties": { - "repoId": { - "type": "string", - "description": "The repository id.", - "nullable": true - }, - "repoName": { - "type": "string", - "description": "The repository name.", - "nullable": true - }, - "webclientUrl": { - "type": "string", - "description": "The corresponding repository WebClient url.", - "nullable": true - } - } - }, - "AuditReasons": { + "RepositoryCollectionResponse": { "type": "object", + "description": "Response containing a collection of Repository.", "additionalProperties": false, "properties": { - "deleteEntry": { - "type": "array", - "description": "The audit reasons associated with delete entry.", - "nullable": true, - "items": { - "$ref": "#/components/schemas/WAuditReason" - } - }, - "exportDocument": { + "value": { "type": "array", - "description": "The audit reasons associated with export document.", - "nullable": true, "items": { - "$ref": "#/components/schemas/WAuditReason" + "$ref": "#/components/schemas/Repository" } } } }, - "WAuditReason": { + "Repository": { "type": "object", + "description": "Represents a Laserfiche repository.", "additionalProperties": false, "properties": { "id": { - "type": "integer", - "description": "The audit reason id.", - "format": "int32" + "type": "string", + "description": "The repository id.", + "nullable": true }, "name": { "type": "string", - "description": "The audit reason text.", + "description": "The repository name.", + "nullable": true + }, + "webClientUrl": { + "type": "string", + "description": "The corresponding repository Web Client url.", "nullable": true } } }, - "AdvancedSearchRequest": { + "StartSearchEntryRequest": { "type": "object", + "description": "Request body for starting an asynchronous search entry task.", "additionalProperties": false, + "required": [ + "searchCommand" + ], "properties": { "searchCommand": { "type": "string", - "description": "Search command for advanced search", - "nullable": true + "description": "The search command to run. The search command should follow the Laserfiche search syntax. https://doc.laserfiche.com/laserfiche.documentation/en-us/Default.htm#Search_Syntax.htm", + "minLength": 1 }, "fuzzyType": { - "description": "Fuzzy type (None, Percentage, or NumberOfLetters)", + "description": "Fuzzy type (None, Percentage, or NumberOfLetters).", "oneOf": [ { "$ref": "#/components/schemas/FuzzyType" @@ -8128,158 +8412,61 @@ }, "fuzzyFactor": { "type": "integer", - "description": "Fuzzy factor (percentage as int or int value)", - "format": "int32" - } - } - }, - "FuzzyType": { - "type": "string", - "description": "", - "x-enumNames": [ - "None", - "Percentage", - "NumberOfLetters" - ], - "enum": [ - "None", - "Percentage", - "NumberOfLetters" - ] - }, - "OperationProgress": { - "type": "object", - "additionalProperties": false, - "properties": { - "operationToken": { - "type": "string", - "description": "The operation token of the operation associated with this OperationProgress.", - "nullable": true - }, - "operationType": { - "type": "string", - "description": "The type of the operation associated with this OperationProgress.", - "nullable": true - }, - "percentComplete": { - "type": "integer", - "description": "Determines what percentage of the execution of the associated operation is completed.", - "format": "int32" - }, - "status": { - "description": "The status of the operation associated with this OperationProgress.", - "oneOf": [ - { - "$ref": "#/components/schemas/OperationStatus" - } - ] - }, - "errors": { - "type": "array", - "description": "The list of errors occurred during the execution of the associated operation.", - "nullable": true, - "items": { - "$ref": "#/components/schemas/OperationErrorItem" - } - }, - "redirectUri": { - "type": "string", - "description": "The URI which can be used (via api call) to access the result(s) of the associated operation.", - "nullable": true - }, - "entryId": { - "type": "integer", - "description": "The ID of the entry affected (e.g. created or modified) by the execution of the associated operation.", - "format": "int32" - }, - "startTimestamp": { - "type": "string", - "description": "The timestamp representing when the associated operation's execution is started.", - "format": "date-time" - }, - "statusTimestamp": { - "type": "string", - "description": "The timestamp representing the last time when the associated task's status has changed.", - "format": "date-time" - } - } - }, - "OperationStatus": { - "type": "string", - "description": "", - "x-enumNames": [ - "NotStarted", - "InProgress", - "Completed", - "Failed", - "Cancelled" - ], - "enum": [ - "NotStarted", - "InProgress", - "Completed", - "Failed", - "Cancelled" - ] - }, - "OperationErrorItem": { - "type": "object", - "additionalProperties": false, - "properties": { - "objectId": { - "type": "integer", - "description": "The ID of the entry to which the error is related. ", + "description": "Fuzzy factor (percentage as int or int value).", "format": "int32" - }, - "errorMessage": { - "type": "string", - "description": "The short description of the error.", - "nullable": true } } - }, - "ODataValueContextOfIListOfContextHit": { - "allOf": [ - { - "$ref": "#/components/schemas/ODataValueOfIListOfContextHit" - }, - { - "type": "object", - "description": "A wrapper around the ODataValue with extra odata.nextLink and odata.count.", - "additionalProperties": false, - "properties": { - "@odata.nextLink": { - "type": "string", - "description": "It contains a URL that allows retrieving the next subset of the requested collection.", - "nullable": true - }, - "@odata.count": { - "type": "integer", - "description": "It contains the count of a collection of entities or a collection of entity references.", - "format": "int32" - } - } - } + }, + "FuzzyType": { + "type": "string", + "description": "", + "x-enumNames": [ + "None", + "Percentage", + "NumberOfLetters" + ], + "enum": [ + "None", + "Percentage", + "NumberOfLetters" ] }, - "ODataValueOfIListOfContextHit": { + "SearchContextHitCollectionResponse": { "type": "object", + "description": "Response containing a collection of SearchContextHit.", "additionalProperties": false, "properties": { + "@odata.nextLink": { + "type": "string", + "description": "A URL to retrieve the next page of the requested collection.", + "nullable": true + }, + "@odata.count": { + "type": "integer", + "description": "The total count of items within a collection.", + "format": "int32", + "nullable": true + }, "value": { "type": "array", "items": { - "$ref": "#/components/schemas/ContextHit" + "$ref": "#/components/schemas/SearchContextHit" } } } }, - "ContextHit": { + "SearchContextHit": { "type": "object", + "description": "Represents a context hit for a search result.", "additionalProperties": false, "properties": { "hitType": { - "$ref": "#/components/schemas/HitType" + "description": "The type of context hit this instance represents.", + "oneOf": [ + { + "$ref": "#/components/schemas/HitType" + } + ] }, "isAnnotationHit": { "type": "boolean", @@ -8392,55 +8579,275 @@ "Attachment" ] }, - "SimpleSearchRequest": { + "SearchEntryRequest": { "type": "object", + "description": "Request body for searching entries.", "additionalProperties": false, + "required": [ + "searchCommand" + ], "properties": { "searchCommand": { "type": "string", - "description": "Search command for simple search", + "description": "The search command to run. The search command should follow the Laserfiche search syntax. https://doc.laserfiche.com/laserfiche.documentation/en-us/Default.htm#Search_Syntax.htm", + "minLength": 1 + } + } + }, + "TagDefinitionCollectionResponse": { + "type": "object", + "description": "Response containing a collection of TagDefinition.", + "additionalProperties": false, + "properties": { + "@odata.nextLink": { + "type": "string", + "description": "A URL to retrieve the next page of the requested collection.", + "nullable": true + }, + "@odata.count": { + "type": "integer", + "description": "The total count of items within a collection.", + "format": "int32", "nullable": true + }, + "value": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TagDefinition" + } } } }, - "ODataValueContextOfIListOfWTemplateInfo": { - "allOf": [ - { - "$ref": "#/components/schemas/ODataValueOfIListOfWTemplateInfo" + "TagDefinition": { + "type": "object", + "description": "Represents an entry tag definition.", + "additionalProperties": false, + "properties": { + "id": { + "type": "integer", + "description": "The ID of the tag definition.", + "format": "int32" }, - { - "type": "object", - "description": "A wrapper around the ODataValue with extra odata.nextLink and odata.count.", - "additionalProperties": false, - "properties": { - "@odata.nextLink": { - "type": "string", - "description": "It contains a URL that allows retrieving the next subset of the requested collection.", - "nullable": true - }, - "@odata.count": { - "type": "integer", - "description": "It contains the count of a collection of entities or a collection of entity references.", - "format": "int32" + "name": { + "type": "string", + "description": "The name of the tag definition.", + "nullable": true + }, + "displayName": { + "type": "string", + "description": "The localized name of the tag definition.", + "nullable": true + }, + "description": { + "type": "string", + "description": "The description of the tag definition.", + "nullable": true + }, + "isSecure": { + "type": "boolean", + "description": "A boolean indicating whether or not the tag definition is classified as a security tag (true) or an informational tag (false)." + }, + "watermark": { + "description": "The watermark properties associated with the tag definition.", + "nullable": true, + "oneOf": [ + { + "$ref": "#/components/schemas/TagDefinitionWatermark" + } + ] + } + } + }, + "TaskCollectionResponse": { + "type": "object", + "description": "Response containing a collection of TaskProgress.", + "additionalProperties": false, + "properties": { + "value": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TaskProgress" + } + } + } + }, + "TaskProgress": { + "type": "object", + "description": "Represents the progress of a long operation task.", + "additionalProperties": false, + "properties": { + "id": { + "type": "string", + "description": "The task ID of the task associated with this TaskProgress.", + "nullable": true + }, + "taskType": { + "description": "The type of the task associated with this TaskProgress.", + "oneOf": [ + { + "$ref": "#/components/schemas/TaskType" + } + ] + }, + "percentComplete": { + "type": "integer", + "description": "Determines what percentage of the execution of the associated task is completed.", + "format": "int32" + }, + "status": { + "description": "The status of the task associated with this TaskProgress.", + "oneOf": [ + { + "$ref": "#/components/schemas/TaskStatus" } + ] + }, + "errors": { + "type": "array", + "description": "The list of errors occurred during the execution of the associated task.", + "nullable": true, + "items": { + "$ref": "#/components/schemas/ProblemDetails" } + }, + "result": { + "description": "The result of the execution of the associated task.", + "nullable": true, + "oneOf": [ + { + "$ref": "#/components/schemas/TaskResult" + } + ] + }, + "startTime": { + "type": "string", + "description": "The time representing when the associated task's execution started.", + "format": "date-time" + }, + "lastUpdateTime": { + "type": "string", + "description": "The time representing when the associated task's status last changed.", + "format": "date-time" } + } + }, + "TaskType": { + "type": "string", + "description": "An enumeration of possible types for a long operation task.", + "x-enumNames": [ + "CopyEntry", + "DeleteEntry", + "ExportEntry", + "ImportUploadedParts", + "SearchEntry" + ], + "enum": [ + "CopyEntry", + "DeleteEntry", + "ExportEntry", + "ImportUploadedParts", + "SearchEntry" + ] + }, + "TaskStatus": { + "type": "string", + "description": "An enumeration of possible statuses for a long operation task.", + "x-enumNames": [ + "NotStarted", + "InProgress", + "Completed", + "Failed", + "Cancelled" + ], + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "Failed", + "Cancelled" ] }, - "ODataValueOfIListOfWTemplateInfo": { + "TaskResult": { + "type": "object", + "description": "Represents the result of a long operation task.", + "additionalProperties": false, + "properties": { + "entryId": { + "type": "integer", + "description": "The ID of the entry which is affected (e.g. created or modified) by the execution of the associated task.", + "format": "int32" + }, + "uri": { + "type": "string", + "description": "The URI which can be used (via api call) to access the result(s) of the associated task.", + "nullable": true + } + } + }, + "CancelTasksResponse": { + "type": "object", + "description": "Response containing a collection of CancelTaskResult.", + "additionalProperties": false, + "properties": { + "value": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CancelTaskResult" + } + } + } + }, + "CancelTaskResult": { + "type": "object", + "description": "Represents the result of cancelling a long operation task.", + "additionalProperties": false, + "properties": { + "id": { + "type": "string", + "description": "The ID of the task which has been subject to cancellation.", + "nullable": true + }, + "taskType": { + "description": "The type of the task which has been subject to cancellation.", + "oneOf": [ + { + "$ref": "#/components/schemas/TaskType" + } + ] + }, + "result": { + "type": "boolean", + "description": "Indicates if the request to cancel the task has been received." + } + } + }, + "TemplateDefinitionCollectionResponse": { "type": "object", + "description": "Response containing a collection of TemplateDefinition.", "additionalProperties": false, "properties": { + "@odata.nextLink": { + "type": "string", + "description": "A URL to retrieve the next page of the requested collection.", + "nullable": true + }, + "@odata.count": { + "type": "integer", + "description": "The total count of items within a collection.", + "format": "int32", + "nullable": true + }, "value": { "type": "array", "items": { - "$ref": "#/components/schemas/WTemplateInfo" + "$ref": "#/components/schemas/TemplateDefinition" } } } }, - "WTemplateInfo": { + "TemplateDefinition": { "type": "object", + "description": "Represents a template definition.", "additionalProperties": false, "properties": { "id": { @@ -8474,76 +8881,70 @@ }, "fieldCount": { "type": "integer", - "description": "The number of fields assigned to the template.", + "description": "The number of field definitions assigned to the template definition.", "format": "int32" } } }, "LFColor": { "type": "object", + "description": "Represents an RGB color value with alpha channel.", "additionalProperties": false, "properties": { "a": { "type": "integer", + "description": "The alpha channel component, from 0-255.", "format": "byte" }, "r": { "type": "integer", + "description": "The red channel component, from 0-255.", "format": "byte" }, "g": { "type": "integer", + "description": "The green channel component, from 0-255.", "format": "byte" }, "b": { "type": "integer", + "description": "The blue channel component from 0-255.", "format": "byte" } } }, - "ODataValueContextOfIListOfTemplateFieldInfo": { - "allOf": [ - { - "$ref": "#/components/schemas/ODataValueOfIListOfTemplateFieldInfo" - }, - { - "type": "object", - "description": "A wrapper around the ODataValue with extra odata.nextLink and odata.count.", - "additionalProperties": false, - "properties": { - "@odata.nextLink": { - "type": "string", - "description": "It contains a URL that allows retrieving the next subset of the requested collection.", - "nullable": true - }, - "@odata.count": { - "type": "integer", - "description": "It contains the count of a collection of entities or a collection of entity references.", - "format": "int32" - } - } - } - ] - }, - "ODataValueOfIListOfTemplateFieldInfo": { + "TemplateFieldDefinitionCollectionResponse": { "type": "object", + "description": "Response containing a collection of TemplateFieldDefinition.", "additionalProperties": false, "properties": { + "@odata.nextLink": { + "type": "string", + "description": "A URL to retrieve the next page of the requested collection.", + "nullable": true + }, + "@odata.count": { + "type": "integer", + "description": "The total count of items within a collection.", + "format": "int32", + "nullable": true + }, "value": { "type": "array", "items": { - "$ref": "#/components/schemas/TemplateFieldInfo" + "$ref": "#/components/schemas/TemplateFieldDefinition" } } } }, - "TemplateFieldInfo": { + "TemplateFieldDefinition": { "allOf": [ { - "$ref": "#/components/schemas/WFieldInfo" + "$ref": "#/components/schemas/FieldDefinition" }, { "type": "object", + "description": "Represents a template field definition.", "additionalProperties": false, "properties": { "rule": { @@ -8571,11 +8972,12 @@ }, "Rule": { "type": "object", + "description": "Represents a form logic rule associated with a Laserfiche template and field definition.", "additionalProperties": false, "properties": { "ancestors": { "type": "array", - "description": "The IDs of the parent fields in the template according to the\nform logic rule.", + "description": "The IDs of the parent fields in the template according to the form logic rule.", "nullable": true, "items": { "type": "integer", @@ -8583,38 +8985,6 @@ } } } - }, - "ODataValueOfDateTime": { - "type": "object", - "additionalProperties": false, - "properties": { - "value": { - "type": "string", - "format": "date-time" - } - } - }, - "SimpleImportMetadata": { - "type": "object", - "additionalProperties": false, - "properties": { - "fields": { - "type": "object", - "description": "The fields that will be assigned to the entry.", - "nullable": true, - "additionalProperties": { - "$ref": "#/components/schemas/FieldToUpdate" - } - }, - "tags": { - "type": "array", - "description": "The tags that will be assigned to the entry.", - "nullable": true, - "items": { - "type": "string" - } - } - } } }, "securitySchemes": { @@ -8628,8 +8998,8 @@ "description": "

Note: Please enter below the clientId/clientSecret of a registered web application, or the clientId of a SPA. For SPA, the clientSecret field must be left empty. The app, either a web application or SPA, must have the following uri defined as its redirect uri.

https://api.laserfiche.com/repository/swagger/oauth2-redirect.html

For more information, see this page

", "flows": { "authorizationCode": { - "authorizationUrl": "https://signin.laserfiche.com/oauth/Authorize", - "tokenUrl": "https://signin.laserfiche.com/oauth/Token", + "authorizationUrl": "https://signin.a.clouddev.laserfiche.com/oauth/Authorize", + "tokenUrl": "https://signin.a.clouddev.laserfiche.com/oauth/Token", "scopes": { "repository.Read": "Allows the app to read the content of Laserfiche repositories on behalf of the signed-in user.", "repository.Write": "Allows the app to modify the content of Laserfiche repositories on behalf of the signed-in user." diff --git a/src/Clients/RepositoryClients.cs b/src/Clients/RepositoryClients.cs index cf6efeea..ccbfafd9 100644 --- a/src/Clients/RepositoryClients.cs +++ b/src/Clients/RepositoryClients.cs @@ -34,200 +34,21 @@ namespace Laserfiche.Repository.Api.Client using System = global::System; [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial interface IEntriesClient + public partial interface IAttributesClient { /// - /// Creates a new document in a folder. - /// - /// - /// - Creates a new document in the specified folder with file (no more than 100 MB).
- /// - Optionally sets metadata and electronic document component.
- /// - Optional parameter: autoRename (default false). If an entry already exists with the given name, the entry will be automatically renamed. With this route, partial success is possible. The response returns multiple operation (entryCreate operation, setEdoc operation, setLinks operation, etc..) objects, which contain information about any errors that may have occurred during the creation. As long as the entryCreate operation succeeds, the entry will be created, even if all other operations fail. - ///
- /// The requested repository ID. - /// The entry ID of the folder that the document will be created in. - /// The created document's file name. - /// An optional query parameter used to indicate if the new document should be automatically
- /// renamed if an entry already exists with the given name in the folder. The default value is false. - /// An optional query parameter used to indicate the locale that should be used.
- /// The value should be a standard language tag. This may be used when setting field values with tokens. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Document creation is success. - /// A server side error occurred. - Task ImportDocumentAsync(string repoId, int parentEntryId, string fileName, bool? autoRename = null, string culture = null, FileParameter electronicDocument = null, PostEntryWithEdocMetadataRequest request = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Returns a single entry object. - /// - /// - /// - Returns a single entry object.
- /// - Provide an entry ID, and get the entry associated with that ID. Useful when detailed information about the entry is required, such as metadata, path information, etc.
- /// - Allowed OData query options: Select. If the entry is a subtype (Folder, Document, or Shortcut), the entry will automatically be converted to include those model-specific properties. - ///
- /// The requested repository ID. - /// The requested entry ID. - /// Limits the properties returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get entry successfully. - /// A server side error occurred. - Task GetEntryAsync(string repoId, int entryId, string select = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Deletes an entry asynchronously. - /// - /// - /// - Begins a task to delete an entry, and returns an operationToken.
- /// - Provide an entry ID, and queue a delete task to remove it from the repository (includes nested objects if the entry is a Folder type). The entry will not be deleted immediately.
- /// - Optionally include an audit reason ID and comment in the JSON body. This route returns an operationToken, and will run as an asynchronous operation. Check the progress via the Tasks/{operationToken} route. - ///
- /// The requested repository ID. - /// The requested entry ID. - /// The submitted audit reason. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Delete entry operation start successfully. - /// A server side error occurred. - Task DeleteEntryInfoAsync(string repoId, int entryId, DeleteEntryWithAuditReason request = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Moves and/or renames an entry. - /// - /// - /// - Moves and/or renames an entry.
- /// - Move and/or rename an entry by passing in the new parent folder ID or name in the JSON body.
- /// - Optional parameter: autoRename (default false). If an entry already exists with the given name, the entry will be automatically renamed. - ///
- /// The requested repository ID. - /// The requested entry ID. - /// The request containing the folder ID that the entry will be moved to and the new name
- /// the entry will be renamed to. - /// An optional query parameter used to indicate if the entry should be automatically
- /// renamed if another entry already exists with the same name in the folder. The default value is false. - /// An optional query parameter used to indicate the locale that should be used.
- /// The value should be a standard language tag. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Moves and/or renames an entry successfully. - /// A server side error occurred. - Task MoveOrRenameEntryAsync(string repoId, int entryId, PatchEntryRequest request = null, bool? autoRename = null, string culture = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Returns a single entry object using the entry path. - /// - /// - /// - Returns a single entry object using the entry path.
- /// - Optional query parameter: fallbackToClosestAncestor. Use the fallbackToClosestAncestor query parameter to return the closest existing ancestor if the initial entry path is not found. - ///
- /// The requested repository ID. - /// The requested entry path. - /// An optional query parameter used to indicate whether or not the closest ancestor in the path should be returned if the initial entry path is not found. The default value is false. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get entry successfully. - /// A server side error occurred. - Task GetEntryByPathAsync(string repoId, string fullPath, bool? fallbackToClosestAncestor = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Returns the children entries of a folder. - /// - /// - /// - Returns the children entries of a folder in the repository.
- /// - Provide an entry ID (must be a folder), and get a paged listing of entries in that folder. Used as a way of navigating through the repository.
- /// - Default page size: 150. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. OData $OrderBy syntax should follow: "PropertyName direction,PropertyName2 direction". Sort order can be either value "asc" or "desc". Optional query parameters: groupByOrderType (bool). This query parameter decides if results are returned in groups based on their entry type. Entries returned in the listing are not automatically converted to their subtype (Folder, Shortcut, Document), so clients who want model-specific information should request it via the GET entry by ID route.
- /// - Optionally returns field values for the entries in the folder. Each field name needs to be specified in the request. Maximum limit of 10 field names.
- /// - If field values are requested, only the first value is returned if it is a multi value field.
- /// - Null or Empty field values should not be used to determine if a field is assigned to the entry. - ///
- /// The requested repository ID. - /// The folder ID. - /// An optional query parameter used to indicate if the result should be grouped by entry type or not. - /// Optional array of field names. Field values corresponding to the given field names will be returned for each entry. - /// Boolean for if field values should be formatted. Only applicable if Fields are specified. - /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. The formatFields query parameter must be set to true, otherwise
- /// culture will not be used for formatting. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get the children entries of a Folder successfully. - /// A server side error occurred. - Task GetEntryListingAsync(string repoId, int entryId, bool? groupByEntryType = null, IEnumerable fields = null, bool? formatFields = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Creates/copies a new child entry in a folder. - /// - /// - /// - Create/copy a new child entry in the designated folder.
- /// - Provide the parent folder ID, and based on the request body, copy or create a folder/shortcut as a child entry of the designated folder.
- /// - Optional parameter: autoRename (default false). If an entry already exists with the given name, the entry will be automatically renamed. - ///
- /// The requested repository ID. - /// The folder ID that the entry will be created in. - /// The entry to create. - /// An optional query parameter used to indicate if the new entry should be automatically
- /// renamed if an entry already exists with the given name in the folder. The default value is false. - /// An optional query parameter used to indicate the locale that should be used.
- /// The value should be a standard language tag. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Created a new child entry successfully. - /// A server side error occurred. - Task CreateOrCopyEntryAsync(string repoId, int entryId, PostEntryChildrenRequest request = null, bool? autoRename = null, string culture = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Returns the fields assigned to an entry. - /// - /// - /// - Returns the fields assigned to an entry.
- /// - Provide an entry ID, and get a paged listing of all fields assigned to that entry.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. - ///
- /// The requested repository ID. - /// The requested entry ID. - /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// An optional query parameter used to indicate if the field values should be formatted.
- /// The default value is false. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. The formatValue query parameter must be set to true, otherwise
- /// culture will not be used for formatting. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get field values successfully. - /// A server side error occurred. - Task GetFieldValuesAsync(string repoId, int entryId, string prefer = null, bool? formatValue = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Updates the field values assigned to an entry. - /// - /// - /// - Update the field values assigned to an entry.
- /// - Provide the new field values to assign to the entry, and remove/reset all previously assigned field values.
- /// - This is an overwrite action. The request body must include all desired field values, including any existing field values that should remain assigned to the entry. Field values that are not included in the request will be deleted from the entry. If the field value that is not included is part of a template, it will still be assigned (as required by the template), but its value will be reset. - ///
- /// The requested repository ID. - /// The entry ID of the entry that will have its fields updated. - /// An optional query parameter used to indicate the locale that should be used.
- /// The value should be a standard language tag. This may be used when setting field values with tokens. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Update field values successfully. - /// A server side error occurred. - Task AssignFieldValuesAsync(string repoId, int entryId, IDictionary fieldsToUpdate = null, string culture = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Returns the tags assigned to an entry. + /// Returns the attribute key value pairs associated with the authenticated user. /// /// - /// - Returns the tags assigned to an entry.
- /// - Provide an entry ID, and get a paged listing of tags assigned to that entry.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. + /// - Returns the attribute key value pairs associated with the authenticated user. Alternatively, return only the attribute key value pairs that are associated with the "Everyone" group.
+ /// - Attribute keys can be used with subsequent calls to get specific attribute values.
+ /// - Optional query parameters: everyone (bool, default false). When true, this route does not return the attributes that are tied to the currently authenticated user, but rather the attributes assigned to the "Everyone" group. Note when this is true, the response does not include both the "Everyone" groups attribute and the currently authenticated user, but only the "Everyone" groups.
+ /// - Default page size: 100. Allowed OData query options: Select, Count, OrderBy, Skip, Top, SkipToken, Prefer.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. - /// The requested entry ID. + /// The requested repository ID. + /// Indicates if attributes associated with the "Everyone" group or the currently authenticated user is returned. The default value is false. /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. /// Limits the properties returned in the result. /// Specifies the order in which items are returned. The maximum number of expressions is 5. @@ -235,219 +56,35 @@ public partial interface IEntriesClient /// Excludes the specified number of items of the queried collection from the result. /// Indicates whether the total count of items within a collection are returned in the result. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get entry tags successfully. - /// A server side error occurred. - Task GetTagsAssignedToEntryAsync(string repoId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Assigns tags to an entry. - /// - /// - /// - Assign tags to an entry.
- /// - Provide an entry ID and a list of tags to assign to that entry.
- /// - This is an overwrite action. The request must include all tags to assign to the entry, including existing tags that should remain assigned to the entry. - ///
- /// The requested repository ID. - /// The requested entry ID. - /// The tags to add. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Assign tags to an entry successfully. - /// A server side error occurred. - Task AssignTagsAsync(string repoId, int entryId, PutTagRequest tagsToAdd = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Assigns links to an entry. - /// - /// - /// - Assign links to an entry.
- /// - Provide an entry ID and a list of links to assign to that entry.
- /// - This is an overwrite action. The request must include all links to assign to the entry, including existing links that should remain assigned to the entry. - ///
- /// The request repository ID. - /// The requested entry ID. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Assign links to an entry successfully. - /// A server side error occurred. - Task AssignEntryLinksAsync(string repoId, int entryId, IEnumerable linksToAdd = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Returns the links assigned to an entry. - /// - /// - /// - Returns the links assigned to an entry.
- /// - Provide an entry ID, and get a paged listing of links assigned to that entry.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. - ///
- /// The requested repository ID. - /// The requested entry ID. - /// An optional odata header. Can be used to set the maximum page size using odata.maxpagesize. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get links successfully. - /// A server side error occurred. - Task GetLinkValuesFromEntryAsync(string repoId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Copies an entry into a folder asynchronously. - /// - /// - /// - Copy a new child entry in the designated folder async, and potentially return an operationToken.
- /// - Provide the parent folder ID, and copy an entry as a child of the designated folder.
- /// - Optional parameter: autoRename (default false). If an entry already exists with the given name, the entry will be automatically renamed.
- /// - The status of the operation can be checked via the Tasks/{operationToken} route.
- /// - Token substitution in the name of the copied entry is not supported. - ///
- /// The requested repository ID. - /// The folder ID that the entry will be created in. - /// Copy entry request. - /// An optional query parameter used to indicate if the new entry should be automatically
- /// renamed if an entry already exists with the given name in the folder. The default value is false. - /// An optional query parameter used to indicate the locale that should be used.
- /// The value should be a standard language tag. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Copy entry operation is started successfully. - /// A server side error occurred. - Task CopyEntryAsync(string repoId, int entryId, CopyAsyncRequest request = null, bool? autoRename = null, string culture = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Deletes the edoc associated with an entry. - /// - /// - /// - Delete the edoc associated with the provided entry ID. - /// - /// The requested repository ID. - /// The requested document ID. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Deleted edoc successfully. - /// A server side error occurred. - Task DeleteDocumentAsync(string repoId, int entryId, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Returns information about the edoc content of an entry. - /// - /// - /// - Returns information about the edoc content of an entry, without downloading the edoc in its entirety.
- /// - Provide an entry ID, and get back the Content-Type and Content-Length in the response headers.
- /// - This route does not provide a way to download the actual edoc. Instead, it just gives metadata information about the edoc associated with the entry.
- /// - If an error occurs, the error message can be found in the X-APIServer-Error HTTP response header. - ///
- /// The requested repository ID. - /// The requested document ID. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get edoc info successfully. - /// A server side error occurred. - Task GetDocumentContentTypeAsync(string repoId, int entryId, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Returns an entry's edoc resource in a stream format. - /// - /// - /// - Returns an entry's edoc resource in a stream format.
- /// - Provide an entry ID, and get the edoc resource as part of the response content.
- /// - Optional header: Range. Use the Range header (single range with byte unit) to retrieve partial content of the edoc, rather than the entire edoc. - ///
- /// The requested repository ID. - /// The requested document ID. - /// An optional header used to retrieve partial content of the edoc. Only supports single
- /// range with byte unit. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get edoc successfully. - /// A server side error occurred. - Task ExportDocumentAsync(string repoId, int entryId, string range = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Deletes the pages associated with an entry. - /// - /// - /// - Delete the pages associated with the provided entry ID. If no pageRange is specified, all pages will be deleted.
- /// - Optional parameter: pageRange (default empty). The value should be a comma-seperated string which contains non-overlapping single values, or page ranges. Ex: "1,2,3", "1-3,5", "2-7,10-12." - ///
- /// The requested repository ID. - /// The requested document ID. - /// The pages to be deleted. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Deleted pages successfully. - /// A server side error occurred. - Task DeletePagesAsync(string repoId, int entryId, string pageRange = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Returns an entry's edoc resource in a stream format, including an audit reason. - /// - /// - /// - Returns an entry's edoc resource in a stream format while including an audit reason.
- /// - Provide an entry ID and audit reason/comment in the request body, and get the edoc resource as part of the response content.
- /// - Optional header: Range. Use the Range header (single range with byte unit) to retrieve partial content of the edoc, rather than the entire edoc. This route is identical to the GET edoc route, but allows clients to include an audit reason when downloading the edoc. - ///
- /// The requested repository ID. - /// The requested document ID. - /// An optional header used to retrieve partial content of the edoc. Only supports single
- /// range with byte unit. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get edoc successfully. - /// A server side error occurred. - Task ExportDocumentWithAuditReasonAsync(string repoId, int entryId, GetEdocWithAuditReasonRequest request = null, string range = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Returns the dynamic field logic values assigned to an entry. - /// - /// - /// - Returns dynamic field logic values with the current values of the fields in the template.
- /// - Provide an entry ID and field values in the JSON body to get dynamic field logic values.
- /// Independent and non-dynamic fields in the request body will be ignored, and only related dynamic field logic values for the assigned template will be returned. - ///
- /// The requested repository ID. - /// The requested entry ID. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get dynamic field logic values successfully. - /// A server side error occurred. - Task>> GetDynamicFieldValuesAsync(string repoId, int entryId, GetDynamicFieldLogicValueRequest request = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Removes the currently assigned template from an entry. - /// - /// - /// - Remove the currently assigned template from the specified entry.
- /// - Provide an entry ID to clear template value on.
- /// - If the entry does not have a template assigned, no change will be made. - ///
- /// The requested repository ID. - /// The ID of the entry that will have its template removed. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Remove the currently assigned template successfully. + /// A collection of attributes associated with the authenticated user. /// A server side error occurred. - Task DeleteAssignedTemplateAsync(string repoId, int entryId, CancellationToken cancellationToken = default(CancellationToken)); + Task ListAttributesAsync(string repositoryId, bool? everyone = null, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Assigns a template to an entry. + /// Returns an attribute object associated with the authenticated user. /// /// - /// - Assign a template to an entry.
- /// - Provide an entry ID, template name, and a list of template fields to assign to that entry.
- /// - Only template values will be modified. Any existing independent fields on the entry will not be modified, nor will they be added if included in the request. The only modification to fields will only occur on templated fields. If the previously assigned template includes common template fields as the newly assigned template, the common field values will not be modified. + /// - Returns the attribute associated with the key. Alternatively, return the attribute associated with the key within "Everyone" group.
+ /// - Optional query parameters: everyone (bool, default false). When true, the server only searches for the attribute value with the given key upon the authenticated users attributes. If false, only the authenticated users attributes will be queried.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. - /// The ID of entry that will have its template updated. - /// The template and template fields that will be assigned to the entry. - /// An optional query parameter used to indicate the locale that should be used.
- /// The value should be a standard language tag. This may be used when setting field values with tokens. + /// The requested repository ID. + /// The requested attribute key. + /// Indicates if attributes associated with the "Everyone" group or the currently authenticated user is returned. The default value is false. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Assign a template successfully. + /// A single attribute associated with the authenticated user. /// A server side error occurred. - Task WriteTemplateValueToEntryAsync(string repoId, int entryId, PutTemplateRequest request = null, string culture = null, CancellationToken cancellationToken = default(CancellationToken)); + Task GetAttributeAsync(string repositoryId, string attributeKey, bool? everyone = null, CancellationToken cancellationToken = default(CancellationToken)); } [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class EntriesClient : BaseClient, IEntriesClient + public partial class AttributesClient : BaseClient, IAttributesClient { private HttpClient _httpClient; private Lazy _settings; - public EntriesClient(HttpClient httpClient) + public AttributesClient(HttpClient httpClient) { _httpClient = httpClient; _settings = new Lazy(CreateSerializerSettings); @@ -467,79 +104,70 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() partial void ProcessResponse(HttpClient client, HttpResponseMessage response); /// - /// Creates a new document in a folder. + /// Returns the attribute key value pairs associated with the authenticated user. /// /// - /// - Creates a new document in the specified folder with file (no more than 100 MB).
- /// - Optionally sets metadata and electronic document component.
- /// - Optional parameter: autoRename (default false). If an entry already exists with the given name, the entry will be automatically renamed. With this route, partial success is possible. The response returns multiple operation (entryCreate operation, setEdoc operation, setLinks operation, etc..) objects, which contain information about any errors that may have occurred during the creation. As long as the entryCreate operation succeeds, the entry will be created, even if all other operations fail. + /// - Returns the attribute key value pairs associated with the authenticated user. Alternatively, return only the attribute key value pairs that are associated with the "Everyone" group.
+ /// - Attribute keys can be used with subsequent calls to get specific attribute values.
+ /// - Optional query parameters: everyone (bool, default false). When true, this route does not return the attributes that are tied to the currently authenticated user, but rather the attributes assigned to the "Everyone" group. Note when this is true, the response does not include both the "Everyone" groups attribute and the currently authenticated user, but only the "Everyone" groups.
+ /// - Default page size: 100. Allowed OData query options: Select, Count, OrderBy, Skip, Top, SkipToken, Prefer.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. - /// The entry ID of the folder that the document will be created in. - /// The created document's file name. - /// An optional query parameter used to indicate if the new document should be automatically
- /// renamed if an entry already exists with the given name in the folder. The default value is false. - /// An optional query parameter used to indicate the locale that should be used.
- /// The value should be a standard language tag. This may be used when setting field values with tokens. + /// The requested repository ID. + /// Indicates if attributes associated with the "Everyone" group or the currently authenticated user is returned. The default value is false. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Document creation is success. + /// A collection of attributes associated with the authenticated user. /// A server side error occurred. - public virtual async Task ImportDocumentAsync(string repoId, int parentEntryId, string fileName, bool? autoRename = null, string culture = null, FileParameter electronicDocument = null, PostEntryWithEdocMetadataRequest request = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task ListAttributesAsync(string repositoryId, bool? everyone = null, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); - - if (parentEntryId == null) - throw new ArgumentNullException("parentEntryId"); - - if (fileName == null) - throw new ArgumentNullException("fileName"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{parentEntryId}/{fileName}?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{parentEntryId}", Uri.EscapeDataString(ConvertToString(parentEntryId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{fileName}", Uri.EscapeDataString(ConvertToString(fileName, CultureInfo.InvariantCulture))); - if (autoRename != null) + urlBuilder_.Append("v2/Repositories/{repositoryId}/Attributes?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + if (everyone != null) { - urlBuilder_.Append(Uri.EscapeDataString("autoRename") + "=").Append(Uri.EscapeDataString(ConvertToString(autoRename, CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Append(Uri.EscapeDataString("everyone") + "=").Append(Uri.EscapeDataString(ConvertToString(everyone, CultureInfo.InvariantCulture))).Append("&"); } - if (culture != null) + if (select != null) { - urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); } - urlBuilder_.Length--; - - var client_ = _httpClient; + if (orderby != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); + } + if (top != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); + } + if (skip != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); + } + if (count != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; bool[] disposeClient_ = new bool[]{ false }; try { using (var request_ = new HttpRequestMessage()) { - var boundary_ = Guid.NewGuid().ToString(); - var content_ = new MultipartFormDataContent(boundary_); - content_.Headers.Remove("Content-Type"); - content_.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + boundary_); - - if (electronicDocument == null) - throw new ArgumentNullException("electronicDocument"); - else - { - var content_electronicDocument_ = new StreamContent(electronicDocument.Data); - if (!string.IsNullOrEmpty(electronicDocument.ContentType)) - content_electronicDocument_.Headers.ContentType = MediaTypeHeaderValue.Parse(electronicDocument.ContentType); - content_.Add(content_electronicDocument_, "electronicDocument", electronicDocument.FileName ?? "electronicDocument"); - } - if (request == null) - throw new ArgumentNullException("request"); - else - { - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); - content_.Add(new StringContent(json_), "request"); - } - request_.Content = content_; - request_.Method = new HttpMethod("POST"); + if (prefer != null) + request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); + request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -549,7 +177,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await ImportDocumentSendAsync(request_, client_, disposeClient_, cancellationToken); + return await ListAttributesSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -559,7 +187,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task ImportDocumentSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task ListAttributesSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -575,9 +203,9 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 201) + if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -587,7 +215,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() else if (status_ == 400) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -616,26 +244,6 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } else if (status_ == 404) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - if (status_ == 409) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - if (status_ == 413) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) @@ -655,16 +263,6 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 500) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw ApiExceptionExtensions.Create(status_, headers_, responseData_, JsonSerializerSettings, null); @@ -678,34 +276,34 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Returns a single entry object. + /// Returns an attribute object associated with the authenticated user. /// /// - /// - Returns a single entry object.
- /// - Provide an entry ID, and get the entry associated with that ID. Useful when detailed information about the entry is required, such as metadata, path information, etc.
- /// - Allowed OData query options: Select. If the entry is a subtype (Folder, Document, or Shortcut), the entry will automatically be converted to include those model-specific properties. + /// - Returns the attribute associated with the key. Alternatively, return the attribute associated with the key within "Everyone" group.
+ /// - Optional query parameters: everyone (bool, default false). When true, the server only searches for the attribute value with the given key upon the authenticated users attributes. If false, only the authenticated users attributes will be queried.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. - /// The requested entry ID. - /// Limits the properties returned in the result. + /// The requested repository ID. + /// The requested attribute key. + /// Indicates if attributes associated with the "Everyone" group or the currently authenticated user is returned. The default value is false. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get entry successfully. + /// A single attribute associated with the authenticated user. /// A server side error occurred. - public virtual async Task GetEntryAsync(string repoId, int entryId, string select = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task GetAttributeAsync(string repositoryId, string attributeKey, bool? everyone = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); - if (entryId == null) - throw new ArgumentNullException("entryId"); + if (attributeKey == null) + throw new ArgumentNullException("attributeKey"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); - if (select != null) + urlBuilder_.Append("v2/Repositories/{repositoryId}/Attributes/{attributeKey}?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{attributeKey}", Uri.EscapeDataString(ConvertToString(attributeKey, CultureInfo.InvariantCulture))); + if (everyone != null) { - urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Append(Uri.EscapeDataString("everyone") + "=").Append(Uri.EscapeDataString(ConvertToString(everyone, CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; @@ -725,7 +323,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetEntrySendAsync(request_, client_, disposeClient_, cancellationToken); + return await GetAttributeSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -735,7 +333,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetEntrySendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task GetAttributeSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -753,7 +351,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -823,375 +421,207 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - /// - /// Deletes an entry asynchronously. - /// - /// - /// - Begins a task to delete an entry, and returns an operationToken.
- /// - Provide an entry ID, and queue a delete task to remove it from the repository (includes nested objects if the entry is a Folder type). The entry will not be deleted immediately.
- /// - Optionally include an audit reason ID and comment in the JSON body. This route returns an operationToken, and will run as an asynchronous operation. Check the progress via the Tasks/{operationToken} route. - ///
- /// The requested repository ID. - /// The requested entry ID. - /// The submitted audit reason. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Delete entry operation start successfully. - /// A server side error occurred. - public virtual async Task DeleteEntryInfoAsync(string repoId, int entryId, DeleteEntryWithAuditReason request = null, CancellationToken cancellationToken = default(CancellationToken)) + protected struct ObjectResponseResult { - if (repoId == null) - throw new ArgumentNullException("repoId"); - - if (entryId == null) - throw new ArgumentNullException("entryId"); - - var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); - - var client_ = _httpClient; - bool[] disposeClient_ = new bool[]{ false }; - try + public ObjectResponseResult(T responseObject, string responseText) { - using (var request_ = new HttpRequestMessage()) - { - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); - var content_ = new StringContent(json_); - content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new HttpMethod("DELETE"); - request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); + this.Object = responseObject; + this.Text = responseText; + } - PrepareRequest(client_, request_, urlBuilder_); + public T Object { get; } - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute); + public string Text { get; } + } - PrepareRequest(client_, request_, url_); + public bool ReadResponseAsString { get; set; } - return await DeleteEntryInfoSendAsync(request_, client_, disposeClient_, cancellationToken); - } - } - finally + protected virtual async Task> ReadObjectResponseAsync(HttpResponseMessage response, IReadOnlyDictionary> headers, CancellationToken cancellationToken) + { + if (response == null || response.Content == null) { - if (disposeClient_[0]) - client_.Dispose(); + return new ObjectResponseResult(default(T), string.Empty); } - } - protected virtual async Task DeleteEntryInfoSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) - { - var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try + if (ReadResponseAsString) { - var headers_ = Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 201) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - if (status_ == 401) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - if (status_ == 403) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - if (status_ == 404) + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); } - else - if (status_ == 413) + catch (Newtonsoft.Json.JsonException exception) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, responseText, JsonSerializerSettings, exception); } - else - if (status_ == 429) + } + else + { + try { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + using (var streamReader = new StreamReader(responseStream)) + using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) { - throw ApiExceptionExtensions.Create(status_, headers_, null); + var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); + var typedBody = serializer.Deserialize(jsonTextReader); + return new ObjectResponseResult(typedBody, string.Empty); } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } - else + catch (Newtonsoft.Json.JsonException exception) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw ApiExceptionExtensions.Create(status_, headers_, responseData_, JsonSerializerSettings, null); + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, exception); } } - finally - { - if (disposeResponse_) - response_.Dispose(); - } } - /// - /// Moves and/or renames an entry. - /// - /// - /// - Moves and/or renames an entry.
- /// - Move and/or rename an entry by passing in the new parent folder ID or name in the JSON body.
- /// - Optional parameter: autoRename (default false). If an entry already exists with the given name, the entry will be automatically renamed. - ///
- /// The requested repository ID. - /// The requested entry ID. - /// The request containing the folder ID that the entry will be moved to and the new name
- /// the entry will be renamed to. - /// An optional query parameter used to indicate if the entry should be automatically
- /// renamed if another entry already exists with the same name in the folder. The default value is false. - /// An optional query parameter used to indicate the locale that should be used.
- /// The value should be a standard language tag. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Moves and/or renames an entry successfully. - /// A server side error occurred. - public virtual async Task MoveOrRenameEntryAsync(string repoId, int entryId, PatchEntryRequest request = null, bool? autoRename = null, string culture = null, CancellationToken cancellationToken = default(CancellationToken)) + private string ConvertToString(object value, CultureInfo cultureInfo) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (value == null) + { + return ""; + } - if (entryId == null) - throw new ArgumentNullException("entryId"); + if (value is Enum) + { + var name = Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = CustomAttributeExtensions.GetCustomAttribute(field, typeof(EnumMemberAttribute)) + as EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } - var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); - if (autoRename != null) + var converted = Convert.ToString(Convert.ChangeType(value, Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) { - urlBuilder_.Append(Uri.EscapeDataString("autoRename") + "=").Append(Uri.EscapeDataString(ConvertToString(autoRename, CultureInfo.InvariantCulture))).Append("&"); + return Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } - if (culture != null) + else if (value is byte[]) { - urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); + return Convert.ToBase64String((byte[]) value); } - urlBuilder_.Length--; - - var client_ = _httpClient; - bool[] disposeClient_ = new bool[]{ false }; - try + else if (value.GetType().IsArray) { - using (var request_ = new HttpRequestMessage()) - { - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); - var content_ = new StringContent(json_); - content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new HttpMethod("PATCH"); - request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); + var array = Enumerable.OfType((Array) value); + return string.Join(",", Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); + } - PrepareRequest(client_, request_, urlBuilder_); + var result = Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute); + [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IAuditReasonsClient + { - PrepareRequest(client_, request_, url_); + /// + /// Returns the audit reasons associated with the authenticated user. + /// + /// + /// - Returns the audit reasons associated with the authenticated user. Inherited audit reasons are included.
+ /// - Only includes audit reasons associated with available API functionalities, like delete entry and export document.
+ /// - If the authenticated user does not have the appropriate Laserfiche feature right, the audit reasons associated with that feature right will not be included.
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of audit reasons. + /// A server side error occurred. + Task ListAuditReasonsAsync(string repositoryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); - return await MoveOrRenameEntrySendAsync(request_, client_, disposeClient_, cancellationToken); - } - } - finally - { - if (disposeClient_[0]) - client_.Dispose(); - } + } + + [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class AuditReasonsClient : BaseClient, IAuditReasonsClient + { + private HttpClient _httpClient; + private Lazy _settings; + + public AuditReasonsClient(HttpClient httpClient) + { + _httpClient = httpClient; + _settings = new Lazy(CreateSerializerSettings); } - protected virtual async Task MoveOrRenameEntrySendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { - var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } + var settings = new Newtonsoft.Json.JsonSerializerSettings(); + UpdateJsonSerializerSettings(settings); + return settings; + } - ProcessResponse(client_, response_); + protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - if (status_ == 401) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - if (status_ == 403) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - if (status_ == 404) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - if (status_ == 409) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - if (status_ == 413) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - if (status_ == 423) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - if (status_ == 429) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw ApiExceptionExtensions.Create(status_, headers_, responseData_, JsonSerializerSettings, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } + partial void PrepareRequest(HttpClient client, HttpRequestMessage request, string url); + partial void PrepareRequest(HttpClient client, HttpRequestMessage request, StringBuilder urlBuilder); + partial void ProcessResponse(HttpClient client, HttpResponseMessage response); /// - /// Returns a single entry object using the entry path. + /// Returns the audit reasons associated with the authenticated user. /// /// - /// - Returns a single entry object using the entry path.
- /// - Optional query parameter: fallbackToClosestAncestor. Use the fallbackToClosestAncestor query parameter to return the closest existing ancestor if the initial entry path is not found. + /// - Returns the audit reasons associated with the authenticated user. Inherited audit reasons are included.
+ /// - Only includes audit reasons associated with available API functionalities, like delete entry and export document.
+ /// - If the authenticated user does not have the appropriate Laserfiche feature right, the audit reasons associated with that feature right will not be included.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. - /// The requested entry path. - /// An optional query parameter used to indicate whether or not the closest ancestor in the path should be returned if the initial entry path is not found. The default value is false. + /// The requested repository ID. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get entry successfully. + /// A collection of audit reasons. /// A server side error occurred. - public virtual async Task GetEntryByPathAsync(string repoId, string fullPath, bool? fallbackToClosestAncestor = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task ListAuditReasonsAsync(string repositoryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/ByPath?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Append(Uri.EscapeDataString("fullPath") + "=").Append(Uri.EscapeDataString(fullPath != null ? ConvertToString(fullPath, CultureInfo.InvariantCulture) : "")).Append("&"); - if (fallbackToClosestAncestor != null) + urlBuilder_.Append("v2/Repositories/{repositoryId}/AuditReasons?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + if (select != null) { - urlBuilder_.Append(Uri.EscapeDataString("fallbackToClosestAncestor") + "=").Append(Uri.EscapeDataString(ConvertToString(fallbackToClosestAncestor, CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); + } + if (orderby != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); + } + if (top != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); + } + if (skip != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); + } + if (count != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; @@ -1201,6 +631,9 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { + + if (prefer != null) + request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); @@ -1211,7 +644,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetEntryByPathSendAsync(request_, client_, disposeClient_, cancellationToken); + return await ListAuditReasonsSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -1221,7 +654,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetEntryByPathSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task ListAuditReasonsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -1239,7 +672,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -1309,81 +742,215 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - /// - /// Returns the children entries of a folder. - /// - /// - /// - Returns the children entries of a folder in the repository.
- /// - Provide an entry ID (must be a folder), and get a paged listing of entries in that folder. Used as a way of navigating through the repository.
- /// - Default page size: 150. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. OData $OrderBy syntax should follow: "PropertyName direction,PropertyName2 direction". Sort order can be either value "asc" or "desc". Optional query parameters: groupByOrderType (bool). This query parameter decides if results are returned in groups based on their entry type. Entries returned in the listing are not automatically converted to their subtype (Folder, Shortcut, Document), so clients who want model-specific information should request it via the GET entry by ID route.
- /// - Optionally returns field values for the entries in the folder. Each field name needs to be specified in the request. Maximum limit of 10 field names.
- /// - If field values are requested, only the first value is returned if it is a multi value field.
- /// - Null or Empty field values should not be used to determine if a field is assigned to the entry. - ///
- /// The requested repository ID. - /// The folder ID. - /// An optional query parameter used to indicate if the result should be grouped by entry type or not. - /// Optional array of field names. Field values corresponding to the given field names will be returned for each entry. - /// Boolean for if field values should be formatted. Only applicable if Fields are specified. - /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. The formatFields query parameter must be set to true, otherwise
- /// culture will not be used for formatting. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get the children entries of a Folder successfully. - /// A server side error occurred. - public virtual async Task GetEntryListingAsync(string repoId, int entryId, bool? groupByEntryType = null, IEnumerable fields = null, bool? formatFields = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) + protected struct ObjectResponseResult { - if (repoId == null) - throw new ArgumentNullException("repoId"); + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } - if (entryId == null) - throw new ArgumentNullException("entryId"); + public T Object { get; } - var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Folder/children?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); - if (groupByEntryType != null) + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async Task> ReadObjectResponseAsync(HttpResponseMessage response, IReadOnlyDictionary> headers, CancellationToken cancellationToken) + { + if (response == null || response.Content == null) { - urlBuilder_.Append(Uri.EscapeDataString("groupByEntryType") + "=").Append(Uri.EscapeDataString(ConvertToString(groupByEntryType, CultureInfo.InvariantCulture))).Append("&"); + return new ObjectResponseResult(default(T), string.Empty); } - if (fields != null) + + if (ReadResponseAsString) { - foreach (var item_ in fields) { urlBuilder_.Append(Uri.EscapeDataString("fields") + "=").Append(Uri.EscapeDataString(ConvertToString(item_, CultureInfo.InvariantCulture))).Append("&"); } + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, responseText, JsonSerializerSettings, exception); + } } - if (formatFields != null) + else { - urlBuilder_.Append(Uri.EscapeDataString("formatFields") + "=").Append(Uri.EscapeDataString(ConvertToString(formatFields, CultureInfo.InvariantCulture))).Append("&"); + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + using (var streamReader = new StreamReader(responseStream)) + using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) + { + var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); + var typedBody = serializer.Deserialize(jsonTextReader); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, exception); + } } - if (culture != null) + } + + private string ConvertToString(object value, CultureInfo cultureInfo) + { + if (value == null) { - urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); + return ""; } - if (select != null) + + if (value is Enum) { - urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); + var name = Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = CustomAttributeExtensions.GetCustomAttribute(field, typeof(EnumMemberAttribute)) + as EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = Convert.ToString(Convert.ChangeType(value, Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } } - if (orderby != null) + else if (value is bool) { - urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); + return Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } - if (top != null) + else if (value is byte[]) { - urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); + return Convert.ToBase64String((byte[]) value); } - if (skip != null) + else if (value.GetType().IsArray) { - urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); + var array = Enumerable.OfType((Array) value); + return string.Join(",", Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } - if (count != null) + + var result = Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IFieldDefinitionsClient + { + + /// + /// Returns a single field definition object. + /// + /// + /// - Returns a single field definition associated with the specified ID.
+ /// - Useful when a route provides a minimal amount of details and more information about the specific field definition is needed.
+ /// - Allowed OData query options: Select
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The requested field definition ID. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. + /// Limits the properties returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A single field definition. + /// A server side error occurred. + Task GetFieldDefinitionAsync(string repositoryId, int fieldId, string culture = null, string select = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Returns the paged listing of the field definitions available in a repository. + /// + /// + /// - Returns a paged listing of field definitions available in the specified repository.
+ /// - Useful when trying to find a list of all field definitions available, rather than only those assigned to a specific entry/template.
+ /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of field definitions. + /// A server side error occurred. + Task ListFieldDefinitionsAsync(string repositoryId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); + + } + + [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class FieldDefinitionsClient : BaseClient, IFieldDefinitionsClient + { + private HttpClient _httpClient; + private Lazy _settings; + + public FieldDefinitionsClient(HttpClient httpClient) + { + _httpClient = httpClient; + _settings = new Lazy(CreateSerializerSettings); + } + + private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() + { + var settings = new Newtonsoft.Json.JsonSerializerSettings(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } + + partial void PrepareRequest(HttpClient client, HttpRequestMessage request, string url); + partial void PrepareRequest(HttpClient client, HttpRequestMessage request, StringBuilder urlBuilder); + partial void ProcessResponse(HttpClient client, HttpResponseMessage response); + + /// + /// Returns a single field definition object. + /// + /// + /// - Returns a single field definition associated with the specified ID.
+ /// - Useful when a route provides a minimal amount of details and more information about the specific field definition is needed.
+ /// - Allowed OData query options: Select
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The requested field definition ID. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. + /// Limits the properties returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A single field definition. + /// A server side error occurred. + public virtual async Task GetFieldDefinitionAsync(string repositoryId, int fieldId, string culture = null, string select = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); + + if (fieldId == null) + throw new ArgumentNullException("fieldId"); + + var urlBuilder_ = new StringBuilder(); + urlBuilder_.Append("v2/Repositories/{repositoryId}/FieldDefinitions/{fieldId}?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{fieldId}", Uri.EscapeDataString(ConvertToString(fieldId, CultureInfo.InvariantCulture))); + if (culture != null) { - urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); + } + if (select != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; @@ -1393,9 +960,6 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - - if (prefer != null) - request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); @@ -1406,7 +970,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetEntryListingSendAsync(request_, client_, disposeClient_, cancellationToken); + return await GetFieldDefinitionSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -1416,7 +980,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetEntryListingSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task GetFieldDefinitionSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -1434,7 +998,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -1505,43 +1069,57 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Creates/copies a new child entry in a folder. + /// Returns the paged listing of the field definitions available in a repository. /// /// - /// - Create/copy a new child entry in the designated folder.
- /// - Provide the parent folder ID, and based on the request body, copy or create a folder/shortcut as a child entry of the designated folder.
- /// - Optional parameter: autoRename (default false). If an entry already exists with the given name, the entry will be automatically renamed. + /// - Returns a paged listing of field definitions available in the specified repository.
+ /// - Useful when trying to find a list of all field definitions available, rather than only those assigned to a specific entry/template.
+ /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. - /// The folder ID that the entry will be created in. - /// The entry to create. - /// An optional query parameter used to indicate if the new entry should be automatically
- /// renamed if an entry already exists with the given name in the folder. The default value is false. - /// An optional query parameter used to indicate the locale that should be used.
- /// The value should be a standard language tag. + /// The requested repository ID. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Created a new child entry successfully. + /// A collection of field definitions. /// A server side error occurred. - public virtual async Task CreateOrCopyEntryAsync(string repoId, int entryId, PostEntryChildrenRequest request = null, bool? autoRename = null, string culture = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task ListFieldDefinitionsAsync(string repositoryId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); - - if (entryId == null) - throw new ArgumentNullException("entryId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Folder/children?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); - if (autoRename != null) - { - urlBuilder_.Append(Uri.EscapeDataString("autoRename") + "=").Append(Uri.EscapeDataString(ConvertToString(autoRename, CultureInfo.InvariantCulture))).Append("&"); - } + urlBuilder_.Append("v2/Repositories/{repositoryId}/FieldDefinitions?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); if (culture != null) { urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); } + if (select != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); + } + if (orderby != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); + } + if (top != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); + } + if (skip != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); + } + if (count != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); + } urlBuilder_.Length--; var client_ = _httpClient; @@ -1550,11 +1128,10 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); - var content_ = new StringContent(json_); - content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new HttpMethod("POST"); + + if (prefer != null) + request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); + request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -1564,7 +1141,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await CreateOrCopyEntrySendAsync(request_, client_, disposeClient_, cancellationToken); + return await ListFieldDefinitionsSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -1574,7 +1151,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task CreateOrCopyEntrySendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task ListFieldDefinitionsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -1590,9 +1167,9 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 201) + if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -1640,7 +1217,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 409) + if (status_ == 429) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) @@ -1650,82 +1227,217 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 413) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw ApiExceptionExtensions.Create(status_, headers_, responseData_, JsonSerializerSettings, null); } - else - if (status_ == 429) + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async Task> ReadObjectResponseAsync(HttpResponseMessage response, IReadOnlyDictionary> headers, CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) + var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, responseText, JsonSerializerSettings, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + using (var streamReader = new StreamReader(responseStream)) + using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) { - throw ApiExceptionExtensions.Create(status_, headers_, null); + var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); + var typedBody = serializer.Deserialize(jsonTextReader); + return new ObjectResponseResult(typedBody, string.Empty); } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } - else + catch (Newtonsoft.Json.JsonException exception) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw ApiExceptionExtensions.Create(status_, headers_, responseData_, JsonSerializerSettings, null); + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, exception); } } - finally + } + + private string ConvertToString(object value, CultureInfo cultureInfo) + { + if (value == null) { - if (disposeResponse_) - response_.Dispose(); + return ""; + } + + if (value is Enum) + { + var name = Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = CustomAttributeExtensions.GetCustomAttribute(field, typeof(EnumMemberAttribute)) + as EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = Convert.ToString(Convert.ChangeType(value, Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return Convert.ToBase64String((byte[]) value); + } + else if (value.GetType().IsArray) + { + var array = Enumerable.OfType((Array) value); + return string.Join(",", Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } + + var result = Convert.ToString(value, cultureInfo); + return result == null ? "" : result; } + } + + [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface ILinkDefinitionsClient + { /// - /// Returns the fields assigned to an entry. + /// Returns the link definitions associated with a repository. /// /// - /// - Returns the fields assigned to an entry.
- /// - Provide an entry ID, and get a paged listing of all fields assigned to that entry.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. + /// - Returns the link definitions in the repository.
+ /// - Provide a repository ID and get a paged listing of link definitions available in the repository. Useful when trying to display all link definitions available, not only links assigned to a specific entry.
+ /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. - /// The requested entry ID. + /// The requested repository ID. /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// An optional query parameter used to indicate if the field values should be formatted.
- /// The default value is false. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. The formatValue query parameter must be set to true, otherwise
- /// culture will not be used for formatting. /// Limits the properties returned in the result. /// Specifies the order in which items are returned. The maximum number of expressions is 5. /// Limits the number of items returned from a collection. /// Excludes the specified number of items of the queried collection from the result. /// Indicates whether the total count of items within a collection are returned in the result. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get field values successfully. + /// A collection of link definitions. + /// A server side error occurred. + Task ListLinkDefinitionsAsync(string repositoryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Returns a single link definition object. + /// + /// + /// - Returns a single link definition associated with the specified ID.
+ /// - Provide a link definition ID and get the associated link definition. Useful when a route provides a minimal amount of details and more information about the specific link definition is needed.
+ /// - Allowed OData query options: Select
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The requested link definition ID. + /// Limits the properties returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A single link definition. /// A server side error occurred. - public virtual async Task GetFieldValuesAsync(string repoId, int entryId, string prefer = null, bool? formatValue = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) + Task GetLinkDefinitionAsync(string repositoryId, int linkDefinitionId, string select = null, CancellationToken cancellationToken = default(CancellationToken)); + + } + + [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class LinkDefinitionsClient : BaseClient, ILinkDefinitionsClient + { + private HttpClient _httpClient; + private Lazy _settings; + + public LinkDefinitionsClient(HttpClient httpClient) + { + _httpClient = httpClient; + _settings = new Lazy(CreateSerializerSettings); + } + + private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { - if (repoId == null) - throw new ArgumentNullException("repoId"); + var settings = new Newtonsoft.Json.JsonSerializerSettings(); + UpdateJsonSerializerSettings(settings); + return settings; + } - if (entryId == null) - throw new ArgumentNullException("entryId"); + protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } + + partial void PrepareRequest(HttpClient client, HttpRequestMessage request, string url); + partial void PrepareRequest(HttpClient client, HttpRequestMessage request, StringBuilder urlBuilder); + partial void ProcessResponse(HttpClient client, HttpResponseMessage response); + + /// + /// Returns the link definitions associated with a repository. + /// + /// + /// - Returns the link definitions in the repository.
+ /// - Provide a repository ID and get a paged listing of link definitions available in the repository. Useful when trying to display all link definitions available, not only links assigned to a specific entry.
+ /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of link definitions. + /// A server side error occurred. + public virtual async Task ListLinkDefinitionsAsync(string repositoryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}/fields?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); - if (formatValue != null) - { - urlBuilder_.Append(Uri.EscapeDataString("formatValue") + "=").Append(Uri.EscapeDataString(ConvertToString(formatValue, CultureInfo.InvariantCulture))).Append("&"); - } - if (culture != null) - { - urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); - } + urlBuilder_.Append("v2/Repositories/{repositoryId}/LinkDefinitions?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); if (select != null) { urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); @@ -1767,7 +1479,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetFieldValuesSendAsync(request_, client_, disposeClient_, cancellationToken); + return await ListLinkDefinitionsSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -1777,7 +1489,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetFieldValuesSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task ListLinkDefinitionsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -1795,7 +1507,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -1866,35 +1578,35 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Updates the field values assigned to an entry. + /// Returns a single link definition object. /// /// - /// - Update the field values assigned to an entry.
- /// - Provide the new field values to assign to the entry, and remove/reset all previously assigned field values.
- /// - This is an overwrite action. The request body must include all desired field values, including any existing field values that should remain assigned to the entry. Field values that are not included in the request will be deleted from the entry. If the field value that is not included is part of a template, it will still be assigned (as required by the template), but its value will be reset. + /// - Returns a single link definition associated with the specified ID.
+ /// - Provide a link definition ID and get the associated link definition. Useful when a route provides a minimal amount of details and more information about the specific link definition is needed.
+ /// - Allowed OData query options: Select
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. - /// The entry ID of the entry that will have its fields updated. - /// An optional query parameter used to indicate the locale that should be used.
- /// The value should be a standard language tag. This may be used when setting field values with tokens. + /// The requested repository ID. + /// The requested link definition ID. + /// Limits the properties returned in the result. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Update field values successfully. + /// A single link definition. /// A server side error occurred. - public virtual async Task AssignFieldValuesAsync(string repoId, int entryId, IDictionary fieldsToUpdate = null, string culture = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task GetLinkDefinitionAsync(string repositoryId, int linkDefinitionId, string select = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); - if (entryId == null) - throw new ArgumentNullException("entryId"); + if (linkDefinitionId == null) + throw new ArgumentNullException("linkDefinitionId"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}/fields?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); - if (culture != null) + urlBuilder_.Append("v2/Repositories/{repositoryId}/LinkDefinitions/{linkDefinitionId}?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{linkDefinitionId}", Uri.EscapeDataString(ConvertToString(linkDefinitionId, CultureInfo.InvariantCulture))); + if (select != null) { - urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; @@ -1904,11 +1616,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(fieldsToUpdate, _settings.Value); - var content_ = new StringContent(json_); - content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new HttpMethod("PUT"); + request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -1918,7 +1626,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await AssignFieldValuesSendAsync(request_, client_, disposeClient_, cancellationToken); + return await GetLinkDefinitionSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -1928,7 +1636,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task AssignFieldValuesSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task GetLinkDefinitionSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -1946,7 +1654,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -1994,26 +1702,6 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 413) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - if (status_ == 423) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else if (status_ == 429) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); @@ -2036,234 +1724,642 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - /// - /// Returns the tags assigned to an entry. - /// - /// - /// - Returns the tags assigned to an entry.
- /// - Provide an entry ID, and get a paged listing of tags assigned to that entry.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. - ///
- /// The requested repository ID. - /// The requested entry ID. - /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get entry tags successfully. - /// A server side error occurred. - public virtual async Task GetTagsAssignedToEntryAsync(string repoId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) + protected struct ObjectResponseResult { - if (repoId == null) - throw new ArgumentNullException("repoId"); - - if (entryId == null) - throw new ArgumentNullException("entryId"); - - var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}/tags?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); - if (select != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); - } - if (orderby != null) + public ObjectResponseResult(T responseObject, string responseText) { - urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); + this.Object = responseObject; + this.Text = responseText; } - if (top != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); - } - if (skip != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); - } - if (count != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); - } - urlBuilder_.Length--; - - var client_ = _httpClient; - bool[] disposeClient_ = new bool[]{ false }; - try - { - using (var request_ = new HttpRequestMessage()) - { - - if (prefer != null) - request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); - request_.Method = new HttpMethod("GET"); - request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); - PrepareRequest(client_, request_, urlBuilder_); + public T Object { get; } - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute); + public string Text { get; } + } - PrepareRequest(client_, request_, url_); + public bool ReadResponseAsString { get; set; } - return await GetTagsAssignedToEntrySendAsync(request_, client_, disposeClient_, cancellationToken); - } - } - finally + protected virtual async Task> ReadObjectResponseAsync(HttpResponseMessage response, IReadOnlyDictionary> headers, CancellationToken cancellationToken) + { + if (response == null || response.Content == null) { - if (disposeClient_[0]) - client_.Dispose(); + return new ObjectResponseResult(default(T), string.Empty); } - } - protected virtual async Task GetTagsAssignedToEntrySendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) - { - var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try + if (ReadResponseAsString) { - var headers_ = Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); } - else - if (status_ == 401) + catch (Newtonsoft.Json.JsonException exception) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, responseText, JsonSerializerSettings, exception); } - else - if (status_ == 403) + } + else + { + try { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + using (var streamReader = new StreamReader(responseStream)) + using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) { - throw ApiExceptionExtensions.Create(status_, headers_, null); + var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); + var typedBody = serializer.Deserialize(jsonTextReader); + return new ObjectResponseResult(typedBody, string.Empty); } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } - else - if (status_ == 404) + catch (Newtonsoft.Json.JsonException exception) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, exception); } - else - if (status_ == 429) + } + } + + private string ConvertToString(object value, CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is Enum) + { + var name = Enum.GetName(value.GetType(), value); + if (name != null) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) + var field = IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) { - throw ApiExceptionExtensions.Create(status_, headers_, null); + var attribute = CustomAttributeExtensions.GetCustomAttribute(field, typeof(EnumMemberAttribute)) + as EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw ApiExceptionExtensions.Create(status_, headers_, responseData_, JsonSerializerSettings, null); + + var converted = Convert.ToString(Convert.ChangeType(value, Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; } } - finally + else if (value is bool) { - if (disposeResponse_) - response_.Dispose(); + return Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return Convert.ToBase64String((byte[]) value); + } + else if (value.GetType().IsArray) + { + var array = Enumerable.OfType((Array) value); + return string.Join(",", Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } + + var result = Convert.ToString(value, cultureInfo); + return result == null ? "" : result; } + } + + [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IEntriesClient + { /// - /// Assigns tags to an entry. + /// Requests Upload URLs to upload a large file in chunks. /// /// - /// - Assign tags to an entry.
- /// - Provide an entry ID and a list of tags to assign to that entry.
- /// - This is an overwrite action. The request must include all tags to assign to the entry, including existing tags that should remain assigned to the entry. + /// - Requests Upload URLs to upload a large file in chunks.
+ /// - Returns an UploadId and an array of URLs to which the file chunks should be written in the same order.
+ /// - To request a new batch of Upload URLs for the same file, set the value of UploadId to the one returned when the first batch of Upload URLs was requested. For requesting the first batch of Upload URLs, leave UploadId empty or null.
+ /// - Example: if a file is going to be uploaded in 10 chunks, the 10 Upload URLs can be retrieved by two successive calls to this api, each call requesting 5 Upload URLs. For this, the first call should have StartingPartNumber=1 and NumberOfParts=5, and the second call should have StartingPartNumber=6 and NumberOfParts=5, along with UploadId returned in the first call.
+ /// - Each Upload URL expires after 15 minutes.
+ /// - Each file chunk written to an Upload URL should be at least 5 MB and at most 5 GB. There is no minimum size limit for the last chunk.
+ /// - The value of NumberOfParts must be in the range [1, 100], meaning that in each call to this api, a maximum of 100 Upload URLs can be requested.
+ /// - The total number of Upload URLs for a single file is 1000, which means (StartingPartNumber + NumberOfParts) should be less than or equal to 1001.
+ /// - Required OAuth scope: repository.Write ///
- /// The requested repository ID. - /// The requested entry ID. - /// The tags to add. + /// The requested repository ID. + /// The request body. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Assign tags to an entry successfully. + /// A response containing an upload id and an array of upload URLs. /// A server side error occurred. - public virtual async Task AssignTagsAsync(string repoId, int entryId, PutTagRequest tagsToAdd = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (repoId == null) - throw new ArgumentNullException("repoId"); + Task CreateMultipartUploadUrlsAsync(string repositoryId, CreateMultipartUploadUrlsRequest request, CancellationToken cancellationToken = default(CancellationToken)); - if (entryId == null) - throw new ArgumentNullException("entryId"); + /// + /// Starts an asynchronous import task to import a document into a folder. + /// + /// + /// - Imports a new file in the specified folder. The file should be already written (in chunks) to the upload URLs obtained by calling the Upload api.
+ /// - This route does not support partial success.
+ /// - Required OAuth scope: repository.Write + ///
+ /// The requested repository ID. + /// The entry ID of the folder that the document will be created in. + /// The request body. + /// An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. This may be used when setting field values with tokens. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A long operation task id. + /// A server side error occurred. + Task StartImportUploadedPartsAsync(string repositoryId, int entryId, StartImportUploadedPartsRequest request = null, string culture = null, CancellationToken cancellationToken = default(CancellationToken)); - var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}/tags"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); + /// + /// Starts an asynchronous export task to export an entry. + /// + /// + /// - Starts an asynchronous export operation to export an entry.
+ /// - If successful, it returns a taskId which can be used to check the status of the export operation or download the export result, otherwise, it returns an error.
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The ID of entry to export. + /// The request body. + /// A comma-separated range of pages to include. Ex: 1,3,4 or 1-3,5-7,9. This value is ignored when part=Edoc. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A long operation task id. + /// A server side error occurred. + Task StartExportEntryAsync(string repositoryId, int entryId, StartExportEntryRequest request, string pageRange = null, CancellationToken cancellationToken = default(CancellationToken)); - var client_ = _httpClient; - bool[] disposeClient_ = new bool[]{ false }; - try - { - using (var request_ = new HttpRequestMessage()) - { - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(tagsToAdd, _settings.Value); - var content_ = new StringContent(json_); - content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new HttpMethod("PUT"); - request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); + /// + /// Starts an asynchronous copy task to copy an entry into a folder. + /// + /// + /// - Copy a new child entry in the designated folder async, and potentially return a taskId.
+ /// - Provide the parent folder ID, and copy an entry as a child of the designated folder.
+ /// - The status of the operation can be checked via the Tasks route.
+ /// - Token substitution in the name of the copied entry is not supported.
+ /// - Required OAuth scope: repository.Write + ///
+ /// The requested repository ID. + /// The folder ID that the entry will be created in. + /// The request body. + /// An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A long operation task id. + /// A server side error occurred. + Task StartCopyEntryAsync(string repositoryId, int entryId, StartCopyEntryRequest request, string culture = null, CancellationToken cancellationToken = default(CancellationToken)); - PrepareRequest(client_, request_, urlBuilder_); + /// + /// Starts an asynchronous delete task to delete an entry. + /// + /// + /// - Begins a task to delete an entry, and returns a taskId.
+ /// - Provide an entry ID, and queue a delete task to remove it from the repository (includes nested objects if the entry is a Folder type). The entry will not be deleted immediately.
+ /// - Optionally include an audit reason ID and comment in the JSON body. This route returns a taskId, and will run as an asynchronous operation. Check the progress via the Tasks route.
+ /// - Required OAuth scope: repository.Write + ///
+ /// The requested repository ID. + /// The requested entry ID. + /// The submitted audit reason. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A long operation task id. + /// A server side error occurred. + Task StartDeleteEntryAsync(string repositoryId, int entryId, StartDeleteEntryRequest request = null, CancellationToken cancellationToken = default(CancellationToken)); - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute); + /// + /// Returns a single entry object. + /// + /// + /// - Returns a single entry object.
+ /// - Provide an entry ID, and get the entry associated with that ID. Useful when detailed information about the entry is required, such as metadata, path information, etc.
+ /// - If the entry is a subtype (Folder, Document, or Shortcut), the entry will automatically be converted to include those model-specific properties.
+ /// - Allowed OData query options: Select.
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The requested entry ID. + /// Limits the properties returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A single entry. + /// A server side error occurred. + Task GetEntryAsync(string repositoryId, int entryId, string select = null, CancellationToken cancellationToken = default(CancellationToken)); - PrepareRequest(client_, request_, url_); + /// + /// Update an entry. (Move and/or Rename) + /// + /// + /// - Update an entry. (Move and/or Rename)
+ /// - Move an entry to a new folder by setting the ParentId in the request body.
+ /// - Rename an entry by setting the Name in the request body.
+ /// - Required OAuth scope: repository.Write + ///
+ /// The requested repository ID. + /// The requested entry ID. + /// The request containing the folder ID that the entry will be moved to and the new name the entry will be renamed to. + /// An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// The updated entry. + /// A server side error occurred. + Task UpdateEntryAsync(string repositoryId, int entryId, UpdateEntryRequest request, string culture = null, CancellationToken cancellationToken = default(CancellationToken)); - return await AssignTagsSendAsync(request_, client_, disposeClient_, cancellationToken); - } - } - finally - { - if (disposeClient_[0]) - client_.Dispose(); - } - } + /// + /// Imports a file into a folder (max length: 100 MB). + /// + /// + /// - Import a new document in the specified folder, and optionally assigns metadata.
+ /// - The import may fail if the file is greater than 100 MB or time out if it takes longer than 60 seconds. These values are subject to change at anytime. Use the long operation asynchronous import if you run into these restrictions.
+ /// - Required OAuth scope: repository.Write + ///
+ /// The requested repository ID. + /// The entry ID of the folder that the document will be created in. + /// An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. This may be used when setting field values with tokens. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// The created entry. + /// A server side error occurred. + Task ImportEntryAsync(string repositoryId, int entryId, string culture = null, FileParameter file = null, ImportEntryRequest request = null, CancellationToken cancellationToken = default(CancellationToken)); - protected virtual async Task AssignTagsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Exports an entry. + /// + /// + /// - Export an entry.
+ /// - The export may time out if it takes longer than 60 seconds. This value is subject to change at anytime. Use the long operation asynchronous export if you run into this restriction.
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The ID of entry to export. + /// The request body. + /// A comma-separated range of pages to include. Ex: 1,3,4 or 1-3,5-7,9. This value is ignored when exporting as Edoc. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A link to download the exported entry. + /// A server side error occurred. + Task ExportEntryAsync(string repositoryId, int entryId, ExportEntryRequest request, string pageRange = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Returns a single entry object using the entry path. + /// + /// + /// - Returns a single entry object using the entry path.
+ /// - Optional query parameter: fallbackToClosestAncestor. Use the fallbackToClosestAncestor query parameter to return the closest existing ancestor if the initial entry path is not found.
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The requested entry path. + /// An optional query parameter used to indicate whether or not the closest ancestor in the path should be returned if the initial entry path is not found. The default value is false. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// The found entry or ancestor entry. + /// A server side error occurred. + Task GetEntryByPathAsync(string repositoryId, string fullPath, bool? fallbackToClosestAncestor = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Returns the children entries of a folder. + /// + /// + /// - Returns the children entries of a folder in the repository.
+ /// - Provide an entry ID (must be a folder), and get a paged listing of entries in that folder. Used as a way of navigating through the repository.
+ /// - Entries returned in the listing are not automatically converted to their subtype (Folder, Shortcut, Document), so clients who want model-specific information should request it via the GET entry by ID route.
+ /// - Optional query parameters: groupByEntryType (bool). This query parameter decides if results are returned in groups based on their entry type.
+ /// - Optionally returns field values for the entries in the folder. Each field name needs to be specified in the request. Maximum limit of 10 field names. If field values are requested, only the first value is returned if it is a multi value field. The remaining field values can be retrieved via the GET fields route. Null or Empty field values should not be used to determine if a field is assigned to the entry.
+ /// - Default page size: 150. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. OData $OrderBy syntax should follow: "PropertyName direction,PropertyName2 direction". Sort order can be either value "asc" or "desc".
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The folder ID. + /// Indicates if the result should be grouped by entry type or not. The default value is false. + /// Optional array of field names. Field values corresponding to the given field names will be returned for each entry. + /// Indicates if field values should be formatted. Only applicable if Fields are specified. The default value is false. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. The formatFieldValues query parameter must be set to true, otherwise culture will not be used for formatting. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of children entries of a folder. + /// A server side error occurred. + Task ListEntriesAsync(string repositoryId, int entryId, bool? groupByEntryType = null, IEnumerable fields = null, bool? formatFieldValues = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Creates a new child entry in a folder. + /// + /// + /// - Create a new child entry in the designated folder.
+ /// - Provide the parent folder ID, and based on the request body, create a folder/shortcut as a child entry of the designated folder.
+ /// - Required OAuth scope: repository.Write + ///
+ /// The requested repository ID. + /// The folder ID that the entry will be created in. + /// The request body. + /// An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// The created entry. + /// A server side error occurred. + Task CreateEntryAsync(string repositoryId, int entryId, CreateEntryRequest request, string culture = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Returns the fields assigned to an entry. + /// + /// + /// - Returns the fields assigned to an entry.
+ /// - Provide an entry ID, and get a paged listing of all fields assigned to that entry.
+ /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The requested entry ID. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// An optional query parameter used to indicate if the field values should be formatted. The default value is false. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. The formatFieldValues query parameter must be set to true, otherwise culture will not be used for formatting. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of fields assigned to the entry. + /// A server side error occurred. + Task ListFieldsAsync(string repositoryId, int entryId, string prefer = null, bool? formatFieldValues = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Updates the field values assigned to an entry. + /// + /// + /// - Update the field values assigned to an entry.
+ /// - Provide the new field values to assign to the entry, and remove/reset all previously assigned field values.
+ /// - This is an overwrite action. The request body must include all desired field values, including any existing field values that should remain assigned to the entry. Field values that are not included in the request will be deleted from the entry. If the field value that is not included is part of a template, it will still be assigned (as required by the template), but its value will be reset.
+ /// - Required OAuth scope: repository.Write + ///
+ /// The requested repository ID. + /// The entry ID of the entry that will have its fields updated. + /// The request body. + /// An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. This may be used when setting field values with tokens. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of fields assigned to the entry. + /// A server side error occurred. + Task SetFieldsAsync(string repositoryId, int entryId, SetFieldsRequest request, string culture = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Returns the tags assigned to an entry. + /// + /// + /// - Returns the tags assigned to an entry.
+ /// - Provide an entry ID, and get a paged listing of tags assigned to that entry.
+ /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The requested entry ID. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of tags assigned to the entry. + /// A server side error occurred. + Task ListTagsAsync(string repositoryId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Assigns tags to an entry. + /// + /// + /// - Assign tags to an entry.
+ /// - Provide an entry ID and a list of tags to assign to that entry.
+ /// - This is an overwrite action. The request must include all tags to assign to the entry, including existing tags that should remain assigned to the entry.
+ /// - Required OAuth scope: repository.Write + ///
+ /// The requested repository ID. + /// The requested entry ID. + /// The tags to add. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of tags assigned to the entry. + /// A server side error occurred. + Task SetTagsAsync(string repositoryId, int entryId, SetTagsRequest request, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Assigns links to an entry. + /// + /// + /// - Assign links to an entry.
+ /// - Provide an entry ID and a list of links to assign to that entry.
+ /// - This is an overwrite action. The request must include all links to assign to the entry, including existing links that should remain assigned to the entry.
+ /// - Required OAuth scope: repository.Write + ///
+ /// The request repository ID. + /// The requested entry ID. + /// The request body. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of links assigned to the entry. + /// A server side error occurred. + Task SetLinksAsync(string repositoryId, int entryId, SetLinksRequest request, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Returns the links assigned to an entry. + /// + /// + /// - Returns the links assigned to an entry.
+ /// - Provide an entry ID, and get a paged listing of links assigned to that entry.
+ /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The requested entry ID. + /// An optional odata header. Can be used to set the maximum page size using odata.maxpagesize. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of links assigned to the entry. + /// A server side error occurred. + Task ListLinksAsync(string repositoryId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Copies a new child entry in a folder. + /// + /// + /// - Copy a new child entry in the designated folder.
+ /// - Provide the parent folder ID, and based on the request body, copy a child entry of the designated folder.
+ /// - Required OAuth scope: repository.Write + ///
+ /// The requested repository ID. + /// The folder ID that the entry will be created in. + /// The request body. + /// An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// The copied entry. + /// A server side error occurred. + Task CopyEntryAsync(string repositoryId, int entryId, CopyEntryRequest request, string culture = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Deletes the edoc associated with an entry. + /// + /// + /// - Delete the edoc associated with the provided entry ID.
+ /// - Required OAuth scope: repository.Write + ///
+ /// The requested repository ID. + /// The requested document ID. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// The updated entry. + /// A server side error occurred. + Task DeleteElectronicDocumentAsync(string repositoryId, int entryId, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Deletes the pages associated with an entry. + /// + /// + /// - Delete the pages associated with the provided entry ID. If no pageRange is specified, all pages will be deleted.
+ /// - Optional parameter: pageRange (default empty). The value should be a comma-separated string which contains non-overlapping single values, or page ranges. Ex: "1,2,3", "1-3,5", "2-7,10-12."
+ /// - Required OAuth scope: repository.Write + ///
+ /// The requested repository ID. + /// The requested document ID. + /// The pages to be deleted. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// The updated entry. + /// A server side error occurred. + Task DeletePagesAsync(string repositoryId, int entryId, string pageRange = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Returns the dynamic field logic values assigned to an entry. + /// + /// + /// - Returns dynamic field logic values with the current values of the fields in the template.
+ /// - Provide an entry ID and field values in the JSON body to get dynamic field logic values.
+ /// - Independent and non-dynamic fields in the request body will be ignored, and only related dynamic field logic values for the assigned template will be returned.
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The requested entry ID. + /// The request body. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of dynamic field values. + /// A server side error occurred. + Task>> ListDynamicFieldValuesAsync(string repositoryId, int entryId, ListDynamicFieldValuesRequest request, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Removes the currently assigned template from an entry. + /// + /// + /// - Remove the currently assigned template from the specified entry.
+ /// - Provide an entry ID to clear template value on.
+ /// - If the entry does not have a template assigned, no change will be made.
+ /// - Required OAuth scope: repository.Write + ///
+ /// The requested repository ID. + /// The ID of the entry that will have its template removed. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// The updated entry. + /// A server side error occurred. + Task RemoveTemplateAsync(string repositoryId, int entryId, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Assigns a template to an entry. + /// + /// + /// - Assign a template to an entry.
+ /// - Provide an entry ID, template name, and a list of template fields to assign to that entry.
+ /// - Only template values will be modified. Any existing independent fields on the entry will not be modified, nor will they be added if included in the request. The only modification to fields will only occur on templated fields. If the previously assigned template includes common template fields as the newly assigned template, the common field values will not be modified.
+ /// - Required OAuth scope: repository.Write + ///
+ /// The requested repository ID. + /// The ID of entry that will have its template updated. + /// The template and template fields that will be assigned to the entry. + /// An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. This may be used when setting field values with tokens. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// The updated entry. + /// A server side error occurred. + Task SetTemplateAsync(string repositoryId, int entryId, SetTemplateRequest request, string culture = null, CancellationToken cancellationToken = default(CancellationToken)); + + } + + [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class EntriesClient : BaseClient, IEntriesClient + { + private HttpClient _httpClient; + private Lazy _settings; + + public EntriesClient(HttpClient httpClient) + { + _httpClient = httpClient; + _settings = new Lazy(CreateSerializerSettings); + } + + private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() + { + var settings = new Newtonsoft.Json.JsonSerializerSettings(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } + + partial void PrepareRequest(HttpClient client, HttpRequestMessage request, string url); + partial void PrepareRequest(HttpClient client, HttpRequestMessage request, StringBuilder urlBuilder); + partial void ProcessResponse(HttpClient client, HttpResponseMessage response); + + /// + /// Requests Upload URLs to upload a large file in chunks. + /// + /// + /// - Requests Upload URLs to upload a large file in chunks.
+ /// - Returns an UploadId and an array of URLs to which the file chunks should be written in the same order.
+ /// - To request a new batch of Upload URLs for the same file, set the value of UploadId to the one returned when the first batch of Upload URLs was requested. For requesting the first batch of Upload URLs, leave UploadId empty or null.
+ /// - Example: if a file is going to be uploaded in 10 chunks, the 10 Upload URLs can be retrieved by two successive calls to this api, each call requesting 5 Upload URLs. For this, the first call should have StartingPartNumber=1 and NumberOfParts=5, and the second call should have StartingPartNumber=6 and NumberOfParts=5, along with UploadId returned in the first call.
+ /// - Each Upload URL expires after 15 minutes.
+ /// - Each file chunk written to an Upload URL should be at least 5 MB and at most 5 GB. There is no minimum size limit for the last chunk.
+ /// - The value of NumberOfParts must be in the range [1, 100], meaning that in each call to this api, a maximum of 100 Upload URLs can be requested.
+ /// - The total number of Upload URLs for a single file is 1000, which means (StartingPartNumber + NumberOfParts) should be less than or equal to 1001.
+ /// - Required OAuth scope: repository.Write + ///
+ /// The requested repository ID. + /// The request body. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A response containing an upload id and an array of upload URLs. + /// A server side error occurred. + public virtual async Task CreateMultipartUploadUrlsAsync(string repositoryId, CreateMultipartUploadUrlsRequest request, CancellationToken cancellationToken = default(CancellationToken)) + { + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); + + if (request == null) + throw new ArgumentNullException("request"); + + var urlBuilder_ = new StringBuilder(); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/CreateMultipartUploadUrls"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + bool[] disposeClient_ = new bool[]{ false }; + try + { + using (var request_ = new HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); + var content_ = new StringContent(json_); + content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new HttpMethod("POST"); + request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + return await CreateMultipartUploadUrlsSendAsync(request_, client_, disposeClient_, cancellationToken); + } + } + finally + { + if (disposeClient_[0]) + client_.Dispose(); + } + } + + protected virtual async Task CreateMultipartUploadUrlsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -2281,7 +2377,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -2339,16 +2435,6 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 423) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else if (status_ == 429) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); @@ -2372,30 +2458,37 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Assigns links to an entry. + /// Starts an asynchronous import task to import a document into a folder. /// /// - /// - Assign links to an entry.
- /// - Provide an entry ID and a list of links to assign to that entry.
- /// - This is an overwrite action. The request must include all links to assign to the entry, including existing links that should remain assigned to the entry. + /// - Imports a new file in the specified folder. The file should be already written (in chunks) to the upload URLs obtained by calling the Upload api.
+ /// - This route does not support partial success.
+ /// - Required OAuth scope: repository.Write ///
- /// The request repository ID. - /// The requested entry ID. + /// The requested repository ID. + /// The entry ID of the folder that the document will be created in. + /// The request body. + /// An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. This may be used when setting field values with tokens. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Assign links to an entry successfully. + /// A long operation task id. /// A server side error occurred. - public virtual async Task AssignEntryLinksAsync(string repoId, int entryId, IEnumerable linksToAdd = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task StartImportUploadedPartsAsync(string repositoryId, int entryId, StartImportUploadedPartsRequest request = null, string culture = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); if (entryId == null) throw new ArgumentNullException("entryId"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}/links"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}/Folder/ImportUploadedParts?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); + if (culture != null) + { + urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; var client_ = _httpClient; bool[] disposeClient_ = new bool[]{ false }; @@ -2403,11 +2496,11 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(linksToAdd, _settings.Value); + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); var content_ = new StringContent(json_); content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; - request_.Method = new HttpMethod("PUT"); + request_.Method = new HttpMethod("POST"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -2417,7 +2510,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await AssignEntryLinksSendAsync(request_, client_, disposeClient_, cancellationToken); + return await StartImportUploadedPartsSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -2427,7 +2520,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task AssignEntryLinksSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task StartImportUploadedPartsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -2443,9 +2536,9 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 200) + if (status_ == 202) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -2503,7 +2596,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 423) + if (status_ == 429) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) @@ -2513,7 +2606,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 429) + if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) @@ -2536,55 +2629,38 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Returns the links assigned to an entry. + /// Starts an asynchronous export task to export an entry. /// /// - /// - Returns the links assigned to an entry.
- /// - Provide an entry ID, and get a paged listing of links assigned to that entry.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. + /// - Starts an asynchronous export operation to export an entry.
+ /// - If successful, it returns a taskId which can be used to check the status of the export operation or download the export result, otherwise, it returns an error.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. - /// The requested entry ID. - /// An optional odata header. Can be used to set the maximum page size using odata.maxpagesize. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. + /// The requested repository ID. + /// The ID of entry to export. + /// The request body. + /// A comma-separated range of pages to include. Ex: 1,3,4 or 1-3,5-7,9. This value is ignored when part=Edoc. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get links successfully. + /// A long operation task id. /// A server side error occurred. - public virtual async Task GetLinkValuesFromEntryAsync(string repoId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task StartExportEntryAsync(string repositoryId, int entryId, StartExportEntryRequest request, string pageRange = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); if (entryId == null) throw new ArgumentNullException("entryId"); + if (request == null) + throw new ArgumentNullException("request"); + var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}/links?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}/ExportAsync?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); - if (select != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); - } - if (orderby != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); - } - if (top != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); - } - if (skip != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); - } - if (count != null) + if (pageRange != null) { - urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Append(Uri.EscapeDataString("pageRange") + "=").Append(Uri.EscapeDataString(ConvertToString(pageRange, CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; @@ -2594,10 +2670,11 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - - if (prefer != null) - request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); - request_.Method = new HttpMethod("GET"); + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); + var content_ = new StringContent(json_); + content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new HttpMethod("POST"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -2607,7 +2684,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetLinkValuesFromEntrySendAsync(request_, client_, disposeClient_, cancellationToken); + return await StartExportEntrySendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -2617,7 +2694,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetLinkValuesFromEntrySendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task StartExportEntrySendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -2633,9 +2710,9 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 200) + if (status_ == 202) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -2683,6 +2760,16 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else + if (status_ == 413) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else if (status_ == 429) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); @@ -2693,6 +2780,16 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw ApiExceptionExtensions.Create(status_, headers_, responseData_, JsonSerializerSettings, null); @@ -2706,41 +2803,37 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Copies an entry into a folder asynchronously. + /// Starts an asynchronous copy task to copy an entry into a folder. /// /// - /// - Copy a new child entry in the designated folder async, and potentially return an operationToken.
+ /// - Copy a new child entry in the designated folder async, and potentially return a taskId.
/// - Provide the parent folder ID, and copy an entry as a child of the designated folder.
- /// - Optional parameter: autoRename (default false). If an entry already exists with the given name, the entry will be automatically renamed.
- /// - The status of the operation can be checked via the Tasks/{operationToken} route.
- /// - Token substitution in the name of the copied entry is not supported. + /// - The status of the operation can be checked via the Tasks route.
+ /// - Token substitution in the name of the copied entry is not supported.
+ /// - Required OAuth scope: repository.Write ///
- /// The requested repository ID. + /// The requested repository ID. /// The folder ID that the entry will be created in. - /// Copy entry request. - /// An optional query parameter used to indicate if the new entry should be automatically
- /// renamed if an entry already exists with the given name in the folder. The default value is false. - /// An optional query parameter used to indicate the locale that should be used.
- /// The value should be a standard language tag. + /// The request body. + /// An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Copy entry operation is started successfully. + /// A long operation task id. /// A server side error occurred. - public virtual async Task CopyEntryAsync(string repoId, int entryId, CopyAsyncRequest request = null, bool? autoRename = null, string culture = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task StartCopyEntryAsync(string repositoryId, int entryId, StartCopyEntryRequest request, string culture = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); if (entryId == null) throw new ArgumentNullException("entryId"); + if (request == null) + throw new ArgumentNullException("request"); + var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Folder/CopyAsync?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}/Folder/CopyAsync?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); - if (autoRename != null) - { - urlBuilder_.Append(Uri.EscapeDataString("autoRename") + "=").Append(Uri.EscapeDataString(ConvertToString(autoRename, CultureInfo.InvariantCulture))).Append("&"); - } if (culture != null) { urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); @@ -2767,7 +2860,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await CopyEntrySendAsync(request_, client_, disposeClient_, cancellationToken); + return await StartCopyEntrySendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -2777,7 +2870,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task CopyEntrySendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task StartCopyEntrySendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -2793,9 +2886,9 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 201) + if (status_ == 202) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -2876,27 +2969,31 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Deletes the edoc associated with an entry. + /// Starts an asynchronous delete task to delete an entry. /// /// - /// - Delete the edoc associated with the provided entry ID. + /// - Begins a task to delete an entry, and returns a taskId.
+ /// - Provide an entry ID, and queue a delete task to remove it from the repository (includes nested objects if the entry is a Folder type). The entry will not be deleted immediately.
+ /// - Optionally include an audit reason ID and comment in the JSON body. This route returns a taskId, and will run as an asynchronous operation. Check the progress via the Tasks route.
+ /// - Required OAuth scope: repository.Write ///
- /// The requested repository ID. - /// The requested document ID. + /// The requested repository ID. + /// The requested entry ID. + /// The submitted audit reason. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Deleted edoc successfully. + /// A long operation task id. /// A server side error occurred. - public virtual async Task DeleteDocumentAsync(string repoId, int entryId, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task StartDeleteEntryAsync(string repositoryId, int entryId, StartDeleteEntryRequest request = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); if (entryId == null) throw new ArgumentNullException("entryId"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Document/edoc"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); var client_ = _httpClient; @@ -2905,6 +3002,10 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); + var content_ = new StringContent(json_); + content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; request_.Method = new HttpMethod("DELETE"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); @@ -2915,7 +3016,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await DeleteDocumentSendAsync(request_, client_, disposeClient_, cancellationToken); + return await StartDeleteEntrySendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -2925,7 +3026,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task DeleteDocumentSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task StartDeleteEntrySendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -2941,9 +3042,9 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 200) + if (status_ == 202) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -2991,7 +3092,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 423) + if (status_ == 413) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) @@ -3024,31 +3125,38 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Returns information about the edoc content of an entry. + /// Returns a single entry object. /// /// - /// - Returns information about the edoc content of an entry, without downloading the edoc in its entirety.
- /// - Provide an entry ID, and get back the Content-Type and Content-Length in the response headers.
- /// - This route does not provide a way to download the actual edoc. Instead, it just gives metadata information about the edoc associated with the entry.
- /// - If an error occurs, the error message can be found in the X-APIServer-Error HTTP response header. + /// - Returns a single entry object.
+ /// - Provide an entry ID, and get the entry associated with that ID. Useful when detailed information about the entry is required, such as metadata, path information, etc.
+ /// - If the entry is a subtype (Folder, Document, or Shortcut), the entry will automatically be converted to include those model-specific properties.
+ /// - Allowed OData query options: Select.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. - /// The requested document ID. + /// The requested repository ID. + /// The requested entry ID. + /// Limits the properties returned in the result. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get edoc info successfully. + /// A single entry. /// A server side error occurred. - public virtual async Task GetDocumentContentTypeAsync(string repoId, int entryId, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task GetEntryAsync(string repositoryId, int entryId, string select = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); if (entryId == null) throw new ArgumentNullException("entryId"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Document/edoc"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); + if (select != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; var client_ = _httpClient; bool[] disposeClient_ = new bool[]{ false }; @@ -3056,7 +3164,8 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - request_.Method = new HttpMethod("HEAD"); + request_.Method = new HttpMethod("GET"); + request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -3065,7 +3174,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetDocumentContentTypeSendAsync(request_, client_, disposeClient_, cancellationToken); + return await GetEntrySendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -3075,7 +3184,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetDocumentContentTypeSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task GetEntrySendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -3093,43 +3202,62 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - return new HttpResponseHead(status_, headers_); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + return objectResponse_.Object; } else if (status_ == 400) { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw ApiExceptionExtensions.Create(status_, headers_, responseText_, JsonSerializerSettings, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else if (status_ == 401) { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw ApiExceptionExtensions.Create(status_, headers_, responseText_, JsonSerializerSettings, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else if (status_ == 403) { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw ApiExceptionExtensions.Create(status_, headers_, responseText_, JsonSerializerSettings, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else if (status_ == 404) { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw ApiExceptionExtensions.Create(status_, headers_, responseText_, JsonSerializerSettings, null); - } - else - if (status_ == 423) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw ApiExceptionExtensions.Create(status_, headers_, responseText_, JsonSerializerSettings, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else if (status_ == 429) { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw ApiExceptionExtensions.Create(status_, headers_, responseText_, JsonSerializerSettings, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else { @@ -3145,32 +3273,41 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Returns an entry's edoc resource in a stream format. + /// Update an entry. (Move and/or Rename) /// /// - /// - Returns an entry's edoc resource in a stream format.
- /// - Provide an entry ID, and get the edoc resource as part of the response content.
- /// - Optional header: Range. Use the Range header (single range with byte unit) to retrieve partial content of the edoc, rather than the entire edoc. + /// - Update an entry. (Move and/or Rename)
+ /// - Move an entry to a new folder by setting the ParentId in the request body.
+ /// - Rename an entry by setting the Name in the request body.
+ /// - Required OAuth scope: repository.Write ///
- /// The requested repository ID. - /// The requested document ID. - /// An optional header used to retrieve partial content of the edoc. Only supports single
- /// range with byte unit. + /// The requested repository ID. + /// The requested entry ID. + /// The request containing the folder ID that the entry will be moved to and the new name the entry will be renamed to. + /// An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get edoc successfully. + /// The updated entry. /// A server side error occurred. - public virtual async Task ExportDocumentAsync(string repoId, int entryId, string range = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task UpdateEntryAsync(string repositoryId, int entryId, UpdateEntryRequest request, string culture = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); if (entryId == null) throw new ArgumentNullException("entryId"); + if (request == null) + throw new ArgumentNullException("request"); + var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Document/edoc"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); + if (culture != null) + { + urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; var client_ = _httpClient; bool[] disposeClient_ = new bool[]{ false }; @@ -3178,11 +3315,12 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - - if (range != null) - request_.Headers.TryAddWithoutValidation("Range", ConvertToString(range, CultureInfo.InvariantCulture)); - request_.Method = new HttpMethod("GET"); - request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/octet-stream")); + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); + var content_ = new StringContent(json_); + content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new HttpMethod("PATCH"); + request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -3191,7 +3329,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await ExportDocumentSendAsync(request_, client_, disposeClient_, cancellationToken); + return await UpdateEntrySendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -3201,7 +3339,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task ExportDocumentSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task UpdateEntrySendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -3217,20 +3355,14 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 200 || status_ == 206) - { - var responseStream_ = response_.Content == null ? Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); - var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_); - disposeClient_[0] = false; disposeResponse_ = false; // response and client are disposed by FileResponse - return fileResponse_; - } - else - if (status_ == 206) + if (status_ == 200) { - var responseStream_ = response_.Content == null ? Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); - var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_); - disposeClient_[0] = false; disposeResponse_ = false; // response and client are disposed by FileResponse - return fileResponse_; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + return objectResponse_.Object; } else if (status_ == 400) @@ -3273,6 +3405,26 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else + if (status_ == 409) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else + if (status_ == 413) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else if (status_ == 423) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); @@ -3306,33 +3458,34 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Deletes the pages associated with an entry. + /// Imports a file into a folder (max length: 100 MB). /// /// - /// - Delete the pages associated with the provided entry ID. If no pageRange is specified, all pages will be deleted.
- /// - Optional parameter: pageRange (default empty). The value should be a comma-seperated string which contains non-overlapping single values, or page ranges. Ex: "1,2,3", "1-3,5", "2-7,10-12." + /// - Import a new document in the specified folder, and optionally assigns metadata.
+ /// - The import may fail if the file is greater than 100 MB or time out if it takes longer than 60 seconds. These values are subject to change at anytime. Use the long operation asynchronous import if you run into these restrictions.
+ /// - Required OAuth scope: repository.Write ///
- /// The requested repository ID. - /// The requested document ID. - /// The pages to be deleted. + /// The requested repository ID. + /// The entry ID of the folder that the document will be created in. + /// An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. This may be used when setting field values with tokens. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Deleted pages successfully. + /// The created entry. /// A server side error occurred. - public virtual async Task DeletePagesAsync(string repoId, int entryId, string pageRange = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task ImportEntryAsync(string repositoryId, int entryId, string culture = null, FileParameter file = null, ImportEntryRequest request = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); if (entryId == null) throw new ArgumentNullException("entryId"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Document/pages?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}/Folder/Import?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); - if (pageRange != null) + if (culture != null) { - urlBuilder_.Append(Uri.EscapeDataString("pageRange") + "=").Append(Uri.EscapeDataString(ConvertToString(pageRange, CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; @@ -3342,7 +3495,30 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - request_.Method = new HttpMethod("DELETE"); + var boundary_ = Guid.NewGuid().ToString(); + var content_ = new MultipartFormDataContent(boundary_); + content_.Headers.Remove("Content-Type"); + content_.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + boundary_); + + if (file == null) + throw new ArgumentNullException("file"); + else + { + var content_file_ = new StreamContent(file.Data); + if (!string.IsNullOrEmpty(file.ContentType)) + content_file_.Headers.ContentType = MediaTypeHeaderValue.Parse(file.ContentType); + content_.Add(content_file_, "file", file.FileName ?? "file"); + } + + if (request == null) + throw new ArgumentNullException("request"); + else + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); + content_.Add(new StringContent(json_), "request"); + } + request_.Content = content_; + request_.Method = new HttpMethod("POST"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -3352,7 +3528,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await DeletePagesSendAsync(request_, client_, disposeClient_, cancellationToken); + return await ImportEntrySendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -3362,7 +3538,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task DeletePagesSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task ImportEntrySendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -3378,9 +3554,9 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 200) + if (status_ == 201) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -3428,7 +3604,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 423) + if (status_ == 413) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) @@ -3448,6 +3624,16 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw ApiExceptionExtensions.Create(status_, headers_, responseData_, JsonSerializerSettings, null); @@ -3461,32 +3647,40 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Returns an entry's edoc resource in a stream format, including an audit reason. + /// Exports an entry. /// /// - /// - Returns an entry's edoc resource in a stream format while including an audit reason.
- /// - Provide an entry ID and audit reason/comment in the request body, and get the edoc resource as part of the response content.
- /// - Optional header: Range. Use the Range header (single range with byte unit) to retrieve partial content of the edoc, rather than the entire edoc. This route is identical to the GET edoc route, but allows clients to include an audit reason when downloading the edoc. + /// - Export an entry.
+ /// - The export may time out if it takes longer than 60 seconds. This value is subject to change at anytime. Use the long operation asynchronous export if you run into this restriction.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. - /// The requested document ID. - /// An optional header used to retrieve partial content of the edoc. Only supports single
- /// range with byte unit. + /// The requested repository ID. + /// The ID of entry to export. + /// The request body. + /// A comma-separated range of pages to include. Ex: 1,3,4 or 1-3,5-7,9. This value is ignored when exporting as Edoc. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get edoc successfully. + /// A link to download the exported entry. /// A server side error occurred. - public virtual async Task ExportDocumentWithAuditReasonAsync(string repoId, int entryId, GetEdocWithAuditReasonRequest request = null, string range = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task ExportEntryAsync(string repositoryId, int entryId, ExportEntryRequest request, string pageRange = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); if (entryId == null) throw new ArgumentNullException("entryId"); + if (request == null) + throw new ArgumentNullException("request"); + var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Document/GetEdocWithAuditReason"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}/Export?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); + if (pageRange != null) + { + urlBuilder_.Append(Uri.EscapeDataString("pageRange") + "=").Append(Uri.EscapeDataString(ConvertToString(pageRange, CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; var client_ = _httpClient; bool[] disposeClient_ = new bool[]{ false }; @@ -3494,15 +3688,12 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - - if (range != null) - request_.Headers.TryAddWithoutValidation("Range", ConvertToString(range, CultureInfo.InvariantCulture)); var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); var content_ = new StringContent(json_); content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; request_.Method = new HttpMethod("POST"); - request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/octet-stream")); + request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -3511,7 +3702,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await ExportDocumentWithAuditReasonSendAsync(request_, client_, disposeClient_, cancellationToken); + return await ExportEntrySendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -3521,7 +3712,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task ExportDocumentWithAuditReasonSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task ExportEntrySendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -3537,20 +3728,14 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 200 || status_ == 206) - { - var responseStream_ = response_.Content == null ? Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); - var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_); - disposeClient_[0] = false; disposeResponse_ = false; // response and client are disposed by FileResponse - return fileResponse_; - } - else - if (status_ == 206) + if (status_ == 200) { - var responseStream_ = response_.Content == null ? Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); - var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_); - disposeClient_[0] = false; disposeResponse_ = false; // response and client are disposed by FileResponse - return fileResponse_; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + return objectResponse_.Object; } else if (status_ == 400) @@ -3623,6 +3808,16 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw ApiExceptionExtensions.Create(status_, headers_, responseData_, JsonSerializerSettings, null); @@ -3636,30 +3831,36 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Returns the dynamic field logic values assigned to an entry. + /// Returns a single entry object using the entry path. /// /// - /// - Returns dynamic field logic values with the current values of the fields in the template.
- /// - Provide an entry ID and field values in the JSON body to get dynamic field logic values.
- /// Independent and non-dynamic fields in the request body will be ignored, and only related dynamic field logic values for the assigned template will be returned. + /// - Returns a single entry object using the entry path.
+ /// - Optional query parameter: fallbackToClosestAncestor. Use the fallbackToClosestAncestor query parameter to return the closest existing ancestor if the initial entry path is not found.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. - /// The requested entry ID. + /// The requested repository ID. + /// The requested entry path. + /// An optional query parameter used to indicate whether or not the closest ancestor in the path should be returned if the initial entry path is not found. The default value is false. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get dynamic field logic values successfully. + /// The found entry or ancestor entry. /// A server side error occurred. - public virtual async Task>> GetDynamicFieldValuesAsync(string repoId, int entryId, GetDynamicFieldLogicValueRequest request = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task GetEntryByPathAsync(string repositoryId, string fullPath, bool? fallbackToClosestAncestor = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); - if (entryId == null) - throw new ArgumentNullException("entryId"); + if (fullPath == null) + throw new ArgumentNullException("fullPath"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}/fields/GetDynamicFieldLogicValue"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/ByPath?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Append(Uri.EscapeDataString("fullPath") + "=").Append(Uri.EscapeDataString(ConvertToString(fullPath, CultureInfo.InvariantCulture))).Append("&"); + if (fallbackToClosestAncestor != null) + { + urlBuilder_.Append(Uri.EscapeDataString("fallbackToClosestAncestor") + "=").Append(Uri.EscapeDataString(ConvertToString(fallbackToClosestAncestor, CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; var client_ = _httpClient; bool[] disposeClient_ = new bool[]{ false }; @@ -3667,11 +3868,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); - var content_ = new StringContent(json_); - content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new HttpMethod("POST"); + request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -3681,7 +3878,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetDynamicFieldValuesSendAsync(request_, client_, disposeClient_, cancellationToken); + return await GetEntryByPathSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -3691,7 +3888,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task>> GetDynamicFieldValuesSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task GetEntryByPathSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -3709,7 +3906,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync>>(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -3757,16 +3954,6 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 413) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else if (status_ == 429) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); @@ -3790,30 +3977,81 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Removes the currently assigned template from an entry. + /// Returns the children entries of a folder. /// /// - /// - Remove the currently assigned template from the specified entry.
- /// - Provide an entry ID to clear template value on.
- /// - If the entry does not have a template assigned, no change will be made. + /// - Returns the children entries of a folder in the repository.
+ /// - Provide an entry ID (must be a folder), and get a paged listing of entries in that folder. Used as a way of navigating through the repository.
+ /// - Entries returned in the listing are not automatically converted to their subtype (Folder, Shortcut, Document), so clients who want model-specific information should request it via the GET entry by ID route.
+ /// - Optional query parameters: groupByEntryType (bool). This query parameter decides if results are returned in groups based on their entry type.
+ /// - Optionally returns field values for the entries in the folder. Each field name needs to be specified in the request. Maximum limit of 10 field names. If field values are requested, only the first value is returned if it is a multi value field. The remaining field values can be retrieved via the GET fields route. Null or Empty field values should not be used to determine if a field is assigned to the entry.
+ /// - Default page size: 150. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. OData $OrderBy syntax should follow: "PropertyName direction,PropertyName2 direction". Sort order can be either value "asc" or "desc".
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. - /// The ID of the entry that will have its template removed. + /// The requested repository ID. + /// The folder ID. + /// Indicates if the result should be grouped by entry type or not. The default value is false. + /// Optional array of field names. Field values corresponding to the given field names will be returned for each entry. + /// Indicates if field values should be formatted. Only applicable if Fields are specified. The default value is false. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. The formatFieldValues query parameter must be set to true, otherwise culture will not be used for formatting. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Remove the currently assigned template successfully. + /// A collection of children entries of a folder. /// A server side error occurred. - public virtual async Task DeleteAssignedTemplateAsync(string repoId, int entryId, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task ListEntriesAsync(string repositoryId, int entryId, bool? groupByEntryType = null, IEnumerable fields = null, bool? formatFieldValues = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); if (entryId == null) throw new ArgumentNullException("entryId"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}/template"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}/Folder/Children?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); + if (groupByEntryType != null) + { + urlBuilder_.Append(Uri.EscapeDataString("groupByEntryType") + "=").Append(Uri.EscapeDataString(ConvertToString(groupByEntryType, CultureInfo.InvariantCulture))).Append("&"); + } + if (fields != null) + { + foreach (var item_ in fields) { urlBuilder_.Append(Uri.EscapeDataString("fields") + "=").Append(Uri.EscapeDataString(ConvertToString(item_, CultureInfo.InvariantCulture))).Append("&"); } + } + if (formatFieldValues != null) + { + urlBuilder_.Append(Uri.EscapeDataString("formatFieldValues") + "=").Append(Uri.EscapeDataString(ConvertToString(formatFieldValues, CultureInfo.InvariantCulture))).Append("&"); + } + if (culture != null) + { + urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); + } + if (select != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); + } + if (orderby != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); + } + if (top != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); + } + if (skip != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); + } + if (count != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; var client_ = _httpClient; bool[] disposeClient_ = new bool[]{ false }; @@ -3821,7 +4059,10 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - request_.Method = new HttpMethod("DELETE"); + + if (prefer != null) + request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); + request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -3831,7 +4072,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await DeleteAssignedTemplateSendAsync(request_, client_, disposeClient_, cancellationToken); + return await ListEntriesSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -3841,7 +4082,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task DeleteAssignedTemplateSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task ListEntriesSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -3859,7 +4100,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -3907,16 +4148,6 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 423) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else if (status_ == 429) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); @@ -3940,32 +4171,34 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Assigns a template to an entry. + /// Creates a new child entry in a folder. /// /// - /// - Assign a template to an entry.
- /// - Provide an entry ID, template name, and a list of template fields to assign to that entry.
- /// - Only template values will be modified. Any existing independent fields on the entry will not be modified, nor will they be added if included in the request. The only modification to fields will only occur on templated fields. If the previously assigned template includes common template fields as the newly assigned template, the common field values will not be modified. + /// - Create a new child entry in the designated folder.
+ /// - Provide the parent folder ID, and based on the request body, create a folder/shortcut as a child entry of the designated folder.
+ /// - Required OAuth scope: repository.Write ///
- /// The requested repository ID. - /// The ID of entry that will have its template updated. - /// The template and template fields that will be assigned to the entry. - /// An optional query parameter used to indicate the locale that should be used.
- /// The value should be a standard language tag. This may be used when setting field values with tokens. + /// The requested repository ID. + /// The folder ID that the entry will be created in. + /// The request body. + /// An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Assign a template successfully. + /// The created entry. /// A server side error occurred. - public virtual async Task WriteTemplateValueToEntryAsync(string repoId, int entryId, PutTemplateRequest request = null, string culture = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task CreateEntryAsync(string repositoryId, int entryId, CreateEntryRequest request, string culture = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); if (entryId == null) throw new ArgumentNullException("entryId"); + if (request == null) + throw new ArgumentNullException("request"); + var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Entries/{entryId}/template?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}/Folder/Children?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); if (culture != null) { @@ -3983,7 +4216,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var content_ = new StringContent(json_); content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; - request_.Method = new HttpMethod("PUT"); + request_.Method = new HttpMethod("POST"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -3993,7 +4226,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await WriteTemplateValueToEntrySendAsync(request_, client_, disposeClient_, cancellationToken); + return await CreateEntrySendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -4003,7 +4236,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task WriteTemplateValueToEntrySendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task CreateEntrySendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -4019,7 +4252,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 200) + if (status_ == 201) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) @@ -4069,7 +4302,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 413) + if (status_ == 409) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) @@ -4079,7 +4312,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 423) + if (status_ == 413) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) @@ -4111,228 +4344,69 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected struct ObjectResponseResult + /// + /// Returns the fields assigned to an entry. + /// + /// + /// - Returns the fields assigned to an entry.
+ /// - Provide an entry ID, and get a paged listing of all fields assigned to that entry.
+ /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The requested entry ID. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// An optional query parameter used to indicate if the field values should be formatted. The default value is false. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. The formatFieldValues query parameter must be set to true, otherwise culture will not be used for formatting. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of fields assigned to the entry. + /// A server side error occurred. + public virtual async Task ListFieldsAsync(string repositoryId, int entryId, string prefer = null, bool? formatFieldValues = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); - protected virtual async Task> ReadObjectResponseAsync(HttpResponseMessage response, IReadOnlyDictionary> headers, CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } + if (entryId == null) + throw new ArgumentNullException("entryId"); - if (ReadResponseAsString) + var urlBuilder_ = new StringBuilder(); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}/Fields?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); + if (formatFieldValues != null) { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (Newtonsoft.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, responseText, JsonSerializerSettings, exception); - } + urlBuilder_.Append(Uri.EscapeDataString("formatFieldValues") + "=").Append(Uri.EscapeDataString(ConvertToString(formatFieldValues, CultureInfo.InvariantCulture))).Append("&"); } - else + if (culture != null) { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - using (var streamReader = new StreamReader(responseStream)) - using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) - { - var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); - var typedBody = serializer.Deserialize(jsonTextReader); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (Newtonsoft.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, exception); - } + urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); } - } - - private string ConvertToString(object value, CultureInfo cultureInfo) - { - if (value == null) + if (select != null) { - return ""; + urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); } - - if (value is Enum) + if (orderby != null) { - var name = Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = CustomAttributeExtensions.GetCustomAttribute(field, typeof(EnumMemberAttribute)) - as EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = Convert.ToString(Convert.ChangeType(value, Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } + urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); } - else if (value is bool) + if (top != null) { - return Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); } - else if (value is byte[]) + if (skip != null) { - return Convert.ToBase64String((byte[]) value); + urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); } - else if (value.GetType().IsArray) + if (count != null) { - var array = Enumerable.OfType((Array) value); - return string.Join(",", Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); + urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); } - - var result = Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial interface IAttributesClient - { - - /// - /// Returns the attribute key value pairs associated with the authenticated user. - /// - /// - /// - Returns the attribute key value pairs associated with the authenticated user. Alternatively, return only the attribute key value pairs that are associated with the "Everyone" group.
- /// - Attribute keys can be used with subsequent calls to get specific attribute values.
- /// - Default page size: 100. Allowed OData query options: Select, Count, OrderBy, Skip, Top, SkipToken, Prefer. Optional query parameters: everyone (bool, default false). When true, this route does not return the attributes that are tied to the currently authenticated user, but rather the attributes assigned to the "Everyone" group. Note when this is true, the response does not include both the "Everyone" groups attribute and the currently authenticated user, but only the "Everyone" groups. - ///
- /// The requested repository ID. - /// Boolean value that indicates whether to return attributes key value pairs associated with everyone or the currently authenticated user. - /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get trustee attribute key value pairs successfully. - /// A server side error occurred. - Task GetTrusteeAttributeKeyValuePairsAsync(string repoId, bool? everyone = null, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Returns an attribute object associated with the authenticated user. - /// - /// - /// - Returns the attribute associated with the key. Alternatively, return the attribute associated with the key within "Everyone" group.
- /// - Optional query parameters: everyone (bool, default false). When true, the server only searches for the attribute value with the given key upon the authenticated users attributes. If false, only the authenticated users attributes will be queried. - ///
- /// The requested repository ID. - /// The requested attribute key. - /// Boolean value that indicates whether to return attributes associated with everyone or the currently authenticated user. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get trustee attribute value successfully. - /// A server side error occurred. - Task GetTrusteeAttributeValueByKeyAsync(string repoId, string attributeKey, bool? everyone = null, CancellationToken cancellationToken = default(CancellationToken)); - - } - - [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class AttributesClient : BaseClient, IAttributesClient - { - private HttpClient _httpClient; - private Lazy _settings; - - public AttributesClient(HttpClient httpClient) - { - _httpClient = httpClient; - _settings = new Lazy(CreateSerializerSettings); - } - - private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() - { - var settings = new Newtonsoft.Json.JsonSerializerSettings(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } - - partial void PrepareRequest(HttpClient client, HttpRequestMessage request, string url); - partial void PrepareRequest(HttpClient client, HttpRequestMessage request, StringBuilder urlBuilder); - partial void ProcessResponse(HttpClient client, HttpResponseMessage response); - - /// - /// Returns the attribute key value pairs associated with the authenticated user. - /// - /// - /// - Returns the attribute key value pairs associated with the authenticated user. Alternatively, return only the attribute key value pairs that are associated with the "Everyone" group.
- /// - Attribute keys can be used with subsequent calls to get specific attribute values.
- /// - Default page size: 100. Allowed OData query options: Select, Count, OrderBy, Skip, Top, SkipToken, Prefer. Optional query parameters: everyone (bool, default false). When true, this route does not return the attributes that are tied to the currently authenticated user, but rather the attributes assigned to the "Everyone" group. Note when this is true, the response does not include both the "Everyone" groups attribute and the currently authenticated user, but only the "Everyone" groups. - ///
- /// The requested repository ID. - /// Boolean value that indicates whether to return attributes key value pairs associated with everyone or the currently authenticated user. - /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get trustee attribute key value pairs successfully. - /// A server side error occurred. - public virtual async Task GetTrusteeAttributeKeyValuePairsAsync(string repoId, bool? everyone = null, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (repoId == null) - throw new ArgumentNullException("repoId"); - - var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Attributes?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - if (everyone != null) - { - urlBuilder_.Append(Uri.EscapeDataString("everyone") + "=").Append(Uri.EscapeDataString(ConvertToString(everyone, CultureInfo.InvariantCulture))).Append("&"); - } - if (select != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); - } - if (orderby != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); - } - if (top != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); - } - if (skip != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); - } - if (count != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); - } - urlBuilder_.Length--; + urlBuilder_.Length--; var client_ = _httpClient; bool[] disposeClient_ = new bool[]{ false }; @@ -4353,7 +4427,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetTrusteeAttributeKeyValuePairsSendAsync(request_, client_, disposeClient_, cancellationToken); + return await ListFieldsSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -4363,7 +4437,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetTrusteeAttributeKeyValuePairsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task ListFieldsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -4381,7 +4455,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -4452,33 +4526,39 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Returns an attribute object associated with the authenticated user. + /// Updates the field values assigned to an entry. /// /// - /// - Returns the attribute associated with the key. Alternatively, return the attribute associated with the key within "Everyone" group.
- /// - Optional query parameters: everyone (bool, default false). When true, the server only searches for the attribute value with the given key upon the authenticated users attributes. If false, only the authenticated users attributes will be queried. + /// - Update the field values assigned to an entry.
+ /// - Provide the new field values to assign to the entry, and remove/reset all previously assigned field values.
+ /// - This is an overwrite action. The request body must include all desired field values, including any existing field values that should remain assigned to the entry. Field values that are not included in the request will be deleted from the entry. If the field value that is not included is part of a template, it will still be assigned (as required by the template), but its value will be reset.
+ /// - Required OAuth scope: repository.Write ///
- /// The requested repository ID. - /// The requested attribute key. - /// Boolean value that indicates whether to return attributes associated with everyone or the currently authenticated user. + /// The requested repository ID. + /// The entry ID of the entry that will have its fields updated. + /// The request body. + /// An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. This may be used when setting field values with tokens. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get trustee attribute value successfully. + /// A collection of fields assigned to the entry. /// A server side error occurred. - public virtual async Task GetTrusteeAttributeValueByKeyAsync(string repoId, string attributeKey, bool? everyone = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task SetFieldsAsync(string repositoryId, int entryId, SetFieldsRequest request, string culture = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); - if (attributeKey == null) - throw new ArgumentNullException("attributeKey"); + if (entryId == null) + throw new ArgumentNullException("entryId"); + + if (request == null) + throw new ArgumentNullException("request"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Attributes/{attributeKey}?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{attributeKey}", Uri.EscapeDataString(ConvertToString(attributeKey, CultureInfo.InvariantCulture))); - if (everyone != null) + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}/Fields?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); + if (culture != null) { - urlBuilder_.Append(Uri.EscapeDataString("everyone") + "=").Append(Uri.EscapeDataString(ConvertToString(everyone, CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; @@ -4488,7 +4568,11 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - request_.Method = new HttpMethod("GET"); + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); + var content_ = new StringContent(json_); + content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new HttpMethod("PUT"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -4498,7 +4582,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetTrusteeAttributeValueByKeySendAsync(request_, client_, disposeClient_, cancellationToken); + return await SetFieldsSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -4508,7 +4592,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetTrusteeAttributeValueByKeySendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task SetFieldsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -4526,7 +4610,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -4574,6 +4658,26 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else + if (status_ == 413) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else + if (status_ == 423) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else if (status_ == 429) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); @@ -4596,249 +4700,94 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected struct ObjectResponseResult + /// + /// Returns the tags assigned to an entry. + /// + /// + /// - Returns the tags assigned to an entry.
+ /// - Provide an entry ID, and get a paged listing of tags assigned to that entry.
+ /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The requested entry ID. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of tags assigned to the entry. + /// A server side error occurred. + public virtual async Task ListTagsAsync(string repositoryId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); - public bool ReadResponseAsString { get; set; } + if (entryId == null) + throw new ArgumentNullException("entryId"); - protected virtual async Task> ReadObjectResponseAsync(HttpResponseMessage response, IReadOnlyDictionary> headers, CancellationToken cancellationToken) - { - if (response == null || response.Content == null) + var urlBuilder_ = new StringBuilder(); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}/Tags?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); + if (select != null) { - return new ObjectResponseResult(default(T), string.Empty); + urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); + } + if (orderby != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); + } + if (top != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); + } + if (skip != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); + } + if (count != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); } + urlBuilder_.Length--; - if (ReadResponseAsString) + var client_ = _httpClient; + bool[] disposeClient_ = new bool[]{ false }; + try { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (Newtonsoft.Json.JsonException exception) + using (var request_ = new HttpRequestMessage()) { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, responseText, JsonSerializerSettings, exception); + + if (prefer != null) + request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); + request_.Method = new HttpMethod("GET"); + request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + return await ListTagsSendAsync(request_, client_, disposeClient_, cancellationToken); } } - else + finally { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - using (var streamReader = new StreamReader(responseStream)) - using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) - { - var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); - var typedBody = serializer.Deserialize(jsonTextReader); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (Newtonsoft.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, exception); - } + if (disposeClient_[0]) + client_.Dispose(); } } - private string ConvertToString(object value, CultureInfo cultureInfo) + protected virtual async Task ListTagsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { - if (value == null) - { - return ""; - } - - if (value is Enum) - { - var name = Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = CustomAttributeExtensions.GetCustomAttribute(field, typeof(EnumMemberAttribute)) - as EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = Convert.ToString(Convert.ChangeType(value, Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return Convert.ToBase64String((byte[]) value); - } - else if (value.GetType().IsArray) - { - var array = Enumerable.OfType((Array) value); - return string.Join(",", Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); - } - - var result = Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial interface IFieldDefinitionsClient - { - - /// - /// Returns a single field definition object. - /// - /// - /// - Returns a single field definition associated with the specified ID.
- /// - Useful when a route provides a minimal amount of details and more information about the specific field definition is needed.
- /// - Allowed OData query options: Select - ///
- /// The requested repository ID. - /// The requested field definition ID. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. - /// Limits the properties returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get field definition successfully. - /// A server side error occurred. - Task GetFieldDefinitionByIdAsync(string repoId, int fieldDefinitionId, string culture = null, string select = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Returns the paged listing of the field definitions available in a repository. - /// - /// - /// - Returns a paged listing of field definitions available in the specified repository.
- /// - Useful when trying to find a list of all field definitions available, rather than only those assigned to a specific entry/template.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. - ///
- /// The requested repository ID. - /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get field definitions successfully. - /// A server side error occurred. - Task GetFieldDefinitionsAsync(string repoId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); - - } - - [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class FieldDefinitionsClient : BaseClient, IFieldDefinitionsClient - { - private HttpClient _httpClient; - private Lazy _settings; - - public FieldDefinitionsClient(HttpClient httpClient) - { - _httpClient = httpClient; - _settings = new Lazy(CreateSerializerSettings); - } - - private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() - { - var settings = new Newtonsoft.Json.JsonSerializerSettings(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } - - partial void PrepareRequest(HttpClient client, HttpRequestMessage request, string url); - partial void PrepareRequest(HttpClient client, HttpRequestMessage request, StringBuilder urlBuilder); - partial void ProcessResponse(HttpClient client, HttpResponseMessage response); - - /// - /// Returns a single field definition object. - /// - /// - /// - Returns a single field definition associated with the specified ID.
- /// - Useful when a route provides a minimal amount of details and more information about the specific field definition is needed.
- /// - Allowed OData query options: Select - ///
- /// The requested repository ID. - /// The requested field definition ID. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. - /// Limits the properties returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get field definition successfully. - /// A server side error occurred. - public virtual async Task GetFieldDefinitionByIdAsync(string repoId, int fieldDefinitionId, string culture = null, string select = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (repoId == null) - throw new ArgumentNullException("repoId"); - - if (fieldDefinitionId == null) - throw new ArgumentNullException("fieldDefinitionId"); - - var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/FieldDefinitions/{fieldDefinitionId}?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{fieldDefinitionId}", Uri.EscapeDataString(ConvertToString(fieldDefinitionId, CultureInfo.InvariantCulture))); - if (culture != null) - { - urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); - } - if (select != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); - } - urlBuilder_.Length--; - - var client_ = _httpClient; - bool[] disposeClient_ = new bool[]{ false }; - try - { - using (var request_ = new HttpRequestMessage()) - { - request_.Method = new HttpMethod("GET"); - request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - return await GetFieldDefinitionByIdSendAsync(request_, client_, disposeClient_, cancellationToken); - } - } - finally - { - if (disposeClient_[0]) - client_.Dispose(); - } - } - - protected virtual async Task GetFieldDefinitionByIdSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) - { - var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try + var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try { var headers_ = Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) @@ -4852,7 +4801,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -4923,58 +4872,35 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Returns the paged listing of the field definitions available in a repository. + /// Assigns tags to an entry. /// /// - /// - Returns a paged listing of field definitions available in the specified repository.
- /// - Useful when trying to find a list of all field definitions available, rather than only those assigned to a specific entry/template.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. + /// - Assign tags to an entry.
+ /// - Provide an entry ID and a list of tags to assign to that entry.
+ /// - This is an overwrite action. The request must include all tags to assign to the entry, including existing tags that should remain assigned to the entry.
+ /// - Required OAuth scope: repository.Write ///
- /// The requested repository ID. - /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. + /// The requested repository ID. + /// The requested entry ID. + /// The tags to add. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get field definitions successfully. + /// A collection of tags assigned to the entry. /// A server side error occurred. - public virtual async Task GetFieldDefinitionsAsync(string repoId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task SetTagsAsync(string repositoryId, int entryId, SetTagsRequest request, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); + + if (entryId == null) + throw new ArgumentNullException("entryId"); + + if (request == null) + throw new ArgumentNullException("request"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/FieldDefinitions?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - if (culture != null) - { - urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); - } - if (select != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); - } - if (orderby != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); - } - if (top != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); - } - if (skip != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); - } - if (count != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); - } - urlBuilder_.Length--; + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}/Tags"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); var client_ = _httpClient; bool[] disposeClient_ = new bool[]{ false }; @@ -4982,10 +4908,11 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - - if (prefer != null) - request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); - request_.Method = new HttpMethod("GET"); + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); + var content_ = new StringContent(json_); + content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new HttpMethod("PUT"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -4995,7 +4922,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetFieldDefinitionsSendAsync(request_, client_, disposeClient_, cancellationToken); + return await SetTagsSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -5005,7 +4932,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetFieldDefinitionsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task SetTagsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -5023,7 +4950,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -5071,6 +4998,26 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else + if (status_ == 413) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else + if (status_ == 423) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else if (status_ == 429) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); @@ -5093,234 +5040,48 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected struct ObjectResponseResult + /// + /// Assigns links to an entry. + /// + /// + /// - Assign links to an entry.
+ /// - Provide an entry ID and a list of links to assign to that entry.
+ /// - This is an overwrite action. The request must include all links to assign to the entry, including existing links that should remain assigned to the entry.
+ /// - Required OAuth scope: repository.Write + ///
+ /// The request repository ID. + /// The requested entry ID. + /// The request body. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of links assigned to the entry. + /// A server side error occurred. + public virtual async Task SetLinksAsync(string repositoryId, int entryId, SetLinksRequest request, CancellationToken cancellationToken = default(CancellationToken)) { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); - public T Object { get; } + if (entryId == null) + throw new ArgumentNullException("entryId"); - public string Text { get; } - } + if (request == null) + throw new ArgumentNullException("request"); - public bool ReadResponseAsString { get; set; } + var urlBuilder_ = new StringBuilder(); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}/Links"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); - protected virtual async Task> ReadObjectResponseAsync(HttpResponseMessage response, IReadOnlyDictionary> headers, CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (Newtonsoft.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, responseText, JsonSerializerSettings, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - using (var streamReader = new StreamReader(responseStream)) - using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) - { - var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); - var typedBody = serializer.Deserialize(jsonTextReader); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (Newtonsoft.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, exception); - } - } - } - - private string ConvertToString(object value, CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is Enum) - { - var name = Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = CustomAttributeExtensions.GetCustomAttribute(field, typeof(EnumMemberAttribute)) - as EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = Convert.ToString(Convert.ChangeType(value, Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return Convert.ToBase64String((byte[]) value); - } - else if (value.GetType().IsArray) - { - var array = Enumerable.OfType((Array) value); - return string.Join(",", Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); - } - - var result = Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial interface ILinkDefinitionsClient - { - - /// - /// Returns the link definitions associated with a repository. - /// - /// - /// - Returns the link definitions in the repository.
- /// - Provide a repository ID and get a paged listing of link definitions available in the repository. Useful when trying to display all link definitions available, not only links assigned to a specific entry.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. - ///
- /// The requested repository ID. - /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get link definitions successfully. - /// A server side error occurred. - Task GetLinkDefinitionsAsync(string repoId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Returns a single link definition object. - /// - /// - /// - Returns a single link definition associated with the specified ID.
- /// - Provide a link type ID and get the associated link definition. Useful when a route provides a minimal amount of details and more information about the specific link definition is needed.
- /// - Allowed OData query options: Select - ///
- /// The requested repository ID. - /// The requested link type ID. - /// Limits the properties returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get link definition successfully. - /// A server side error occurred. - Task GetLinkDefinitionByIdAsync(string repoId, int linkTypeId, string select = null, CancellationToken cancellationToken = default(CancellationToken)); - - } - - [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class LinkDefinitionsClient : BaseClient, ILinkDefinitionsClient - { - private HttpClient _httpClient; - private Lazy _settings; - - public LinkDefinitionsClient(HttpClient httpClient) - { - _httpClient = httpClient; - _settings = new Lazy(CreateSerializerSettings); - } - - private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() - { - var settings = new Newtonsoft.Json.JsonSerializerSettings(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } - - partial void PrepareRequest(HttpClient client, HttpRequestMessage request, string url); - partial void PrepareRequest(HttpClient client, HttpRequestMessage request, StringBuilder urlBuilder); - partial void ProcessResponse(HttpClient client, HttpResponseMessage response); - - /// - /// Returns the link definitions associated with a repository. - /// - /// - /// - Returns the link definitions in the repository.
- /// - Provide a repository ID and get a paged listing of link definitions available in the repository. Useful when trying to display all link definitions available, not only links assigned to a specific entry.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. - ///
- /// The requested repository ID. - /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get link definitions successfully. - /// A server side error occurred. - public virtual async Task GetLinkDefinitionsAsync(string repoId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (repoId == null) - throw new ArgumentNullException("repoId"); - - var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/LinkDefinitions?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - if (select != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); - } - if (orderby != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); - } - if (top != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); - } - if (skip != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); - } - if (count != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); - } - urlBuilder_.Length--; - - var client_ = _httpClient; - bool[] disposeClient_ = new bool[]{ false }; - try + var client_ = _httpClient; + bool[] disposeClient_ = new bool[]{ false }; + try { using (var request_ = new HttpRequestMessage()) { - - if (prefer != null) - request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); - request_.Method = new HttpMethod("GET"); + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); + var content_ = new StringContent(json_); + content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new HttpMethod("PUT"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -5330,7 +5091,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetLinkDefinitionsSendAsync(request_, client_, disposeClient_, cancellationToken); + return await SetLinksSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -5340,7 +5101,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetLinkDefinitionsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task SetLinksSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -5358,7 +5119,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -5406,6 +5167,26 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else + if (status_ == 413) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else + if (status_ == 423) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else if (status_ == 429) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); @@ -5429,35 +5210,57 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Returns a single link definition object. + /// Returns the links assigned to an entry. /// /// - /// - Returns a single link definition associated with the specified ID.
- /// - Provide a link type ID and get the associated link definition. Useful when a route provides a minimal amount of details and more information about the specific link definition is needed.
- /// - Allowed OData query options: Select + /// - Returns the links assigned to an entry.
+ /// - Provide an entry ID, and get a paged listing of links assigned to that entry.
+ /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. - /// The requested link type ID. + /// The requested repository ID. + /// The requested entry ID. + /// An optional odata header. Can be used to set the maximum page size using odata.maxpagesize. /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get link definition successfully. + /// A collection of links assigned to the entry. /// A server side error occurred. - public virtual async Task GetLinkDefinitionByIdAsync(string repoId, int linkTypeId, string select = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task ListLinksAsync(string repositoryId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); - if (linkTypeId == null) - throw new ArgumentNullException("linkTypeId"); + if (entryId == null) + throw new ArgumentNullException("entryId"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/LinkDefinitions/{linkTypeId}?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{linkTypeId}", Uri.EscapeDataString(ConvertToString(linkTypeId, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}/Links?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); if (select != null) { urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); } + if (orderby != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); + } + if (top != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); + } + if (skip != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); + } + if (count != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); + } urlBuilder_.Length--; var client_ = _httpClient; @@ -5466,6 +5269,9 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { + + if (prefer != null) + request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); @@ -5476,7 +5282,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetLinkDefinitionByIdSendAsync(request_, client_, disposeClient_, cancellationToken); + return await ListLinksSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -5486,7 +5292,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetLinkDefinitionByIdSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task ListLinksSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -5504,7 +5310,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -5574,164 +5380,204 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected struct ObjectResponseResult + /// + /// Copies a new child entry in a folder. + /// + /// + /// - Copy a new child entry in the designated folder.
+ /// - Provide the parent folder ID, and based on the request body, copy a child entry of the designated folder.
+ /// - Required OAuth scope: repository.Write + ///
+ /// The requested repository ID. + /// The folder ID that the entry will be created in. + /// The request body. + /// An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// The copied entry. + /// A server side error occurred. + public virtual async Task CopyEntryAsync(string repositoryId, int entryId, CopyEntryRequest request, string culture = null, CancellationToken cancellationToken = default(CancellationToken)) { - public ObjectResponseResult(T responseObject, string responseText) + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); + + if (entryId == null) + throw new ArgumentNullException("entryId"); + + if (request == null) + throw new ArgumentNullException("request"); + + var urlBuilder_ = new StringBuilder(); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}/Folder/Copy?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); + if (culture != null) { - this.Object = responseObject; - this.Text = responseText; + urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); } + urlBuilder_.Length--; - public T Object { get; } + var client_ = _httpClient; + bool[] disposeClient_ = new bool[]{ false }; + try + { + using (var request_ = new HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); + var content_ = new StringContent(json_); + content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new HttpMethod("POST"); + request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); - public string Text { get; } - } + PrepareRequest(client_, request_, urlBuilder_); - public bool ReadResponseAsString { get; set; } + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute); - protected virtual async Task> ReadObjectResponseAsync(HttpResponseMessage response, IReadOnlyDictionary> headers, CancellationToken cancellationToken) - { - if (response == null || response.Content == null) + PrepareRequest(client_, request_, url_); + + return await CopyEntrySendAsync(request_, client_, disposeClient_, cancellationToken); + } + } + finally { - return new ObjectResponseResult(default(T), string.Empty); + if (disposeClient_[0]) + client_.Dispose(); } + } - if (ReadResponseAsString) + protected virtual async Task CopyEntrySendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + { + var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try + var headers_ = Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) { - var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; } - catch (Newtonsoft.Json.JsonException exception) + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 201) { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, responseText, JsonSerializerSettings, exception); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + return objectResponse_.Object; } - } - else - { - try + else + if (status_ == 400) { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - using (var streamReader = new StreamReader(responseStream)) - using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) { - var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); - var typedBody = serializer.Deserialize(jsonTextReader); - return new ObjectResponseResult(typedBody, string.Empty); + throw ApiExceptionExtensions.Create(status_, headers_, null); } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } - catch (Newtonsoft.Json.JsonException exception) + else + if (status_ == 401) { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, exception); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } - } - } - - private string ConvertToString(object value, CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is Enum) - { - var name = Enum.GetName(value.GetType(), value); - if (name != null) + else + if (status_ == 403) { - var field = IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) { - var attribute = CustomAttributeExtensions.GetCustomAttribute(field, typeof(EnumMemberAttribute)) - as EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } + throw ApiExceptionExtensions.Create(status_, headers_, null); } - - var converted = Convert.ToString(Convert.ChangeType(value, Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else + if (status_ == 409) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else + if (status_ == 413) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else + if (status_ == 429) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw ApiExceptionExtensions.Create(status_, headers_, responseData_, JsonSerializerSettings, null); } } - else if (value is bool) - { - return Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return Convert.ToBase64String((byte[]) value); - } - else if (value.GetType().IsArray) + finally { - var array = Enumerable.OfType((Array) value); - return string.Join(",", Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); + if (disposeResponse_) + response_.Dispose(); } - - var result = Convert.ToString(value, cultureInfo); - return result == null ? "" : result; } - } - - [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial interface IRepositoriesClient - { /// - /// Returns the list of repositories accessible to the user. + /// Deletes the edoc associated with an entry. /// /// - /// - Returns the repository resource list that current user has access to. + /// - Delete the edoc associated with the provided entry ID.
+ /// - Required OAuth scope: repository.Write ///
+ /// The requested repository ID. + /// The requested document ID. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get the respository resource list successfully. + /// The updated entry. /// A server side error occurred. - Task> GetRepositoryListAsync(CancellationToken cancellationToken = default(CancellationToken)); - - } - - [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class RepositoriesClient : BaseClient, IRepositoriesClient - { - private HttpClient _httpClient; - private Lazy _settings; - - public RepositoriesClient(HttpClient httpClient) - { - _httpClient = httpClient; - _settings = new Lazy(CreateSerializerSettings); - } - - private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() + public virtual async Task DeleteElectronicDocumentAsync(string repositoryId, int entryId, CancellationToken cancellationToken = default(CancellationToken)) { - var settings = new Newtonsoft.Json.JsonSerializerSettings(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); - partial void PrepareRequest(HttpClient client, HttpRequestMessage request, string url); - partial void PrepareRequest(HttpClient client, HttpRequestMessage request, StringBuilder urlBuilder); - partial void ProcessResponse(HttpClient client, HttpResponseMessage response); + if (entryId == null) + throw new ArgumentNullException("entryId"); - /// - /// Returns the list of repositories accessible to the user. - /// - /// - /// - Returns the repository resource list that current user has access to. - /// - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get the respository resource list successfully. - /// A server side error occurred. - public virtual async Task> GetRepositoryListAsync(CancellationToken cancellationToken = default(CancellationToken)) - { var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories"); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}/Document/Edoc"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); var client_ = _httpClient; bool[] disposeClient_ = new bool[]{ false }; @@ -5739,7 +5585,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - request_.Method = new HttpMethod("GET"); + request_.Method = new HttpMethod("DELETE"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -5749,7 +5595,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetRepositoryListSendAsync(request_, client_, disposeClient_, cancellationToken); + return await DeleteElectronicDocumentSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -5759,7 +5605,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task> GetRepositoryListSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task DeleteElectronicDocumentSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -5777,7 +5623,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -5815,7 +5661,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 429) + if (status_ == 404) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) @@ -5825,186 +5671,69 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else + if (status_ == 423) { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw ApiExceptionExtensions.Create(status_, headers_, responseData_, JsonSerializerSettings, null); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async Task> ReadObjectResponseAsync(HttpResponseMessage response, IReadOnlyDictionary> headers, CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (Newtonsoft.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, responseText, JsonSerializerSettings, exception); - } - } - else - { - try + else + if (status_ == 429) { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - using (var streamReader = new StreamReader(responseStream)) - using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) { - var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); - var typedBody = serializer.Deserialize(jsonTextReader); - return new ObjectResponseResult(typedBody, string.Empty); + throw ApiExceptionExtensions.Create(status_, headers_, null); } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } - catch (Newtonsoft.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, exception); - } - } - } - - private string ConvertToString(object value, CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is Enum) - { - var name = Enum.GetName(value.GetType(), value); - if (name != null) + else { - var field = IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = CustomAttributeExtensions.GetCustomAttribute(field, typeof(EnumMemberAttribute)) - as EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = Convert.ToString(Convert.ChangeType(value, Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw ApiExceptionExtensions.Create(status_, headers_, responseData_, JsonSerializerSettings, null); } } - else if (value is bool) - { - return Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return Convert.ToBase64String((byte[]) value); - } - else if (value.GetType().IsArray) + finally { - var array = Enumerable.OfType((Array) value); - return string.Join(",", Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); + if (disposeResponse_) + response_.Dispose(); } - - var result = Convert.ToString(value, cultureInfo); - return result == null ? "" : result; } - } - - [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial interface IAuditReasonsClient - { /// - /// Returns the audit reasons associated with the authenticated user. + /// Deletes the pages associated with an entry. /// /// - /// - Returns the audit reasons associated with the authenticated user. Inherited audit reasons are included.
- /// - Only includes audit reasons associated with available API functionalities, like delete entry and export document.
- /// - If the authenticated user does not have the appropriate Laserfiche feature right, the audit reasons associated with that feature right will not be included. + /// - Delete the pages associated with the provided entry ID. If no pageRange is specified, all pages will be deleted.
+ /// - Optional parameter: pageRange (default empty). The value should be a comma-separated string which contains non-overlapping single values, or page ranges. Ex: "1,2,3", "1-3,5", "2-7,10-12."
+ /// - Required OAuth scope: repository.Write ///
- /// The requested repository ID. + /// The requested repository ID. + /// The requested document ID. + /// The pages to be deleted. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get audit reasons successfully. + /// The updated entry. /// A server side error occurred. - Task GetAuditReasonsAsync(string repoId, CancellationToken cancellationToken = default(CancellationToken)); - - } - - [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class AuditReasonsClient : BaseClient, IAuditReasonsClient - { - private HttpClient _httpClient; - private Lazy _settings; - - public AuditReasonsClient(HttpClient httpClient) - { - _httpClient = httpClient; - _settings = new Lazy(CreateSerializerSettings); - } - - private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() + public virtual async Task DeletePagesAsync(string repositoryId, int entryId, string pageRange = null, CancellationToken cancellationToken = default(CancellationToken)) { - var settings = new Newtonsoft.Json.JsonSerializerSettings(); - UpdateJsonSerializerSettings(settings); - return settings; - } + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); - protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } - - partial void PrepareRequest(HttpClient client, HttpRequestMessage request, string url); - partial void PrepareRequest(HttpClient client, HttpRequestMessage request, StringBuilder urlBuilder); - partial void ProcessResponse(HttpClient client, HttpResponseMessage response); - - /// - /// Returns the audit reasons associated with the authenticated user. - /// - /// - /// - Returns the audit reasons associated with the authenticated user. Inherited audit reasons are included.
- /// - Only includes audit reasons associated with available API functionalities, like delete entry and export document.
- /// - If the authenticated user does not have the appropriate Laserfiche feature right, the audit reasons associated with that feature right will not be included. - ///
- /// The requested repository ID. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get audit reasons successfully. - /// A server side error occurred. - public virtual async Task GetAuditReasonsAsync(string repoId, CancellationToken cancellationToken = default(CancellationToken)) - { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (entryId == null) + throw new ArgumentNullException("entryId"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/AuditReasons"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}/Document/Pages?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); + if (pageRange != null) + { + urlBuilder_.Append(Uri.EscapeDataString("pageRange") + "=").Append(Uri.EscapeDataString(ConvertToString(pageRange, CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; var client_ = _httpClient; bool[] disposeClient_ = new bool[]{ false }; @@ -6012,7 +5741,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - request_.Method = new HttpMethod("GET"); + request_.Method = new HttpMethod("DELETE"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -6022,7 +5751,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetAuditReasonsSendAsync(request_, client_, disposeClient_, cancellationToken); + return await DeletePagesSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -6032,7 +5761,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetAuditReasonsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task DeletePagesSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -6050,7 +5779,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -6098,6 +5827,16 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else + if (status_ == 423) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else if (status_ == 429) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); @@ -6120,289 +5859,68 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected struct ObjectResponseResult + /// + /// Returns the dynamic field logic values assigned to an entry. + /// + /// + /// - Returns dynamic field logic values with the current values of the fields in the template.
+ /// - Provide an entry ID and field values in the JSON body to get dynamic field logic values.
+ /// - Independent and non-dynamic fields in the request body will be ignored, and only related dynamic field logic values for the assigned template will be returned.
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The requested entry ID. + /// The request body. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of dynamic field values. + /// A server side error occurred. + public virtual async Task>> ListDynamicFieldValuesAsync(string repositoryId, int entryId, ListDynamicFieldValuesRequest request, CancellationToken cancellationToken = default(CancellationToken)) { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); - public string Text { get; } - } + if (entryId == null) + throw new ArgumentNullException("entryId"); - public bool ReadResponseAsString { get; set; } + if (request == null) + throw new ArgumentNullException("request"); - protected virtual async Task> ReadObjectResponseAsync(HttpResponseMessage response, IReadOnlyDictionary> headers, CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } + var urlBuilder_ = new StringBuilder(); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}/Fields/GetDynamicFieldLogicValue"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); - if (ReadResponseAsString) + var client_ = _httpClient; + bool[] disposeClient_ = new bool[]{ false }; + try { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (Newtonsoft.Json.JsonException exception) + using (var request_ = new HttpRequestMessage()) { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, responseText, JsonSerializerSettings, exception); + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); + var content_ = new StringContent(json_); + content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new HttpMethod("POST"); + request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + return await ListDynamicFieldValuesSendAsync(request_, client_, disposeClient_, cancellationToken); } } - else + finally { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - using (var streamReader = new StreamReader(responseStream)) - using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) - { - var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); - var typedBody = serializer.Deserialize(jsonTextReader); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (Newtonsoft.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, exception); - } + if (disposeClient_[0]) + client_.Dispose(); } } - private string ConvertToString(object value, CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is Enum) - { - var name = Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = CustomAttributeExtensions.GetCustomAttribute(field, typeof(EnumMemberAttribute)) - as EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = Convert.ToString(Convert.ChangeType(value, Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return Convert.ToBase64String((byte[]) value); - } - else if (value.GetType().IsArray) - { - var array = Enumerable.OfType((Array) value); - return string.Join(",", Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); - } - - var result = Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial interface ISearchesClient - { - - /// - /// Runs a search in the specified repository. - /// - /// - /// - Runs a search operation on the repository.
- /// - Optional body parameters: FuzzyType: (default none), which can be used to determine what is considered a match by number of letters or percentage. FuzzyFactor: integer value that determines the degree to which a search will be considered a match (integer value for NumberOfLetters, or int value representing a percentage). The status for search operations must be checked via the Search specific status checking route. - ///
- /// The requested repository ID. - /// The Laserfiche search command to run, optionally include fuzzy search settings. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Search operation start successfully. - /// A server side error occurred. - Task CreateSearchOperationAsync(string repoId, AdvancedSearchRequest request = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Returns the status of a search operation. - /// - /// - /// - Returns search status.
- /// - Provide a token (returned in the create search asynchronous route), and get the search status, progress, and any errors that may have occurred. When the search is completed, the Location header can be inspected as a link to the search results.
- /// - OperationStatus can be one of the following : NotStarted, InProgress, Completed, Failed, or Canceled. - ///
- /// The requested repository ID. - /// The requested searchToken. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Search has failed. Check the errors property to find out why. - /// A server side error occurred. - Task GetSearchStatusAsync(string repoId, string searchToken, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Cancels or closes a search operation. - /// - /// - /// - Cancels a currently running search.
- /// - Closes a completed search. - ///
- /// The requested repository ID. - /// The requested searchToken. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Cancel or closed search successfully. - /// A server side error occurred. - Task CancelOrCloseSearchAsync(string repoId, string searchToken, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Returns the results listing associated with a search operation. - /// - /// - /// - Returns a search result listing if the search is completed.
- /// - Optional query parameter: groupByOrderType (default false). This query parameter decides whether or not results are returned in groups based on their entry type.
- /// - Optional query parameter: refresh (default false). If the search listing should be refreshed to show updated values.
- /// - Default page size: 150. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. OData $OrderBy syntax should follow: "PropertyName direction,PropertyName2 direction". sort order can be either "asc" or "desc". Search results expire after 5 minutes, but can be refreshed by retrieving the results again.
- /// - Optionally returns field values for the entries in the search result listing. Each field name needs to be specified in the request. Maximum limit of 10 field names.
- /// - If field values are requested, only the first value is returned if it is a multi value field.
- /// - Null or Empty field values should not be used to determine if a field is assigned to the entry. - ///
- /// The requested repository ID. - /// The requested searchToken. - /// An optional query parameter used to indicate if the result should be grouped by entry type or not. - /// If the search listing should be refreshed to show updated values. - /// Optional array of field names. Field values corresponding to the given field names will be returned for each search result. - /// Boolean for if field values should be formatted. Only applicable if Fields are specified. - /// An optional odata header. Can be used to set the maximum page size using odata.maxpagesize. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. The formatFields query parameter must be set to true, otherwise
- /// culture will not be used for formatting. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get search result successfully. - /// A server side error occurred. - Task GetSearchResultsAsync(string repoId, string searchToken, bool? groupByEntryType = null, bool? refresh = null, IEnumerable fields = null, bool? formatFields = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Returns the context hits associated with a search result entry. - /// - /// - /// - Returns the context hits associated with a search result entry.
- /// - Given a searchToken, and rowNumber associated with a search entry in the listing, return the context hits for that entry.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. - ///
- /// The requested repository ID. - /// The requested searchToken. - /// The search result listing row number to get context hits for. - /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get search context hits successfully. - /// A server side error occurred. - Task GetSearchContextHitsAsync(string repoId, string searchToken, int rowNumber, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); - - } - - [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class SearchesClient : BaseClient, ISearchesClient - { - private HttpClient _httpClient; - private Lazy _settings; - - public SearchesClient(HttpClient httpClient) - { - _httpClient = httpClient; - _settings = new Lazy(CreateSerializerSettings); - } - - private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() - { - var settings = new Newtonsoft.Json.JsonSerializerSettings(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } - - partial void PrepareRequest(HttpClient client, HttpRequestMessage request, string url); - partial void PrepareRequest(HttpClient client, HttpRequestMessage request, StringBuilder urlBuilder); - partial void ProcessResponse(HttpClient client, HttpResponseMessage response); - - /// - /// Runs a search in the specified repository. - /// - /// - /// - Runs a search operation on the repository.
- /// - Optional body parameters: FuzzyType: (default none), which can be used to determine what is considered a match by number of letters or percentage. FuzzyFactor: integer value that determines the degree to which a search will be considered a match (integer value for NumberOfLetters, or int value representing a percentage). The status for search operations must be checked via the Search specific status checking route. - ///
- /// The requested repository ID. - /// The Laserfiche search command to run, optionally include fuzzy search settings. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Search operation start successfully. - /// A server side error occurred. - public virtual async Task CreateSearchOperationAsync(string repoId, AdvancedSearchRequest request = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (repoId == null) - throw new ArgumentNullException("repoId"); - - var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Searches"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - - var client_ = _httpClient; - bool[] disposeClient_ = new bool[]{ false }; - try - { - using (var request_ = new HttpRequestMessage()) - { - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); - var content_ = new StringContent(json_); - content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new HttpMethod("POST"); - request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - return await CreateSearchOperationSendAsync(request_, client_, disposeClient_, cancellationToken); - } - } - finally - { - if (disposeClient_[0]) - client_.Dispose(); - } - } - - protected virtual async Task CreateSearchOperationSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task>> ListDynamicFieldValuesSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -6418,9 +5936,9 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 201) + if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync>>(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -6501,30 +6019,31 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Returns the status of a search operation. + /// Removes the currently assigned template from an entry. /// /// - /// - Returns search status.
- /// - Provide a token (returned in the create search asynchronous route), and get the search status, progress, and any errors that may have occurred. When the search is completed, the Location header can be inspected as a link to the search results.
- /// - OperationStatus can be one of the following : NotStarted, InProgress, Completed, Failed, or Canceled. + /// - Remove the currently assigned template from the specified entry.
+ /// - Provide an entry ID to clear template value on.
+ /// - If the entry does not have a template assigned, no change will be made.
+ /// - Required OAuth scope: repository.Write ///
- /// The requested repository ID. - /// The requested searchToken. + /// The requested repository ID. + /// The ID of the entry that will have its template removed. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Search has failed. Check the errors property to find out why. + /// The updated entry. /// A server side error occurred. - public virtual async Task GetSearchStatusAsync(string repoId, string searchToken, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task RemoveTemplateAsync(string repositoryId, int entryId, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); - if (searchToken == null) - throw new ArgumentNullException("searchToken"); + if (entryId == null) + throw new ArgumentNullException("entryId"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Searches/{searchToken}"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{searchToken}", Uri.EscapeDataString(ConvertToString(searchToken, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}/Template"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); var client_ = _httpClient; bool[] disposeClient_ = new bool[]{ false }; @@ -6532,7 +6051,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - request_.Method = new HttpMethod("GET"); + request_.Method = new HttpMethod("DELETE"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -6542,7 +6061,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetSearchStatusSendAsync(request_, client_, disposeClient_, cancellationToken); + return await RemoveTemplateSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -6552,7 +6071,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetSearchStatusSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task RemoveTemplateSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -6570,17 +6089,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 201) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -6588,17 +6097,17 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() return objectResponse_.Object; } else - if (status_ == 202) + if (status_ == 400) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); } - return objectResponse_.Object; + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 400) + if (status_ == 401) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) @@ -6608,7 +6117,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 401) + if (status_ == 403) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) @@ -6618,7 +6127,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 403) + if (status_ == 404) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) @@ -6628,7 +6137,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 404) + if (status_ == 423) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) @@ -6661,29 +6170,41 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Cancels or closes a search operation. + /// Assigns a template to an entry. /// /// - /// - Cancels a currently running search.
- /// - Closes a completed search. + /// - Assign a template to an entry.
+ /// - Provide an entry ID, template name, and a list of template fields to assign to that entry.
+ /// - Only template values will be modified. Any existing independent fields on the entry will not be modified, nor will they be added if included in the request. The only modification to fields will only occur on templated fields. If the previously assigned template includes common template fields as the newly assigned template, the common field values will not be modified.
+ /// - Required OAuth scope: repository.Write ///
- /// The requested repository ID. - /// The requested searchToken. + /// The requested repository ID. + /// The ID of entry that will have its template updated. + /// The template and template fields that will be assigned to the entry. + /// An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. This may be used when setting field values with tokens. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Cancel or closed search successfully. + /// The updated entry. /// A server side error occurred. - public virtual async Task CancelOrCloseSearchAsync(string repoId, string searchToken, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task SetTemplateAsync(string repositoryId, int entryId, SetTemplateRequest request, string culture = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); + + if (entryId == null) + throw new ArgumentNullException("entryId"); - if (searchToken == null) - throw new ArgumentNullException("searchToken"); + if (request == null) + throw new ArgumentNullException("request"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Searches/{searchToken}"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{searchToken}", Uri.EscapeDataString(ConvertToString(searchToken, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Entries/{entryId}/Template?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{entryId}", Uri.EscapeDataString(ConvertToString(entryId, CultureInfo.InvariantCulture))); + if (culture != null) + { + urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; var client_ = _httpClient; bool[] disposeClient_ = new bool[]{ false }; @@ -6691,7 +6212,11 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - request_.Method = new HttpMethod("DELETE"); + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); + var content_ = new StringContent(json_); + content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new HttpMethod("PUT"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -6701,7 +6226,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await CancelOrCloseSearchSendAsync(request_, client_, disposeClient_, cancellationToken); + return await SetTemplateSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -6711,7 +6236,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task CancelOrCloseSearchSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task SetTemplateSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -6729,7 +6254,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -6777,6 +6302,26 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else + if (status_ == 413) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else + if (status_ == 423) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else if (status_ == 429) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); @@ -6799,89 +6344,166 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - /// - /// Returns the results listing associated with a search operation. - /// - /// - /// - Returns a search result listing if the search is completed.
- /// - Optional query parameter: groupByOrderType (default false). This query parameter decides whether or not results are returned in groups based on their entry type.
- /// - Optional query parameter: refresh (default false). If the search listing should be refreshed to show updated values.
- /// - Default page size: 150. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. OData $OrderBy syntax should follow: "PropertyName direction,PropertyName2 direction". sort order can be either "asc" or "desc". Search results expire after 5 minutes, but can be refreshed by retrieving the results again.
- /// - Optionally returns field values for the entries in the search result listing. Each field name needs to be specified in the request. Maximum limit of 10 field names.
- /// - If field values are requested, only the first value is returned if it is a multi value field.
- /// - Null or Empty field values should not be used to determine if a field is assigned to the entry. - ///
- /// The requested repository ID. - /// The requested searchToken. - /// An optional query parameter used to indicate if the result should be grouped by entry type or not. - /// If the search listing should be refreshed to show updated values. - /// Optional array of field names. Field values corresponding to the given field names will be returned for each search result. - /// Boolean for if field values should be formatted. Only applicable if Fields are specified. - /// An optional odata header. Can be used to set the maximum page size using odata.maxpagesize. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. The formatFields query parameter must be set to true, otherwise
- /// culture will not be used for formatting. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get search result successfully. - /// A server side error occurred. - public virtual async Task GetSearchResultsAsync(string repoId, string searchToken, bool? groupByEntryType = null, bool? refresh = null, IEnumerable fields = null, bool? formatFields = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) + protected struct ObjectResponseResult { - if (repoId == null) - throw new ArgumentNullException("repoId"); - - if (searchToken == null) - throw new ArgumentNullException("searchToken"); - - var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Searches/{searchToken}/Results?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{searchToken}", Uri.EscapeDataString(ConvertToString(searchToken, CultureInfo.InvariantCulture))); - if (groupByEntryType != null) - { - urlBuilder_.Append(Uri.EscapeDataString("groupByEntryType") + "=").Append(Uri.EscapeDataString(ConvertToString(groupByEntryType, CultureInfo.InvariantCulture))).Append("&"); - } - if (refresh != null) + public ObjectResponseResult(T responseObject, string responseText) { - urlBuilder_.Append(Uri.EscapeDataString("refresh") + "=").Append(Uri.EscapeDataString(ConvertToString(refresh, CultureInfo.InvariantCulture))).Append("&"); + this.Object = responseObject; + this.Text = responseText; } - if (fields != null) + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async Task> ReadObjectResponseAsync(HttpResponseMessage response, IReadOnlyDictionary> headers, CancellationToken cancellationToken) + { + if (response == null || response.Content == null) { - foreach (var item_ in fields) { urlBuilder_.Append(Uri.EscapeDataString("fields") + "=").Append(Uri.EscapeDataString(ConvertToString(item_, CultureInfo.InvariantCulture))).Append("&"); } + return new ObjectResponseResult(default(T), string.Empty); } - if (formatFields != null) + + if (ReadResponseAsString) { - urlBuilder_.Append(Uri.EscapeDataString("formatFields") + "=").Append(Uri.EscapeDataString(ConvertToString(formatFields, CultureInfo.InvariantCulture))).Append("&"); + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, responseText, JsonSerializerSettings, exception); + } } - if (culture != null) + else { - urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + using (var streamReader = new StreamReader(responseStream)) + using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) + { + var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); + var typedBody = serializer.Deserialize(jsonTextReader); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, exception); + } } - if (select != null) + } + + private string ConvertToString(object value, CultureInfo cultureInfo) + { + if (value == null) { - urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); + return ""; } - if (orderby != null) + + if (value is Enum) { - urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); + var name = Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = CustomAttributeExtensions.GetCustomAttribute(field, typeof(EnumMemberAttribute)) + as EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = Convert.ToString(Convert.ChangeType(value, Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } } - if (top != null) + else if (value is bool) { - urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); + return Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } - if (skip != null) + else if (value is byte[]) { - urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); + return Convert.ToBase64String((byte[]) value); } - if (count != null) + else if (value.GetType().IsArray) { - urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); + var array = Enumerable.OfType((Array) value); + return string.Join(",", Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } - urlBuilder_.Length--; + + var result = Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IRepositoriesClient + { + + /// + /// Returns the list of repositories accessible to the user. + /// + /// + /// - Returns the repository resource list that current user has access to.
+ /// - Required OAuth scope: repository.Read + ///
+ /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of respositories. + /// A server side error occurred. + Task ListRepositoriesAsync(CancellationToken cancellationToken = default(CancellationToken)); + + } + + [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class RepositoriesClient : BaseClient, IRepositoriesClient + { + private HttpClient _httpClient; + private Lazy _settings; + + public RepositoriesClient(HttpClient httpClient) + { + _httpClient = httpClient; + _settings = new Lazy(CreateSerializerSettings); + } + + private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() + { + var settings = new Newtonsoft.Json.JsonSerializerSettings(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } + + partial void PrepareRequest(HttpClient client, HttpRequestMessage request, string url); + partial void PrepareRequest(HttpClient client, HttpRequestMessage request, StringBuilder urlBuilder); + partial void ProcessResponse(HttpClient client, HttpResponseMessage response); + + /// + /// Returns the list of repositories accessible to the user. + /// + /// + /// - Returns the repository resource list that current user has access to.
+ /// - Required OAuth scope: repository.Read + ///
+ /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of respositories. + /// A server side error occurred. + public virtual async Task ListRepositoriesAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + var urlBuilder_ = new StringBuilder(); + urlBuilder_.Append("v2/Repositories"); var client_ = _httpClient; bool[] disposeClient_ = new bool[]{ false }; @@ -6889,9 +6511,6 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - - if (prefer != null) - request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); @@ -6902,7 +6521,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetSearchResultsSendAsync(request_, client_, disposeClient_, cancellationToken); + return await ListRepositoriesSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -6912,7 +6531,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetSearchResultsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task ListRepositoriesSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -6930,7 +6549,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -6968,16 +6587,6 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 404) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else if (status_ == 429) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); @@ -7000,63 +6609,234 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - /// - /// Returns the context hits associated with a search result entry. - /// - /// - /// - Returns the context hits associated with a search result entry.
- /// - Given a searchToken, and rowNumber associated with a search entry in the listing, return the context hits for that entry.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. - ///
- /// The requested repository ID. - /// The requested searchToken. - /// The search result listing row number to get context hits for. - /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get search context hits successfully. - /// A server side error occurred. - public virtual async Task GetSearchContextHitsAsync(string repoId, string searchToken, int rowNumber, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) + protected struct ObjectResponseResult { - if (repoId == null) - throw new ArgumentNullException("repoId"); + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } - if (searchToken == null) - throw new ArgumentNullException("searchToken"); + public T Object { get; } - if (rowNumber == null) - throw new ArgumentNullException("rowNumber"); + public string Text { get; } + } - var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Searches/{searchToken}/Results/{rowNumber}/ContextHits?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{searchToken}", Uri.EscapeDataString(ConvertToString(searchToken, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{rowNumber}", Uri.EscapeDataString(ConvertToString(rowNumber, CultureInfo.InvariantCulture))); - if (select != null) + public bool ReadResponseAsString { get; set; } + + protected virtual async Task> ReadObjectResponseAsync(HttpResponseMessage response, IReadOnlyDictionary> headers, CancellationToken cancellationToken) + { + if (response == null || response.Content == null) { - urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); + return new ObjectResponseResult(default(T), string.Empty); } - if (orderby != null) + + if (ReadResponseAsString) { - urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, responseText, JsonSerializerSettings, exception); + } } - if (top != null) + else { - urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + using (var streamReader = new StreamReader(responseStream)) + using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) + { + var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); + var typedBody = serializer.Deserialize(jsonTextReader); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, exception); + } } - if (skip != null) + } + + private string ConvertToString(object value, CultureInfo cultureInfo) + { + if (value == null) { - urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); + return ""; } - if (count != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); + + if (value is Enum) + { + var name = Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = CustomAttributeExtensions.GetCustomAttribute(field, typeof(EnumMemberAttribute)) + as EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = Convert.ToString(Convert.ChangeType(value, Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } } - urlBuilder_.Length--; + else if (value is bool) + { + return Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return Convert.ToBase64String((byte[]) value); + } + else if (value.GetType().IsArray) + { + var array = Enumerable.OfType((Array) value); + return string.Join(",", Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); + } + + var result = Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface ISearchesClient + { + + /// + /// Starts an asynchronous search task. + /// + /// + /// - Runs a search operation on the repository.
+ /// - The status for search operations must be checked via the Tasks route.
+ /// - Optional body parameters: FuzzyType: (default none), which can be used to determine what is considered a match by number of letters or percentage. FuzzyFactor: integer value that determines the degree to which a search will be considered a match (integer value for NumberOfLetters, or int value representing a percentage).
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The Laserfiche search command to run, optionally include fuzzy search settings. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A long operation task id. + /// A server side error occurred. + Task StartSearchEntryAsync(string repositoryId, StartSearchEntryRequest request, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Returns the results listing associated with a search task. + /// + /// + /// - Returns a search result listing if the search is completed.
+ /// - Search results expire after 5 minutes, but can be refreshed by retrieving the results again.
+ /// - Optional query parameter: groupByOrderType (default false). This query parameter decides whether or not results are returned in groups based on their entry type.
+ /// - Optional query parameter: refresh (default false). If the search listing should be refreshed to show updated values.
+ /// - Optionally returns field values for the entries in the folder. Each field name needs to be specified in the request. Maximum limit of 10 field names. If field values are requested, only the first value is returned if it is a multi value field. The remaining field values can be retrieved via the GET fields route. Null or Empty field values should not be used to determine if a field is assigned to the entry.
+ /// - Default page size: 150. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. OData $OrderBy syntax should follow: "PropertyName direction,PropertyName2 direction". sort order can be either "asc" or "desc".
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The requested task ID. + /// Indicates if the result should be grouped by entry type or not. The default value is false. + /// Indicates if the search listing should be refreshed to show updated values. The default value is false. + /// Optional array of field names. Field values corresponding to the given field names will be returned for each search result. + /// Indicates if field values should be formatted. Only applicable if Fields are specified. The default value is false. + /// An optional odata header. Can be used to set the maximum page size using odata.maxpagesize. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. The formatFieldValues query parameter must be set to true, otherwise culture will not be used for formatting. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of entry search results. + /// A server side error occurred. + Task ListSearchResultsAsync(string repositoryId, string taskId, bool? groupByEntryType = null, bool? refresh = null, IEnumerable fields = null, bool? formatFieldValues = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Returns the context hits associated with a search result entry. + /// + /// + /// - Returns the context hits associated with a search result entry.
+ /// - Given a taskId, and rowNumber associated with a search entry in the listing, return the context hits for that entry.
+ /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The requested task ID. + /// The search result listing row number to get context hits for. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of context hits for a search result. + /// A server side error occurred. + Task ListSearchContextHitsAsync(string repositoryId, string taskId, int rowNumber, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); + + } + + [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SearchesClient : BaseClient, ISearchesClient + { + private HttpClient _httpClient; + private Lazy _settings; + + public SearchesClient(HttpClient httpClient) + { + _httpClient = httpClient; + _settings = new Lazy(CreateSerializerSettings); + } + + private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() + { + var settings = new Newtonsoft.Json.JsonSerializerSettings(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } + + partial void PrepareRequest(HttpClient client, HttpRequestMessage request, string url); + partial void PrepareRequest(HttpClient client, HttpRequestMessage request, StringBuilder urlBuilder); + partial void ProcessResponse(HttpClient client, HttpResponseMessage response); + + /// + /// Starts an asynchronous search task. + /// + /// + /// - Runs a search operation on the repository.
+ /// - The status for search operations must be checked via the Tasks route.
+ /// - Optional body parameters: FuzzyType: (default none), which can be used to determine what is considered a match by number of letters or percentage. FuzzyFactor: integer value that determines the degree to which a search will be considered a match (integer value for NumberOfLetters, or int value representing a percentage).
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The Laserfiche search command to run, optionally include fuzzy search settings. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A long operation task id. + /// A server side error occurred. + public virtual async Task StartSearchEntryAsync(string repositoryId, StartSearchEntryRequest request, CancellationToken cancellationToken = default(CancellationToken)) + { + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); + + if (request == null) + throw new ArgumentNullException("request"); + + var urlBuilder_ = new StringBuilder(); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Searches/SearchAsync"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); var client_ = _httpClient; bool[] disposeClient_ = new bool[]{ false }; @@ -7064,10 +6844,11 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - - if (prefer != null) - request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); - request_.Method = new HttpMethod("GET"); + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); + var content_ = new StringContent(json_); + content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new HttpMethod("POST"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -7077,7 +6858,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetSearchContextHitsSendAsync(request_, client_, disposeClient_, cancellationToken); + return await StartSearchEntrySendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -7087,7 +6868,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetSearchContextHitsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task StartSearchEntrySendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -7103,9 +6884,9 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 200) + if (status_ == 202) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -7153,6 +6934,16 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else + if (status_ == 413) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else if (status_ == 429) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); @@ -7175,198 +6966,242 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected struct ObjectResponseResult + /// + /// Returns the results listing associated with a search task. + /// + /// + /// - Returns a search result listing if the search is completed.
+ /// - Search results expire after 5 minutes, but can be refreshed by retrieving the results again.
+ /// - Optional query parameter: groupByOrderType (default false). This query parameter decides whether or not results are returned in groups based on their entry type.
+ /// - Optional query parameter: refresh (default false). If the search listing should be refreshed to show updated values.
+ /// - Optionally returns field values for the entries in the folder. Each field name needs to be specified in the request. Maximum limit of 10 field names. If field values are requested, only the first value is returned if it is a multi value field. The remaining field values can be retrieved via the GET fields route. Null or Empty field values should not be used to determine if a field is assigned to the entry.
+ /// - Default page size: 150. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. OData $OrderBy syntax should follow: "PropertyName direction,PropertyName2 direction". sort order can be either "asc" or "desc".
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The requested task ID. + /// Indicates if the result should be grouped by entry type or not. The default value is false. + /// Indicates if the search listing should be refreshed to show updated values. The default value is false. + /// Optional array of field names. Field values corresponding to the given field names will be returned for each search result. + /// Indicates if field values should be formatted. Only applicable if Fields are specified. The default value is false. + /// An optional odata header. Can be used to set the maximum page size using odata.maxpagesize. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. The formatFieldValues query parameter must be set to true, otherwise culture will not be used for formatting. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of entry search results. + /// A server side error occurred. + public virtual async Task ListSearchResultsAsync(string repositoryId, string taskId, bool? groupByEntryType = null, bool? refresh = null, IEnumerable fields = null, bool? formatFieldValues = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); - public bool ReadResponseAsString { get; set; } + if (taskId == null) + throw new ArgumentNullException("taskId"); - protected virtual async Task> ReadObjectResponseAsync(HttpResponseMessage response, IReadOnlyDictionary> headers, CancellationToken cancellationToken) - { - if (response == null || response.Content == null) + var urlBuilder_ = new StringBuilder(); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Searches/{taskId}/Results?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{taskId}", Uri.EscapeDataString(ConvertToString(taskId, CultureInfo.InvariantCulture))); + if (groupByEntryType != null) { - return new ObjectResponseResult(default(T), string.Empty); + urlBuilder_.Append(Uri.EscapeDataString("groupByEntryType") + "=").Append(Uri.EscapeDataString(ConvertToString(groupByEntryType, CultureInfo.InvariantCulture))).Append("&"); } - - if (ReadResponseAsString) + if (refresh != null) { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (Newtonsoft.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, responseText, JsonSerializerSettings, exception); - } + urlBuilder_.Append(Uri.EscapeDataString("refresh") + "=").Append(Uri.EscapeDataString(ConvertToString(refresh, CultureInfo.InvariantCulture))).Append("&"); } - else + if (fields != null) { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - using (var streamReader = new StreamReader(responseStream)) - using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) - { - var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); - var typedBody = serializer.Deserialize(jsonTextReader); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (Newtonsoft.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, exception); - } + foreach (var item_ in fields) { urlBuilder_.Append(Uri.EscapeDataString("fields") + "=").Append(Uri.EscapeDataString(ConvertToString(item_, CultureInfo.InvariantCulture))).Append("&"); } } - } - - private string ConvertToString(object value, CultureInfo cultureInfo) - { - if (value == null) + if (formatFieldValues != null) { - return ""; + urlBuilder_.Append(Uri.EscapeDataString("formatFieldValues") + "=").Append(Uri.EscapeDataString(ConvertToString(formatFieldValues, CultureInfo.InvariantCulture))).Append("&"); } - - if (value is Enum) + if (culture != null) { - var name = Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = CustomAttributeExtensions.GetCustomAttribute(field, typeof(EnumMemberAttribute)) - as EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = Convert.ToString(Convert.ChangeType(value, Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } + urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); } - else if (value is bool) + if (select != null) { - return Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); } - else if (value is byte[]) + if (orderby != null) { - return Convert.ToBase64String((byte[]) value); + urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); } - else if (value.GetType().IsArray) + if (top != null) { - var array = Enumerable.OfType((Array) value); - return string.Join(",", Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); + urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); } + if (skip != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); + } + if (count != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; - var result = Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } + var client_ = _httpClient; + bool[] disposeClient_ = new bool[]{ false }; + try + { + using (var request_ = new HttpRequestMessage()) + { - [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial interface ISimpleSearchesClient - { + if (prefer != null) + request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); + request_.Method = new HttpMethod("GET"); + request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); - /// - /// Runs a "simple" search operation. - /// - /// - /// - Runs a "simple" search operation on the repository.
- /// - Returns a truncated search result listing.
- /// - Search result listing may be truncated, depending on number of results. Additionally, searches may time out if they take too long. Use the other search route to run full searches.
- /// - Optionally returns field values for the entries in the search result listing. Each field name needs to be specified in the request. Maximum limit of 10 field names.
- /// - If field values are requested, only the first value is returned if it is a multi value field.
- /// - Null or Empty field values should not be used to determine if a field is assigned to the entry. - ///
- /// The requested repository ID. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Indicates whether the total count of items within a collection are returned in the result. - /// Optional array of field names. Field values corresponding to the given field names will be returned for each search result. - /// Boolean for if field values should be formatted. Only applicable if Fields are specified. - /// The Laserfiche search command to run. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. The formatFields query parameter must be set to true, otherwise
- /// culture will not be used for formatting. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Simple search run successfully. - /// A server side error occurred. - Task CreateSimpleSearchOperationAsync(string repoId, string select = null, string orderby = null, bool? count = null, IEnumerable fields = null, bool? formatFields = null, SimpleSearchRequest request = null, string culture = null, CancellationToken cancellationToken = default(CancellationToken)); + PrepareRequest(client_, request_, urlBuilder_); - } + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute); - [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class SimpleSearchesClient : BaseClient, ISimpleSearchesClient - { - private HttpClient _httpClient; - private Lazy _settings; + PrepareRequest(client_, request_, url_); - public SimpleSearchesClient(HttpClient httpClient) - { - _httpClient = httpClient; - _settings = new Lazy(CreateSerializerSettings); + return await ListSearchResultsSendAsync(request_, client_, disposeClient_, cancellationToken); + } + } + finally + { + if (disposeClient_[0]) + client_.Dispose(); + } } - private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() + protected virtual async Task ListSearchResultsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { - var settings = new Newtonsoft.Json.JsonSerializerSettings(); - UpdateJsonSerializerSettings(settings); - return settings; - } + var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } - protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } + ProcessResponse(client_, response_); - partial void PrepareRequest(HttpClient client, HttpRequestMessage request, string url); - partial void PrepareRequest(HttpClient client, HttpRequestMessage request, StringBuilder urlBuilder); - partial void ProcessResponse(HttpClient client, HttpResponseMessage response); + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else + if (status_ == 401) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else + if (status_ == 403) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else + if (status_ == 429) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw ApiExceptionExtensions.Create(status_, headers_, responseData_, JsonSerializerSettings, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } /// - /// Runs a "simple" search operation. + /// Returns the context hits associated with a search result entry. /// /// - /// - Runs a "simple" search operation on the repository.
- /// - Returns a truncated search result listing.
- /// - Search result listing may be truncated, depending on number of results. Additionally, searches may time out if they take too long. Use the other search route to run full searches.
- /// - Optionally returns field values for the entries in the search result listing. Each field name needs to be specified in the request. Maximum limit of 10 field names.
- /// - If field values are requested, only the first value is returned if it is a multi value field.
- /// - Null or Empty field values should not be used to determine if a field is assigned to the entry. + /// - Returns the context hits associated with a search result entry.
+ /// - Given a taskId, and rowNumber associated with a search entry in the listing, return the context hits for that entry.
+ /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. + /// The requested repository ID. + /// The requested task ID. + /// The search result listing row number to get context hits for. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. /// Limits the properties returned in the result. /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. /// Indicates whether the total count of items within a collection are returned in the result. - /// Optional array of field names. Field values corresponding to the given field names will be returned for each search result. - /// Boolean for if field values should be formatted. Only applicable if Fields are specified. - /// The Laserfiche search command to run. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. The formatFields query parameter must be set to true, otherwise
- /// culture will not be used for formatting. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Simple search run successfully. + /// A collection of context hits for a search result. /// A server side error occurred. - public virtual async Task CreateSimpleSearchOperationAsync(string repoId, string select = null, string orderby = null, bool? count = null, IEnumerable fields = null, bool? formatFields = null, SimpleSearchRequest request = null, string culture = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task ListSearchContextHitsAsync(string repositoryId, string taskId, int rowNumber, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); + + if (taskId == null) + throw new ArgumentNullException("taskId"); + + if (rowNumber == null) + throw new ArgumentNullException("rowNumber"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/SimpleSearches?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/Searches/{taskId}/Results/{rowNumber}/ContextHits?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{taskId}", Uri.EscapeDataString(ConvertToString(taskId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{rowNumber}", Uri.EscapeDataString(ConvertToString(rowNumber, CultureInfo.InvariantCulture))); if (select != null) { urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); @@ -7375,21 +7210,17 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); } - if (count != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); - } - if (fields != null) + if (top != null) { - foreach (var item_ in fields) { urlBuilder_.Append(Uri.EscapeDataString("fields") + "=").Append(Uri.EscapeDataString(ConvertToString(item_, CultureInfo.InvariantCulture))).Append("&"); } + urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); } - if (formatFields != null) + if (skip != null) { - urlBuilder_.Append(Uri.EscapeDataString("formatFields") + "=").Append(Uri.EscapeDataString(ConvertToString(formatFields, CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); } - if (culture != null) + if (count != null) { - urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; @@ -7399,11 +7230,10 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); - var content_ = new StringContent(json_); - content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new HttpMethod("POST"); + + if (prefer != null) + request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); + request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -7413,7 +7243,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await CreateSimpleSearchOperationSendAsync(request_, client_, disposeClient_, cancellationToken); + return await ListSearchContextHitsSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -7423,7 +7253,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task CreateSimpleSearchOperationSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task ListSearchContextHitsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -7441,23 +7271,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 204) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw ApiExceptionExtensions.Create(status_, headers_, responseText_, JsonSerializerSettings, null); - } - else - if (status_ == 206) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -7505,16 +7319,6 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 413) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else if (status_ == 429) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); @@ -7641,58 +7445,41 @@ private string ConvertToString(object value, CultureInfo cultureInfo) } [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial interface ITagDefinitionsClient + public partial interface ISimpleSearchesClient { /// - /// Returns the tag definitions associated with a repository. + /// Runs a "simple" search operation. /// /// - /// - Returns all tag definitions in the repository.
- /// - Provide a repository ID and get a paged listing of tag definitions available in the repository. Useful when trying to display all tag definitions available, not only tags assigned to a specific entry.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. + /// - Runs a "simple" search operation on the repository.
+ /// - Returns a truncated search result listing.
+ /// - Search result listing may be truncated, depending on number of results. Additionally, searches may time out if they take too long. Use the other search route to run full searches.
+ /// - Optionally returns field values for the entries in the folder. Each field name needs to be specified in the request. Maximum limit of 10 field names. If field values are requested, only the first value is returned if it is a multi value field. The remaining field values can be retrieved via the GET fields route. Null or Empty field values should not be used to determine if a field is assigned to the entry.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. - /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. + /// The requested repository ID. + /// The Laserfiche search command to run. /// Limits the properties returned in the result. /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. /// Indicates whether the total count of items within a collection are returned in the result. + /// Optional array of field names. Field values corresponding to the given field names will be returned for each search result. + /// Indicates if field values should be formatted. Only applicable if Fields are specified. The default value is false. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. The formatFieldValues query parameter must be set to true, otherwise culture will not be used for formatting. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get tag definitions successfully. - /// A server side error occurred. - Task GetTagDefinitionsAsync(string repoId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Returns a single tag definition object. - /// - /// - /// - Returns a single tag definition.
- /// - Provide a tag definition ID, and get the single tag definition associated with that ID. Useful when another route provides a minimal amount of details, and more information about the specific tag is needed.
- /// - Allowed OData query options: Select - ///
- /// The requested repository ID. - /// The requested tag definition ID. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. - /// Limits the properties returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get tag definition successfully. + /// A collection of entry search results. /// A server side error occurred. - Task GetTagDefinitionByIdAsync(string repoId, int tagId, string culture = null, string select = null, CancellationToken cancellationToken = default(CancellationToken)); + Task SearchEntryAsync(string repositoryId, SearchEntryRequest request, string select = null, string orderby = null, bool? count = null, IEnumerable fields = null, bool? formatFieldValues = null, string culture = null, CancellationToken cancellationToken = default(CancellationToken)); } [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class TagDefinitionsClient : BaseClient, ITagDefinitionsClient + public partial class SimpleSearchesClient : BaseClient, ISimpleSearchesClient { private HttpClient _httpClient; private Lazy _settings; - public TagDefinitionsClient(HttpClient httpClient) + public SimpleSearchesClient(HttpClient httpClient) { _httpClient = httpClient; _settings = new Lazy(CreateSerializerSettings); @@ -7712,37 +7499,37 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() partial void ProcessResponse(HttpClient client, HttpResponseMessage response); /// - /// Returns the tag definitions associated with a repository. + /// Runs a "simple" search operation. /// /// - /// - Returns all tag definitions in the repository.
- /// - Provide a repository ID and get a paged listing of tag definitions available in the repository. Useful when trying to display all tag definitions available, not only tags assigned to a specific entry.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. + /// - Runs a "simple" search operation on the repository.
+ /// - Returns a truncated search result listing.
+ /// - Search result listing may be truncated, depending on number of results. Additionally, searches may time out if they take too long. Use the other search route to run full searches.
+ /// - Optionally returns field values for the entries in the folder. Each field name needs to be specified in the request. Maximum limit of 10 field names. If field values are requested, only the first value is returned if it is a multi value field. The remaining field values can be retrieved via the GET fields route. Null or Empty field values should not be used to determine if a field is assigned to the entry.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. - /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. + /// The requested repository ID. + /// The Laserfiche search command to run. /// Limits the properties returned in the result. /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. /// Indicates whether the total count of items within a collection are returned in the result. + /// Optional array of field names. Field values corresponding to the given field names will be returned for each search result. + /// Indicates if field values should be formatted. Only applicable if Fields are specified. The default value is false. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. The formatFieldValues query parameter must be set to true, otherwise culture will not be used for formatting. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get tag definitions successfully. + /// A collection of entry search results. /// A server side error occurred. - public virtual async Task GetTagDefinitionsAsync(string repoId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task SearchEntryAsync(string repositoryId, SearchEntryRequest request, string select = null, string orderby = null, bool? count = null, IEnumerable fields = null, bool? formatFieldValues = null, string culture = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); + + if (request == null) + throw new ArgumentNullException("request"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/TagDefinitions?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - if (culture != null) - { - urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); - } + urlBuilder_.Append("v2/Repositories/{repositoryId}/SimpleSearches?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); if (select != null) { urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); @@ -7751,17 +7538,21 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); } - if (top != null) + if (count != null) { - urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); } - if (skip != null) + if (fields != null) { - urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); + foreach (var item_ in fields) { urlBuilder_.Append(Uri.EscapeDataString("fields") + "=").Append(Uri.EscapeDataString(ConvertToString(item_, CultureInfo.InvariantCulture))).Append("&"); } } - if (count != null) + if (formatFieldValues != null) { - urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Append(Uri.EscapeDataString("formatFieldValues") + "=").Append(Uri.EscapeDataString(ConvertToString(formatFieldValues, CultureInfo.InvariantCulture))).Append("&"); + } + if (culture != null) + { + urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; @@ -7771,10 +7562,11 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - - if (prefer != null) - request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); - request_.Method = new HttpMethod("GET"); + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value); + var content_ = new StringContent(json_); + content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new HttpMethod("POST"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -7784,7 +7576,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetTagDefinitionsSendAsync(request_, client_, disposeClient_, cancellationToken); + return await SearchEntrySendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -7794,7 +7586,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetTagDefinitionsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task SearchEntrySendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -7812,7 +7604,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -7820,47 +7612,17 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() return objectResponse_.Object; } else - if (status_ == 400) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - if (status_ == 401) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - if (status_ == 403) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - if (status_ == 404) + if (status_ == 206) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + return objectResponse_.Object; } else - if (status_ == 429) + if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) @@ -7870,109 +7632,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw ApiExceptionExtensions.Create(status_, headers_, responseData_, JsonSerializerSettings, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - - /// - /// Returns a single tag definition object. - /// - /// - /// - Returns a single tag definition.
- /// - Provide a tag definition ID, and get the single tag definition associated with that ID. Useful when another route provides a minimal amount of details, and more information about the specific tag is needed.
- /// - Allowed OData query options: Select - ///
- /// The requested repository ID. - /// The requested tag definition ID. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. - /// Limits the properties returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get tag definition successfully. - /// A server side error occurred. - public virtual async Task GetTagDefinitionByIdAsync(string repoId, int tagId, string culture = null, string select = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (repoId == null) - throw new ArgumentNullException("repoId"); - - if (tagId == null) - throw new ArgumentNullException("tagId"); - - var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/TagDefinitions/{tagId}?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{tagId}", Uri.EscapeDataString(ConvertToString(tagId, CultureInfo.InvariantCulture))); - if (culture != null) - { - urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); - } - if (select != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); - } - urlBuilder_.Length--; - - var client_ = _httpClient; - bool[] disposeClient_ = new bool[]{ false }; - try - { - using (var request_ = new HttpRequestMessage()) - { - request_.Method = new HttpMethod("GET"); - request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - return await GetTagDefinitionByIdSendAsync(request_, client_, disposeClient_, cancellationToken); - } - } - finally - { - if (disposeClient_[0]) - client_.Dispose(); - } - } - - protected virtual async Task GetTagDefinitionByIdSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) - { - var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) + if (status_ == 401) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) @@ -7982,7 +7642,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 401) + if (status_ == 403) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) @@ -7992,7 +7652,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 403) + if (status_ == 404) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) @@ -8002,7 +7662,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else - if (status_ == 404) + if (status_ == 413) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) @@ -8138,48 +7798,58 @@ private string ConvertToString(object value, CultureInfo cultureInfo) } [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial interface ITasksClient + public partial interface ITagDefinitionsClient { /// - /// Returns the status of an operation. + /// Returns the tag definitions associated with a repository. /// /// - /// - Returns the status of an operation.
- /// - Provide an operationToken (returned in other asynchronous routes) to get the operation status, progress, and any errors that may have occurred. When the operation is completed, the Location header can be inspected as a link to the modified resources (if relevant).
- /// - OperationStatus can be one of the following values: NotStarted, InProgress, Completed, or Failed. + /// - Returns all tag definitions in the repository.
+ /// - Provide a repository ID and get a paged listing of tag definitions available in the repository. Useful when trying to display all tag definitions available, not only tags assigned to a specific entry.
+ /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID - /// The operation token + /// The requested repository ID. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get completed or failed operation status with no result successfully. + /// A collection of tag definitions. /// A server side error occurred. - Task GetOperationStatusAndProgressAsync(string repoId, string operationToken, CancellationToken cancellationToken = default(CancellationToken)); + Task ListTagDefinitionsAsync(string repositoryId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Cancels an operation. + /// Returns a single tag definition object. /// /// - /// - Cancels an operation.
- /// - Provide an operationToken to cancel the operation, if possible. Should be used if an operation was created in error, or is no longer necessary.
- /// - Rollbacks must be done manually. For example, if a copy operation is started and is halfway complete when canceled, the client application is responsible for cleaning up the files that were successfully copied before the operation was canceled. + /// - Returns a single tag definition.
+ /// - Provide a tag definition ID, and get the single tag definition associated with that ID. Useful when another route provides a minimal amount of details, and more information about the specific tag is needed.
+ /// - Allowed OData query options: Select
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID - /// The operation token + /// The requested repository ID. + /// The requested tag definition ID. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. + /// Limits the properties returned in the result. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Cancel operation successfully. + /// A single tag definition. /// A server side error occurred. - Task CancelOperationAsync(string repoId, string operationToken, CancellationToken cancellationToken = default(CancellationToken)); + Task GetTagDefinitionAsync(string repositoryId, int tagId, string culture = null, string select = null, CancellationToken cancellationToken = default(CancellationToken)); } [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class TasksClient : BaseClient, ITasksClient + public partial class TagDefinitionsClient : BaseClient, ITagDefinitionsClient { private HttpClient _httpClient; private Lazy _settings; - public TasksClient(HttpClient httpClient) + public TagDefinitionsClient(HttpClient httpClient) { _httpClient = httpClient; _settings = new Lazy(CreateSerializerSettings); @@ -8199,30 +7869,58 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() partial void ProcessResponse(HttpClient client, HttpResponseMessage response); /// - /// Returns the status of an operation. + /// Returns the tag definitions associated with a repository. /// /// - /// - Returns the status of an operation.
- /// - Provide an operationToken (returned in other asynchronous routes) to get the operation status, progress, and any errors that may have occurred. When the operation is completed, the Location header can be inspected as a link to the modified resources (if relevant).
- /// - OperationStatus can be one of the following values: NotStarted, InProgress, Completed, or Failed. + /// - Returns all tag definitions in the repository.
+ /// - Provide a repository ID and get a paged listing of tag definitions available in the repository. Useful when trying to display all tag definitions available, not only tags assigned to a specific entry.
+ /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID - /// The operation token + /// The requested repository ID. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get completed or failed operation status with no result successfully. + /// A collection of tag definitions. /// A server side error occurred. - public virtual async Task GetOperationStatusAndProgressAsync(string repoId, string operationToken, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task ListTagDefinitionsAsync(string repositoryId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); - - if (operationToken == null) - throw new ArgumentNullException("operationToken"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Tasks/{operationToken}"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{operationToken}", Uri.EscapeDataString(ConvertToString(operationToken, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/TagDefinitions?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + if (culture != null) + { + urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); + } + if (select != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); + } + if (orderby != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); + } + if (top != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); + } + if (skip != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); + } + if (count != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; var client_ = _httpClient; bool[] disposeClient_ = new bool[]{ false }; @@ -8230,6 +7928,9 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { + + if (prefer != null) + request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); @@ -8240,7 +7941,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetOperationStatusAndProgressSendAsync(request_, client_, disposeClient_, cancellationToken); + return await ListTagDefinitionsSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -8250,7 +7951,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetOperationStatusAndProgressSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task ListTagDefinitionsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -8268,27 +7969,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 201) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 202) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -8359,30 +8040,42 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Cancels an operation. + /// Returns a single tag definition object. /// /// - /// - Cancels an operation.
- /// - Provide an operationToken to cancel the operation, if possible. Should be used if an operation was created in error, or is no longer necessary.
- /// - Rollbacks must be done manually. For example, if a copy operation is started and is halfway complete when canceled, the client application is responsible for cleaning up the files that were successfully copied before the operation was canceled. + /// - Returns a single tag definition.
+ /// - Provide a tag definition ID, and get the single tag definition associated with that ID. Useful when another route provides a minimal amount of details, and more information about the specific tag is needed.
+ /// - Allowed OData query options: Select
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID - /// The operation token + /// The requested repository ID. + /// The requested tag definition ID. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. + /// Limits the properties returned in the result. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Cancel operation successfully. + /// A single tag definition. /// A server side error occurred. - public virtual async Task CancelOperationAsync(string repoId, string operationToken, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task GetTagDefinitionAsync(string repositoryId, int tagId, string culture = null, string select = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); - if (operationToken == null) - throw new ArgumentNullException("operationToken"); + if (tagId == null) + throw new ArgumentNullException("tagId"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/Tasks/{operationToken}"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{operationToken}", Uri.EscapeDataString(ConvertToString(operationToken, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/TagDefinitions/{tagId}?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{tagId}", Uri.EscapeDataString(ConvertToString(tagId, CultureInfo.InvariantCulture))); + if (culture != null) + { + urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); + } + if (select != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; var client_ = _httpClient; bool[] disposeClient_ = new bool[]{ false }; @@ -8390,7 +8083,8 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - request_.Method = new HttpMethod("DELETE"); + request_.Method = new HttpMethod("GET"); + request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -8399,8 +8093,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - await CancelOperationSendAsync(request_, client_, disposeClient_, cancellationToken); - return; + return await GetTagDefinitionSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -8410,7 +8103,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task CancelOperationSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task GetTagDefinitionSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -8426,9 +8119,14 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() ProcessResponse(client_, response_); var status_ = (int)response_.StatusCode; - if (status_ == 204) + if (status_ == 200) { - return; + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + return objectResponse_.Object; } else if (status_ == 400) @@ -8597,105 +8295,54 @@ private string ConvertToString(object value, CultureInfo cultureInfo) } [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial interface ITemplateDefinitionsClient + public partial interface ITasksClient { /// - /// Returns the template definitions associated with a repository. - /// - /// - /// - Returns all template definitions (including field definitions) in the repository. If a template name query parameter is given, then a single template definition is returned.
- /// - Provide a repository ID, and get a paged listing of template definitions available in the repository. Useful when trying to find a list of all template definitions available, rather than a specific one.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. - ///
- /// The requested repository ID. - /// An optional query parameter. Can be used to get a single template definition using the template name. - /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get template definitions successfully. - /// A server side error occurred. - Task GetTemplateDefinitionsAsync(string repoId, string templateName = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Returns a single template definition object. - /// - /// - /// - Returns a single template definition (including field definitions, if relevant).
- /// - Provide a template definition ID, and get the single template definition associated with that ID. Useful when a route provides a minimal amount of details, and more information about the specific template is needed.
- /// - Allowed OData query options: Select - ///
- /// The requested repository ID. - /// The requested template definition ID. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. - /// Limits the properties returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get template definition successfully. - /// A server side error occurred. - Task GetTemplateDefinitionByIdAsync(string repoId, int templateId, string culture = null, string select = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Returns the field definitions assigned to a template definition (by template definition ID). + /// Returns the status of a set of one or more tasks. /// /// - /// - Returns the field definitions assigned to a template definition.
- /// - Provide a template definition ID, and get a paged listing of the field definitions assigned to that template.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. + /// - Returns the status of a set of one or more tasks.
+ /// - Provide a comma-separated list of task IDs to get the task status, progress, and any errors that may have occurred.
+ /// - Leave the taskIds query parameter empty, to get the list of all the task IDs associated with the current access token.
+ /// - TaskStatus can be one of the following values: NotStarted, InProgress, Completed, Cancelled, or Failed.
+ /// - This API employs long polling technique and could return the result immediately (e.g. if the export operation is failed or completed successfully) or after atmost 60 seconds.
+ /// - Required OAuth scope: None ///
- /// The requested repository ID. - /// The requested template definition ID. - /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. + /// The requested repository ID + /// An array of task IDs. Leave this parameter empty to get the list of all the tasks associated with the current access token. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get template field definitions successfully. + /// A collection of task progresses. /// A server side error occurred. - Task GetTemplateFieldDefinitionsAsync(string repoId, int templateId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); + Task ListTasksAsync(string repositoryId, IEnumerable taskIds = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Returns the field definitions assigned to a template definition (by template definition name). + /// Starts the cancellation for a set of one or more tasks. /// /// - /// - Returns the field definitions assigned to a template definition.
- /// - Provide a template definition name, and get a paged listing of the field definitions assigned to that template.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. + /// - Starts the cancellation for a set of one or more tasks.
+ /// - Provide comma-separated list of task IDs to cancel. Should be used if an operation was created in error, or is no longer necessary.
+ /// - Check the status of the task to determine if the task has been cancelled successfully.
+ /// - Leave the taskIds query parameter empty, to cancel the list of all the task IDs associated with the current access token.
+ /// - Rollbacks must be done manually. For example, if a copy operation is started and is halfway complete when canceled, the client application is responsible for cleaning up the files that were successfully copied before the operation was canceled.
+ /// - Required OAuth scope: None ///
- /// The requested repository ID. - /// A required query parameter for the requested template name. - /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. + /// The requested repository ID + /// An array of task IDs. Leave this parameter empty to cancel the list of all the tasks associated with the current access token. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get template field definitions successfully. + /// A collection of task cancellation results. /// A server side error occurred. - Task GetTemplateFieldDefinitionsByTemplateNameAsync(string repoId, string templateName, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); + Task CancelTasksAsync(string repositoryId, IEnumerable taskIds = null, CancellationToken cancellationToken = default(CancellationToken)); } [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class TemplateDefinitionsClient : BaseClient, ITemplateDefinitionsClient + public partial class TasksClient : BaseClient, ITasksClient { private HttpClient _httpClient; private Lazy _settings; - public TemplateDefinitionsClient(HttpClient httpClient) + public TasksClient(HttpClient httpClient) { _httpClient = httpClient; _settings = new Lazy(CreateSerializerSettings); @@ -8715,61 +8362,32 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() partial void ProcessResponse(HttpClient client, HttpResponseMessage response); /// - /// Returns the template definitions associated with a repository. + /// Returns the status of a set of one or more tasks. /// /// - /// - Returns all template definitions (including field definitions) in the repository. If a template name query parameter is given, then a single template definition is returned.
- /// - Provide a repository ID, and get a paged listing of template definitions available in the repository. Useful when trying to find a list of all template definitions available, rather than a specific one.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. + /// - Returns the status of a set of one or more tasks.
+ /// - Provide a comma-separated list of task IDs to get the task status, progress, and any errors that may have occurred.
+ /// - Leave the taskIds query parameter empty, to get the list of all the task IDs associated with the current access token.
+ /// - TaskStatus can be one of the following values: NotStarted, InProgress, Completed, Cancelled, or Failed.
+ /// - This API employs long polling technique and could return the result immediately (e.g. if the export operation is failed or completed successfully) or after atmost 60 seconds.
+ /// - Required OAuth scope: None ///
- /// The requested repository ID. - /// An optional query parameter. Can be used to get a single template definition using the template name. - /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. + /// The requested repository ID + /// An array of task IDs. Leave this parameter empty to get the list of all the tasks associated with the current access token. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get template definitions successfully. + /// A collection of task progresses. /// A server side error occurred. - public virtual async Task GetTemplateDefinitionsAsync(string repoId, string templateName = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task ListTasksAsync(string repositoryId, IEnumerable taskIds = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/TemplateDefinitions?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - if (templateName != null) - { - urlBuilder_.Append(Uri.EscapeDataString("templateName") + "=").Append(Uri.EscapeDataString(ConvertToString(templateName, CultureInfo.InvariantCulture))).Append("&"); - } - if (culture != null) - { - urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); - } - if (select != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); - } - if (orderby != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); - } - if (top != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); - } - if (skip != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); - } - if (count != null) + urlBuilder_.Append("v2/Repositories/{repositoryId}/Tasks?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + if (taskIds != null) { - urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); + foreach (var item_ in taskIds) { urlBuilder_.Append(Uri.EscapeDataString("taskIds") + "=").Append(Uri.EscapeDataString(ConvertToString(item_, CultureInfo.InvariantCulture))).Append("&"); } } urlBuilder_.Length--; @@ -8779,9 +8397,6 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - - if (prefer != null) - request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); @@ -8792,7 +8407,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetTemplateDefinitionsSendAsync(request_, client_, disposeClient_, cancellationToken); + return await ListTasksSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -8802,7 +8417,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetTemplateDefinitionsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task ListTasksSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -8820,7 +8435,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -8891,40 +8506,32 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Returns a single template definition object. + /// Starts the cancellation for a set of one or more tasks. /// /// - /// - Returns a single template definition (including field definitions, if relevant).
- /// - Provide a template definition ID, and get the single template definition associated with that ID. Useful when a route provides a minimal amount of details, and more information about the specific template is needed.
- /// - Allowed OData query options: Select + /// - Starts the cancellation for a set of one or more tasks.
+ /// - Provide comma-separated list of task IDs to cancel. Should be used if an operation was created in error, or is no longer necessary.
+ /// - Check the status of the task to determine if the task has been cancelled successfully.
+ /// - Leave the taskIds query parameter empty, to cancel the list of all the task IDs associated with the current access token.
+ /// - Rollbacks must be done manually. For example, if a copy operation is started and is halfway complete when canceled, the client application is responsible for cleaning up the files that were successfully copied before the operation was canceled.
+ /// - Required OAuth scope: None ///
- /// The requested repository ID. - /// The requested template definition ID. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. - /// Limits the properties returned in the result. + /// The requested repository ID + /// An array of task IDs. Leave this parameter empty to cancel the list of all the tasks associated with the current access token. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get template definition successfully. + /// A collection of task cancellation results. /// A server side error occurred. - public virtual async Task GetTemplateDefinitionByIdAsync(string repoId, int templateId, string culture = null, string select = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task CancelTasksAsync(string repositoryId, IEnumerable taskIds = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); - - if (templateId == null) - throw new ArgumentNullException("templateId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/TemplateDefinitions/{templateId}?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{templateId}", Uri.EscapeDataString(ConvertToString(templateId, CultureInfo.InvariantCulture))); - if (culture != null) - { - urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); - } - if (select != null) + urlBuilder_.Append("v2/Repositories/{repositoryId}/Tasks?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + if (taskIds != null) { - urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); + foreach (var item_ in taskIds) { urlBuilder_.Append(Uri.EscapeDataString("taskIds") + "=").Append(Uri.EscapeDataString(ConvertToString(item_, CultureInfo.InvariantCulture))).Append("&"); } } urlBuilder_.Length--; @@ -8934,7 +8541,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - request_.Method = new HttpMethod("GET"); + request_.Method = new HttpMethod("DELETE"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -8944,7 +8551,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetTemplateDefinitionByIdSendAsync(request_, client_, disposeClient_, cancellationToken); + return await CancelTasksSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -8954,7 +8561,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetTemplateDefinitionByIdSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task CancelTasksSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -8972,7 +8579,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -9042,181 +8649,176 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - /// - /// Returns the field definitions assigned to a template definition (by template definition ID). - /// - /// - /// - Returns the field definitions assigned to a template definition.
- /// - Provide a template definition ID, and get a paged listing of the field definitions assigned to that template.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. - ///
- /// The requested repository ID. - /// The requested template definition ID. - /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. - /// Limits the properties returned in the result. - /// Specifies the order in which items are returned. The maximum number of expressions is 5. - /// Limits the number of items returned from a collection. - /// Excludes the specified number of items of the queried collection from the result. - /// Indicates whether the total count of items within a collection are returned in the result. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get template field definitions successfully. - /// A server side error occurred. - public virtual async Task GetTemplateFieldDefinitionsAsync(string repoId, int templateId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) + protected struct ObjectResponseResult { - if (repoId == null) - throw new ArgumentNullException("repoId"); - - if (templateId == null) - throw new ArgumentNullException("templateId"); - - var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/TemplateDefinitions/{templateId}/Fields?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Replace("{templateId}", Uri.EscapeDataString(ConvertToString(templateId, CultureInfo.InvariantCulture))); - if (culture != null) - { - urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); - } - if (select != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); - } - if (orderby != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); - } - if (top != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); - } - if (skip != null) - { - urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); - } - if (count != null) + public ObjectResponseResult(T responseObject, string responseText) { - urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); + this.Object = responseObject; + this.Text = responseText; } - urlBuilder_.Length--; - - var client_ = _httpClient; - bool[] disposeClient_ = new bool[]{ false }; - try - { - using (var request_ = new HttpRequestMessage()) - { - if (prefer != null) - request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); - request_.Method = new HttpMethod("GET"); - request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); - - PrepareRequest(client_, request_, urlBuilder_); + public T Object { get; } - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute); + public string Text { get; } + } - PrepareRequest(client_, request_, url_); + public bool ReadResponseAsString { get; set; } - return await GetTemplateFieldDefinitionsSendAsync(request_, client_, disposeClient_, cancellationToken); - } - } - finally + protected virtual async Task> ReadObjectResponseAsync(HttpResponseMessage response, IReadOnlyDictionary> headers, CancellationToken cancellationToken) + { + if (response == null || response.Content == null) { - if (disposeClient_[0]) - client_.Dispose(); + return new ObjectResponseResult(default(T), string.Empty); } - } - protected virtual async Task GetTemplateFieldDefinitionsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) - { - var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try + if (ReadResponseAsString) { - var headers_ = Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); - if (response_.Content != null && response_.Content.Headers != null) + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; + var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) + catch (Newtonsoft.Json.JsonException exception) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - return objectResponse_.Object; + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, responseText, JsonSerializerSettings, exception); } - else - if (status_ == 400) + } + else + { + try { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + using (var streamReader = new StreamReader(responseStream)) + using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) { - throw ApiExceptionExtensions.Create(status_, headers_, null); + var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); + var typedBody = serializer.Deserialize(jsonTextReader); + return new ObjectResponseResult(typedBody, string.Empty); } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } - else - if (status_ == 401) + catch (Newtonsoft.Json.JsonException exception) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, exception); } - else - if (status_ == 403) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - if (status_ == 404) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw ApiExceptionExtensions.Create(status_, headers_, null); - } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - if (status_ == 429) + } + } + + private string ConvertToString(object value, CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is Enum) + { + var name = Enum.GetName(value.GetType(), value); + if (name != null) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) + var field = IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) { - throw ApiExceptionExtensions.Create(status_, headers_, null); + var attribute = CustomAttributeExtensions.GetCustomAttribute(field, typeof(EnumMemberAttribute)) + as EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } } - throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw ApiExceptionExtensions.Create(status_, headers_, responseData_, JsonSerializerSettings, null); + + var converted = Convert.ToString(Convert.ChangeType(value, Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; } } - finally + else if (value is bool) { - if (disposeResponse_) - response_.Dispose(); + return Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return Convert.ToBase64String((byte[]) value); + } + else if (value.GetType().IsArray) + { + var array = Enumerable.OfType((Array) value); + return string.Join(",", Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } + + var result = Convert.ToString(value, cultureInfo); + return result == null ? "" : result; } + } + + [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface ITemplateDefinitionsClient + { + + /// + /// Returns the template definitions associated with a repository. + /// + /// + /// - Returns all template definitions (including field definitions) in the repository. If a template name query parameter is given, then a single template definition is returned.
+ /// - Provide a repository ID, and get a paged listing of template definitions available in the repository. Useful when trying to find a list of all template definitions available, rather than a specific one.
+ /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// An optional query parameter. Can be used to get a single template definition using the template name. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of template definitions. + /// A server side error occurred. + Task ListTemplateDefinitionsAsync(string repositoryId, string templateName = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Returns a single template definition object. + /// + /// + /// - Returns a single template definition (including field definitions, if relevant).
+ /// - Provide a template definition ID, and get the single template definition associated with that ID. Useful when a route provides a minimal amount of details, and more information about the specific template is needed.
+ /// - Allowed OData query options: Select
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The requested template definition ID. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. + /// Limits the properties returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A single template definition. + /// A server side error occurred. + Task GetTemplateDefinitionAsync(string repositoryId, int templateId, string culture = null, string select = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Returns the field definitions assigned to a template definition (by template definition ID). + /// + /// + /// - Returns the field definitions assigned to a template definition.
+ /// - Provide a template definition ID, and get a paged listing of the field definitions assigned to that template.
+ /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The requested template definition ID. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of template field definitions. + /// A server side error occurred. + Task ListTemplateFieldDefinitionsByTemplateIdAsync(string repositoryId, int templateId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Returns the field definitions assigned to a template definition (by template definition name). @@ -9224,30 +8826,83 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() /// /// - Returns the field definitions assigned to a template definition.
/// - Provide a template definition name, and get a paged listing of the field definitions assigned to that template.
- /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer. + /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. + /// The requested repository ID. /// A required query parameter for the requested template name. /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. - /// An optional query parameter used to indicate the locale that should be used for formatting.
- /// The value should be a standard language tag. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A collection of template field definitions. + /// A server side error occurred. + Task ListTemplateFieldDefinitionsByTemplateNameAsync(string repositoryId, string templateName, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)); + + } + + [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TemplateDefinitionsClient : BaseClient, ITemplateDefinitionsClient + { + private HttpClient _httpClient; + private Lazy _settings; + + public TemplateDefinitionsClient(HttpClient httpClient) + { + _httpClient = httpClient; + _settings = new Lazy(CreateSerializerSettings); + } + + private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() + { + var settings = new Newtonsoft.Json.JsonSerializerSettings(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } + + partial void PrepareRequest(HttpClient client, HttpRequestMessage request, string url); + partial void PrepareRequest(HttpClient client, HttpRequestMessage request, StringBuilder urlBuilder); + partial void ProcessResponse(HttpClient client, HttpResponseMessage response); + + /// + /// Returns the template definitions associated with a repository. + /// + /// + /// - Returns all template definitions (including field definitions) in the repository. If a template name query parameter is given, then a single template definition is returned.
+ /// - Provide a repository ID, and get a paged listing of template definitions available in the repository. Useful when trying to find a list of all template definitions available, rather than a specific one.
+ /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// An optional query parameter. Can be used to get a single template definition using the template name. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. /// Limits the properties returned in the result. /// Specifies the order in which items are returned. The maximum number of expressions is 5. /// Limits the number of items returned from a collection. /// Excludes the specified number of items of the queried collection from the result. /// Indicates whether the total count of items within a collection are returned in the result. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Get template field definitions successfully. + /// A collection of template definitions. /// A server side error occurred. - public virtual async Task GetTemplateFieldDefinitionsByTemplateNameAsync(string repoId, string templateName, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task ListTemplateDefinitionsAsync(string repositoryId, string templateName = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/TemplateDefinitions/Fields?"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - urlBuilder_.Append(Uri.EscapeDataString("templateName") + "=").Append(Uri.EscapeDataString(templateName != null ? ConvertToString(templateName, CultureInfo.InvariantCulture) : "")).Append("&"); + urlBuilder_.Append("v2/Repositories/{repositoryId}/TemplateDefinitions?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + if (templateName != null) + { + urlBuilder_.Append(Uri.EscapeDataString("templateName") + "=").Append(Uri.EscapeDataString(ConvertToString(templateName, CultureInfo.InvariantCulture))).Append("&"); + } if (culture != null) { urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); @@ -9293,7 +8948,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await GetTemplateFieldDefinitionsByTemplateNameSendAsync(request_, client_, disposeClient_, cancellationToken); + return await ListTemplateDefinitionsSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -9303,7 +8958,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task GetTemplateFieldDefinitionsByTemplateNameSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task ListTemplateDefinitionsSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -9321,7 +8976,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -9391,241 +9046,75 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected struct ObjectResponseResult + /// + /// Returns a single template definition object. + /// + /// + /// - Returns a single template definition (including field definitions, if relevant).
+ /// - Provide a template definition ID, and get the single template definition associated with that ID. Useful when a route provides a minimal amount of details, and more information about the specific template is needed.
+ /// - Allowed OData query options: Select
+ /// - Required OAuth scope: repository.Read + ///
+ /// The requested repository ID. + /// The requested template definition ID. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. + /// Limits the properties returned in the result. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A single template definition. + /// A server side error occurred. + public virtual async Task GetTemplateDefinitionAsync(string repositoryId, int templateId, string culture = null, string select = null, CancellationToken cancellationToken = default(CancellationToken)) { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); - public bool ReadResponseAsString { get; set; } + if (templateId == null) + throw new ArgumentNullException("templateId"); - protected virtual async Task> ReadObjectResponseAsync(HttpResponseMessage response, IReadOnlyDictionary> headers, CancellationToken cancellationToken) - { - if (response == null || response.Content == null) + var urlBuilder_ = new StringBuilder(); + urlBuilder_.Append("v2/Repositories/{repositoryId}/TemplateDefinitions/{templateId}?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{templateId}", Uri.EscapeDataString(ConvertToString(templateId, CultureInfo.InvariantCulture))); + if (culture != null) { - return new ObjectResponseResult(default(T), string.Empty); + urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); + } + if (select != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); } + urlBuilder_.Length--; - if (ReadResponseAsString) + var client_ = _httpClient; + bool[] disposeClient_ = new bool[]{ false }; + try { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (Newtonsoft.Json.JsonException exception) + using (var request_ = new HttpRequestMessage()) { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, responseText, JsonSerializerSettings, exception); + request_.Method = new HttpMethod("GET"); + request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + return await GetTemplateDefinitionSendAsync(request_, client_, disposeClient_, cancellationToken); } } - else + finally { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - using (var streamReader = new StreamReader(responseStream)) - using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) - { - var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); - var typedBody = serializer.Deserialize(jsonTextReader); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (Newtonsoft.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw ApiExceptionExtensions.Create((int)response.StatusCode, headers, exception); - } + if (disposeClient_[0]) + client_.Dispose(); } } - private string ConvertToString(object value, CultureInfo cultureInfo) + protected virtual async Task GetTemplateDefinitionSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { - if (value == null) - { - return ""; - } - - if (value is Enum) - { - var name = Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = CustomAttributeExtensions.GetCustomAttribute(field, typeof(EnumMemberAttribute)) - as EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = Convert.ToString(Convert.ChangeType(value, Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return Convert.ToBase64String((byte[]) value); - } - else if (value.GetType().IsArray) - { - var array = Enumerable.OfType((Array) value); - return string.Join(",", Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); - } - - var result = Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial interface IServerSessionClient - { - - /// - /// Deprecated. Do not call this api. - /// - /// - /// - Deprecated.
- /// - Invalidates the server session.
- /// - Acts as a "logout" operation, and invalidates the session associated with the provided access token. This method should be used when the client wants to clean up the current session.
- /// - Only available in Laserfiche Cloud. - ///
- /// The requested repository ID. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Invalidate the server session successfully. - /// A server side error occurred. - [Obsolete] - Task InvalidateServerSessionAsync(string repoId, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Deprecated. Do not call this api. - /// - /// - /// - Deprecated.
- /// - Refreshes the session associated with the access token. This is only necessary if you want to keep the same session alive, otherwise a new session will be automatically created when the session expires.
- /// - When a client application wants to keep a session alive that has been idle for an hour, this route can be used to refresh the expiration timer associated with the access token.
- /// - Only available in Laserfiche Cloud. - ///
- /// The requested repository ID. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Refresh the session successfully. - /// A server side error occurred. - [Obsolete] - Task RefreshServerSessionAsync(string repoId, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Deprecated. Do not call this api. - /// - /// - /// - Deprecated. This function is a no-op, always returns 200.
- /// - Only available in Laserfiche Cloud. - ///
- /// The requested repository ID. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Create the session successfully. - /// A server side error occurred. - [Obsolete] - Task CreateServerSessionAsync(string repoId, CancellationToken cancellationToken = default(CancellationToken)); - - } - - [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ServerSessionClient : BaseClient, IServerSessionClient - { - private HttpClient _httpClient; - private Lazy _settings; - - public ServerSessionClient(HttpClient httpClient) - { - _httpClient = httpClient; - _settings = new Lazy(CreateSerializerSettings); - } - - private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() - { - var settings = new Newtonsoft.Json.JsonSerializerSettings(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } - - partial void PrepareRequest(HttpClient client, HttpRequestMessage request, string url); - partial void PrepareRequest(HttpClient client, HttpRequestMessage request, StringBuilder urlBuilder); - partial void ProcessResponse(HttpClient client, HttpResponseMessage response); - - /// - /// Deprecated. Do not call this api. - /// - /// - /// - Deprecated.
- /// - Invalidates the server session.
- /// - Acts as a "logout" operation, and invalidates the session associated with the provided access token. This method should be used when the client wants to clean up the current session.
- /// - Only available in Laserfiche Cloud. - ///
- /// The requested repository ID. - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Invalidate the server session successfully. - /// A server side error occurred. - [Obsolete] - public virtual async Task InvalidateServerSessionAsync(string repoId, CancellationToken cancellationToken = default(CancellationToken)) - { - if (repoId == null) - throw new ArgumentNullException("repoId"); - - var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/ServerSession/Invalidate"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); - - var client_ = _httpClient; - bool[] disposeClient_ = new bool[]{ false }; - try - { - using (var request_ = new HttpRequestMessage()) - { - request_.Content = new StringContent(string.Empty, Encoding.UTF8, "application/json"); - request_.Method = new HttpMethod("POST"); - request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - return await InvalidateServerSessionSendAsync(request_, client_, disposeClient_, cancellationToken); - } - } - finally - { - if (disposeClient_[0]) - client_.Dispose(); - } - } - - protected virtual async Task InvalidateServerSessionSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) - { - var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try + var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try { var headers_ = Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) @@ -9639,7 +9128,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -9710,27 +9199,63 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Deprecated. Do not call this api. + /// Returns the field definitions assigned to a template definition (by template definition ID). /// /// - /// - Deprecated.
- /// - Refreshes the session associated with the access token. This is only necessary if you want to keep the same session alive, otherwise a new session will be automatically created when the session expires.
- /// - When a client application wants to keep a session alive that has been idle for an hour, this route can be used to refresh the expiration timer associated with the access token.
- /// - Only available in Laserfiche Cloud. + /// - Returns the field definitions assigned to a template definition.
+ /// - Provide a template definition ID, and get a paged listing of the field definitions assigned to that template.
+ /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. + /// The requested repository ID. + /// The requested template definition ID. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Refresh the session successfully. + /// A collection of template field definitions. /// A server side error occurred. - [Obsolete] - public virtual async Task RefreshServerSessionAsync(string repoId, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task ListTemplateFieldDefinitionsByTemplateIdAsync(string repositoryId, int templateId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); + + if (templateId == null) + throw new ArgumentNullException("templateId"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/ServerSession/Refresh"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/TemplateDefinitions/{templateId}/FieldDefinitions?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Replace("{templateId}", Uri.EscapeDataString(ConvertToString(templateId, CultureInfo.InvariantCulture))); + if (culture != null) + { + urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); + } + if (select != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); + } + if (orderby != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); + } + if (top != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); + } + if (skip != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); + } + if (count != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; var client_ = _httpClient; bool[] disposeClient_ = new bool[]{ false }; @@ -9738,8 +9263,10 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - request_.Content = new StringContent(string.Empty, Encoding.UTF8, "application/json"); - request_.Method = new HttpMethod("POST"); + + if (prefer != null) + request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); + request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -9749,7 +9276,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await RefreshServerSessionSendAsync(request_, client_, disposeClient_, cancellationToken); + return await ListTemplateFieldDefinitionsByTemplateIdSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -9759,7 +9286,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task RefreshServerSessionSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task ListTemplateFieldDefinitionsByTemplateIdSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -9777,7 +9304,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -9848,25 +9375,63 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } /// - /// Deprecated. Do not call this api. + /// Returns the field definitions assigned to a template definition (by template definition name). /// /// - /// - Deprecated. This function is a no-op, always returns 200.
- /// - Only available in Laserfiche Cloud. + /// - Returns the field definitions assigned to a template definition.
+ /// - Provide a template definition name, and get a paged listing of the field definitions assigned to that template.
+ /// - Default page size: 100. Allowed OData query options: Select | Count | OrderBy | Skip | Top | SkipToken | Prefer.
+ /// - Required OAuth scope: repository.Read ///
- /// The requested repository ID. + /// The requested repository ID. + /// A required query parameter for the requested template name. + /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. + /// An optional query parameter used to indicate the locale that should be used for formatting. The value should be a standard language tag. + /// Limits the properties returned in the result. + /// Specifies the order in which items are returned. The maximum number of expressions is 5. + /// Limits the number of items returned from a collection. + /// Excludes the specified number of items of the queried collection from the result. + /// Indicates whether the total count of items within a collection are returned in the result. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Create the session successfully. + /// A collection of template field definitions. /// A server side error occurred. - [Obsolete] - public virtual async Task CreateServerSessionAsync(string repoId, CancellationToken cancellationToken = default(CancellationToken)) + public virtual async Task ListTemplateFieldDefinitionsByTemplateNameAsync(string repositoryId, string templateName, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (repoId == null) - throw new ArgumentNullException("repoId"); + if (repositoryId == null) + throw new ArgumentNullException("repositoryId"); + + if (templateName == null) + throw new ArgumentNullException("templateName"); var urlBuilder_ = new StringBuilder(); - urlBuilder_.Append("v1/Repositories/{repoId}/ServerSession/Create"); - urlBuilder_.Replace("{repoId}", Uri.EscapeDataString(ConvertToString(repoId, CultureInfo.InvariantCulture))); + urlBuilder_.Append("v2/Repositories/{repositoryId}/TemplateDefinitions/FieldDefinitions?"); + urlBuilder_.Replace("{repositoryId}", Uri.EscapeDataString(ConvertToString(repositoryId, CultureInfo.InvariantCulture))); + urlBuilder_.Append(Uri.EscapeDataString("templateName") + "=").Append(Uri.EscapeDataString(ConvertToString(templateName, CultureInfo.InvariantCulture))).Append("&"); + if (culture != null) + { + urlBuilder_.Append(Uri.EscapeDataString("culture") + "=").Append(Uri.EscapeDataString(ConvertToString(culture, CultureInfo.InvariantCulture))).Append("&"); + } + if (select != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$select") + "=").Append(Uri.EscapeDataString(ConvertToString(select, CultureInfo.InvariantCulture))).Append("&"); + } + if (orderby != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$orderby") + "=").Append(Uri.EscapeDataString(ConvertToString(orderby, CultureInfo.InvariantCulture))).Append("&"); + } + if (top != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$top") + "=").Append(Uri.EscapeDataString(ConvertToString(top, CultureInfo.InvariantCulture))).Append("&"); + } + if (skip != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$skip") + "=").Append(Uri.EscapeDataString(ConvertToString(skip, CultureInfo.InvariantCulture))).Append("&"); + } + if (count != null) + { + urlBuilder_.Append(Uri.EscapeDataString("$count") + "=").Append(Uri.EscapeDataString(ConvertToString(count, CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; var client_ = _httpClient; bool[] disposeClient_ = new bool[]{ false }; @@ -9874,8 +9439,10 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { using (var request_ = new HttpRequestMessage()) { - request_.Content = new StringContent(string.Empty, Encoding.UTF8, "application/json"); - request_.Method = new HttpMethod("POST"); + + if (prefer != null) + request_.Headers.TryAddWithoutValidation("Prefer", ConvertToString(prefer, CultureInfo.InvariantCulture)); + request_.Method = new HttpMethod("GET"); request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); @@ -9885,7 +9452,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() PrepareRequest(client_, request_, url_); - return await CreateServerSessionSendAsync(request_, client_, disposeClient_, cancellationToken); + return await ListTemplateFieldDefinitionsByTemplateNameSendAsync(request_, client_, disposeClient_, cancellationToken); } } finally @@ -9895,7 +9462,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } } - protected virtual async Task CreateServerSessionSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) + protected virtual async Task ListTemplateFieldDefinitionsByTemplateNameSendAsync(HttpRequestMessage request_, HttpClient client_, bool[] disposeClient_, CancellationToken cancellationToken = default(CancellationToken)) { var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); var disposeResponse_ = true; @@ -9913,7 +9480,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw ApiExceptionExtensions.Create(status_, headers_, null); @@ -9921,6 +9488,16 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() return objectResponse_.Object; } else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else if (status_ == 401) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); @@ -9941,6 +9518,26 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); } else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else + if (status_ == 429) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw ApiExceptionExtensions.Create(status_, headers_, null); + } + throw ApiExceptionExtensions.Create(status_, headers_, objectResponse_.Object, null); + } + else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw ApiExceptionExtensions.Create(status_, headers_, responseData_, JsonSerializerSettings, null); @@ -10056,1181 +9653,1595 @@ private string ConvertToString(object value, CultureInfo cultureInfo) } } + /// + /// Response containing a collection of Attribute. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class AttributeCollectionResponse + { + /// + /// A URL to retrieve the next page of the requested collection. + /// + [Newtonsoft.Json.JsonProperty("@odata.nextLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string OdataNextLink { get; set; } + + /// + /// The total count of items within a collection. + /// + [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? OdataCount { get; set; } + + [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Value { get; set; } + + } + + /// + /// Represents a trustee attribute. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Attribute + { + /// + /// The attribute key. + /// + [Newtonsoft.Json.JsonProperty("key", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Key { get; set; } + + /// + /// The attribute value. + /// + [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Value { get; set; } + + } + + /// + /// Response containing a collection of AuditReason. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class AuditReasonCollectionResponse + { + /// + /// A URL to retrieve the next page of the requested collection. + /// + [Newtonsoft.Json.JsonProperty("@odata.nextLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string OdataNextLink { get; set; } + + /// + /// The total count of items within a collection. + /// + [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? OdataCount { get; set; } + + [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Value { get; set; } + + } + + /// + /// Represents a user-defined audit reason for an audit event. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class AuditReason + { + /// + /// The audit reason id. + /// + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Id { get; set; } + + /// + /// The audit reason text. + /// + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } + + /// + /// The audit event type for this audit reason. + /// + [Newtonsoft.Json.JsonProperty("auditEventType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public AuditEventType AuditEventType { get; set; } + + } + + /// + /// Enumeration of Laserfiche audit event types. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum AuditEventType + { + + [EnumMember(Value = @"DeleteEntry")] + DeleteEntry = 0, + + [EnumMember(Value = @"ExportDocument")] + ExportDocument = 1, + + } + + /// + /// Represents a field definition. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class FieldDefinition + { + /// + /// The name of the field. + /// + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } + + /// + /// The localized name of the field. + /// + [Newtonsoft.Json.JsonProperty("displayName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string DisplayName { get; set; } + + /// + /// The ID of the field. + /// + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Id { get; set; } + + /// + /// The description of the field. + /// + [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Description { get; set; } + + /// + /// The type of the field. + /// + [Newtonsoft.Json.JsonProperty("fieldType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public FieldType FieldType { get; set; } + + /// + /// The length of the field for variable length data types. + /// + [Newtonsoft.Json.JsonProperty("length", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Length { get; set; } + + /// + /// The default value of the field for new entries that are assigned to a template the represented field is a member of. + /// + [Newtonsoft.Json.JsonProperty("defaultValue", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string DefaultValue { get; set; } + + /// + /// A boolean indicating if the represented template field supports multiple values. + /// + [Newtonsoft.Json.JsonProperty("isMultiValue", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool IsMultiValue { get; set; } + + /// + /// A boolean indicating if the represented field must have a value set on entries assigned to a template that the field is a member of. + /// + [Newtonsoft.Json.JsonProperty("isRequired", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool IsRequired { get; set; } + + /// + /// The constraint for values stored in the represented field. + /// + [Newtonsoft.Json.JsonProperty("constraint", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Constraint { get; set; } + + /// + /// The error string that will be returned when the field constraint is violated when setting a value for this field. + /// + [Newtonsoft.Json.JsonProperty("constraintError", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ConstraintError { get; set; } + + /// + /// The list of items assigned to the represented field. + /// + [Newtonsoft.Json.JsonProperty("listValues", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection ListValues { get; set; } + + /// + /// The display format of the represented field. + /// + [Newtonsoft.Json.JsonProperty("format", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public FieldFormat Format { get; set; } + + /// + /// The name of the currency that will be using when formatting the represented field when the Format property is set to the Currency member of the WFieldFormat enumeration. + /// + [Newtonsoft.Json.JsonProperty("currency", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Currency { get; set; } + + /// + /// The custom format pattern for fields that are configured to use a custom format. + /// + [Newtonsoft.Json.JsonProperty("formatPattern", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string FormatPattern { get; set; } + + } + + /// + /// Enumeration of Laserfiche template field types. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum FieldType + { + + [EnumMember(Value = @"DateTime")] + DateTime = 0, + + [EnumMember(Value = @"Blob")] + Blob = 1, + + [EnumMember(Value = @"Date")] + Date = 2, + + [EnumMember(Value = @"ShortInteger")] + ShortInteger = 3, + + [EnumMember(Value = @"LongInteger")] + LongInteger = 4, + + [EnumMember(Value = @"List")] + List = 5, + + [EnumMember(Value = @"Number")] + Number = 6, + + [EnumMember(Value = @"String")] + String = 7, + + [EnumMember(Value = @"Time")] + Time = 8, + + } + + /// + /// Enumeration of Laserfiche template field formats. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum FieldFormat + { + + [EnumMember(Value = @"None")] + None = 0, + + [EnumMember(Value = @"ShortDate")] + ShortDate = 1, + + [EnumMember(Value = @"LongDate")] + LongDate = 2, + + [EnumMember(Value = @"ShortDateTime")] + ShortDateTime = 3, + + [EnumMember(Value = @"LongDateTime")] + LongDateTime = 4, + + [EnumMember(Value = @"ShortTime")] + ShortTime = 5, + + [EnumMember(Value = @"LongTime")] + LongTime = 6, + + [EnumMember(Value = @"GeneralNumber")] + GeneralNumber = 7, + + [EnumMember(Value = @"Currency")] + Currency = 8, + + [EnumMember(Value = @"Percent")] + Percent = 9, + + [EnumMember(Value = @"Scientific")] + Scientific = 10, + + [EnumMember(Value = @"Custom")] + Custom = 11, + + } + + /// + /// Response containing a collection of FieldDefinition. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class FieldDefinitionCollectionResponse + { + /// + /// A URL to retrieve the next page of the requested collection. + /// + [Newtonsoft.Json.JsonProperty("@odata.nextLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string OdataNextLink { get; set; } + + /// + /// The total count of items within a collection. + /// + [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? OdataCount { get; set; } + + [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Value { get; set; } + + } + + /// + /// Response containing a collection of LinkDefinition. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class LinkDefinitionCollectionResponse + { + /// + /// A URL to retrieve the next page of the requested collection. + /// + [Newtonsoft.Json.JsonProperty("@odata.nextLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string OdataNextLink { get; set; } + + /// + /// The total count of items within a collection. + /// + [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? OdataCount { get; set; } + + [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Value { get; set; } + + } + + /// + /// Represents an entry link definition. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class LinkDefinition + { + /// + /// The ID of the link definition. + /// + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Id { get; set; } + + /// + /// The label for the source entry in the link definition. + /// + [Newtonsoft.Json.JsonProperty("sourceLabel", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string SourceLabel { get; set; } + + /// + /// The label for the target entry in the link definition. + /// + [Newtonsoft.Json.JsonProperty("targetLabel", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string TargetLabel { get; set; } + + /// + /// The description of the link definition. + /// + [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Description { get; set; } + + } + + /// + /// Response for CreateMultipartUploadUrls. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class CreateEntryResult + public partial class CreateMultipartUploadUrlsResponse { - [Newtonsoft.Json.JsonProperty("operations", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public CreateEntryOperations Operations { get; set; } + /// + /// A unique identifier for the whole upload process. + /// + [Newtonsoft.Json.JsonProperty("uploadId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string UploadId { get; set; } /// - /// A link to get the created entry. + /// A list of URLs to which the file chunk should be written. /// - [Newtonsoft.Json.JsonProperty("documentLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string DocumentLink { get; set; } + [Newtonsoft.Json.JsonProperty("urls", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Urls { get; set; } } /// - /// The results of each operation needed in order to create the electronic document with optional template and fields. + /// Request body for creating multipart upload urls. /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class CreateEntryOperations + public partial class CreateMultipartUploadUrlsRequest { - [Newtonsoft.Json.JsonProperty("entryCreate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public EntryCreate EntryCreate { get; set; } - - [Newtonsoft.Json.JsonProperty("setEdoc", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public SetEdoc SetEdoc { get; set; } + /// + /// A unique identifier for the whole upload process. + /// + [Newtonsoft.Json.JsonProperty("uploadId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string UploadId { get; set; } = ""; - [Newtonsoft.Json.JsonProperty("setTemplate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public SetTemplate SetTemplate { get; set; } + /// + /// Determines the starting position of the requested parts among all the parts associated with this upload. The default value is 1. + /// + [Newtonsoft.Json.JsonProperty("startingPartNumber", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int StartingPartNumber { get; set; } = 1; - [Newtonsoft.Json.JsonProperty("setFields", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public SetFields SetFields { get; set; } + /// + /// The value must be in the range [1, 100], meaning that in each call to the CreateMultipartUploadUrls api, a maximum of 100 Upload URLs can be requested. Further, each file chunk written to an Upload URL should be at least 5 MB. There is no minimum size limit for the last chunk. + /// + [Newtonsoft.Json.JsonProperty("numberOfParts", Required = Newtonsoft.Json.Required.Always)] + public int NumberOfParts { get; set; } - [Newtonsoft.Json.JsonProperty("setTags", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public SetTags SetTags { get; set; } + /// + /// The name of the file to be uploaded. The file extension in the name will be used as the extension of the imported entry. + /// + [Newtonsoft.Json.JsonProperty("fileName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string FileName { get; set; } - [Newtonsoft.Json.JsonProperty("setLinks", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public SetLinks SetLinks { get; set; } + /// + /// The mime-type of the file to be uploaded. + /// + [Newtonsoft.Json.JsonProperty("mimeType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string MimeType { get; set; } } /// - /// The result of trying to create the entry. + /// Response containing a long operation task id. /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class EntryCreate + public partial class StartTaskResponse { /// - /// The list of exceptions that occured when trying to perform the operation. - /// - [Newtonsoft.Json.JsonProperty("exceptions", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Exceptions { get; set; } - - /// - /// The id of the created entry. If the id is 0, then the entry was not created. + /// A task ID that can be used to check on the status of the task. /// - [Newtonsoft.Json.JsonProperty("entryId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int EntryId { get; set; } + [Newtonsoft.Json.JsonProperty("taskId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string TaskId { get; set; } } + /// + /// Request body for starting an asynchronous import entry task. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class APIServerException + public partial class StartImportUploadedPartsRequest { /// - /// The id of the operation that threw the exception. + /// The UploadId received when calling the CreateMultipartUploadUrls API to request upload URLs. /// - [Newtonsoft.Json.JsonProperty("operationId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string OperationId { get; set; } + [Newtonsoft.Json.JsonProperty("uploadId", Required = Newtonsoft.Json.Required.Always)] + [ComponentModel.DataAnnotations.Required] + public string UploadId { get; set; } /// - /// The explaination of the exception that occurred. + /// The array of the ETag values received when writing the file chunks into the upload URLs. /// - [Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Message { get; set; } + [Newtonsoft.Json.JsonProperty("partETags", Required = Newtonsoft.Json.Required.Always)] + [ComponentModel.DataAnnotations.Required] + public ICollection PartETags { get; set; } = new Collections.ObjectModel.Collection(); /// - /// The code associated with the exception. + /// The name for the imported entry. /// - [Newtonsoft.Json.JsonProperty("errorCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int? ErrorCode { get; set; } + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [ComponentModel.DataAnnotations.Required] + public string Name { get; set; } /// - /// The class of exceptions this belongs to. + /// Indicates if the entry should be automatically renamed if an entry already exists with the given name in the folder. The default value is false. /// - [Newtonsoft.Json.JsonProperty("errorClass", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string ErrorClass { get; set; } + [Newtonsoft.Json.JsonProperty("autoRename", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool AutoRename { get; set; } = false; /// - /// The HTTP status code returned. + /// The options applied when importing a PDF. /// - [Newtonsoft.Json.JsonProperty("statusCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int? StatusCode { get; set; } + [Newtonsoft.Json.JsonProperty("pdfOptions", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ImportEntryRequestPdfOptions PdfOptions { get; set; } /// - /// The source of where the exception occurred. + /// Indicates if the document should be imported as an electronic document (true) or as image pages (false). The default value is false. This option is only applicable when importing the following document types: txt, tif, tiff, bmp, pcx, jpg, jpeg, gif, png. /// - [Newtonsoft.Json.JsonProperty("errorSource", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string ErrorSource { get; set; } + [Newtonsoft.Json.JsonProperty("importAsElectronicDocument", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool ImportAsElectronicDocument { get; set; } = false; - private IDictionary _additionalProperties; + /// + /// The metadata that will be assigned to the entry. + /// + [Newtonsoft.Json.JsonProperty("metadata", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ImportEntryRequestMetadata Metadata { get; set; } - [Newtonsoft.Json.JsonExtensionData] - public IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new Dictionary()); } - set { _additionalProperties = value; } - } + /// + /// The name of the volume to use. Will use the default parent entry volume if not specified. This is ignored in Laserfiche Cloud. + /// + [Newtonsoft.Json.JsonProperty("volumeName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string VolumeName { get; set; } } /// - /// The result of trying to create the electronic document. + /// PDF-related options for importing an entry. /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class SetEdoc + public partial class ImportEntryRequestPdfOptions { /// - /// The list of exceptions that occured when trying to perform the operation. + /// Indicates if the import operation should generate text. The default value is false. /// - [Newtonsoft.Json.JsonProperty("exceptions", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Exceptions { get; set; } + [Newtonsoft.Json.JsonProperty("generateText", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool GenerateText { get; set; } = false; - } + /// + /// Indicates if the import operation should generate image pages. The default value is false. + /// + [Newtonsoft.Json.JsonProperty("generatePages", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool GeneratePages { get; set; } = false; - /// - /// The result of trying to assign a template to the entry. - /// - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class SetTemplate - { /// - /// The list of exceptions that occured when trying to perform the operation. + /// The image type used when generating image pages. The default value is StandardColor. This option is only applicable when GeneratePages is true. /// - [Newtonsoft.Json.JsonProperty("exceptions", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Exceptions { get; set; } + [Newtonsoft.Json.JsonProperty("generatePagesImageType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public GeneratePagesImageType GeneratePagesImageType { get; set; } = Laserfiche.Repository.Api.Client.GeneratePagesImageType.StandardColor; /// - /// The name of the template assigned to the entry. If this is null, then no template was assigned. + /// Indicates if the PDF file should be retained as an electronic document after generating image pages. The default value is true. This option is only applicable when GeneratePages is true. /// - [Newtonsoft.Json.JsonProperty("template", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Template { get; set; } + [Newtonsoft.Json.JsonProperty("keepPdfAfterImport", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool KeepPdfAfterImport { get; set; } = true; } /// - /// The result of trying to assign fields to the entry. + /// Enumeration for the image types when generating pages. /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class SetFields + public enum GeneratePagesImageType { - /// - /// The list of exceptions that occured when trying to perform the operation. - /// - [Newtonsoft.Json.JsonProperty("exceptions", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Exceptions { get; set; } - /// - /// The number of fields assigned to the entry. - /// - [Newtonsoft.Json.JsonProperty("fieldCount", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int FieldCount { get; set; } + [EnumMember(Value = @"BlackAndWhite")] + BlackAndWhite = 0, + + [EnumMember(Value = @"StandardColor")] + StandardColor = 1, + + [EnumMember(Value = @"HighQualityColor")] + HighQualityColor = 2, } /// - /// The result of trying to assign fields to the entry. + /// Represents the metadata that will be assigned to the imported entry. /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class SetTags + public partial class ImportEntryRequestMetadata { /// - /// The list of exceptions that occured when trying to perform the operation. + /// The name of the template assigned to the entry. + /// + [Newtonsoft.Json.JsonProperty("templateName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string TemplateName { get; set; } + + /// + /// The fields that will be assigned to the entry. + /// + [Newtonsoft.Json.JsonProperty("fields", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Fields { get; set; } + + /// + /// The tags that will be assigned to the entry. /// - [Newtonsoft.Json.JsonProperty("exceptions", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Exceptions { get; set; } + [Newtonsoft.Json.JsonProperty("tags", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Tags { get; set; } /// - /// The tags that were assigned to the entry + /// The links that will be assigned to the entry. /// - [Newtonsoft.Json.JsonProperty("assignedTags", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AssignedTags { get; set; } + [Newtonsoft.Json.JsonProperty("links", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Links { get; set; } } /// - /// The result of trying to assign a entry link to the entry. + /// Represents a field that will be assigned to the entry. /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class SetLinks + public partial class FieldToUpdate { /// - /// The list of exceptions that occured when trying to perform the operation. + /// The name of the field that will be assigned to the entry. /// - [Newtonsoft.Json.JsonProperty("exceptions", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Exceptions { get; set; } + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [ComponentModel.DataAnnotations.Required] + public string Name { get; set; } /// - /// The ids of the other entries linked to the entry + /// The field values that will be assigned to the field. /// - [Newtonsoft.Json.JsonProperty("otherEntryIds", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection OtherEntryIds { get; set; } + [Newtonsoft.Json.JsonProperty("values", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Values { get; set; } } + /// + /// Represents a link that will be assigned to the entry. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public abstract partial class IHeaderDictionary + public partial class LinkToUpdate { - [Newtonsoft.Json.JsonProperty("Item", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Item { get; set; } - - [Newtonsoft.Json.JsonProperty("ContentLength", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public long? ContentLength { get; set; } - - [Newtonsoft.Json.JsonProperty("Accept", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Accept { get; set; } - - [Newtonsoft.Json.JsonProperty("AcceptCharset", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AcceptCharset { get; set; } - - [Newtonsoft.Json.JsonProperty("AcceptEncoding", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AcceptEncoding { get; set; } - - [Newtonsoft.Json.JsonProperty("AcceptLanguage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AcceptLanguage { get; set; } - - [Newtonsoft.Json.JsonProperty("AcceptRanges", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AcceptRanges { get; set; } - - [Newtonsoft.Json.JsonProperty("AccessControlAllowCredentials", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AccessControlAllowCredentials { get; set; } - - [Newtonsoft.Json.JsonProperty("AccessControlAllowHeaders", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AccessControlAllowHeaders { get; set; } - - [Newtonsoft.Json.JsonProperty("AccessControlAllowMethods", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AccessControlAllowMethods { get; set; } - - [Newtonsoft.Json.JsonProperty("AccessControlAllowOrigin", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AccessControlAllowOrigin { get; set; } - - [Newtonsoft.Json.JsonProperty("AccessControlExposeHeaders", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AccessControlExposeHeaders { get; set; } + /// + /// The id of the link definition to be assigned to the entry. + /// + [Newtonsoft.Json.JsonProperty("linkDefinitionId", Required = Newtonsoft.Json.Required.Always)] + public int LinkDefinitionId { get; set; } - [Newtonsoft.Json.JsonProperty("AccessControlMaxAge", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AccessControlMaxAge { get; set; } + /// + /// The id of the other entry to be linked to the entry. + /// + [Newtonsoft.Json.JsonProperty("otherEntryId", Required = Newtonsoft.Json.Required.Always)] + public int OtherEntryId { get; set; } - [Newtonsoft.Json.JsonProperty("AccessControlRequestHeaders", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AccessControlRequestHeaders { get; set; } + /// + /// Whether the entry is the source for the link. The default value is true. + /// + [Newtonsoft.Json.JsonProperty("isSource", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool IsSource { get; set; } = true; - [Newtonsoft.Json.JsonProperty("AccessControlRequestMethod", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AccessControlRequestMethod { get; set; } + /// + /// Custom properties (key, value pairs) to be added to the link. + /// + [Newtonsoft.Json.JsonProperty("customProperties", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public IDictionary CustomProperties { get; set; } - [Newtonsoft.Json.JsonProperty("Age", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Age { get; set; } + } - [Newtonsoft.Json.JsonProperty("Allow", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Allow { get; set; } + /// + /// Request body for starting an asynchronous export entry task. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class StartExportEntryRequest + { + /// + /// The reason id for this audit event. + /// + [Newtonsoft.Json.JsonProperty("auditReasonId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int AuditReasonId { get; set; } - [Newtonsoft.Json.JsonProperty("AltSvc", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AltSvc { get; set; } + /// + /// The comment for this audit event. + /// + [Newtonsoft.Json.JsonProperty("auditReasonComment", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string AuditReasonComment { get; set; } = ""; - [Newtonsoft.Json.JsonProperty("Authorization", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Authorization { get; set; } + /// + /// Specifies the part of the document to export. + /// + [Newtonsoft.Json.JsonProperty("part", Required = Newtonsoft.Json.Required.Always)] + [ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public ExportEntryRequestPart Part { get; set; } - [Newtonsoft.Json.JsonProperty("Baggage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Baggage { get; set; } + /// + /// The options applied when exporting as Image. + /// + [Newtonsoft.Json.JsonProperty("imageOptions", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ExportEntryRequestImageOptions ImageOptions { get; set; } - [Newtonsoft.Json.JsonProperty("CacheControl", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection CacheControl { get; set; } + /// + /// The options applied when exporting as Text. + /// + [Newtonsoft.Json.JsonProperty("textOptions", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ExportEntryRequestTextOptions TextOptions { get; set; } - [Newtonsoft.Json.JsonProperty("Connection", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Connection { get; set; } + } - [Newtonsoft.Json.JsonProperty("ContentDisposition", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ContentDisposition { get; set; } + /// + /// Enumeration of the entry parts to export. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum ExportEntryRequestPart + { - [Newtonsoft.Json.JsonProperty("ContentEncoding", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ContentEncoding { get; set; } + [EnumMember(Value = @"Image")] + Image = 0, - [Newtonsoft.Json.JsonProperty("ContentLanguage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ContentLanguage { get; set; } + [EnumMember(Value = @"Text")] + Text = 1, - [Newtonsoft.Json.JsonProperty("ContentLocation", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ContentLocation { get; set; } + [EnumMember(Value = @"Edoc")] + Edoc = 2, - [Newtonsoft.Json.JsonProperty("ContentMD5", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ContentMD5 { get; set; } + } - [Newtonsoft.Json.JsonProperty("ContentRange", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ContentRange { get; set; } + /// + /// Represents the options when exporting the image part of an entry. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ExportEntryRequestImageOptions + { + /// + /// The image format to export as. Options include: MultiPageTIFF, SinglePageTIFF, PNG, PDF and JPEG. The default value is MultiPageTIFF. MultiPageTIFF format is a single multi-page TIFF file. SinglePageTIFF format is multiple single-page TIFF files (in a single zip file). + /// + [Newtonsoft.Json.JsonProperty("format", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public ExportEntryRequestImageFormat Format { get; set; } = Laserfiche.Repository.Api.Client.ExportEntryRequestImageFormat.MultiPageTIFF; - [Newtonsoft.Json.JsonProperty("ContentSecurityPolicy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ContentSecurityPolicy { get; set; } + /// + /// The quality level for JPEG compression when exporting images. The value must be between 0 and 100 (inclusive). The default value is 70. + /// + [Newtonsoft.Json.JsonProperty("jPEGCompressionLevel", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int JPEGCompressionLevel { get; set; } = 70; - [Newtonsoft.Json.JsonProperty("ContentSecurityPolicyReportOnly", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ContentSecurityPolicyReportOnly { get; set; } + /// + /// Indicates if the annotations need to be included. The default value is true. + /// + [Newtonsoft.Json.JsonProperty("includeAnnotations", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool IncludeAnnotations { get; set; } = true; - [Newtonsoft.Json.JsonProperty("ContentType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ContentType { get; set; } + /// + /// Indicates if the annotations on the image need to be converted to PDF annotations when exporting to PDF format. The default value is true. This option is only applicable when exporting to PDF format and IncludeAnnotations is true. + /// + [Newtonsoft.Json.JsonProperty("convertPdfAnnotations", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool ConvertPdfAnnotations { get; set; } = true; - [Newtonsoft.Json.JsonProperty("CorrelationContext", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection CorrelationContext { get; set; } + /// + /// The page prefix of the individual files, when exporting to multi-file format (e.g.zip). The value must have a length of atmost 10 characters and only valid characters that can be included in file names are allowed. The default value is ", Page ". + /// + [Newtonsoft.Json.JsonProperty("pagePrefix", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string PagePrefix { get; set; } = ", Page "; - [Newtonsoft.Json.JsonProperty("Cookie", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Cookie { get; set; } + /// + /// Indicates if redactions are included. The default value is true. + /// + [Newtonsoft.Json.JsonProperty("includeRedactions", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool IncludeRedactions { get; set; } = true; - [Newtonsoft.Json.JsonProperty("Date", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Date { get; set; } + /// + /// The watermark element added to each image. No watermark will be added by default. + /// + [Newtonsoft.Json.JsonProperty("watermark", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ExportEntryRequestWatermark Watermark { get; set; } - [Newtonsoft.Json.JsonProperty("ETag", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ETag { get; set; } + } - [Newtonsoft.Json.JsonProperty("Expires", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Expires { get; set; } + /// + /// Enumeration of formats when exporting the image part of an entry. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum ExportEntryRequestImageFormat + { - [Newtonsoft.Json.JsonProperty("Expect", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Expect { get; set; } + [EnumMember(Value = @"MultiPageTIFF")] + MultiPageTIFF = 0, - [Newtonsoft.Json.JsonProperty("From", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection From { get; set; } + [EnumMember(Value = @"SinglePageTIFF")] + SinglePageTIFF = 1, - [Newtonsoft.Json.JsonProperty("GrpcAcceptEncoding", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection GrpcAcceptEncoding { get; set; } + [EnumMember(Value = @"PNG")] + PNG = 2, - [Newtonsoft.Json.JsonProperty("GrpcEncoding", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection GrpcEncoding { get; set; } + [EnumMember(Value = @"PDF")] + PDF = 3, - [Newtonsoft.Json.JsonProperty("GrpcMessage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection GrpcMessage { get; set; } + [EnumMember(Value = @"JPEG")] + JPEG = 4, - [Newtonsoft.Json.JsonProperty("GrpcStatus", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection GrpcStatus { get; set; } + } - [Newtonsoft.Json.JsonProperty("GrpcTimeout", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection GrpcTimeout { get; set; } + /// + /// Represents the watermark added to the images when exporting an entry. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ExportEntryRequestWatermark + { + /// + /// The text of the watermark. The value must be a string with a length of atmost 100 characters and must not be all whitespace characters. + /// + [Newtonsoft.Json.JsonProperty("text", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Text { get; set; } = ""; - [Newtonsoft.Json.JsonProperty("Host", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Host { get; set; } + /// + /// The position of the watermark. The default value is DeadCenter. + /// + [Newtonsoft.Json.JsonProperty("position", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public WatermarkPosition Position { get; set; } = Laserfiche.Repository.Api.Client.WatermarkPosition.DeadCenter; - [Newtonsoft.Json.JsonProperty("KeepAlive", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection KeepAlive { get; set; } + /// + /// The rotation angle of the watermark. The value must be between 0 and 360 (inclusive). The default value is 0. + /// + [Newtonsoft.Json.JsonProperty("rotationAngle", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int RotationAngle { get; set; } = 0; - [Newtonsoft.Json.JsonProperty("IfMatch", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection IfMatch { get; set; } + /// + /// The percentage of the page that the watermark spans on. The value must be between 1 and 100 (inclusive). The default value is 50. + /// + [Newtonsoft.Json.JsonProperty("pageSpanPercentage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int PageSpanPercentage { get; set; } = 50; - [Newtonsoft.Json.JsonProperty("IfModifiedSince", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection IfModifiedSince { get; set; } + } - [Newtonsoft.Json.JsonProperty("IfNoneMatch", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection IfNoneMatch { get; set; } + /// + /// An enumeration of possible positions on a page for watermarks. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum WatermarkPosition + { - [Newtonsoft.Json.JsonProperty("IfRange", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection IfRange { get; set; } + [EnumMember(Value = @"TopLeft")] + TopLeft = 0, - [Newtonsoft.Json.JsonProperty("IfUnmodifiedSince", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection IfUnmodifiedSince { get; set; } + [EnumMember(Value = @"TopCenter")] + TopCenter = 1, - [Newtonsoft.Json.JsonProperty("LastModified", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection LastModified { get; set; } + [EnumMember(Value = @"TopRight")] + TopRight = 2, - [Newtonsoft.Json.JsonProperty("Link", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Link { get; set; } + [EnumMember(Value = @"MiddleLeft")] + MiddleLeft = 3, - [Newtonsoft.Json.JsonProperty("Location", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Location { get; set; } + [EnumMember(Value = @"DeadCenter")] + DeadCenter = 4, - [Newtonsoft.Json.JsonProperty("MaxForwards", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection MaxForwards { get; set; } + [EnumMember(Value = @"MiddleRight")] + MiddleRight = 5, - [Newtonsoft.Json.JsonProperty("Origin", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Origin { get; set; } + [EnumMember(Value = @"BottomLeft")] + BottomLeft = 6, - [Newtonsoft.Json.JsonProperty("Pragma", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Pragma { get; set; } + [EnumMember(Value = @"BottomCenter")] + BottomCenter = 7, - [Newtonsoft.Json.JsonProperty("ProxyAuthenticate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ProxyAuthenticate { get; set; } + [EnumMember(Value = @"BottomRight")] + BottomRight = 8, - [Newtonsoft.Json.JsonProperty("ProxyAuthorization", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ProxyAuthorization { get; set; } + } - [Newtonsoft.Json.JsonProperty("ProxyConnection", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ProxyConnection { get; set; } + /// + /// Represents the options when exporting the text part of an entry. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ExportEntryRequestTextOptions + { + /// + /// Indicates if redactions are included. The default value is true. + /// + [Newtonsoft.Json.JsonProperty("includeRedactions", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool IncludeRedactions { get; set; } = true; - [Newtonsoft.Json.JsonProperty("Range", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Range { get; set; } + /// + /// The character that replaces the original character in a redacted text. The value must be a string of length 1 and must not be a whitespace character. The default value is 'X'. + /// + [Newtonsoft.Json.JsonProperty("redactionCharacter", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string RedactionCharacter { get; set; } = "X"; - [Newtonsoft.Json.JsonProperty("Referer", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Referer { get; set; } + } - [Newtonsoft.Json.JsonProperty("RetryAfter", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection RetryAfter { get; set; } + /// + /// Request body for starting an asynchronous copy entry task. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class StartCopyEntryRequest + { + /// + /// The name of the entry. + /// + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [ComponentModel.DataAnnotations.Required] + public string Name { get; set; } - [Newtonsoft.Json.JsonProperty("RequestId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection RequestId { get; set; } + /// + /// Indicates if the entry should be automatically renamed if an entry already exists with the given name in the folder. The default value is false. + /// + [Newtonsoft.Json.JsonProperty("autoRename", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool AutoRename { get; set; } = false; - [Newtonsoft.Json.JsonProperty("SecWebSocketAccept", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection SecWebSocketAccept { get; set; } + /// + /// The source entry Id to copy. + /// + [Newtonsoft.Json.JsonProperty("sourceId", Required = Newtonsoft.Json.Required.Always)] + public int SourceId { get; set; } - [Newtonsoft.Json.JsonProperty("SecWebSocketKey", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection SecWebSocketKey { get; set; } + /// + /// The name of the volume to use. Will use the default parent entry volume if not specified. This is ignored in Laserfiche Cloud. + /// + [Newtonsoft.Json.JsonProperty("volumeName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string VolumeName { get; set; } - [Newtonsoft.Json.JsonProperty("SecWebSocketProtocol", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection SecWebSocketProtocol { get; set; } + } - [Newtonsoft.Json.JsonProperty("SecWebSocketVersion", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection SecWebSocketVersion { get; set; } + /// + /// Request body for starting an asynchronous delete entry task. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class StartDeleteEntryRequest + { + /// + /// The reason id for this audit event. + /// + [Newtonsoft.Json.JsonProperty("auditReasonId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? AuditReasonId { get; set; } - [Newtonsoft.Json.JsonProperty("SecWebSocketExtensions", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection SecWebSocketExtensions { get; set; } + /// + /// The comment for this audit event. + /// + [Newtonsoft.Json.JsonProperty("auditReasonComment", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string AuditReasonComment { get; set; } - [Newtonsoft.Json.JsonProperty("Server", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Server { get; set; } + } - [Newtonsoft.Json.JsonProperty("SetCookie", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection SetCookie { get; set; } + /// + /// Base type for all types which represent entry objects in a Laserfiche repository. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public abstract partial class Entry + { + /// + /// The ID of the entry. + /// + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Id { get; set; } - [Newtonsoft.Json.JsonProperty("StrictTransportSecurity", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection StrictTransportSecurity { get; set; } + /// + /// The name of the entry. + /// + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } - [Newtonsoft.Json.JsonProperty("TE", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection TE { get; set; } + /// + /// The ID of the parent entry. + /// + [Newtonsoft.Json.JsonProperty("parentId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? ParentId { get; set; } - [Newtonsoft.Json.JsonProperty("Trailer", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Trailer { get; set; } + /// + /// The full path in the Laserfiche repository to the entry. + /// + [Newtonsoft.Json.JsonProperty("fullPath", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string FullPath { get; set; } - [Newtonsoft.Json.JsonProperty("TransferEncoding", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection TransferEncoding { get; set; } + /// + /// The path in the Laserfiche repository to the parent folder. + /// + [Newtonsoft.Json.JsonProperty("folderPath", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string FolderPath { get; set; } - [Newtonsoft.Json.JsonProperty("Translate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Translate { get; set; } + /// + /// The name of the user that created this entry. + /// + [Newtonsoft.Json.JsonProperty("creator", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Creator { get; set; } - [Newtonsoft.Json.JsonProperty("TraceParent", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection TraceParent { get; set; } + /// + /// The creation time of the entry. + /// + [Newtonsoft.Json.JsonProperty("creationTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public DateTimeOffset CreationTime { get; set; } - [Newtonsoft.Json.JsonProperty("TraceState", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection TraceState { get; set; } + /// + /// The last modification time of the entry. + /// + [Newtonsoft.Json.JsonProperty("lastModifiedTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public DateTimeOffset LastModifiedTime { get; set; } - [Newtonsoft.Json.JsonProperty("Upgrade", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Upgrade { get; set; } + /// + /// The type of the entry. + /// + [Newtonsoft.Json.JsonProperty("entryType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public EntryType EntryType { get; set; } - [Newtonsoft.Json.JsonProperty("UpgradeInsecureRequests", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection UpgradeInsecureRequests { get; set; } + /// + /// A boolean indicating if this entry is a container object; it can have other entries as children. + /// + [Newtonsoft.Json.JsonProperty("isContainer", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool IsContainer { get; set; } - [Newtonsoft.Json.JsonProperty("UserAgent", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection UserAgent { get; set; } + /// + /// A boolean indicating if this entry is a leaf object; it cannot have other entries as children. + /// + [Newtonsoft.Json.JsonProperty("isLeaf", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool IsLeaf { get; set; } - [Newtonsoft.Json.JsonProperty("Vary", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Vary { get; set; } + /// + /// The name of the template assigned to this entry. + /// + [Newtonsoft.Json.JsonProperty("templateName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string TemplateName { get; set; } - [Newtonsoft.Json.JsonProperty("Via", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Via { get; set; } + /// + /// The id of the template assigned to this entry. + /// + [Newtonsoft.Json.JsonProperty("templateId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int TemplateId { get; set; } - [Newtonsoft.Json.JsonProperty("Warning", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Warning { get; set; } + /// + /// The names of the fields assigned to the template assigned to this entry. + /// + [Newtonsoft.Json.JsonProperty("templateFieldNames", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection TemplateFieldNames { get; set; } - [Newtonsoft.Json.JsonProperty("WebSocketSubProtocols", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection WebSocketSubProtocols { get; set; } + /// + /// The name of the volume that this entry is associated with. + /// + [Newtonsoft.Json.JsonProperty("volumeName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string VolumeName { get; set; } - [Newtonsoft.Json.JsonProperty("WWWAuthenticate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection WWWAuthenticate { get; set; } + /// + /// Row number assigned to this entry in the listing. + /// + [Newtonsoft.Json.JsonProperty("rowNumber", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? RowNumber { get; set; } - [Newtonsoft.Json.JsonProperty("XContentTypeOptions", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection XContentTypeOptions { get; set; } + /// + /// The fields assigned to this entry. + /// + [Newtonsoft.Json.JsonProperty("fields", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Fields { get; set; } - [Newtonsoft.Json.JsonProperty("XFrameOptions", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection XFrameOptions { get; set; } + } - [Newtonsoft.Json.JsonProperty("XPoweredBy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection XPoweredBy { get; set; } + /// + /// Enumeration of entry types. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum EntryType + { - [Newtonsoft.Json.JsonProperty("XRequestedWith", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection XRequestedWith { get; set; } + [EnumMember(Value = @"Folder")] + Folder = 0, - [Newtonsoft.Json.JsonProperty("XUACompatible", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection XUACompatible { get; set; } + [EnumMember(Value = @"RecordSeries")] + RecordSeries = 1, - [Newtonsoft.Json.JsonProperty("XXSSProtection", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection XXSSProtection { get; set; } + [EnumMember(Value = @"Document")] + Document = 2, + + [EnumMember(Value = @"Shortcut")] + Shortcut = 3, } /// - /// The request body containing fields that will be assigned to the entry. + /// Represents a field set on an entry. /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class FieldToUpdate + public partial class Field { /// - /// The field values that will be assigned to the field. + /// The name of the field. /// - [Newtonsoft.Json.JsonProperty("values", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Values { get; set; } - - } + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ValueToUpdate - { /// - /// The value assigned to the field at the position specified. + /// The type of the field. The possible field types are listed below. /// - [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Value { get; set; } + [Newtonsoft.Json.JsonProperty("fieldType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public FieldType FieldType { get; set; } /// - /// The position of the value in the field. This is 1-indexed for multi value field. It will be ignored for single value field. + /// The ID of the field. /// - [Newtonsoft.Json.JsonProperty("position", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int Position { get; set; } - - } + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Id { get; set; } - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class LinkToUpdate - { /// - /// The id of the link assigned to the entry. + /// A boolean indicating if the represented field supports multiple values. /// - [Newtonsoft.Json.JsonProperty("linkTypeId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int LinkTypeId { get; set; } + [Newtonsoft.Json.JsonProperty("isMultiValue", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool IsMultiValue { get; set; } /// - /// The id of the other source linked to the entry. + /// A boolean indicating if the represented field must have a value set on entries assigned to a template that the field is a member of. /// - [Newtonsoft.Json.JsonProperty("otherSourceId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int OtherSourceId { get; set; } + [Newtonsoft.Json.JsonProperty("isRequired", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool IsRequired { get; set; } /// - /// Whether the entry is the source for the link. + /// A boolean indicating if there are more field values. /// - [Newtonsoft.Json.JsonProperty("isSource", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool IsSource { get; set; } - - } + [Newtonsoft.Json.JsonProperty("hasMoreValues", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool HasMoreValues { get; set; } - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PostEntryWithEdocMetadataRequest - { /// - /// The name of the template assigned to the entry. + /// The group id of the multi value field group. If the field is not a part of a multi value field group, then there is no group id. /// - [Newtonsoft.Json.JsonProperty("template", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Template { get; set; } - - [Newtonsoft.Json.JsonProperty("metadata", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public PutFieldValsRequest Metadata { get; set; } + [Newtonsoft.Json.JsonProperty("groupId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? GroupId { get; set; } /// - /// The name of the volume to use. Will use the default parent entry volume if not specified. This is ignored in Laserfiche Cloud. + /// The values assigned to the field. /// - [Newtonsoft.Json.JsonProperty("volumeName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string VolumeName { get; set; } + [Newtonsoft.Json.JsonProperty("values", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Values { get; set; } } /// - /// The request body containing fields that will be assigned to the entry. + /// Represents a Laserfiche record series. /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PutFieldValsRequest : SimpleImportMetadata + public partial class RecordSeries : Entry { - /// - /// The links that will be assigned to the entry. - /// - [Newtonsoft.Json.JsonProperty("links", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Links { get; set; } } /// - /// A wrapper around the ODataValue with extra odata.nextLink and odata.count. + /// Represents a document in a Laserfiche repository. /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueContextOfListOfAttribute : ODataValueOfListOfAttribute - { - /// - /// It contains a URL that allows retrieving the next subset of the requested collection. - /// - [Newtonsoft.Json.JsonProperty("@odata.nextLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string OdataNextLink { get; set; } - - /// - /// It contains the count of a collection of entities or a collection of entity references. - /// - [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int OdataCount { get; set; } - - } - - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueOfListOfAttribute - { - [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } - - } - - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Attribute - { - [Newtonsoft.Json.JsonProperty("key", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Key { get; set; } - - [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Value { get; set; } - - } - - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class WFieldInfo + public partial class Document : Entry { /// - /// The name of the field. - /// - [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Name { get; set; } - - /// - /// The localized name of the field. + /// The size of the electronic document attached to the represented document, if there is one, in bytes. /// - [Newtonsoft.Json.JsonProperty("displayName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string DisplayName { get; set; } + [Newtonsoft.Json.JsonProperty("electronicDocumentSize", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long ElectronicDocumentSize { get; set; } /// - /// The ID of the field. + /// The extension for the document. /// - [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int Id { get; set; } + [Newtonsoft.Json.JsonProperty("extension", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Extension { get; set; } /// - /// The description of the field. + /// A boolean indicating if there is an electronic document attached to the represented document. /// - [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Description { get; set; } + [Newtonsoft.Json.JsonProperty("isElectronicDocument", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool IsElectronicDocument { get; set; } /// - /// The type of the field. + /// A boolean indicating if the represented document is a record. /// - [Newtonsoft.Json.JsonProperty("fieldType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public WFieldType FieldType { get; set; } + [Newtonsoft.Json.JsonProperty("isRecord", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool IsRecord { get; set; } /// - /// The length of the field for variable length data types. + /// The MIME type of the electronic document. /// - [Newtonsoft.Json.JsonProperty("length", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int Length { get; set; } + [Newtonsoft.Json.JsonProperty("mimeType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string MimeType { get; set; } /// - /// The default value of the field for new entries that are assigned
- /// to a template the represented field is a member of. + /// The page count of the represented document. ///
- [Newtonsoft.Json.JsonProperty("defaultValue", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string DefaultValue { get; set; } + [Newtonsoft.Json.JsonProperty("pageCount", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int PageCount { get; set; } /// - /// A boolean indicating if the represented template field supports multiple values. + /// A boolean indicating if the represented document is checked out. /// - [Newtonsoft.Json.JsonProperty("isMultiValue", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool IsMultiValue { get; set; } + [Newtonsoft.Json.JsonProperty("isCheckedOut", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool IsCheckedOut { get; set; } /// - /// A boolean indicating if the represented field must have a value set
- /// on entries assigned to a template that the field is a member of. + /// A boolean indicating if the represented document is under version control. ///
- [Newtonsoft.Json.JsonProperty("isRequired", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool IsRequired { get; set; } + [Newtonsoft.Json.JsonProperty("isUnderVersionControl", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool IsUnderVersionControl { get; set; } - /// - /// The constraint for values stored in the represented field. - /// - [Newtonsoft.Json.JsonProperty("constraint", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Constraint { get; set; } + } + /// + /// Represents an entry shortcut in a Laserfiche repository. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Shortcut : Entry + { /// - /// The error string that will be returned when the field constraint
- /// is violated when setting a value for this field. + /// The entry ID of the shortcut target. ///
- [Newtonsoft.Json.JsonProperty("constraintError", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string ConstraintError { get; set; } + [Newtonsoft.Json.JsonProperty("targetId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int TargetId { get; set; } /// - /// The list of items assigned to the represented field. + /// The extension of the shortcut target. /// - [Newtonsoft.Json.JsonProperty("listValues", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ListValues { get; set; } + [Newtonsoft.Json.JsonProperty("extension", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Extension { get; set; } /// - /// The display format of the represented field. + /// The entry type of the shortcut target. /// - [Newtonsoft.Json.JsonProperty("format", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonProperty("targetType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public WFieldFormat Format { get; set; } + public EntryType TargetType { get; set; } + + } + /// + /// Represents a folder (standard or record folder) in a Laserfiche repository. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Folder : Entry + { /// - /// The name of the currency that will be using when formatting
- /// the represented field when the Format property is set to the
- /// Currency member of the WFieldFormat enumeration. + /// A boolean indicating if the folder that this instance represents is known to be a record folder. ///
- [Newtonsoft.Json.JsonProperty("currency", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Currency { get; set; } + [Newtonsoft.Json.JsonProperty("isRecordFolder", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool IsRecordFolder { get; set; } /// - /// The custom format pattern for fields that are configured to
- /// use a custom format. + /// A boolean indicating if the folder that this instance represents is known to directly or indirectly under a record series in the repository. ///
- [Newtonsoft.Json.JsonProperty("formatPattern", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string FormatPattern { get; set; } + [Newtonsoft.Json.JsonProperty("isUnderRecordSeries", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool IsUnderRecordSeries { get; set; } } - /// - /// Enumeration of Laserfiche template field types. - /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public enum WFieldType + public abstract partial class IHeaderDictionary { + [Newtonsoft.Json.JsonProperty("Item", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Item { get; set; } - [EnumMember(Value = @"DateTime")] - DateTime = 0, + [Newtonsoft.Json.JsonProperty("ContentLength", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long? ContentLength { get; set; } - [EnumMember(Value = @"Blob")] - Blob = 1, + [Newtonsoft.Json.JsonProperty("Accept", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Accept { get; set; } - [EnumMember(Value = @"Date")] - Date = 2, + [Newtonsoft.Json.JsonProperty("AcceptCharset", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection AcceptCharset { get; set; } - [EnumMember(Value = @"ShortInteger")] - ShortInteger = 3, + [Newtonsoft.Json.JsonProperty("AcceptEncoding", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection AcceptEncoding { get; set; } - [EnumMember(Value = @"LongInteger")] - LongInteger = 4, + [Newtonsoft.Json.JsonProperty("AcceptLanguage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection AcceptLanguage { get; set; } - [EnumMember(Value = @"List")] - List = 5, + [Newtonsoft.Json.JsonProperty("AcceptRanges", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection AcceptRanges { get; set; } - [EnumMember(Value = @"Number")] - Number = 6, + [Newtonsoft.Json.JsonProperty("AccessControlAllowCredentials", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection AccessControlAllowCredentials { get; set; } + + [Newtonsoft.Json.JsonProperty("AccessControlAllowHeaders", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection AccessControlAllowHeaders { get; set; } + + [Newtonsoft.Json.JsonProperty("AccessControlAllowMethods", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection AccessControlAllowMethods { get; set; } + + [Newtonsoft.Json.JsonProperty("AccessControlAllowOrigin", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection AccessControlAllowOrigin { get; set; } + + [Newtonsoft.Json.JsonProperty("AccessControlExposeHeaders", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection AccessControlExposeHeaders { get; set; } + + [Newtonsoft.Json.JsonProperty("AccessControlMaxAge", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection AccessControlMaxAge { get; set; } + + [Newtonsoft.Json.JsonProperty("AccessControlRequestHeaders", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection AccessControlRequestHeaders { get; set; } + + [Newtonsoft.Json.JsonProperty("AccessControlRequestMethod", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection AccessControlRequestMethod { get; set; } + + [Newtonsoft.Json.JsonProperty("Age", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Age { get; set; } + + [Newtonsoft.Json.JsonProperty("Allow", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Allow { get; set; } + + [Newtonsoft.Json.JsonProperty("AltSvc", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection AltSvc { get; set; } + + [Newtonsoft.Json.JsonProperty("Authorization", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Authorization { get; set; } + + [Newtonsoft.Json.JsonProperty("Baggage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Baggage { get; set; } + + [Newtonsoft.Json.JsonProperty("CacheControl", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection CacheControl { get; set; } + + [Newtonsoft.Json.JsonProperty("Connection", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Connection { get; set; } + + [Newtonsoft.Json.JsonProperty("ContentDisposition", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection ContentDisposition { get; set; } - [EnumMember(Value = @"String")] - String = 7, + [Newtonsoft.Json.JsonProperty("ContentEncoding", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection ContentEncoding { get; set; } - [EnumMember(Value = @"Time")] - Time = 8, + [Newtonsoft.Json.JsonProperty("ContentLanguage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection ContentLanguage { get; set; } - } + [Newtonsoft.Json.JsonProperty("ContentLocation", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection ContentLocation { get; set; } - /// - /// Enumeration of Laserfiche template field formats. - /// - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public enum WFieldFormat - { + [Newtonsoft.Json.JsonProperty("ContentMD5", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection ContentMD5 { get; set; } - [EnumMember(Value = @"None")] - None = 0, + [Newtonsoft.Json.JsonProperty("ContentRange", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection ContentRange { get; set; } - [EnumMember(Value = @"ShortDate")] - ShortDate = 1, + [Newtonsoft.Json.JsonProperty("ContentSecurityPolicy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection ContentSecurityPolicy { get; set; } - [EnumMember(Value = @"LongDate")] - LongDate = 2, + [Newtonsoft.Json.JsonProperty("ContentSecurityPolicyReportOnly", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection ContentSecurityPolicyReportOnly { get; set; } - [EnumMember(Value = @"ShortDateTime")] - ShortDateTime = 3, + [Newtonsoft.Json.JsonProperty("ContentType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection ContentType { get; set; } - [EnumMember(Value = @"LongDateTime")] - LongDateTime = 4, + [Newtonsoft.Json.JsonProperty("CorrelationContext", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection CorrelationContext { get; set; } - [EnumMember(Value = @"ShortTime")] - ShortTime = 5, + [Newtonsoft.Json.JsonProperty("Cookie", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Cookie { get; set; } - [EnumMember(Value = @"LongTime")] - LongTime = 6, + [Newtonsoft.Json.JsonProperty("Date", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Date { get; set; } - [EnumMember(Value = @"GeneralNumber")] - GeneralNumber = 7, + [Newtonsoft.Json.JsonProperty("ETag", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection ETag { get; set; } - [EnumMember(Value = @"Currency")] - Currency = 8, + [Newtonsoft.Json.JsonProperty("Expires", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Expires { get; set; } - [EnumMember(Value = @"Percent")] - Percent = 9, + [Newtonsoft.Json.JsonProperty("Expect", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Expect { get; set; } - [EnumMember(Value = @"Scientific")] - Scientific = 10, + [Newtonsoft.Json.JsonProperty("From", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection From { get; set; } - [EnumMember(Value = @"Custom")] - Custom = 11, + [Newtonsoft.Json.JsonProperty("GrpcAcceptEncoding", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection GrpcAcceptEncoding { get; set; } - } + [Newtonsoft.Json.JsonProperty("GrpcEncoding", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection GrpcEncoding { get; set; } - /// - /// A wrapper around the ODataValue with extra odata.nextLink and odata.count. - /// - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueContextOfIListOfWFieldInfo : ODataValueOfIListOfWFieldInfo - { - /// - /// It contains a URL that allows retrieving the next subset of the requested collection. - /// - [Newtonsoft.Json.JsonProperty("@odata.nextLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string OdataNextLink { get; set; } + [Newtonsoft.Json.JsonProperty("GrpcMessage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection GrpcMessage { get; set; } - /// - /// It contains the count of a collection of entities or a collection of entity references. - /// - [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int OdataCount { get; set; } + [Newtonsoft.Json.JsonProperty("GrpcStatus", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection GrpcStatus { get; set; } - } + [Newtonsoft.Json.JsonProperty("GrpcTimeout", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection GrpcTimeout { get; set; } - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueOfIListOfWFieldInfo - { - [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + [Newtonsoft.Json.JsonProperty("Host", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Host { get; set; } - } + [Newtonsoft.Json.JsonProperty("KeepAlive", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection KeepAlive { get; set; } - /// - /// A wrapper around the ODataValue with extra odata.nextLink and odata.count. - /// - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueContextOfIListOfEntryLinkTypeInfo : ODataValueOfIListOfEntryLinkTypeInfo - { - /// - /// It contains a URL that allows retrieving the next subset of the requested collection. - /// - [Newtonsoft.Json.JsonProperty("@odata.nextLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string OdataNextLink { get; set; } + [Newtonsoft.Json.JsonProperty("IfMatch", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection IfMatch { get; set; } - /// - /// It contains the count of a collection of entities or a collection of entity references. - /// - [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int OdataCount { get; set; } + [Newtonsoft.Json.JsonProperty("IfModifiedSince", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection IfModifiedSince { get; set; } - } + [Newtonsoft.Json.JsonProperty("IfNoneMatch", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection IfNoneMatch { get; set; } - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueOfIListOfEntryLinkTypeInfo - { - [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + [Newtonsoft.Json.JsonProperty("IfRange", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection IfRange { get; set; } - } + [Newtonsoft.Json.JsonProperty("IfUnmodifiedSince", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection IfUnmodifiedSince { get; set; } - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class EntryLinkTypeInfo - { - /// - /// The ID of the entry link type. - /// - [Newtonsoft.Json.JsonProperty("linkTypeId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int LinkTypeId { get; set; } + [Newtonsoft.Json.JsonProperty("LastModified", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection LastModified { get; set; } - /// - /// The label for the source entry in the link type. - /// - [Newtonsoft.Json.JsonProperty("sourceLabel", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string SourceLabel { get; set; } + [Newtonsoft.Json.JsonProperty("Link", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Link { get; set; } - /// - /// The label for the target entry in the link type. - /// - [Newtonsoft.Json.JsonProperty("targetLabel", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string TargetLabel { get; set; } + [Newtonsoft.Json.JsonProperty("Location", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Location { get; set; } - /// - /// The description of the link type. - /// - [Newtonsoft.Json.JsonProperty("linkTypeDescription", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string LinkTypeDescription { get; set; } + [Newtonsoft.Json.JsonProperty("MaxForwards", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection MaxForwards { get; set; } - } + [Newtonsoft.Json.JsonProperty("Origin", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Origin { get; set; } - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public abstract partial class Entry - { - /// - /// The ID of the entry. - /// - [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int Id { get; set; } + [Newtonsoft.Json.JsonProperty("Pragma", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Pragma { get; set; } - /// - /// The name of the entry. - /// - [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty("ProxyAuthenticate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection ProxyAuthenticate { get; set; } - /// - /// The ID of the parent entry. - /// - [Newtonsoft.Json.JsonProperty("parentId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int? ParentId { get; set; } + [Newtonsoft.Json.JsonProperty("ProxyAuthorization", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection ProxyAuthorization { get; set; } - /// - /// The full path in the Laserfiche repository to the entry. - /// - [Newtonsoft.Json.JsonProperty("fullPath", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string FullPath { get; set; } + [Newtonsoft.Json.JsonProperty("ProxyConnection", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection ProxyConnection { get; set; } - /// - /// The path in the Laserfiche repository to the parent folder. - /// - [Newtonsoft.Json.JsonProperty("folderPath", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string FolderPath { get; set; } + [Newtonsoft.Json.JsonProperty("Range", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Range { get; set; } - /// - /// The name of the user that created this entry. - /// - [Newtonsoft.Json.JsonProperty("creator", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Creator { get; set; } + [Newtonsoft.Json.JsonProperty("Referer", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Referer { get; set; } - /// - /// The creation time of the entry. - /// - [Newtonsoft.Json.JsonProperty("creationTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public DateTimeOffset CreationTime { get; set; } + [Newtonsoft.Json.JsonProperty("RetryAfter", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection RetryAfter { get; set; } - /// - /// The last modification time of the entry. - /// - [Newtonsoft.Json.JsonProperty("lastModifiedTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public DateTimeOffset LastModifiedTime { get; set; } + [Newtonsoft.Json.JsonProperty("RequestId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection RequestId { get; set; } - /// - /// The type of the entry. - /// - [Newtonsoft.Json.JsonProperty("entryType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public EntryType EntryType { get; set; } + [Newtonsoft.Json.JsonProperty("SecWebSocketAccept", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection SecWebSocketAccept { get; set; } - /// - /// A boolean indicating if this entry is a container object; it can have other entries as children. - /// - [Newtonsoft.Json.JsonProperty("isContainer", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool IsContainer { get; set; } + [Newtonsoft.Json.JsonProperty("SecWebSocketKey", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection SecWebSocketKey { get; set; } - /// - /// A boolean indicating if this entry is a leaf object; it cannot have other entries as children. - /// - [Newtonsoft.Json.JsonProperty("isLeaf", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool IsLeaf { get; set; } + [Newtonsoft.Json.JsonProperty("SecWebSocketProtocol", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection SecWebSocketProtocol { get; set; } - /// - /// The name of the template assigned to this entry. - /// - [Newtonsoft.Json.JsonProperty("templateName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string TemplateName { get; set; } + [Newtonsoft.Json.JsonProperty("SecWebSocketVersion", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection SecWebSocketVersion { get; set; } - /// - /// The id of the template assigned to this entry. - /// - [Newtonsoft.Json.JsonProperty("templateId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int TemplateId { get; set; } + [Newtonsoft.Json.JsonProperty("SecWebSocketExtensions", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection SecWebSocketExtensions { get; set; } - /// - /// The names of the fields assigned to the template assigned to this entry. - /// - [Newtonsoft.Json.JsonProperty("templateFieldNames", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection TemplateFieldNames { get; set; } + [Newtonsoft.Json.JsonProperty("Server", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Server { get; set; } - /// - /// The name of the volume that this entry is associated with. - /// - [Newtonsoft.Json.JsonProperty("volumeName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string VolumeName { get; set; } + [Newtonsoft.Json.JsonProperty("SetCookie", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection SetCookie { get; set; } + + [Newtonsoft.Json.JsonProperty("StrictTransportSecurity", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection StrictTransportSecurity { get; set; } - /// - /// Row number assigned to this entry in the listing. - /// - [Newtonsoft.Json.JsonProperty("rowNumber", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int RowNumber { get; set; } + [Newtonsoft.Json.JsonProperty("TE", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection TE { get; set; } - /// - /// The fields assigned to this entry. - /// - [Newtonsoft.Json.JsonProperty("fields", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Fields { get; set; } + [Newtonsoft.Json.JsonProperty("Trailer", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Trailer { get; set; } - } + [Newtonsoft.Json.JsonProperty("TransferEncoding", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection TransferEncoding { get; set; } - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public enum EntryType - { + [Newtonsoft.Json.JsonProperty("Translate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Translate { get; set; } - [EnumMember(Value = @"Folder")] - Folder = 0, + [Newtonsoft.Json.JsonProperty("TraceParent", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection TraceParent { get; set; } - [EnumMember(Value = @"RecordSeries")] - RecordSeries = 1, + [Newtonsoft.Json.JsonProperty("TraceState", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection TraceState { get; set; } - [EnumMember(Value = @"Document")] - Document = 2, + [Newtonsoft.Json.JsonProperty("Upgrade", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Upgrade { get; set; } - [EnumMember(Value = @"Shortcut")] - Shortcut = 3, + [Newtonsoft.Json.JsonProperty("UpgradeInsecureRequests", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection UpgradeInsecureRequests { get; set; } - } + [Newtonsoft.Json.JsonProperty("UserAgent", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection UserAgent { get; set; } - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class EntryFieldValue - { - /// - /// The name of the field. - /// - [Newtonsoft.Json.JsonProperty("fieldName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string FieldName { get; set; } + [Newtonsoft.Json.JsonProperty("Vary", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Vary { get; set; } - /// - /// The values assigned to the field. - /// - [Newtonsoft.Json.JsonProperty("values", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection> Values { get; set; } + [Newtonsoft.Json.JsonProperty("Via", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Via { get; set; } - /// - /// The type of the field. The possible field types are listed below. - /// - [Newtonsoft.Json.JsonProperty("fieldType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public WFieldType FieldType { get; set; } + [Newtonsoft.Json.JsonProperty("Warning", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Warning { get; set; } - /// - /// The ID of the field. - /// - [Newtonsoft.Json.JsonProperty("fieldId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int FieldId { get; set; } + [Newtonsoft.Json.JsonProperty("WebSocketSubProtocols", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection WebSocketSubProtocols { get; set; } - /// - /// A boolean indicating if the represented field supports multiple values. - /// - [Newtonsoft.Json.JsonProperty("isMultiValue", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool IsMultiValue { get; set; } + [Newtonsoft.Json.JsonProperty("WWWAuthenticate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection WWWAuthenticate { get; set; } - /// - /// A boolean indicating if the represented field must have a value set on entries assigned to a template that the field is a member of. - /// - [Newtonsoft.Json.JsonProperty("isRequired", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool IsRequired { get; set; } + [Newtonsoft.Json.JsonProperty("XContentTypeOptions", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection XContentTypeOptions { get; set; } - /// - /// A boolean indicating if there are more field values. - /// - [Newtonsoft.Json.JsonProperty("hasMoreValues", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool HasMoreValues { get; set; } + [Newtonsoft.Json.JsonProperty("XFrameOptions", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection XFrameOptions { get; set; } - } + [Newtonsoft.Json.JsonProperty("XPoweredBy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection XPoweredBy { get; set; } - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class RecordSeries : Entry - { + [Newtonsoft.Json.JsonProperty("XRequestedWith", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection XRequestedWith { get; set; } + + [Newtonsoft.Json.JsonProperty("XUACompatible", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection XUACompatible { get; set; } + + [Newtonsoft.Json.JsonProperty("XXSSProtection", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection XXSSProtection { get; set; } } + /// + /// Request body for importing an entry. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Document : Entry + public partial class ImportEntryRequest { /// - /// The size of the electronic document attached to the represented document,
- /// if there is one, in bytes. - ///
- [Newtonsoft.Json.JsonProperty("elecDocumentSize", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public long ElecDocumentSize { get; set; } - - /// - /// The extension for the document. - /// - [Newtonsoft.Json.JsonProperty("extension", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Extension { get; set; } - - /// - /// A boolean indicating if there is an electronic document attached to the represented document. - /// - [Newtonsoft.Json.JsonProperty("isElectronicDocument", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool IsElectronicDocument { get; set; } - - /// - /// A boolean indicating if the represented document is a record. + /// The name for the imported entry. /// - [Newtonsoft.Json.JsonProperty("isRecord", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool IsRecord { get; set; } + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } /// - /// The MIME type of the electronic document. + /// Indicates if the entry should be automatically renamed if an entry already exists with the given name in the folder. The default value is false. /// - [Newtonsoft.Json.JsonProperty("mimeType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string MimeType { get; set; } + [Newtonsoft.Json.JsonProperty("autoRename", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool AutoRename { get; set; } = false; /// - /// The page count of the represented document. + /// The options applied when importing a PDF. /// - [Newtonsoft.Json.JsonProperty("pageCount", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int PageCount { get; set; } + [Newtonsoft.Json.JsonProperty("pdfOptions", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ImportEntryRequestPdfOptions PdfOptions { get; set; } /// - /// A boolean indicating if the represented document is checked out. + /// Indicates if the document should be imported as an electronic document (true) or as image pages (false). The default value is false. This option is only applicable when importing the following document types: txt, tif, tiff, bmp, pcx, jpg, jpeg, gif, png. /// - [Newtonsoft.Json.JsonProperty("isCheckedOut", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool IsCheckedOut { get; set; } + [Newtonsoft.Json.JsonProperty("importAsElectronicDocument", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool ImportAsElectronicDocument { get; set; } = false; /// - /// A boolean indicating if the represented document is under version control. + /// The metadata that will be assigned to the entry. /// - [Newtonsoft.Json.JsonProperty("isUnderVersionControl", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool IsUnderVersionControl { get; set; } + [Newtonsoft.Json.JsonProperty("metadata", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ImportEntryRequestMetadata Metadata { get; set; } /// - /// The electronic document attached to the represented document. + /// The name of the volume to use. Will use the default parent entry volume if not specified. This is ignored in Laserfiche Cloud. /// - [Newtonsoft.Json.JsonProperty("edoc", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Edoc Edoc { get; set; } + [Newtonsoft.Json.JsonProperty("volumeName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string VolumeName { get; set; } } + /// + /// Response containing a link to download the exported entry. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Edoc + public partial class ExportEntryResponse { + [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Value { get; set; } } + /// + /// Request body for exporting an entry. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Shortcut : Entry + public partial class ExportEntryRequest { /// - /// The entry ID of the shortcut target. + /// The reason id for this audit event. /// - [Newtonsoft.Json.JsonProperty("targetId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int TargetId { get; set; } + [Newtonsoft.Json.JsonProperty("auditReasonId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int AuditReasonId { get; set; } /// - /// The extension of the shortcut target. + /// The comment for this audit event. /// - [Newtonsoft.Json.JsonProperty("extension", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Extension { get; set; } + [Newtonsoft.Json.JsonProperty("auditReasonComment", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string AuditReasonComment { get; set; } = ""; /// - /// The entry type of the shortcut target. + /// The part of the document to export. Options include: Image, Text, Edoc. /// - [Newtonsoft.Json.JsonProperty("targetType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonProperty("part", Required = Newtonsoft.Json.Required.Always)] + [ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public EntryType TargetType { get; set; } - - } - - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Folder : Entry - { - /// - /// A boolean indicating if the folder that this instance represents is known
- /// to be a record folder. - ///
- [Newtonsoft.Json.JsonProperty("isRecordFolder", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool IsRecordFolder { get; set; } + public ExportEntryRequestPart Part { get; set; } /// - /// A boolean indicating if the folder that this instance represents is known
- /// to directly or indirectly under a record series in the repository. + /// The options applied when exporting as Image. ///
- [Newtonsoft.Json.JsonProperty("isUnderRecordSeries", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool IsUnderRecordSeries { get; set; } + [Newtonsoft.Json.JsonProperty("imageOptions", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ExportEntryRequestImageOptions ImageOptions { get; set; } /// - /// The entries in this folder. + /// The options applied when exporting as Text. /// - [Newtonsoft.Json.JsonProperty("children", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Children { get; set; } + [Newtonsoft.Json.JsonProperty("textOptions", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ExportEntryRequestTextOptions TextOptions { get; set; } } + /// + /// Response containing an entry or ancestor entry found by entry path. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class FindEntryResult + public partial class GetEntryByPathResponse { /// /// The entry found by path. This property is set if entry is found. @@ -11246,36 +11257,11 @@ public partial class FindEntryResult } + /// + /// Request body for updating an entry. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class AcceptedOperation - { - /// - /// A token that can be used to check on the status of the operation. - /// - [Newtonsoft.Json.JsonProperty("token", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Token { get; set; } - - } - - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class DeleteEntryWithAuditReason - { - /// - /// The reason id for this audit event. - /// - [Newtonsoft.Json.JsonProperty("auditReasonId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int? AuditReasonId { get; set; } - - /// - /// The comment for this audit event. - /// - [Newtonsoft.Json.JsonProperty("comment", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Comment { get; set; } - - } - - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PatchEntryRequest + public partial class UpdateEntryRequest { /// /// The ID of the parent entry that the entry will be moved to. @@ -11289,105 +11275,102 @@ public partial class PatchEntryRequest [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Name { get; set; } + /// + /// Indicates if the entry should be automatically renamed if an entry already exists with the given name in the folder. The default value is false. + /// + [Newtonsoft.Json.JsonProperty("autoRename", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool AutoRename { get; set; } = false; + } /// - /// A wrapper around the ODataValue with extra odata.nextLink and odata.count. + /// Response containing a collection of Entry. /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueContextOfIListOfEntry : ODataValueOfIListOfEntry + public partial class EntryCollectionResponse { /// - /// It contains a URL that allows retrieving the next subset of the requested collection. + /// A URL to retrieve the next page of the requested collection. /// [Newtonsoft.Json.JsonProperty("@odata.nextLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string OdataNextLink { get; set; } /// - /// It contains the count of a collection of entities or a collection of entity references. + /// The total count of items within a collection. /// - [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int OdataCount { get; set; } - - } + [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? OdataCount { get; set; } - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueOfIListOfEntry - { [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public ICollection Value { get; set; } } /// - /// A wrapper around the ODataValue with extra odata.nextLink and odata.count. + /// Response containing a collection of Field. /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueContextOfIListOfFieldValue : ODataValueOfIListOfFieldValue + public partial class FieldCollectionResponse { /// - /// It contains a URL that allows retrieving the next subset of the requested collection. + /// A URL to retrieve the next page of the requested collection. /// [Newtonsoft.Json.JsonProperty("@odata.nextLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string OdataNextLink { get; set; } /// - /// It contains the count of a collection of entities or a collection of entity references. + /// The total count of items within a collection. /// - [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int OdataCount { get; set; } - - } + [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? OdataCount { get; set; } - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueOfIListOfFieldValue - { [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public ICollection Value { get; set; } } + /// + /// Request body for assigning fields to an entry. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class FieldValue : EntryFieldValue + public partial class SetFieldsRequest { /// - /// The group id of the multi value field group. If the field is not a part of a multi value field group, then there is no group id. + /// The fields that will be assigned to the entry. /// - [Newtonsoft.Json.JsonProperty("groupId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int? GroupId { get; set; } + [Newtonsoft.Json.JsonProperty("fields", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Fields { get; set; } } /// - /// A wrapper around the ODataValue with extra odata.nextLink and odata.count. + /// Response containing a collection of Tag. /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueContextOfIListOfWTagInfo : ODataValueOfIListOfWTagInfo + public partial class TagCollectionResponse { /// - /// It contains a URL that allows retrieving the next subset of the requested collection. + /// A URL to retrieve the next page of the requested collection. /// [Newtonsoft.Json.JsonProperty("@odata.nextLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string OdataNextLink { get; set; } /// - /// It contains the count of a collection of entities or a collection of entity references. + /// The total count of items within a collection. /// - [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int OdataCount { get; set; } - - } + [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? OdataCount { get; set; } - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueOfIListOfWTagInfo - { [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public ICollection Value { get; set; } } + /// + /// Represents a tag set on an entry. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class WTagInfo + public partial class Tag { /// /// The ID of the tag definition. @@ -11414,8 +11397,7 @@ public partial class WTagInfo public string Description { get; set; } /// - /// A boolean indicating whether or not the tag definition is classified
- /// as a security tag (true) or an informational tag (false). + /// A boolean indicating whether or not the tag definition is classified as a security tag (true) or an informational tag (false). ///
[Newtonsoft.Json.JsonProperty("isSecure", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsSecure { get; set; } @@ -11424,88 +11406,60 @@ public partial class WTagInfo /// The watermark properties associated with the tag definition. ///
[Newtonsoft.Json.JsonProperty("watermark", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Watermark Watermark { get; set; } + public TagDefinitionWatermark Watermark { get; set; } } + /// + /// Represents a watermark associated with a tag defintion. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Watermark + public partial class TagDefinitionWatermark { /// /// The watermark text associated with the tag defintion. /// - [Newtonsoft.Json.JsonProperty("watermarkText", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string WatermarkText { get; set; } - - /// - /// The size of the watermark text, in points, associated with the tag definition. - /// - [Newtonsoft.Json.JsonProperty("watermarkTextSize", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int WatermarkTextSize { get; set; } - - /// - /// The position of the watermark on the page. - /// - [Newtonsoft.Json.JsonProperty("watermarkPosition", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public WatermarkPosition WatermarkPosition { get; set; } - - /// - /// The rotation angle, in degrees, of the watermark associated with the tag definition. - /// - [Newtonsoft.Json.JsonProperty("watermarkRotationAngle", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int WatermarkRotationAngle { get; set; } + [Newtonsoft.Json.JsonProperty("text", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Text { get; set; } /// - /// A boolean indicating whether or not the watermark associated with the tag is mandatory. + /// The percentage of the page that the watermark associated with the tag definition spans on. /// - [Newtonsoft.Json.JsonProperty("isWatermarkMandatory", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool IsWatermarkMandatory { get; set; } + [Newtonsoft.Json.JsonProperty("pageSpanPercentage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int PageSpanPercentage { get; set; } /// - /// The intensity of the watermark associated with the tag definition. Valid value
- /// ranges from 0 to 100, with -1 as the default values. - ///
- [Newtonsoft.Json.JsonProperty("watermarkIntensity", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int WatermarkIntensity { get; set; } - - } - - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public enum WatermarkPosition - { - - [EnumMember(Value = @"TopLeft")] - TopLeft = 0, - - [EnumMember(Value = @"TopCenter")] - TopCenter = 1, - - [EnumMember(Value = @"TopRight")] - TopRight = 2, - - [EnumMember(Value = @"MiddleLeft")] - MiddleLeft = 3, - - [EnumMember(Value = @"DeadCenter")] - DeadCenter = 4, - - [EnumMember(Value = @"MiddleRight")] - MiddleRight = 5, + /// The position of the watermark on the page. + ///
+ [Newtonsoft.Json.JsonProperty("position", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public WatermarkPosition Position { get; set; } - [EnumMember(Value = @"BottomLeft")] - BottomLeft = 6, + /// + /// The rotation angle, in degrees, of the watermark associated with the tag definition. + /// + [Newtonsoft.Json.JsonProperty("rotationAngle", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int RotationAngle { get; set; } - [EnumMember(Value = @"BottomCenter")] - BottomCenter = 7, + /// + /// A boolean indicating whether or not the watermark associated with the tag is mandatory. + /// + [Newtonsoft.Json.JsonProperty("isMandatory", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool IsMandatory { get; set; } - [EnumMember(Value = @"BottomRight")] - BottomRight = 8, + /// + /// The opacity of the watermark associated with the tag definition. Valid value ranges from 0 to 100, with -1 as the default values. + /// + [Newtonsoft.Json.JsonProperty("opacity", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Opacity { get; set; } } + /// + /// Request body for assigning tags to an entry. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PutTagRequest + public partial class SetTagsRequest { /// /// The tag names to assign to the entry. @@ -11515,22 +11469,46 @@ public partial class PutTagRequest } + /// + /// Response containing a collection of Link. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueOfIListOfWEntryLinkInfo + public partial class LinkCollectionResponse { + /// + /// A URL to retrieve the next page of the requested collection. + /// + [Newtonsoft.Json.JsonProperty("@odata.nextLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string OdataNextLink { get; set; } + + /// + /// The total count of items within a collection. + /// + [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? OdataCount { get; set; } + [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public ICollection Value { get; set; } } + /// + /// Represents a link between a source entry and a target entry. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class WEntryLinkInfo + public partial class Link { /// - /// The ID of the entry link. + /// The ID of the represented link. /// - [Newtonsoft.Json.JsonProperty("linkId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int LinkId { get; set; } + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Id { get; set; } + + /// + /// The description for the represented link. + /// + [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Description { get; set; } /// /// The ID of the source entry of the represented link. @@ -11545,11 +11523,17 @@ public partial class WEntryLinkInfo public string SourceFullPath { get; set; } /// - /// The label for the source entry in the link type. + /// The label for the source entry in the link definition. /// [Newtonsoft.Json.JsonProperty("sourceLabel", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string SourceLabel { get; set; } + /// + /// The navigation link to the source entry. + /// + [Newtonsoft.Json.JsonProperty("sourceLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string SourceLink { get; set; } + /// /// The ID of the target entry of the represented link. /// @@ -11563,66 +11547,31 @@ public partial class WEntryLinkInfo public string TargetFullPath { get; set; } /// - /// The label for the target entry in the link type. + /// The label for the target entry in the link definition. /// [Newtonsoft.Json.JsonProperty("targetLabel", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string TargetLabel { get; set; } - /// - /// The descriptive text for the represented entry link. - /// - [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Description { get; set; } - - /// - /// The description of the link type. - /// - [Newtonsoft.Json.JsonProperty("linkTypeDescription", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string LinkTypeDescription { get; set; } - - /// - /// The ID of the entry link type. - /// - [Newtonsoft.Json.JsonProperty("linkTypeId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int LinkTypeId { get; set; } - - /// - /// The properties for the entry link. - /// - [Newtonsoft.Json.JsonProperty("linkProperties", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public IDictionary LinkProperties { get; set; } - - /// - /// The navigation link to the source entry. - /// - [Newtonsoft.Json.JsonProperty("sourceLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string SourceLink { get; set; } - /// /// The navigation link to the target entry. /// [Newtonsoft.Json.JsonProperty("targetLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string TargetLink { get; set; } - } - - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PutLinksRequest - { /// - /// The target entry ID to create a link to. + /// The ID of the link definition. /// - [Newtonsoft.Json.JsonProperty("targetId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int TargetId { get; set; } + [Newtonsoft.Json.JsonProperty("linkDefinitionId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int LinkDefinitionId { get; set; } /// - /// The link type ID to create the link with. + /// The description of the link definition. /// - [Newtonsoft.Json.JsonProperty("linkTypeId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int LinkTypeId { get; set; } + [Newtonsoft.Json.JsonProperty("linkDefinitionDescription", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string LinkDefinitionDescription { get; set; } /// - /// Custom properties (key, value pairs) to be added to the link + /// The custom properties for the represented link. /// [Newtonsoft.Json.JsonProperty("customProperties", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public IDictionary CustomProperties { get; set; } @@ -11630,51 +11579,42 @@ public partial class PutLinksRequest } /// - /// A wrapper around the ODataValue with extra odata.nextLink and odata.count. + /// Request body for assigning links to an entry. /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueContextOfIListOfWEntryLinkInfo : ODataValueOfIListOfWEntryLinkInfo + public partial class SetLinksRequest { /// - /// It contains a URL that allows retrieving the next subset of the requested collection. - /// - [Newtonsoft.Json.JsonProperty("@odata.nextLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string OdataNextLink { get; set; } - - /// - /// It contains the count of a collection of entities or a collection of entity references. + /// The links that will be assigned to the entry. /// - [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int OdataCount { get; set; } + [Newtonsoft.Json.JsonProperty("links", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Links { get; set; } } + /// + /// Request body for copying an entry. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PostEntryChildrenRequest + public partial class CopyEntryRequest { /// /// The name of the entry. /// - [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [ComponentModel.DataAnnotations.Required] public string Name { get; set; } /// - /// The type of the entry. - /// - [Newtonsoft.Json.JsonProperty("entryType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public PostEntryChildrenEntryType? EntryType { get; set; } - - /// - /// The TargetId is only needed for creating a shortcut. This will be the entry ID of the shortcut target. + /// Indicates if the entry should be automatically renamed if an entry already exists with the given name in the folder. The default value is false. /// - [Newtonsoft.Json.JsonProperty("targetId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int TargetId { get; set; } + [Newtonsoft.Json.JsonProperty("autoRename", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool AutoRename { get; set; } = false; /// - /// The SourceId is needed for some operations that require a source/destination. One example is the Copy operation. + /// The source entry Id to copy. /// - [Newtonsoft.Json.JsonProperty("sourceId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonProperty("sourceId", Required = Newtonsoft.Json.Required.Always)] public int SourceId { get; set; } /// @@ -11685,32 +11625,38 @@ public partial class PostEntryChildrenRequest } + /// + /// Request body for creating an entry. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public enum PostEntryChildrenEntryType - { - - [EnumMember(Value = @"Folder")] - Folder = 0, - - [EnumMember(Value = @"Shortcut")] - Shortcut = 1, - - } - - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class CopyAsyncRequest + public partial class CreateEntryRequest { /// /// The name of the entry. /// - [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] + [ComponentModel.DataAnnotations.Required] public string Name { get; set; } /// - /// The source entry Id to copy. + /// Indicates if the entry should be automatically renamed if an entry already exists with the given name in the folder. The default value is false. /// - [Newtonsoft.Json.JsonProperty("sourceId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int SourceId { get; set; } + [Newtonsoft.Json.JsonProperty("autoRename", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool AutoRename { get; set; } = false; + + /// + /// The type of the entry. + /// + [Newtonsoft.Json.JsonProperty("entryType", Required = Newtonsoft.Json.Required.Always)] + [ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public CreateEntryRequestEntryType EntryType { get; set; } + + /// + /// The TargetId is only needed for creating a shortcut. This will be the entry ID of the shortcut target. + /// + [Newtonsoft.Json.JsonProperty("targetId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int TargetId { get; set; } /// /// The name of the volume to use. Will use the default parent entry volume if not specified. This is ignored in Laserfiche Cloud. @@ -11720,38 +11666,31 @@ public partial class CopyAsyncRequest } + /// + /// Enumeration of entry types for CreateEntry. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueOfBoolean + public enum CreateEntryRequestEntryType { - [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool Value { get; set; } - - } - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class GetEdocWithAuditReasonRequest - { - /// - /// The reason id for this audit event. - /// - [Newtonsoft.Json.JsonProperty("auditReasonId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int? AuditReasonId { get; set; } + [EnumMember(Value = @"Folder")] + Folder = 0, - /// - /// The comment for this audit event. - /// - [Newtonsoft.Json.JsonProperty("comment", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Comment { get; set; } + [EnumMember(Value = @"Shortcut")] + Shortcut = 1, } + /// + /// Request body for listing dynamic field values for an entry. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class GetDynamicFieldLogicValueRequest + public partial class ListDynamicFieldValuesRequest { /// /// The template id. /// - [Newtonsoft.Json.JsonProperty("templateId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonProperty("templateId", Required = Newtonsoft.Json.Required.Always)] public int TemplateId { get; set; } /// @@ -11762,248 +11701,139 @@ public partial class GetDynamicFieldLogicValueRequest } + /// + /// Request body for assigning a template and template fields to an entry. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PutTemplateRequest + public partial class SetTemplateRequest { /// /// The template that will be assigned to the entry. /// - [Newtonsoft.Json.JsonProperty("templateName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonProperty("templateName", Required = Newtonsoft.Json.Required.Always)] + [ComponentModel.DataAnnotations.Required] public string TemplateName { get; set; } /// /// The template fields that will be assigned to the entry. /// [Newtonsoft.Json.JsonProperty("fields", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public IDictionary Fields { get; set; } + public ICollection Fields { get; set; } } + /// + /// Response containing a collection of Repository. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class RepositoryInfo + public partial class RepositoryCollectionResponse { - /// - /// The repository id. - /// - [Newtonsoft.Json.JsonProperty("repoId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string RepoId { get; set; } - - /// - /// The repository name. - /// - [Newtonsoft.Json.JsonProperty("repoName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string RepoName { get; set; } - - /// - /// The corresponding repository WebClient url. - /// - [Newtonsoft.Json.JsonProperty("webclientUrl", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string WebclientUrl { get; set; } + [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Value { get; set; } } + /// + /// Represents a Laserfiche repository. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class AuditReasons + public partial class Repository { /// - /// The audit reasons associated with delete entry. - /// - [Newtonsoft.Json.JsonProperty("deleteEntry", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection DeleteEntry { get; set; } - - /// - /// The audit reasons associated with export document. + /// The repository id. /// - [Newtonsoft.Json.JsonProperty("exportDocument", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ExportDocument { get; set; } - - } + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Id { get; set; } - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class WAuditReason - { /// - /// The audit reason id. + /// The repository name. /// - [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int Id { get; set; } + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } /// - /// The audit reason text. + /// The corresponding repository Web Client url. /// - [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty("webClientUrl", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string WebClientUrl { get; set; } } + /// + /// Request body for starting an asynchronous search entry task. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class AdvancedSearchRequest + public partial class StartSearchEntryRequest { /// - /// Search command for advanced search + /// The search command to run. The search command should follow the Laserfiche search syntax. https://doc.laserfiche.com/laserfiche.documentation/en-us/Default.htm#Search_Syntax.htm /// - [Newtonsoft.Json.JsonProperty("searchCommand", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonProperty("searchCommand", Required = Newtonsoft.Json.Required.Always)] + [ComponentModel.DataAnnotations.Required] public string SearchCommand { get; set; } /// - /// Fuzzy type (None, Percentage, or NumberOfLetters) + /// Fuzzy type (None, Percentage, or NumberOfLetters). /// [Newtonsoft.Json.JsonProperty("fuzzyType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public FuzzyType FuzzyType { get; set; } - /// - /// Fuzzy factor (percentage as int or int value) - /// - [Newtonsoft.Json.JsonProperty("fuzzyFactor", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int FuzzyFactor { get; set; } - - } - - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public enum FuzzyType - { - - [EnumMember(Value = @"None")] - None = 0, - - [EnumMember(Value = @"Percentage")] - Percentage = 1, - - [EnumMember(Value = @"NumberOfLetters")] - NumberOfLetters = 2, - - } - - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class OperationProgress - { - /// - /// The operation token of the operation associated with this OperationProgress. - /// - [Newtonsoft.Json.JsonProperty("operationToken", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string OperationToken { get; set; } - - /// - /// The type of the operation associated with this OperationProgress. - /// - [Newtonsoft.Json.JsonProperty("operationType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string OperationType { get; set; } - - /// - /// Determines what percentage of the execution of the associated operation is completed. - /// - [Newtonsoft.Json.JsonProperty("percentComplete", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int PercentComplete { get; set; } - - /// - /// The status of the operation associated with this OperationProgress. - /// - [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public OperationStatus Status { get; set; } - - /// - /// The list of errors occurred during the execution of the associated operation. - /// - [Newtonsoft.Json.JsonProperty("errors", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Errors { get; set; } - - /// - /// The URI which can be used (via api call) to access the result(s) of the associated operation. - /// - [Newtonsoft.Json.JsonProperty("redirectUri", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string RedirectUri { get; set; } - - /// - /// The ID of the entry affected (e.g. created or modified) by the execution of the associated operation. - /// - [Newtonsoft.Json.JsonProperty("entryId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int EntryId { get; set; } - - /// - /// The timestamp representing when the associated operation's execution is started. - /// - [Newtonsoft.Json.JsonProperty("startTimestamp", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public DateTimeOffset StartTimestamp { get; set; } - - /// - /// The timestamp representing the last time when the associated task's status has changed. - /// - [Newtonsoft.Json.JsonProperty("statusTimestamp", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public DateTimeOffset StatusTimestamp { get; set; } - - } - - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public enum OperationStatus - { - - [EnumMember(Value = @"NotStarted")] - NotStarted = 0, - - [EnumMember(Value = @"InProgress")] - InProgress = 1, - - [EnumMember(Value = @"Completed")] - Completed = 2, - - [EnumMember(Value = @"Failed")] - Failed = 3, - - [EnumMember(Value = @"Cancelled")] - Cancelled = 4, - + /// + /// Fuzzy factor (percentage as int or int value). + /// + [Newtonsoft.Json.JsonProperty("fuzzyFactor", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int FuzzyFactor { get; set; } + } [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class OperationErrorItem + public enum FuzzyType { - /// - /// The ID of the entry to which the error is related. - /// - [Newtonsoft.Json.JsonProperty("objectId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int ObjectId { get; set; } - /// - /// The short description of the error. - /// - [Newtonsoft.Json.JsonProperty("errorMessage", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string ErrorMessage { get; set; } + [EnumMember(Value = @"None")] + None = 0, + + [EnumMember(Value = @"Percentage")] + Percentage = 1, + + [EnumMember(Value = @"NumberOfLetters")] + NumberOfLetters = 2, } /// - /// A wrapper around the ODataValue with extra odata.nextLink and odata.count. + /// Response containing a collection of SearchContextHit. /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueContextOfIListOfContextHit : ODataValueOfIListOfContextHit + public partial class SearchContextHitCollectionResponse { /// - /// It contains a URL that allows retrieving the next subset of the requested collection. + /// A URL to retrieve the next page of the requested collection. /// [Newtonsoft.Json.JsonProperty("@odata.nextLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string OdataNextLink { get; set; } /// - /// It contains the count of a collection of entities or a collection of entity references. + /// The total count of items within a collection. /// - [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int OdataCount { get; set; } - - } + [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? OdataCount { get; set; } - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueOfIListOfContextHit - { [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public ICollection Value { get; set; } } + /// + /// Represents a context hit for a search result. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ContextHit + public partial class SearchContextHit { + /// + /// The type of context hit this instance represents. + /// [Newtonsoft.Json.JsonProperty("hitType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public HitType HitType { get; set; } @@ -12151,47 +11981,291 @@ public enum HitType } + /// + /// Request body for searching entries. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class SimpleSearchRequest + public partial class SearchEntryRequest { /// - /// Search command for simple search + /// The search command to run. The search command should follow the Laserfiche search syntax. https://doc.laserfiche.com/laserfiche.documentation/en-us/Default.htm#Search_Syntax.htm /// - [Newtonsoft.Json.JsonProperty("searchCommand", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonProperty("searchCommand", Required = Newtonsoft.Json.Required.Always)] + [ComponentModel.DataAnnotations.Required] public string SearchCommand { get; set; } } /// - /// A wrapper around the ODataValue with extra odata.nextLink and odata.count. + /// Response containing a collection of TagDefinition. /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueContextOfIListOfWTemplateInfo : ODataValueOfIListOfWTemplateInfo + public partial class TagDefinitionCollectionResponse { /// - /// It contains a URL that allows retrieving the next subset of the requested collection. + /// A URL to retrieve the next page of the requested collection. /// [Newtonsoft.Json.JsonProperty("@odata.nextLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string OdataNextLink { get; set; } /// - /// It contains the count of a collection of entities or a collection of entity references. + /// The total count of items within a collection. + /// + [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? OdataCount { get; set; } + + [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Value { get; set; } + + } + + /// + /// Represents an entry tag definition. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TagDefinition + { + /// + /// The ID of the tag definition. + /// + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Id { get; set; } + + /// + /// The name of the tag definition. + /// + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } + + /// + /// The localized name of the tag definition. + /// + [Newtonsoft.Json.JsonProperty("displayName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string DisplayName { get; set; } + + /// + /// The description of the tag definition. + /// + [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Description { get; set; } + + /// + /// A boolean indicating whether or not the tag definition is classified as a security tag (true) or an informational tag (false). + /// + [Newtonsoft.Json.JsonProperty("isSecure", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool IsSecure { get; set; } + + /// + /// The watermark properties associated with the tag definition. + /// + [Newtonsoft.Json.JsonProperty("watermark", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public TagDefinitionWatermark Watermark { get; set; } + + } + + /// + /// Response containing a collection of TaskProgress. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TaskCollectionResponse + { + [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Value { get; set; } + + } + + /// + /// Represents the progress of a long operation task. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TaskProgress + { + /// + /// The task ID of the task associated with this TaskProgress. + /// + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Id { get; set; } + + /// + /// The type of the task associated with this TaskProgress. + /// + [Newtonsoft.Json.JsonProperty("taskType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public TaskType TaskType { get; set; } + + /// + /// Determines what percentage of the execution of the associated task is completed. + /// + [Newtonsoft.Json.JsonProperty("percentComplete", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int PercentComplete { get; set; } + + /// + /// The status of the task associated with this TaskProgress. + /// + [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public TaskStatus Status { get; set; } + + /// + /// The list of errors occurred during the execution of the associated task. + /// + [Newtonsoft.Json.JsonProperty("errors", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Errors { get; set; } + + /// + /// The result of the execution of the associated task. + /// + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public TaskResult Result { get; set; } + + /// + /// The time representing when the associated task's execution started. + /// + [Newtonsoft.Json.JsonProperty("startTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public DateTimeOffset StartTime { get; set; } + + /// + /// The time representing when the associated task's status last changed. + /// + [Newtonsoft.Json.JsonProperty("lastUpdateTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public DateTimeOffset LastUpdateTime { get; set; } + + } + + /// + /// An enumeration of possible types for a long operation task. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum TaskType + { + + [EnumMember(Value = @"CopyEntry")] + CopyEntry = 0, + + [EnumMember(Value = @"DeleteEntry")] + DeleteEntry = 1, + + [EnumMember(Value = @"ExportEntry")] + ExportEntry = 2, + + [EnumMember(Value = @"ImportUploadedParts")] + ImportUploadedParts = 3, + + [EnumMember(Value = @"SearchEntry")] + SearchEntry = 4, + + } + + /// + /// An enumeration of possible statuses for a long operation task. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum TaskStatus + { + + [EnumMember(Value = @"NotStarted")] + NotStarted = 0, + + [EnumMember(Value = @"InProgress")] + InProgress = 1, + + [EnumMember(Value = @"Completed")] + Completed = 2, + + [EnumMember(Value = @"Failed")] + Failed = 3, + + [EnumMember(Value = @"Cancelled")] + Cancelled = 4, + + } + + /// + /// Represents the result of a long operation task. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TaskResult + { + /// + /// The ID of the entry which is affected (e.g. created or modified) by the execution of the associated task. + /// + [Newtonsoft.Json.JsonProperty("entryId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int EntryId { get; set; } + + /// + /// The URI which can be used (via api call) to access the result(s) of the associated task. + /// + [Newtonsoft.Json.JsonProperty("uri", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Uri { get; set; } + + } + + /// + /// Response containing a collection of CancelTaskResult. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class CancelTasksResponse + { + [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ICollection Value { get; set; } + + } + + /// + /// Represents the result of cancelling a long operation task. + /// + [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class CancelTaskResult + { + /// + /// The ID of the task which has been subject to cancellation. + /// + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Id { get; set; } + + /// + /// The type of the task which has been subject to cancellation. + /// + [Newtonsoft.Json.JsonProperty("taskType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public TaskType TaskType { get; set; } + + /// + /// Indicates if the request to cancel the task has been received. /// - [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int OdataCount { get; set; } + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool Result { get; set; } } + /// + /// Response containing a collection of TemplateDefinition. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueOfIListOfWTemplateInfo + public partial class TemplateDefinitionCollectionResponse { + /// + /// A URL to retrieve the next page of the requested collection. + /// + [Newtonsoft.Json.JsonProperty("@odata.nextLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string OdataNextLink { get; set; } + + /// + /// The total count of items within a collection. + /// + [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? OdataCount { get; set; } + [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public ICollection Value { get; set; } } + /// + /// Represents a template definition. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class WTemplateInfo + public partial class TemplateDefinition { /// /// The ID of the template definition. @@ -12224,60 +12298,73 @@ public partial class WTemplateInfo public LFColor Color { get; set; } /// - /// The number of fields assigned to the template. + /// The number of field definitions assigned to the template definition. /// [Newtonsoft.Json.JsonProperty("fieldCount", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int FieldCount { get; set; } } + /// + /// Represents an RGB color value with alpha channel. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class LFColor { + /// + /// The alpha channel component, from 0-255. + /// [Newtonsoft.Json.JsonProperty("a", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public byte A { get; set; } + /// + /// The red channel component, from 0-255. + /// [Newtonsoft.Json.JsonProperty("r", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public byte R { get; set; } + /// + /// The green channel component, from 0-255. + /// [Newtonsoft.Json.JsonProperty("g", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public byte G { get; set; } + /// + /// The blue channel component from 0-255. + /// [Newtonsoft.Json.JsonProperty("b", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public byte B { get; set; } } /// - /// A wrapper around the ODataValue with extra odata.nextLink and odata.count. + /// Response containing a collection of TemplateFieldDefinition. /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueContextOfIListOfTemplateFieldInfo : ODataValueOfIListOfTemplateFieldInfo + public partial class TemplateFieldDefinitionCollectionResponse { /// - /// It contains a URL that allows retrieving the next subset of the requested collection. + /// A URL to retrieve the next page of the requested collection. /// [Newtonsoft.Json.JsonProperty("@odata.nextLink", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string OdataNextLink { get; set; } /// - /// It contains the count of a collection of entities or a collection of entity references. + /// The total count of items within a collection. /// - [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int OdataCount { get; set; } + [Newtonsoft.Json.JsonProperty("@odata.count", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? OdataCount { get; set; } - } - - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueOfIListOfTemplateFieldInfo - { [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public ICollection Value { get; set; } } + /// + /// Represents a template field definition. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class TemplateFieldInfo : WFieldInfo + public partial class TemplateFieldDefinition : FieldDefinition { /// /// A form logic rule associated with a Laserfiche template and field definition. @@ -12299,43 +12386,20 @@ public partial class TemplateFieldInfo : WFieldInfo } + /// + /// Represents a form logic rule associated with a Laserfiche template and field definition. + /// [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class Rule { /// - /// The IDs of the parent fields in the template according to the
- /// form logic rule. + /// The IDs of the parent fields in the template according to the form logic rule. ///
[Newtonsoft.Json.JsonProperty("ancestors", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public ICollection Ancestors { get; set; } } - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ODataValueOfDateTime - { - [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public DateTimeOffset Value { get; set; } - - } - - [GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class SimpleImportMetadata - { - /// - /// The fields that will be assigned to the entry. - /// - [Newtonsoft.Json.JsonProperty("fields", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public IDictionary Fields { get; set; } - - /// - /// The tags that will be assigned to the entry. - /// - [Newtonsoft.Json.JsonProperty("tags", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Tags { get; set; } - - } - [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class FileParameter { @@ -12363,41 +12427,6 @@ public FileParameter(Stream data, string fileName, string contentType) public string ContentType { get; private set; } } - [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class FileResponse : IDisposable - { - private IDisposable _client; - private IDisposable _response; - - public int StatusCode { get; private set; } - - public IReadOnlyDictionary> Headers { get; private set; } - - public Stream Stream { get; private set; } - - public bool IsPartial - { - get { return StatusCode == 206; } - } - - public FileResponse(int statusCode, IReadOnlyDictionary> headers, Stream stream, IDisposable client, IDisposable response) - { - StatusCode = statusCode; - Headers = headers; - Stream = stream; - _client = client; - _response = response; - } - - public void Dispose() - { - Stream.Dispose(); - if (_response != null) - _response.Dispose(); - if (_client != null) - _client.Dispose(); - } - } [GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class HttpResponseHead From af705cd7dbc761d069fc778c27224d2f88876abc Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Mon, 11 Sep 2023 17:14:31 -0400 Subject: [PATCH 04/93] Prefer list --- generate-client/nswag.json | 1 + src/Clients/RepositoryClients.cs | 242 +++++++++++++++---------------- 2 files changed, 122 insertions(+), 121 deletions(-) diff --git a/generate-client/nswag.json b/generate-client/nswag.json index b18831b7..e384f89b 100644 --- a/generate-client/nswag.json +++ b/generate-client/nswag.json @@ -39,6 +39,7 @@ "generateOptionalParameters": true, "generateUpdateJsonSerializerSettingsMethod": false, "useBaseUrl": false, + "arrayType": "IList", "templateDirectory": "nswag", "wrapResponses": true, "wrapResponseMethods": [ diff --git a/src/Clients/RepositoryClients.cs b/src/Clients/RepositoryClients.cs index ccbfafd9..f4b5d9fe 100644 --- a/src/Clients/RepositoryClients.cs +++ b/src/Clients/RepositoryClients.cs @@ -9672,7 +9672,7 @@ public partial class AttributeCollectionResponse public int? OdataCount { get; set; } [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public IList Value { get; set; } } @@ -9715,7 +9715,7 @@ public partial class AuditReasonCollectionResponse public int? OdataCount { get; set; } [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public IList Value { get; set; } } @@ -9838,7 +9838,7 @@ public partial class FieldDefinition /// The list of items assigned to the represented field. ///
[Newtonsoft.Json.JsonProperty("listValues", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ListValues { get; set; } + public IList ListValues { get; set; } /// /// The display format of the represented field. @@ -9961,7 +9961,7 @@ public partial class FieldDefinitionCollectionResponse public int? OdataCount { get; set; } [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public IList Value { get; set; } } @@ -9984,7 +9984,7 @@ public partial class LinkDefinitionCollectionResponse public int? OdataCount { get; set; } [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public IList Value { get; set; } } @@ -10036,7 +10036,7 @@ public partial class CreateMultipartUploadUrlsResponse /// A list of URLs to which the file chunk should be written. /// [Newtonsoft.Json.JsonProperty("urls", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Urls { get; set; } + public IList Urls { get; set; } } @@ -10110,7 +10110,7 @@ public partial class StartImportUploadedPartsRequest ///
[Newtonsoft.Json.JsonProperty("partETags", Required = Newtonsoft.Json.Required.Always)] [ComponentModel.DataAnnotations.Required] - public ICollection PartETags { get; set; } = new Collections.ObjectModel.Collection(); + public IList PartETags { get; set; } = new Collections.ObjectModel.Collection(); /// /// The name for the imported entry. @@ -10218,19 +10218,19 @@ public partial class ImportEntryRequestMetadata /// The fields that will be assigned to the entry. /// [Newtonsoft.Json.JsonProperty("fields", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Fields { get; set; } + public IList Fields { get; set; } /// /// The tags that will be assigned to the entry. /// [Newtonsoft.Json.JsonProperty("tags", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Tags { get; set; } + public IList Tags { get; set; } /// /// The links that will be assigned to the entry. /// [Newtonsoft.Json.JsonProperty("links", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Links { get; set; } + public IList Links { get; set; } } @@ -10251,7 +10251,7 @@ public partial class FieldToUpdate /// The field values that will be assigned to the field. ///
[Newtonsoft.Json.JsonProperty("values", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Values { get; set; } + public IList Values { get; set; } } @@ -10651,7 +10651,7 @@ public abstract partial class Entry /// The names of the fields assigned to the template assigned to this entry. ///
[Newtonsoft.Json.JsonProperty("templateFieldNames", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection TemplateFieldNames { get; set; } + public IList TemplateFieldNames { get; set; } /// /// The name of the volume that this entry is associated with. @@ -10669,7 +10669,7 @@ public abstract partial class Entry /// The fields assigned to this entry. /// [Newtonsoft.Json.JsonProperty("fields", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Fields { get; set; } + public IList Fields { get; set; } } @@ -10747,7 +10747,7 @@ public partial class Field /// The values assigned to the field. ///
[Newtonsoft.Json.JsonProperty("values", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Values { get; set; } + public IList Values { get; set; } } @@ -10867,277 +10867,277 @@ public partial class Folder : Entry public abstract partial class IHeaderDictionary { [Newtonsoft.Json.JsonProperty("Item", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Item { get; set; } + public IList Item { get; set; } [Newtonsoft.Json.JsonProperty("ContentLength", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long? ContentLength { get; set; } [Newtonsoft.Json.JsonProperty("Accept", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Accept { get; set; } + public IList Accept { get; set; } [Newtonsoft.Json.JsonProperty("AcceptCharset", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AcceptCharset { get; set; } + public IList AcceptCharset { get; set; } [Newtonsoft.Json.JsonProperty("AcceptEncoding", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AcceptEncoding { get; set; } + public IList AcceptEncoding { get; set; } [Newtonsoft.Json.JsonProperty("AcceptLanguage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AcceptLanguage { get; set; } + public IList AcceptLanguage { get; set; } [Newtonsoft.Json.JsonProperty("AcceptRanges", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AcceptRanges { get; set; } + public IList AcceptRanges { get; set; } [Newtonsoft.Json.JsonProperty("AccessControlAllowCredentials", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AccessControlAllowCredentials { get; set; } + public IList AccessControlAllowCredentials { get; set; } [Newtonsoft.Json.JsonProperty("AccessControlAllowHeaders", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AccessControlAllowHeaders { get; set; } + public IList AccessControlAllowHeaders { get; set; } [Newtonsoft.Json.JsonProperty("AccessControlAllowMethods", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AccessControlAllowMethods { get; set; } + public IList AccessControlAllowMethods { get; set; } [Newtonsoft.Json.JsonProperty("AccessControlAllowOrigin", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AccessControlAllowOrigin { get; set; } + public IList AccessControlAllowOrigin { get; set; } [Newtonsoft.Json.JsonProperty("AccessControlExposeHeaders", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AccessControlExposeHeaders { get; set; } + public IList AccessControlExposeHeaders { get; set; } [Newtonsoft.Json.JsonProperty("AccessControlMaxAge", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AccessControlMaxAge { get; set; } + public IList AccessControlMaxAge { get; set; } [Newtonsoft.Json.JsonProperty("AccessControlRequestHeaders", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AccessControlRequestHeaders { get; set; } + public IList AccessControlRequestHeaders { get; set; } [Newtonsoft.Json.JsonProperty("AccessControlRequestMethod", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AccessControlRequestMethod { get; set; } + public IList AccessControlRequestMethod { get; set; } [Newtonsoft.Json.JsonProperty("Age", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Age { get; set; } + public IList Age { get; set; } [Newtonsoft.Json.JsonProperty("Allow", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Allow { get; set; } + public IList Allow { get; set; } [Newtonsoft.Json.JsonProperty("AltSvc", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection AltSvc { get; set; } + public IList AltSvc { get; set; } [Newtonsoft.Json.JsonProperty("Authorization", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Authorization { get; set; } + public IList Authorization { get; set; } [Newtonsoft.Json.JsonProperty("Baggage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Baggage { get; set; } + public IList Baggage { get; set; } [Newtonsoft.Json.JsonProperty("CacheControl", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection CacheControl { get; set; } + public IList CacheControl { get; set; } [Newtonsoft.Json.JsonProperty("Connection", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Connection { get; set; } + public IList Connection { get; set; } [Newtonsoft.Json.JsonProperty("ContentDisposition", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ContentDisposition { get; set; } + public IList ContentDisposition { get; set; } [Newtonsoft.Json.JsonProperty("ContentEncoding", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ContentEncoding { get; set; } + public IList ContentEncoding { get; set; } [Newtonsoft.Json.JsonProperty("ContentLanguage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ContentLanguage { get; set; } + public IList ContentLanguage { get; set; } [Newtonsoft.Json.JsonProperty("ContentLocation", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ContentLocation { get; set; } + public IList ContentLocation { get; set; } [Newtonsoft.Json.JsonProperty("ContentMD5", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ContentMD5 { get; set; } + public IList ContentMD5 { get; set; } [Newtonsoft.Json.JsonProperty("ContentRange", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ContentRange { get; set; } + public IList ContentRange { get; set; } [Newtonsoft.Json.JsonProperty("ContentSecurityPolicy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ContentSecurityPolicy { get; set; } + public IList ContentSecurityPolicy { get; set; } [Newtonsoft.Json.JsonProperty("ContentSecurityPolicyReportOnly", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ContentSecurityPolicyReportOnly { get; set; } + public IList ContentSecurityPolicyReportOnly { get; set; } [Newtonsoft.Json.JsonProperty("ContentType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ContentType { get; set; } + public IList ContentType { get; set; } [Newtonsoft.Json.JsonProperty("CorrelationContext", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection CorrelationContext { get; set; } + public IList CorrelationContext { get; set; } [Newtonsoft.Json.JsonProperty("Cookie", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Cookie { get; set; } + public IList Cookie { get; set; } [Newtonsoft.Json.JsonProperty("Date", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Date { get; set; } + public IList Date { get; set; } [Newtonsoft.Json.JsonProperty("ETag", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ETag { get; set; } + public IList ETag { get; set; } [Newtonsoft.Json.JsonProperty("Expires", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Expires { get; set; } + public IList Expires { get; set; } [Newtonsoft.Json.JsonProperty("Expect", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Expect { get; set; } + public IList Expect { get; set; } [Newtonsoft.Json.JsonProperty("From", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection From { get; set; } + public IList From { get; set; } [Newtonsoft.Json.JsonProperty("GrpcAcceptEncoding", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection GrpcAcceptEncoding { get; set; } + public IList GrpcAcceptEncoding { get; set; } [Newtonsoft.Json.JsonProperty("GrpcEncoding", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection GrpcEncoding { get; set; } + public IList GrpcEncoding { get; set; } [Newtonsoft.Json.JsonProperty("GrpcMessage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection GrpcMessage { get; set; } + public IList GrpcMessage { get; set; } [Newtonsoft.Json.JsonProperty("GrpcStatus", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection GrpcStatus { get; set; } + public IList GrpcStatus { get; set; } [Newtonsoft.Json.JsonProperty("GrpcTimeout", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection GrpcTimeout { get; set; } + public IList GrpcTimeout { get; set; } [Newtonsoft.Json.JsonProperty("Host", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Host { get; set; } + public IList Host { get; set; } [Newtonsoft.Json.JsonProperty("KeepAlive", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection KeepAlive { get; set; } + public IList KeepAlive { get; set; } [Newtonsoft.Json.JsonProperty("IfMatch", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection IfMatch { get; set; } + public IList IfMatch { get; set; } [Newtonsoft.Json.JsonProperty("IfModifiedSince", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection IfModifiedSince { get; set; } + public IList IfModifiedSince { get; set; } [Newtonsoft.Json.JsonProperty("IfNoneMatch", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection IfNoneMatch { get; set; } + public IList IfNoneMatch { get; set; } [Newtonsoft.Json.JsonProperty("IfRange", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection IfRange { get; set; } + public IList IfRange { get; set; } [Newtonsoft.Json.JsonProperty("IfUnmodifiedSince", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection IfUnmodifiedSince { get; set; } + public IList IfUnmodifiedSince { get; set; } [Newtonsoft.Json.JsonProperty("LastModified", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection LastModified { get; set; } + public IList LastModified { get; set; } [Newtonsoft.Json.JsonProperty("Link", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Link { get; set; } + public IList Link { get; set; } [Newtonsoft.Json.JsonProperty("Location", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Location { get; set; } + public IList Location { get; set; } [Newtonsoft.Json.JsonProperty("MaxForwards", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection MaxForwards { get; set; } + public IList MaxForwards { get; set; } [Newtonsoft.Json.JsonProperty("Origin", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Origin { get; set; } + public IList Origin { get; set; } [Newtonsoft.Json.JsonProperty("Pragma", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Pragma { get; set; } + public IList Pragma { get; set; } [Newtonsoft.Json.JsonProperty("ProxyAuthenticate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ProxyAuthenticate { get; set; } + public IList ProxyAuthenticate { get; set; } [Newtonsoft.Json.JsonProperty("ProxyAuthorization", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ProxyAuthorization { get; set; } + public IList ProxyAuthorization { get; set; } [Newtonsoft.Json.JsonProperty("ProxyConnection", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection ProxyConnection { get; set; } + public IList ProxyConnection { get; set; } [Newtonsoft.Json.JsonProperty("Range", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Range { get; set; } + public IList Range { get; set; } [Newtonsoft.Json.JsonProperty("Referer", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Referer { get; set; } + public IList Referer { get; set; } [Newtonsoft.Json.JsonProperty("RetryAfter", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection RetryAfter { get; set; } + public IList RetryAfter { get; set; } [Newtonsoft.Json.JsonProperty("RequestId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection RequestId { get; set; } + public IList RequestId { get; set; } [Newtonsoft.Json.JsonProperty("SecWebSocketAccept", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection SecWebSocketAccept { get; set; } + public IList SecWebSocketAccept { get; set; } [Newtonsoft.Json.JsonProperty("SecWebSocketKey", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection SecWebSocketKey { get; set; } + public IList SecWebSocketKey { get; set; } [Newtonsoft.Json.JsonProperty("SecWebSocketProtocol", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection SecWebSocketProtocol { get; set; } + public IList SecWebSocketProtocol { get; set; } [Newtonsoft.Json.JsonProperty("SecWebSocketVersion", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection SecWebSocketVersion { get; set; } + public IList SecWebSocketVersion { get; set; } [Newtonsoft.Json.JsonProperty("SecWebSocketExtensions", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection SecWebSocketExtensions { get; set; } + public IList SecWebSocketExtensions { get; set; } [Newtonsoft.Json.JsonProperty("Server", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Server { get; set; } + public IList Server { get; set; } [Newtonsoft.Json.JsonProperty("SetCookie", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection SetCookie { get; set; } + public IList SetCookie { get; set; } [Newtonsoft.Json.JsonProperty("StrictTransportSecurity", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection StrictTransportSecurity { get; set; } + public IList StrictTransportSecurity { get; set; } [Newtonsoft.Json.JsonProperty("TE", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection TE { get; set; } + public IList TE { get; set; } [Newtonsoft.Json.JsonProperty("Trailer", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Trailer { get; set; } + public IList Trailer { get; set; } [Newtonsoft.Json.JsonProperty("TransferEncoding", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection TransferEncoding { get; set; } + public IList TransferEncoding { get; set; } [Newtonsoft.Json.JsonProperty("Translate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Translate { get; set; } + public IList Translate { get; set; } [Newtonsoft.Json.JsonProperty("TraceParent", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection TraceParent { get; set; } + public IList TraceParent { get; set; } [Newtonsoft.Json.JsonProperty("TraceState", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection TraceState { get; set; } + public IList TraceState { get; set; } [Newtonsoft.Json.JsonProperty("Upgrade", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Upgrade { get; set; } + public IList Upgrade { get; set; } [Newtonsoft.Json.JsonProperty("UpgradeInsecureRequests", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection UpgradeInsecureRequests { get; set; } + public IList UpgradeInsecureRequests { get; set; } [Newtonsoft.Json.JsonProperty("UserAgent", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection UserAgent { get; set; } + public IList UserAgent { get; set; } [Newtonsoft.Json.JsonProperty("Vary", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Vary { get; set; } + public IList Vary { get; set; } [Newtonsoft.Json.JsonProperty("Via", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Via { get; set; } + public IList Via { get; set; } [Newtonsoft.Json.JsonProperty("Warning", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Warning { get; set; } + public IList Warning { get; set; } [Newtonsoft.Json.JsonProperty("WebSocketSubProtocols", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection WebSocketSubProtocols { get; set; } + public IList WebSocketSubProtocols { get; set; } [Newtonsoft.Json.JsonProperty("WWWAuthenticate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection WWWAuthenticate { get; set; } + public IList WWWAuthenticate { get; set; } [Newtonsoft.Json.JsonProperty("XContentTypeOptions", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection XContentTypeOptions { get; set; } + public IList XContentTypeOptions { get; set; } [Newtonsoft.Json.JsonProperty("XFrameOptions", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection XFrameOptions { get; set; } + public IList XFrameOptions { get; set; } [Newtonsoft.Json.JsonProperty("XPoweredBy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection XPoweredBy { get; set; } + public IList XPoweredBy { get; set; } [Newtonsoft.Json.JsonProperty("XRequestedWith", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection XRequestedWith { get; set; } + public IList XRequestedWith { get; set; } [Newtonsoft.Json.JsonProperty("XUACompatible", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection XUACompatible { get; set; } + public IList XUACompatible { get; set; } [Newtonsoft.Json.JsonProperty("XXSSProtection", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection XXSSProtection { get; set; } + public IList XXSSProtection { get; set; } } @@ -11302,7 +11302,7 @@ public partial class EntryCollectionResponse public int? OdataCount { get; set; } [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public IList Value { get; set; } } @@ -11325,7 +11325,7 @@ public partial class FieldCollectionResponse public int? OdataCount { get; set; } [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public IList Value { get; set; } } @@ -11339,7 +11339,7 @@ public partial class SetFieldsRequest /// The fields that will be assigned to the entry. /// [Newtonsoft.Json.JsonProperty("fields", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Fields { get; set; } + public IList Fields { get; set; } } @@ -11362,7 +11362,7 @@ public partial class TagCollectionResponse public int? OdataCount { get; set; } [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public IList Value { get; set; } } @@ -11465,7 +11465,7 @@ public partial class SetTagsRequest /// The tag names to assign to the entry. /// [Newtonsoft.Json.JsonProperty("tags", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Tags { get; set; } + public IList Tags { get; set; } } @@ -11488,7 +11488,7 @@ public partial class LinkCollectionResponse public int? OdataCount { get; set; } [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public IList Value { get; set; } } @@ -11588,7 +11588,7 @@ public partial class SetLinksRequest /// The links that will be assigned to the entry. /// [Newtonsoft.Json.JsonProperty("links", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Links { get; set; } + public IList Links { get; set; } } @@ -11718,7 +11718,7 @@ public partial class SetTemplateRequest /// The template fields that will be assigned to the entry. /// [Newtonsoft.Json.JsonProperty("fields", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Fields { get; set; } + public IList Fields { get; set; } } @@ -11729,7 +11729,7 @@ public partial class SetTemplateRequest public partial class RepositoryCollectionResponse { [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public IList Value { get; set; } } @@ -11821,7 +11821,7 @@ public partial class SearchContextHitCollectionResponse public int? OdataCount { get; set; } [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public IList Value { get; set; } } @@ -12015,7 +12015,7 @@ public partial class TagDefinitionCollectionResponse public int? OdataCount { get; set; } [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public IList Value { get; set; } } @@ -12070,7 +12070,7 @@ public partial class TagDefinition public partial class TaskCollectionResponse { [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public IList Value { get; set; } } @@ -12110,7 +12110,7 @@ public partial class TaskProgress /// The list of errors occurred during the execution of the associated task. /// [Newtonsoft.Json.JsonProperty("errors", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Errors { get; set; } + public IList Errors { get; set; } /// /// The result of the execution of the associated task. @@ -12207,7 +12207,7 @@ public partial class TaskResult public partial class CancelTasksResponse { [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public IList Value { get; set; } } @@ -12257,7 +12257,7 @@ public partial class TemplateDefinitionCollectionResponse public int? OdataCount { get; set; } [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public IList Value { get; set; } } @@ -12356,7 +12356,7 @@ public partial class TemplateFieldDefinitionCollectionResponse public int? OdataCount { get; set; } [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Value { get; set; } + public IList Value { get; set; } } @@ -12396,7 +12396,7 @@ public partial class Rule /// The IDs of the parent fields in the template according to the form logic rule. /// [Newtonsoft.Json.JsonProperty("ancestors", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public ICollection Ancestors { get; set; } + public IList Ancestors { get; set; } } From 1368072270caf65173d76f9ee3db8f9e0383c777 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Mon, 11 Sep 2023 17:35:39 -0400 Subject: [PATCH 05/93] Manual fix to generated code due to ComponentModel.Annotations not part of .NET Standard --- src/Clients/RepositoryClients.cs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Clients/RepositoryClients.cs b/src/Clients/RepositoryClients.cs index f4b5d9fe..847d5d1d 100644 --- a/src/Clients/RepositoryClients.cs +++ b/src/Clients/RepositoryClients.cs @@ -10102,21 +10102,21 @@ public partial class StartImportUploadedPartsRequest /// The UploadId received when calling the CreateMultipartUploadUrls API to request upload URLs. /// [Newtonsoft.Json.JsonProperty("uploadId", Required = Newtonsoft.Json.Required.Always)] - [ComponentModel.DataAnnotations.Required] + // [ComponentModel.DataAnnotations.Required] https://github.com/dotnet/standard/issues/450 public string UploadId { get; set; } /// /// The array of the ETag values received when writing the file chunks into the upload URLs. /// [Newtonsoft.Json.JsonProperty("partETags", Required = Newtonsoft.Json.Required.Always)] - [ComponentModel.DataAnnotations.Required] - public IList PartETags { get; set; } = new Collections.ObjectModel.Collection(); + // [ComponentModel.DataAnnotations.Required] https://github.com/dotnet/standard/issues/450 + public IList PartETags { get; set; } = new System.Collections.ObjectModel.Collection(); /// /// The name for the imported entry. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] - [ComponentModel.DataAnnotations.Required] + // [ComponentModel.DataAnnotations.Required] https://github.com/dotnet/standard/issues/450 public string Name { get; set; } /// @@ -10244,7 +10244,7 @@ public partial class FieldToUpdate /// The name of the field that will be assigned to the entry. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] - [ComponentModel.DataAnnotations.Required] + // [ComponentModel.DataAnnotations.Required] https://github.com/dotnet/standard/issues/450 public string Name { get; set; } /// @@ -10309,7 +10309,7 @@ public partial class StartExportEntryRequest /// Specifies the part of the document to export. /// [Newtonsoft.Json.JsonProperty("part", Required = Newtonsoft.Json.Required.Always)] - [ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + // [ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] https://github.com/dotnet/standard/issues/450 [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public ExportEntryRequestPart Part { get; set; } @@ -10519,7 +10519,7 @@ public partial class StartCopyEntryRequest /// The name of the entry. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] - [ComponentModel.DataAnnotations.Required] + // [ComponentModel.DataAnnotations.Required] https://github.com/dotnet/standard/issues/450 public string Name { get; set; } /// @@ -11151,7 +11151,7 @@ public partial class ImportEntryRequest /// The name for the imported entry. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] - [ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + // [ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] https://github.com/dotnet/standard/issues/450 public string Name { get; set; } /// @@ -11219,7 +11219,7 @@ public partial class ExportEntryRequest /// The part of the document to export. Options include: Image, Text, Edoc. /// [Newtonsoft.Json.JsonProperty("part", Required = Newtonsoft.Json.Required.Always)] - [ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + // [ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] https://github.com/dotnet/standard/issues/450 [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public ExportEntryRequestPart Part { get; set; } @@ -11602,7 +11602,7 @@ public partial class CopyEntryRequest /// The name of the entry. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] - [ComponentModel.DataAnnotations.Required] + // [ComponentModel.DataAnnotations.Required] https://github.com/dotnet/standard/issues/450 public string Name { get; set; } /// @@ -11635,7 +11635,7 @@ public partial class CreateEntryRequest /// The name of the entry. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] - [ComponentModel.DataAnnotations.Required] + // [ComponentModel.DataAnnotations.Required] https://github.com/dotnet/standard/issues/450 public string Name { get; set; } /// @@ -11648,7 +11648,7 @@ public partial class CreateEntryRequest /// The type of the entry. /// [Newtonsoft.Json.JsonProperty("entryType", Required = Newtonsoft.Json.Required.Always)] - [ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + // [ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] https://github.com/dotnet/standard/issues/450 [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public CreateEntryRequestEntryType EntryType { get; set; } @@ -11711,7 +11711,7 @@ public partial class SetTemplateRequest /// The template that will be assigned to the entry. /// [Newtonsoft.Json.JsonProperty("templateName", Required = Newtonsoft.Json.Required.Always)] - [ComponentModel.DataAnnotations.Required] + // [ComponentModel.DataAnnotations.Required] https://github.com/dotnet/standard/issues/450 public string TemplateName { get; set; } /// @@ -11769,7 +11769,7 @@ public partial class StartSearchEntryRequest /// The search command to run. The search command should follow the Laserfiche search syntax. https://doc.laserfiche.com/laserfiche.documentation/en-us/Default.htm#Search_Syntax.htm /// [Newtonsoft.Json.JsonProperty("searchCommand", Required = Newtonsoft.Json.Required.Always)] - [ComponentModel.DataAnnotations.Required] + // [ComponentModel.DataAnnotations.Required] https://github.com/dotnet/standard/issues/450 public string SearchCommand { get; set; } /// @@ -11991,7 +11991,7 @@ public partial class SearchEntryRequest /// The search command to run. The search command should follow the Laserfiche search syntax. https://doc.laserfiche.com/laserfiche.documentation/en-us/Default.htm#Search_Syntax.htm /// [Newtonsoft.Json.JsonProperty("searchCommand", Required = Newtonsoft.Json.Required.Always)] - [ComponentModel.DataAnnotations.Required] + // [ComponentModel.DataAnnotations.Required] https://github.com/dotnet/standard/issues/450 public string SearchCommand { get; set; } } From 765e5407a285c193cf7c2b7b9aa032fb295f78a3 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Mon, 11 Sep 2023 17:37:25 -0400 Subject: [PATCH 06/93] Server session is gone for good --- src/IRepositoryApiClient.cs | 4 ---- src/RepositoryApiClient.cs | 3 --- 2 files changed, 7 deletions(-) diff --git a/src/IRepositoryApiClient.cs b/src/IRepositoryApiClient.cs index 303613f3..0969f992 100644 --- a/src/IRepositoryApiClient.cs +++ b/src/IRepositoryApiClient.cs @@ -41,10 +41,6 @@ public interface IRepositoryApiClient /// ISearchesClient SearchesClient { get; } /// - /// The Laserfiche Repository Server Session API client. - /// - IServerSessionClient ServerSessionClient { get; } - /// /// The Laserfiche Repository Simple Searches API client. /// ISimpleSearchesClient SimpleSearchesClient { get; } diff --git a/src/RepositoryApiClient.cs b/src/RepositoryApiClient.cs index 4cb99db0..3a28e89e 100644 --- a/src/RepositoryApiClient.cs +++ b/src/RepositoryApiClient.cs @@ -35,8 +35,6 @@ public HttpRequestHeaders DefaultRequestHeaders /// public ISearchesClient SearchesClient { get; } /// - public IServerSessionClient ServerSessionClient { get; } - /// public ISimpleSearchesClient SimpleSearchesClient { get; } /// public ITagDefinitionsClient TagDefinitionsClient { get; } @@ -59,7 +57,6 @@ internal RepositoryApiClient(HttpClient httpClient) LinkDefinitionsClient = new LinkDefinitionsClient(_httpClient); RepositoriesClient = new RepositoriesClient(_httpClient); SearchesClient = new SearchesClient(_httpClient); - ServerSessionClient = new ServerSessionClient(_httpClient); SimpleSearchesClient = new SimpleSearchesClient(_httpClient); TagDefinitionsClient = new TagDefinitionsClient(_httpClient); TasksClient = new TasksClient(_httpClient); From b605f24974c9177fd9efb83974450c2e3eb0128c Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Mon, 11 Sep 2023 17:42:33 -0400 Subject: [PATCH 07/93] Remove unnecessary long names --- src/Clients/BaseClient.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Clients/BaseClient.cs b/src/Clients/BaseClient.cs index 32e64c8f..19c2924c 100644 --- a/src/Clients/BaseClient.cs +++ b/src/Clients/BaseClient.cs @@ -57,7 +57,7 @@ protected string MergeMaxSizeIntoPrefer(int? maxSize, string prefer) } // Copied from auto generated code - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + private string ConvertToString(object value, CultureInfo cultureInfo) { if (value == null) { @@ -76,7 +76,7 @@ private string ConvertToString(object value, System.Globalization.CultureInfo cu return attribute.Value ?? name; } - var converted = Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + var converted = Convert.ToString(Convert.ChangeType(value, Enum.GetUnderlyingType(value.GetType()), cultureInfo)); return converted ?? string.Empty; } } @@ -90,8 +90,8 @@ private string ConvertToString(object value, System.Globalization.CultureInfo cu } else if (value.GetType().IsArray) { - var array = Enumerable.OfType((System.Array)value); - return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); + var array = Enumerable.OfType((Array)value); + return string.Join(",", Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } var result = Convert.ToString(value, cultureInfo); From 10d9517587bfe27b88f8ce9f3a33db633933b850 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Mon, 11 Sep 2023 17:47:42 -0400 Subject: [PATCH 08/93] Update attributes APIs --- src/Clients/AttributesClient.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Clients/AttributesClient.cs b/src/Clients/AttributesClient.cs index 9e60d97a..959b7646 100644 --- a/src/Clients/AttributesClient.cs +++ b/src/Clients/AttributesClient.cs @@ -15,7 +15,7 @@ partial interface IAttributesClient /// /// A delegate that will be called each time new data is retrieved. Returns false to stop receiving more data; returns true to be called again if there's more data. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// The requested repository ID. + /// The requested repository ID. /// Boolean value that indicates whether to return attributes key value pairs associated with everyone or the currently authenticated user. /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. /// Limits the properties returned in the result. @@ -25,7 +25,7 @@ partial interface IAttributesClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task GetTrusteeAttributeKeyValuePairsForEachAsync(Func> callback, string repoId, bool? everyone = null, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListAttributesForEachAsync(Func> callback, string repositoryId, bool? everyone = null, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the attribute key value pairs associated with the authenticated user using a nextlink. @@ -35,26 +35,26 @@ partial interface IAttributesClient /// Optional cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get trustee attribute key value pairs successfully. /// A server side error occurred. - Task GetTrusteeAttributeKeyValuePairsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListAttributesNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); } partial class AttributesClient { - public async Task GetTrusteeAttributeKeyValuePairsForEachAsync(Func> callback, string repoId, bool? everyone = null, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListAttributesForEachAsync(Func> callback, string repositoryId, bool? everyone = null, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await GetTrusteeAttributeKeyValuePairsAsync(repoId, everyone, MergeMaxSizeIntoPrefer(maxPageSize, prefer), select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); + var response = await ListAttributesAsync(repositoryId, everyone, MergeMaxSizeIntoPrefer(maxPageSize, prefer), select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) { - response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), GetTrusteeAttributeKeyValuePairsSendAsync, cancellationToken).ConfigureAwait(false); + response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), ListAttributesSendAsync, cancellationToken).ConfigureAwait(false); } } - public async Task GetTrusteeAttributeKeyValuePairsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListAttributesNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) { - return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), GetTrusteeAttributeKeyValuePairsSendAsync, cancellationToken).ConfigureAwait(false); + return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), ListAttributesSendAsync, cancellationToken).ConfigureAwait(false); } } } From 5d2d6eaa647bcf823dfeb028fb48c052b443c623 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Mon, 11 Sep 2023 17:56:44 -0400 Subject: [PATCH 09/93] Update entries APIs --- src/Clients/EntriesClient.cs | 56 ++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/Clients/EntriesClient.cs b/src/Clients/EntriesClient.cs index cd1f4c42..79e17b7a 100644 --- a/src/Clients/EntriesClient.cs +++ b/src/Clients/EntriesClient.cs @@ -41,7 +41,7 @@ partial interface IEntriesClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task GetEntryListingForEachAsync(Func> callback, string repoId, int entryId, bool? groupByEntryType = null, IEnumerable fields = null, bool? formatFields = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListEntriesForEachAsync(Func> callback, string repoId, int entryId, bool? groupByEntryType = null, IEnumerable fields = null, bool? formatFields = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the fields assigned to an entry using paging. Page results are returned to the . @@ -63,7 +63,7 @@ partial interface IEntriesClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task GetFieldValuesForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, bool? formatValue = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListFieldsForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, bool? formatValue = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the links assigned to an entry using paging. Page results are returned to the . @@ -80,7 +80,7 @@ partial interface IEntriesClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task GetLinkValuesFromEntryForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListLinksForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the tags assigned to an entry using paging. Page results are returned to the . @@ -97,7 +97,7 @@ partial interface IEntriesClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task GetTagsAssignedToEntryForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListTagsForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the children entries of a folder in the repository using a nextlink. @@ -107,7 +107,7 @@ partial interface IEntriesClient /// Optional cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get the children entries of a Folder successfully. /// A server side error occurred. - Task GetEntryListingNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListEntriesNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the fields assigned to an entry using a nextlink. @@ -117,7 +117,7 @@ partial interface IEntriesClient /// Optional cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get field values successfully. /// A server side error occurred. - Task GetFieldValuesNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListFieldsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the links assigned to an entry using a nextlink. @@ -127,7 +127,7 @@ partial interface IEntriesClient /// Optional cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get links successfully. /// A server side error occurred. - Task GetLinkValuesFromEntryNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListLinksNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the tags assigned to an entry using a nextlink @@ -137,7 +137,7 @@ partial interface IEntriesClient /// Optional cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get entry tags successfully. /// A server side error occurred. - Task GetTagsAssignedToEntryNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListTagsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); } partial class EntriesClient @@ -153,72 +153,72 @@ public async Task GetEntryAsync(string uriString, CancellationToken cance } } - public async Task GetEntryListingForEachAsync(Func> callback, string repoId, int entryId, bool? groupByEntryType = null, IEnumerable fields = null, bool? formatFields = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListEntriesForEachAsync(Func> callback, string repoId, int entryId, bool? groupByEntryType = null, IEnumerable fields = null, bool? formatFields = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await GetEntryListingAsync(repoId, entryId, groupByEntryType, fields, formatFields, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); + var response = await ListEntriesAsync(repoId, entryId, groupByEntryType, fields, formatFields, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) { - response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), GetEntryListingSendAsync, cancellationToken).ConfigureAwait(false); + response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), ListEntriesSendAsync, cancellationToken).ConfigureAwait(false); } } - public async Task GetFieldValuesForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, bool? formatValue = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListFieldsForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, bool? formatValue = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await GetFieldValuesAsync(repoId, entryId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), formatValue, culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); + var response = await ListFieldsAsync(repoId, entryId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), formatValue, culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) { - response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), GetFieldValuesSendAsync, cancellationToken).ConfigureAwait(false); + response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), ListFieldsSendAsync, cancellationToken).ConfigureAwait(false); } } - public async Task GetLinkValuesFromEntryForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListLinksForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await GetLinkValuesFromEntryAsync(repoId, entryId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); + var response = await ListLinksAsync(repoId, entryId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) { - response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), GetLinkValuesFromEntrySendAsync, cancellationToken).ConfigureAwait(false); + response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), ListLinksSendAsync, cancellationToken).ConfigureAwait(false); } } - public async Task GetTagsAssignedToEntryForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListTagsForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await GetTagsAssignedToEntryAsync(repoId, entryId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); + var response = await ListTagsAsync(repoId, entryId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) { - response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), GetTagsAssignedToEntrySendAsync, cancellationToken).ConfigureAwait(false); + response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), ListTagsSendAsync, cancellationToken).ConfigureAwait(false); } } - public async Task GetEntryListingNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListEntriesNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) { - return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), GetEntryListingSendAsync, cancellationToken).ConfigureAwait(false); + return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), ListEntriesSendAsync, cancellationToken).ConfigureAwait(false); } - public async Task GetFieldValuesNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListFieldsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) { - return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), GetFieldValuesSendAsync, cancellationToken).ConfigureAwait(false); + return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), ListFieldsSendAsync, cancellationToken).ConfigureAwait(false); } - public async Task GetLinkValuesFromEntryNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListLinksNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) { - return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), GetLinkValuesFromEntrySendAsync, cancellationToken).ConfigureAwait(false); + return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), ListLinksSendAsync, cancellationToken).ConfigureAwait(false); } - public async Task GetTagsAssignedToEntryNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListTagsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) { - return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), GetTagsAssignedToEntrySendAsync, cancellationToken).ConfigureAwait(false); + return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), ListTagsSendAsync, cancellationToken).ConfigureAwait(false); } } } From b57b1e6758b35af0993079c4aa1c47321d7bccf7 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 09:49:50 -0400 Subject: [PATCH 10/93] Update APIs for field definitions --- src/Clients/FieldDefinitionsClient.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Clients/FieldDefinitionsClient.cs b/src/Clients/FieldDefinitionsClient.cs index 7a29d646..defeb96d 100644 --- a/src/Clients/FieldDefinitionsClient.cs +++ b/src/Clients/FieldDefinitionsClient.cs @@ -15,7 +15,7 @@ partial interface IFieldDefinitionsClient /// /// A delegate that will be called each time new data is retrieved. Returns false to stop receiving more data; returns true to be called again if there's more data. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// The requested repository ID. + /// The requested repository ID. /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. /// An optional query parameter used to indicate the locale that should be used for formatting. ///
The value should be a standard language tag. @@ -26,7 +26,7 @@ partial interface IFieldDefinitionsClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task GetFieldDefinitionsForEachAsync(Func> callback, string repoId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListFieldDefinitionsForEachAsync(Func> callback, string repositoryId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns a collection of field definitions using a nextlink. @@ -36,27 +36,27 @@ partial interface IFieldDefinitionsClient /// Optional cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get field definitions successfully. /// A server side error occurred. - Task GetFieldDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListFieldDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); } partial class FieldDefinitionsClient { - public async Task GetFieldDefinitionsForEachAsync(Func> callback, string repoId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListFieldDefinitionsForEachAsync(Func> callback, string repositoryId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await GetFieldDefinitionsAsync(repoId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); + var response = await ListFieldDefinitionsAsync(repositoryId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) { - response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), GetFieldDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); + response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), ListFieldDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); } } - public async Task GetFieldDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListFieldDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) { - return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), GetFieldDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); + return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), ListFieldDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); } } } From 675c280d9df4fe361b08cf337be60828511b1169 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 09:51:33 -0400 Subject: [PATCH 11/93] Update APIs for link definitions --- src/Clients/LinkDefinitionsClient.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Clients/LinkDefinitionsClient.cs b/src/Clients/LinkDefinitionsClient.cs index 6a87c96d..e4e98e9e 100644 --- a/src/Clients/LinkDefinitionsClient.cs +++ b/src/Clients/LinkDefinitionsClient.cs @@ -15,7 +15,7 @@ partial interface ILinkDefinitionsClient /// /// A delegate that will be called each time new data is retrieved. Returns false to stop receiving more data; returns true to be called again if there's more data. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// The requested repository ID. + /// The requested repository ID. /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. /// Limits the properties returned in the result. /// Specifies the order in which items are returned. The maximum number of expressions is 5. @@ -24,7 +24,7 @@ partial interface ILinkDefinitionsClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task GetLinkDefinitionsForEachAsync(Func> callback, string repoId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListLinkDefinitionsForEachAsync(Func> callback, string repositoryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns a collection of link definitions using a nextlink. @@ -34,27 +34,27 @@ partial interface ILinkDefinitionsClient /// Optional cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get link definitions successfully. /// A server side error occurred. - Task GetLinkDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListLinkDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); } partial class LinkDefinitionsClient { - public async Task GetLinkDefinitionsForEachAsync(Func> callback, string repoId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListLinkDefinitionsForEachAsync(Func> callback, string repositoryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await GetLinkDefinitionsAsync(repoId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); + var response = await ListLinkDefinitionsAsync(repositoryId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) { - response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), GetLinkDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); + response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), ListLinkDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); } } - public async Task GetLinkDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListLinkDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) { - return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), GetLinkDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); + return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), ListLinkDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); } } } From d3952b9f5b9ab2425ebce95736f5e48565766421 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 09:54:37 -0400 Subject: [PATCH 12/93] Update APIs for listing repositories --- src/Clients/RepositoriesClient.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Clients/RepositoriesClient.cs b/src/Clients/RepositoriesClient.cs index 9ab7255c..bc14279a 100644 --- a/src/Clients/RepositoriesClient.cs +++ b/src/Clients/RepositoriesClient.cs @@ -13,7 +13,7 @@ public partial class RepositoriesClient /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get the respository resource list successfully. /// A server side error occurred. - public static async System.Threading.Tasks.Task> GetSelfHostedRepositoryListAsync(string baseUrl, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task GetSelfHostedRepositoryListAsync(string baseUrl, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { using (HttpClient client_ = new HttpClient()) { @@ -21,7 +21,7 @@ public partial class RepositoriesClient baseUrl = baseUrl.TrimEnd('/') + "/"; client_.BaseAddress = new Uri(baseUrl); RepositoriesClient repositoriesClient = new RepositoriesClient(client_); - return await repositoriesClient.GetRepositoryListAsync(cancellationToken).ConfigureAwait(false); + return await repositoriesClient.ListRepositoriesAsync(cancellationToken).ConfigureAwait(false); } } } From 28ba91adfe1bf841eb563f49ad5184bdfedf5559 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 10:02:06 -0400 Subject: [PATCH 13/93] Update APIs for search --- src/Clients/SearchesClient.cs | 36 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Clients/SearchesClient.cs b/src/Clients/SearchesClient.cs index f5c6dc20..19e2486d 100644 --- a/src/Clients/SearchesClient.cs +++ b/src/Clients/SearchesClient.cs @@ -16,15 +16,15 @@ partial interface ISearchesClient /// /// A delegate that will be called each time new data is retrieved. Returns false to stop receiving more data; returns true to be called again if there's more data. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// The requested repository ID. + /// The requested repository ID. /// The requested searchToken. /// An optional query parameter used to indicate if the result should be grouped by entry type or not. /// If the search listing should be refreshed to show updated values. /// Optional array of field names. Field values corresponding to the given field names will be returned for each search result. - /// Boolean for if field values should be formatted. Only applicable if Fields are specified. + /// Boolean for if field values should be formatted. Only applicable if Fields are specified. /// An optional odata header. Can be used to set the maximum page size using odata.maxpagesize. /// An optional query parameter used to indicate the locale that should be used for formatting. - ///
The value should be a standard language tag. The formatFields query parameter must be set to true, otherwise + ///
The value should be a standard language tag. The formatFieldValues query parameter must be set to true, otherwise ///
culture will not be used for formatting. /// Limits the properties returned in the result. /// Specifies the order in which items are returned. The maximum number of expressions is 5. @@ -33,14 +33,14 @@ partial interface ISearchesClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task GetSearchResultsForEachAsync(Func> callback, string repoId, string searchToken, bool? groupByEntryType = null, bool? refresh = null, IEnumerable fields = null, bool? formatFields = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListSearchResultsForEachAsync(Func> callback, string repositoryId, string searchToken, bool? groupByEntryType = null, bool? refresh = null, IEnumerable fields = null, bool? formatFieldValues = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the context hits associated with a search result entry using paging. Page results are returned to the . /// /// A delegate that will be called each time new data is retrieved. Returns false to stop receiving more data; returns true to be called again if there's more data. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// The requested repository ID. + /// The requested repository ID. /// The requested searchToken. /// The search result listing row number to get context hits for. /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. @@ -51,7 +51,7 @@ partial interface ISearchesClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task GetSearchContextHitsForEachAsync(Func> callback, string repoId, string searchToken, int rowNumber, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListSearchContextHitsForEachAsync(Func> callback, string repositoryId, string searchToken, int rowNumber, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns a collection of search results using a nextlink. @@ -61,7 +61,7 @@ partial interface ISearchesClient /// Optional cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get search result successfully. /// A server side error occurred. - Task GetSearchResultsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListSearchResultsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the context hits associated with a search result entry using a nextlink. @@ -71,44 +71,44 @@ partial interface ISearchesClient /// Optional cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get search context hits successfully. /// A server side error occurred. - Task GetSearchContextHitsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListSearchContextHitsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); } partial class SearchesClient { - public async Task GetSearchResultsForEachAsync(Func> callback, string repoId, string searchToken, bool? groupByEntryType = null, bool? refresh = null, IEnumerable fields = null, bool? formatFields = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListSearchResultsForEachAsync(Func> callback, string repositoryId, string searchToken, bool? groupByEntryType = null, bool? refresh = null, IEnumerable fields = null, bool? formatFieldValues = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await GetSearchResultsAsync(repoId, searchToken, groupByEntryType, refresh, fields, formatFields, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); + var response = await ListSearchResultsAsync(repositoryId, searchToken, groupByEntryType, refresh, fields, formatFieldValues, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) { - response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), GetSearchResultsSendAsync, cancellationToken).ConfigureAwait(false); + response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), ListSearchResultsSendAsync, cancellationToken).ConfigureAwait(false); } } - public async Task GetSearchContextHitsForEachAsync(Func> callback, string repoId, string searchToken, int rowNumber, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListSearchContextHitsForEachAsync(Func> callback, string repositoryId, string searchToken, int rowNumber, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await GetSearchContextHitsAsync(repoId, searchToken, rowNumber, MergeMaxSizeIntoPrefer(maxPageSize, prefer), select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); + var response = await ListSearchContextHitsAsync(repositoryId, searchToken, rowNumber, MergeMaxSizeIntoPrefer(maxPageSize, prefer), select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) { - response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), GetSearchContextHitsSendAsync, cancellationToken).ConfigureAwait(false); + response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), ListSearchContextHitsSendAsync, cancellationToken).ConfigureAwait(false); } } - public async Task GetSearchResultsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListSearchResultsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) { - return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), GetSearchResultsSendAsync, cancellationToken).ConfigureAwait(false); + return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), ListSearchResultsSendAsync, cancellationToken).ConfigureAwait(false); } - public async Task GetSearchContextHitsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListSearchContextHitsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) { - return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), GetSearchContextHitsSendAsync, cancellationToken).ConfigureAwait(false); + return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), ListSearchContextHitsSendAsync, cancellationToken).ConfigureAwait(false); } } } From 77f3fc742da69116153ef1b22af1011bc790f842 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 10:03:25 -0400 Subject: [PATCH 14/93] Update APIs for tag definitions --- src/Clients/TagDefinitionsClient.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Clients/TagDefinitionsClient.cs b/src/Clients/TagDefinitionsClient.cs index 5463d90f..b913111a 100644 --- a/src/Clients/TagDefinitionsClient.cs +++ b/src/Clients/TagDefinitionsClient.cs @@ -15,7 +15,7 @@ partial interface ITagDefinitionsClient /// /// A delegate that will be called each time new data is retrieved. Returns false to stop receiving more data; returns true to be called again if there's more data. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// The requested repository ID. + /// The requested repository ID. /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. /// An optional query parameter used to indicate the locale that should be used for formatting. ///
The value should be a standard language tag. @@ -26,7 +26,7 @@ partial interface ITagDefinitionsClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task GetTagDefinitionsForEachAsync(Func> callback, string repoId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListTagDefinitionsForEachAsync(Func> callback, string repositoryId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns a collection of tag definitions using a nextlink. @@ -36,26 +36,26 @@ partial interface ITagDefinitionsClient /// Optional cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get tag definitions successfully. /// A server side error occurred. - Task GetTagDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListTagDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); } partial class TagDefinitionsClient { - public async Task GetTagDefinitionsForEachAsync(Func> callback, string repoId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListTagDefinitionsForEachAsync(Func> callback, string repositoryId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await GetTagDefinitionsAsync(repoId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); + var response = await ListTagDefinitionsAsync(repositoryId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) { - response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), GetTagDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); + response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), ListTagDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); } } - public async Task GetTagDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListTagDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) { - return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), GetTagDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); + return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), ListTagDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); } } } From 35037093df0c3987ac8156b8d1bb85d76565ae40 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 10:13:12 -0400 Subject: [PATCH 15/93] WIP: update APIs for template definitions --- src/Clients/TemplateDefinitionsClient.cs | 36 ++++++++++++------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Clients/TemplateDefinitionsClient.cs b/src/Clients/TemplateDefinitionsClient.cs index 8ccfbb36..6a433484 100644 --- a/src/Clients/TemplateDefinitionsClient.cs +++ b/src/Clients/TemplateDefinitionsClient.cs @@ -15,7 +15,7 @@ partial interface ITemplateDefinitionsClient /// /// A delegate that will be called each time new data is retrieved. Returns false to stop receiving more data; returns true to be called again if there's more data. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// The requested repository ID. + /// The requested repository ID. /// An optional query parameter. Can be used to get a single template definition using the template name. /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. /// An optional query parameter used to indicate the locale that should be used for formatting. @@ -27,14 +27,14 @@ partial interface ITemplateDefinitionsClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task GetTemplateDefinitionsForEachAsync(Func> callback, string repoId, string templateName = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task GetTemplateDefinitionsForEachAsync(Func> callback, string repositoryId, string templateName = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the field definitions assigned to a template definition by template id using paging. Page results are returned to the . /// /// A delegate that will be called each time new data is retrieved. Returns false to stop receiving more data; returns true to be called again if there's more data. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// The requested repository ID. + /// The requested repository ID. /// The requested template definition ID. /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. /// An optional query parameter used to indicate the locale that should be used for formatting. @@ -46,14 +46,14 @@ partial interface ITemplateDefinitionsClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task GetTemplateFieldDefinitionsForEachAsync(Func> callback, string repoId, int templateId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task GetTemplateFieldDefinitionsForEachAsync(Func> callback, string repositoryId, int templateId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the field definitions assigned to a template definition by template name using paging. Page results are returned to the . /// /// A delegate that will be called each time new data is retrieved. Returns false to stop receiving more data; returns true to be called again if there's more data. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// The requested repository ID. + /// The requested repository ID. /// A required query parameter for the requested template name. /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. /// An optional query parameter used to indicate the locale that should be used for formatting. @@ -65,7 +65,7 @@ partial interface ITemplateDefinitionsClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task GetTemplateFieldDefinitionsByTemplateNameForEachAsync(Func> callback, string repoId, string templateName, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task GetTemplateFieldDefinitionsByTemplateNameForEachAsync(Func> callback, string repositoryId, string templateName, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns a collection of template definitions using a nextlink. @@ -75,7 +75,7 @@ partial interface ITemplateDefinitionsClient /// Optional cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get template definitions successfully. /// A server side error occurred. - Task GetTemplateDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task GetTemplateDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the field definitions assigned to a template definition by template id using a nextlink. @@ -85,7 +85,7 @@ partial interface ITemplateDefinitionsClient /// Optional cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get template field definitions successfully. /// A server side error occurred. - Task GetTemplateFieldDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task GetTemplateFieldDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the field definitions assigned to a template definition by template name using a nextlink. @@ -95,15 +95,15 @@ partial interface ITemplateDefinitionsClient /// Optional cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get template field definitions successfully. /// A server side error occurred. - Task GetTemplateFieldDefinitionsByTemplateNameNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task GetTemplateFieldDefinitionsByTemplateNameNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); } partial class TemplateDefinitionsClient { - public async Task GetTemplateDefinitionsForEachAsync(Func> callback, string repoId, string templateName = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task GetTemplateDefinitionsForEachAsync(Func> callback, string repositoryId, string templateName = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await GetTemplateDefinitionsAsync(repoId, templateName, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); + var response = await GetTemplateDefinitionsAsync(repositoryId, templateName, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) @@ -112,10 +112,10 @@ public async Task GetTemplateDefinitionsForEachAsync(Func> callback, string repoId, int templateId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task GetTemplateFieldDefinitionsForEachAsync(Func> callback, string repositoryId, int templateId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await GetTemplateFieldDefinitionsAsync(repoId, templateId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count).ConfigureAwait(false); + var response = await GetTemplateFieldDefinitionsAsync(repositoryId, templateId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) @@ -124,10 +124,10 @@ public async Task GetTemplateFieldDefinitionsForEachAsync(Func> callback, string repoId, string templateName, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task GetTemplateFieldDefinitionsByTemplateNameForEachAsync(Func> callback, string repositoryId, string templateName, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await GetTemplateFieldDefinitionsByTemplateNameAsync(repoId, templateName, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); + var response = await GetTemplateFieldDefinitionsByTemplateNameAsync(repositoryId, templateName, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) @@ -136,17 +136,17 @@ public async Task GetTemplateFieldDefinitionsByTemplateNameForEachAsync(Func GetTemplateDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task GetTemplateDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) { return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), GetTemplateDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); } - public async Task GetTemplateFieldDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task GetTemplateFieldDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) { return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), GetTemplateFieldDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); } - public async Task GetTemplateFieldDefinitionsByTemplateNameNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task GetTemplateFieldDefinitionsByTemplateNameNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) { return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), GetTemplateFieldDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); } From b0ade44d2f1184cf0842b8d1396b81ae4c4f9abc Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 10:21:39 -0400 Subject: [PATCH 16/93] Finish updating APIs for template definitions --- src/Clients/TemplateDefinitionsClient.cs | 42 ++++++++++++------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Clients/TemplateDefinitionsClient.cs b/src/Clients/TemplateDefinitionsClient.cs index 6a433484..459362ee 100644 --- a/src/Clients/TemplateDefinitionsClient.cs +++ b/src/Clients/TemplateDefinitionsClient.cs @@ -27,7 +27,7 @@ partial interface ITemplateDefinitionsClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task GetTemplateDefinitionsForEachAsync(Func> callback, string repositoryId, string templateName = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListTemplateDefinitionsForEachAsync(Func> callback, string repositoryId, string templateName = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the field definitions assigned to a template definition by template id using paging. Page results are returned to the . @@ -46,7 +46,7 @@ partial interface ITemplateDefinitionsClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task GetTemplateFieldDefinitionsForEachAsync(Func> callback, string repositoryId, int templateId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListTemplateFieldDefinitionsByTemplateIdForEachAsync(Func> callback, string repositoryId, int templateId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the field definitions assigned to a template definition by template name using paging. Page results are returned to the . @@ -65,7 +65,7 @@ partial interface ITemplateDefinitionsClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task GetTemplateFieldDefinitionsByTemplateNameForEachAsync(Func> callback, string repositoryId, string templateName, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListTemplateFieldDefinitionsByTemplateNameForEachAsync(Func> callback, string repositoryId, string templateName, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns a collection of template definitions using a nextlink. @@ -75,7 +75,7 @@ partial interface ITemplateDefinitionsClient /// Optional cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get template definitions successfully. /// A server side error occurred. - Task GetTemplateDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListTemplateDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the field definitions assigned to a template definition by template id using a nextlink. @@ -85,7 +85,7 @@ partial interface ITemplateDefinitionsClient /// Optional cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get template field definitions successfully. /// A server side error occurred. - Task GetTemplateFieldDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListTemplateFieldDefinitionsByTemplateIdNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the field definitions assigned to a template definition by template name using a nextlink. @@ -95,60 +95,60 @@ partial interface ITemplateDefinitionsClient /// Optional cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get template field definitions successfully. /// A server side error occurred. - Task GetTemplateFieldDefinitionsByTemplateNameNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListTemplateFieldDefinitionsByTemplateNameNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); } partial class TemplateDefinitionsClient { - public async Task GetTemplateDefinitionsForEachAsync(Func> callback, string repositoryId, string templateName = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListTemplateDefinitionsForEachAsync(Func> callback, string repositoryId, string templateName = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await GetTemplateDefinitionsAsync(repositoryId, templateName, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); + var response = await ListTemplateDefinitionsAsync(repositoryId, templateName, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) { - response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), GetTemplateDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); + response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), ListTemplateDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); } } - public async Task GetTemplateFieldDefinitionsForEachAsync(Func> callback, string repositoryId, int templateId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListTemplateFieldDefinitionsByTemplateIdForEachAsync(Func> callback, string repositoryId, int templateId, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await GetTemplateFieldDefinitionsAsync(repositoryId, templateId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count).ConfigureAwait(false); + var response = await ListTemplateFieldDefinitionsByTemplateIdAsync(repositoryId, templateId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) { - response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), GetTemplateFieldDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); + response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), ListTemplateFieldDefinitionsByTemplateIdSendAsync, cancellationToken).ConfigureAwait(false); } } - public async Task GetTemplateFieldDefinitionsByTemplateNameForEachAsync(Func> callback, string repositoryId, string templateName, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListTemplateFieldDefinitionsByTemplateNameForEachAsync(Func> callback, string repositoryId, string templateName, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await GetTemplateFieldDefinitionsByTemplateNameAsync(repositoryId, templateName, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); + var response = await ListTemplateFieldDefinitionsByTemplateNameAsync(repositoryId, templateName, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) { - response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), GetTemplateFieldDefinitionsByTemplateNameSendAsync, cancellationToken).ConfigureAwait(false); + response = await GetNextLinkAsync(_httpClient, response.OdataNextLink, MergeMaxSizeIntoPrefer(maxPageSize, prefer), ListTemplateFieldDefinitionsByTemplateNameSendAsync, cancellationToken).ConfigureAwait(false); } } - public async Task GetTemplateDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListTemplateDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) { - return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), GetTemplateDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); + return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), ListTemplateDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); } - public async Task GetTemplateFieldDefinitionsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListTemplateFieldDefinitionsByTemplateIdNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) { - return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), GetTemplateFieldDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); + return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), ListTemplateFieldDefinitionsByTemplateIdSendAsync, cancellationToken).ConfigureAwait(false); } - public async Task GetTemplateFieldDefinitionsByTemplateNameNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListTemplateFieldDefinitionsByTemplateNameNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default) { - return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), GetTemplateFieldDefinitionsSendAsync, cancellationToken).ConfigureAwait(false); + return await GetNextLinkAsync(_httpClient, nextLink, MergeMaxSizeIntoPrefer(maxPageSize, null), ListTemplateFieldDefinitionsByTemplateIdSendAsync, cancellationToken).ConfigureAwait(false); } } } From 033d5d9358858312f1afb1642fb24e544ab61d92 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 10:29:11 -0400 Subject: [PATCH 17/93] No longer needed --- .../Extensions/ApiExceptionExtensions.cs | 16 ---------- src/Clients/RepositoryClientsPartial.cs | 31 ------------------- 2 files changed, 47 deletions(-) diff --git a/src/Clients/Extensions/ApiExceptionExtensions.cs b/src/Clients/Extensions/ApiExceptionExtensions.cs index 6e319c78..93b2aaa3 100644 --- a/src/Clients/Extensions/ApiExceptionExtensions.cs +++ b/src/Clients/Extensions/ApiExceptionExtensions.cs @@ -21,21 +21,5 @@ internal static ApiException Create(int statusCode, IReadOnlyDictionary> headers, CreateEntryResult createEntryResult, Exception innerException) - { - if (createEntryResult == null) - { - return ApiException.Create(statusCode, headers, innerException); - } - - ProblemDetails problemDetails = ProblemDetails.Create(statusCode, headers); - problemDetails.Title = createEntryResult.GetSummary(); - problemDetails.Extensions = new Dictionary(StringComparer.OrdinalIgnoreCase) - { - [createEntryResult.GetType().Name] = createEntryResult - }; - return ApiException.Create(statusCode, headers, problemDetails, innerException); - } } } diff --git a/src/Clients/RepositoryClientsPartial.cs b/src/Clients/RepositoryClientsPartial.cs index 2fa30e8c..7def5783 100644 --- a/src/Clients/RepositoryClientsPartial.cs +++ b/src/Clients/RepositoryClientsPartial.cs @@ -18,37 +18,6 @@ public string ToString(string format, IFormatProvider formatProvider) } } - partial class CreateEntryResult - { - /// - /// Returns a human-readable summary of the . - /// - /// A human-readable summary of the . - public string GetSummary() - { - var messages = new List(); - int entryId = Operations?.EntryCreate?.EntryId ?? default; - if (entryId != default) - { - messages.Add($"{nameof(Operations.EntryCreate.EntryId)}={entryId}."); - } - messages.Add(GetErrorMessages(Operations?.EntryCreate?.Exceptions)); - messages.Add(GetErrorMessages(Operations?.SetEdoc?.Exceptions)); - messages.Add(GetErrorMessages(Operations?.SetTemplate?.Exceptions)); - messages.Add(GetErrorMessages(Operations?.SetFields?.Exceptions)); - messages.Add(GetErrorMessages(Operations?.SetTags?.Exceptions)); - messages.Add(GetErrorMessages(Operations?.SetLinks?.Exceptions)); - return string.Join(" ", messages.Where(s => !string.IsNullOrWhiteSpace(s))); - } - - private string GetErrorMessages(ICollection errors) - { - if (errors == null) - return string.Empty; - return string.Join(" ", errors?.Select(e => e.Message)); - } - } - #region inheritance [JsonConverter(typeof(JsonInheritanceConverter), "entryType")] [JsonInheritance("Document", typeof(Document))] From a0d8fbf56a59849f9e726329599004c973e9b0ae Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 10:57:00 -0400 Subject: [PATCH 18/93] No need to use so many fully qualified names --- src/Clients/RepositoryClientsPartial.cs | 43 +++++++++++++------------ 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/Clients/RepositoryClientsPartial.cs b/src/Clients/RepositoryClientsPartial.cs index 7def5783..cca60c06 100644 --- a/src/Clients/RepositoryClientsPartial.cs +++ b/src/Clients/RepositoryClientsPartial.cs @@ -1,7 +1,10 @@ using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Serialization; using System; -using System.Collections.Generic; +using System.CodeDom.Compiler; using System.Linq; +using System.Reflection; namespace Laserfiche.Repository.Api.Client { @@ -32,11 +35,11 @@ partial class Entry // so client lib don't need to add dependency to NJsonSchema // we don't add "discriminator" at server side because it will add another property in json schema and we already have @odata.type and entryType could be used for discrimination // only need JsonInheritanceAttribute and JsonInheritanceConverter on client side for response deserialize - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.3.1.0 (Newtonsoft.Json v11.0.0.0)")] - [System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple = true)] + [GeneratedCode("NJsonSchema", "10.3.1.0 (Newtonsoft.Json v11.0.0.0)")] + [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] internal class JsonInheritanceAttribute : System.Attribute { - public JsonInheritanceAttribute(string key, System.Type type) + public JsonInheritanceAttribute(string key, Type type) { Key = key; Type = type; @@ -44,11 +47,11 @@ public JsonInheritanceAttribute(string key, System.Type type) public string Key { get; } - public System.Type Type { get; } + public Type Type { get; } } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.3.1.0 (Newtonsoft.Json v11.0.0.0)")] - internal class JsonInheritanceConverter : Newtonsoft.Json.JsonConverter + [GeneratedCode("NJsonSchema", "10.3.1.0 (Newtonsoft.Json v11.0.0.0)")] + internal class JsonInheritanceConverter : JsonConverter { internal static readonly string DefaultDiscriminatorName = "discriminator"; @@ -70,16 +73,16 @@ public JsonInheritanceConverter(string discriminator) _discriminator = discriminator; } - public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer) + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { try { _isWriting = true; - var jObject = Newtonsoft.Json.Linq.JObject.FromObject(value, serializer); + var jObject = JObject.FromObject(value, serializer); try { - jObject.AddFirst(new Newtonsoft.Json.Linq.JProperty(_discriminator, GetSubtypeDiscriminator(value.GetType()))); + jObject.AddFirst(new JProperty(_discriminator, GetSubtypeDiscriminator(value.GetType()))); } catch (Exception) { } writer.WriteToken(jObject.CreateReader()); @@ -116,23 +119,23 @@ public override bool CanRead } } - public override bool CanConvert(System.Type objectType) + public override bool CanConvert(Type objectType) { return true; } - public override object ReadJson(Newtonsoft.Json.JsonReader reader, System.Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { - var jObject = serializer.Deserialize(reader); + var jObject = serializer.Deserialize(reader); if (jObject == null) return null; var discriminatorValue = jObject.GetValue(_discriminator); - var discriminator = discriminatorValue != null ? Newtonsoft.Json.Linq.Extensions.Value(discriminatorValue) : null; + var discriminator = discriminatorValue != null ? Extensions.Value(discriminatorValue) : null; var subtype = GetObjectSubtype(objectType, discriminator); - var objectContract = serializer.ContractResolver.ResolveContract(subtype) as Newtonsoft.Json.Serialization.JsonObjectContract; - if (objectContract == null || System.Linq.Enumerable.All(objectContract.Properties, p => p.PropertyName != _discriminator)) + var objectContract = serializer.ContractResolver.ResolveContract(subtype) as JsonObjectContract; + if (objectContract == null || Enumerable.All(objectContract.Properties, p => p.PropertyName != _discriminator)) { jObject.Remove(_discriminator); } @@ -148,9 +151,9 @@ public override object ReadJson(Newtonsoft.Json.JsonReader reader, System.Type o } } - private System.Type GetObjectSubtype(System.Type objectType, string discriminator) + private Type GetObjectSubtype(Type objectType, string discriminator) { - foreach (var attribute in System.Reflection.CustomAttributeExtensions.GetCustomAttributes(System.Reflection.IntrospectionExtensions.GetTypeInfo(objectType), true)) + foreach (var attribute in CustomAttributeExtensions.GetCustomAttributes(IntrospectionExtensions.GetTypeInfo(objectType), true)) { if (attribute.Key == discriminator) return attribute.Type; @@ -159,9 +162,9 @@ private System.Type GetObjectSubtype(System.Type objectType, string discriminato return objectType; } - private string GetSubtypeDiscriminator(System.Type objectType) + private string GetSubtypeDiscriminator(Type objectType) { - foreach (var attribute in System.Reflection.CustomAttributeExtensions.GetCustomAttributes(System.Reflection.IntrospectionExtensions.GetTypeInfo(objectType), true)) + foreach (var attribute in CustomAttributeExtensions.GetCustomAttributes(IntrospectionExtensions.GetTypeInfo(objectType), true)) { if (attribute.Type == objectType) return attribute.Key; From 00b7521a5bb99a6f995c699c59a95060464450a3 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 10:58:31 -0400 Subject: [PATCH 19/93] Again, no need for fully qualified name --- src/Clients/RepositoriesClient.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Clients/RepositoriesClient.cs b/src/Clients/RepositoriesClient.cs index bc14279a..5e0e59c2 100644 --- a/src/Clients/RepositoriesClient.cs +++ b/src/Clients/RepositoriesClient.cs @@ -1,6 +1,7 @@ using System; -using System.Collections.Generic; using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; namespace Laserfiche.Repository.Api.Client { @@ -13,7 +14,7 @@ public partial class RepositoriesClient /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get the respository resource list successfully. /// A server side error occurred. - public static async System.Threading.Tasks.Task GetSelfHostedRepositoryListAsync(string baseUrl, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task GetSelfHostedRepositoryListAsync(string baseUrl, CancellationToken cancellationToken = default) { using (HttpClient client_ = new HttpClient()) { From adc81f0b4d9c52b93f87ce50e7c87e15057f63d1 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 11:00:26 -0400 Subject: [PATCH 20/93] Use shorter names --- src/Clients/BaseClient.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Clients/BaseClient.cs b/src/Clients/BaseClient.cs index 19c2924c..c38f6274 100644 --- a/src/Clients/BaseClient.cs +++ b/src/Clients/BaseClient.cs @@ -1,10 +1,11 @@ -using System.Globalization; +using System; +using System.Globalization; using System.Linq; using System.Net.Http; using System.Reflection; -using System.Threading.Tasks; using System.Threading; -using System; +using System.Threading.Tasks; +using System.Runtime.Serialization; namespace Laserfiche.Repository.Api.Client { @@ -71,7 +72,7 @@ private string ConvertToString(object value, CultureInfo cultureInfo) { var field = IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); if (field != null && - CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) is System.Runtime.Serialization.EnumMemberAttribute attribute) + CustomAttributeExtensions.GetCustomAttribute(field, typeof(EnumMemberAttribute)) is EnumMemberAttribute attribute) { return attribute.Value ?? name; } From e45b4fbc66ae27f55a7b33db33b5d5b2da0fbe82 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 11:01:26 -0400 Subject: [PATCH 21/93] Use null propagation --- src/RepositoryApiClient.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/RepositoryApiClient.cs b/src/RepositoryApiClient.cs index 3a28e89e..9f334949 100644 --- a/src/RepositoryApiClient.cs +++ b/src/RepositoryApiClient.cs @@ -46,10 +46,7 @@ public HttpRequestHeaders DefaultRequestHeaders internal RepositoryApiClient(HttpClient httpClient) { _httpClient = httpClient; - if (_httpClient != null) - { - _httpClient.DefaultRequestHeaders.Add("Accept-Encoding", "gzip"); - } + _httpClient?.DefaultRequestHeaders.Add("Accept-Encoding", "gzip"); AttributesClient = new AttributesClient(_httpClient); AuditReasonsClient = new AuditReasonsClient(_httpClient); EntriesClient = new EntriesClient(_httpClient); From 14c66d423eb347f6c06e7df5170d07ce35ddd6a8 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 11:07:27 -0400 Subject: [PATCH 22/93] Fix CreateEntry method --- tests/integration/BaseTest.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/integration/BaseTest.cs b/tests/integration/BaseTest.cs index e9dddc30..30889de9 100644 --- a/tests/integration/BaseTest.cs +++ b/tests/integration/BaseTest.cs @@ -105,12 +105,13 @@ public IRepositoryApiClient CreateClient() public async Task CreateEntry(IRepositoryApiClient client, string entryName, int parentEntryId = 1, bool autoRename = true) { - var request = new PostEntryChildrenRequest() + var request = new CreateEntryRequest() { - EntryType = PostEntryChildrenEntryType.Folder, - Name = entryName + EntryType = CreateEntryRequestEntryType.Folder, + Name = entryName, + AutoRename = autoRename }; - var newEntry = await client.EntriesClient.CreateOrCopyEntryAsync(RepositoryId, parentEntryId, request, autoRename: autoRename).ConfigureAwait(false); + var newEntry = await client.EntriesClient.CreateEntryAsync(RepositoryId, parentEntryId, request).ConfigureAwait(false); Assert.IsNotNull(newEntry); Assert.AreEqual(parentEntryId, newEntry.ParentId); Assert.AreEqual(EntryType.Folder, newEntry.EntryType); From 99daa9976ee4383913d5f870530f7182f14e6a49 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 15:54:02 -0400 Subject: [PATCH 23/93] Add missing API --- src/Clients/EntriesClient.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Clients/EntriesClient.cs b/src/Clients/EntriesClient.cs index 79e17b7a..65d643cd 100644 --- a/src/Clients/EntriesClient.cs +++ b/src/Clients/EntriesClient.cs @@ -97,7 +97,7 @@ partial interface IEntriesClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task ListTagsForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListTagsForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the children entries of a folder in the repository using a nextlink. @@ -137,7 +137,7 @@ partial interface IEntriesClient /// Optional cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get entry tags successfully. /// A server side error occurred. - Task ListTagsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListTagsNextLinkAsync(string nextLink, int? maxPageSize = null, CancellationToken cancellationToken = default); } partial class EntriesClient From 1b64aa10beff9378d80fe691f6ca580c05ce81ae Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 16:07:45 -0400 Subject: [PATCH 24/93] Fix test util methods and use simple import for entry creation --- tests/integration/BaseTest.cs | 44 +++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/tests/integration/BaseTest.cs b/tests/integration/BaseTest.cs index 30889de9..c1efe2e5 100644 --- a/tests/integration/BaseTest.cs +++ b/tests/integration/BaseTest.cs @@ -1,9 +1,7 @@ using Laserfiche.Api.Client.OAuth; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Newtonsoft.Json; using System; using System.IO; -using System.Text; using System.Threading.Tasks; namespace Laserfiche.Repository.Api.Client.IntegrationTest @@ -112,38 +110,44 @@ public async Task CreateEntry(IRepositoryApiClient client, string entryNa AutoRename = autoRename }; var newEntry = await client.EntriesClient.CreateEntryAsync(RepositoryId, parentEntryId, request).ConfigureAwait(false); + Assert.IsNotNull(newEntry); Assert.AreEqual(parentEntryId, newEntry.ParentId); Assert.AreEqual(EntryType.Folder, newEntry.EntryType); + return newEntry; } - public async Task DeleteEntry(IRepositoryApiClient client, int entryId, DeleteEntryWithAuditReason auditReason = null) + public async Task DeleteEntry(IRepositoryApiClient client, int entryId, StartDeleteEntryRequest auditReason = null) { - var operation = await client.EntriesClient.DeleteEntryInfoAsync(RepositoryId, entryId, auditReason).ConfigureAwait(false); - Assert.IsNotNull(operation.Token); - var progress = await client.TasksClient.GetOperationStatusAndProgressAsync(RepositoryId, operation.Token).ConfigureAwait(false); - Assert.IsTrue(progress.Status == OperationStatus.InProgress || progress.Status == OperationStatus.Completed); + var operation = await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, entryId, auditReason).ConfigureAwait(false); + Assert.IsNotNull(operation.TaskId); + + var progress = await client.TasksClient.ListTasksAsync(RepositoryId, new [] { operation.TaskId }).ConfigureAwait(false); + Assert.IsNotNull(progress); + Assert.IsNotNull(progress.Value); + Assert.IsTrue(progress.Value.Count > 0); + Assert.IsTrue(progress.Value[0].Status == TaskStatus.InProgress || progress.Value[0].Status == TaskStatus.Completed); } protected async Task CreateDocument(string name) { int parentEntryId = 1; string fileLocation = TempPath + "test.pdf"; - var request = new PostEntryWithEdocMetadataRequest(); - using (var fileStream = File.OpenRead(fileLocation)) + var request = new ImportEntryRequest() { - var electronicDocument = new FileParameter(fileStream, "test", "application/pdf"); - var result = await client.EntriesClient.ImportDocumentAsync(RepositoryId, parentEntryId, name, autoRename: true, electronicDocument: electronicDocument, request: request).ConfigureAwait(false); - - var operations = result.Operations; - Assert.IsNotNull(operations?.EntryCreate); - Assert.AreEqual(0, operations.EntryCreate.Exceptions.Count); - Assert.AreNotEqual(0, operations.EntryCreate.EntryId); - Assert.AreEqual(0, operations.SetEdoc.Exceptions.Count); - Assert.IsFalse(string.IsNullOrEmpty(result.DocumentLink)); - return operations.EntryCreate.EntryId; - } + AutoRename = true, + Name = name, + }; + + using var fileStream = File.OpenRead(fileLocation); + var electronicDocument = new FileParameter(fileStream, "test", "application/pdf"); + var entry = await client.EntriesClient.ImportEntryAsync(RepositoryId, parentEntryId, null, electronicDocument, request).ConfigureAwait(false); + + Assert.IsNotNull(entry); + Assert.IsNotNull(entry.Id); + + return entry.Id; } } } From 6e084ffcdb4424a75831f9927ed0cf938c28108b Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 16:09:05 -0400 Subject: [PATCH 25/93] Server session is gone --- .../InvalidateServerSessionTest.cs | 27 ---------------- .../AccessTokens/RefreshServerSessionTest.cs | 31 ------------------- 2 files changed, 58 deletions(-) delete mode 100644 tests/integration/AccessTokens/InvalidateServerSessionTest.cs delete mode 100644 tests/integration/AccessTokens/RefreshServerSessionTest.cs diff --git a/tests/integration/AccessTokens/InvalidateServerSessionTest.cs b/tests/integration/AccessTokens/InvalidateServerSessionTest.cs deleted file mode 100644 index 4b759ef5..00000000 --- a/tests/integration/AccessTokens/InvalidateServerSessionTest.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Threading.Tasks; - -namespace Laserfiche.Repository.Api.Client.IntegrationTest.AccessTokens -{ - [TestClass] - public class InvalidateServerSessionTest : BaseTest - { - [TestInitialize] - public void Initialize() - { - client = CreateClient(); - } - - [TestMethod] - public async Task InvalidateServerSession_LogoutSuccessful() - { - if (AuthorizationType == AuthorizationType.API_SERVER_USERNAME_PASSWORD) - { - return; - } - - var result = await client.ServerSessionClient.InvalidateServerSessionAsync(RepositoryId).ConfigureAwait(false); - Assert.AreEqual(true, result.Value); - } - } -} diff --git a/tests/integration/AccessTokens/RefreshServerSessionTest.cs b/tests/integration/AccessTokens/RefreshServerSessionTest.cs deleted file mode 100644 index 1c976009..00000000 --- a/tests/integration/AccessTokens/RefreshServerSessionTest.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; -using System.Threading.Tasks; - -namespace Laserfiche.Repository.Api.Client.IntegrationTest.AccessTokens -{ - [TestClass] - public class RefreshServerSessionTest : BaseTest - { - [TestInitialize] - public void Initialize() - { - client = CreateClient(); - } - - [TestMethod] - public async Task RefreshServerSession_RefreshSuccessful() - { - if (AuthorizationType == AuthorizationType.API_SERVER_USERNAME_PASSWORD) - { - return; - } - - var currentTime = DateTime.UtcNow; - var refreshResult = await client.ServerSessionClient.RefreshServerSessionAsync(RepositoryId).ConfigureAwait(false); - var expireTime = refreshResult?.Value; - Assert.IsNotNull(expireTime); - Assert.IsTrue(currentTime < expireTime.Value.UtcDateTime); - } - } -} From 214a54b1e2c18a414838974bc1949a215d4a27c7 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 16:14:32 -0400 Subject: [PATCH 26/93] Update parameter naming for entries API --- src/Clients/EntriesClient.cs | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Clients/EntriesClient.cs b/src/Clients/EntriesClient.cs index 65d643cd..21292a37 100644 --- a/src/Clients/EntriesClient.cs +++ b/src/Clients/EntriesClient.cs @@ -25,14 +25,14 @@ partial interface IEntriesClient /// /// A delegate that will be called each time new data is retrieved. Returns false to stop receiving more data; returns true to be called again if there's more data. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// The requested repository ID. + /// The requested repository ID. /// The folder ID. /// An optional query parameter used to indicate if the result should be grouped by entry type or not. /// Optional array of field names. Field values corresponding to the given field names will be returned for each entry. - /// Boolean for if field values should be formatted. Only applicable if Fields are specified. + /// Boolean for if field values should be formatted. Only applicable if Fields are specified. /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. /// An optional query parameter used to indicate the locale that should be used for formatting. - ///
The value should be a standard language tag. The formatFields query parameter must be set to true, otherwise + ///
The value should be a standard language tag. The formatFieldValues query parameter must be set to true, otherwise ///
culture will not be used for formatting. /// Limits the properties returned in the result. /// Specifies the order in which items are returned. The maximum number of expressions is 5. @@ -41,14 +41,14 @@ partial interface IEntriesClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task ListEntriesForEachAsync(Func> callback, string repoId, int entryId, bool? groupByEntryType = null, IEnumerable fields = null, bool? formatFields = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListEntriesForEachAsync(Func> callback, string repositoryId, int entryId, bool? groupByEntryType = null, IEnumerable fields = null, bool? formatFieldValues = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the fields assigned to an entry using paging. Page results are returned to the . /// /// A delegate that will be called each time new data is retrieved. Returns false to stop receiving more data; returns true to be called again if there's more data. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// The requested repository ID. + /// The requested repository ID. /// The requested entry ID. /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. /// An optional query parameter used to indicate if the field values should be formatted. @@ -63,14 +63,14 @@ partial interface IEntriesClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task ListFieldsForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, bool? formatValue = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListFieldsForEachAsync(Func> callback, string repositoryId, int entryId, string prefer = null, bool? formatValue = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the links assigned to an entry using paging. Page results are returned to the . /// /// A delegate that will be called each time new data is retrieved. Returns false to stop receiving more data; returns true to be called again if there's more data. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// The requested repository ID. + /// The requested repository ID. /// The requested entry ID. /// An optional odata header. Can be used to set the maximum page size using odata.maxpagesize. /// Limits the properties returned in the result. @@ -80,14 +80,14 @@ partial interface IEntriesClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task ListLinksForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListLinksForEachAsync(Func> callback, string repositoryId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the tags assigned to an entry using paging. Page results are returned to the . /// /// A delegate that will be called each time new data is retrieved. Returns false to stop receiving more data; returns true to be called again if there's more data. /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// The requested repository ID. + /// The requested repository ID. /// The requested entry ID. /// An optional OData header. Can be used to set the maximum page size using odata.maxpagesize. /// Limits the properties returned in the result. @@ -97,7 +97,7 @@ partial interface IEntriesClient /// Indicates whether the total count of items within a collection are returned in the result. /// Optionally specify the maximum number of items to retrieve. /// A server side error occurred. - Task ListTagsForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); + Task ListTagsForEachAsync(Func> callback, string repositoryId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default); /// /// Returns the children entries of a folder in the repository using a nextlink. @@ -153,10 +153,10 @@ public async Task GetEntryAsync(string uriString, CancellationToken cance } } - public async Task ListEntriesForEachAsync(Func> callback, string repoId, int entryId, bool? groupByEntryType = null, IEnumerable fields = null, bool? formatFields = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListEntriesForEachAsync(Func> callback, string repositoryId, int entryId, bool? groupByEntryType = null, IEnumerable fields = null, bool? formatFieldValues = null, string prefer = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await ListEntriesAsync(repoId, entryId, groupByEntryType, fields, formatFields, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); + var response = await ListEntriesAsync(repositoryId, entryId, groupByEntryType, fields, formatFieldValues, MergeMaxSizeIntoPrefer(maxPageSize, prefer), culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) @@ -165,10 +165,10 @@ public async Task ListEntriesForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, bool? formatValue = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListFieldsForEachAsync(Func> callback, string repositoryId, int entryId, string prefer = null, bool? formatValue = null, string culture = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await ListFieldsAsync(repoId, entryId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), formatValue, culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); + var response = await ListFieldsAsync(repositoryId, entryId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), formatValue, culture, select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) @@ -177,10 +177,10 @@ public async Task ListFieldsForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListLinksForEachAsync(Func> callback, string repositoryId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await ListLinksAsync(repoId, entryId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); + var response = await ListLinksAsync(repositoryId, entryId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) @@ -189,10 +189,10 @@ public async Task ListLinksForEachAsync(Func> } } - public async Task ListTagsForEachAsync(Func> callback, string repoId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) + public async Task ListTagsForEachAsync(Func> callback, string repositoryId, int entryId, string prefer = null, string select = null, string orderby = null, int? top = null, int? skip = null, bool? count = null, int? maxPageSize = null, CancellationToken cancellationToken = default) { // Initial request - var response = await ListTagsAsync(repoId, entryId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); + var response = await ListTagsAsync(repositoryId, entryId, MergeMaxSizeIntoPrefer(maxPageSize, prefer), select, orderby, top, skip, count, cancellationToken).ConfigureAwait(false); // Further requests while (!cancellationToken.IsCancellationRequested && response != null && await callback(response).ConfigureAwait(false)) From 50ea7edbbc20d334cf0e529b47502fadb91b065c Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 16:17:15 -0400 Subject: [PATCH 27/93] Update tests for attributes APIs --- tests/integration/Attributes/GetAttributeKeysTest.cs | 10 +++++----- .../Attributes/GetAttributeValueByKeyTest.cs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/integration/Attributes/GetAttributeKeysTest.cs b/tests/integration/Attributes/GetAttributeKeysTest.cs index cb083cad..1e4dbf07 100644 --- a/tests/integration/Attributes/GetAttributeKeysTest.cs +++ b/tests/integration/Attributes/GetAttributeKeysTest.cs @@ -15,7 +15,7 @@ public void Initialize() [TestMethod] public async Task GetAttributes_ReturnAttributes() { - var response = await client.AttributesClient.GetTrusteeAttributeKeyValuePairsAsync(RepositoryId).ConfigureAwait(false); + var response = await client.AttributesClient.ListAttributesAsync(RepositoryId).ConfigureAwait(false); Assert.IsNotNull(response.Value); } @@ -24,7 +24,7 @@ public async Task GetAttributes_ForEachPaging() { int maxPageSize = 10; - Task PagingCallback(ODataValueContextOfListOfAttribute data) + Task PagingCallback(AttributeCollectionResponse data) { if (data.OdataNextLink != null) { @@ -38,7 +38,7 @@ Task PagingCallback(ODataValueContextOfListOfAttribute data) } } - await client.AttributesClient.GetTrusteeAttributeKeyValuePairsForEachAsync(PagingCallback, RepositoryId, maxPageSize: maxPageSize).ConfigureAwait(false); + await client.AttributesClient.ListAttributesForEachAsync(PagingCallback, RepositoryId, maxPageSize: maxPageSize).ConfigureAwait(false); await Task.Delay(5000).ConfigureAwait(false); } @@ -48,7 +48,7 @@ public async Task GetAttributes_SimplePaging() int maxPageSize = 1; // Initial request - var result = await client.AttributesClient.GetTrusteeAttributeKeyValuePairsAsync(RepositoryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); + var result = await client.AttributesClient.ListAttributesAsync(RepositoryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); Assert.IsNotNull(result); if (result.Value.Count == 0) @@ -61,7 +61,7 @@ public async Task GetAttributes_SimplePaging() Assert.IsTrue(result.Value.Count <= maxPageSize); // Paging request - result = await client.AttributesClient.GetTrusteeAttributeKeyValuePairsNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); + result = await client.AttributesClient.ListAttributesNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); Assert.IsNotNull(result); Assert.IsTrue(result.Value.Count <= maxPageSize); } diff --git a/tests/integration/Attributes/GetAttributeValueByKeyTest.cs b/tests/integration/Attributes/GetAttributeValueByKeyTest.cs index 73b1dc99..ffb45278 100644 --- a/tests/integration/Attributes/GetAttributeValueByKeyTest.cs +++ b/tests/integration/Attributes/GetAttributeValueByKeyTest.cs @@ -16,12 +16,12 @@ public void Initialize() [TestMethod] public async Task GetAttributeByKey_ReturnAttribute() { - var result = await client.AttributesClient.GetTrusteeAttributeKeyValuePairsAsync(RepositoryId).ConfigureAwait(false); + var result = await client.AttributesClient.ListAttributesAsync(RepositoryId).ConfigureAwait(false); var attributeKeys = result.Value; Assert.IsNotNull(attributeKeys); Assert.IsTrue(attributeKeys.Count > 0, "No attribute keys exist on the user."); - var attribute = await client.AttributesClient.GetTrusteeAttributeValueByKeyAsync(RepositoryId, attributeKeys.First().Key).ConfigureAwait(false); + var attribute = await client.AttributesClient.GetAttributeAsync(RepositoryId, attributeKeys.First().Key).ConfigureAwait(false); Assert.IsTrue(!string.IsNullOrEmpty(attribute.Value)); } } From 11192d49a3cde8f0c3b1b6a558ed07eef28bcd08 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 16:20:41 -0400 Subject: [PATCH 28/93] Update tests for audit reason APIs --- tests/integration/AuditReasons/GetAuditReasonsTest.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/integration/AuditReasons/GetAuditReasonsTest.cs b/tests/integration/AuditReasons/GetAuditReasonsTest.cs index 1f64bd58..2eb340f7 100644 --- a/tests/integration/AuditReasons/GetAuditReasonsTest.cs +++ b/tests/integration/AuditReasons/GetAuditReasonsTest.cs @@ -15,11 +15,13 @@ public void Initialize() [TestMethod] public async Task GetAuditReasons_ReturnAuditReasons() { - var auditReasons = await client.AuditReasonsClient.GetAuditReasonsAsync(RepositoryId).ConfigureAwait(false); + var response = await client.AuditReasonsClient.ListAuditReasonsAsync(RepositoryId).ConfigureAwait(false); - Assert.IsNotNull(auditReasons); - Assert.IsNotNull(auditReasons.DeleteEntry); - Assert.IsNotNull(auditReasons.ExportDocument); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Value); + Assert.IsNotNull(response.Value.Count > 0); + Assert.IsNotNull(response.Value[0]); + Assert.IsNotNull(response.Value[0].AuditEventType); } } } From e177ba7ac123009dcaf058460957c3ea90973b7b Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 16:23:38 -0400 Subject: [PATCH 29/93] For tests of attribtues APIs, rename test classes names and their tests since the API names have changed --- ...GetAttributeValueByKeyTest.cs => GetAttributeTest.cs} | 4 ++-- .../{GetAttributeKeysTest.cs => ListAttributesTest.cs} | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) rename tests/integration/Attributes/{GetAttributeValueByKeyTest.cs => GetAttributeTest.cs} (88%) rename tests/integration/Attributes/{GetAttributeKeysTest.cs => ListAttributesTest.cs} (90%) diff --git a/tests/integration/Attributes/GetAttributeValueByKeyTest.cs b/tests/integration/Attributes/GetAttributeTest.cs similarity index 88% rename from tests/integration/Attributes/GetAttributeValueByKeyTest.cs rename to tests/integration/Attributes/GetAttributeTest.cs index ffb45278..87c9dfff 100644 --- a/tests/integration/Attributes/GetAttributeValueByKeyTest.cs +++ b/tests/integration/Attributes/GetAttributeTest.cs @@ -5,7 +5,7 @@ namespace Laserfiche.Repository.Api.Client.IntegrationTest.Attributes { [TestClass] - public class GetAttributeValueByKeyTest : BaseTest + public class GetAttributeTest : BaseTest { [TestInitialize] public void Initialize() @@ -14,7 +14,7 @@ public void Initialize() } [TestMethod] - public async Task GetAttributeByKey_ReturnAttribute() + public async Task GetAttribute_ReturnAttribute() { var result = await client.AttributesClient.ListAttributesAsync(RepositoryId).ConfigureAwait(false); var attributeKeys = result.Value; diff --git a/tests/integration/Attributes/GetAttributeKeysTest.cs b/tests/integration/Attributes/ListAttributesTest.cs similarity index 90% rename from tests/integration/Attributes/GetAttributeKeysTest.cs rename to tests/integration/Attributes/ListAttributesTest.cs index 1e4dbf07..a09cf6da 100644 --- a/tests/integration/Attributes/GetAttributeKeysTest.cs +++ b/tests/integration/Attributes/ListAttributesTest.cs @@ -4,7 +4,7 @@ namespace Laserfiche.Repository.Api.Client.IntegrationTest.Attributes { [TestClass] - public class GetAttributesTest : BaseTest + public class ListAttributesTest : BaseTest { [TestInitialize] public void Initialize() @@ -13,14 +13,15 @@ public void Initialize() } [TestMethod] - public async Task GetAttributes_ReturnAttributes() + public async Task ListAttributes_ReturnAttributes() { var response = await client.AttributesClient.ListAttributesAsync(RepositoryId).ConfigureAwait(false); + Assert.IsNotNull(response.Value); } [TestMethod] - public async Task GetAttributes_ForEachPaging() + public async Task ListAttributes_ForEachPaging() { int maxPageSize = 10; @@ -43,7 +44,7 @@ Task PagingCallback(AttributeCollectionResponse data) } [TestMethod] - public async Task GetAttributes_SimplePaging() + public async Task ListAttributes_SimplePaging() { int maxPageSize = 1; From 2302dcc6242000e40b19f0cb38cf73c9d7f0af84 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 16:24:26 -0400 Subject: [PATCH 30/93] Rename tests for audit reasons since their names have changed --- .../{GetAuditReasonsTest.cs => ListAuditReasonsTest.cs} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename tests/integration/AuditReasons/{GetAuditReasonsTest.cs => ListAuditReasonsTest.cs} (86%) diff --git a/tests/integration/AuditReasons/GetAuditReasonsTest.cs b/tests/integration/AuditReasons/ListAuditReasonsTest.cs similarity index 86% rename from tests/integration/AuditReasons/GetAuditReasonsTest.cs rename to tests/integration/AuditReasons/ListAuditReasonsTest.cs index 2eb340f7..9496f2fa 100644 --- a/tests/integration/AuditReasons/GetAuditReasonsTest.cs +++ b/tests/integration/AuditReasons/ListAuditReasonsTest.cs @@ -4,7 +4,7 @@ namespace Laserfiche.Repository.Api.Client.IntegrationTest.AuditReasons { [TestClass] - public class GetAuditReasonsTest : BaseTest + public class ListAuditReasonsTest : BaseTest { [TestInitialize] public void Initialize() @@ -13,7 +13,7 @@ public void Initialize() } [TestMethod] - public async Task GetAuditReasons_ReturnAuditReasons() + public async Task ListAuditReasons_ReturnAuditReasons() { var response = await client.AuditReasonsClient.ListAuditReasonsAsync(RepositoryId).ConfigureAwait(false); From 2106cfc58a00e8b5b62952dfc364ef4c30a9f9be Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 16:55:07 -0400 Subject: [PATCH 31/93] Add standard assertion for collection response --- tests/integration/BaseTest.cs | 96 +++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/tests/integration/BaseTest.cs b/tests/integration/BaseTest.cs index c1efe2e5..96ff12bd 100644 --- a/tests/integration/BaseTest.cs +++ b/tests/integration/BaseTest.cs @@ -149,5 +149,101 @@ protected async Task CreateDocument(string name) return entry.Id; } + + protected static void AssertCollectionResponse(AttributeCollectionResponse response) + { + Assert.IsNotNull(response); + Assert.IsNotNull(response.Value); + Assert.IsTrue(response.Value.Count > 0); + Assert.IsNotNull(response.Value[0]); + } + + protected static void AssertCollectionResponse(AuditReasonCollectionResponse response) + { + Assert.IsNotNull(response); + Assert.IsNotNull(response.Value); + Assert.IsTrue(response.Value.Count > 0); + Assert.IsNotNull(response.Value[0]); + } + + protected static void AssertCollectionResponse(FieldDefinitionCollectionResponse response) + { + Assert.IsNotNull(response); + Assert.IsNotNull(response.Value); + Assert.IsTrue(response.Value.Count > 0); + Assert.IsNotNull(response.Value[0]); + } + + protected static void AssertCollectionResponse(LinkDefinitionCollectionResponse response) + { + Assert.IsNotNull(response); + Assert.IsNotNull(response.Value); + Assert.IsTrue(response.Value.Count > 0); + Assert.IsNotNull(response.Value[0]); + } + + protected static void AssertCollectionResponse(EntryCollectionResponse response) + { + Assert.IsNotNull(response); + Assert.IsNotNull(response.Value); + Assert.IsTrue(response.Value.Count > 0); + Assert.IsNotNull(response.Value[0]); + } + + protected static void AssertCollectionResponse(FieldCollectionResponse response) + { + Assert.IsNotNull(response); + Assert.IsNotNull(response.Value); + Assert.IsTrue(response.Value.Count > 0); + Assert.IsNotNull(response.Value[0]); + } + + protected static void AssertCollectionResponse(TagCollectionResponse response) + { + Assert.IsNotNull(response); + Assert.IsNotNull(response.Value); + Assert.IsTrue(response.Value.Count > 0); + Assert.IsNotNull(response.Value[0]); + } + + protected static void AssertCollectionResponse(LinkCollectionResponse response) + { + Assert.IsNotNull(response); + Assert.IsNotNull(response.Value); + Assert.IsTrue(response.Value.Count > 0); + Assert.IsNotNull(response.Value[0]); + } + + protected static void AssertCollectionResponse(RepositoryCollectionResponse response) + { + Assert.IsNotNull(response); + Assert.IsNotNull(response.Value); + Assert.IsTrue(response.Value.Count > 0); + Assert.IsNotNull(response.Value[0]); + } + + protected static void AssertCollectionResponse(SearchContextHitCollectionResponse response) + { + Assert.IsNotNull(response); + Assert.IsNotNull(response.Value); + Assert.IsTrue(response.Value.Count > 0); + Assert.IsNotNull(response.Value[0]); + } + + protected static void AssertCollectionResponse(TaskCollectionResponse response) + { + Assert.IsNotNull(response); + Assert.IsNotNull(response.Value); + Assert.IsTrue(response.Value.Count > 0); + Assert.IsNotNull(response.Value[0]); + } + + protected static void AssertCollectionResponse(TemplateDefinitionCollectionResponse response) + { + Assert.IsNotNull(response); + Assert.IsNotNull(response.Value); + Assert.IsTrue(response.Value.Count > 0); + Assert.IsNotNull(response.Value[0]); + } } } From d29e66327773a98f06d58c227303faf767433585 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 17:03:52 -0400 Subject: [PATCH 32/93] Update tests for copy entry API --- ...CopyEntryAsyncTest.cs => CopyEntryTest.cs} | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) rename tests/integration/Entries/{CopyEntryAsyncTest.cs => CopyEntryTest.cs} (57%) diff --git a/tests/integration/Entries/CopyEntryAsyncTest.cs b/tests/integration/Entries/CopyEntryTest.cs similarity index 57% rename from tests/integration/Entries/CopyEntryAsyncTest.cs rename to tests/integration/Entries/CopyEntryTest.cs index 2377b25d..0ec1cf29 100644 --- a/tests/integration/Entries/CopyEntryAsyncTest.cs +++ b/tests/integration/Entries/CopyEntryTest.cs @@ -1,11 +1,12 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; namespace Laserfiche.Repository.Api.Client.IntegrationTest.Entries { [TestClass] - public class CopyEntryAsyncTest : BaseTest + public class CopyEntryTest : BaseTest { IList createdEntries; @@ -23,8 +24,8 @@ public async Task Cleanup() { if (entry != null) { - DeleteEntryWithAuditReason body = new DeleteEntryWithAuditReason(); - await client.EntriesClient.DeleteEntryInfoAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); + StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); } } } @@ -39,29 +40,32 @@ public async Task CreateCopyEntry_CopyEntry() // Create new entry string newEntryName = "RepositoryApiClientIntegrationTest .Net CreateFolder"; - var request = new PostEntryChildrenRequest() + var request = new CreateEntryRequest() { - EntryType = PostEntryChildrenEntryType.Folder, - Name = newEntryName + EntryType = CreateEntryRequestEntryType.Folder, + Name = newEntryName, + AutoRename = true }; - var targetEntry = await client.EntriesClient.CreateOrCopyEntryAsync(RepositoryId, testFolder.Id, request, autoRename: true).ConfigureAwait(false); + var targetEntry = await client.EntriesClient.CreateEntryAsync(RepositoryId, testFolder.Id, request).ConfigureAwait(false); Assert.IsNotNull(targetEntry); Assert.AreEqual(testFolder.Id, targetEntry.ParentId); Assert.AreEqual(EntryType.Folder, targetEntry.EntryType); // Copy entry - var copyRequest = new CopyAsyncRequest() + var copyRequest = new StartCopyEntryRequest() { Name = "RepositoryApiClientIntegrationTest .Net CopiedEntry", - SourceId = targetEntry.Id + SourceId = targetEntry.Id, + AutoRename = true }; - var copyResult = await client.EntriesClient.CopyEntryAsync(RepositoryId, testFolder.Id, copyRequest, autoRename: true).ConfigureAwait(false); - var opToken = copyResult.Token; + var copyResult = await client.EntriesClient.StartCopyEntryAsync(RepositoryId, testFolder.Id, copyRequest).ConfigureAwait(false); + var opToken = copyResult.TaskId; // Wait for the copy operation to finish await Task.Delay(5000).ConfigureAwait(false); - var opResponse = await client.TasksClient.GetOperationStatusAndProgressAsync(RepositoryId, opToken).ConfigureAwait(false); - Assert.AreEqual(OperationStatus.Completed, opResponse.Status); + var taskCollectionResponse = await client.TasksClient.ListTasksAsync(RepositoryId).ConfigureAwait(false); + AssertCollectionResponse(taskCollectionResponse); + Assert.IsNotNull(taskCollectionResponse.Value.First(t => t.Id == opToken && t.Status == TaskStatus.Completed)); } } } From cb88bc76afa7cc46f6167b9e285a0bac47269a42 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 17:07:50 -0400 Subject: [PATCH 33/93] Use AssertCollectionResponse --- tests/integration/AuditReasons/ListAuditReasonsTest.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/integration/AuditReasons/ListAuditReasonsTest.cs b/tests/integration/AuditReasons/ListAuditReasonsTest.cs index 9496f2fa..0bb863e3 100644 --- a/tests/integration/AuditReasons/ListAuditReasonsTest.cs +++ b/tests/integration/AuditReasons/ListAuditReasonsTest.cs @@ -17,10 +17,7 @@ public async Task ListAuditReasons_ReturnAuditReasons() { var response = await client.AuditReasonsClient.ListAuditReasonsAsync(RepositoryId).ConfigureAwait(false); - Assert.IsNotNull(response); - Assert.IsNotNull(response.Value); - Assert.IsNotNull(response.Value.Count > 0); - Assert.IsNotNull(response.Value[0]); + AssertCollectionResponse(response); Assert.IsNotNull(response.Value[0].AuditEventType); } } From f161200635b3ef7b7d10012b59a8739e3165d72e Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 17:20:46 -0400 Subject: [PATCH 34/93] Update tests for create and copy entry APIs --- tests/integration/Entries/CopyEntryTest.cs | 82 ++++++++- .../Entries/CreateCopyEntryTest.cs | 162 ------------------ tests/integration/Entries/CreateEntryTest.cs | 89 ++++++++++ 3 files changed, 170 insertions(+), 163 deletions(-) delete mode 100644 tests/integration/Entries/CreateCopyEntryTest.cs create mode 100644 tests/integration/Entries/CreateEntryTest.cs diff --git a/tests/integration/Entries/CopyEntryTest.cs b/tests/integration/Entries/CopyEntryTest.cs index 0ec1cf29..0e801e35 100644 --- a/tests/integration/Entries/CopyEntryTest.cs +++ b/tests/integration/Entries/CopyEntryTest.cs @@ -1,4 +1,5 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Laserfiche.Api.Client; +using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -67,5 +68,84 @@ public async Task CreateCopyEntry_CopyEntry() AssertCollectionResponse(taskCollectionResponse); Assert.IsNotNull(taskCollectionResponse.Value.First(t => t.Id == opToken && t.Status == TaskStatus.Completed)); } + + [TestMethod] + public async Task CreateCopyEntry_CopyShortcut() + { + // Create new entry + string newEntryName = "RepositoryApiClientIntegrationTest .Net CreateFolder"; + int parentEntryId = 1; + var createEntryRequest = new CreateEntryRequest() + { + EntryType = CreateEntryRequestEntryType.Folder, + Name = newEntryName, + AutoRename = true + }; + var targetEntry = await client.EntriesClient.CreateEntryAsync(RepositoryId, parentEntryId, createEntryRequest).ConfigureAwait(false); + Assert.IsNotNull(targetEntry); + createdEntries.Add(targetEntry); + Assert.AreEqual(parentEntryId, targetEntry.ParentId); + Assert.AreEqual(EntryType.Folder, targetEntry.EntryType); + + // Create shortcut to the new entry + newEntryName = "RepositoryApiClientIntegrationTest .Net CreateShortcut"; + createEntryRequest = new CreateEntryRequest() + { + EntryType = CreateEntryRequestEntryType.Shortcut, + Name = newEntryName, + TargetId = targetEntry.Id, + AutoRename = true + }; + var shortcut = await client.EntriesClient.CreateEntryAsync(RepositoryId, parentEntryId, createEntryRequest).ConfigureAwait(false); + + Assert.IsNotNull(shortcut); + createdEntries.Add(shortcut); + Assert.AreEqual(parentEntryId, shortcut.ParentId); + Assert.AreEqual(EntryType.Shortcut, shortcut.EntryType); + + // Copy entry + var copyEntryRequest = new CopyEntryRequest() + { + Name = "RepositoryApiClientIntegrationTest .Net CopiedEntry", + SourceId = shortcut.Id, + AutoRename = true + }; + var newEntry = await client.EntriesClient.CopyEntryAsync(RepositoryId, parentEntryId, copyEntryRequest).ConfigureAwait(false); + + createdEntries.Add(newEntry); + Assert.IsTrue(newEntry.Name.StartsWith(createEntryRequest.Name)); + Assert.AreEqual(parentEntryId, newEntry.ParentId); + Assert.AreEqual(shortcut.EntryType, newEntry.EntryType); + } + + + [ExpectedException(typeof(ApiException))] + [TestMethod] + public async Task CreateCopyEntry_CopyFolder() + { + // Create new entry + string newEntryName = "RepositoryApiClientIntegrationTest .Net CreateFolder"; + int parentEntryId = 1; + var createEntryRequest = new CreateEntryRequest() + { + EntryType = CreateEntryRequestEntryType.Folder, + Name = newEntryName, + AutoRename = true + }; + var targetEntry = await client.EntriesClient.CreateEntryAsync(RepositoryId, parentEntryId, createEntryRequest).ConfigureAwait(false); + Assert.IsNotNull(targetEntry); + createdEntries.Add(targetEntry); + Assert.AreEqual(parentEntryId, targetEntry.ParentId); + Assert.AreEqual(EntryType.Folder, targetEntry.EntryType); + + // Copy entry + var copyEntryRequest = new CopyEntryRequest() + { + Name = "RepositoryApiClientIntegrationTest .Net CopiedEntry", + SourceId = targetEntry.Id, + AutoRename = true + }; + _ = await client.EntriesClient.CopyEntryAsync(RepositoryId, parentEntryId, copyEntryRequest).ConfigureAwait(false); + } } } diff --git a/tests/integration/Entries/CreateCopyEntryTest.cs b/tests/integration/Entries/CreateCopyEntryTest.cs deleted file mode 100644 index 4f862417..00000000 --- a/tests/integration/Entries/CreateCopyEntryTest.cs +++ /dev/null @@ -1,162 +0,0 @@ -using Laserfiche.Api.Client; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Laserfiche.Repository.Api.Client.IntegrationTest.Entries -{ - [TestClass] - public class CreateCopyEntryTest : BaseTest - { - IList createdEntries; - - [TestInitialize] - public void Initialize() - { - client = CreateClient(); - createdEntries = new List(); - } - - [TestCleanup] - public async Task Cleanup() - { - foreach (var entry in createdEntries) - { - if (entry != null) - { - DeleteEntryWithAuditReason body = new DeleteEntryWithAuditReason(); - await client.EntriesClient.DeleteEntryInfoAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); - } - } - } - - [TestMethod] - public async Task CreateCopyEntry_CreateFolder() - { - string newEntryName = "RepositoryApiClientIntegrationTest .Net CreateFolder"; - int parentEntryId = 1; - var request = new PostEntryChildrenRequest() - { - EntryType = PostEntryChildrenEntryType.Folder, - Name = newEntryName - }; - - var entry = await client.EntriesClient.CreateOrCopyEntryAsync(RepositoryId, parentEntryId, request, autoRename: true).ConfigureAwait(false); - Assert.IsNotNull(entry); - createdEntries.Add(entry); - Assert.AreEqual(parentEntryId, entry.ParentId); - Assert.AreEqual(EntryType.Folder, entry.EntryType); - Assert.AreEqual(typeof(Folder), entry.GetType()); - } - - [TestMethod] - public async Task CreateCopyEntry_CreateShortcut() - { - // Create new entry - string newEntryName = "RepositoryApiClientIntegrationTest .Net CreateFolder"; - int parentEntryId = 1; - var request = new PostEntryChildrenRequest() - { - EntryType = PostEntryChildrenEntryType.Folder, - Name = newEntryName - }; - var targetEntry = await client.EntriesClient.CreateOrCopyEntryAsync(RepositoryId, parentEntryId, request, autoRename: true).ConfigureAwait(false); - Assert.IsNotNull(targetEntry); - createdEntries.Add(targetEntry); - Assert.AreEqual(parentEntryId, targetEntry.ParentId); - Assert.AreEqual(EntryType.Folder, targetEntry.EntryType); - - // Create shortcut to the new entry - newEntryName = "RepositoryApiClientIntegrationTest .Net CreateShortcut"; - request = new PostEntryChildrenRequest() - { - EntryType = PostEntryChildrenEntryType.Shortcut, - Name = newEntryName, - TargetId = targetEntry.Id - }; - var shortcut = await client.EntriesClient.CreateOrCopyEntryAsync(RepositoryId, parentEntryId, request, autoRename: true).ConfigureAwait(false); - Assert.IsNotNull(shortcut); - createdEntries.Add(shortcut); - Assert.AreEqual(parentEntryId, shortcut.ParentId); - Assert.AreEqual(EntryType.Shortcut, shortcut.EntryType); - Assert.AreEqual(typeof(Shortcut), shortcut.GetType()); - Assert.AreEqual(targetEntry.EntryType, ((Shortcut)shortcut).TargetType); - Assert.AreEqual(targetEntry.Id, ((Shortcut)shortcut).TargetId); - } - - - [TestMethod] - public async Task CreateCopyEntry_CopyShortcut() - { - // Create new entry - string newEntryName = "RepositoryApiClientIntegrationTest .Net CreateFolder"; - int parentEntryId = 1; - var request = new PostEntryChildrenRequest() - { - EntryType = PostEntryChildrenEntryType.Folder, - Name = newEntryName - }; - var targetEntry = await client.EntriesClient.CreateOrCopyEntryAsync(RepositoryId, parentEntryId, request, autoRename: true).ConfigureAwait(false); - Assert.IsNotNull(targetEntry); - createdEntries.Add(targetEntry); - Assert.AreEqual(parentEntryId, targetEntry.ParentId); - Assert.AreEqual(EntryType.Folder, targetEntry.EntryType); - - // Create shortcut to the new entry - newEntryName = "RepositoryApiClientIntegrationTest .Net CreateShortcut"; - request = new PostEntryChildrenRequest() - { - EntryType = PostEntryChildrenEntryType.Shortcut, - Name = newEntryName, - TargetId = targetEntry.Id - }; - var shortcut = await client.EntriesClient.CreateOrCopyEntryAsync(RepositoryId, parentEntryId, request, autoRename: true).ConfigureAwait(false); - - Assert.IsNotNull(shortcut); - createdEntries.Add(shortcut); - Assert.AreEqual(parentEntryId, shortcut.ParentId); - Assert.AreEqual(EntryType.Shortcut, shortcut.EntryType); - - // Copy entry - request = new PostEntryChildrenRequest() - { - Name = "RepositoryApiClientIntegrationTest .Net CopiedEntry", - SourceId = shortcut.Id - }; - var newEntry = await client.EntriesClient.CreateOrCopyEntryAsync(RepositoryId, parentEntryId, request, autoRename: true).ConfigureAwait(false); - - createdEntries.Add(newEntry); - Assert.IsTrue(newEntry.Name.StartsWith(request.Name)); - Assert.AreEqual(parentEntryId, newEntry.ParentId); - Assert.AreEqual(shortcut.EntryType, newEntry.EntryType); - } - - - [ExpectedException(typeof(ApiException))] - [TestMethod] - public async Task CreateCopyEntry_CopyFolder() - { - // Create new entry - string newEntryName = "RepositoryApiClientIntegrationTest .Net CreateFolder"; - int parentEntryId = 1; - var request = new PostEntryChildrenRequest() - { - EntryType = PostEntryChildrenEntryType.Folder, - Name = newEntryName - }; - var targetEntry = await client.EntriesClient.CreateOrCopyEntryAsync(RepositoryId, parentEntryId, request, autoRename: true).ConfigureAwait(false); - Assert.IsNotNull(targetEntry); - createdEntries.Add(targetEntry); - Assert.AreEqual(parentEntryId, targetEntry.ParentId); - Assert.AreEqual(EntryType.Folder, targetEntry.EntryType); - - // Copy entry - request = new PostEntryChildrenRequest() - { - Name = "RepositoryApiClientIntegrationTest .Net CopiedEntry", - SourceId = targetEntry.Id - }; - _ = await client.EntriesClient.CreateOrCopyEntryAsync(RepositoryId, parentEntryId, request, autoRename: true).ConfigureAwait(false); - } - } -} diff --git a/tests/integration/Entries/CreateEntryTest.cs b/tests/integration/Entries/CreateEntryTest.cs new file mode 100644 index 00000000..44812ded --- /dev/null +++ b/tests/integration/Entries/CreateEntryTest.cs @@ -0,0 +1,89 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Laserfiche.Repository.Api.Client.IntegrationTest.Entries +{ + [TestClass] + public class CreateEntryTest : BaseTest + { + IList createdEntries; + + [TestInitialize] + public void Initialize() + { + client = CreateClient(); + createdEntries = new List(); + } + + [TestCleanup] + public async Task Cleanup() + { + foreach (var entry in createdEntries) + { + if (entry != null) + { + StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); + } + } + } + + [TestMethod] + public async Task CreateCopyEntry_CreateFolder() + { + string newEntryName = "RepositoryApiClientIntegrationTest .Net CreateFolder"; + int parentEntryId = 1; + var request = new CreateEntryRequest() + { + EntryType = CreateEntryRequestEntryType.Folder, + Name = newEntryName, + AutoRename = true + }; + + var entry = await client.EntriesClient.CreateEntryAsync(RepositoryId, parentEntryId, request).ConfigureAwait(false); + Assert.IsNotNull(entry); + createdEntries.Add(entry); + Assert.AreEqual(parentEntryId, entry.ParentId); + Assert.AreEqual(EntryType.Folder, entry.EntryType); + Assert.AreEqual(typeof(Folder), entry.GetType()); + } + + [TestMethod] + public async Task CreateCopyEntry_CreateShortcut() + { + // Create new entry + string newEntryName = "RepositoryApiClientIntegrationTest .Net CreateFolder"; + int parentEntryId = 1; + var request = new CreateEntryRequest() + { + EntryType = CreateEntryRequestEntryType.Folder, + Name = newEntryName, + AutoRename = true + }; + var targetEntry = await client.EntriesClient.CreateEntryAsync(RepositoryId, parentEntryId, request).ConfigureAwait(false); + Assert.IsNotNull(targetEntry); + createdEntries.Add(targetEntry); + Assert.AreEqual(parentEntryId, targetEntry.ParentId); + Assert.AreEqual(EntryType.Folder, targetEntry.EntryType); + + // Create shortcut to the new entry + newEntryName = "RepositoryApiClientIntegrationTest .Net CreateShortcut"; + request = new CreateEntryRequest() + { + EntryType = CreateEntryRequestEntryType.Shortcut, + Name = newEntryName, + TargetId = targetEntry.Id, + AutoRename = true + }; + var shortcut = await client.EntriesClient.CreateEntryAsync(RepositoryId, parentEntryId, request).ConfigureAwait(false); + Assert.IsNotNull(shortcut); + createdEntries.Add(shortcut); + Assert.AreEqual(parentEntryId, shortcut.ParentId); + Assert.AreEqual(EntryType.Shortcut, shortcut.EntryType); + Assert.AreEqual(typeof(Shortcut), shortcut.GetType()); + Assert.AreEqual(targetEntry.EntryType, ((Shortcut)shortcut).TargetType); + Assert.AreEqual(targetEntry.Id, ((Shortcut)shortcut).TargetId); + } + } +} From 0e02da4f926543154e35f72047400bc3500ee0df Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 17:22:39 -0400 Subject: [PATCH 35/93] Update entry deletion related tests --- .../{DeleteEntryTest.cs => StartDeleteEntryTest.cs} | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) rename tests/integration/Entries/{DeleteEntryTest.cs => StartDeleteEntryTest.cs} (60%) diff --git a/tests/integration/Entries/DeleteEntryTest.cs b/tests/integration/Entries/StartDeleteEntryTest.cs similarity index 60% rename from tests/integration/Entries/DeleteEntryTest.cs rename to tests/integration/Entries/StartDeleteEntryTest.cs index 54782a02..8859da39 100644 --- a/tests/integration/Entries/DeleteEntryTest.cs +++ b/tests/integration/Entries/StartDeleteEntryTest.cs @@ -4,7 +4,7 @@ namespace Laserfiche.Repository.Api.Client.IntegrationTest.Entries { [TestClass] - public class DeleteEntryTest : BaseTest + public class StartDeleteEntryTest : BaseTest { [TestInitialize] public void Initialize() @@ -16,10 +16,9 @@ public void Initialize() public async Task DeleteEntry_ReturnOperationToken() { var deleteEntry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net DeleteFolder").ConfigureAwait(false); - DeleteEntryWithAuditReason body = new DeleteEntryWithAuditReason(); - var result = await client.EntriesClient.DeleteEntryInfoAsync(RepositoryId, deleteEntry.Id, body).ConfigureAwait(false); - var token = result.Token; - Assert.IsTrue(!string.IsNullOrEmpty(token)); + StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + var response = await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, deleteEntry.Id, body).ConfigureAwait(false); + Assert.IsTrue(!string.IsNullOrEmpty(response.TaskId)); } } } From c1682fccdc9d51b6e382bcfce856b0a033e4eee9 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 17:23:14 -0400 Subject: [PATCH 36/93] Rename since the API name has changed --- .../Entries/{CopyEntryTest.cs => StartCopyEntryTest.cs} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename tests/integration/Entries/{CopyEntryTest.cs => StartCopyEntryTest.cs} (99%) diff --git a/tests/integration/Entries/CopyEntryTest.cs b/tests/integration/Entries/StartCopyEntryTest.cs similarity index 99% rename from tests/integration/Entries/CopyEntryTest.cs rename to tests/integration/Entries/StartCopyEntryTest.cs index 0e801e35..8a85d08c 100644 --- a/tests/integration/Entries/CopyEntryTest.cs +++ b/tests/integration/Entries/StartCopyEntryTest.cs @@ -7,7 +7,7 @@ namespace Laserfiche.Repository.Api.Client.IntegrationTest.Entries { [TestClass] - public class CopyEntryTest : BaseTest + public class StartCopyEntryTest : BaseTest { IList createdEntries; From 8fe580b4a858cdf77646b6c1a4a6d452b9b132dc Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 17:25:23 -0400 Subject: [PATCH 37/93] Remove the tests since the API is gone --- .../Entries/GetDocumentContentTypeTest.cs | 67 ------------------- 1 file changed, 67 deletions(-) delete mode 100644 tests/integration/Entries/GetDocumentContentTypeTest.cs diff --git a/tests/integration/Entries/GetDocumentContentTypeTest.cs b/tests/integration/Entries/GetDocumentContentTypeTest.cs deleted file mode 100644 index cdb043a7..00000000 --- a/tests/integration/Entries/GetDocumentContentTypeTest.cs +++ /dev/null @@ -1,67 +0,0 @@ -using Laserfiche.Api.Client; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Net; -using System.Threading.Tasks; - -namespace Laserfiche.Repository.Api.Client.IntegrationTest.Entries -{ - [TestClass] - public class GetDocumentContentTypeTest : BaseTest - { - int createdEntryId; - - [TestInitialize] - public void Initialize() - { - client = CreateClient(); - createdEntryId = 0; - } - - [TestCleanup] - public async Task Cleanup() - { - if (createdEntryId != 0) - { - DeleteEntryWithAuditReason body = new DeleteEntryWithAuditReason(); - await client.EntriesClient.DeleteEntryInfoAsync(RepositoryId, createdEntryId, body).ConfigureAwait(false); - } - } - - [TestMethod] - public async Task GetDocumentContentTypeAsync_ReturnHeaders() - { - createdEntryId = await CreateDocument("RepositoryApiClientIntegrationTest .Net GetDocumentContentTypeAsync").ConfigureAwait(false); - - var response = await client.EntriesClient.GetDocumentContentTypeAsync(RepositoryId, createdEntryId).ConfigureAwait(false); - - Assert.AreEqual(200, response.StatusCode); - Assert.IsTrue(response.Headers.ContainsKey("Content-Type")); - Assert.IsTrue(response.Headers.ContainsKey("Content-Length")); - } - - [TestMethod] - public async Task GetDocumentContentTypeAsync_ThrowException() - { - int entryId = 1; - string repositoryId = "fakeRepository"; - try - { - await client.EntriesClient.GetDocumentContentTypeAsync(repositoryId, entryId).ConfigureAwait(false); - } - catch (ApiException e) - { - Assert.IsNotNull(e?.ProblemDetails?.Title); - Assert.AreEqual(e.ProblemDetails.Title, e.Message); - Assert.AreEqual((int)HttpStatusCode.NotFound, e.StatusCode); - Assert.AreEqual((int)HttpStatusCode.NotFound, e.ProblemDetails.Status); - Assert.IsNotNull(e.ProblemDetails.OperationId); - Assert.IsNull(e.ProblemDetails.Type); - Assert.IsNull(e.ProblemDetails.Instance); - Assert.IsNull(e.ProblemDetails.ErrorSource); - Assert.AreEqual(default, e.ProblemDetails.ErrorCode); - Assert.IsNull(e.ProblemDetails.TraceId); - Assert.AreEqual(0, e.ProblemDetails.Extensions.Count); - } - } - } -} From 5780107488cc4c2aa2966ea53db68b636bacdfcb Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Tue, 12 Sep 2023 17:28:04 -0400 Subject: [PATCH 38/93] Update tests related to template definition listing API --- .../Entries/GetDynamicFieldsTest.cs | 32 ------------------- .../Entries/ListTemplateDefinitionsTest.cs | 30 +++++++++++++++++ 2 files changed, 30 insertions(+), 32 deletions(-) delete mode 100644 tests/integration/Entries/GetDynamicFieldsTest.cs create mode 100644 tests/integration/Entries/ListTemplateDefinitionsTest.cs diff --git a/tests/integration/Entries/GetDynamicFieldsTest.cs b/tests/integration/Entries/GetDynamicFieldsTest.cs deleted file mode 100644 index 15114023..00000000 --- a/tests/integration/Entries/GetDynamicFieldsTest.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Linq; -using System.Threading.Tasks; - -namespace Laserfiche.Repository.Api.Client.IntegrationTest.Entries -{ - [TestClass] - public class GetDynamicFieldsTest : BaseTest - { - [TestInitialize] - public void Initialize() - { - client = CreateClient(); - } - - [TestMethod] - public async Task GetDynamicFields_ReturnDynamicFields() - { - // Get a template definition id - var templateDefinitionResult = await client.TemplateDefinitionsClient.GetTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); - var templateDefinitions = templateDefinitionResult.Value; - Assert.IsNotNull(templateDefinitions); - Assert.IsTrue(templateDefinitions.Count > 0, "No template definitions exist in the repository."); - - int entryId = 1; - var request = new GetDynamicFieldLogicValueRequest() { TemplateId = templateDefinitions.First().Id }; - var result = await client.EntriesClient.GetDynamicFieldValuesAsync(RepositoryId, entryId, request).ConfigureAwait(false); - - Assert.IsNotNull(result); - } - } -} diff --git a/tests/integration/Entries/ListTemplateDefinitionsTest.cs b/tests/integration/Entries/ListTemplateDefinitionsTest.cs new file mode 100644 index 00000000..20208790 --- /dev/null +++ b/tests/integration/Entries/ListTemplateDefinitionsTest.cs @@ -0,0 +1,30 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Linq; +using System.Threading.Tasks; + +namespace Laserfiche.Repository.Api.Client.IntegrationTest.Entries +{ + [TestClass] + public class ListTemplateDefinitionsTest : BaseTest + { + [TestInitialize] + public void Initialize() + { + client = CreateClient(); + } + + [TestMethod] + public async Task GetDynamicFields_ReturnDynamicFields() + { + // Get a template definition id + var collectionResponse = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); + AssertCollectionResponse(collectionResponse); + + int entryId = 1; + var request = new ListDynamicFieldValuesRequest() { TemplateId = collectionResponse.Value.First().Id }; + var result = await client.EntriesClient.ListDynamicFieldValuesAsync(RepositoryId, entryId, request).ConfigureAwait(false); + + Assert.IsNotNull(result); + } + } +} From a2a8b7e085fcc174c03a4982c0b916e777f6e329 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 10:33:40 -0400 Subject: [PATCH 39/93] Delete since the API no longer exists --- tests/integration/Entries/GetEdocTest.cs | 54 ------------------ .../Entries/GetEdocWithAuditReasonTest.cs | 55 ------------------- 2 files changed, 109 deletions(-) delete mode 100644 tests/integration/Entries/GetEdocTest.cs delete mode 100644 tests/integration/Entries/GetEdocWithAuditReasonTest.cs diff --git a/tests/integration/Entries/GetEdocTest.cs b/tests/integration/Entries/GetEdocTest.cs deleted file mode 100644 index 5e422e37..00000000 --- a/tests/integration/Entries/GetEdocTest.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.IO; -using System.Threading.Tasks; - -namespace Laserfiche.Repository.Api.Client.IntegrationTest.Entries -{ - [TestClass] - public class GetEdocTest : BaseTest - { - int createdEntryId; - string fileToWriteTo; - - [TestInitialize] - public void Initialize() - { - client = CreateClient(); - createdEntryId = 0; - fileToWriteTo = ""; - } - - [TestCleanup] - public async Task Cleanup() - { - if (!string.IsNullOrEmpty(fileToWriteTo)) - { - File.Delete(fileToWriteTo); - } - if (createdEntryId != 0) - { - DeleteEntryWithAuditReason body = new DeleteEntryWithAuditReason(); - await client.EntriesClient.DeleteEntryInfoAsync(RepositoryId, createdEntryId, body).ConfigureAwait(false); - } - } - - [TestMethod] - public async Task GetEdoc_ReturnDocument() - { - createdEntryId = await CreateDocument("RepositoryApiClientIntegrationTest .Net GetDocumentContent").ConfigureAwait(false); - - using (var response = await client.EntriesClient.ExportDocumentAsync(RepositoryId, createdEntryId).ConfigureAwait(false)) - { - Assert.AreEqual(200, response.StatusCode); - Assert.IsTrue(response.Headers.ContainsKey("Content-Type")); - Assert.IsNotNull(response.Stream); - - fileToWriteTo = Path.GetTempFileName(); - using (Stream streamToWriteTo = File.Open(fileToWriteTo, FileMode.Create)) - { - await response.Stream.CopyToAsync(streamToWriteTo).ConfigureAwait(false); - } - } - } - } -} diff --git a/tests/integration/Entries/GetEdocWithAuditReasonTest.cs b/tests/integration/Entries/GetEdocWithAuditReasonTest.cs deleted file mode 100644 index eef54476..00000000 --- a/tests/integration/Entries/GetEdocWithAuditReasonTest.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.IO; -using System.Threading.Tasks; - -namespace Laserfiche.Repository.Api.Client.IntegrationTest.Entries -{ - [TestClass] - public class GetEdocWithAuditReasonTest : BaseTest - { - int createdEntryId; - string fileToWriteTo; - - [TestInitialize] - public void Initialize() - { - client = CreateClient(); - createdEntryId = 0; - fileToWriteTo = ""; - } - - [TestCleanup] - public async Task Cleanup() - { - if (!string.IsNullOrEmpty(fileToWriteTo)) - { - File.Delete(fileToWriteTo); - } - if (createdEntryId != 0) - { - DeleteEntryWithAuditReason body = new DeleteEntryWithAuditReason(); - await client.EntriesClient.DeleteEntryInfoAsync(RepositoryId, createdEntryId, body).ConfigureAwait(false); - } - } - - [TestMethod] - public async Task Export_document_with_audit_reasonAsync_ReturnDocument() - { - createdEntryId = await CreateDocument("RepositoryApiClientIntegrationTest .Net GetDocumentContent AuditReason").ConfigureAwait(false); - var request = new GetEdocWithAuditReasonRequest(); - - using (var response = await client.EntriesClient.ExportDocumentWithAuditReasonAsync(RepositoryId, createdEntryId, request).ConfigureAwait(false)) - { - Assert.AreEqual(200, response.StatusCode); - Assert.IsTrue(response.Headers.ContainsKey("Content-Type")); - Assert.IsNotNull(response.Stream); - - fileToWriteTo = Path.GetTempFileName(); - using (Stream streamToWriteTo = File.Open(fileToWriteTo, FileMode.Create)) - { - await response.Stream.CopyToAsync(streamToWriteTo).ConfigureAwait(false); - } - } - } - } -} From 00440afc51936dc5ac6c402ac6ac6bc51cff8175 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 10:39:56 -0400 Subject: [PATCH 40/93] Update list fields related tests --- .../{GetEntryFieldsTest.cs => ListFieldsTest.cs} | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename tests/integration/Entries/{GetEntryFieldsTest.cs => ListFieldsTest.cs} (72%) diff --git a/tests/integration/Entries/GetEntryFieldsTest.cs b/tests/integration/Entries/ListFieldsTest.cs similarity index 72% rename from tests/integration/Entries/GetEntryFieldsTest.cs rename to tests/integration/Entries/ListFieldsTest.cs index 254c4c1c..aab74399 100644 --- a/tests/integration/Entries/GetEntryFieldsTest.cs +++ b/tests/integration/Entries/ListFieldsTest.cs @@ -4,7 +4,7 @@ namespace Laserfiche.Repository.Api.Client.IntegrationTest.Entries { [TestClass] - public class GetEntryFieldsTest : BaseTest + public class ListFieldsTest : BaseTest { [TestInitialize] public void Initialize() @@ -16,7 +16,7 @@ public void Initialize() public async Task GetEntryFields_ReturnFields() { int entryId = 1; - var result = await client.EntriesClient.GetFieldValuesAsync(RepositoryId, entryId).ConfigureAwait(false); + var result = await client.EntriesClient.ListFieldsAsync(RepositoryId, entryId).ConfigureAwait(false); Assert.IsNotNull(result.Value); } @@ -26,7 +26,7 @@ public async Task GetEntryFields_ForEachPaging() int entryId = 1; int maxPageSize = 10; - Task PagingCallback(ODataValueContextOfIListOfFieldValue data) + Task PagingCallback(FieldCollectionResponse data) { if (data.OdataNextLink != null) { @@ -40,7 +40,7 @@ Task PagingCallback(ODataValueContextOfIListOfFieldValue data) } } - await client.EntriesClient.GetFieldValuesForEachAsync(PagingCallback, RepositoryId, entryId, maxPageSize: maxPageSize).ConfigureAwait(false); + await client.EntriesClient.ListFieldsForEachAsync(PagingCallback, RepositoryId, entryId, maxPageSize: maxPageSize).ConfigureAwait(false); await Task.Delay(5000).ConfigureAwait(false); } @@ -51,7 +51,7 @@ public async Task GetEntryFields_SimplePaging() int maxPageSize = 1; // Initial request - var result = await client.EntriesClient.GetFieldValuesAsync(RepositoryId, entryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); + var result = await client.EntriesClient.ListFieldsAsync(RepositoryId, entryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); Assert.IsNotNull(result); if (result.Value.Count == 0) @@ -64,7 +64,7 @@ public async Task GetEntryFields_SimplePaging() Assert.IsTrue(result.Value.Count <= maxPageSize); // Paging request - result = await client.EntriesClient.GetFieldValuesNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); + result = await client.EntriesClient.ListFieldsNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); Assert.IsNotNull(result); Assert.IsTrue(result.Value.Count <= maxPageSize); } From fbd079794d1e676b6ef6b46a83f2453678cdcadd Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 10:45:31 -0400 Subject: [PATCH 41/93] Update list link related tests --- .../{GetEntryLinksTest.cs => ListLinksTest.cs} | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename tests/integration/Entries/{GetEntryLinksTest.cs => ListLinksTest.cs} (71%) diff --git a/tests/integration/Entries/GetEntryLinksTest.cs b/tests/integration/Entries/ListLinksTest.cs similarity index 71% rename from tests/integration/Entries/GetEntryLinksTest.cs rename to tests/integration/Entries/ListLinksTest.cs index d42905f6..41ee92d2 100644 --- a/tests/integration/Entries/GetEntryLinksTest.cs +++ b/tests/integration/Entries/ListLinksTest.cs @@ -4,7 +4,7 @@ namespace Laserfiche.Repository.Api.Client.IntegrationTest.Entries { [TestClass] - public class GetEntryLinksTest : BaseTest + public class ListLinksTest : BaseTest { [TestInitialize] public void Initialize() @@ -16,7 +16,7 @@ public void Initialize() public async Task GetEntryLinks_ReturnLinks() { int entryId = 1; - var result = await client.EntriesClient.GetLinkValuesFromEntryAsync(RepositoryId, entryId).ConfigureAwait(false); + var result = await client.EntriesClient.ListLinksAsync(RepositoryId, entryId).ConfigureAwait(false); Assert.IsNotNull(result.Value); } @@ -26,7 +26,7 @@ public async Task GetEntryLinks_ForEachPaging() int entryId = 1; int maxPageSize = 10; - Task PagingCallback(ODataValueContextOfIListOfWEntryLinkInfo data) + Task PagingCallback(LinkCollectionResponse data) { if (data.OdataNextLink != null) { @@ -40,7 +40,7 @@ Task PagingCallback(ODataValueContextOfIListOfWEntryLinkInfo data) } } - await client.EntriesClient.GetLinkValuesFromEntryForEachAsync(PagingCallback, RepositoryId, entryId, maxPageSize: maxPageSize).ConfigureAwait(false); + await client.EntriesClient.ListLinksForEachAsync(PagingCallback, RepositoryId, entryId, maxPageSize: maxPageSize).ConfigureAwait(false); await Task.Delay(5000).ConfigureAwait(false); } @@ -51,7 +51,7 @@ public async Task GetEntryLinks_SimplePaging() int maxPageSize = 1; // Initial request - var response = await client.EntriesClient.GetLinkValuesFromEntryAsync(RepositoryId, entryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); + var response = await client.EntriesClient.ListLinksAsync(RepositoryId, entryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); Assert.IsNotNull(response); if (response.Value.Count == 0) @@ -64,7 +64,7 @@ public async Task GetEntryLinks_SimplePaging() Assert.IsTrue(response.Value.Count <= maxPageSize); // Paging request - response = await client.EntriesClient.GetLinkValuesFromEntryNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); + response = await client.EntriesClient.ListLinksNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); Assert.IsNotNull(response); Assert.IsTrue(response.Value.Count <= maxPageSize); } From 48a72aaa61c2a8e4f46ea27d07c0ba36a221af46 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 10:48:52 -0400 Subject: [PATCH 42/93] Update list entries related tests --- ...tEntryListingTest.cs => ListEntriesTest.cs} | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) rename tests/integration/Entries/{GetEntryListingTest.cs => ListEntriesTest.cs} (67%) diff --git a/tests/integration/Entries/GetEntryListingTest.cs b/tests/integration/Entries/ListEntriesTest.cs similarity index 67% rename from tests/integration/Entries/GetEntryListingTest.cs rename to tests/integration/Entries/ListEntriesTest.cs index b343b295..949d3f9a 100644 --- a/tests/integration/Entries/GetEntryListingTest.cs +++ b/tests/integration/Entries/ListEntriesTest.cs @@ -4,7 +4,7 @@ namespace Laserfiche.Repository.Api.Client.IntegrationTest.Entries { [TestClass] - public class GetEntryListingTest : BaseTest + public class ListEntriesTest : BaseTest { [TestInitialize] public void Initialize() @@ -13,10 +13,10 @@ public void Initialize() } [TestMethod] - public async Task GetEntryListing_ReturnEntries() + public async Task ListEntries_ReturnEntries() { int entryId = 1; - var result = await client.EntriesClient.GetEntryListingAsync(RepositoryId, entryId).ConfigureAwait(false); + var result = await client.EntriesClient.ListEntriesAsync(RepositoryId, entryId).ConfigureAwait(false); var entries = result.Value; Assert.IsNotNull(entries); foreach (var entry in entries) @@ -26,12 +26,12 @@ public async Task GetEntryListing_ReturnEntries() } [TestMethod] - public async Task GetEntryListing_ForEachPaging() + public async Task ListEntries_ForEachPaging() { int entryId = 1; int maxPageSize = 10; - Task PagingCallback(ODataValueContextOfIListOfEntry data) + Task PagingCallback(EntryCollectionResponse data) { if (data.OdataNextLink != null) { @@ -45,18 +45,18 @@ Task PagingCallback(ODataValueContextOfIListOfEntry data) } } - await client.EntriesClient.GetEntryListingForEachAsync(PagingCallback, RepositoryId, entryId, maxPageSize: maxPageSize).ConfigureAwait(false); + await client.EntriesClient.ListEntriesForEachAsync(PagingCallback, RepositoryId, entryId, maxPageSize: maxPageSize).ConfigureAwait(false); await Task.Delay(5000).ConfigureAwait(false); } [TestMethod] - public async Task GetEntryListing_SimplePaging() + public async Task ListEntries_SimplePaging() { int entryId = 1; int maxPageSize = 1; // Initial request - var result = await client.EntriesClient.GetEntryListingAsync(RepositoryId, entryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); + var result = await client.EntriesClient.ListEntriesAsync(RepositoryId, entryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); Assert.IsNotNull(result); if (result.Value.Count == 0) @@ -69,7 +69,7 @@ public async Task GetEntryListing_SimplePaging() Assert.IsTrue(result.Value.Count <= maxPageSize); // Paging request - result = await client.EntriesClient.GetEntryListingNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); + result = await client.EntriesClient.ListEntriesNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); Assert.IsNotNull(result); Assert.IsTrue(result.Value.Count <= maxPageSize); } From 97f3a7618fe4d313663d59932815aadaac08025f Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 10:52:23 -0400 Subject: [PATCH 43/93] Update list tag related tests --- .../Entries/{GetEntryTagsTest.cs => ListTagsTest.cs} | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename tests/integration/Entries/{GetEntryTagsTest.cs => ListTagsTest.cs} (71%) diff --git a/tests/integration/Entries/GetEntryTagsTest.cs b/tests/integration/Entries/ListTagsTest.cs similarity index 71% rename from tests/integration/Entries/GetEntryTagsTest.cs rename to tests/integration/Entries/ListTagsTest.cs index e7a6417a..71ca6622 100644 --- a/tests/integration/Entries/GetEntryTagsTest.cs +++ b/tests/integration/Entries/ListTagsTest.cs @@ -4,7 +4,7 @@ namespace Laserfiche.Repository.Api.Client.IntegrationTest.Entries { [TestClass] - public class GetEntryTagsTest : BaseTest + public class ListTagsTest : BaseTest { [TestInitialize] public void Initialize() @@ -16,7 +16,7 @@ public void Initialize() public async Task GetEntryTags_ReturnTags() { int entryId = 1; - var result = await client.EntriesClient.GetTagsAssignedToEntryAsync(RepositoryId, entryId).ConfigureAwait(false); + var result = await client.EntriesClient.ListTagsAsync(RepositoryId, entryId).ConfigureAwait(false); Assert.IsNotNull(result.Value); } @@ -26,7 +26,7 @@ public async Task GetEntryTags_ForEachPaging() int entryId = 1; int maxPageSize = 10; - Task PagingCallback(ODataValueContextOfIListOfWTagInfo data) + Task PagingCallback(TagCollectionResponse data) { if (data.OdataNextLink != null) { @@ -40,7 +40,7 @@ Task PagingCallback(ODataValueContextOfIListOfWTagInfo data) } } - await client.EntriesClient.GetTagsAssignedToEntryForEachAsync(PagingCallback, RepositoryId, entryId, maxPageSize: maxPageSize).ConfigureAwait(false); + await client.EntriesClient.ListTagsForEachAsync(PagingCallback, RepositoryId, entryId, maxPageSize: maxPageSize).ConfigureAwait(false); await Task.Delay(5000).ConfigureAwait(false); } @@ -51,7 +51,7 @@ public async Task GetEntryTags_SimplePaging() int maxPageSize = 1; // Initial request - var result = await client.EntriesClient.GetTagsAssignedToEntryAsync(RepositoryId, entryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); + var result = await client.EntriesClient.ListTagsAsync(RepositoryId, entryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); Assert.IsNotNull(result); if (result.Value.Count == 0) @@ -64,7 +64,7 @@ public async Task GetEntryTags_SimplePaging() Assert.IsTrue(result.Value.Count <= maxPageSize); // Paging request - result = await client.EntriesClient.GetTagsAssignedToEntryNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); + result = await client.EntriesClient.ListTagsNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); Assert.IsNotNull(result); Assert.IsTrue(result.Value.Count <= maxPageSize); } From 809ffe148e57c01418cb57927f0a1456d6894233 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 10:58:13 -0400 Subject: [PATCH 44/93] Update tests for set template API --- tests/integration/Entries/SetTemplateTest.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/integration/Entries/SetTemplateTest.cs b/tests/integration/Entries/SetTemplateTest.cs index c177db23..97214de2 100644 --- a/tests/integration/Entries/SetTemplateTest.cs +++ b/tests/integration/Entries/SetTemplateTest.cs @@ -21,8 +21,8 @@ public async Task Cleanup() { if (entry != null) { - DeleteEntryWithAuditReason body = new DeleteEntryWithAuditReason(); - await client.EntriesClient.DeleteEntryInfoAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); + StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); } } @@ -30,14 +30,14 @@ public async Task Cleanup() public async Task SetTemplate_ReturnEntryWithTemplate() { // Find a template definition with no required fields - WTemplateInfo template = null; - var templateDefinitionResult = await client.TemplateDefinitionsClient.GetTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); + TemplateDefinition template = null; + var templateDefinitionResult = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); var templateDefinitions = templateDefinitionResult.Value; Assert.IsNotNull(templateDefinitions); Assert.IsTrue(templateDefinitions.Count > 0, "No template definitions exist in the repository."); foreach (var templateDefinition in templateDefinitions) { - var templateDefinitionFields = await client.TemplateDefinitionsClient.GetTemplateFieldDefinitionsAsync(RepositoryId, templateDefinition.Id).ConfigureAwait(false); + var templateDefinitionFields = await client.TemplateDefinitionsClient.ListTemplateFieldDefinitionsByTemplateIdAsync(RepositoryId, templateDefinition.Id).ConfigureAwait(false); if (templateDefinitionFields.Value != null && templateDefinitionFields.Value.All(f => !f.IsRequired)) { template = templateDefinition; @@ -47,12 +47,12 @@ public async Task SetTemplate_ReturnEntryWithTemplate() Assert.IsNotNull(template, "Could not find a good template definition to assign to the entry"); // Set the template on an entry - var request = new PutTemplateRequest() + var request = new SetTemplateRequest() { TemplateName = template.Name }; entry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net DeleteTemplate").ConfigureAwait(false); - var setTemplateResult = await client.EntriesClient.WriteTemplateValueToEntryAsync(RepositoryId, entry.Id, request).ConfigureAwait(false); + var setTemplateResult = await client.EntriesClient.SetTemplateAsync(RepositoryId, entry.Id, request).ConfigureAwait(false); Assert.IsNotNull(setTemplateResult); Assert.AreEqual(template.Name, setTemplateResult.TemplateName); } From b7191b3c43d90ebbbc55b2e0fc9e3fd5c666fdda Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 11:00:28 -0400 Subject: [PATCH 45/93] Update set tags related tests --- tests/integration/Entries/SetTagsTest.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/integration/Entries/SetTagsTest.cs b/tests/integration/Entries/SetTagsTest.cs index de8392db..4fb1e665 100644 --- a/tests/integration/Entries/SetTagsTest.cs +++ b/tests/integration/Entries/SetTagsTest.cs @@ -22,26 +22,26 @@ public async Task Cleanup() { if (entry != null) { - DeleteEntryWithAuditReason body = new DeleteEntryWithAuditReason(); - await client.EntriesClient.DeleteEntryInfoAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); + StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); } } [TestMethod] public async Task SetTags_ReturnTags() { - var tagDefinitionsResult = await client.TagDefinitionsClient.GetTagDefinitionsAsync(RepositoryId).ConfigureAwait(false); + var tagDefinitionsResult = await client.TagDefinitionsClient.ListTagDefinitionsAsync(RepositoryId).ConfigureAwait(false); var tagDefinitions = tagDefinitionsResult.Value; Assert.IsNotNull(tagDefinitions); Assert.IsTrue(tagDefinitions.Count > 0, "No tag definitions exist in the repository."); string tag = tagDefinitions.First().Name; - var request = new PutTagRequest() + var request = new SetTagsRequest() { Tags = new List() { tag } }; entry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net SetTags").ConfigureAwait(false); - var result = await client.EntriesClient.AssignTagsAsync(RepositoryId, entry.Id, request).ConfigureAwait(false); + var result = await client.EntriesClient.SetTagsAsync(RepositoryId, entry.Id, request).ConfigureAwait(false); var tags = result.Value; Assert.IsNotNull(tags); Assert.AreEqual(request.Tags.Count, tags.Count); From 554417bc876090ac34facd736e0294113995e652 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 11:05:10 -0400 Subject: [PATCH 46/93] Update set links related tests --- tests/integration/Entries/SetLinksTest.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/integration/Entries/SetLinksTest.cs b/tests/integration/Entries/SetLinksTest.cs index 20a78c12..db3f3dbd 100644 --- a/tests/integration/Entries/SetLinksTest.cs +++ b/tests/integration/Entries/SetLinksTest.cs @@ -24,8 +24,8 @@ public async Task Cleanup() { if (entry != null) { - DeleteEntryWithAuditReason body = new DeleteEntryWithAuditReason(); - await client.EntriesClient.DeleteEntryInfoAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); + StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); } } } @@ -37,20 +37,22 @@ public async Task SetLinks_ReturnLinks() createdEntries.Add(sourceEntry); var targetEntry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net SetLinks Target").ConfigureAwait(false); createdEntries.Add(targetEntry); - var request = new List() + var request = new SetLinksRequest() { - new PutLinksRequest() + Links = new List { - TargetId = targetEntry.Id, - LinkTypeId = 1 + new LinkToUpdate + { + LinkDefinitionId = targetEntry.Id, + } } }; - var result = await client.EntriesClient.AssignEntryLinksAsync(RepositoryId, sourceEntry.Id, request).ConfigureAwait(false); + var result = await client.EntriesClient.SetLinksAsync(RepositoryId, sourceEntry.Id, request).ConfigureAwait(false); var links = result.Value; Assert.IsNotNull(links); - Assert.AreEqual(request.Count, links.Count); + Assert.AreEqual(request.Links.Count, links.Count); Assert.AreEqual(sourceEntry.Id, links.FirstOrDefault()?.SourceId); Assert.AreEqual(targetEntry.Id, links.FirstOrDefault()?.TargetId); } From b690ab122b4f6d3e1cd558f20bbd3440b09d1cae Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 11:20:40 -0400 Subject: [PATCH 47/93] Update tests related to set fields --- tests/integration/Entries/SetFieldsTest.cs | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tests/integration/Entries/SetFieldsTest.cs b/tests/integration/Entries/SetFieldsTest.cs index 6191c501..a1fe5e12 100644 --- a/tests/integration/Entries/SetFieldsTest.cs +++ b/tests/integration/Entries/SetFieldsTest.cs @@ -22,8 +22,8 @@ public async Task Cleanup() { if (entry != null) { - DeleteEntryWithAuditReason body = new DeleteEntryWithAuditReason(); - await client.EntriesClient.DeleteEntryInfoAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); + StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); } } @@ -31,14 +31,14 @@ public async Task Cleanup() public async Task SetFields_ReturnFields() { // Find a string field - WFieldInfo field = null; + FieldDefinition field = null; string fieldValue = "a"; - var fieldDefinitionsResult = await client.FieldDefinitionsClient.GetFieldDefinitionsAsync(RepositoryId).ConfigureAwait(false); + var fieldDefinitionsResult = await client.FieldDefinitionsClient.ListFieldDefinitionsAsync(RepositoryId).ConfigureAwait(false); var fieldDefinitions = fieldDefinitionsResult.Value; Assert.IsNotNull(fieldDefinitions); foreach(var fieldDefinition in fieldDefinitions) { - if (fieldDefinition.FieldType == WFieldType.String && string.IsNullOrEmpty(fieldDefinition.Constraint) && fieldDefinition.Length >= 1) + if (fieldDefinition.FieldType == FieldType.String && string.IsNullOrEmpty(fieldDefinition.Constraint) && fieldDefinition.Length >= 1) { field = fieldDefinition; break; @@ -46,24 +46,23 @@ public async Task SetFields_ReturnFields() } Assert.IsNotNull(field, "Could not find a string field to set."); - var requestBody = new Dictionary() + var request = new SetFieldsRequest() { - [field.Name] = new FieldToUpdate() + Fields = new List { - Values = new List() + new FieldToUpdate() { - new ValueToUpdate() { Value = fieldValue, Position = 1 } + Values = new List { fieldValue } } } }; entry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net SetFields").ConfigureAwait(false); - var result = await client.EntriesClient.AssignFieldValuesAsync(RepositoryId, entry.Id, requestBody).ConfigureAwait(false); + var result = await client.EntriesClient.SetFieldsAsync(RepositoryId, entry.Id, request).ConfigureAwait(false); var fields = result.Value; Assert.IsNotNull(fields); Assert.AreEqual(1, fields.Count); - Assert.AreEqual(field.Name, fields.FirstOrDefault()?.FieldName); - Assert.AreEqual(fieldValue, fields.FirstOrDefault()?.Values.FirstOrDefault()["value"]); + Assert.AreEqual(field.Name, fields.FirstOrDefault()?.Name); } } } From 56342b9f9c091bcb249b5034e00a435b6b3d890c Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 11:27:16 -0400 Subject: [PATCH 48/93] Update tests related to template removal API --- ...eFromEntryTest.cs => RemoveTemplateTest.cs} | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) rename tests/integration/Entries/{RemoveTemplateFromEntryTest.cs => RemoveTemplateTest.cs} (76%) diff --git a/tests/integration/Entries/RemoveTemplateFromEntryTest.cs b/tests/integration/Entries/RemoveTemplateTest.cs similarity index 76% rename from tests/integration/Entries/RemoveTemplateFromEntryTest.cs rename to tests/integration/Entries/RemoveTemplateTest.cs index 39ec9041..49165c59 100644 --- a/tests/integration/Entries/RemoveTemplateFromEntryTest.cs +++ b/tests/integration/Entries/RemoveTemplateTest.cs @@ -5,7 +5,7 @@ namespace Laserfiche.Repository.Api.Client.IntegrationTest.Entries { [TestClass] - public class RemoveTemplateFromEntryTest : BaseTest + public class RemoveTemplateTest : BaseTest { Entry entry; @@ -21,8 +21,8 @@ public async Task Cleanup() { if (entry != null) { - DeleteEntryWithAuditReason body = new DeleteEntryWithAuditReason(); - await client.EntriesClient.DeleteEntryInfoAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); + StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); } } @@ -30,14 +30,14 @@ public async Task Cleanup() public async Task RemoveTemplateFromEntry_ReturnEntry() { // Find a template definition with no required fields - WTemplateInfo template = null; - var templateDefinitionResult = await client.TemplateDefinitionsClient.GetTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); + TemplateDefinition template = null; + var templateDefinitionResult = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); var templateDefinitions = templateDefinitionResult.Value; Assert.IsNotNull(templateDefinitions); Assert.IsTrue(templateDefinitions.Count > 0, "No template definitions exist in the repository."); foreach (var templateDefinition in templateDefinitions) { - var templateDefinitionFieldsResult = await client.TemplateDefinitionsClient.GetTemplateFieldDefinitionsAsync(RepositoryId, templateDefinition.Id).ConfigureAwait(false); + var templateDefinitionFieldsResult = await client.TemplateDefinitionsClient.ListTemplateFieldDefinitionsByTemplateIdAsync(RepositoryId, templateDefinition.Id).ConfigureAwait(false); if (templateDefinitionFieldsResult.Value != null && templateDefinitionFieldsResult.Value.All(f => !f.IsRequired)) { template = templateDefinition; @@ -47,17 +47,17 @@ public async Task RemoveTemplateFromEntry_ReturnEntry() Assert.IsNotNull(template, "Could not find a good template definition to assign to the entry"); // Set the template on an entry - var request = new PutTemplateRequest() + var request = new SetTemplateRequest() { TemplateName = template.Name }; entry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net RemoveTemplateFromEntry").ConfigureAwait(false); - var setTemplateEntryResult = await client.EntriesClient.WriteTemplateValueToEntryAsync(RepositoryId, entry.Id, request).ConfigureAwait(false); + var setTemplateEntryResult = await client.EntriesClient.SetTemplateAsync(RepositoryId, entry.Id, request).ConfigureAwait(false); Assert.IsNotNull(setTemplateEntryResult); Assert.AreEqual(template.Name, setTemplateEntryResult.TemplateName); // Delete the template on the entry - var deleteTemplateResponse = await client.EntriesClient.DeleteAssignedTemplateAsync(RepositoryId, entry.Id).ConfigureAwait(false); + var deleteTemplateResponse = await client.EntriesClient.RemoveTemplateAsync(RepositoryId, entry.Id).ConfigureAwait(false); var returnedEntry = deleteTemplateResponse; Assert.IsNotNull(returnedEntry); Assert.AreEqual(entry.Id, returnedEntry.Id); From 27b97260e2aaed54c5cdf34e5c63effc8293a241 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 11:28:23 -0400 Subject: [PATCH 49/93] Update entry update API tests --- .../Entries/{MoveEntryTest.cs => UpdateEntryTest.cs} | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename tests/integration/Entries/{MoveEntryTest.cs => UpdateEntryTest.cs} (77%) diff --git a/tests/integration/Entries/MoveEntryTest.cs b/tests/integration/Entries/UpdateEntryTest.cs similarity index 77% rename from tests/integration/Entries/MoveEntryTest.cs rename to tests/integration/Entries/UpdateEntryTest.cs index a3034429..cb713eee 100644 --- a/tests/integration/Entries/MoveEntryTest.cs +++ b/tests/integration/Entries/UpdateEntryTest.cs @@ -5,7 +5,7 @@ namespace Laserfiche.Repository.Api.Client.IntegrationTest.Entries { [TestClass] - public class MoveEntryTest : BaseTest + public class UpdateEntryTest : BaseTest { IList createdEntries; @@ -23,8 +23,8 @@ public async Task Cleanup() { if (entry != null) { - DeleteEntryWithAuditReason body = new DeleteEntryWithAuditReason(); - await client.EntriesClient.DeleteEntryInfoAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); + StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); } } } @@ -36,13 +36,13 @@ public async Task MoveAndRenameEntry_ReturnEntry() createdEntries.Add(parentFolder); var childFolder = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net ChildFolder").ConfigureAwait(false); createdEntries.Add(childFolder); - var request = new PatchEntryRequest() + var request = new UpdateEntryRequest() { ParentId = parentFolder.Id, Name = "RepositoryApiClientIntegrationTest .Net MovedFolder" }; - var movedEntry = await client.EntriesClient.MoveOrRenameEntryAsync(RepositoryId, childFolder.Id, request, autoRename: true).ConfigureAwait(false); + var movedEntry = await client.EntriesClient.UpdateEntryAsync(RepositoryId, childFolder.Id, request, autoRename: true).ConfigureAwait(false); Assert.IsNotNull(movedEntry); Assert.AreEqual(childFolder.Id, movedEntry.Id); From b47b24bbe716fc6ae307f99f651462917e1d4ddd Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 11:54:01 -0400 Subject: [PATCH 50/93] Update tests related to import entry --- tests/integration/Entries/ImportEntryTest.cs | 133 +++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 tests/integration/Entries/ImportEntryTest.cs diff --git a/tests/integration/Entries/ImportEntryTest.cs b/tests/integration/Entries/ImportEntryTest.cs new file mode 100644 index 00000000..0a0f9e7f --- /dev/null +++ b/tests/integration/Entries/ImportEntryTest.cs @@ -0,0 +1,133 @@ +using Laserfiche.Api.Client; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.IO; +using System.Linq; +using System.Net; +using System.Threading.Tasks; + +namespace Laserfiche.Repository.Api.Client.IntegrationTest.Entries +{ + [TestClass] + public class ImportEntryTest : BaseTest + { + int createdEntryId; + Stream fileStream; + + [TestInitialize] + public void Initialize() + { + client = CreateClient(); + createdEntryId = 0; + fileStream = null; + } + + [TestCleanup] + public async Task Cleanup() + { + fileStream?.Dispose(); + if (createdEntryId != 0) + { + StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, createdEntryId, body).ConfigureAwait(false); + } + } + + private FileParameter GetFileParameter() + { + string fileLocation = TempPath + "test.pdf"; + fileStream = File.OpenRead(fileLocation); + return new FileParameter(fileStream, "test", "application/pdf"); + } + + [TestMethod] + public async Task ImportEntry_DocumentCreated() + { + int parentEntryId = 1; + string fileName = "RepositoryApiClientIntegrationTest .Net ImportDocument"; + var electronicDocument = GetFileParameter(); + var request = new ImportEntryRequest() + { + AutoRename = true + }; + + var importedEntry = await client.EntriesClient.ImportEntryAsync(RepositoryId, parentEntryId, fileName, file: electronicDocument, request: request).ConfigureAwait(false); + + Assert.IsNotNull(importedEntry); + } + + [TestMethod] + public async Task ImportEntry_DocumentCreatedWithTemplate() + { + // Find a template definition with no required fields + TemplateDefinition template = null; + var templateDefinitionResult = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); + var templateDefinitions = templateDefinitionResult.Value; + Assert.IsNotNull(templateDefinitions); + Assert.IsTrue(templateDefinitions.Count > 0, "No template definitions exist in the repository."); + foreach (var templateDefinition in templateDefinitions) + { + var templateDefinitionFieldsResult = await client.TemplateDefinitionsClient.ListTemplateFieldDefinitionsByTemplateIdAsync(RepositoryId, templateDefinition.Id).ConfigureAwait(false); + if (templateDefinitionFieldsResult.Value != null && templateDefinitionFieldsResult.Value.All(f => !f.IsRequired)) + { + template = templateDefinition; + break; + } + } + Assert.IsNotNull(template, "Could not find a good template definition to assign to the entry"); + + int parentEntryId = 1; + string fileName = "RepositoryApiClientIntegrationTest .Net ImportDocument"; + var electronicDocument = GetFileParameter(); + var request = new ImportEntryRequest() + { + AutoRename = true, + Metadata = new ImportEntryRequestMetadata() + { + TemplateName = template.Name + } + }; + + var importedEntry = await client.EntriesClient.ImportEntryAsync(RepositoryId, parentEntryId, fileName, file: electronicDocument, request: request).ConfigureAwait(false); + + Assert.IsNotNull(importedEntry); + Assert.IsNotNull(importedEntry.TemplateId); + Assert.IsNotNull(importedEntry.TemplateName); + Assert.AreEqual(template.Name, importedEntry.TemplateName); + } + + [TestMethod] + public async Task ImportDocument_ThrowExceptionWithCreateEntryResult() + { + int parentEntryId = 1; + string fileName = "RepositoryApiClientIntegrationTest .Net ImportDocument"; + var electronicDocument = GetFileParameter(); + var request = new ImportEntryRequest() + { + AutoRename = true, + Metadata = new ImportEntryRequestMetadata() + { + TemplateName = "faketemplate123" + } + }; + + try + { + await client.EntriesClient.ImportEntryAsync(RepositoryId, parentEntryId, fileName, file: electronicDocument, request: request).ConfigureAwait(false); + } + catch (ApiException e) + { + Assert.IsNotNull(e?.ProblemDetails?.Title); + Assert.AreEqual(e.ProblemDetails.Title, e.Message); + Assert.AreEqual((int)HttpStatusCode.Conflict, e.StatusCode); + Assert.AreEqual((int)HttpStatusCode.Conflict, e.ProblemDetails.Status); + Assert.IsNotNull(e.ProblemDetails.OperationId); + Assert.IsNull(e.ProblemDetails.Type); + Assert.IsNull(e.ProblemDetails.Instance); + Assert.IsNull(e.ProblemDetails.ErrorSource); + Assert.AreEqual(default, e.ProblemDetails.ErrorCode); + Assert.IsNull(e.ProblemDetails.TraceId); + Assert.AreEqual(1, e.ProblemDetails.Extensions.Count); + } + } + } +} From ec05da2c1f18592452dc026e9075d717f32031fd Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 13:14:24 -0400 Subject: [PATCH 51/93] Update get entry related tests --- tests/integration/Entries/GetEntryTest.cs | 22 +-- .../integration/Entries/ImportDocumentTest.cs | 144 ------------------ 2 files changed, 11 insertions(+), 155 deletions(-) delete mode 100644 tests/integration/Entries/ImportDocumentTest.cs diff --git a/tests/integration/Entries/GetEntryTest.cs b/tests/integration/Entries/GetEntryTest.cs index fdfee418..ae9fd4c8 100644 --- a/tests/integration/Entries/GetEntryTest.cs +++ b/tests/integration/Entries/GetEntryTest.cs @@ -23,8 +23,8 @@ public async Task Cleanup() { if (createdEntryId != 0) { - DeleteEntryWithAuditReason body = new DeleteEntryWithAuditReason(); - await client.EntriesClient.DeleteEntryInfoAsync(RepositoryId, createdEntryId, body).ConfigureAwait(false); + StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, createdEntryId, body).ConfigureAwait(false); } } @@ -44,19 +44,19 @@ private async Task CreateDocument() int parentEntryId = 1; string fileName = "RepositoryApiClientIntegrationTest .Net GetEntry"; string fileLocation = TempPath + "test.pdf"; - var request = new PostEntryWithEdocMetadataRequest(); + var request = new ImportEntryRequest() + { + AutoRename = true + } using (var fileStream = File.OpenRead(fileLocation)) { var electronicDocument = new FileParameter(fileStream, "test", "application/pdf"); - var result = await client.EntriesClient.ImportDocumentAsync(RepositoryId, parentEntryId, fileName, autoRename: true, electronicDocument: electronicDocument, request: request).ConfigureAwait(false); + var importedEntry = await client.EntriesClient.ImportEntryAsync(RepositoryId, parentEntryId, fileName, file: electronicDocument, request: request).ConfigureAwait(false); + + Assert.IsNotNull(importedEntry); + Assert.IsNotNull(importedEntry.Id); - var operations = result.Operations; - Assert.IsNotNull(operations?.EntryCreate); - Assert.AreEqual(0, operations.EntryCreate.Exceptions.Count); - Assert.AreNotEqual(0, operations.EntryCreate.EntryId); - Assert.AreEqual(0, operations.SetEdoc.Exceptions.Count); - Assert.IsFalse(string.IsNullOrEmpty(result.DocumentLink)); - return operations.EntryCreate.EntryId; + return importedEntry.Id; } } diff --git a/tests/integration/Entries/ImportDocumentTest.cs b/tests/integration/Entries/ImportDocumentTest.cs deleted file mode 100644 index 804ef6e5..00000000 --- a/tests/integration/Entries/ImportDocumentTest.cs +++ /dev/null @@ -1,144 +0,0 @@ -using Laserfiche.Api.Client; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; -using System.IO; -using System.Linq; -using System.Net; -using System.Threading.Tasks; - -namespace Laserfiche.Repository.Api.Client.IntegrationTest.Entries -{ - [TestClass] - public class ImportDocumentTest : BaseTest - { - int createdEntryId; - Stream fileStream; - - [TestInitialize] - public void Initialize() - { - client = CreateClient(); - createdEntryId = 0; - fileStream = null; - } - - [TestCleanup] - public async Task Cleanup() - { - fileStream?.Dispose(); - if (createdEntryId != 0) - { - DeleteEntryWithAuditReason body = new DeleteEntryWithAuditReason(); - await client.EntriesClient.DeleteEntryInfoAsync(RepositoryId, createdEntryId, body).ConfigureAwait(false); - } - } - - private FileParameter GetFileParameter() - { - string fileLocation = TempPath + "test.pdf"; - fileStream = File.OpenRead(fileLocation); - return new FileParameter(fileStream, "test", "application/pdf"); - } - - [TestMethod] - public async Task ImportDocument_DocumentCreated() - { - int parentEntryId = 1; - string fileName = "RepositoryApiClientIntegrationTest .Net ImportDocument"; - var electronicDocument = GetFileParameter(); - var request = new PostEntryWithEdocMetadataRequest(); - - var result = await client.EntriesClient.ImportDocumentAsync(RepositoryId, parentEntryId, fileName, autoRename: true, electronicDocument: electronicDocument, request: request).ConfigureAwait(false); - - var operations = result.Operations; - createdEntryId = operations.EntryCreate.EntryId; - Assert.IsNotNull(operations); - Assert.AreEqual(0, operations.EntryCreate.Exceptions.Count); - Assert.AreNotEqual(0, operations.EntryCreate.EntryId); - Assert.AreEqual(0, operations.SetEdoc.Exceptions.Count); - Assert.IsTrue(!string.IsNullOrEmpty(result.DocumentLink)); - } - - [TestMethod] - public async Task ImportDocument_DocumentCreatedWithTemplate() - { - // Find a template definition with no required fields - WTemplateInfo template = null; - var templateDefinitionResult = await client.TemplateDefinitionsClient.GetTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); - var templateDefinitions = templateDefinitionResult.Value; - Assert.IsNotNull(templateDefinitions); - Assert.IsTrue(templateDefinitions.Count > 0, "No template definitions exist in the repository."); - foreach (var templateDefinition in templateDefinitions) - { - var templateDefinitionFieldsResult = await client.TemplateDefinitionsClient.GetTemplateFieldDefinitionsAsync(RepositoryId, templateDefinition.Id).ConfigureAwait(false); - if (templateDefinitionFieldsResult.Value != null && templateDefinitionFieldsResult.Value.All(f => !f.IsRequired)) - { - template = templateDefinition; - break; - } - } - Assert.IsNotNull(template, "Could not find a good template definition to assign to the entry"); - - int parentEntryId = 1; - string fileName = "RepositoryApiClientIntegrationTest .Net ImportDocument"; - var electronicDocument = GetFileParameter(); - var request = new PostEntryWithEdocMetadataRequest() - { - Template = template.Name - }; - - var result = await client.EntriesClient.ImportDocumentAsync(RepositoryId, parentEntryId, fileName, autoRename: true, electronicDocument: electronicDocument, request: request).ConfigureAwait(false); - - var operations = result.Operations; - createdEntryId = operations.EntryCreate.EntryId; - Assert.IsNotNull(operations); - Assert.AreEqual(0, operations.EntryCreate.Exceptions.Count); - Assert.AreNotEqual(0, operations.EntryCreate.EntryId); - Assert.AreEqual(0, operations.SetEdoc.Exceptions.Count); - Assert.IsTrue(!string.IsNullOrEmpty(result.DocumentLink)); - Assert.AreEqual(0, operations.SetTemplate.Exceptions.Count); - Assert.AreEqual(template.Name, operations.SetTemplate.Template); - } - - [TestMethod] - public async Task ImportDocument_ThrowExceptionWithCreateEntryResult() - { - int parentEntryId = 1; - string fileName = "RepositoryApiClientIntegrationTest .Net ImportDocument"; - var electronicDocument = GetFileParameter(); - var request = new PostEntryWithEdocMetadataRequest() - { - Template = "faketemplate123", - }; - - try - { - await client.EntriesClient.ImportDocumentAsync(RepositoryId, parentEntryId, fileName, autoRename: true, electronicDocument: electronicDocument, request: request).ConfigureAwait(false); - } - catch (ApiException e) - { - Assert.IsNotNull(e?.ProblemDetails?.Title); - Assert.AreEqual(e.ProblemDetails.Title, e.Message); - Assert.AreEqual((int)HttpStatusCode.Conflict, e.StatusCode); - Assert.AreEqual((int)HttpStatusCode.Conflict, e.ProblemDetails.Status); - Assert.IsNotNull(e.ProblemDetails.OperationId); - Assert.IsNull(e.ProblemDetails.Type); - Assert.IsNull(e.ProblemDetails.Instance); - Assert.IsNull(e.ProblemDetails.ErrorSource); - Assert.AreEqual(default, e.ProblemDetails.ErrorCode); - Assert.IsNull(e.ProblemDetails.TraceId); - Assert.AreEqual(1, e.ProblemDetails.Extensions.Count); - if (e.ProblemDetails.Extensions.TryGetValue(nameof(CreateEntryResult), out var value) && value is CreateEntryResult partialSuccessResult) - { - Assert.IsNotNull(partialSuccessResult); - createdEntryId = partialSuccessResult.Operations.EntryCreate.EntryId; - Assert.IsTrue(e.Message.Contains(partialSuccessResult.Operations.SetTemplate.Exceptions.First().Message)); - } - else - { - Assert.Fail($"{nameof(CreateEntryResult)} is missing from the exception."); - } - } - } - } -} From f2783d9369320b8bf2cda66949a6ff18c50997b7 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 13:16:43 -0400 Subject: [PATCH 52/93] Fix entry update tests --- tests/integration/Entries/UpdateEntryTest.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/integration/Entries/UpdateEntryTest.cs b/tests/integration/Entries/UpdateEntryTest.cs index cb713eee..0e18f65c 100644 --- a/tests/integration/Entries/UpdateEntryTest.cs +++ b/tests/integration/Entries/UpdateEntryTest.cs @@ -23,7 +23,7 @@ public async Task Cleanup() { if (entry != null) { - StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + StartDeleteEntryRequest body = new(); await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); } } @@ -38,11 +38,12 @@ public async Task MoveAndRenameEntry_ReturnEntry() createdEntries.Add(childFolder); var request = new UpdateEntryRequest() { + AutoRename = true, ParentId = parentFolder.Id, Name = "RepositoryApiClientIntegrationTest .Net MovedFolder" }; - var movedEntry = await client.EntriesClient.UpdateEntryAsync(RepositoryId, childFolder.Id, request, autoRename: true).ConfigureAwait(false); + var movedEntry = await client.EntriesClient.UpdateEntryAsync(RepositoryId, childFolder.Id, request).ConfigureAwait(false); Assert.IsNotNull(movedEntry); Assert.AreEqual(childFolder.Id, movedEntry.Id); From f96568aae2e4021c09e2f9de7cee4a3c084a1ab4 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 13:33:16 -0400 Subject: [PATCH 53/93] Minor naming and syntax fixes --- .../AuditReasons/ListAuditReasonsTest.cs | 6 ++-- tests/integration/Entries/CreateEntryTest.cs | 5 ++- tests/integration/Entries/GetEntryTest.cs | 23 ++++++------- tests/integration/Entries/ImportEntryTest.cs | 14 ++++---- tests/integration/Entries/ListEntriesTest.cs | 26 +++++++++------ tests/integration/Entries/ListFieldsTest.cs | 25 +++++++++------ tests/integration/Entries/ListLinksTest.cs | 25 +++++++++------ tests/integration/Entries/ListTagsTest.cs | 22 +++++++------ .../Entries/ListTemplateDefinitionsTest.cs | 10 +++--- .../integration/Entries/RemoveTemplateTest.cs | 32 +++++++++++-------- tests/integration/Entries/SetFieldsTest.cs | 14 +++++--- tests/integration/Entries/SetLinksTest.cs | 6 ++-- tests/integration/Entries/SetTagsTest.cs | 5 ++- tests/integration/Entries/SetTemplateTest.cs | 3 +- .../integration/Entries/StartCopyEntryTest.cs | 8 +++-- .../Entries/StartDeleteEntryTest.cs | 4 ++- 16 files changed, 135 insertions(+), 93 deletions(-) diff --git a/tests/integration/AuditReasons/ListAuditReasonsTest.cs b/tests/integration/AuditReasons/ListAuditReasonsTest.cs index 0bb863e3..aa9969b1 100644 --- a/tests/integration/AuditReasons/ListAuditReasonsTest.cs +++ b/tests/integration/AuditReasons/ListAuditReasonsTest.cs @@ -15,10 +15,10 @@ public void Initialize() [TestMethod] public async Task ListAuditReasons_ReturnAuditReasons() { - var response = await client.AuditReasonsClient.ListAuditReasonsAsync(RepositoryId).ConfigureAwait(false); + var collectionResponse = await client.AuditReasonsClient.ListAuditReasonsAsync(RepositoryId).ConfigureAwait(false); - AssertCollectionResponse(response); - Assert.IsNotNull(response.Value[0].AuditEventType); + AssertCollectionResponse(collectionResponse); + Assert.IsNotNull(collectionResponse.Value[0].AuditEventType); } } } diff --git a/tests/integration/Entries/CreateEntryTest.cs b/tests/integration/Entries/CreateEntryTest.cs index 44812ded..a08ce47b 100644 --- a/tests/integration/Entries/CreateEntryTest.cs +++ b/tests/integration/Entries/CreateEntryTest.cs @@ -23,7 +23,7 @@ public async Task Cleanup() { if (entry != null) { - StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + StartDeleteEntryRequest body = new(); await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); } } @@ -42,6 +42,7 @@ public async Task CreateCopyEntry_CreateFolder() }; var entry = await client.EntriesClient.CreateEntryAsync(RepositoryId, parentEntryId, request).ConfigureAwait(false); + Assert.IsNotNull(entry); createdEntries.Add(entry); Assert.AreEqual(parentEntryId, entry.ParentId); @@ -62,6 +63,7 @@ public async Task CreateCopyEntry_CreateShortcut() AutoRename = true }; var targetEntry = await client.EntriesClient.CreateEntryAsync(RepositoryId, parentEntryId, request).ConfigureAwait(false); + Assert.IsNotNull(targetEntry); createdEntries.Add(targetEntry); Assert.AreEqual(parentEntryId, targetEntry.ParentId); @@ -77,6 +79,7 @@ public async Task CreateCopyEntry_CreateShortcut() AutoRename = true }; var shortcut = await client.EntriesClient.CreateEntryAsync(RepositoryId, parentEntryId, request).ConfigureAwait(false); + Assert.IsNotNull(shortcut); createdEntries.Add(shortcut); Assert.AreEqual(parentEntryId, shortcut.ParentId); diff --git a/tests/integration/Entries/GetEntryTest.cs b/tests/integration/Entries/GetEntryTest.cs index ae9fd4c8..c4a685ad 100644 --- a/tests/integration/Entries/GetEntryTest.cs +++ b/tests/integration/Entries/GetEntryTest.cs @@ -23,7 +23,7 @@ public async Task Cleanup() { if (createdEntryId != 0) { - StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + StartDeleteEntryRequest body = new(); await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, createdEntryId, body).ConfigureAwait(false); } } @@ -33,6 +33,7 @@ public async Task GetEntry_ReturnRootFolder() { int entryId = 1; var entry = await client.EntriesClient.GetEntryAsync(RepositoryId, entryId).ConfigureAwait(false); + Assert.IsNotNull(entry); Assert.AreEqual(typeof(Folder), entry.GetType()); Assert.AreEqual(entryId, entry.Id); @@ -47,17 +48,16 @@ private async Task CreateDocument() var request = new ImportEntryRequest() { AutoRename = true - } - using (var fileStream = File.OpenRead(fileLocation)) - { - var electronicDocument = new FileParameter(fileStream, "test", "application/pdf"); - var importedEntry = await client.EntriesClient.ImportEntryAsync(RepositoryId, parentEntryId, fileName, file: electronicDocument, request: request).ConfigureAwait(false); + }; - Assert.IsNotNull(importedEntry); - Assert.IsNotNull(importedEntry.Id); + using var fileStream = File.OpenRead(fileLocation); + var electronicDocument = new FileParameter(fileStream, "test", "application/pdf"); + var importedEntry = await client.EntriesClient.ImportEntryAsync(RepositoryId, parentEntryId, fileName, file: electronicDocument, request: request).ConfigureAwait(false); - return importedEntry.Id; - } + Assert.IsNotNull(importedEntry); + Assert.IsNotNull(importedEntry.Id); + + return importedEntry.Id; } [TestMethod] @@ -65,6 +65,7 @@ public async Task GetEntry_ReturnDocument() { createdEntryId = await CreateDocument().ConfigureAwait(false); var entry = await client.EntriesClient.GetEntryAsync(RepositoryId, createdEntryId).ConfigureAwait(false); + Assert.IsNotNull(entry); Assert.AreEqual(typeof(Document), entry.GetType()); Assert.AreEqual(createdEntryId, entry.Id); @@ -78,7 +79,7 @@ public async Task GetEntry_ThrowException() string repositoryId = "fakeRepository"; try { - await client.EntriesClient.GetEntryAsync(repositoryId, entryId).ConfigureAwait(false); + _ = await client.EntriesClient.GetEntryAsync(repositoryId, entryId).ConfigureAwait(false); } catch (ApiException e) { diff --git a/tests/integration/Entries/ImportEntryTest.cs b/tests/integration/Entries/ImportEntryTest.cs index 0a0f9e7f..b4ee16f1 100644 --- a/tests/integration/Entries/ImportEntryTest.cs +++ b/tests/integration/Entries/ImportEntryTest.cs @@ -27,7 +27,7 @@ public async Task Cleanup() fileStream?.Dispose(); if (createdEntryId != 0) { - StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + StartDeleteEntryRequest body = new(); await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, createdEntryId, body).ConfigureAwait(false); } } @@ -60,14 +60,16 @@ public async Task ImportEntry_DocumentCreatedWithTemplate() { // Find a template definition with no required fields TemplateDefinition template = null; - var templateDefinitionResult = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); - var templateDefinitions = templateDefinitionResult.Value; + var templateDefinitionCollectionResponse = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); + var templateDefinitions = templateDefinitionCollectionResponse.Value; + Assert.IsNotNull(templateDefinitions); Assert.IsTrue(templateDefinitions.Count > 0, "No template definitions exist in the repository."); + foreach (var templateDefinition in templateDefinitions) { - var templateDefinitionFieldsResult = await client.TemplateDefinitionsClient.ListTemplateFieldDefinitionsByTemplateIdAsync(RepositoryId, templateDefinition.Id).ConfigureAwait(false); - if (templateDefinitionFieldsResult.Value != null && templateDefinitionFieldsResult.Value.All(f => !f.IsRequired)) + var templateFieldDefinitionCollectionResponse = await client.TemplateDefinitionsClient.ListTemplateFieldDefinitionsByTemplateIdAsync(RepositoryId, templateDefinition.Id).ConfigureAwait(false); + if (templateFieldDefinitionCollectionResponse.Value != null && templateFieldDefinitionCollectionResponse.Value.All(f => !f.IsRequired)) { template = templateDefinition; break; @@ -112,7 +114,7 @@ public async Task ImportDocument_ThrowExceptionWithCreateEntryResult() try { - await client.EntriesClient.ImportEntryAsync(RepositoryId, parentEntryId, fileName, file: electronicDocument, request: request).ConfigureAwait(false); + _ = await client.EntriesClient.ImportEntryAsync(RepositoryId, parentEntryId, fileName, file: electronicDocument, request: request).ConfigureAwait(false); } catch (ApiException e) { diff --git a/tests/integration/Entries/ListEntriesTest.cs b/tests/integration/Entries/ListEntriesTest.cs index 949d3f9a..b15c4d1f 100644 --- a/tests/integration/Entries/ListEntriesTest.cs +++ b/tests/integration/Entries/ListEntriesTest.cs @@ -16,9 +16,11 @@ public void Initialize() public async Task ListEntries_ReturnEntries() { int entryId = 1; - var result = await client.EntriesClient.ListEntriesAsync(RepositoryId, entryId).ConfigureAwait(false); - var entries = result.Value; + var entryCollectionResponse = await client.EntriesClient.ListEntriesAsync(RepositoryId, entryId).ConfigureAwait(false); + var entries = entryCollectionResponse.Value; + Assert.IsNotNull(entries); + foreach (var entry in entries) { Assert.AreEqual(entryId, entry.ParentId); @@ -37,6 +39,7 @@ Task PagingCallback(EntryCollectionResponse data) { Assert.AreNotEqual(0, data.Value.Count); Assert.IsTrue(data.Value.Count <= maxPageSize); + return Task.FromResult(true); } else @@ -56,22 +59,25 @@ public async Task ListEntries_SimplePaging() int maxPageSize = 1; // Initial request - var result = await client.EntriesClient.ListEntriesAsync(RepositoryId, entryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); - Assert.IsNotNull(result); + var entryCollectionResponse = await client.EntriesClient.ListEntriesAsync(RepositoryId, entryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); + + Assert.IsNotNull(entryCollectionResponse); - if (result.Value.Count == 0) + if (entryCollectionResponse.Value.Count == 0) { return; // There's no point testing if we don't have any such item. } - var nextLink = result.OdataNextLink; + var nextLink = entryCollectionResponse.OdataNextLink; + Assert.IsNotNull(nextLink); - Assert.IsTrue(result.Value.Count <= maxPageSize); + Assert.IsTrue(entryCollectionResponse.Value.Count <= maxPageSize); // Paging request - result = await client.EntriesClient.ListEntriesNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); - Assert.IsNotNull(result); - Assert.IsTrue(result.Value.Count <= maxPageSize); + entryCollectionResponse = await client.EntriesClient.ListEntriesNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); + + Assert.IsNotNull(entryCollectionResponse); + Assert.IsTrue(entryCollectionResponse.Value.Count <= maxPageSize); } } } diff --git a/tests/integration/Entries/ListFieldsTest.cs b/tests/integration/Entries/ListFieldsTest.cs index aab74399..42ed8090 100644 --- a/tests/integration/Entries/ListFieldsTest.cs +++ b/tests/integration/Entries/ListFieldsTest.cs @@ -16,8 +16,9 @@ public void Initialize() public async Task GetEntryFields_ReturnFields() { int entryId = 1; - var result = await client.EntriesClient.ListFieldsAsync(RepositoryId, entryId).ConfigureAwait(false); - Assert.IsNotNull(result.Value); + var fieldCollectionResponse = await client.EntriesClient.ListFieldsAsync(RepositoryId, entryId).ConfigureAwait(false); + + Assert.IsNotNull(fieldCollectionResponse.Value); } [TestMethod] @@ -32,6 +33,7 @@ Task PagingCallback(FieldCollectionResponse data) { Assert.AreNotEqual(0, data.Value.Count); Assert.IsTrue(data.Value.Count <= maxPageSize); + return Task.FromResult(true); } else @@ -51,22 +53,25 @@ public async Task GetEntryFields_SimplePaging() int maxPageSize = 1; // Initial request - var result = await client.EntriesClient.ListFieldsAsync(RepositoryId, entryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); - Assert.IsNotNull(result); + var fieldCollectionResponse = await client.EntriesClient.ListFieldsAsync(RepositoryId, entryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); + + Assert.IsNotNull(fieldCollectionResponse); - if (result.Value.Count == 0) + if (fieldCollectionResponse.Value.Count == 0) { return; // There's no point testing if we don't have any such item. } - var nextLink = result.OdataNextLink; + var nextLink = fieldCollectionResponse.OdataNextLink; + Assert.IsNotNull(nextLink); - Assert.IsTrue(result.Value.Count <= maxPageSize); + Assert.IsTrue(fieldCollectionResponse.Value.Count <= maxPageSize); // Paging request - result = await client.EntriesClient.ListFieldsNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); - Assert.IsNotNull(result); - Assert.IsTrue(result.Value.Count <= maxPageSize); + fieldCollectionResponse = await client.EntriesClient.ListFieldsNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); + + Assert.IsNotNull(fieldCollectionResponse); + Assert.IsTrue(fieldCollectionResponse.Value.Count <= maxPageSize); } } } diff --git a/tests/integration/Entries/ListLinksTest.cs b/tests/integration/Entries/ListLinksTest.cs index 41ee92d2..903514a3 100644 --- a/tests/integration/Entries/ListLinksTest.cs +++ b/tests/integration/Entries/ListLinksTest.cs @@ -16,8 +16,9 @@ public void Initialize() public async Task GetEntryLinks_ReturnLinks() { int entryId = 1; - var result = await client.EntriesClient.ListLinksAsync(RepositoryId, entryId).ConfigureAwait(false); - Assert.IsNotNull(result.Value); + var linkCollectionResponse = await client.EntriesClient.ListLinksAsync(RepositoryId, entryId).ConfigureAwait(false); + + Assert.IsNotNull(linkCollectionResponse.Value); } [TestMethod] @@ -32,6 +33,7 @@ Task PagingCallback(LinkCollectionResponse data) { Assert.AreNotEqual(0, data.Value.Count); Assert.IsTrue(data.Value.Count <= maxPageSize); + return Task.FromResult(true); } else @@ -51,22 +53,25 @@ public async Task GetEntryLinks_SimplePaging() int maxPageSize = 1; // Initial request - var response = await client.EntriesClient.ListLinksAsync(RepositoryId, entryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); - Assert.IsNotNull(response); + var linkCollectionResponse = await client.EntriesClient.ListLinksAsync(RepositoryId, entryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); + + Assert.IsNotNull(linkCollectionResponse); - if (response.Value.Count == 0) + if (linkCollectionResponse.Value.Count == 0) { return; // There's no point testing if we don't have any such item. } - var nextLink = response.OdataNextLink; + var nextLink = linkCollectionResponse.OdataNextLink; + Assert.IsNotNull(nextLink); - Assert.IsTrue(response.Value.Count <= maxPageSize); + Assert.IsTrue(linkCollectionResponse.Value.Count <= maxPageSize); // Paging request - response = await client.EntriesClient.ListLinksNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); - Assert.IsNotNull(response); - Assert.IsTrue(response.Value.Count <= maxPageSize); + linkCollectionResponse = await client.EntriesClient.ListLinksNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); + + Assert.IsNotNull(linkCollectionResponse); + Assert.IsTrue(linkCollectionResponse.Value.Count <= maxPageSize); } } } diff --git a/tests/integration/Entries/ListTagsTest.cs b/tests/integration/Entries/ListTagsTest.cs index 71ca6622..dce59dfe 100644 --- a/tests/integration/Entries/ListTagsTest.cs +++ b/tests/integration/Entries/ListTagsTest.cs @@ -16,8 +16,9 @@ public void Initialize() public async Task GetEntryTags_ReturnTags() { int entryId = 1; - var result = await client.EntriesClient.ListTagsAsync(RepositoryId, entryId).ConfigureAwait(false); - Assert.IsNotNull(result.Value); + var tagCollectionResponse = await client.EntriesClient.ListTagsAsync(RepositoryId, entryId).ConfigureAwait(false); + + Assert.IsNotNull(tagCollectionResponse.Value); } [TestMethod] @@ -32,6 +33,7 @@ Task PagingCallback(TagCollectionResponse data) { Assert.AreNotEqual(0, data.Value.Count); Assert.IsTrue(data.Value.Count <= maxPageSize); + return Task.FromResult(true); } else @@ -51,22 +53,22 @@ public async Task GetEntryTags_SimplePaging() int maxPageSize = 1; // Initial request - var result = await client.EntriesClient.ListTagsAsync(RepositoryId, entryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); - Assert.IsNotNull(result); + var tagCollectionResponse = await client.EntriesClient.ListTagsAsync(RepositoryId, entryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); + Assert.IsNotNull(tagCollectionResponse); - if (result.Value.Count == 0) + if (tagCollectionResponse.Value.Count == 0) { return; // There's no point testing if we don't have any such item. } - var nextLink = result.OdataNextLink; + var nextLink = tagCollectionResponse.OdataNextLink; Assert.IsNotNull(nextLink); - Assert.IsTrue(result.Value.Count <= maxPageSize); + Assert.IsTrue(tagCollectionResponse.Value.Count <= maxPageSize); // Paging request - result = await client.EntriesClient.ListTagsNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); - Assert.IsNotNull(result); - Assert.IsTrue(result.Value.Count <= maxPageSize); + tagCollectionResponse = await client.EntriesClient.ListTagsNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); + Assert.IsNotNull(tagCollectionResponse); + Assert.IsTrue(tagCollectionResponse.Value.Count <= maxPageSize); } } } diff --git a/tests/integration/Entries/ListTemplateDefinitionsTest.cs b/tests/integration/Entries/ListTemplateDefinitionsTest.cs index 20208790..1243a9fc 100644 --- a/tests/integration/Entries/ListTemplateDefinitionsTest.cs +++ b/tests/integration/Entries/ListTemplateDefinitionsTest.cs @@ -17,14 +17,14 @@ public void Initialize() public async Task GetDynamicFields_ReturnDynamicFields() { // Get a template definition id - var collectionResponse = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); - AssertCollectionResponse(collectionResponse); + var templateDefinitionCollectionResponse = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); + AssertCollectionResponse(templateDefinitionCollectionResponse); int entryId = 1; - var request = new ListDynamicFieldValuesRequest() { TemplateId = collectionResponse.Value.First().Id }; - var result = await client.EntriesClient.ListDynamicFieldValuesAsync(RepositoryId, entryId, request).ConfigureAwait(false); + var request = new ListDynamicFieldValuesRequest() { TemplateId = templateDefinitionCollectionResponse.Value.First().Id }; + var dynamicFieldValues = await client.EntriesClient.ListDynamicFieldValuesAsync(RepositoryId, entryId, request).ConfigureAwait(false); - Assert.IsNotNull(result); + Assert.IsNotNull(dynamicFieldValues); } } } diff --git a/tests/integration/Entries/RemoveTemplateTest.cs b/tests/integration/Entries/RemoveTemplateTest.cs index 49165c59..69df7cb9 100644 --- a/tests/integration/Entries/RemoveTemplateTest.cs +++ b/tests/integration/Entries/RemoveTemplateTest.cs @@ -21,7 +21,7 @@ public async Task Cleanup() { if (entry != null) { - StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + StartDeleteEntryRequest body = new(); await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); } } @@ -31,19 +31,22 @@ public async Task RemoveTemplateFromEntry_ReturnEntry() { // Find a template definition with no required fields TemplateDefinition template = null; - var templateDefinitionResult = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); - var templateDefinitions = templateDefinitionResult.Value; + var templateDefinitionCollectionResponse = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); + var templateDefinitions = templateDefinitionCollectionResponse.Value; + Assert.IsNotNull(templateDefinitions); Assert.IsTrue(templateDefinitions.Count > 0, "No template definitions exist in the repository."); + foreach (var templateDefinition in templateDefinitions) { - var templateDefinitionFieldsResult = await client.TemplateDefinitionsClient.ListTemplateFieldDefinitionsByTemplateIdAsync(RepositoryId, templateDefinition.Id).ConfigureAwait(false); - if (templateDefinitionFieldsResult.Value != null && templateDefinitionFieldsResult.Value.All(f => !f.IsRequired)) + var templateFieldDefinitionCollectionResponse = await client.TemplateDefinitionsClient.ListTemplateFieldDefinitionsByTemplateIdAsync(RepositoryId, templateDefinition.Id).ConfigureAwait(false); + if (templateFieldDefinitionCollectionResponse.Value != null && templateFieldDefinitionCollectionResponse.Value.All(f => !f.IsRequired)) { template = templateDefinition; break; } } + Assert.IsNotNull(template, "Could not find a good template definition to assign to the entry"); // Set the template on an entry @@ -52,17 +55,18 @@ public async Task RemoveTemplateFromEntry_ReturnEntry() TemplateName = template.Name }; entry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net RemoveTemplateFromEntry").ConfigureAwait(false); - var setTemplateEntryResult = await client.EntriesClient.SetTemplateAsync(RepositoryId, entry.Id, request).ConfigureAwait(false); - Assert.IsNotNull(setTemplateEntryResult); - Assert.AreEqual(template.Name, setTemplateEntryResult.TemplateName); + var entryWithTemplate = await client.EntriesClient.SetTemplateAsync(RepositoryId, entry.Id, request).ConfigureAwait(false); + + Assert.IsNotNull(entryWithTemplate); + Assert.AreEqual(template.Name, entryWithTemplate.TemplateName); // Delete the template on the entry - var deleteTemplateResponse = await client.EntriesClient.RemoveTemplateAsync(RepositoryId, entry.Id).ConfigureAwait(false); - var returnedEntry = deleteTemplateResponse; - Assert.IsNotNull(returnedEntry); - Assert.AreEqual(entry.Id, returnedEntry.Id); - Assert.AreEqual(0, returnedEntry.TemplateId); - Assert.IsTrue(string.IsNullOrEmpty(returnedEntry.TemplateName)); + var entryWithoutTemplate = await client.EntriesClient.RemoveTemplateAsync(RepositoryId, entry.Id).ConfigureAwait(false); + + Assert.IsNotNull(entryWithoutTemplate); + Assert.AreEqual(entry.Id, entryWithoutTemplate.Id); + Assert.AreEqual(0, entryWithoutTemplate.TemplateId); + Assert.IsTrue(string.IsNullOrEmpty(entryWithoutTemplate.TemplateName)); } } } diff --git a/tests/integration/Entries/SetFieldsTest.cs b/tests/integration/Entries/SetFieldsTest.cs index a1fe5e12..cdfb91a3 100644 --- a/tests/integration/Entries/SetFieldsTest.cs +++ b/tests/integration/Entries/SetFieldsTest.cs @@ -22,7 +22,7 @@ public async Task Cleanup() { if (entry != null) { - StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + StartDeleteEntryRequest body = new(); await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); } } @@ -33,9 +33,11 @@ public async Task SetFields_ReturnFields() // Find a string field FieldDefinition field = null; string fieldValue = "a"; - var fieldDefinitionsResult = await client.FieldDefinitionsClient.ListFieldDefinitionsAsync(RepositoryId).ConfigureAwait(false); - var fieldDefinitions = fieldDefinitionsResult.Value; + var fieldDefinitionCollectionResponse = await client.FieldDefinitionsClient.ListFieldDefinitionsAsync(RepositoryId).ConfigureAwait(false); + var fieldDefinitions = fieldDefinitionCollectionResponse.Value; + Assert.IsNotNull(fieldDefinitions); + foreach(var fieldDefinition in fieldDefinitions) { if (fieldDefinition.FieldType == FieldType.String && string.IsNullOrEmpty(fieldDefinition.Constraint) && fieldDefinition.Length >= 1) @@ -44,6 +46,7 @@ public async Task SetFields_ReturnFields() break; } } + Assert.IsNotNull(field, "Could not find a string field to set."); var request = new SetFieldsRequest() @@ -58,8 +61,9 @@ public async Task SetFields_ReturnFields() }; entry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net SetFields").ConfigureAwait(false); - var result = await client.EntriesClient.SetFieldsAsync(RepositoryId, entry.Id, request).ConfigureAwait(false); - var fields = result.Value; + var fieldCollectionResponse = await client.EntriesClient.SetFieldsAsync(RepositoryId, entry.Id, request).ConfigureAwait(false); + var fields = fieldCollectionResponse.Value; + Assert.IsNotNull(fields); Assert.AreEqual(1, fields.Count); Assert.AreEqual(field.Name, fields.FirstOrDefault()?.Name); diff --git a/tests/integration/Entries/SetLinksTest.cs b/tests/integration/Entries/SetLinksTest.cs index db3f3dbd..ab303dff 100644 --- a/tests/integration/Entries/SetLinksTest.cs +++ b/tests/integration/Entries/SetLinksTest.cs @@ -24,7 +24,7 @@ public async Task Cleanup() { if (entry != null) { - StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + StartDeleteEntryRequest body = new(); await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); } } @@ -35,8 +35,10 @@ public async Task SetLinks_ReturnLinks() { var sourceEntry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net SetLinks Source").ConfigureAwait(false); createdEntries.Add(sourceEntry); + var targetEntry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net SetLinks Target").ConfigureAwait(false); createdEntries.Add(targetEntry); + var request = new SetLinksRequest() { Links = new List @@ -49,8 +51,8 @@ public async Task SetLinks_ReturnLinks() }; var result = await client.EntriesClient.SetLinksAsync(RepositoryId, sourceEntry.Id, request).ConfigureAwait(false); - var links = result.Value; + Assert.IsNotNull(links); Assert.AreEqual(request.Links.Count, links.Count); Assert.AreEqual(sourceEntry.Id, links.FirstOrDefault()?.SourceId); diff --git a/tests/integration/Entries/SetTagsTest.cs b/tests/integration/Entries/SetTagsTest.cs index 4fb1e665..f0bd5877 100644 --- a/tests/integration/Entries/SetTagsTest.cs +++ b/tests/integration/Entries/SetTagsTest.cs @@ -22,7 +22,7 @@ public async Task Cleanup() { if (entry != null) { - StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + StartDeleteEntryRequest body = new(); await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); } } @@ -32,8 +32,10 @@ public async Task SetTags_ReturnTags() { var tagDefinitionsResult = await client.TagDefinitionsClient.ListTagDefinitionsAsync(RepositoryId).ConfigureAwait(false); var tagDefinitions = tagDefinitionsResult.Value; + Assert.IsNotNull(tagDefinitions); Assert.IsTrue(tagDefinitions.Count > 0, "No tag definitions exist in the repository."); + string tag = tagDefinitions.First().Name; var request = new SetTagsRequest() { @@ -43,6 +45,7 @@ public async Task SetTags_ReturnTags() var result = await client.EntriesClient.SetTagsAsync(RepositoryId, entry.Id, request).ConfigureAwait(false); var tags = result.Value; + Assert.IsNotNull(tags); Assert.AreEqual(request.Tags.Count, tags.Count); Assert.AreEqual(tag, tags.FirstOrDefault()?.Name); diff --git a/tests/integration/Entries/SetTemplateTest.cs b/tests/integration/Entries/SetTemplateTest.cs index 97214de2..0c49f63a 100644 --- a/tests/integration/Entries/SetTemplateTest.cs +++ b/tests/integration/Entries/SetTemplateTest.cs @@ -21,7 +21,7 @@ public async Task Cleanup() { if (entry != null) { - StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + StartDeleteEntryRequest body = new(); await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); } } @@ -53,6 +53,7 @@ public async Task SetTemplate_ReturnEntryWithTemplate() }; entry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net DeleteTemplate").ConfigureAwait(false); var setTemplateResult = await client.EntriesClient.SetTemplateAsync(RepositoryId, entry.Id, request).ConfigureAwait(false); + Assert.IsNotNull(setTemplateResult); Assert.AreEqual(template.Name, setTemplateResult.TemplateName); } diff --git a/tests/integration/Entries/StartCopyEntryTest.cs b/tests/integration/Entries/StartCopyEntryTest.cs index 8a85d08c..217ddb69 100644 --- a/tests/integration/Entries/StartCopyEntryTest.cs +++ b/tests/integration/Entries/StartCopyEntryTest.cs @@ -25,7 +25,7 @@ public async Task Cleanup() { if (entry != null) { - StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + StartDeleteEntryRequest body = new(); await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, entry.Id, body).ConfigureAwait(false); } } @@ -48,6 +48,7 @@ public async Task CreateCopyEntry_CopyEntry() AutoRename = true }; var targetEntry = await client.EntriesClient.CreateEntryAsync(RepositoryId, testFolder.Id, request).ConfigureAwait(false); + Assert.IsNotNull(targetEntry); Assert.AreEqual(testFolder.Id, targetEntry.ParentId); Assert.AreEqual(EntryType.Folder, targetEntry.EntryType); @@ -60,13 +61,12 @@ public async Task CreateCopyEntry_CopyEntry() AutoRename = true }; var copyResult = await client.EntriesClient.StartCopyEntryAsync(RepositoryId, testFolder.Id, copyRequest).ConfigureAwait(false); - var opToken = copyResult.TaskId; // Wait for the copy operation to finish await Task.Delay(5000).ConfigureAwait(false); var taskCollectionResponse = await client.TasksClient.ListTasksAsync(RepositoryId).ConfigureAwait(false); AssertCollectionResponse(taskCollectionResponse); - Assert.IsNotNull(taskCollectionResponse.Value.First(t => t.Id == opToken && t.Status == TaskStatus.Completed)); + Assert.IsNotNull(taskCollectionResponse.Value.First(t => t.Id == copyResult.TaskId && t.Status == TaskStatus.Completed)); } [TestMethod] @@ -82,6 +82,7 @@ public async Task CreateCopyEntry_CopyShortcut() AutoRename = true }; var targetEntry = await client.EntriesClient.CreateEntryAsync(RepositoryId, parentEntryId, createEntryRequest).ConfigureAwait(false); + Assert.IsNotNull(targetEntry); createdEntries.Add(targetEntry); Assert.AreEqual(parentEntryId, targetEntry.ParentId); @@ -133,6 +134,7 @@ public async Task CreateCopyEntry_CopyFolder() AutoRename = true }; var targetEntry = await client.EntriesClient.CreateEntryAsync(RepositoryId, parentEntryId, createEntryRequest).ConfigureAwait(false); + Assert.IsNotNull(targetEntry); createdEntries.Add(targetEntry); Assert.AreEqual(parentEntryId, targetEntry.ParentId); diff --git a/tests/integration/Entries/StartDeleteEntryTest.cs b/tests/integration/Entries/StartDeleteEntryTest.cs index 8859da39..d8499ae0 100644 --- a/tests/integration/Entries/StartDeleteEntryTest.cs +++ b/tests/integration/Entries/StartDeleteEntryTest.cs @@ -16,8 +16,10 @@ public void Initialize() public async Task DeleteEntry_ReturnOperationToken() { var deleteEntry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net DeleteFolder").ConfigureAwait(false); - StartDeleteEntryRequest body = new StartDeleteEntryRequest(); + + StartDeleteEntryRequest body = new(); var response = await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, deleteEntry.Id, body).ConfigureAwait(false); + Assert.IsTrue(!string.IsNullOrEmpty(response.TaskId)); } } From 9df6d436c590ace5808e82e3b2726d9f4e9b603f Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 13:40:57 -0400 Subject: [PATCH 54/93] Update tests related to field definitions --- ...nByIdTest.cs => GetFieldDefinitionTest.cs} | 7 ++--- ...onsTest.cs => ListFieldDefinitionsTest.cs} | 27 ++++++++++--------- 2 files changed, 19 insertions(+), 15 deletions(-) rename tests/integration/FieldDefinitions/{GetFieldDefinitionByIdTest.cs => GetFieldDefinitionTest.cs} (78%) rename tests/integration/FieldDefinitions/{GetFieldDefinitionsTest.cs => ListFieldDefinitionsTest.cs} (52%) diff --git a/tests/integration/FieldDefinitions/GetFieldDefinitionByIdTest.cs b/tests/integration/FieldDefinitions/GetFieldDefinitionTest.cs similarity index 78% rename from tests/integration/FieldDefinitions/GetFieldDefinitionByIdTest.cs rename to tests/integration/FieldDefinitions/GetFieldDefinitionTest.cs index 81afe6ce..6251135c 100644 --- a/tests/integration/FieldDefinitions/GetFieldDefinitionByIdTest.cs +++ b/tests/integration/FieldDefinitions/GetFieldDefinitionTest.cs @@ -5,7 +5,7 @@ namespace Laserfiche.Repository.Api.Client.IntegrationTest.FieldDefinitions { [TestClass] - public class GetFieldDefinitionByIdTest : BaseTest + public class GetFieldDefinitionTest : BaseTest { [TestInitialize] public void Initialize() @@ -16,11 +16,12 @@ public void Initialize() [TestMethod] public async Task GetFieldDefinitionById_ReturnField() { - var allFieldDefinitionsResult = await client.FieldDefinitionsClient.GetFieldDefinitionsAsync(RepositoryId).ConfigureAwait(false); + var allFieldDefinitionsResult = await client.FieldDefinitionsClient.ListFieldDefinitionsAsync(RepositoryId).ConfigureAwait(false); var firstFieldDefinition = allFieldDefinitionsResult.Value?.FirstOrDefault(); + Assert.IsNotNull(firstFieldDefinition, "No field definitions exist in the repository."); - var fieldDefinition = await client.FieldDefinitionsClient.GetFieldDefinitionByIdAsync(RepositoryId, firstFieldDefinition.Id).ConfigureAwait(false); + var fieldDefinition = await client.FieldDefinitionsClient.GetFieldDefinitionAsync(RepositoryId, firstFieldDefinition.Id).ConfigureAwait(false); Assert.IsNotNull(fieldDefinition); Assert.AreEqual(firstFieldDefinition.Id, fieldDefinition.Id); diff --git a/tests/integration/FieldDefinitions/GetFieldDefinitionsTest.cs b/tests/integration/FieldDefinitions/ListFieldDefinitionsTest.cs similarity index 52% rename from tests/integration/FieldDefinitions/GetFieldDefinitionsTest.cs rename to tests/integration/FieldDefinitions/ListFieldDefinitionsTest.cs index 1bbf03c4..2207fbb0 100644 --- a/tests/integration/FieldDefinitions/GetFieldDefinitionsTest.cs +++ b/tests/integration/FieldDefinitions/ListFieldDefinitionsTest.cs @@ -4,7 +4,7 @@ namespace Laserfiche.Repository.Api.Client.IntegrationTest.FieldDefinitions { [TestClass] - public class GetFieldDefinitionsTest : BaseTest + public class ListFieldDefinitionsTest : BaseTest { [TestInitialize] public void Initialize() @@ -15,7 +15,7 @@ public void Initialize() [TestMethod] public async Task GetFieldDefinitions_ReturnAllFields() { - var result = await client.FieldDefinitionsClient.GetFieldDefinitionsAsync(RepositoryId).ConfigureAwait(false); + var result = await client.FieldDefinitionsClient.ListFieldDefinitionsAsync(RepositoryId).ConfigureAwait(false); Assert.IsNotNull(result.Value); } @@ -24,7 +24,7 @@ public async Task GetFieldDefinitions_ForEachPaging() { int maxPageSize = 10; - Task PagingCallback(ODataValueContextOfIListOfWFieldInfo data) + Task PagingCallback(FieldDefinitionCollectionResponse data) { if (data.OdataNextLink != null) { @@ -38,7 +38,7 @@ Task PagingCallback(ODataValueContextOfIListOfWFieldInfo data) } } - await client.FieldDefinitionsClient.GetFieldDefinitionsForEachAsync(PagingCallback, RepositoryId, maxPageSize: maxPageSize).ConfigureAwait(false); + await client.FieldDefinitionsClient.ListFieldDefinitionsForEachAsync(PagingCallback, RepositoryId, maxPageSize: maxPageSize).ConfigureAwait(false); await Task.Delay(5000).ConfigureAwait(false); } @@ -48,22 +48,25 @@ public async Task GetFieldDefinitions_SimplePaging() int maxPageSize = 1; // Initial request - var result = await client.FieldDefinitionsClient.GetFieldDefinitionsAsync(RepositoryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); - Assert.IsNotNull(result); + var fieldDefinitionCollectionResponse = await client.FieldDefinitionsClient.ListFieldDefinitionsAsync(RepositoryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); + + Assert.IsNotNull(fieldDefinitionCollectionResponse); - if (result.Value.Count == 0) + if (fieldDefinitionCollectionResponse.Value.Count == 0) { return; // There's no point testing if we don't have any such item. } - var nextLink = result.OdataNextLink; + var nextLink = fieldDefinitionCollectionResponse.OdataNextLink; + Assert.IsNotNull(nextLink); - Assert.IsTrue(result.Value.Count <= maxPageSize); + Assert.IsTrue(fieldDefinitionCollectionResponse.Value.Count <= maxPageSize); // Paging request - result = await client.FieldDefinitionsClient.GetFieldDefinitionsNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); - Assert.IsNotNull(result); - Assert.IsTrue(result.Value.Count <= maxPageSize); + fieldDefinitionCollectionResponse = await client.FieldDefinitionsClient.ListFieldDefinitionsNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); + + Assert.IsNotNull(fieldDefinitionCollectionResponse); + Assert.IsTrue(fieldDefinitionCollectionResponse.Value.Count <= maxPageSize); } } } From 4de04bda5ef11986742019274ac8b638a1e7d341 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 13:48:15 -0400 Subject: [PATCH 55/93] Update test names as API names have changed --- .../FieldDefinitions/GetFieldDefinitionTest.cs | 2 +- .../FieldDefinitions/ListFieldDefinitionsTest.cs | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/integration/FieldDefinitions/GetFieldDefinitionTest.cs b/tests/integration/FieldDefinitions/GetFieldDefinitionTest.cs index 6251135c..578a62ae 100644 --- a/tests/integration/FieldDefinitions/GetFieldDefinitionTest.cs +++ b/tests/integration/FieldDefinitions/GetFieldDefinitionTest.cs @@ -14,7 +14,7 @@ public void Initialize() } [TestMethod] - public async Task GetFieldDefinitionById_ReturnField() + public async Task GetFieldDefinition_ReturnField() { var allFieldDefinitionsResult = await client.FieldDefinitionsClient.ListFieldDefinitionsAsync(RepositoryId).ConfigureAwait(false); var firstFieldDefinition = allFieldDefinitionsResult.Value?.FirstOrDefault(); diff --git a/tests/integration/FieldDefinitions/ListFieldDefinitionsTest.cs b/tests/integration/FieldDefinitions/ListFieldDefinitionsTest.cs index 2207fbb0..ce7f035d 100644 --- a/tests/integration/FieldDefinitions/ListFieldDefinitionsTest.cs +++ b/tests/integration/FieldDefinitions/ListFieldDefinitionsTest.cs @@ -13,14 +13,15 @@ public void Initialize() } [TestMethod] - public async Task GetFieldDefinitions_ReturnAllFields() + public async Task ListFieldDefinitions_ReturnAllFields() { - var result = await client.FieldDefinitionsClient.ListFieldDefinitionsAsync(RepositoryId).ConfigureAwait(false); - Assert.IsNotNull(result.Value); + var fieldDefinitionCollectionResponse = await client.FieldDefinitionsClient.ListFieldDefinitionsAsync(RepositoryId).ConfigureAwait(false); + + Assert.IsNotNull(fieldDefinitionCollectionResponse.Value); } [TestMethod] - public async Task GetFieldDefinitions_ForEachPaging() + public async Task ListFieldDefinitions_ForEachPaging() { int maxPageSize = 10; @@ -30,6 +31,7 @@ Task PagingCallback(FieldDefinitionCollectionResponse data) { Assert.AreNotEqual(0, data.Value.Count); Assert.IsTrue(data.Value.Count <= maxPageSize); + return Task.FromResult(true); } else @@ -43,7 +45,7 @@ Task PagingCallback(FieldDefinitionCollectionResponse data) } [TestMethod] - public async Task GetFieldDefinitions_SimplePaging() + public async Task ListFieldDefinitions_SimplePaging() { int maxPageSize = 1; From 7c1a46be3a9433b6e0381be31d1b10169376077a Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 13:49:50 -0400 Subject: [PATCH 56/93] Udpate tests related to link definitions --- ...onByIdTest.cs => GetLinkDefinitionTest.cs} | 9 +++--- ...ionsTest.cs => ListLinkDefinitionsTest.cs} | 31 +++++++++++-------- 2 files changed, 23 insertions(+), 17 deletions(-) rename tests/integration/LinkDefinitions/{GetLinkDefinitionByIdTest.cs => GetLinkDefinitionTest.cs} (71%) rename tests/integration/LinkDefinitions/{GetLinkDefinitionsTest.cs => ListLinkDefinitionsTest.cs} (50%) diff --git a/tests/integration/LinkDefinitions/GetLinkDefinitionByIdTest.cs b/tests/integration/LinkDefinitions/GetLinkDefinitionTest.cs similarity index 71% rename from tests/integration/LinkDefinitions/GetLinkDefinitionByIdTest.cs rename to tests/integration/LinkDefinitions/GetLinkDefinitionTest.cs index a0e6dd2c..d329aa97 100644 --- a/tests/integration/LinkDefinitions/GetLinkDefinitionByIdTest.cs +++ b/tests/integration/LinkDefinitions/GetLinkDefinitionTest.cs @@ -5,7 +5,7 @@ namespace Laserfiche.Repository.Api.Client.IntegrationTest.LinkDefinitions { [TestClass] - public class GetLinkDefinitionByIdTest : BaseTest + public class GetLinkDefinitionTest : BaseTest { [TestInitialize] public void Initialize() @@ -16,14 +16,15 @@ public void Initialize() [TestMethod] public async Task GetLinkDefinitionByIdAsync_ReturnLinkDefinition() { - var allLinkDefinitionsResult = await client.LinkDefinitionsClient.GetLinkDefinitionsAsync(RepositoryId).ConfigureAwait(false); + var allLinkDefinitionsResult = await client.LinkDefinitionsClient.ListLinkDefinitionsAsync(RepositoryId).ConfigureAwait(false); var firstLinkDefinition = allLinkDefinitionsResult.Value?.FirstOrDefault(); + Assert.IsNotNull(firstLinkDefinition, "No link definitions exist in the repository."); - var linkDefinition = await client.LinkDefinitionsClient.GetLinkDefinitionByIdAsync(RepositoryId, firstLinkDefinition.LinkTypeId).ConfigureAwait(false); + var linkDefinition = await client.LinkDefinitionsClient.GetLinkDefinitionAsync(RepositoryId, firstLinkDefinition.Id).ConfigureAwait(false); Assert.IsNotNull(linkDefinition); - Assert.AreEqual(firstLinkDefinition.LinkTypeId, linkDefinition.LinkTypeId); + Assert.AreEqual(firstLinkDefinition.Id, linkDefinition.Id); } } } diff --git a/tests/integration/LinkDefinitions/GetLinkDefinitionsTest.cs b/tests/integration/LinkDefinitions/ListLinkDefinitionsTest.cs similarity index 50% rename from tests/integration/LinkDefinitions/GetLinkDefinitionsTest.cs rename to tests/integration/LinkDefinitions/ListLinkDefinitionsTest.cs index 19ed349b..836d9406 100644 --- a/tests/integration/LinkDefinitions/GetLinkDefinitionsTest.cs +++ b/tests/integration/LinkDefinitions/ListLinkDefinitionsTest.cs @@ -4,7 +4,7 @@ namespace Laserfiche.Repository.Api.Client.IntegrationTest.LinkDefinitions { [TestClass] - public class GetLinkDefinitionsTest : BaseTest + public class ListLinkDefinitionsTest : BaseTest { [TestInitialize] public void Initialize() @@ -15,8 +15,9 @@ public void Initialize() [TestMethod] public async Task GetLinkDefinitionsAsync_ReturnAllLinks() { - var result = await client.LinkDefinitionsClient.GetLinkDefinitionsAsync(RepositoryId).ConfigureAwait(false); - Assert.IsNotNull(result.Value); + var linkedDefinitionCollectionResponse = await client.LinkDefinitionsClient.ListLinkDefinitionsAsync(RepositoryId).ConfigureAwait(false); + + Assert.IsNotNull(linkedDefinitionCollectionResponse.Value); } [TestMethod] @@ -24,12 +25,13 @@ public async Task GetLinkDefinitionsAsync_ForEachPaging() { int maxPageSize = 10; - Task PagingCallback(ODataValueContextOfIListOfEntryLinkTypeInfo data) + Task PagingCallback(LinkDefinitionCollectionResponse data) { if (data.OdataNextLink != null) { Assert.AreNotEqual(0, data.Value.Count); Assert.IsTrue(data.Value.Count <= maxPageSize); + return Task.FromResult(true); } else @@ -38,7 +40,7 @@ Task PagingCallback(ODataValueContextOfIListOfEntryLinkTypeInfo data) } } - await client.LinkDefinitionsClient.GetLinkDefinitionsForEachAsync(PagingCallback, RepositoryId, maxPageSize: maxPageSize).ConfigureAwait(false); + await client.LinkDefinitionsClient.ListLinkDefinitionsForEachAsync(PagingCallback, RepositoryId, maxPageSize: maxPageSize).ConfigureAwait(false); await Task.Delay(5000).ConfigureAwait(false); } @@ -48,22 +50,25 @@ public async Task GetLinkDefinitionsAsync_SimplePaging() int maxPageSize = 1; // Initial request - var result = await client.LinkDefinitionsClient.GetLinkDefinitionsAsync(RepositoryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); - Assert.IsNotNull(result); + var linkDefinitionCollectionResponse = await client.LinkDefinitionsClient.ListLinkDefinitionsAsync(RepositoryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); + + Assert.IsNotNull(linkDefinitionCollectionResponse); - if (result.Value.Count == 0) + if (linkDefinitionCollectionResponse.Value.Count == 0) { return; // There's no point testing if we don't have any such item. } - var nextLink = result.OdataNextLink; + var nextLink = linkDefinitionCollectionResponse.OdataNextLink; + Assert.IsNotNull(nextLink); - Assert.IsTrue(result.Value.Count <= maxPageSize); + Assert.IsTrue(linkDefinitionCollectionResponse.Value.Count <= maxPageSize); // Paging request - result = await client.LinkDefinitionsClient.GetLinkDefinitionsNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); - Assert.IsNotNull(result); - Assert.IsTrue(result.Value.Count <= maxPageSize); + linkDefinitionCollectionResponse = await client.LinkDefinitionsClient.ListLinkDefinitionsNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); + + Assert.IsNotNull(linkDefinitionCollectionResponse); + Assert.IsTrue(linkDefinitionCollectionResponse.Value.Count <= maxPageSize); } } } From 188efc485e6c7d0c9fbc0eb273a37147870efe3b Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 13:53:39 -0400 Subject: [PATCH 57/93] Update tests related to listing repositories --- .../Repositories/GetRepositoryListTest.cs | 57 ----------------- .../Repositories/ListRepositoriesTest.cs | 61 +++++++++++++++++++ 2 files changed, 61 insertions(+), 57 deletions(-) delete mode 100644 tests/integration/Repositories/GetRepositoryListTest.cs create mode 100644 tests/integration/Repositories/ListRepositoriesTest.cs diff --git a/tests/integration/Repositories/GetRepositoryListTest.cs b/tests/integration/Repositories/GetRepositoryListTest.cs deleted file mode 100644 index 62fe5bff..00000000 --- a/tests/integration/Repositories/GetRepositoryListTest.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Threading.Tasks; - -namespace Laserfiche.Repository.Api.Client.IntegrationTest.Repositories -{ - [TestClass] - public class GetRepositoryListTest : BaseTest - { - [TestInitialize] - public void Initialize() - { - client = CreateClient(); - } - - [TestMethod] - public async Task GetRepositoryList_ReturnSuccessful() - { - var result = await client.RepositoriesClient.GetRepositoryListAsync().ConfigureAwait(false); - Assert.IsTrue(result.Count > 0, "No repositories found."); - - bool foundRepo = false; - foreach (var repoInfo in result) - { - Assert.IsFalse(string.IsNullOrEmpty(repoInfo.RepoId)); - if (AuthorizationType != AuthorizationType.API_SERVER_USERNAME_PASSWORD) - { - Assert.IsFalse(string.IsNullOrEmpty(repoInfo.WebclientUrl)); - Assert.IsTrue(repoInfo.WebclientUrl.Contains(repoInfo.RepoId)); - } - - if (repoInfo.RepoId.Equals(RepositoryId, System.StringComparison.OrdinalIgnoreCase)) - foundRepo = true; - } - Assert.IsTrue(foundRepo); - } - - [TestMethod] - public async Task GetSelfHostedRepositoryList_ReturnSuccessful() - { - if (AuthorizationType == AuthorizationType.CLOUD_ACCESS_KEY) - { - return; // There's no point testing if it is a cloud environment - } - var result = await RepositoriesClient.GetSelfHostedRepositoryListAsync(BaseUrl).ConfigureAwait(false); - Assert.IsTrue(result.Count > 0, "No repositories found."); - Assert.IsNotNull(result); - bool foundRepo = false; - foreach (var repoInfo in result) - { - Assert.IsFalse(string.IsNullOrEmpty(repoInfo.RepoId)); - if (repoInfo.RepoId.Equals(RepositoryId, System.StringComparison.OrdinalIgnoreCase)) - foundRepo = true; - } - Assert.IsTrue(foundRepo); - } - } -} diff --git a/tests/integration/Repositories/ListRepositoriesTest.cs b/tests/integration/Repositories/ListRepositoriesTest.cs new file mode 100644 index 00000000..3dd8b8e7 --- /dev/null +++ b/tests/integration/Repositories/ListRepositoriesTest.cs @@ -0,0 +1,61 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Threading.Tasks; + +namespace Laserfiche.Repository.Api.Client.IntegrationTest.Repositories +{ + [TestClass] + public class ListRepositoriesTest : BaseTest + { + [TestInitialize] + public void Initialize() + { + client = CreateClient(); + } + + [TestMethod] + public async Task ListRepositories_ReturnSuccessful() + { + var repositoryCollectionResponse = await client.RepositoriesClient.ListRepositoriesAsync().ConfigureAwait(false); + AssertCollectionResponse(repositoryCollectionResponse); + + bool repositoryFound = false; + foreach (var repository in repositoryCollectionResponse.Value) + { + Assert.IsFalse(string.IsNullOrEmpty(repository.Id)); + + if (AuthorizationType != AuthorizationType.API_SERVER_USERNAME_PASSWORD) + { + Assert.IsFalse(string.IsNullOrEmpty(repository.WebClientUrl)); + Assert.IsTrue(repository.WebClientUrl.Contains(repository.Id)); + } + + if (repository.Id.Equals(RepositoryId, System.StringComparison.OrdinalIgnoreCase)) + repositoryFound = true; + } + + Assert.IsTrue(repositoryFound); + } + + [TestMethod] + public async Task GetSelfHostedRepositoryList_ReturnSuccessful() + { + if (AuthorizationType == AuthorizationType.CLOUD_ACCESS_KEY) + { + return; // There's no point testing if it is a cloud environment + } + var repositoryCollectionResponse = await RepositoriesClient.GetSelfHostedRepositoryListAsync(BaseUrl).ConfigureAwait(false); + AssertCollectionResponse(repositoryCollectionResponse); + + bool repositoryFound = false; + foreach (var repository in repositoryCollectionResponse.Value) + { + Assert.IsFalse(string.IsNullOrEmpty(repository.Id)); + + if (repository.Id.Equals(RepositoryId, System.StringComparison.OrdinalIgnoreCase)) + repositoryFound = true; + } + + Assert.IsTrue(repositoryFound); + } + } +} From c8f7c3f4681cd35433ffc7bee15834859d285d62 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 15:59:53 -0400 Subject: [PATCH 58/93] Tests can run on .NET 6 --- .../Laserfiche.Repository.Api.Client.IntegrationTest.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/Laserfiche.Repository.Api.Client.IntegrationTest.csproj b/tests/integration/Laserfiche.Repository.Api.Client.IntegrationTest.csproj index 4323294c..01336e25 100644 --- a/tests/integration/Laserfiche.Repository.Api.Client.IntegrationTest.csproj +++ b/tests/integration/Laserfiche.Repository.Api.Client.IntegrationTest.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;net6.0 + net6.0 false Laserfiche Apache License 2.0 From 05104fad0cafffb168e51ed8eda75b62f082a44c Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 16:02:43 -0400 Subject: [PATCH 59/93] More readable --- tests/integration/BaseTest.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/integration/BaseTest.cs b/tests/integration/BaseTest.cs index 96ff12bd..cf79fd58 100644 --- a/tests/integration/BaseTest.cs +++ b/tests/integration/BaseTest.cs @@ -1,4 +1,5 @@ using Laserfiche.Api.Client.OAuth; +using Microsoft.IdentityModel.Tokens; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.IO; @@ -245,5 +246,10 @@ protected static void AssertCollectionResponse(TemplateDefinitionCollectionRespo Assert.IsTrue(response.Value.Count > 0); Assert.IsNotNull(response.Value[0]); } + + protected static void AssertIsNotNullOrEmpty(string value) + { + Assert.IsFalse(value.IsNullOrEmpty()); + } } } From f76d7d94987a26527a8f71ac278a9fd587bc26ac Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 16:08:30 -0400 Subject: [PATCH 60/93] Use new assertion --- tests/integration/Attributes/GetAttributeTest.cs | 2 +- tests/integration/Entries/StartDeleteEntryTest.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/Attributes/GetAttributeTest.cs b/tests/integration/Attributes/GetAttributeTest.cs index 87c9dfff..1c40f784 100644 --- a/tests/integration/Attributes/GetAttributeTest.cs +++ b/tests/integration/Attributes/GetAttributeTest.cs @@ -22,7 +22,7 @@ public async Task GetAttribute_ReturnAttribute() Assert.IsTrue(attributeKeys.Count > 0, "No attribute keys exist on the user."); var attribute = await client.AttributesClient.GetAttributeAsync(RepositoryId, attributeKeys.First().Key).ConfigureAwait(false); - Assert.IsTrue(!string.IsNullOrEmpty(attribute.Value)); + AssertIsNotNullOrEmpty(attribute.Value); } } } diff --git a/tests/integration/Entries/StartDeleteEntryTest.cs b/tests/integration/Entries/StartDeleteEntryTest.cs index d8499ae0..0569c409 100644 --- a/tests/integration/Entries/StartDeleteEntryTest.cs +++ b/tests/integration/Entries/StartDeleteEntryTest.cs @@ -20,7 +20,7 @@ public async Task DeleteEntry_ReturnOperationToken() StartDeleteEntryRequest body = new(); var response = await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, deleteEntry.Id, body).ConfigureAwait(false); - Assert.IsTrue(!string.IsNullOrEmpty(response.TaskId)); + AssertIsNotNullOrEmpty(response.TaskId); } } } From 3921c2892d3ed4f505ce42cc3bd4a2211df5319f Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 16:56:10 -0400 Subject: [PATCH 61/93] Update all search API releated tests --- ...rchOperationTest.cs => CancelTasksTest.cs} | 18 +-- .../Searches/GetSearchContextHitsTest.cs | 96 ------------- .../Searches/GetSearchResultsTest.cs | 116 ---------------- .../Searches/GetSearchStatusTest.cs | 47 ------- .../Searches/ListSearchContextHitsTest.cs | 105 ++++++++++++++ .../Searches/ListSearchResultsTest.cs | 129 ++++++++++++++++++ tests/integration/Searches/ListTasksTest.cs | 53 +++++++ ...erationTest.cs => StartSearchEntryTest.cs} | 18 +-- 8 files changed, 305 insertions(+), 277 deletions(-) rename tests/integration/Searches/{CloseSearchOperationTest.cs => CancelTasksTest.cs} (55%) delete mode 100644 tests/integration/Searches/GetSearchContextHitsTest.cs delete mode 100644 tests/integration/Searches/GetSearchResultsTest.cs delete mode 100644 tests/integration/Searches/GetSearchStatusTest.cs create mode 100644 tests/integration/Searches/ListSearchContextHitsTest.cs create mode 100644 tests/integration/Searches/ListSearchResultsTest.cs create mode 100644 tests/integration/Searches/ListTasksTest.cs rename tests/integration/Searches/{CreateSearchOperationTest.cs => StartSearchEntryTest.cs} (53%) diff --git a/tests/integration/Searches/CloseSearchOperationTest.cs b/tests/integration/Searches/CancelTasksTest.cs similarity index 55% rename from tests/integration/Searches/CloseSearchOperationTest.cs rename to tests/integration/Searches/CancelTasksTest.cs index 3295b570..f3add0f7 100644 --- a/tests/integration/Searches/CloseSearchOperationTest.cs +++ b/tests/integration/Searches/CancelTasksTest.cs @@ -4,23 +4,23 @@ namespace Laserfiche.Repository.Api.Client.IntegrationTest.Searches { [TestClass] - public class CloseSearchOperationTest : BaseTest + public class CancelTasksTest : BaseTest { - string token; + string taskId; [TestInitialize] public void Initialize() { client = CreateClient(); - token = ""; + taskId = ""; } [TestCleanup] public async Task Cleanup() { - if (!string.IsNullOrEmpty(token)) + if (!string.IsNullOrEmpty(taskId)) { - await client.SearchesClient.CancelOrCloseSearchAsync(RepositoryId, token).ConfigureAwait(false); + await client.TasksClient.CancelTasksAsync(taskId).ConfigureAwait(false); } } @@ -28,13 +28,13 @@ public async Task Cleanup() public async Task CloseSearchOperation_CloseSearch() { // Create search - var request = new AdvancedSearchRequest() + var request = new StartSearchEntryRequest() { SearchCommand = "({LF:Basic ~= \"search text\", option=\"DFANLT\"})" }; - var operation = await client.SearchesClient.CreateSearchOperationAsync(RepositoryId, request).ConfigureAwait(false); - token = operation.Token; - Assert.IsTrue(!string.IsNullOrEmpty(token)); + var taskResponse = await client.SearchesClient.StartSearchEntryAsync(RepositoryId, request).ConfigureAwait(false); + + AssertIsNotNullOrEmpty(taskResponse.TaskId); } } } diff --git a/tests/integration/Searches/GetSearchContextHitsTest.cs b/tests/integration/Searches/GetSearchContextHitsTest.cs deleted file mode 100644 index 8d779e5e..00000000 --- a/tests/integration/Searches/GetSearchContextHitsTest.cs +++ /dev/null @@ -1,96 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Linq; -using System.Threading.Tasks; - -namespace Laserfiche.Repository.Api.Client.IntegrationTest.Searches -{ - [TestClass] - public class GetSearchContextHitsTest : BaseTest - { - string token; - - [TestInitialize] - public void Initialize() - { - client = CreateClient(); - token = ""; - } - - [TestCleanup] - public async Task Cleanup() - { - if (!string.IsNullOrEmpty(token)) - { - await client.SearchesClient.CancelOrCloseSearchAsync(RepositoryId, token).ConfigureAwait(false); - } - } - - [TestMethod] - public async Task GetSearchContextHits_ReturnContextHits() - { - // Create search - var request = new AdvancedSearchRequest() - { - SearchCommand = "({LF:Basic ~= \"*\", option=\"DFANLT\"})" - }; - var operation = await client.SearchesClient.CreateSearchOperationAsync(RepositoryId, request).ConfigureAwait(false); - token = operation.Token; - Assert.IsTrue(!string.IsNullOrEmpty(token)); - - await Task.Delay(5000).ConfigureAwait(false); - - // Get search results - var searchResultsResponse = await client.SearchesClient.GetSearchResultsAsync(RepositoryId, token).ConfigureAwait(false); - var searchResults = searchResultsResponse.Value; - Assert.IsNotNull(searchResults); - Assert.IsTrue(searchResults.Count > 0, "No search results found. Cannot get context hits."); - int rowNumber = searchResults.First().RowNumber; - - // Get context hits - var contextHitsResponse = await client.SearchesClient.GetSearchContextHitsAsync(RepositoryId, token, rowNumber).ConfigureAwait(false); - var contextHits = contextHitsResponse.Value; - Assert.IsNotNull(contextHits); - } - - [TestMethod] - public async Task GetSearchContextHits_ForEachPaging() - { - int maxPageSize = 10; - - // Create search - var request = new AdvancedSearchRequest() - { - SearchCommand = "({LF:Basic ~= \"*\", option=\"DFANLT\"})" - }; - var operation = await client.SearchesClient.CreateSearchOperationAsync(RepositoryId, request).ConfigureAwait(false); - token = operation.Token; - Assert.IsTrue(!string.IsNullOrEmpty(token)); - - await Task.Delay(5000).ConfigureAwait(false); - - // Get search results - var searchResultsResponse = await client.SearchesClient.GetSearchResultsAsync(RepositoryId, token).ConfigureAwait(false); - var searchResults = searchResultsResponse.Value; - Assert.IsNotNull(searchResults); - Assert.IsTrue(searchResults.Count > 0, "No search results found. Cannot get context hits."); - int rowNumber = searchResults.First().RowNumber; - - Task PagingCallback(ODataValueContextOfIListOfContextHit data) - { - if (data.OdataNextLink != null) - { - Assert.AreNotEqual(0, data.Value.Count); - Assert.IsTrue(data.Value.Count <= maxPageSize); - return Task.FromResult(true); - } - else - { - return Task.FromResult(false); - } - } - - await client.SearchesClient.GetSearchContextHitsForEachAsync(PagingCallback, RepositoryId, token, rowNumber, maxPageSize: maxPageSize).ConfigureAwait(false); - await Task.Delay(5000).ConfigureAwait(false); - } - } -} diff --git a/tests/integration/Searches/GetSearchResultsTest.cs b/tests/integration/Searches/GetSearchResultsTest.cs deleted file mode 100644 index 9b46c002..00000000 --- a/tests/integration/Searches/GetSearchResultsTest.cs +++ /dev/null @@ -1,116 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Threading.Tasks; - -namespace Laserfiche.Repository.Api.Client.IntegrationTest.Searches -{ - [TestClass] - public class GetSearchResultsTest : BaseTest - { - string token; - - [TestInitialize] - public void Initialize() - { - client = CreateClient(); - token = ""; - } - - [TestCleanup] - public async Task Cleanup() - { - if (!string.IsNullOrEmpty(token)) - { - await client.SearchesClient.CancelOrCloseSearchAsync(RepositoryId, token).ConfigureAwait(false); - } - } - - [TestMethod] - public async Task GetSearchResults_ReturnSearchResults() - { - // Create search - var request = new AdvancedSearchRequest() - { - SearchCommand = "({LF:Basic ~= \"search text\", option=\"DFANLT\"})" - }; - var searchResult = await client.SearchesClient.CreateSearchOperationAsync(RepositoryId, request).ConfigureAwait(false); - token = searchResult.Token; - Assert.IsTrue(!string.IsNullOrEmpty(token)); - - await Task.Delay(10000).ConfigureAwait(false); - - // Get search results - var searchResultsResult = await client.SearchesClient.GetSearchResultsAsync(RepositoryId, token).ConfigureAwait(false); - var searchResults = searchResultsResult.Value; - Assert.IsNotNull(searchResults); - } - - [TestMethod] - public async Task GetSearchResults_ForEachPaging() - { - int maxPageSize = 90; - - // Create search - var request = new AdvancedSearchRequest() - { - SearchCommand = "({LF:Basic ~= \"search text\", option=\"NLT\"})" - }; - var operation = await client.SearchesClient.CreateSearchOperationAsync(RepositoryId, request).ConfigureAwait(false); - token = operation.Token; - Assert.IsTrue(!string.IsNullOrEmpty(token)); - - await Task.Delay(10000).ConfigureAwait(false); - - Task PagingCallback(ODataValueContextOfIListOfEntry data) - { - if (data.OdataNextLink != null) - { - Assert.AreNotEqual(0, data.Value.Count); - Assert.IsTrue(data.Value.Count <= maxPageSize); - return Task.FromResult(true); - } - else - { - return Task.FromResult(false); - } - } - - await client.SearchesClient.GetSearchResultsForEachAsync(PagingCallback, RepositoryId, token, maxPageSize: maxPageSize).ConfigureAwait(false); - await Task.Delay(5000).ConfigureAwait(false); - } - - [TestMethod] - public async Task GetSearchResults_SimplePaging() - { - int maxPageSize = 1; - - // Create search first - var request = new AdvancedSearchRequest() - { - SearchCommand = "({LF:Basic ~= \"search text\", option=\"NLT\"})" - }; - var operation = await client.SearchesClient.CreateSearchOperationAsync(RepositoryId, request).ConfigureAwait(false); - token = operation.Token; - Assert.IsTrue(!string.IsNullOrEmpty(token)); - - await Task.Delay(10000).ConfigureAwait(false); - - // Initial request - var result = await client.SearchesClient.GetSearchResultsAsync(RepositoryId, token, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); - Assert.IsNotNull(result); - - if (result.Value.Count <= maxPageSize) - { - return; // There's no point testing if the items do not need more than one page or do not exist. - } - - var nextLink = result.OdataNextLink; - Assert.IsNotNull(nextLink); - Assert.IsTrue(result.Value.Count <= maxPageSize); - - // Paging request - result = await client.SearchesClient.GetSearchResultsNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); - Assert.IsNotNull(result); - Assert.IsTrue(result.Value.Count <= maxPageSize); - } - } -} diff --git a/tests/integration/Searches/GetSearchStatusTest.cs b/tests/integration/Searches/GetSearchStatusTest.cs deleted file mode 100644 index 17a878b4..00000000 --- a/tests/integration/Searches/GetSearchStatusTest.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Threading.Tasks; - -namespace Laserfiche.Repository.Api.Client.IntegrationTest.Searches -{ - [TestClass] - public class GetSearchStatusTest : BaseTest - { - string token; - - [TestInitialize] - public void Initialize() - { - client = CreateClient(); - token = ""; - } - - [TestCleanup] - public async Task Cleanup() - { - if (!string.IsNullOrEmpty(token)) - { - await client.SearchesClient.CancelOrCloseSearchAsync(RepositoryId, token).ConfigureAwait(false); - } - } - - [TestMethod] - public async Task GetSearchStatus_ReturnSearchStatus() - { - // Create search - var request = new AdvancedSearchRequest() - { - SearchCommand = "({LF:Basic ~= \"search text\", option=\"DFANLT\"})" - }; - var operation = await client.SearchesClient.CreateSearchOperationAsync(RepositoryId, request).ConfigureAwait(false); - token = operation.Token; - Assert.IsTrue(!string.IsNullOrEmpty(token)); - - await Task.Delay(5000).ConfigureAwait(false); - - // Get search status - var searchStatus = await client.SearchesClient.GetSearchStatusAsync(RepositoryId, token).ConfigureAwait(false); - Assert.IsNotNull(searchStatus); - Assert.AreEqual(token, searchStatus.OperationToken); - } - } -} diff --git a/tests/integration/Searches/ListSearchContextHitsTest.cs b/tests/integration/Searches/ListSearchContextHitsTest.cs new file mode 100644 index 00000000..bc3dd2f8 --- /dev/null +++ b/tests/integration/Searches/ListSearchContextHitsTest.cs @@ -0,0 +1,105 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Linq; +using System.Threading.Tasks; + +namespace Laserfiche.Repository.Api.Client.IntegrationTest.Searches +{ + [TestClass] + public class ListSearchContextHitsTest : BaseTest + { + string taskId; + + [TestInitialize] + public void Initialize() + { + client = CreateClient(); + taskId = ""; + } + + [TestCleanup] + public async Task Cleanup() + { + if (!string.IsNullOrEmpty(taskId)) + { + await client.TasksClient.CancelTasksAsync(taskId).ConfigureAwait(false); + } + } + + [TestMethod] + public async Task GetSearchContextHits_ReturnContextHits() + { + // Create search + var request = new StartSearchEntryRequest() + { + SearchCommand = "({LF:Basic ~= \"*\", option=\"DFANLT\"})" + }; + var taskResponse = await client.SearchesClient.StartSearchEntryAsync(RepositoryId, request).ConfigureAwait(false); + + AssertIsNotNullOrEmpty(taskResponse.TaskId); + + await Task.Delay(5000).ConfigureAwait(false); + + // Get search results + var entryCollectionResponse = await client.SearchesClient.ListSearchResultsAsync(RepositoryId, taskId).ConfigureAwait(false); + + AssertCollectionResponse(entryCollectionResponse); + + var searchResults = entryCollectionResponse.Value; + + Assert.IsNotNull(searchResults.First().RowNumber); + + var rowNumber = (int)searchResults.First().RowNumber; + + // Get context hits + var contextHitsCollectionResponse = await client.SearchesClient.ListSearchContextHitsAsync(RepositoryId, taskId, rowNumber).ConfigureAwait(false); + + AssertCollectionResponse(contextHitsCollectionResponse); + } + + [TestMethod] + public async Task GetSearchContextHits_ForEachPaging() + { + int maxPageSize = 10; + + // Create search + var request = new StartSearchEntryRequest() + { + SearchCommand = "({LF:Basic ~= \"*\", option=\"DFANLT\"})" + }; + + var taskResponse = await client.SearchesClient.StartSearchEntryAsync(RepositoryId, request).ConfigureAwait(false); + taskId = taskResponse.TaskId; + + AssertIsNotNullOrEmpty(taskId); + + await Task.Delay(5000).ConfigureAwait(false); + + // Get search results + var entryCollectionResponse = await client.SearchesClient.ListSearchResultsAsync(RepositoryId, taskId).ConfigureAwait(false); + var searchResults = entryCollectionResponse.Value; + + AssertCollectionResponse(entryCollectionResponse); + Assert.IsNotNull(searchResults.First().RowNumber); + + var rowNumber = (int)searchResults.First().RowNumber; + + Task PagingCallback(SearchContextHitCollectionResponse data) + { + if (data.OdataNextLink != null) + { + Assert.AreNotEqual(0, data.Value.Count); + Assert.IsTrue(data.Value.Count <= maxPageSize); + + return Task.FromResult(true); + } + else + { + return Task.FromResult(false); + } + } + + await client.SearchesClient.ListSearchContextHitsForEachAsync(PagingCallback, RepositoryId, taskId, rowNumber, maxPageSize: maxPageSize).ConfigureAwait(false); + await Task.Delay(5000).ConfigureAwait(false); + } + } +} diff --git a/tests/integration/Searches/ListSearchResultsTest.cs b/tests/integration/Searches/ListSearchResultsTest.cs new file mode 100644 index 00000000..ebf9fd82 --- /dev/null +++ b/tests/integration/Searches/ListSearchResultsTest.cs @@ -0,0 +1,129 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Threading.Tasks; + +namespace Laserfiche.Repository.Api.Client.IntegrationTest.Searches +{ + [TestClass] + public class ListSearchResultsTest : BaseTest + { + string taskId; + + [TestInitialize] + public void Initialize() + { + client = CreateClient(); + taskId = ""; + } + + [TestCleanup] + public async Task Cleanup() + { + if (!string.IsNullOrEmpty(taskId)) + { + await client.TasksClient.CancelTasksAsync(taskId).ConfigureAwait(false); + } + } + + [TestMethod] + public async Task GetSearchResults_ReturnSearchResults() + { + // Create search + var request = new StartSearchEntryRequest() + { + SearchCommand = "({LF:Basic ~= \"search text\", option=\"DFANLT\"})" + }; + var taskResponse = await client.SearchesClient.StartSearchEntryAsync(RepositoryId, request).ConfigureAwait(false); + taskId = taskResponse.TaskId; + + AssertIsNotNullOrEmpty(taskId); + + await Task.Delay(10000).ConfigureAwait(false); + + // Get search results + var entryCollectionResponse = await client.SearchesClient.ListSearchResultsAsync(RepositoryId, taskId).ConfigureAwait(false); + + AssertCollectionResponse(entryCollectionResponse); + + var searchResults = entryCollectionResponse.Value; + + Assert.IsNotNull(searchResults); + } + + [TestMethod] + public async Task GetSearchResults_ForEachPaging() + { + int maxPageSize = 90; + + // Create search + var request = new StartSearchEntryRequest() + { + SearchCommand = "({LF:Basic ~= \"search text\", option=\"NLT\"})" + }; + + var taskResponse = await client.SearchesClient.StartSearchEntryAsync(RepositoryId, request).ConfigureAwait(false); + + taskId = taskResponse.TaskId; + + AssertIsNotNullOrEmpty(taskId); + + await Task.Delay(10000).ConfigureAwait(false); + + Task PagingCallback(EntryCollectionResponse data) + { + if (data.OdataNextLink != null) + { + Assert.AreNotEqual(0, data.Value.Count); + Assert.IsTrue(data.Value.Count <= maxPageSize); + + return Task.FromResult(true); + } + else + { + return Task.FromResult(false); + } + } + + await client.SearchesClient.ListSearchResultsForEachAsync(PagingCallback, RepositoryId, taskId, maxPageSize: maxPageSize).ConfigureAwait(false); + await Task.Delay(5000).ConfigureAwait(false); + } + + [TestMethod] + public async Task GetSearchResults_SimplePaging() + { + int maxPageSize = 1; + + // Create search first + var request = new StartSearchEntryRequest() + { + SearchCommand = "({LF:Basic ~= \"search text\", option=\"NLT\"})" + }; + var taskResponse = await client.SearchesClient.StartSearchEntryAsync(RepositoryId, request).ConfigureAwait(false); + taskId = taskResponse.TaskId; + + Assert.IsTrue(!string.IsNullOrEmpty(taskId)); + AssertIsNotNullOrEmpty(taskId); + + await Task.Delay(10000).ConfigureAwait(false); + + // Initial request + var entryCollectionResponse = await client.SearchesClient.ListSearchResultsAsync(RepositoryId, taskId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); + + Assert.IsNotNull(entryCollectionResponse); + + if (entryCollectionResponse.Value.Count <= maxPageSize) + { + return; // There's no point testing if the items do not need more than one page or do not exist. + } + + var nextLink = entryCollectionResponse.OdataNextLink; + Assert.IsNotNull(nextLink); + Assert.IsTrue(entryCollectionResponse.Value.Count <= maxPageSize); + + // Paging request + entryCollectionResponse = await client.SearchesClient.ListSearchResultsNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); + + Assert.IsNotNull(entryCollectionResponse); + Assert.IsTrue(entryCollectionResponse.Value.Count <= maxPageSize); + } + } +} diff --git a/tests/integration/Searches/ListTasksTest.cs b/tests/integration/Searches/ListTasksTest.cs new file mode 100644 index 00000000..79fcbc2f --- /dev/null +++ b/tests/integration/Searches/ListTasksTest.cs @@ -0,0 +1,53 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Linq; +using System.Threading.Tasks; + +namespace Laserfiche.Repository.Api.Client.IntegrationTest.Searches +{ + [TestClass] + public class ListTasksTest : BaseTest + { + string taskId; + + [TestInitialize] + public void Initialize() + { + client = CreateClient(); + taskId = ""; + } + + [TestCleanup] + public async Task Cleanup() + { + if (!string.IsNullOrEmpty(taskId)) + { + await client.TasksClient.CancelTasksAsync(taskId).ConfigureAwait(false); + } + } + + [TestMethod] + public async Task GetSearchStatus_ReturnSearchStatus() + { + // Create search + var request = new StartSearchEntryRequest() + { + SearchCommand = "({LF:Basic ~= \"search text\", option=\"DFANLT\"})" + }; + var taskResponse = await client.SearchesClient.StartSearchEntryAsync(RepositoryId, request).ConfigureAwait(false); + taskId = taskResponse.TaskId; + + AssertIsNotNullOrEmpty(taskId); + + await Task.Delay(5000).ConfigureAwait(false); + + // Get search status + var taskCollectionResponse = await client.TasksClient.ListTasksAsync(RepositoryId).ConfigureAwait(false); + + AssertCollectionResponse(taskCollectionResponse); + + var searchTaskId = taskCollectionResponse.Value.First(t => t.Id == taskId); + + Assert.AreEqual(taskId, searchTaskId); + } + } +} diff --git a/tests/integration/Searches/CreateSearchOperationTest.cs b/tests/integration/Searches/StartSearchEntryTest.cs similarity index 53% rename from tests/integration/Searches/CreateSearchOperationTest.cs rename to tests/integration/Searches/StartSearchEntryTest.cs index b74a19ec..0aec2d14 100644 --- a/tests/integration/Searches/CreateSearchOperationTest.cs +++ b/tests/integration/Searches/StartSearchEntryTest.cs @@ -4,36 +4,36 @@ namespace Laserfiche.Repository.Api.Client.IntegrationTest.Searches { [TestClass] - public class CreateSearchOperationTest : BaseTest + public class StartSearchEntryTest : BaseTest { - string token; + string taskId; [TestInitialize] public void Initialize() { client = CreateClient(); - token = ""; + taskId = ""; } [TestCleanup] public async Task Cleanup() { - if (!string.IsNullOrEmpty(token)) + if (!string.IsNullOrEmpty(taskId)) { - await client.SearchesClient.CancelOrCloseSearchAsync(RepositoryId, token).ConfigureAwait(false); + await client.TasksClient.CancelTasksAsync(taskId).ConfigureAwait(false); } } [TestMethod] public async Task CreateSearchOperation_ReturnToken() { - var request = new AdvancedSearchRequest() + var request = new StartSearchEntryRequest() { SearchCommand = "({LF:Basic ~= \"search text\", option=\"DFANLT\"})" }; - var operation = await client.SearchesClient.CreateSearchOperationAsync(RepositoryId, request).ConfigureAwait(false); - token = operation.Token; - Assert.IsTrue(!string.IsNullOrEmpty(token)); + var taskResponse = await client.SearchesClient.StartSearchEntryAsync(RepositoryId, request).ConfigureAwait(false); + + AssertIsNotNullOrEmpty(taskResponse.TaskId); } } } From ce01c67d93b875b81190b44cbcf8cbe0e3f36b3d Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 16:57:40 -0400 Subject: [PATCH 62/93] Update tests realted to simple search API --- tests/integration/SimpleSearches/SimpleSearchTest.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/integration/SimpleSearches/SimpleSearchTest.cs b/tests/integration/SimpleSearches/SimpleSearchTest.cs index a5eb2420..f41558f3 100644 --- a/tests/integration/SimpleSearches/SimpleSearchTest.cs +++ b/tests/integration/SimpleSearches/SimpleSearchTest.cs @@ -19,9 +19,10 @@ public async Task Initialize() [TestMethod] public async Task SimpleSearch_ReturnSearchResults() { - var request = new SimpleSearchRequest() { SearchCommand = "({LF:Basic ~= \"search text\", option=\"DFANLT\"})" }; - var result = await client.SimpleSearchesClient.CreateSimpleSearchOperationAsync(RepositoryId, request: request).ConfigureAwait(false); - Assert.IsNotNull(result.Value); + var request = new SearchEntryRequest() { SearchCommand = "({LF:Basic ~= \"search text\", option=\"DFANLT\"})" }; + var entryCollectionResponse = await client.SimpleSearchesClient.SearchEntryAsync(RepositoryId, request: request).ConfigureAwait(false); + + AssertCollectionResponse(entryCollectionResponse); } [TestCleanup] From 87ab792b88ef5689a97aaa6455b9508cdc2d9469 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 17:03:23 -0400 Subject: [PATCH 63/93] Update tag definition API related tests --- tests/integration/BaseTest.cs | 8 ++ ...onsByIdTest.cs => GetTagDefinitionTest.cs} | 11 +-- .../TagDefinitions/GetTagDefinitionsTest.cs | 73 ----------------- .../TagDefinitions/ListTagDefinitionsTest.cs | 79 +++++++++++++++++++ 4 files changed, 93 insertions(+), 78 deletions(-) rename tests/integration/TagDefinitions/{GetTagDefinitionsByIdTest.cs => GetTagDefinitionTest.cs} (59%) delete mode 100644 tests/integration/TagDefinitions/GetTagDefinitionsTest.cs create mode 100644 tests/integration/TagDefinitions/ListTagDefinitionsTest.cs diff --git a/tests/integration/BaseTest.cs b/tests/integration/BaseTest.cs index cf79fd58..f2b4449a 100644 --- a/tests/integration/BaseTest.cs +++ b/tests/integration/BaseTest.cs @@ -207,6 +207,14 @@ protected static void AssertCollectionResponse(TagCollectionResponse response) Assert.IsNotNull(response.Value[0]); } + protected static void AssertCollectionResponse(TagDefinitionCollectionResponse response) + { + Assert.IsNotNull(response); + Assert.IsNotNull(response.Value); + Assert.IsTrue(response.Value.Count > 0); + Assert.IsNotNull(response.Value[0]); + } + protected static void AssertCollectionResponse(LinkCollectionResponse response) { Assert.IsNotNull(response); diff --git a/tests/integration/TagDefinitions/GetTagDefinitionsByIdTest.cs b/tests/integration/TagDefinitions/GetTagDefinitionTest.cs similarity index 59% rename from tests/integration/TagDefinitions/GetTagDefinitionsByIdTest.cs rename to tests/integration/TagDefinitions/GetTagDefinitionTest.cs index 016ed3ad..5416f9b0 100644 --- a/tests/integration/TagDefinitions/GetTagDefinitionsByIdTest.cs +++ b/tests/integration/TagDefinitions/GetTagDefinitionTest.cs @@ -5,7 +5,7 @@ namespace Laserfiche.Repository.Api.Client.IntegrationTest.TagDefinitions { [TestClass] - public class GetTagDefinitionsByIdTest : BaseTest + public class GetTagDefinitionTest : BaseTest { [TestInitialize] public void Initialize() @@ -14,13 +14,14 @@ public void Initialize() } [TestMethod] - public async Task GetTagDefinitionsById_ReturnTag() + public async Task GetTagDefinition_ReturnTag() { - var allTagDefinitionsResult = await client.TagDefinitionsClient.GetTagDefinitionsAsync(RepositoryId).ConfigureAwait(false); - var firstTagDefinition = allTagDefinitionsResult.Value?.FirstOrDefault(); + var tagDefinitionCollectionResponse = await client.TagDefinitionsClient.ListTagDefinitionsAsync(RepositoryId).ConfigureAwait(false); + var firstTagDefinition = tagDefinitionCollectionResponse.Value?.FirstOrDefault(); + Assert.IsNotNull(firstTagDefinition, "No tag definitions exist in the repository."); - var tagDefinition = await client.TagDefinitionsClient.GetTagDefinitionByIdAsync(RepositoryId, firstTagDefinition.Id).ConfigureAwait(false); + var tagDefinition = await client.TagDefinitionsClient.GetTagDefinitionAsync(RepositoryId, firstTagDefinition.Id).ConfigureAwait(false); Assert.IsNotNull(tagDefinition); Assert.AreEqual(firstTagDefinition.Id, tagDefinition.Id); diff --git a/tests/integration/TagDefinitions/GetTagDefinitionsTest.cs b/tests/integration/TagDefinitions/GetTagDefinitionsTest.cs deleted file mode 100644 index 8e488035..00000000 --- a/tests/integration/TagDefinitions/GetTagDefinitionsTest.cs +++ /dev/null @@ -1,73 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Threading.Tasks; - -namespace Laserfiche.Repository.Api.Client.IntegrationTest.TagDefinitions -{ - [TestClass] - public class GetTagDefinitionsTest : BaseTest - { - [TestInitialize] - public void Initialize() - { - client = CreateClient(); - } - - [TestMethod] - public async Task GetTagDefinitions_ReturnAllTags() - { - var result = await client.TagDefinitionsClient.GetTagDefinitionsAsync(RepositoryId).ConfigureAwait(false); - Assert.IsNotNull(result.Value); - } - - [TestMethod] - public async Task GetTagDefinitions_ForEachPaging() - { - int maxPageSize = 10; - - Task PagingCallback(ODataValueContextOfIListOfWTagInfo data) - { - if (data.OdataNextLink != null) - { - Assert.AreNotEqual(0, data.Value.Count); - Assert.IsTrue(data.Value.Count <= maxPageSize); - return Task.FromResult(true); - } - else - { - return Task.FromResult(false); - } - } - - await client.TagDefinitionsClient.GetTagDefinitionsForEachAsync(PagingCallback, RepositoryId, maxPageSize: maxPageSize).ConfigureAwait(false); - await Task.Delay(5000).ConfigureAwait(false); - } - - [TestMethod] - public async Task GetTagDefinitions_SimplePaging() - { - // Get total count of tags - var result = await client.TagDefinitionsClient.GetTagDefinitionsAsync(RepositoryId).ConfigureAwait(false); - int tagsCount = result.Value.Count; - - int maxPageSize = 1; - - // Initial request - result = await client.TagDefinitionsClient.GetTagDefinitionsAsync(RepositoryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); - Assert.IsNotNull(result); - Assert.IsTrue(result.Value.Count <= maxPageSize); - - if (result.Value.Count == 0 || tagsCount <= maxPageSize) - { - return; // There's no point testing if we don't have any such item. - } - - var nextLink = result.OdataNextLink; - Assert.IsNotNull(nextLink); - - // Paging request - result = await client.TagDefinitionsClient.GetTagDefinitionsNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); - Assert.IsNotNull(result); - Assert.IsTrue(result.Value.Count <= maxPageSize); - } - } -} diff --git a/tests/integration/TagDefinitions/ListTagDefinitionsTest.cs b/tests/integration/TagDefinitions/ListTagDefinitionsTest.cs new file mode 100644 index 00000000..325860a3 --- /dev/null +++ b/tests/integration/TagDefinitions/ListTagDefinitionsTest.cs @@ -0,0 +1,79 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Threading.Tasks; + +namespace Laserfiche.Repository.Api.Client.IntegrationTest.TagDefinitions +{ + [TestClass] + public class ListTagDefinitionsTest : BaseTest + { + [TestInitialize] + public void Initialize() + { + client = CreateClient(); + } + + [TestMethod] + public async Task ListTagDefinitions_ReturnAllTags() + { + var tagDefinitionCollectionResponse = await client.TagDefinitionsClient.ListTagDefinitionsAsync(RepositoryId).ConfigureAwait(false); + + AssertCollectionResponse(tagDefinitionCollectionResponse); + } + + [TestMethod] + public async Task ListTagDefinitions_ForEachPaging() + { + int maxPageSize = 10; + + Task PagingCallback(TagDefinitionCollectionResponse data) + { + if (data.OdataNextLink != null) + { + Assert.AreNotEqual(0, data.Value.Count); + Assert.IsTrue(data.Value.Count <= maxPageSize); + + return Task.FromResult(true); + } + else + { + return Task.FromResult(false); + } + } + + await client.TagDefinitionsClient.ListTagDefinitionsForEachAsync(PagingCallback, RepositoryId, maxPageSize: maxPageSize).ConfigureAwait(false); + await Task.Delay(5000).ConfigureAwait(false); + } + + [TestMethod] + public async Task ListTagDefinitions_SimplePaging() + { + // Get total count of tags + var tagDefinitionCollectionResponse = await client.TagDefinitionsClient.ListTagDefinitionsAsync(RepositoryId).ConfigureAwait(false); + AssertCollectionResponse(tagDefinitionCollectionResponse); + + int tagCount = tagDefinitionCollectionResponse.Value.Count; + int maxPageSize = 1; + + // Initial request + tagDefinitionCollectionResponse = await client.TagDefinitionsClient.ListTagDefinitionsAsync(RepositoryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); + + Assert.IsNotNull(tagDefinitionCollectionResponse); + Assert.IsTrue(tagDefinitionCollectionResponse.Value.Count <= maxPageSize); + + if (tagDefinitionCollectionResponse.Value.Count == 0 || tagCount <= maxPageSize) + { + return; // There's no point testing if we don't have any such item. + } + + var nextLink = tagDefinitionCollectionResponse.OdataNextLink; + + Assert.IsNotNull(nextLink); + + // Paging request + tagDefinitionCollectionResponse = await client.TagDefinitionsClient.ListTagDefinitionsNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); + + Assert.IsNotNull(tagDefinitionCollectionResponse); + Assert.IsTrue(tagDefinitionCollectionResponse.Value.Count <= maxPageSize); + } + } +} From c7eca09856b4044ab740a183c711c0d8c2b72c77 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Wed, 13 Sep 2023 17:06:28 -0400 Subject: [PATCH 64/93] Update test names since their APIs have changed --- tests/integration/Searches/CancelTasksTest.cs | 2 +- tests/integration/Searches/ListSearchContextHitsTest.cs | 4 ++-- tests/integration/Searches/ListSearchResultsTest.cs | 6 +++--- tests/integration/Searches/ListTasksTest.cs | 2 +- tests/integration/Searches/StartSearchEntryTest.cs | 2 +- tests/integration/SimpleSearches/SimpleSearchTest.cs | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/integration/Searches/CancelTasksTest.cs b/tests/integration/Searches/CancelTasksTest.cs index f3add0f7..b7f5137c 100644 --- a/tests/integration/Searches/CancelTasksTest.cs +++ b/tests/integration/Searches/CancelTasksTest.cs @@ -25,7 +25,7 @@ public async Task Cleanup() } [TestMethod] - public async Task CloseSearchOperation_CloseSearch() + public async Task CancelTasks_CancelSearchTasks() { // Create search var request = new StartSearchEntryRequest() diff --git a/tests/integration/Searches/ListSearchContextHitsTest.cs b/tests/integration/Searches/ListSearchContextHitsTest.cs index bc3dd2f8..1e1bfc4e 100644 --- a/tests/integration/Searches/ListSearchContextHitsTest.cs +++ b/tests/integration/Searches/ListSearchContextHitsTest.cs @@ -26,7 +26,7 @@ public async Task Cleanup() } [TestMethod] - public async Task GetSearchContextHits_ReturnContextHits() + public async Task ListSearchContextHits_ReturnContextHits() { // Create search var request = new StartSearchEntryRequest() @@ -57,7 +57,7 @@ public async Task GetSearchContextHits_ReturnContextHits() } [TestMethod] - public async Task GetSearchContextHits_ForEachPaging() + public async Task ListSearchContextHits_ForEachPaging() { int maxPageSize = 10; diff --git a/tests/integration/Searches/ListSearchResultsTest.cs b/tests/integration/Searches/ListSearchResultsTest.cs index ebf9fd82..f9127161 100644 --- a/tests/integration/Searches/ListSearchResultsTest.cs +++ b/tests/integration/Searches/ListSearchResultsTest.cs @@ -25,7 +25,7 @@ public async Task Cleanup() } [TestMethod] - public async Task GetSearchResults_ReturnSearchResults() + public async Task ListSearchResults_ReturnSearchResults() { // Create search var request = new StartSearchEntryRequest() @@ -50,7 +50,7 @@ public async Task GetSearchResults_ReturnSearchResults() } [TestMethod] - public async Task GetSearchResults_ForEachPaging() + public async Task ListSearchResults_ForEachPaging() { int maxPageSize = 90; @@ -88,7 +88,7 @@ Task PagingCallback(EntryCollectionResponse data) } [TestMethod] - public async Task GetSearchResults_SimplePaging() + public async Task ListSearchResults_SimplePaging() { int maxPageSize = 1; diff --git a/tests/integration/Searches/ListTasksTest.cs b/tests/integration/Searches/ListTasksTest.cs index 79fcbc2f..ff41f115 100644 --- a/tests/integration/Searches/ListTasksTest.cs +++ b/tests/integration/Searches/ListTasksTest.cs @@ -26,7 +26,7 @@ public async Task Cleanup() } [TestMethod] - public async Task GetSearchStatus_ReturnSearchStatus() + public async Task StartSearchEntry_ReturnTaskStatus() { // Create search var request = new StartSearchEntryRequest() diff --git a/tests/integration/Searches/StartSearchEntryTest.cs b/tests/integration/Searches/StartSearchEntryTest.cs index 0aec2d14..92d9fffa 100644 --- a/tests/integration/Searches/StartSearchEntryTest.cs +++ b/tests/integration/Searches/StartSearchEntryTest.cs @@ -25,7 +25,7 @@ public async Task Cleanup() } [TestMethod] - public async Task CreateSearchOperation_ReturnToken() + public async Task StartSearchEntry_ReturnTaskId() { var request = new StartSearchEntryRequest() { diff --git a/tests/integration/SimpleSearches/SimpleSearchTest.cs b/tests/integration/SimpleSearches/SimpleSearchTest.cs index f41558f3..240c340a 100644 --- a/tests/integration/SimpleSearches/SimpleSearchTest.cs +++ b/tests/integration/SimpleSearches/SimpleSearchTest.cs @@ -17,7 +17,7 @@ public async Task Initialize() } [TestMethod] - public async Task SimpleSearch_ReturnSearchResults() + public async Task SimpleSearch_SearchEntry() { var request = new SearchEntryRequest() { SearchCommand = "({LF:Basic ~= \"search text\", option=\"DFANLT\"})" }; var entryCollectionResponse = await client.SimpleSearchesClient.SearchEntryAsync(RepositoryId, request: request).ConfigureAwait(false); From de7ccf09f9b4fd4e98b2cfdfc143f3a5d5e43b7c Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Thu, 14 Sep 2023 11:30:09 -0400 Subject: [PATCH 65/93] Update tests related to task listing --- .../Tasks/GetOperationStatusTest.cs | 33 ---------------- tests/integration/Tasks/ListTasksTest.cs | 39 +++++++++++++++++++ 2 files changed, 39 insertions(+), 33 deletions(-) delete mode 100644 tests/integration/Tasks/GetOperationStatusTest.cs create mode 100644 tests/integration/Tasks/ListTasksTest.cs diff --git a/tests/integration/Tasks/GetOperationStatusTest.cs b/tests/integration/Tasks/GetOperationStatusTest.cs deleted file mode 100644 index a34ae785..00000000 --- a/tests/integration/Tasks/GetOperationStatusTest.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Threading.Tasks; - -namespace Laserfiche.Repository.Api.Client.IntegrationTest.Tasks -{ - [TestClass] - public class GetOperationStatusTest : BaseTest - { - [TestInitialize] - public void Initialize() - { - client = CreateClient(); - } - - [TestMethod] - public async Task GetOperationStatus_ReturnStatus() - { - var deleteEntry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net GetOperationStatus").ConfigureAwait(false); - - DeleteEntryWithAuditReason body = new DeleteEntryWithAuditReason(); - var result = await client.EntriesClient.DeleteEntryInfoAsync(RepositoryId, deleteEntry.Id, body).ConfigureAwait(false); - var token = result.Token; - Assert.IsFalse(string.IsNullOrEmpty(token)); - - await Task.Delay(5000).ConfigureAwait(false); - - var operationProgress = await client.TasksClient.GetOperationStatusAndProgressAsync(RepositoryId, token).ConfigureAwait(false); - Assert.IsNotNull(operationProgress); - Assert.AreEqual(OperationStatus.Completed, operationProgress.Status); - Assert.AreEqual(100, operationProgress.PercentComplete); - } - } -} diff --git a/tests/integration/Tasks/ListTasksTest.cs b/tests/integration/Tasks/ListTasksTest.cs new file mode 100644 index 00000000..5e105547 --- /dev/null +++ b/tests/integration/Tasks/ListTasksTest.cs @@ -0,0 +1,39 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Linq; +using System.Threading.Tasks; + +namespace Laserfiche.Repository.Api.Client.IntegrationTest.Tasks +{ + [TestClass] + public class ListTasksTest : BaseTest + { + [TestInitialize] + public void Initialize() + { + client = CreateClient(); + } + + [TestMethod] + public async Task ListTasks_ReturnStatus() + { + var deleteEntry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net GetOperationStatus").ConfigureAwait(false); + + StartDeleteEntryRequest request = new(); + var result = await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, deleteEntry.Id, request).ConfigureAwait(false); + + Assert.IsFalse(string.IsNullOrEmpty(result.TaskId)); + + await Task.Delay(5000).ConfigureAwait(false); + + var taskCollectionResponse = await client.TasksClient.ListTasksAsync(RepositoryId).ConfigureAwait(false); + + AssertCollectionResponse(taskCollectionResponse); + + var task = taskCollectionResponse.Value.First(t => t.Id == result.TaskId); + + Assert.IsNotNull(task); + Assert.AreEqual(TaskStatus.Completed, task.Status); + Assert.AreEqual(100, task.PercentComplete); + } + } +} From 909fb6f30980c41b6c93bfb695fe998ddf06f18a Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Thu, 14 Sep 2023 11:49:11 -0400 Subject: [PATCH 66/93] Update tests related to task cancellation --- ...CancelOperationTest.cs => CancelTasksTest.cs} | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) rename tests/integration/Tasks/{CancelOperationTest.cs => CancelTasksTest.cs} (60%) diff --git a/tests/integration/Tasks/CancelOperationTest.cs b/tests/integration/Tasks/CancelTasksTest.cs similarity index 60% rename from tests/integration/Tasks/CancelOperationTest.cs rename to tests/integration/Tasks/CancelTasksTest.cs index 222db7f6..eda84050 100644 --- a/tests/integration/Tasks/CancelOperationTest.cs +++ b/tests/integration/Tasks/CancelTasksTest.cs @@ -1,11 +1,12 @@ using Laserfiche.Api.Client; using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections.Generic; using System.Threading.Tasks; namespace Laserfiche.Repository.Api.Client.IntegrationTest.Tasks { [TestClass] - public class CancelOperationTest : BaseTest + public class CancelTasksTest : BaseTest { [TestInitialize] public void Initialize() @@ -14,18 +15,19 @@ public void Initialize() } [TestMethod] - public async Task CancelOpeartion_OperationEndedBeforeCancel() + public async Task CancelTasks_OperationEndedBeforeCancel() { var deleteEntry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net CancelOperation").ConfigureAwait(false); - DeleteEntryWithAuditReason body = new DeleteEntryWithAuditReason(); - var result = await client.EntriesClient.DeleteEntryInfoAsync(RepositoryId, deleteEntry.Id, body).ConfigureAwait(false); - var token = result.Token; - Assert.IsFalse(string.IsNullOrEmpty(token)); + StartDeleteEntryRequest body = new(); + var taskResponse = await client.EntriesClient.StartDeleteEntryAsync(RepositoryId, deleteEntry.Id, body).ConfigureAwait(false); + + AssertIsNotNullOrEmpty(taskResponse.TaskId); try { await Task.Delay(5000).ConfigureAwait(false); - await client.TasksClient.CancelOperationAsync(RepositoryId, token).ConfigureAwait(false); + await client.TasksClient.CancelTasksAsync(RepositoryId, new List { taskResponse.TaskId }).ConfigureAwait(false); + Assert.Fail("Long operation should have ended before cancel."); } catch (ApiException e) From fb3a628677d332626c1b6c580627d02fae10fb50 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Thu, 14 Sep 2023 14:15:27 -0400 Subject: [PATCH 67/93] Update tests related to retriving a single template definition --- .../GetTemplateDefinitionByIdTest.cs | 29 -------- .../GetTemplateDefinitionTest.cs | 70 +++---------------- 2 files changed, 10 insertions(+), 89 deletions(-) delete mode 100644 tests/integration/TemplateDefinitions/GetTemplateDefinitionByIdTest.cs diff --git a/tests/integration/TemplateDefinitions/GetTemplateDefinitionByIdTest.cs b/tests/integration/TemplateDefinitions/GetTemplateDefinitionByIdTest.cs deleted file mode 100644 index 13b88986..00000000 --- a/tests/integration/TemplateDefinitions/GetTemplateDefinitionByIdTest.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Linq; -using System.Threading.Tasks; - -namespace Laserfiche.Repository.Api.Client.IntegrationTest.TemplateDefinitions -{ - [TestClass] - public class GetTemplateDefinitionByIdTest : BaseTest - { - [TestInitialize] - public void Initialize() - { - client = CreateClient(); - } - - [TestMethod] - public async Task GetTemplateDefinitionById_ReturnTemplate() - { - var allTemplateDefinitionsResult = await client.TemplateDefinitionsClient.GetTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); - var firstTemplateDefinition = allTemplateDefinitionsResult.Value?.FirstOrDefault(); - Assert.IsNotNull(firstTemplateDefinition, "No template definitions exist in the repository."); - - var result = await client.TemplateDefinitionsClient.GetTemplateDefinitionByIdAsync(RepositoryId, firstTemplateDefinition.Id).ConfigureAwait(false); - - Assert.IsNotNull(result); - Assert.AreEqual(firstTemplateDefinition.Id, result.Id); - } - } -} diff --git a/tests/integration/TemplateDefinitions/GetTemplateDefinitionTest.cs b/tests/integration/TemplateDefinitions/GetTemplateDefinitionTest.cs index 8f61e332..0a253a44 100644 --- a/tests/integration/TemplateDefinitions/GetTemplateDefinitionTest.cs +++ b/tests/integration/TemplateDefinitions/GetTemplateDefinitionTest.cs @@ -14,70 +14,20 @@ public void Initialize() } [TestMethod] - public async Task GetTemplateDefinition_ReturnAllTemplates() + public async Task GetTemplateDefinition_ReturnTemplate() { - var result = await client.TemplateDefinitionsClient.GetTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); - Assert.IsNotNull(result.Value); - } - - [TestMethod] - public async Task GetTemplateDefinition_TemplateNameQueryParameter_ReturnSingleTemplate() - { - var allTemplateDefinitionsResult = await client.TemplateDefinitionsClient.GetTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); - var firstTemplateDefinition = allTemplateDefinitionsResult.Value?.FirstOrDefault(); - Assert.IsNotNull(firstTemplateDefinition); - - var result = await client.TemplateDefinitionsClient.GetTemplateDefinitionsAsync(RepositoryId, templateName: firstTemplateDefinition.Name).ConfigureAwait(false); - Assert.IsNotNull(result.Value); - Assert.AreEqual(1, result.Value.Count); - Assert.AreEqual(firstTemplateDefinition.Id, result.Value.FirstOrDefault().Id); - } - - [TestMethod] - public async Task GetTemplateDefinition_ForEachPaging() - { - int maxPageSize = 10; - - Task PagingCallback(ODataValueContextOfIListOfWTemplateInfo data) - { - if (data.OdataNextLink != null) - { - Assert.AreNotEqual(0, data.Value.Count); - Assert.IsTrue(data.Value.Count <= maxPageSize); - return Task.FromResult(true); - } - else - { - return Task.FromResult(false); - } - } - - await client.TemplateDefinitionsClient.GetTemplateDefinitionsForEachAsync(PagingCallback, RepositoryId, maxPageSize: maxPageSize).ConfigureAwait(false); - await Task.Delay(5000).ConfigureAwait(false); - } - - [TestMethod] - public async Task GetTemplateDefinition_SimplePaging() - { - int maxPageSize = 1; - - // Initial request - var result = await client.TemplateDefinitionsClient.GetTemplateDefinitionsAsync(RepositoryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); - Assert.IsNotNull(result); + var templateDefinitionCollectionResponse = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); - if (result.Value.Count == 0) - { - return; // There's no point testing if we don't have any such item. - } + AssertCollectionResponse(templateDefinitionCollectionResponse); + + var firstTemplateDefinition = templateDefinitionCollectionResponse.Value?.FirstOrDefault(); + + Assert.IsNotNull(firstTemplateDefinition, "No template definitions exist in the repository."); - var nextLink = result.OdataNextLink; - Assert.IsNotNull(nextLink); - Assert.IsTrue(result.Value.Count <= maxPageSize); + var templateDefinition = await client.TemplateDefinitionsClient.GetTemplateDefinitionAsync(RepositoryId, firstTemplateDefinition.Id).ConfigureAwait(false); - // Paging request - result = await client.TemplateDefinitionsClient.GetTemplateDefinitionsNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); - Assert.IsNotNull(result); - Assert.IsTrue(result.Value.Count <= maxPageSize); + Assert.IsNotNull(templateDefinition); + Assert.AreEqual(firstTemplateDefinition.Id, templateDefinition.Id); } } } From 1374a206b685673656c013047a3eb8d018e0240d Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Thu, 14 Sep 2023 14:23:16 -0400 Subject: [PATCH 68/93] Update tests related to listing of template definitions --- .../ListTemplateDefinitionsTest.cs | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 tests/integration/TemplateDefinitions/ListTemplateDefinitionsTest.cs diff --git a/tests/integration/TemplateDefinitions/ListTemplateDefinitionsTest.cs b/tests/integration/TemplateDefinitions/ListTemplateDefinitionsTest.cs new file mode 100644 index 00000000..66cf0f65 --- /dev/null +++ b/tests/integration/TemplateDefinitions/ListTemplateDefinitionsTest.cs @@ -0,0 +1,90 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Linq; +using System.Threading.Tasks; + +namespace Laserfiche.Repository.Api.Client.IntegrationTest.TemplateDefinitions +{ + [TestClass] + public class ListTemplateDefinitionsTest : BaseTest + { + [TestInitialize] + public void Initialize() + { + client = CreateClient(); + } + + [TestMethod] + public async Task GetTemplateDefinition_ReturnAllTemplates() + { + var templateDefinitionCollectionResponse = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); + + AssertCollectionResponse(templateDefinitionCollectionResponse); + } + + [TestMethod] + public async Task GetTemplateDefinition_TemplateNameQueryParameter_ReturnSingleTemplate() + { + var allTemplateDefinitions = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); + var firstTemplateDefinition = allTemplateDefinitions.Value?.FirstOrDefault(); + + Assert.IsNotNull(firstTemplateDefinition); + + var templateDefinitionCollectionResponse = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId, templateName: firstTemplateDefinition.Name).ConfigureAwait(false); + + AssertCollectionResponse(templateDefinitionCollectionResponse); + Assert.AreEqual(1, templateDefinitionCollectionResponse.Value.Count); + Assert.AreEqual(firstTemplateDefinition.Id, templateDefinitionCollectionResponse.Value.FirstOrDefault().Id); + } + + [TestMethod] + public async Task GetTemplateDefinition_ForEachPaging() + { + int maxPageSize = 10; + + Task PagingCallback(TemplateDefinitionCollectionResponse data) + { + if (data.OdataNextLink != null) + { + Assert.AreNotEqual(0, data.Value.Count); + Assert.IsTrue(data.Value.Count <= maxPageSize); + + return Task.FromResult(true); + } + else + { + return Task.FromResult(false); + } + } + + await client.TemplateDefinitionsClient.ListTemplateDefinitionsForEachAsync(PagingCallback, RepositoryId, maxPageSize: maxPageSize).ConfigureAwait(false); + await Task.Delay(5000).ConfigureAwait(false); + } + + [TestMethod] + public async Task GetTemplateDefinition_SimplePaging() + { + int maxPageSize = 1; + + // Initial request + var templateDefinitionCollectionResponse = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); + + Assert.IsNotNull(templateDefinitionCollectionResponse); + + if (templateDefinitionCollectionResponse.Value.Count == 0) + { + return; // There's no point testing if we don't have any such item. + } + + var nextLink = templateDefinitionCollectionResponse.OdataNextLink; + + Assert.IsNotNull(nextLink); + Assert.IsTrue(templateDefinitionCollectionResponse.Value.Count <= maxPageSize); + + // Paging request + templateDefinitionCollectionResponse = await client.TemplateDefinitionsClient.ListTemplateDefinitionsNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); + + Assert.IsNotNull(templateDefinitionCollectionResponse); + Assert.IsTrue(templateDefinitionCollectionResponse.Value.Count <= maxPageSize); + } + } +} From 27a97787c5d9490fe58db8fc617dccee13b59e11 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Thu, 14 Sep 2023 14:41:48 -0400 Subject: [PATCH 69/93] Update list template fiels by template name tests --- ...plateDefinitionFieldsByTemplateNameTest.cs | 80 ----------------- ...plateDefinitionFieldsByTemplateNameTest.cs | 88 +++++++++++++++++++ 2 files changed, 88 insertions(+), 80 deletions(-) delete mode 100644 tests/integration/TemplateDefinitions/GetTemplateDefinitionFieldsByTemplateNameTest.cs create mode 100644 tests/integration/TemplateDefinitions/ListTemplateDefinitionFieldsByTemplateNameTest.cs diff --git a/tests/integration/TemplateDefinitions/GetTemplateDefinitionFieldsByTemplateNameTest.cs b/tests/integration/TemplateDefinitions/GetTemplateDefinitionFieldsByTemplateNameTest.cs deleted file mode 100644 index ae0b1eb3..00000000 --- a/tests/integration/TemplateDefinitions/GetTemplateDefinitionFieldsByTemplateNameTest.cs +++ /dev/null @@ -1,80 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Linq; -using System.Threading.Tasks; - -namespace Laserfiche.Repository.Api.Client.IntegrationTest.TemplateDefinitions -{ - [TestClass] - public class GetTemplateDefinitionFieldsByTemplateNameTest : BaseTest - { - [TestInitialize] - public void Initialize() - { - client = CreateClient(); - } - - [TestMethod] - public async Task GetTemplateDefinitionFieldsByTemplateName_ReturnTemplateFields() - { - var allTemplateDefinitionsResult = await client.TemplateDefinitionsClient.GetTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); - var firstTemplateDefinition = allTemplateDefinitionsResult.Value?.FirstOrDefault(); - Assert.IsNotNull(firstTemplateDefinition); - - var result = await client.TemplateDefinitionsClient.GetTemplateFieldDefinitionsByTemplateNameAsync(RepositoryId, firstTemplateDefinition.Name).ConfigureAwait(false); - var templateFieldDefinitions = result.Value; - - Assert.IsNotNull(templateFieldDefinitions); - Assert.AreEqual(firstTemplateDefinition.FieldCount, templateFieldDefinitions.Count); - } - - [TestMethod] - public async Task GetTemplateDefinitionFieldsByTemplateName_ForEachPaging() - { - int maxPageSize = 10; - - var allTemplateDefinitionsResult = await client.TemplateDefinitionsClient.GetTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); - var firstTemplateDefinition = allTemplateDefinitionsResult.Value?.FirstOrDefault(); - Assert.IsNotNull(firstTemplateDefinition); - - Task PagingCallback(ODataValueContextOfIListOfTemplateFieldInfo data) - { - if (data.OdataNextLink != null) - { - Assert.AreNotEqual(0, data.Value.Count); - Assert.IsTrue(data.Value.Count <= maxPageSize); - return Task.FromResult(true); - } - else - { - return Task.FromResult(false); - } - } - - await client.TemplateDefinitionsClient.GetTemplateFieldDefinitionsByTemplateNameForEachAsync(PagingCallback, RepositoryId, firstTemplateDefinition.Name, maxPageSize: maxPageSize).ConfigureAwait(false); - await Task.Delay(5000).ConfigureAwait(false); - } - - [TestMethod] - public async Task GetTemplateDefinitionFieldsByTemplateName_SimplePaging() - { - var allTemplateDefinitionsResult = await client.TemplateDefinitionsClient.GetTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); - var firstTemplateDefinition = allTemplateDefinitionsResult.Value?.FirstOrDefault(); - Assert.IsNotNull(firstTemplateDefinition); - - int maxPageSize = 1; - - // Initial request - var result = await client.TemplateDefinitionsClient.GetTemplateFieldDefinitionsByTemplateNameAsync(RepositoryId, firstTemplateDefinition.Name, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); - Assert.IsNotNull(result); - - var nextLink = result.OdataNextLink; - Assert.IsNotNull(nextLink); - Assert.IsTrue(result.Value.Count <= maxPageSize); - - // Paging request - result = await client.TemplateDefinitionsClient.GetTemplateFieldDefinitionsByTemplateNameNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); - Assert.IsNotNull(result); - Assert.IsTrue(result.Value.Count <= maxPageSize); - } - } -} diff --git a/tests/integration/TemplateDefinitions/ListTemplateDefinitionFieldsByTemplateNameTest.cs b/tests/integration/TemplateDefinitions/ListTemplateDefinitionFieldsByTemplateNameTest.cs new file mode 100644 index 00000000..d8a28f7f --- /dev/null +++ b/tests/integration/TemplateDefinitions/ListTemplateDefinitionFieldsByTemplateNameTest.cs @@ -0,0 +1,88 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Linq; +using System.Threading.Tasks; + +namespace Laserfiche.Repository.Api.Client.IntegrationTest.TemplateDefinitions +{ + [TestClass] + public class ListTemplateDefinitionFieldsByTemplateNameTest : BaseTest + { + [TestInitialize] + public void Initialize() + { + client = CreateClient(); + } + + [TestMethod] + public async Task GetTemplateDefinitionFieldsByTemplateName_ReturnTemplateFields() + { + var allTemplateDefinitions = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); + var firstTemplateDefinition = allTemplateDefinitions.Value?.FirstOrDefault(); + + Assert.IsNotNull(firstTemplateDefinition); + + var templateDefinitionCollectionResponse = await client.TemplateDefinitionsClient.ListTemplateFieldDefinitionsByTemplateNameAsync(RepositoryId, firstTemplateDefinition.Name).ConfigureAwait(false); + var templateFieldDefinitions = templateDefinitionCollectionResponse.Value; + + Assert.IsNotNull(templateFieldDefinitions); + Assert.AreEqual(firstTemplateDefinition.FieldCount, templateFieldDefinitions.Count); + } + + [TestMethod] + public async Task GetTemplateDefinitionFieldsByTemplateName_ForEachPaging() + { + int maxPageSize = 10; + + var allTemplateDefinitions = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); + var firstTemplateDefinition = allTemplateDefinitions.Value?.FirstOrDefault(); + + AssertCollectionResponse(allTemplateDefinitions); + Assert.IsNotNull(firstTemplateDefinition); + + Task PagingCallback(TemplateFieldDefinitionCollectionResponse data) + { + if (data.OdataNextLink != null) + { + Assert.AreNotEqual(0, data.Value.Count); + Assert.IsTrue(data.Value.Count <= maxPageSize); + + return Task.FromResult(true); + } + else + { + return Task.FromResult(false); + } + } + + await client.TemplateDefinitionsClient.ListTemplateFieldDefinitionsByTemplateNameForEachAsync(PagingCallback, RepositoryId, firstTemplateDefinition.Name, maxPageSize: maxPageSize).ConfigureAwait(false); + await Task.Delay(5000).ConfigureAwait(false); + } + + [TestMethod] + public async Task GetTemplateDefinitionFieldsByTemplateName_SimplePaging() + { + var allTemplateDefinitions = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); + var firstTemplateDefinition = allTemplateDefinitions.Value?.FirstOrDefault(); + + Assert.IsNotNull(firstTemplateDefinition); + + int maxPageSize = 1; + + // Initial request + var templateDeifnitionCollectionResponse = await client.TemplateDefinitionsClient.ListTemplateFieldDefinitionsByTemplateNameAsync(RepositoryId, firstTemplateDefinition.Name, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); + + Assert.IsNotNull(templateDeifnitionCollectionResponse); + + var nextLink = templateDeifnitionCollectionResponse.OdataNextLink; + + Assert.IsNotNull(nextLink); + Assert.IsTrue(templateDeifnitionCollectionResponse.Value.Count <= maxPageSize); + + // Paging request + templateDeifnitionCollectionResponse = await client.TemplateDefinitionsClient.ListTemplateFieldDefinitionsByTemplateNameNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); + + Assert.IsNotNull(templateDeifnitionCollectionResponse); + Assert.IsTrue(templateDeifnitionCollectionResponse.Value.Count <= maxPageSize); + } + } +} From 426387ddca92a6bb3894868fd61ad1787712410e Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Thu, 14 Sep 2023 14:45:10 -0400 Subject: [PATCH 70/93] Update tests related to ListTemplateFieldDefinitionsByTemplateId --- .../GetTemplateDefinitionFieldsTest.cs | 85 ----------------- ...emplateFieldDefinitionsByTemplateIdTest.cs | 92 +++++++++++++++++++ 2 files changed, 92 insertions(+), 85 deletions(-) delete mode 100644 tests/integration/TemplateDefinitions/GetTemplateDefinitionFieldsTest.cs create mode 100644 tests/integration/TemplateDefinitions/ListTemplateFieldDefinitionsByTemplateIdTest.cs diff --git a/tests/integration/TemplateDefinitions/GetTemplateDefinitionFieldsTest.cs b/tests/integration/TemplateDefinitions/GetTemplateDefinitionFieldsTest.cs deleted file mode 100644 index 3c8e6bfc..00000000 --- a/tests/integration/TemplateDefinitions/GetTemplateDefinitionFieldsTest.cs +++ /dev/null @@ -1,85 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Linq; -using System.Threading.Tasks; - -namespace Laserfiche.Repository.Api.Client.IntegrationTest.TemplateDefinitions -{ - [TestClass] - public class GetTemplateDefinitionFieldsTest : BaseTest - { - [TestInitialize] - public void Initialize() - { - client = CreateClient(); - } - - [TestMethod] - public async Task GetTemplateDefinitionFields_ReturnTemplateFields() - { - var allTemplateDefinitionsResult = await client.TemplateDefinitionsClient.GetTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); - var firstTemplateDefinition = allTemplateDefinitionsResult.Value?.FirstOrDefault(); - Assert.IsNotNull(firstTemplateDefinition); - - var result = await client.TemplateDefinitionsClient.GetTemplateFieldDefinitionsAsync(RepositoryId, firstTemplateDefinition.Id).ConfigureAwait(false); - var templateFieldDefinitions = result.Value; - - Assert.IsNotNull(templateFieldDefinitions); - Assert.AreEqual(firstTemplateDefinition.FieldCount, templateFieldDefinitions.Count); - } - - [TestMethod] - public async Task GetTemplateDefinitionFields_ForEachPaging() - { - int maxPageSize = 10; - - var allTemplateDefinitionsResult = await client.TemplateDefinitionsClient.GetTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); - var firstTemplateDefinition = allTemplateDefinitionsResult.Value?.FirstOrDefault(); - Assert.IsNotNull(firstTemplateDefinition); - - Task PagingCallback(ODataValueContextOfIListOfTemplateFieldInfo data) - { - if (data.OdataNextLink != null) - { - Assert.AreNotEqual(0, data.Value.Count); - Assert.IsTrue(data.Value.Count <= maxPageSize); - return Task.FromResult(true); - } - else - { - return Task.FromResult(false); - } - } - - await client.TemplateDefinitionsClient.GetTemplateFieldDefinitionsForEachAsync(PagingCallback, RepositoryId, firstTemplateDefinition.Id, maxPageSize: maxPageSize).ConfigureAwait(false); - await Task.Delay(5000).ConfigureAwait(false); - } - - [TestMethod] - public async Task GetTemplateDefinitionFields_SimplePaging() - { - var allTemplateDefinitionsResult = await client.TemplateDefinitionsClient.GetTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); - var firstTemplateDefinition = allTemplateDefinitionsResult.Value?.FirstOrDefault(); - Assert.IsNotNull(firstTemplateDefinition); - - int maxPageSize = 1; - - // Initial request - var result = await client.TemplateDefinitionsClient.GetTemplateFieldDefinitionsAsync(RepositoryId, firstTemplateDefinition.Id, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); - Assert.IsNotNull(result); - - if (result.Value.Count == 0) - { - return; // There's no point testing if we don't have any such item. - } - - var nextLink = result.OdataNextLink; - Assert.IsNotNull(nextLink); - Assert.IsTrue(result.Value.Count <= maxPageSize); - - // Paging request - result = await client.TemplateDefinitionsClient.GetTemplateFieldDefinitionsNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); - Assert.IsNotNull(result); - Assert.IsTrue(result.Value.Count <= maxPageSize); - } - } -} diff --git a/tests/integration/TemplateDefinitions/ListTemplateFieldDefinitionsByTemplateIdTest.cs b/tests/integration/TemplateDefinitions/ListTemplateFieldDefinitionsByTemplateIdTest.cs new file mode 100644 index 00000000..620bc8a4 --- /dev/null +++ b/tests/integration/TemplateDefinitions/ListTemplateFieldDefinitionsByTemplateIdTest.cs @@ -0,0 +1,92 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Linq; +using System.Threading.Tasks; + +namespace Laserfiche.Repository.Api.Client.IntegrationTest.TemplateDefinitions +{ + [TestClass] + public class ListTemplateFieldDefinitionsByTemplateIdTest : BaseTest + { + [TestInitialize] + public void Initialize() + { + client = CreateClient(); + } + + [TestMethod] + public async Task GetTemplateDefinitionFields_ReturnTemplateFields() + { + var allTemplateDefinitions = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); + var firstTemplateDefinition = allTemplateDefinitions.Value?.FirstOrDefault(); + + Assert.IsNotNull(firstTemplateDefinition); + + var templateFieldDefinitionCollectionResponse = await client.TemplateDefinitionsClient.ListTemplateFieldDefinitionsByTemplateIdAsync(RepositoryId, firstTemplateDefinition.Id).ConfigureAwait(false); + var templateFieldDefinitions = templateFieldDefinitionCollectionResponse.Value; + + Assert.IsNotNull(templateFieldDefinitions); + Assert.AreEqual(firstTemplateDefinition.FieldCount, templateFieldDefinitions.Count); + } + + [TestMethod] + public async Task GetTemplateDefinitionFields_ForEachPaging() + { + int maxPageSize = 10; + + var allTemplateDefinitionsResult = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); + var firstTemplateDefinition = allTemplateDefinitionsResult.Value?.FirstOrDefault(); + + Assert.IsNotNull(firstTemplateDefinition); + + Task PagingCallback(TemplateFieldDefinitionCollectionResponse data) + { + if (data.OdataNextLink != null) + { + Assert.AreNotEqual(0, data.Value.Count); + Assert.IsTrue(data.Value.Count <= maxPageSize); + + return Task.FromResult(true); + } + else + { + return Task.FromResult(false); + } + } + + await client.TemplateDefinitionsClient.ListTemplateFieldDefinitionsByTemplateIdForEachAsync(PagingCallback, RepositoryId, firstTemplateDefinition.Id, maxPageSize: maxPageSize).ConfigureAwait(false); + await Task.Delay(5000).ConfigureAwait(false); + } + + [TestMethod] + public async Task GetTemplateDefinitionFields_SimplePaging() + { + var allTemplateDefinitions = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); + var firstTemplateDefinition = allTemplateDefinitions.Value?.FirstOrDefault(); + + Assert.IsNotNull(firstTemplateDefinition); + + int maxPageSize = 1; + + // Initial request + var templateFieldDefinitionCollectionResponse = await client.TemplateDefinitionsClient.ListTemplateFieldDefinitionsByTemplateIdAsync(RepositoryId, firstTemplateDefinition.Id, prefer: $"maxpagesize={maxPageSize}").ConfigureAwait(false); + + Assert.IsNotNull(templateFieldDefinitionCollectionResponse); + + if (templateFieldDefinitionCollectionResponse.Value.Count == 0) + { + return; // There's no point testing if we don't have any such item. + } + + var nextLink = templateFieldDefinitionCollectionResponse.OdataNextLink; + + Assert.IsNotNull(nextLink); + Assert.IsTrue(templateFieldDefinitionCollectionResponse.Value.Count <= maxPageSize); + + // Paging request + templateFieldDefinitionCollectionResponse = await client.TemplateDefinitionsClient.ListTemplateFieldDefinitionsByTemplateIdNextLinkAsync(nextLink, maxPageSize).ConfigureAwait(false); + + Assert.IsNotNull(templateFieldDefinitionCollectionResponse); + Assert.IsTrue(templateFieldDefinitionCollectionResponse.Value.Count <= maxPageSize); + } + } +} From d3462a0e4e7f2b52730d522df4ae2033f4424252 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Thu, 14 Sep 2023 14:58:19 -0400 Subject: [PATCH 71/93] Pass in scopes --- tests/integration/BaseTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/BaseTest.cs b/tests/integration/BaseTest.cs index f2b4449a..5f10d3dc 100644 --- a/tests/integration/BaseTest.cs +++ b/tests/integration/BaseTest.cs @@ -84,7 +84,7 @@ public IRepositoryApiClient CreateClient() { if (string.IsNullOrEmpty(ServicePrincipalKey) || AccessKey == null) return null; - client = RepositoryApiClient.CreateFromAccessKey(ServicePrincipalKey, AccessKey); + client = RepositoryApiClient.CreateFromAccessKey(ServicePrincipalKey, AccessKey, "repository.ReadWrite"); } else if (AuthorizationType == AuthorizationType.API_SERVER_USERNAME_PASSWORD) { From d028012379b8b2997e71a4220197e99bd05437a6 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Thu, 14 Sep 2023 15:56:08 -0400 Subject: [PATCH 72/93] Test no need to support .net core 3 --- tests/unit/Laserfiche.Repository.Api.Client.Test.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/Laserfiche.Repository.Api.Client.Test.csproj b/tests/unit/Laserfiche.Repository.Api.Client.Test.csproj index e806eb36..30c8b34d 100644 --- a/tests/unit/Laserfiche.Repository.Api.Client.Test.csproj +++ b/tests/unit/Laserfiche.Repository.Api.Client.Test.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1;net6.0 + net6.0 false Laserfiche Apache License 2.0 From 5debc1e5c728f988f9fb36c376e9a96a17a9bcef Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Thu, 14 Sep 2023 16:15:22 -0400 Subject: [PATCH 73/93] Simplify test naming --- tests/integration/Attributes/GetAttributeTest.cs | 2 +- tests/integration/Attributes/ListAttributesTest.cs | 6 +++--- tests/integration/AuditReasons/ListAuditReasonsTest.cs | 2 +- tests/integration/Entries/CreateEntryTest.cs | 4 ++-- tests/integration/Entries/GetEntryTest.cs | 6 +++--- tests/integration/Entries/ImportEntryTest.cs | 6 +++--- ...teDefinitionsTest.cs => ListDynamicFieldValuesTest.cs} | 4 ++-- tests/integration/Entries/ListEntriesTest.cs | 6 +++--- tests/integration/Entries/ListFieldsTest.cs | 6 +++--- tests/integration/Entries/ListLinksTest.cs | 6 +++--- tests/integration/Entries/ListTagsTest.cs | 6 +++--- tests/integration/Entries/RemoveTemplateTest.cs | 2 +- tests/integration/Entries/SetFieldsTest.cs | 2 +- tests/integration/Entries/SetLinksTest.cs | 2 +- tests/integration/Entries/SetTagsTest.cs | 2 +- tests/integration/Entries/SetTemplateTest.cs | 2 +- tests/integration/Entries/StartCopyEntryTest.cs | 6 +++--- tests/integration/Entries/StartDeleteEntryTest.cs | 2 +- tests/integration/Entries/UpdateEntryTest.cs | 2 +- .../FieldDefinitions/GetFieldDefinitionTest.cs | 2 +- .../FieldDefinitions/ListFieldDefinitionsTest.cs | 6 +++--- .../integration/LinkDefinitions/GetLinkDefinitionTest.cs | 2 +- .../LinkDefinitions/ListLinkDefinitionsTest.cs | 6 +++--- tests/integration/Repositories/ListRepositoriesTest.cs | 4 ++-- tests/integration/RepositoryApiClientTest.cs | 2 +- tests/integration/Searches/CancelTasksTest.cs | 2 +- tests/integration/Searches/ListSearchContextHitsTest.cs | 4 ++-- tests/integration/Searches/ListSearchResultsTest.cs | 6 +++--- tests/integration/Searches/ListTasksTest.cs | 2 +- tests/integration/Searches/StartSearchEntryTest.cs | 2 +- tests/integration/SimpleSearches/SimpleSearchTest.cs | 2 +- tests/integration/TagDefinitions/GetTagDefinitionTest.cs | 2 +- .../integration/TagDefinitions/ListTagDefinitionsTest.cs | 6 +++--- tests/integration/Tasks/CancelTasksTest.cs | 2 +- tests/integration/Tasks/ListTasksTest.cs | 2 +- .../TemplateDefinitions/GetTemplateDefinitionTest.cs | 2 +- .../ListTemplateDefinitionFieldsByTemplateNameTest.cs | 6 +++--- .../TemplateDefinitions/ListTemplateDefinitionsTest.cs | 8 ++++---- .../ListTemplateFieldDefinitionsByTemplateIdTest.cs | 6 +++--- 39 files changed, 74 insertions(+), 74 deletions(-) rename tests/integration/Entries/{ListTemplateDefinitionsTest.cs => ListDynamicFieldValuesTest.cs} (89%) diff --git a/tests/integration/Attributes/GetAttributeTest.cs b/tests/integration/Attributes/GetAttributeTest.cs index 1c40f784..26d24ad5 100644 --- a/tests/integration/Attributes/GetAttributeTest.cs +++ b/tests/integration/Attributes/GetAttributeTest.cs @@ -14,7 +14,7 @@ public void Initialize() } [TestMethod] - public async Task GetAttribute_ReturnAttribute() + public async Task ReturnAttribute() { var result = await client.AttributesClient.ListAttributesAsync(RepositoryId).ConfigureAwait(false); var attributeKeys = result.Value; diff --git a/tests/integration/Attributes/ListAttributesTest.cs b/tests/integration/Attributes/ListAttributesTest.cs index a09cf6da..6b95ce90 100644 --- a/tests/integration/Attributes/ListAttributesTest.cs +++ b/tests/integration/Attributes/ListAttributesTest.cs @@ -13,7 +13,7 @@ public void Initialize() } [TestMethod] - public async Task ListAttributes_ReturnAttributes() + public async Task ReturnAttributes() { var response = await client.AttributesClient.ListAttributesAsync(RepositoryId).ConfigureAwait(false); @@ -21,7 +21,7 @@ public async Task ListAttributes_ReturnAttributes() } [TestMethod] - public async Task ListAttributes_ForEachPaging() + public async Task ForEachPaging() { int maxPageSize = 10; @@ -44,7 +44,7 @@ Task PagingCallback(AttributeCollectionResponse data) } [TestMethod] - public async Task ListAttributes_SimplePaging() + public async Task SimplePaging() { int maxPageSize = 1; diff --git a/tests/integration/AuditReasons/ListAuditReasonsTest.cs b/tests/integration/AuditReasons/ListAuditReasonsTest.cs index aa9969b1..e5b0dab6 100644 --- a/tests/integration/AuditReasons/ListAuditReasonsTest.cs +++ b/tests/integration/AuditReasons/ListAuditReasonsTest.cs @@ -13,7 +13,7 @@ public void Initialize() } [TestMethod] - public async Task ListAuditReasons_ReturnAuditReasons() + public async Task ReturnAuditReasons() { var collectionResponse = await client.AuditReasonsClient.ListAuditReasonsAsync(RepositoryId).ConfigureAwait(false); diff --git a/tests/integration/Entries/CreateEntryTest.cs b/tests/integration/Entries/CreateEntryTest.cs index a08ce47b..40cfd7b1 100644 --- a/tests/integration/Entries/CreateEntryTest.cs +++ b/tests/integration/Entries/CreateEntryTest.cs @@ -30,7 +30,7 @@ public async Task Cleanup() } [TestMethod] - public async Task CreateCopyEntry_CreateFolder() + public async Task CreateFolder() { string newEntryName = "RepositoryApiClientIntegrationTest .Net CreateFolder"; int parentEntryId = 1; @@ -51,7 +51,7 @@ public async Task CreateCopyEntry_CreateFolder() } [TestMethod] - public async Task CreateCopyEntry_CreateShortcut() + public async Task CreateShortcut() { // Create new entry string newEntryName = "RepositoryApiClientIntegrationTest .Net CreateFolder"; diff --git a/tests/integration/Entries/GetEntryTest.cs b/tests/integration/Entries/GetEntryTest.cs index c4a685ad..1ff8def4 100644 --- a/tests/integration/Entries/GetEntryTest.cs +++ b/tests/integration/Entries/GetEntryTest.cs @@ -29,7 +29,7 @@ public async Task Cleanup() } [TestMethod] - public async Task GetEntry_ReturnRootFolder() + public async Task ReturnRootFolder() { int entryId = 1; var entry = await client.EntriesClient.GetEntryAsync(RepositoryId, entryId).ConfigureAwait(false); @@ -61,7 +61,7 @@ private async Task CreateDocument() } [TestMethod] - public async Task GetEntry_ReturnDocument() + public async Task ReturnEntry() { createdEntryId = await CreateDocument().ConfigureAwait(false); var entry = await client.EntriesClient.GetEntryAsync(RepositoryId, createdEntryId).ConfigureAwait(false); @@ -73,7 +73,7 @@ public async Task GetEntry_ReturnDocument() } [TestMethod] - public async Task GetEntry_ThrowException() + public async Task ThrowException() { int entryId = 1; string repositoryId = "fakeRepository"; diff --git a/tests/integration/Entries/ImportEntryTest.cs b/tests/integration/Entries/ImportEntryTest.cs index b4ee16f1..f72a287b 100644 --- a/tests/integration/Entries/ImportEntryTest.cs +++ b/tests/integration/Entries/ImportEntryTest.cs @@ -40,7 +40,7 @@ private FileParameter GetFileParameter() } [TestMethod] - public async Task ImportEntry_DocumentCreated() + public async Task DocumentCreated() { int parentEntryId = 1; string fileName = "RepositoryApiClientIntegrationTest .Net ImportDocument"; @@ -56,7 +56,7 @@ public async Task ImportEntry_DocumentCreated() } [TestMethod] - public async Task ImportEntry_DocumentCreatedWithTemplate() + public async Task DocumentCreatedWithTemplate() { // Find a template definition with no required fields TemplateDefinition template = null; @@ -98,7 +98,7 @@ public async Task ImportEntry_DocumentCreatedWithTemplate() } [TestMethod] - public async Task ImportDocument_ThrowExceptionWithCreateEntryResult() + public async Task ThrowExceptionWithCreateEntryResult() { int parentEntryId = 1; string fileName = "RepositoryApiClientIntegrationTest .Net ImportDocument"; diff --git a/tests/integration/Entries/ListTemplateDefinitionsTest.cs b/tests/integration/Entries/ListDynamicFieldValuesTest.cs similarity index 89% rename from tests/integration/Entries/ListTemplateDefinitionsTest.cs rename to tests/integration/Entries/ListDynamicFieldValuesTest.cs index 1243a9fc..6c58a92f 100644 --- a/tests/integration/Entries/ListTemplateDefinitionsTest.cs +++ b/tests/integration/Entries/ListDynamicFieldValuesTest.cs @@ -5,7 +5,7 @@ namespace Laserfiche.Repository.Api.Client.IntegrationTest.Entries { [TestClass] - public class ListTemplateDefinitionsTest : BaseTest + public class ListDynamicFieldValuesTest : BaseTest { [TestInitialize] public void Initialize() @@ -14,7 +14,7 @@ public void Initialize() } [TestMethod] - public async Task GetDynamicFields_ReturnDynamicFields() + public async Task ReturnDynamicFields() { // Get a template definition id var templateDefinitionCollectionResponse = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); diff --git a/tests/integration/Entries/ListEntriesTest.cs b/tests/integration/Entries/ListEntriesTest.cs index b15c4d1f..25f20ef4 100644 --- a/tests/integration/Entries/ListEntriesTest.cs +++ b/tests/integration/Entries/ListEntriesTest.cs @@ -13,7 +13,7 @@ public void Initialize() } [TestMethod] - public async Task ListEntries_ReturnEntries() + public async Task ReturnEntries() { int entryId = 1; var entryCollectionResponse = await client.EntriesClient.ListEntriesAsync(RepositoryId, entryId).ConfigureAwait(false); @@ -28,7 +28,7 @@ public async Task ListEntries_ReturnEntries() } [TestMethod] - public async Task ListEntries_ForEachPaging() + public async Task ForEachPaging() { int entryId = 1; int maxPageSize = 10; @@ -53,7 +53,7 @@ Task PagingCallback(EntryCollectionResponse data) } [TestMethod] - public async Task ListEntries_SimplePaging() + public async Task SimplePaging() { int entryId = 1; int maxPageSize = 1; diff --git a/tests/integration/Entries/ListFieldsTest.cs b/tests/integration/Entries/ListFieldsTest.cs index 42ed8090..ff577a2f 100644 --- a/tests/integration/Entries/ListFieldsTest.cs +++ b/tests/integration/Entries/ListFieldsTest.cs @@ -13,7 +13,7 @@ public void Initialize() } [TestMethod] - public async Task GetEntryFields_ReturnFields() + public async Task ReturnFields() { int entryId = 1; var fieldCollectionResponse = await client.EntriesClient.ListFieldsAsync(RepositoryId, entryId).ConfigureAwait(false); @@ -22,7 +22,7 @@ public async Task GetEntryFields_ReturnFields() } [TestMethod] - public async Task GetEntryFields_ForEachPaging() + public async Task ForEachPaging() { int entryId = 1; int maxPageSize = 10; @@ -47,7 +47,7 @@ Task PagingCallback(FieldCollectionResponse data) } [TestMethod] - public async Task GetEntryFields_SimplePaging() + public async Task SimplePaging() { int entryId = 1; int maxPageSize = 1; diff --git a/tests/integration/Entries/ListLinksTest.cs b/tests/integration/Entries/ListLinksTest.cs index 903514a3..c9d2a092 100644 --- a/tests/integration/Entries/ListLinksTest.cs +++ b/tests/integration/Entries/ListLinksTest.cs @@ -13,7 +13,7 @@ public void Initialize() } [TestMethod] - public async Task GetEntryLinks_ReturnLinks() + public async Task ReturnLinks() { int entryId = 1; var linkCollectionResponse = await client.EntriesClient.ListLinksAsync(RepositoryId, entryId).ConfigureAwait(false); @@ -22,7 +22,7 @@ public async Task GetEntryLinks_ReturnLinks() } [TestMethod] - public async Task GetEntryLinks_ForEachPaging() + public async Task ForEachPaging() { int entryId = 1; int maxPageSize = 10; @@ -47,7 +47,7 @@ Task PagingCallback(LinkCollectionResponse data) } [TestMethod] - public async Task GetEntryLinks_SimplePaging() + public async Task SimplePaging() { int entryId = 1; int maxPageSize = 1; diff --git a/tests/integration/Entries/ListTagsTest.cs b/tests/integration/Entries/ListTagsTest.cs index dce59dfe..5a819803 100644 --- a/tests/integration/Entries/ListTagsTest.cs +++ b/tests/integration/Entries/ListTagsTest.cs @@ -13,7 +13,7 @@ public void Initialize() } [TestMethod] - public async Task GetEntryTags_ReturnTags() + public async Task ReturnTags() { int entryId = 1; var tagCollectionResponse = await client.EntriesClient.ListTagsAsync(RepositoryId, entryId).ConfigureAwait(false); @@ -22,7 +22,7 @@ public async Task GetEntryTags_ReturnTags() } [TestMethod] - public async Task GetEntryTags_ForEachPaging() + public async Task ForEachPaging() { int entryId = 1; int maxPageSize = 10; @@ -47,7 +47,7 @@ Task PagingCallback(TagCollectionResponse data) } [TestMethod] - public async Task GetEntryTags_SimplePaging() + public async Task SimplePaging() { int entryId = 1; int maxPageSize = 1; diff --git a/tests/integration/Entries/RemoveTemplateTest.cs b/tests/integration/Entries/RemoveTemplateTest.cs index 69df7cb9..f7bee5bc 100644 --- a/tests/integration/Entries/RemoveTemplateTest.cs +++ b/tests/integration/Entries/RemoveTemplateTest.cs @@ -27,7 +27,7 @@ public async Task Cleanup() } [TestMethod] - public async Task RemoveTemplateFromEntry_ReturnEntry() + public async Task RemoveTemplateFromEntry() { // Find a template definition with no required fields TemplateDefinition template = null; diff --git a/tests/integration/Entries/SetFieldsTest.cs b/tests/integration/Entries/SetFieldsTest.cs index cdfb91a3..f107d3d0 100644 --- a/tests/integration/Entries/SetFieldsTest.cs +++ b/tests/integration/Entries/SetFieldsTest.cs @@ -28,7 +28,7 @@ public async Task Cleanup() } [TestMethod] - public async Task SetFields_ReturnFields() + public async Task SetAndReturnFields() { // Find a string field FieldDefinition field = null; diff --git a/tests/integration/Entries/SetLinksTest.cs b/tests/integration/Entries/SetLinksTest.cs index ab303dff..0666cb39 100644 --- a/tests/integration/Entries/SetLinksTest.cs +++ b/tests/integration/Entries/SetLinksTest.cs @@ -31,7 +31,7 @@ public async Task Cleanup() } [TestMethod] - public async Task SetLinks_ReturnLinks() + public async Task SetAndReturnLinks() { var sourceEntry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net SetLinks Source").ConfigureAwait(false); createdEntries.Add(sourceEntry); diff --git a/tests/integration/Entries/SetTagsTest.cs b/tests/integration/Entries/SetTagsTest.cs index f0bd5877..2386d4a2 100644 --- a/tests/integration/Entries/SetTagsTest.cs +++ b/tests/integration/Entries/SetTagsTest.cs @@ -28,7 +28,7 @@ public async Task Cleanup() } [TestMethod] - public async Task SetTags_ReturnTags() + public async Task SetAndReturnTags() { var tagDefinitionsResult = await client.TagDefinitionsClient.ListTagDefinitionsAsync(RepositoryId).ConfigureAwait(false); var tagDefinitions = tagDefinitionsResult.Value; diff --git a/tests/integration/Entries/SetTemplateTest.cs b/tests/integration/Entries/SetTemplateTest.cs index 0c49f63a..274769c3 100644 --- a/tests/integration/Entries/SetTemplateTest.cs +++ b/tests/integration/Entries/SetTemplateTest.cs @@ -27,7 +27,7 @@ public async Task Cleanup() } [TestMethod] - public async Task SetTemplate_ReturnEntryWithTemplate() + public async Task ReturnEntryWithTemplate() { // Find a template definition with no required fields TemplateDefinition template = null; diff --git a/tests/integration/Entries/StartCopyEntryTest.cs b/tests/integration/Entries/StartCopyEntryTest.cs index 217ddb69..d3cad89f 100644 --- a/tests/integration/Entries/StartCopyEntryTest.cs +++ b/tests/integration/Entries/StartCopyEntryTest.cs @@ -32,7 +32,7 @@ public async Task Cleanup() } [TestMethod] - public async Task CreateCopyEntry_CopyEntry() + public async Task CopyEntry() { // Create a new folder that contains the created entry var testFolderName = "RepositoryApiClientIntegrationTest .Net CreateCopyEntry_CopyEntry_test_folder"; @@ -70,7 +70,7 @@ public async Task CreateCopyEntry_CopyEntry() } [TestMethod] - public async Task CreateCopyEntry_CopyShortcut() + public async Task CopyShortcut() { // Create new entry string newEntryName = "RepositoryApiClientIntegrationTest .Net CreateFolder"; @@ -122,7 +122,7 @@ public async Task CreateCopyEntry_CopyShortcut() [ExpectedException(typeof(ApiException))] [TestMethod] - public async Task CreateCopyEntry_CopyFolder() + public async Task CopyFolder() { // Create new entry string newEntryName = "RepositoryApiClientIntegrationTest .Net CreateFolder"; diff --git a/tests/integration/Entries/StartDeleteEntryTest.cs b/tests/integration/Entries/StartDeleteEntryTest.cs index 0569c409..b418f187 100644 --- a/tests/integration/Entries/StartDeleteEntryTest.cs +++ b/tests/integration/Entries/StartDeleteEntryTest.cs @@ -13,7 +13,7 @@ public void Initialize() } [TestMethod] - public async Task DeleteEntry_ReturnOperationToken() + public async Task ReturnOperationToken() { var deleteEntry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net DeleteFolder").ConfigureAwait(false); diff --git a/tests/integration/Entries/UpdateEntryTest.cs b/tests/integration/Entries/UpdateEntryTest.cs index 0e18f65c..f652909f 100644 --- a/tests/integration/Entries/UpdateEntryTest.cs +++ b/tests/integration/Entries/UpdateEntryTest.cs @@ -30,7 +30,7 @@ public async Task Cleanup() } [TestMethod] - public async Task MoveAndRenameEntry_ReturnEntry() + public async Task ReturnEntry() { var parentFolder = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net ParentFolder").ConfigureAwait(false); createdEntries.Add(parentFolder); diff --git a/tests/integration/FieldDefinitions/GetFieldDefinitionTest.cs b/tests/integration/FieldDefinitions/GetFieldDefinitionTest.cs index 578a62ae..f84f9e49 100644 --- a/tests/integration/FieldDefinitions/GetFieldDefinitionTest.cs +++ b/tests/integration/FieldDefinitions/GetFieldDefinitionTest.cs @@ -14,7 +14,7 @@ public void Initialize() } [TestMethod] - public async Task GetFieldDefinition_ReturnField() + public async Task ReturnField() { var allFieldDefinitionsResult = await client.FieldDefinitionsClient.ListFieldDefinitionsAsync(RepositoryId).ConfigureAwait(false); var firstFieldDefinition = allFieldDefinitionsResult.Value?.FirstOrDefault(); diff --git a/tests/integration/FieldDefinitions/ListFieldDefinitionsTest.cs b/tests/integration/FieldDefinitions/ListFieldDefinitionsTest.cs index ce7f035d..e3dca5d0 100644 --- a/tests/integration/FieldDefinitions/ListFieldDefinitionsTest.cs +++ b/tests/integration/FieldDefinitions/ListFieldDefinitionsTest.cs @@ -13,7 +13,7 @@ public void Initialize() } [TestMethod] - public async Task ListFieldDefinitions_ReturnAllFields() + public async Task ReturnAllFields() { var fieldDefinitionCollectionResponse = await client.FieldDefinitionsClient.ListFieldDefinitionsAsync(RepositoryId).ConfigureAwait(false); @@ -21,7 +21,7 @@ public async Task ListFieldDefinitions_ReturnAllFields() } [TestMethod] - public async Task ListFieldDefinitions_ForEachPaging() + public async Task ForEachPaging() { int maxPageSize = 10; @@ -45,7 +45,7 @@ Task PagingCallback(FieldDefinitionCollectionResponse data) } [TestMethod] - public async Task ListFieldDefinitions_SimplePaging() + public async Task SimplePaging() { int maxPageSize = 1; diff --git a/tests/integration/LinkDefinitions/GetLinkDefinitionTest.cs b/tests/integration/LinkDefinitions/GetLinkDefinitionTest.cs index d329aa97..399da3f8 100644 --- a/tests/integration/LinkDefinitions/GetLinkDefinitionTest.cs +++ b/tests/integration/LinkDefinitions/GetLinkDefinitionTest.cs @@ -14,7 +14,7 @@ public void Initialize() } [TestMethod] - public async Task GetLinkDefinitionByIdAsync_ReturnLinkDefinition() + public async Task ReturnLinkDefinition() { var allLinkDefinitionsResult = await client.LinkDefinitionsClient.ListLinkDefinitionsAsync(RepositoryId).ConfigureAwait(false); var firstLinkDefinition = allLinkDefinitionsResult.Value?.FirstOrDefault(); diff --git a/tests/integration/LinkDefinitions/ListLinkDefinitionsTest.cs b/tests/integration/LinkDefinitions/ListLinkDefinitionsTest.cs index 836d9406..817bf7fb 100644 --- a/tests/integration/LinkDefinitions/ListLinkDefinitionsTest.cs +++ b/tests/integration/LinkDefinitions/ListLinkDefinitionsTest.cs @@ -13,7 +13,7 @@ public void Initialize() } [TestMethod] - public async Task GetLinkDefinitionsAsync_ReturnAllLinks() + public async Task ReturnAllLinks() { var linkedDefinitionCollectionResponse = await client.LinkDefinitionsClient.ListLinkDefinitionsAsync(RepositoryId).ConfigureAwait(false); @@ -21,7 +21,7 @@ public async Task GetLinkDefinitionsAsync_ReturnAllLinks() } [TestMethod] - public async Task GetLinkDefinitionsAsync_ForEachPaging() + public async Task ForEachPaging() { int maxPageSize = 10; @@ -45,7 +45,7 @@ Task PagingCallback(LinkDefinitionCollectionResponse data) } [TestMethod] - public async Task GetLinkDefinitionsAsync_SimplePaging() + public async Task SimplePaging() { int maxPageSize = 1; diff --git a/tests/integration/Repositories/ListRepositoriesTest.cs b/tests/integration/Repositories/ListRepositoriesTest.cs index 3dd8b8e7..08ff9a60 100644 --- a/tests/integration/Repositories/ListRepositoriesTest.cs +++ b/tests/integration/Repositories/ListRepositoriesTest.cs @@ -13,7 +13,7 @@ public void Initialize() } [TestMethod] - public async Task ListRepositories_ReturnSuccessful() + public async Task ReturnSuccessful() { var repositoryCollectionResponse = await client.RepositoriesClient.ListRepositoriesAsync().ConfigureAwait(false); AssertCollectionResponse(repositoryCollectionResponse); @@ -37,7 +37,7 @@ public async Task ListRepositories_ReturnSuccessful() } [TestMethod] - public async Task GetSelfHostedRepositoryList_ReturnSuccessful() + public async Task SelfHosted_ReturnSuccessful() { if (AuthorizationType == AuthorizationType.CLOUD_ACCESS_KEY) { diff --git a/tests/integration/RepositoryApiClientTest.cs b/tests/integration/RepositoryApiClientTest.cs index 9e40bc21..d42e591b 100644 --- a/tests/integration/RepositoryApiClientTest.cs +++ b/tests/integration/RepositoryApiClientTest.cs @@ -14,7 +14,7 @@ public void Initialize() } [TestMethod] - public async Task FailedAuthentication_ThrowsException() + public async Task FailedAuthenticationThrowsException() { int entryId = 1; IRepositoryApiClient invalidClient; diff --git a/tests/integration/Searches/CancelTasksTest.cs b/tests/integration/Searches/CancelTasksTest.cs index b7f5137c..762674a3 100644 --- a/tests/integration/Searches/CancelTasksTest.cs +++ b/tests/integration/Searches/CancelTasksTest.cs @@ -25,7 +25,7 @@ public async Task Cleanup() } [TestMethod] - public async Task CancelTasks_CancelSearchTasks() + public async Task CancelSearchTasks() { // Create search var request = new StartSearchEntryRequest() diff --git a/tests/integration/Searches/ListSearchContextHitsTest.cs b/tests/integration/Searches/ListSearchContextHitsTest.cs index 1e1bfc4e..773a856f 100644 --- a/tests/integration/Searches/ListSearchContextHitsTest.cs +++ b/tests/integration/Searches/ListSearchContextHitsTest.cs @@ -26,7 +26,7 @@ public async Task Cleanup() } [TestMethod] - public async Task ListSearchContextHits_ReturnContextHits() + public async Task ReturnContextHits() { // Create search var request = new StartSearchEntryRequest() @@ -57,7 +57,7 @@ public async Task ListSearchContextHits_ReturnContextHits() } [TestMethod] - public async Task ListSearchContextHits_ForEachPaging() + public async Task ForEachPaging() { int maxPageSize = 10; diff --git a/tests/integration/Searches/ListSearchResultsTest.cs b/tests/integration/Searches/ListSearchResultsTest.cs index f9127161..733857aa 100644 --- a/tests/integration/Searches/ListSearchResultsTest.cs +++ b/tests/integration/Searches/ListSearchResultsTest.cs @@ -25,7 +25,7 @@ public async Task Cleanup() } [TestMethod] - public async Task ListSearchResults_ReturnSearchResults() + public async Task ReturnSearchResults() { // Create search var request = new StartSearchEntryRequest() @@ -50,7 +50,7 @@ public async Task ListSearchResults_ReturnSearchResults() } [TestMethod] - public async Task ListSearchResults_ForEachPaging() + public async Task ForEachPaging() { int maxPageSize = 90; @@ -88,7 +88,7 @@ Task PagingCallback(EntryCollectionResponse data) } [TestMethod] - public async Task ListSearchResults_SimplePaging() + public async Task SimplePaging() { int maxPageSize = 1; diff --git a/tests/integration/Searches/ListTasksTest.cs b/tests/integration/Searches/ListTasksTest.cs index ff41f115..612cd4c9 100644 --- a/tests/integration/Searches/ListTasksTest.cs +++ b/tests/integration/Searches/ListTasksTest.cs @@ -26,7 +26,7 @@ public async Task Cleanup() } [TestMethod] - public async Task StartSearchEntry_ReturnTaskStatus() + public async Task ReturnTaskStatus() { // Create search var request = new StartSearchEntryRequest() diff --git a/tests/integration/Searches/StartSearchEntryTest.cs b/tests/integration/Searches/StartSearchEntryTest.cs index 92d9fffa..a03d100e 100644 --- a/tests/integration/Searches/StartSearchEntryTest.cs +++ b/tests/integration/Searches/StartSearchEntryTest.cs @@ -25,7 +25,7 @@ public async Task Cleanup() } [TestMethod] - public async Task StartSearchEntry_ReturnTaskId() + public async Task ReturnTaskId() { var request = new StartSearchEntryRequest() { diff --git a/tests/integration/SimpleSearches/SimpleSearchTest.cs b/tests/integration/SimpleSearches/SimpleSearchTest.cs index 240c340a..6a6bfb59 100644 --- a/tests/integration/SimpleSearches/SimpleSearchTest.cs +++ b/tests/integration/SimpleSearches/SimpleSearchTest.cs @@ -17,7 +17,7 @@ public async Task Initialize() } [TestMethod] - public async Task SimpleSearch_SearchEntry() + public async Task SearchEntry() { var request = new SearchEntryRequest() { SearchCommand = "({LF:Basic ~= \"search text\", option=\"DFANLT\"})" }; var entryCollectionResponse = await client.SimpleSearchesClient.SearchEntryAsync(RepositoryId, request: request).ConfigureAwait(false); diff --git a/tests/integration/TagDefinitions/GetTagDefinitionTest.cs b/tests/integration/TagDefinitions/GetTagDefinitionTest.cs index 5416f9b0..9c0a5b42 100644 --- a/tests/integration/TagDefinitions/GetTagDefinitionTest.cs +++ b/tests/integration/TagDefinitions/GetTagDefinitionTest.cs @@ -14,7 +14,7 @@ public void Initialize() } [TestMethod] - public async Task GetTagDefinition_ReturnTag() + public async Task ReturnTag() { var tagDefinitionCollectionResponse = await client.TagDefinitionsClient.ListTagDefinitionsAsync(RepositoryId).ConfigureAwait(false); var firstTagDefinition = tagDefinitionCollectionResponse.Value?.FirstOrDefault(); diff --git a/tests/integration/TagDefinitions/ListTagDefinitionsTest.cs b/tests/integration/TagDefinitions/ListTagDefinitionsTest.cs index 325860a3..558dd296 100644 --- a/tests/integration/TagDefinitions/ListTagDefinitionsTest.cs +++ b/tests/integration/TagDefinitions/ListTagDefinitionsTest.cs @@ -13,7 +13,7 @@ public void Initialize() } [TestMethod] - public async Task ListTagDefinitions_ReturnAllTags() + public async Task ReturnAllTags() { var tagDefinitionCollectionResponse = await client.TagDefinitionsClient.ListTagDefinitionsAsync(RepositoryId).ConfigureAwait(false); @@ -21,7 +21,7 @@ public async Task ListTagDefinitions_ReturnAllTags() } [TestMethod] - public async Task ListTagDefinitions_ForEachPaging() + public async Task ForEachPaging() { int maxPageSize = 10; @@ -45,7 +45,7 @@ Task PagingCallback(TagDefinitionCollectionResponse data) } [TestMethod] - public async Task ListTagDefinitions_SimplePaging() + public async Task SimplePaging() { // Get total count of tags var tagDefinitionCollectionResponse = await client.TagDefinitionsClient.ListTagDefinitionsAsync(RepositoryId).ConfigureAwait(false); diff --git a/tests/integration/Tasks/CancelTasksTest.cs b/tests/integration/Tasks/CancelTasksTest.cs index eda84050..314246fe 100644 --- a/tests/integration/Tasks/CancelTasksTest.cs +++ b/tests/integration/Tasks/CancelTasksTest.cs @@ -15,7 +15,7 @@ public void Initialize() } [TestMethod] - public async Task CancelTasks_OperationEndedBeforeCancel() + public async Task OperationEndedBeforeCancel() { var deleteEntry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net CancelOperation").ConfigureAwait(false); StartDeleteEntryRequest body = new(); diff --git a/tests/integration/Tasks/ListTasksTest.cs b/tests/integration/Tasks/ListTasksTest.cs index 5e105547..de3cf1be 100644 --- a/tests/integration/Tasks/ListTasksTest.cs +++ b/tests/integration/Tasks/ListTasksTest.cs @@ -14,7 +14,7 @@ public void Initialize() } [TestMethod] - public async Task ListTasks_ReturnStatus() + public async Task ReturnStatus() { var deleteEntry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net GetOperationStatus").ConfigureAwait(false); diff --git a/tests/integration/TemplateDefinitions/GetTemplateDefinitionTest.cs b/tests/integration/TemplateDefinitions/GetTemplateDefinitionTest.cs index 0a253a44..fa215378 100644 --- a/tests/integration/TemplateDefinitions/GetTemplateDefinitionTest.cs +++ b/tests/integration/TemplateDefinitions/GetTemplateDefinitionTest.cs @@ -14,7 +14,7 @@ public void Initialize() } [TestMethod] - public async Task GetTemplateDefinition_ReturnTemplate() + public async Task ReturnTemplate() { var templateDefinitionCollectionResponse = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); diff --git a/tests/integration/TemplateDefinitions/ListTemplateDefinitionFieldsByTemplateNameTest.cs b/tests/integration/TemplateDefinitions/ListTemplateDefinitionFieldsByTemplateNameTest.cs index d8a28f7f..1a4d240e 100644 --- a/tests/integration/TemplateDefinitions/ListTemplateDefinitionFieldsByTemplateNameTest.cs +++ b/tests/integration/TemplateDefinitions/ListTemplateDefinitionFieldsByTemplateNameTest.cs @@ -14,7 +14,7 @@ public void Initialize() } [TestMethod] - public async Task GetTemplateDefinitionFieldsByTemplateName_ReturnTemplateFields() + public async Task ReturnTemplateFields() { var allTemplateDefinitions = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); var firstTemplateDefinition = allTemplateDefinitions.Value?.FirstOrDefault(); @@ -29,7 +29,7 @@ public async Task GetTemplateDefinitionFieldsByTemplateName_ReturnTemplateFields } [TestMethod] - public async Task GetTemplateDefinitionFieldsByTemplateName_ForEachPaging() + public async Task ForEachPaging() { int maxPageSize = 10; @@ -59,7 +59,7 @@ Task PagingCallback(TemplateFieldDefinitionCollectionResponse data) } [TestMethod] - public async Task GetTemplateDefinitionFieldsByTemplateName_SimplePaging() + public async Task SimplePaging() { var allTemplateDefinitions = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); var firstTemplateDefinition = allTemplateDefinitions.Value?.FirstOrDefault(); diff --git a/tests/integration/TemplateDefinitions/ListTemplateDefinitionsTest.cs b/tests/integration/TemplateDefinitions/ListTemplateDefinitionsTest.cs index 66cf0f65..8f1b58a3 100644 --- a/tests/integration/TemplateDefinitions/ListTemplateDefinitionsTest.cs +++ b/tests/integration/TemplateDefinitions/ListTemplateDefinitionsTest.cs @@ -14,7 +14,7 @@ public void Initialize() } [TestMethod] - public async Task GetTemplateDefinition_ReturnAllTemplates() + public async Task ReturnAllTemplates() { var templateDefinitionCollectionResponse = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); @@ -22,7 +22,7 @@ public async Task GetTemplateDefinition_ReturnAllTemplates() } [TestMethod] - public async Task GetTemplateDefinition_TemplateNameQueryParameter_ReturnSingleTemplate() + public async Task TemplateNameQueryParameter_ReturnSingleTemplate() { var allTemplateDefinitions = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); var firstTemplateDefinition = allTemplateDefinitions.Value?.FirstOrDefault(); @@ -37,7 +37,7 @@ public async Task GetTemplateDefinition_TemplateNameQueryParameter_ReturnSingleT } [TestMethod] - public async Task GetTemplateDefinition_ForEachPaging() + public async Task ForEachPaging() { int maxPageSize = 10; @@ -61,7 +61,7 @@ Task PagingCallback(TemplateDefinitionCollectionResponse data) } [TestMethod] - public async Task GetTemplateDefinition_SimplePaging() + public async Task SimplePaging() { int maxPageSize = 1; diff --git a/tests/integration/TemplateDefinitions/ListTemplateFieldDefinitionsByTemplateIdTest.cs b/tests/integration/TemplateDefinitions/ListTemplateFieldDefinitionsByTemplateIdTest.cs index 620bc8a4..7837f517 100644 --- a/tests/integration/TemplateDefinitions/ListTemplateFieldDefinitionsByTemplateIdTest.cs +++ b/tests/integration/TemplateDefinitions/ListTemplateFieldDefinitionsByTemplateIdTest.cs @@ -14,7 +14,7 @@ public void Initialize() } [TestMethod] - public async Task GetTemplateDefinitionFields_ReturnTemplateFields() + public async Task ReturnTemplateFields() { var allTemplateDefinitions = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); var firstTemplateDefinition = allTemplateDefinitions.Value?.FirstOrDefault(); @@ -29,7 +29,7 @@ public async Task GetTemplateDefinitionFields_ReturnTemplateFields() } [TestMethod] - public async Task GetTemplateDefinitionFields_ForEachPaging() + public async Task ForEachPaging() { int maxPageSize = 10; @@ -58,7 +58,7 @@ Task PagingCallback(TemplateFieldDefinitionCollectionResponse data) } [TestMethod] - public async Task GetTemplateDefinitionFields_SimplePaging() + public async Task SimplePaging() { var allTemplateDefinitions = await client.TemplateDefinitionsClient.ListTemplateDefinitionsAsync(RepositoryId).ConfigureAwait(false); var firstTemplateDefinition = allTemplateDefinitions.Value?.FirstOrDefault(); From 0046fd7f347d541632ceac41da91557750843fdf Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Thu, 14 Sep 2023 16:28:52 -0400 Subject: [PATCH 74/93] ImportEntryRequest must have its Name field filled --- tests/integration/Entries/GetEntryTest.cs | 1 + tests/integration/Entries/ImportEntryTest.cs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/tests/integration/Entries/GetEntryTest.cs b/tests/integration/Entries/GetEntryTest.cs index 1ff8def4..24f12e83 100644 --- a/tests/integration/Entries/GetEntryTest.cs +++ b/tests/integration/Entries/GetEntryTest.cs @@ -47,6 +47,7 @@ private async Task CreateDocument() string fileLocation = TempPath + "test.pdf"; var request = new ImportEntryRequest() { + Name = fileName, AutoRename = true }; diff --git a/tests/integration/Entries/ImportEntryTest.cs b/tests/integration/Entries/ImportEntryTest.cs index f72a287b..57c9c987 100644 --- a/tests/integration/Entries/ImportEntryTest.cs +++ b/tests/integration/Entries/ImportEntryTest.cs @@ -47,6 +47,7 @@ public async Task DocumentCreated() var electronicDocument = GetFileParameter(); var request = new ImportEntryRequest() { + Name = fileName, AutoRename = true }; @@ -82,6 +83,7 @@ public async Task DocumentCreatedWithTemplate() var electronicDocument = GetFileParameter(); var request = new ImportEntryRequest() { + Name = fileName, AutoRename = true, Metadata = new ImportEntryRequestMetadata() { @@ -105,6 +107,7 @@ public async Task ThrowExceptionWithCreateEntryResult() var electronicDocument = GetFileParameter(); var request = new ImportEntryRequest() { + Name = fileName, AutoRename = true, Metadata = new ImportEntryRequestMetadata() { From 53c7876069b53548171ecf1ae69d82091e0c120b Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Thu, 14 Sep 2023 16:36:00 -0400 Subject: [PATCH 75/93] Problem details have changed --- tests/integration/Entries/ImportEntryTest.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/integration/Entries/ImportEntryTest.cs b/tests/integration/Entries/ImportEntryTest.cs index 57c9c987..9738b8cb 100644 --- a/tests/integration/Entries/ImportEntryTest.cs +++ b/tests/integration/Entries/ImportEntryTest.cs @@ -123,15 +123,15 @@ public async Task ThrowExceptionWithCreateEntryResult() { Assert.IsNotNull(e?.ProblemDetails?.Title); Assert.AreEqual(e.ProblemDetails.Title, e.Message); - Assert.AreEqual((int)HttpStatusCode.Conflict, e.StatusCode); - Assert.AreEqual((int)HttpStatusCode.Conflict, e.ProblemDetails.Status); + Assert.AreEqual((int)HttpStatusCode.NotFound, e.StatusCode); + Assert.AreEqual((int)HttpStatusCode.NotFound, e.ProblemDetails.Status); Assert.IsNotNull(e.ProblemDetails.OperationId); - Assert.IsNull(e.ProblemDetails.Type); - Assert.IsNull(e.ProblemDetails.Instance); - Assert.IsNull(e.ProblemDetails.ErrorSource); - Assert.AreEqual(default, e.ProblemDetails.ErrorCode); - Assert.IsNull(e.ProblemDetails.TraceId); - Assert.AreEqual(1, e.ProblemDetails.Extensions.Count); + Assert.IsNotNull(e.ProblemDetails.Type); + Assert.IsNotNull(e.ProblemDetails.Instance); + Assert.IsNotNull(e.ProblemDetails.ErrorSource); + Assert.AreEqual(204, e.ProblemDetails.ErrorCode); + Assert.IsNotNull(e.ProblemDetails.TraceId); + Assert.AreEqual(0, e.ProblemDetails.Extensions.Count); } } } From 189b337843e7361a12b442f4a33bc271973a7134 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Thu, 14 Sep 2023 17:02:27 -0400 Subject: [PATCH 76/93] FieldToUpdate needs its Name field set --- tests/integration/Entries/SetFieldsTest.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integration/Entries/SetFieldsTest.cs b/tests/integration/Entries/SetFieldsTest.cs index f107d3d0..0d7639f4 100644 --- a/tests/integration/Entries/SetFieldsTest.cs +++ b/tests/integration/Entries/SetFieldsTest.cs @@ -55,6 +55,7 @@ public async Task SetAndReturnFields() { new FieldToUpdate() { + Name = field.Name, Values = new List { fieldValue } } } From 916e33130d01043bf80017ded01c5503909fbd79 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Thu, 14 Sep 2023 17:10:22 -0400 Subject: [PATCH 77/93] Fix set link test --- tests/integration/Entries/SetLinksTest.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/integration/Entries/SetLinksTest.cs b/tests/integration/Entries/SetLinksTest.cs index 0666cb39..c4c03664 100644 --- a/tests/integration/Entries/SetLinksTest.cs +++ b/tests/integration/Entries/SetLinksTest.cs @@ -45,7 +45,8 @@ public async Task SetAndReturnLinks() { new LinkToUpdate { - LinkDefinitionId = targetEntry.Id, + LinkDefinitionId = 1, + OtherEntryId = targetEntry.Id } } }; From 097ea84c67633f5ed4d35a65f5b4e6474a1704ab Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Thu, 14 Sep 2023 17:13:25 -0400 Subject: [PATCH 78/93] LFS behavior has changed, use a more robust check --- tests/integration/Entries/StartCopyEntryTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/Entries/StartCopyEntryTest.cs b/tests/integration/Entries/StartCopyEntryTest.cs index d3cad89f..434fb808 100644 --- a/tests/integration/Entries/StartCopyEntryTest.cs +++ b/tests/integration/Entries/StartCopyEntryTest.cs @@ -114,7 +114,7 @@ public async Task CopyShortcut() var newEntry = await client.EntriesClient.CopyEntryAsync(RepositoryId, parentEntryId, copyEntryRequest).ConfigureAwait(false); createdEntries.Add(newEntry); - Assert.IsTrue(newEntry.Name.StartsWith(createEntryRequest.Name)); + Assert.AreEqual(EntryType.Shortcut, newEntry.EntryType); Assert.AreEqual(parentEntryId, newEntry.ParentId); Assert.AreEqual(shortcut.EntryType, newEntry.EntryType); } From 7d1f0f6f8de8756c3afc45e7df8602528c9f33f7 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Thu, 14 Sep 2023 17:22:58 -0400 Subject: [PATCH 79/93] Pass in repository ID instead of task ID --- tests/integration/Searches/ListSearchContextHitsTest.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/integration/Searches/ListSearchContextHitsTest.cs b/tests/integration/Searches/ListSearchContextHitsTest.cs index 773a856f..efabf62e 100644 --- a/tests/integration/Searches/ListSearchContextHitsTest.cs +++ b/tests/integration/Searches/ListSearchContextHitsTest.cs @@ -19,9 +19,9 @@ public void Initialize() [TestCleanup] public async Task Cleanup() { - if (!string.IsNullOrEmpty(taskId)) + if (!string.IsNullOrEmpty(RepositoryId)) { - await client.TasksClient.CancelTasksAsync(taskId).ConfigureAwait(false); + await client.TasksClient.CancelTasksAsync(RepositoryId).ConfigureAwait(false); } } @@ -34,8 +34,9 @@ public async Task ReturnContextHits() SearchCommand = "({LF:Basic ~= \"*\", option=\"DFANLT\"})" }; var taskResponse = await client.SearchesClient.StartSearchEntryAsync(RepositoryId, request).ConfigureAwait(false); + taskId = taskResponse.TaskId; - AssertIsNotNullOrEmpty(taskResponse.TaskId); + AssertIsNotNullOrEmpty(taskId); await Task.Delay(5000).ConfigureAwait(false); From 3a199273a68302fe10a70393c6b8e585260afc37 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Thu, 14 Sep 2023 17:26:53 -0400 Subject: [PATCH 80/93] Non-null check is consistent with the JS client --- tests/integration/Searches/ListSearchContextHitsTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/Searches/ListSearchContextHitsTest.cs b/tests/integration/Searches/ListSearchContextHitsTest.cs index efabf62e..b7703ade 100644 --- a/tests/integration/Searches/ListSearchContextHitsTest.cs +++ b/tests/integration/Searches/ListSearchContextHitsTest.cs @@ -54,7 +54,7 @@ public async Task ReturnContextHits() // Get context hits var contextHitsCollectionResponse = await client.SearchesClient.ListSearchContextHitsAsync(RepositoryId, taskId, rowNumber).ConfigureAwait(false); - AssertCollectionResponse(contextHitsCollectionResponse); + Assert.IsNotNull(contextHitsCollectionResponse); } [TestMethod] From 7292eb0d3df00ee1c70a622152df73bfb4094021 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Thu, 14 Sep 2023 17:30:00 -0400 Subject: [PATCH 81/93] Should pass in repository ID instead --- tests/integration/Searches/ListSearchResultsTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/Searches/ListSearchResultsTest.cs b/tests/integration/Searches/ListSearchResultsTest.cs index 733857aa..b30b538e 100644 --- a/tests/integration/Searches/ListSearchResultsTest.cs +++ b/tests/integration/Searches/ListSearchResultsTest.cs @@ -20,7 +20,7 @@ public async Task Cleanup() { if (!string.IsNullOrEmpty(taskId)) { - await client.TasksClient.CancelTasksAsync(taskId).ConfigureAwait(false); + await client.TasksClient.CancelTasksAsync(RepositoryId).ConfigureAwait(false); } } From a6f667c75f7a32fdbebc026f390eda72f0cc257a Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Fri, 15 Sep 2023 10:17:48 -0400 Subject: [PATCH 82/93] Update task cancellation usage --- tests/integration/Searches/ListTasksTest.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/integration/Searches/ListTasksTest.cs b/tests/integration/Searches/ListTasksTest.cs index 612cd4c9..df303dea 100644 --- a/tests/integration/Searches/ListTasksTest.cs +++ b/tests/integration/Searches/ListTasksTest.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -21,7 +22,7 @@ public async Task Cleanup() { if (!string.IsNullOrEmpty(taskId)) { - await client.TasksClient.CancelTasksAsync(taskId).ConfigureAwait(false); + await client.TasksClient.CancelTasksAsync(RepositoryId, new List { taskId }).ConfigureAwait(false); } } From ad08f89c0e2bd1ae9cbfad0f487558b4739aac8c Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Fri, 15 Sep 2023 10:27:18 -0400 Subject: [PATCH 83/93] We already check equality using Linq --- tests/integration/Searches/ListTasksTest.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/integration/Searches/ListTasksTest.cs b/tests/integration/Searches/ListTasksTest.cs index df303dea..71d741f2 100644 --- a/tests/integration/Searches/ListTasksTest.cs +++ b/tests/integration/Searches/ListTasksTest.cs @@ -35,20 +35,21 @@ public async Task ReturnTaskStatus() SearchCommand = "({LF:Basic ~= \"search text\", option=\"DFANLT\"})" }; var taskResponse = await client.SearchesClient.StartSearchEntryAsync(RepositoryId, request).ConfigureAwait(false); + + Assert.IsNotNull(taskResponse); + taskId = taskResponse.TaskId; - - AssertIsNotNullOrEmpty(taskId); await Task.Delay(5000).ConfigureAwait(false); // Get search status - var taskCollectionResponse = await client.TasksClient.ListTasksAsync(RepositoryId).ConfigureAwait(false); + var taskCollectionResponse = await client.TasksClient.ListTasksAsync(RepositoryId, new List { taskId }).ConfigureAwait(false); AssertCollectionResponse(taskCollectionResponse); - var searchTaskId = taskCollectionResponse.Value.First(t => t.Id == taskId); - - Assert.AreEqual(taskId, searchTaskId); + var searchTaskProgress = taskCollectionResponse.Value.First(t => t.Id == taskId); + + Assert.IsNotNull(searchTaskProgress); } } } From 5a6bdb537293448a37631e1daf8c75a8422931b1 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Fri, 15 Sep 2023 10:38:32 -0400 Subject: [PATCH 84/93] Update task cancellation test since the original test no longer fits the API --- tests/integration/Tasks/CancelTasksTest.cs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/tests/integration/Tasks/CancelTasksTest.cs b/tests/integration/Tasks/CancelTasksTest.cs index 314246fe..3bac860f 100644 --- a/tests/integration/Tasks/CancelTasksTest.cs +++ b/tests/integration/Tasks/CancelTasksTest.cs @@ -1,6 +1,7 @@ using Laserfiche.Api.Client; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; namespace Laserfiche.Repository.Api.Client.IntegrationTest.Tasks @@ -15,7 +16,7 @@ public void Initialize() } [TestMethod] - public async Task OperationEndedBeforeCancel() + public async Task TaskCompletedBeforeCancellation() { var deleteEntry = await CreateEntry(client, "RepositoryApiClientIntegrationTest .Net CancelOperation").ConfigureAwait(false); StartDeleteEntryRequest body = new(); @@ -23,17 +24,13 @@ public async Task OperationEndedBeforeCancel() AssertIsNotNullOrEmpty(taskResponse.TaskId); - try - { - await Task.Delay(5000).ConfigureAwait(false); - await client.TasksClient.CancelTasksAsync(RepositoryId, new List { taskResponse.TaskId }).ConfigureAwait(false); - - Assert.Fail("Long operation should have ended before cancel."); - } - catch (ApiException e) - { - Assert.IsTrue(e.ProblemDetails.Title.Contains("Cannot cancel completed operation")); - } + await Task.Delay(5000).ConfigureAwait(false); + var cancelTaskResponse = await client.TasksClient.CancelTasksAsync(RepositoryId, new List { taskResponse.TaskId }).ConfigureAwait(false); + + Assert.IsNotNull(cancelTaskResponse); + Assert.IsNotNull(cancelTaskResponse.Value); + Assert.IsTrue(cancelTaskResponse.Value.Count > 0); + Assert.AreEqual(true, cancelTaskResponse.Value.First(r => r.Id == taskResponse.TaskId).Result); } } } From 35319b1f821e81ec2cc1d3d04d8dc3260e4ee59b Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Fri, 15 Sep 2023 10:47:44 -0400 Subject: [PATCH 85/93] There's no server session anymore, so remove its tests --- tests/unit/AccessTokens/ServerSessionsTest.cs | 224 ------------------ 1 file changed, 224 deletions(-) delete mode 100644 tests/unit/AccessTokens/ServerSessionsTest.cs diff --git a/tests/unit/AccessTokens/ServerSessionsTest.cs b/tests/unit/AccessTokens/ServerSessionsTest.cs deleted file mode 100644 index cc0c8a86..00000000 --- a/tests/unit/AccessTokens/ServerSessionsTest.cs +++ /dev/null @@ -1,224 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.AccessTokens -{ - public class ServerSessionsTest - { - [Fact] - public async Task InvalidateServerSessionAsync_200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - ODataValueOfBoolean ret = new ODataValueOfBoolean() - { - Value = true - }; - - Mock handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(ret)) - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await client.ServerSessionClient.InvalidateServerSessionAsync(repoId).ConfigureAwait(false); - Assert.True(response.Value); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/ServerSession/Invalidate"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a Post request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task InvalidateServerSessionAsync_AnyOther() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - - Mock handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.InternalServerError, - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.ServerSessionClient.InvalidateServerSessionAsync(repoId).ConfigureAwait(false)).ConfigureAwait(false); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/ServerSession/Invalidate"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a Post request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task Refresh_Server_SessionAsync_200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - ODataValueOfDateTime ret = new ODataValueOfDateTime() - { - Value = DateTime.Now - }; - - Mock handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(ret)) - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await client.ServerSessionClient.RefreshServerSessionAsync(repoId).ConfigureAwait(false); - Assert.Equal(ret.Value, response.Value); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/ServerSession/Refresh"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a Post request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task Refresh_Server_SessionAsync_AnyOther() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - - Mock handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.InternalServerError, - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.ServerSessionClient.RefreshServerSessionAsync(repoId).ConfigureAwait(false)).ConfigureAwait(false); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/ServerSession/Refresh"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a Post request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} From 838b4750ad7cd340cf95d518a4cf6574adc4beed Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Fri, 15 Sep 2023 11:09:59 -0400 Subject: [PATCH 86/93] There's no point unit testing auto generated implementation --- tests/unit/Attributes/GetAttributeKeysTest.cs | 206 -------- .../Attributes/GetAttributeValueByKeyTest.cs | 182 ------- .../unit/AuditReasons/GetAuditReasonsTest.cs | 162 ------- tests/unit/Entries/CopyEntryAsyncTest.cs | 219 --------- tests/unit/Entries/CreateCopyEntryTest.cs | 260 ---------- .../DeleteAssignedTemplateAsyncTest.cs | 137 ------ tests/unit/Entries/DeleteEntryTest.cs | 145 ------ tests/unit/Entries/ExportDocumentAsyncTest.cs | 238 --------- .../ExportDocumentWithAuditReasonAsyncTest.cs | 255 ---------- .../GetDocumentContentTypeAsyncTest.cs | 128 ----- .../Entries/GetDynamicFieldValuesAsyncTest.cs | 146 ------ tests/unit/Entries/GetEntryByFullPathTest.cs | 305 ------------ tests/unit/Entries/GetEntryFieldsTest.cs | 272 ----------- tests/unit/Entries/GetEntryInfoAsyncTest.cs | 230 --------- tests/unit/Entries/GetEntryListingTest.cs | 293 ------------ tests/unit/Entries/GetEntryTagsTest.cs | 281 ----------- .../GetLinkValuesFromEntryAsyncTest.cs | 270 ----------- tests/unit/Entries/ImportDocumentTest.cs | 450 ------------------ tests/unit/Entries/MoveEntryTest.cs | 260 ---------- tests/unit/Entries/SetEntryFieldsTest.cs | 213 --------- .../Entries/SetLinkValuesOnEntryAsyncTest.cs | 208 -------- .../Entries/SetTagValuesOnEntryAsyncTest.cs | 215 --------- .../WriteTemplateValueToEntryAsyncTest.cs | 178 ------- .../FieldDefinitionsByIdTest.cs | 152 ------ .../FieldDefinitions/FieldDefinitionsTest.cs | 266 ----------- .../LinkDefinitionsByIdTest.cs | 131 ----- .../LinkDefinitions/LinkDefinitionsTest.cs | 217 --------- .../Repositories/GetRepositoryListTest.cs | 137 ------ .../CancelCloseSearchOperationTest.cs | 124 ----- .../Searches/CreateSearchOpeartionTest.cs | 142 ------ .../unit/Searches/GetSearchContextHitsTest.cs | 318 ------------- tests/unit/Searches/GetSearchResultsTest.cs | 294 ------------ tests/unit/Searches/GetSearchStatusTest.cs | 273 ----------- tests/unit/SimpleSearches/SimpleSearchTest.cs | 305 ------------ .../TagDefinitions/TagDefinitionsByIdTest.cs | 147 ------ .../unit/TagDefinitions/TagDefinitionsTest.cs | 261 ---------- tests/unit/Tasks/CancelOperationTest.cs | 116 ----- tests/unit/Tasks/GetOperationStatusTest.cs | 197 -------- .../GetTemplateDefinitionByIdTest.cs | 143 ------ ...plateDefinitionFieldsByTemplateNameTest.cs | 307 ------------ .../GetTemplateDefinitionFieldsTest.cs | 307 ------------ .../GetTemplateDefinitionTest.cs | 268 ----------- 42 files changed, 9358 deletions(-) delete mode 100644 tests/unit/Attributes/GetAttributeKeysTest.cs delete mode 100644 tests/unit/Attributes/GetAttributeValueByKeyTest.cs delete mode 100644 tests/unit/AuditReasons/GetAuditReasonsTest.cs delete mode 100644 tests/unit/Entries/CopyEntryAsyncTest.cs delete mode 100644 tests/unit/Entries/CreateCopyEntryTest.cs delete mode 100644 tests/unit/Entries/DeleteAssignedTemplateAsyncTest.cs delete mode 100644 tests/unit/Entries/DeleteEntryTest.cs delete mode 100644 tests/unit/Entries/ExportDocumentAsyncTest.cs delete mode 100644 tests/unit/Entries/ExportDocumentWithAuditReasonAsyncTest.cs delete mode 100644 tests/unit/Entries/GetDocumentContentTypeAsyncTest.cs delete mode 100644 tests/unit/Entries/GetDynamicFieldValuesAsyncTest.cs delete mode 100644 tests/unit/Entries/GetEntryByFullPathTest.cs delete mode 100644 tests/unit/Entries/GetEntryFieldsTest.cs delete mode 100644 tests/unit/Entries/GetEntryInfoAsyncTest.cs delete mode 100644 tests/unit/Entries/GetEntryListingTest.cs delete mode 100644 tests/unit/Entries/GetEntryTagsTest.cs delete mode 100644 tests/unit/Entries/GetLinkValuesFromEntryAsyncTest.cs delete mode 100644 tests/unit/Entries/ImportDocumentTest.cs delete mode 100644 tests/unit/Entries/MoveEntryTest.cs delete mode 100644 tests/unit/Entries/SetEntryFieldsTest.cs delete mode 100644 tests/unit/Entries/SetLinkValuesOnEntryAsyncTest.cs delete mode 100644 tests/unit/Entries/SetTagValuesOnEntryAsyncTest.cs delete mode 100644 tests/unit/Entries/WriteTemplateValueToEntryAsyncTest.cs delete mode 100644 tests/unit/FieldDefinitions/FieldDefinitionsByIdTest.cs delete mode 100644 tests/unit/FieldDefinitions/FieldDefinitionsTest.cs delete mode 100644 tests/unit/LinkDefinitions/LinkDefinitionsByIdTest.cs delete mode 100644 tests/unit/LinkDefinitions/LinkDefinitionsTest.cs delete mode 100644 tests/unit/Repositories/GetRepositoryListTest.cs delete mode 100644 tests/unit/Searches/CancelCloseSearchOperationTest.cs delete mode 100644 tests/unit/Searches/CreateSearchOpeartionTest.cs delete mode 100644 tests/unit/Searches/GetSearchContextHitsTest.cs delete mode 100644 tests/unit/Searches/GetSearchResultsTest.cs delete mode 100644 tests/unit/Searches/GetSearchStatusTest.cs delete mode 100644 tests/unit/SimpleSearches/SimpleSearchTest.cs delete mode 100644 tests/unit/TagDefinitions/TagDefinitionsByIdTest.cs delete mode 100644 tests/unit/TagDefinitions/TagDefinitionsTest.cs delete mode 100644 tests/unit/Tasks/CancelOperationTest.cs delete mode 100644 tests/unit/Tasks/GetOperationStatusTest.cs delete mode 100644 tests/unit/TemplateDefinitions/GetTemplateDefinitionByIdTest.cs delete mode 100644 tests/unit/TemplateDefinitions/GetTemplateDefinitionFieldsByTemplateNameTest.cs delete mode 100644 tests/unit/TemplateDefinitions/GetTemplateDefinitionFieldsTest.cs delete mode 100644 tests/unit/TemplateDefinitions/GetTemplateDefinitionTest.cs diff --git a/tests/unit/Attributes/GetAttributeKeysTest.cs b/tests/unit/Attributes/GetAttributeKeysTest.cs deleted file mode 100644 index bdb4e6d4..00000000 --- a/tests/unit/Attributes/GetAttributeKeysTest.cs +++ /dev/null @@ -1,206 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Attributes -{ - public class GetAttributeKeysTest - { - [Fact] - public async Task GetTrusteeAttributeKeyValuePairsAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var attributeKeys = new ODataValueOfListOfAttribute() - { - Value = new List() { - new Attribute() { Key = "attributekey1", Value = "value1"}, - new Attribute() { Key = "attributekey2", Value = "value2"}, - new Attribute() { Key = "attributekey3", Value = "value3"}, - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(attributeKeys)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.AttributesClient.GetTrusteeAttributeKeyValuePairsAsync(repoId).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(attributeKeys.Value.Count, result.Value.Count); - var attributeKeysEnumerator = attributeKeys.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (attributeKeysEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(attributeKeysEnumerator.Current.Key, resultEnumerator.Current.Key); - Assert.Equal(attributeKeysEnumerator.Current.Value, resultEnumerator.Current.Value); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Attributes"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetTrusteeAttributeKeyValuePairsAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var statusCode = HttpStatusCode.Unauthorized; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.AttributesClient.GetTrusteeAttributeKeyValuePairsAsync(repoId).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Attributes"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetTrusteeAttributeKeyValuePairsAsync_WithQueryParameter_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var attributeKeys = new ODataValueOfListOfAttribute() - { - Value = new List() { - new Attribute() { Key = "attributekey1", Value = "value1"}, - new Attribute() { Key = "attributekey2", Value = "value2"}, - new Attribute() { Key = "attributekey3", Value = "value3"}, - } - }; - - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(attributeKeys)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.AttributesClient.GetTrusteeAttributeKeyValuePairsAsync(repoId, everyone: true).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(attributeKeys.Value.Count, result.Value.Count); - var attributeKeysEnumerator = attributeKeys.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (attributeKeysEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(attributeKeysEnumerator.Current.Key, resultEnumerator.Current.Key); - Assert.Equal(attributeKeysEnumerator.Current.Value, resultEnumerator.Current.Value); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Attributes?everyone=true"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Attributes/GetAttributeValueByKeyTest.cs b/tests/unit/Attributes/GetAttributeValueByKeyTest.cs deleted file mode 100644 index 3c268db0..00000000 --- a/tests/unit/Attributes/GetAttributeValueByKeyTest.cs +++ /dev/null @@ -1,182 +0,0 @@ -using System; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Attributes -{ - public class GetAttributeValueByKeyTest - { - [Fact] - public async Task GetTrusteeAttributeValueByKeyAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string attributeKey = "attributekey"; - var attributeValue = new Attribute() { Key = "attributekey1", Value = "attributevalue1"}; - - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(attributeValue)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.AttributesClient.GetTrusteeAttributeValueByKeyAsync(repoId, attributeKey).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(attributeValue.Key, result.Key); - Assert.Equal(attributeValue.Value, result.Value); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Attributes/{attributeKey}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetTrusteeAttributeValueByKeyAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string attributeKey = "attributekey"; - var statusCode = HttpStatusCode.Unauthorized; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.AttributesClient.GetTrusteeAttributeValueByKeyAsync(repoId, attributeKey).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Attributes/{attributeKey}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetTrusteeAttributeValueByKeyAsync_WithQueryParameter_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string attributeKey = "attributekey"; - var attributeValue = new Attribute() { Key = "attributekey", Value = "attributevalue1" }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(attributeValue)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.AttributesClient.GetTrusteeAttributeValueByKeyAsync(repoId, attributeKey, everyone: true).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(attributeValue.Value, result.Value); - Assert.Equal(attributeValue.Key, result.Key); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Attributes/{attributeKey}?everyone=true"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/AuditReasons/GetAuditReasonsTest.cs b/tests/unit/AuditReasons/GetAuditReasonsTest.cs deleted file mode 100644 index 2ca60e03..00000000 --- a/tests/unit/AuditReasons/GetAuditReasonsTest.cs +++ /dev/null @@ -1,162 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.AuditReasons -{ - public class GetAuditReasonsTest - { - [Fact] - public async Task GetAuditReasonsAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var auditReasons = new Client.AuditReasons() - { - DeleteEntry = new List() - { - new WAuditReason() - { - Id = 1, - Name = "first delete entry audit reason" - }, - new WAuditReason() - { - Id = 2, - Name = "second delete entry audit reason" - } - }, - ExportDocument = new List() - { - new WAuditReason() - { - Id = 10, - Name = "export document audit reason" - } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(auditReasons)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.AuditReasonsClient.GetAuditReasonsAsync(repoId).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(auditReasons.DeleteEntry.Count, result.DeleteEntry.Count); - var deleteEntryAuditReasonsEnumerator = auditReasons.DeleteEntry.GetEnumerator(); - var resultEnumerator = result.DeleteEntry.GetEnumerator(); - while (deleteEntryAuditReasonsEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(deleteEntryAuditReasonsEnumerator.Current.Id, resultEnumerator.Current.Id); - Assert.Equal(deleteEntryAuditReasonsEnumerator.Current.Name, resultEnumerator.Current.Name); - } - - Assert.Equal(auditReasons.ExportDocument.Count, result.ExportDocument.Count); - var exportDocumentAuditReasonsEnumerator = auditReasons.ExportDocument.GetEnumerator(); - resultEnumerator = result.ExportDocument.GetEnumerator(); - while (exportDocumentAuditReasonsEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(exportDocumentAuditReasonsEnumerator.Current.Id, resultEnumerator.Current.Id); - Assert.Equal(exportDocumentAuditReasonsEnumerator.Current.Name, resultEnumerator.Current.Name); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/AuditReasons"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetAuditReasonsAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var statusCode = HttpStatusCode.Unauthorized; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.AuditReasonsClient.GetAuditReasonsAsync(repoId).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/AuditReasons"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Entries/CopyEntryAsyncTest.cs b/tests/unit/Entries/CopyEntryAsyncTest.cs deleted file mode 100644 index 83faa407..00000000 --- a/tests/unit/Entries/CopyEntryAsyncTest.cs +++ /dev/null @@ -1,219 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class CopyEntryAsyncTest - { - [Fact] - public async Task CopyEntryAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - var request = new CopyAsyncRequest() - { - Name = "entry1", - SourceId = 10 - }; - var acceptedOperation = new AcceptedOperation() - { - Token = "12345-qwerqw-12345-qwer" - }; - - string requestContent = ""; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => requestContent = httpRequestMessage.Content.ReadAsStringAsync().Result) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.Created, - Content = new StringContent(JsonConvert.SerializeObject(acceptedOperation)), - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.CopyEntryAsync(repoId, entryId, request).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(acceptedOperation.Token, result.Token); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Folder/CopyAsync"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a POST request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(request), requestContent); - } - - [Fact] - public async Task CopyEntryAsync_ReturnErrorStatusCodeWithProblemDetails() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - var request = new CopyAsyncRequest() - { - Name = "entry1", - SourceId = 10 - }; - var exception = new ProblemDetails() - { - Title = "some fake message" - }; - - string requestContent = ""; - var statusCode = HttpStatusCode.BadRequest; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => requestContent = httpRequestMessage.Content.ReadAsStringAsync().Result) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode, - Content = new StringContent(JsonConvert.SerializeObject(exception)), - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.EntriesClient.CopyEntryAsync(repoId, entryId, request).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - Assert.Equal(exception.Title, response.ProblemDetails.Title); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Folder/CopyAsync"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a POST request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(request), requestContent); - } - - [Fact] - public async Task CreateEntry_WithQueryParameters_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - var request = new CopyAsyncRequest() - { - Name = "entry1", - SourceId = 10 - }; - var acceptedOperation = new AcceptedOperation() - { - Token = "12345-qwerqw-12345-qwer" - }; - - string requestContent = ""; - bool autoRename = true; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => requestContent = httpRequestMessage.Content.ReadAsStringAsync().Result) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.Created, - Content = new StringContent(JsonConvert.SerializeObject(acceptedOperation)), - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.CopyEntryAsync(repoId, entryId, request, autoRename).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(acceptedOperation.Token, result.Token); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Folder/CopyAsync?autoRename={autoRename.ToString().ToLower()}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a POST request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(request), requestContent); - } - } -} diff --git a/tests/unit/Entries/CreateCopyEntryTest.cs b/tests/unit/Entries/CreateCopyEntryTest.cs deleted file mode 100644 index abefd8bb..00000000 --- a/tests/unit/Entries/CreateCopyEntryTest.cs +++ /dev/null @@ -1,260 +0,0 @@ -using System; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class CreateCopyEntryTest - { - [Fact] - public async Task CreateOrCopyEntryAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var request = new PostEntryChildrenRequest() - { - EntryType = PostEntryChildrenEntryType.Folder, - Name = "entry1" - }; - var entry = new Folder() - { - Id = 100, - Name = "entry1", - ParentId = 1, - FullPath = @"\entry1", - FolderPath = @"\", - Creator = "", - CreationTime = DateTimeOffset.Parse("2021-01-01"), - LastModifiedTime = DateTimeOffset.Parse("2021-01-01"), - EntryType = EntryType.Folder, - TemplateName = null, - TemplateId = 0, - VolumeName = "default", - RowNumber = 1 - }; - - string requestContent = ""; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => requestContent = httpRequestMessage.Content.ReadAsStringAsync().Result) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.Created, - Content = new StringContent(JsonConvert.SerializeObject(entry)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.CreateOrCopyEntryAsync(repoId, (int)entry.ParentId, request).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(entry.Id, result.Id); - Assert.Equal(entry.Name, result.Name); - Assert.Equal(entry.ParentId, result.ParentId); - Assert.Equal(entry.FullPath, result.FullPath); - Assert.Equal(entry.FolderPath, result.FolderPath); - Assert.Equal(entry.Creator, result.Creator); - Assert.Equal(entry.CreationTime, result.CreationTime); - Assert.Equal(entry.LastModifiedTime, result.LastModifiedTime); - Assert.Equal(entry.EntryType, result.EntryType); - Assert.Equal(entry.TemplateName, result.TemplateName); - Assert.Equal(entry.TemplateId, result.TemplateId); - Assert.Equal(entry.VolumeName, result.VolumeName); - Assert.Equal(entry.RowNumber, result.RowNumber); - Assert.Equal(typeof(Folder), result.GetType()); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{(int)entry.ParentId}/Laserfiche.Repository.Folder/children"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a POST request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(request), requestContent); - } - - [Fact] - public async Task CreateOrCopyEntryAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 100; - var statusCode = HttpStatusCode.Unauthorized; - var request = new PostEntryChildrenRequest() - { - EntryType = PostEntryChildrenEntryType.Folder, - Name = "entry1" - }; - - string requestContent = ""; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => requestContent = httpRequestMessage.Content.ReadAsStringAsync().Result) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.EntriesClient.CreateOrCopyEntryAsync(repoId, entryId, request).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Folder/children"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a POST request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(request), requestContent); - } - - [Fact] - public async Task CreateOrCopyEntryAsync_WithQueryParameters_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var request = new PostEntryChildrenRequest() - { - EntryType = PostEntryChildrenEntryType.Folder, - Name = "entry1" - }; - var entry = new Folder() - { - Id = 100, - Name = "entry1", - ParentId = 1, - FullPath = @"\entry1", - FolderPath = @"\", - Creator = "", - CreationTime = DateTimeOffset.Parse("2021-01-01"), - LastModifiedTime = DateTimeOffset.Parse("2021-01-01"), - EntryType = EntryType.Folder, - TemplateName = null, - TemplateId = 0, - VolumeName = "default", - RowNumber = 1 - }; - - string requestContent = ""; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => requestContent = httpRequestMessage.Content.ReadAsStringAsync().Result) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.Created, - Content = new StringContent(JsonConvert.SerializeObject(entry)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.CreateOrCopyEntryAsync(repoId, (int)entry.ParentId, request, autoRename: true).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(entry.Id, result.Id); - Assert.Equal(entry.Name, result.Name); - Assert.Equal(entry.ParentId, result.ParentId); - Assert.Equal(entry.FullPath, result.FullPath); - Assert.Equal(entry.FolderPath, result.FolderPath); - Assert.Equal(entry.Creator, result.Creator); - Assert.Equal(entry.CreationTime, result.CreationTime); - Assert.Equal(entry.LastModifiedTime, result.LastModifiedTime); - Assert.Equal(entry.EntryType, result.EntryType); - Assert.Equal(entry.TemplateName, result.TemplateName); - Assert.Equal(entry.TemplateId, result.TemplateId); - Assert.Equal(entry.VolumeName, result.VolumeName); - Assert.Equal(entry.RowNumber, result.RowNumber); - Assert.Equal(typeof(Folder), result.GetType()); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{(int)entry.ParentId}/Laserfiche.Repository.Folder/children?autoRename=true"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a POST request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(request), requestContent); - } - } -} diff --git a/tests/unit/Entries/DeleteAssignedTemplateAsyncTest.cs b/tests/unit/Entries/DeleteAssignedTemplateAsyncTest.cs deleted file mode 100644 index d9e9149b..00000000 --- a/tests/unit/Entries/DeleteAssignedTemplateAsyncTest.cs +++ /dev/null @@ -1,137 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class DeleteAssignedTemplateAsyncTest - { - [Fact] - public async Task DeleteAssignedTemplateAsync_200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var entryId = 1; - var entry = new Folder() - { - Id = 1, - Name = "entry1", - ParentId = 1, - FullPath = @"\entry1", - FolderPath = @"\", - Creator = "", - CreationTime = DateTimeOffset.Parse("2021-01-01"), - LastModifiedTime = DateTimeOffset.Parse("2021-01-01"), - TemplateName = null, - TemplateId = 0, - VolumeName = "default", - RowNumber = 1 - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(entry)) - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.DeleteAssignedTemplateAsync(repoId, entryId).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.True(string.IsNullOrEmpty(result.TemplateName)); - Assert.Equal(0, (result.TemplateId)); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/template"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Delete // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task DeleteAssignedTemplateAsync_AnyOther() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.InternalServerError - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.EntriesClient.DeleteAssignedTemplateAsync(repoId, entryId).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/template"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Delete // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Entries/DeleteEntryTest.cs b/tests/unit/Entries/DeleteEntryTest.cs deleted file mode 100644 index ac9f296e..00000000 --- a/tests/unit/Entries/DeleteEntryTest.cs +++ /dev/null @@ -1,145 +0,0 @@ -using System; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class DeleteEntryTest - { - [Fact] - public async Task DeleteEntryInfoAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - var request = new DeleteEntryWithAuditReason() - { - AuditReasonId = 10, - Comment = "a comment" - }; - var acceptedOperation = new AcceptedOperation() - { - Token = "123-abc" - }; - - string requestContent = ""; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => requestContent = httpRequestMessage.Content.ReadAsStringAsync().Result) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.Created, - Content = new StringContent(JsonConvert.SerializeObject(acceptedOperation)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.DeleteEntryInfoAsync(repoId, entryId, request).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(acceptedOperation.Token, result.Token); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Delete // we expected a DELETE request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(request), requestContent); - } - - [Fact] - public async Task DeleteEntryInfoAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - var statusCode = HttpStatusCode.Unauthorized; - var request = new DeleteEntryWithAuditReason() - { - AuditReasonId = 10, - Comment = "a comment" - }; - - string requestContent = ""; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => requestContent = httpRequestMessage.Content.ReadAsStringAsync().Result) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.EntriesClient.DeleteEntryInfoAsync(repoId, entryId, request).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Delete // we expected a DELETE request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(request), requestContent); - } - } -} diff --git a/tests/unit/Entries/ExportDocumentAsyncTest.cs b/tests/unit/Entries/ExportDocumentAsyncTest.cs deleted file mode 100644 index 253f0527..00000000 --- a/tests/unit/Entries/ExportDocumentAsyncTest.cs +++ /dev/null @@ -1,238 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.IO; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class ExportDocumentAsyncTest - { - public class MemoryStreamJsonConverter : JsonConverter - { - public override bool CanConvert(Type objectType) - { - return typeof(MemoryStream).IsAssignableFrom(objectType); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - var bytes = serializer.Deserialize(reader); - return bytes != null ? new MemoryStream(bytes) : new MemoryStream(); - } - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - var bytes = ((MemoryStream)value).ToArray(); - serializer.Serialize(writer, bytes); - } - } - - [Fact] - public async Task ExportDocumentAsync_200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - - using (var stream = new MemoryStream()) - { - using (var writer = new StreamWriter(stream)) - { - FileResponse fileResponse = new FileResponse(200, null, stream, null, null); - - HttpResponseMessage httpResponse = new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject("hello world", Formatting.Indented, new MemoryStreamJsonConverter())) - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(httpResponse) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var swaggerResponse = await client.EntriesClient.ExportDocumentAsync(repoId, entryId, range : "bytes=0-200, 300-400").ConfigureAwait(false); - - // ASSERT - string result = ""; - using (var reader = new StreamReader(swaggerResponse.Stream)) - { - result = reader.ReadToEnd(); - } - - Assert.NotNull(swaggerResponse); - Assert.Equal(200, swaggerResponse.StatusCode); - Assert.Equal("\"hello world\"", result); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Document/edoc"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - && req.Headers.Range.Ranges.ElementAt(0).From == 0 // with range header - && req.Headers.Range.Ranges.ElementAt(0).To == 200 // with range header - && req.Headers.Range.Ranges.ElementAt(1).From == 300 // with range header - && req.Headers.Range.Ranges.ElementAt(1).To == 400 // with range header - ), - ItExpr.IsAny() - ); - } - } - } - - [Fact] - public async Task ExportDocumentAsync_206() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - - using (var stream = new MemoryStream()) - { - using (var writer = new StreamWriter(stream)) - { - FileResponse fileResponse = new FileResponse(200, null, stream, null, null); - - HttpResponseMessage httpResponse = new HttpResponseMessage() - { - StatusCode = HttpStatusCode.PartialContent, - Content = new StringContent(JsonConvert.SerializeObject("hello world", Formatting.Indented, new MemoryStreamJsonConverter())) - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(httpResponse) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var swaggerResponse = await client.EntriesClient.ExportDocumentAsync(repoId, entryId, range : "bytes=0-200, 300-400").ConfigureAwait(false); - - // ASSERT - string result = ""; - using (var reader = new StreamReader(swaggerResponse.Stream)) - { - result = reader.ReadToEnd(); - } - - Assert.NotNull(swaggerResponse); - Assert.Equal(206, swaggerResponse.StatusCode); - Assert.Equal("\"hello world\"", result); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Document/edoc"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - && req.Headers.Range.Ranges.ElementAt(0).From == 0 // with range header - && req.Headers.Range.Ranges.ElementAt(0).To == 200 // with range header - && req.Headers.Range.Ranges.ElementAt(1).From == 300 // with range header - && req.Headers.Range.Ranges.ElementAt(1).To == 400 // with range header - ), - ItExpr.IsAny() - ); - } - } - } - - [Fact] - public async Task ExportDocumentAsync_AnyOther() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.InternalServerError - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.EntriesClient.ExportDocumentAsync(repoId, entryId).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Document/edoc"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Entries/ExportDocumentWithAuditReasonAsyncTest.cs b/tests/unit/Entries/ExportDocumentWithAuditReasonAsyncTest.cs deleted file mode 100644 index 48ede4f6..00000000 --- a/tests/unit/Entries/ExportDocumentWithAuditReasonAsyncTest.cs +++ /dev/null @@ -1,255 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.IO; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class ExportDocumentWithAuditReasonAsyncTest - { - public class MemoryStreamJsonConverter : JsonConverter - { - public override bool CanConvert(Type objectType) - { - return typeof(MemoryStream).IsAssignableFrom(objectType); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - var bytes = serializer.Deserialize(reader); - return bytes != null ? new MemoryStream(bytes) : new MemoryStream(); - } - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - var bytes = ((MemoryStream)value).ToArray(); - serializer.Serialize(writer, bytes); - } - } - - [Fact] - public async Task ExportDocumentWithAuditReasonAsync_200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - - using (var stream = new MemoryStream()) - { - using (var writer = new StreamWriter(stream)) - { - _ = new FileResponse(200, null, stream, null, null); - - HttpResponseMessage httpResponse = new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject("hello world", Formatting.Indented, new MemoryStreamJsonConverter())) - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(httpResponse) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var swaggerResponse = await client.EntriesClient.ExportDocumentWithAuditReasonAsync(repoId, entryId, new GetEdocWithAuditReasonRequest() - { - AuditReasonId = 1, - Comment = "asdf" - }, range: "bytes=0-200, 300-400").ConfigureAwait(false); - - // ASSERT - string result = ""; - using (var reader = new StreamReader(swaggerResponse.Stream)) - { - result = reader.ReadToEnd(); - } - - Assert.NotNull(swaggerResponse); - Assert.Equal(200, swaggerResponse.StatusCode); - Assert.Equal("\"hello world\"", result); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Document/GetEdocWithAuditReason"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post// we expected a GET request - && req.RequestUri == expectedUri // to this uri - && req.Headers.Range.Ranges.ElementAt(0).From == 0 // with range header - && req.Headers.Range.Ranges.ElementAt(0).To == 200 // with range header - && req.Headers.Range.Ranges.ElementAt(1).From == 300 // with range header - && req.Headers.Range.Ranges.ElementAt(1).To == 400 // with range header - && req.Content.ToString() == new StringContent(JsonConvert.SerializeObject(new GetEdocWithAuditReasonRequest() - { - AuditReasonId = 1, - Comment = "asdf" - })).ToString() - ), - ItExpr.IsAny() - ); - } - } - } - - [Fact] - public async Task ExportDocumentWithAuditReasonAsync_206() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - - using (var stream = new MemoryStream()) - { - using (var writer = new StreamWriter(stream)) - { - _ = new FileResponse(200, null, stream, null, null); - - HttpResponseMessage httpResponse = new HttpResponseMessage() - { - StatusCode = HttpStatusCode.PartialContent, - Content = new StringContent(JsonConvert.SerializeObject("hello world", Formatting.Indented, new MemoryStreamJsonConverter())) - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(httpResponse) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var swaggerResponse = await client.EntriesClient.ExportDocumentWithAuditReasonAsync(repoId, entryId, new GetEdocWithAuditReasonRequest() - { - AuditReasonId = 1, - Comment = "asdf" - }, range: "bytes=0-200, 300-400").ConfigureAwait(false); - - // ASSERT - string result = ""; - using (var reader = new StreamReader(swaggerResponse.Stream)) - { - result = reader.ReadToEnd(); - } - - Assert.NotNull(swaggerResponse); - Assert.Equal(206, swaggerResponse.StatusCode); - Assert.Equal("\"hello world\"", result); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Document/GetEdocWithAuditReason"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post// we expected a GET request - && req.RequestUri == expectedUri // to this uri - && req.Headers.Range.Ranges.ElementAt(0).From == 0 // with range header - && req.Headers.Range.Ranges.ElementAt(0).To == 200 // with range header - && req.Headers.Range.Ranges.ElementAt(1).From == 300 // with range header - && req.Headers.Range.Ranges.ElementAt(1).To == 400 // with range header - ), - ItExpr.IsAny() - ); - } - } - } - - [Fact] - public async Task ExportDocumentWithAuditReasonAsync_AnyOther() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.InternalServerError - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.EntriesClient.ExportDocumentWithAuditReasonAsync(repoId, entryId, new GetEdocWithAuditReasonRequest() - { - AuditReasonId = 1, - Comment = "asdf" - }, range: "bytes=0-200, 300-400").ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Document/GetEdocWithAuditReason"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Entries/GetDocumentContentTypeAsyncTest.cs b/tests/unit/Entries/GetDocumentContentTypeAsyncTest.cs deleted file mode 100644 index 4ba0de21..00000000 --- a/tests/unit/Entries/GetDocumentContentTypeAsyncTest.cs +++ /dev/null @@ -1,128 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class GetDocumentContentTypeAsyncTest - { - [Fact] - public async Task GetDocumentContentTypeAsync_200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - - HttpResponseMessage httpResponse = new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject("asdf")) - }; - httpResponse.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html"); - httpResponse.Content.Headers.ContentLength = 123123; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(httpResponse) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var swaggerResponse = await client.EntriesClient.GetDocumentContentTypeAsync(repoId, entryId).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(swaggerResponse); - Assert.Equal(200, swaggerResponse.StatusCode); - Assert.Equal(httpResponse.Content.Headers.ContentType.ToString(), swaggerResponse.Headers["Content-Type"].ElementAt(0).ToString()); - Assert.Equal(httpResponse.Content.Headers.ContentLength.ToString(), swaggerResponse.Headers["Content-Length"].ElementAt(0).ToString()); - - // Also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Document/edoc"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Head // we expected a GET request - && req.RequestUri == expectedUri - ), // to this uri - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetDocumentContentTypeAsync_AnyOther() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.InternalServerError - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.EntriesClient.GetDocumentContentTypeAsync(repoId, entryId).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Document/edoc"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Head // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Entries/GetDynamicFieldValuesAsyncTest.cs b/tests/unit/Entries/GetDynamicFieldValuesAsyncTest.cs deleted file mode 100644 index c094b76a..00000000 --- a/tests/unit/Entries/GetDynamicFieldValuesAsyncTest.cs +++ /dev/null @@ -1,146 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class GetDynamicFieldValuesAsyncTest - { - [Fact] - public async Task GetDynamicFieldValuesAsync_200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(new Dictionary>() - { - ["additionalProp1"] = new List() { "additionalValue1" } - } - )) - }) - .Verifiable(); - - Dictionary fieldValsDict = new Dictionary(){ ["1"] = "2" }; - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await client.EntriesClient.GetDynamicFieldValuesAsync(repoId, entryId, new GetDynamicFieldLogicValueRequest() - { - TemplateId = 1, - FieldValues = fieldValsDict - } - ).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(response); - Assert.Equal(1, response.Count); - Assert.True(response.ElementAt(0).Value.Contains("additionalValue1")); - Assert.Equal(1, response.ElementAt(0).Value.Count); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/fields/GetDynamicFieldLogicValue"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post// we expected a GET request - && req.RequestUri == expectedUri // to this uri - && req.Content.ToString() == new StringContent(JsonConvert.SerializeObject(new GetDynamicFieldLogicValueRequest() - { - TemplateId = 1, - FieldValues = fieldValsDict - })).ToString() - ), - ItExpr.IsAny() - ); - } - - - [Fact] - public async Task GetDynamicFieldValuesAsync_AnyOther() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.InternalServerError - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.EntriesClient.GetDynamicFieldValuesAsync(repoId, entryId, new GetDynamicFieldLogicValueRequest() - { - TemplateId = 1, - FieldValues = new Dictionary() { ["1"] = "2" } - } - ).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/fields/GetDynamicFieldLogicValue"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Entries/GetEntryByFullPathTest.cs b/tests/unit/Entries/GetEntryByFullPathTest.cs deleted file mode 100644 index 916386d8..00000000 --- a/tests/unit/Entries/GetEntryByFullPathTest.cs +++ /dev/null @@ -1,305 +0,0 @@ -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.Web; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; -using Laserfiche.Api.Client; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class GetEntryByFullPathTest - { - [Fact] - public async Task GetEntryByPathAsync_ReturnSuccessfulEntryStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string rootPath = @"\"; - bool fallBackToClosestAncestor = true; - FindEntryResult getEntryByPath = new FindEntryResult() - { - Entry = new Folder() - { - Id = 1, - Name = "EntryName", - ParentId = 1, - FullPath = @"\", - FolderPath = null, - Creator = "", - CreationTime = DateTimeOffset.Now, - LastModifiedTime = DateTimeOffset.Now, - EntryType = EntryType.Folder, - TemplateName = "Template", - TemplateId = 2, - VolumeName = "Volume" - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(getEntryByPath)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.GetEntryByPathAsync(repoId, rootPath, fallBackToClosestAncestor).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Null(result.AncestorEntry); - Assert.Equal(getEntryByPath.AncestorEntry, result.AncestorEntry); - Assert.Equal(getEntryByPath.Entry.Id, result.Entry.Id); - Assert.Equal(getEntryByPath.Entry.Name, result.Entry.Name); - Assert.Equal(getEntryByPath.Entry.ParentId, result.Entry.ParentId); - Assert.Equal(getEntryByPath.Entry.FullPath, result.Entry.FullPath); - Assert.Equal(getEntryByPath.Entry.FolderPath, result.Entry.FolderPath); - Assert.Equal(getEntryByPath.Entry.Creator, result.Entry.Creator); - Assert.Equal(getEntryByPath.Entry.CreationTime, result.Entry.CreationTime); - Assert.Equal(getEntryByPath.Entry.LastModifiedTime, result.Entry.LastModifiedTime); - Assert.Equal(getEntryByPath.Entry.EntryType, result.Entry.EntryType); - Assert.Equal(getEntryByPath.Entry.TemplateName, result.Entry.TemplateName); - Assert.Equal(getEntryByPath.Entry.TemplateId, result.Entry.TemplateId); - Assert.Equal(getEntryByPath.Entry.VolumeName, result.Entry.VolumeName); - Assert.Equal(typeof(Folder), result.Entry.GetType()); - - // also check the 'http' call was like we expected it - string urlEncodedRootPath = HttpUtility.UrlEncode(rootPath).ToUpper(); - var expectedUri = new Uri(baseAddress + $"v1/Repositories/repoId/Entries/ByPath?fullPath={urlEncodedRootPath}&fallbackToClosestAncestor=true"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetEntryByPathAsync_ReturnSuccessfulAncestorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string nonExistingPath = @"\NonExistingPath"; - bool fallBackToClosestAncestor = true; - FindEntryResult getAncestorEntryByPath = new FindEntryResult() - { - AncestorEntry = new Folder() - { - Id = 1, - Name = "EntryName", - ParentId = 1, - FullPath = @"\", - FolderPath = null, - Creator = "", - CreationTime = DateTimeOffset.Now, - LastModifiedTime = DateTimeOffset.Now, - EntryType = EntryType.Folder, - TemplateName = "Template", - TemplateId = 2, - VolumeName = "Volume" - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(getAncestorEntryByPath)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.GetEntryByPathAsync(repoId, nonExistingPath, fallBackToClosestAncestor).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Null(result.Entry); - Assert.Equal(getAncestorEntryByPath.Entry, result.Entry); - Assert.Equal(getAncestorEntryByPath.AncestorEntry.Id, result.AncestorEntry.Id); - Assert.Equal(getAncestorEntryByPath.AncestorEntry.Name, result.AncestorEntry.Name); - Assert.Equal(getAncestorEntryByPath.AncestorEntry.ParentId, result.AncestorEntry.ParentId); - Assert.Equal(getAncestorEntryByPath.AncestorEntry.FullPath, result.AncestorEntry.FullPath); - Assert.Equal(getAncestorEntryByPath.AncestorEntry.FolderPath, result.AncestorEntry.FolderPath); - Assert.Equal(getAncestorEntryByPath.AncestorEntry.Creator, result.AncestorEntry.Creator); - Assert.Equal(getAncestorEntryByPath.AncestorEntry.CreationTime, result.AncestorEntry.CreationTime); - Assert.Equal(getAncestorEntryByPath.AncestorEntry.LastModifiedTime, result.AncestorEntry.LastModifiedTime); - Assert.Equal(getAncestorEntryByPath.AncestorEntry.EntryType, result.AncestorEntry.EntryType); - Assert.Equal(getAncestorEntryByPath.AncestorEntry.TemplateName, result.AncestorEntry.TemplateName); - Assert.Equal(getAncestorEntryByPath.AncestorEntry.TemplateId, result.AncestorEntry.TemplateId); - Assert.Equal(getAncestorEntryByPath.AncestorEntry.VolumeName, result.AncestorEntry.VolumeName); - Assert.Equal(typeof(Folder), result.AncestorEntry.GetType()); - - // also check the 'http' call was like we expected it - string urlEncodedRootPath = HttpUtility.UrlEncode(nonExistingPath); - urlEncodedRootPath = urlEncodedRootPath.Replace("c", "C"); - var expectedUri = new Uri(baseAddress + $"v1/Repositories/repoId/Entries/ByPath?fullPath={urlEncodedRootPath}&fallbackToClosestAncestor=true"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetEntryByPathAsync_ReturnUnauthorizedCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string rootPath = @"\"; - bool fallBackToClosestAncestor = true; - var statusCode = HttpStatusCode.Unauthorized; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.EntriesClient.GetEntryByPathAsync(repoId, rootPath, fallBackToClosestAncestor).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - string urlEncodedRootPath = HttpUtility.UrlEncode(rootPath).ToUpper(); - var expectedUri = new Uri(baseAddress + $"v1/Repositories/repoId/Entries/ByPath?fullPath={urlEncodedRootPath}&fallbackToClosestAncestor=true"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetEntryByPathAsync_ReturnNotFoundCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string nonExistingPath = @"\NonExistingPath"; - bool fallBackToClosestAncestor = false; - var statusCode = HttpStatusCode.NotFound; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.EntriesClient.GetEntryByPathAsync(repoId, nonExistingPath, fallBackToClosestAncestor).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - string urlEncodedRootPath = HttpUtility.UrlEncode(nonExistingPath); - urlEncodedRootPath = urlEncodedRootPath.Replace("c", "C"); - var expectedUri = new Uri(baseAddress + $"v1/Repositories/repoId/Entries/ByPath?fullPath={urlEncodedRootPath}&fallbackToClosestAncestor=false"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Entries/GetEntryFieldsTest.cs b/tests/unit/Entries/GetEntryFieldsTest.cs deleted file mode 100644 index 31c21aa0..00000000 --- a/tests/unit/Entries/GetEntryFieldsTest.cs +++ /dev/null @@ -1,272 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class GetEntryFieldsTest - { - [Fact] - public async Task GetFieldValuesAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - ODataValueOfIListOfFieldValue entryFields = new ODataValueOfIListOfFieldValue() - { - Value = new List() - { - new FieldValue() - { - FieldName = "Field1", - FieldType = WFieldType.String, - GroupId = 0, - FieldId = 1, - IsMultiValue = false, - IsRequired = false, - Values = new List>() - { - new Dictionary(){ ["value"] = "field value 1", ["position"] = 0 } - } - }, - new FieldValue() - { - FieldName = "Field2", - FieldType = WFieldType.String, - GroupId = 0, - FieldId = 2, - IsMultiValue = false, - IsRequired = false, - Values = new List>() - { - new Dictionary(){ ["value"] = "field value 2", ["position"] = 0 } - } - } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(entryFields)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.GetFieldValuesAsync(repoId, entryId).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(entryFields.Value.Count, result.Value.Count); - var fieldsEnumerator = entryFields.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (fieldsEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(fieldsEnumerator.Current.FieldName, resultEnumerator.Current.FieldName); - Assert.Equal(fieldsEnumerator.Current.FieldType, resultEnumerator.Current.FieldType); - Assert.Equal(fieldsEnumerator.Current.GroupId, resultEnumerator.Current.GroupId); - Assert.Equal(fieldsEnumerator.Current.FieldId, resultEnumerator.Current.FieldId); - Assert.Equal(fieldsEnumerator.Current.IsMultiValue, resultEnumerator.Current.IsMultiValue); - Assert.Equal(fieldsEnumerator.Current.IsRequired, resultEnumerator.Current.IsRequired); - Assert.Equal(fieldsEnumerator.Current.Values.Count, resultEnumerator.Current.Values.Count); - Assert.Equal(fieldsEnumerator.Current.Values.First()["value"], resultEnumerator.Current.Values.First()["value"]); - Assert.Equal(Convert.ToInt32(fieldsEnumerator.Current.Values.First()["position"]), Convert.ToInt32(resultEnumerator.Current.Values.First()["position"])); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/fields"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetFieldValuesAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - var statusCode = HttpStatusCode.Unauthorized; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.EntriesClient.GetFieldValuesAsync(repoId, entryId).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/fields"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetFieldValuesAsync_WithPreferHeader_WithQueryParameters_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - string preferHeaderValue = "maxpagesize=1"; - bool formatValue = true; - string culture = "en"; - string selectQueryParameter = "fieldName"; - string orderbyQueryParameter = "fieldName"; - int topQueryParameter = 1; - int skipQueryParameter = 1; - bool countQueryParameter = true; - ODataValueOfIListOfFieldValue entryFields = new ODataValueOfIListOfFieldValue() - { - Value = new List() - { - new FieldValue() - { - FieldName = "Field1", - FieldType = WFieldType.String, - GroupId = 0, - FieldId = 1, - IsMultiValue = false, - IsRequired = false, - Values = new List>() - { - new Dictionary(){ ["value"] = "field value 1", ["position"] = 0 } - } - } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(entryFields)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.GetFieldValuesAsync(repoId, entryId, prefer: preferHeaderValue, - formatValue: formatValue, culture: culture, select: selectQueryParameter, orderby: orderbyQueryParameter, - top: topQueryParameter, skip: skipQueryParameter, count: countQueryParameter).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(entryFields.Value.Count, result.Value.Count); - var fieldsEnumerator = entryFields.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (fieldsEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(fieldsEnumerator.Current.FieldName, resultEnumerator.Current.FieldName); - Assert.Equal(fieldsEnumerator.Current.FieldType, resultEnumerator.Current.FieldType); - Assert.Equal(fieldsEnumerator.Current.GroupId, resultEnumerator.Current.GroupId); - Assert.Equal(fieldsEnumerator.Current.FieldId, resultEnumerator.Current.FieldId); - Assert.Equal(fieldsEnumerator.Current.IsMultiValue, resultEnumerator.Current.IsMultiValue); - Assert.Equal(fieldsEnumerator.Current.IsRequired, resultEnumerator.Current.IsRequired); - Assert.Equal(fieldsEnumerator.Current.Values.Count, resultEnumerator.Current.Values.Count); - Assert.Equal(fieldsEnumerator.Current.Values.First()["value"], resultEnumerator.Current.Values.First()["value"]); - Assert.Equal(Convert.ToInt32(fieldsEnumerator.Current.Values.First()["position"]), Convert.ToInt32(resultEnumerator.Current.Values.First()["position"])); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/fields?" + - $"formatValue={formatValue.ToString().ToLower()}&culture={culture}&%24select={selectQueryParameter}&%24orderby={orderbyQueryParameter}&%24top={topQueryParameter}&" + - $"%24skip={skipQueryParameter}&%24count={countQueryParameter.ToString().ToLower()}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - && req.Headers.Contains("Prefer") // and Prefer header with maxpagesize value - && req.Headers.GetValues("Prefer").FirstOrDefault() == preferHeaderValue - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Entries/GetEntryInfoAsyncTest.cs b/tests/unit/Entries/GetEntryInfoAsyncTest.cs deleted file mode 100644 index 496f622f..00000000 --- a/tests/unit/Entries/GetEntryInfoAsyncTest.cs +++ /dev/null @@ -1,230 +0,0 @@ -using System; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class GetEntryInfoAsyncTest - { - [Fact] - public async Task GetEntryAsync_Return200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - Entry entry = new Folder() { - Id = 10, - Name = "EntryName", - ParentId = 1, - FullPath = "/EntryName", - FolderPath = "/EntryName", - Creator = "Creator", - CreationTime = DateTimeOffset.Now, - LastModifiedTime = DateTimeOffset.Now, - EntryType = EntryType.Folder, - TemplateName = "Template", - TemplateId = 2, - VolumeName = "Volume" - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(entry)), - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.GetEntryAsync(repoId, entry.Id).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(entry.Id, result.Id); - Assert.Equal(entry.Name, result.Name); - Assert.Equal(entry.ParentId, result.ParentId); - Assert.Equal(entry.FullPath, result.FullPath); - Assert.Equal(entry.FolderPath, result.FolderPath); - Assert.Equal(entry.Creator, result.Creator); - Assert.Equal(entry.CreationTime, result.CreationTime); - Assert.Equal(entry.LastModifiedTime, result.LastModifiedTime); - Assert.Equal(entry.EntryType, result.EntryType); - Assert.Equal(entry.TemplateName, result.TemplateName); - Assert.Equal(entry.TemplateId, result.TemplateId); - Assert.Equal(entry.VolumeName, result.VolumeName); - Assert.Equal(typeof(Folder), result.GetType()); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entry.Id}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetEntryAsync_Return401() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - var statusCode = HttpStatusCode.Unauthorized; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.EntriesClient.GetEntryAsync(repoId, entryId).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetEntryAsync_WithQueryParameters_Return200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string selectQueryParameter = "name"; - Entry entry = new Folder() - { - Id = 10, - Name = "EntryName", - ParentId = 1, - FullPath = "/EntryName", - FolderPath = "/EntryName", - Creator = "Creator", - CreationTime = DateTimeOffset.Now, - LastModifiedTime = DateTimeOffset.Now, - EntryType = EntryType.Folder, - TemplateName = "Template", - TemplateId = 2, - VolumeName = "Volume" - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(entry)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.GetEntryAsync(repoId, entry.Id, select: selectQueryParameter).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(entry.Id, result.Id); - Assert.Equal(entry.Name, result.Name); - Assert.Equal(entry.ParentId, result.ParentId); - Assert.Equal(entry.FullPath, result.FullPath); - Assert.Equal(entry.FolderPath, result.FolderPath); - Assert.Equal(entry.Creator, result.Creator); - Assert.Equal(entry.CreationTime, result.CreationTime); - Assert.Equal(entry.LastModifiedTime, result.LastModifiedTime); - Assert.Equal(entry.EntryType, result.EntryType); - Assert.Equal(entry.TemplateName, result.TemplateName); - Assert.Equal(entry.TemplateId, result.TemplateId); - Assert.Equal(entry.VolumeName, result.VolumeName); - Assert.Equal(typeof(Folder), result.GetType()); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entry.Id}?%24select={selectQueryParameter}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} \ No newline at end of file diff --git a/tests/unit/Entries/GetEntryListingTest.cs b/tests/unit/Entries/GetEntryListingTest.cs deleted file mode 100644 index c18cf671..00000000 --- a/tests/unit/Entries/GetEntryListingTest.cs +++ /dev/null @@ -1,293 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class GetEntryListingTest - { - [Fact] - public async Task GetEntryListingAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - ODataValueContextOfIListOfEntry entries = new ODataValueContextOfIListOfEntry() - { - Value = new List() - { - new Document() - { - Id = 100, - Name = "entry1", - ParentId = 1, - FullPath = @"\entry1", - FolderPath = @"\", - Creator = "", - CreationTime = DateTimeOffset.Parse("2021-01-01"), - LastModifiedTime = DateTimeOffset.Parse("2021-01-01"), - EntryType = EntryType.Document, - TemplateName = null, - TemplateId = 0, - VolumeName = "default", - RowNumber = 1 - }, - new Document() - { - Id = 101, - Name = "entry2", - ParentId = 1, - FullPath = @"\entry2", - FolderPath = @"\", - Creator = "", - CreationTime = DateTimeOffset.Parse("2021-01-01"), - LastModifiedTime = DateTimeOffset.Parse("2021-01-01"), - EntryType = EntryType.Document, - TemplateName = null, - TemplateId = 0, - VolumeName = "default", - RowNumber = 2 - } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(entries)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.GetEntryListingAsync(repoId, entryId).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(entries.Value.Count, result.Value.Count); - var entriesEnumerator = entries.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (entriesEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(entriesEnumerator.Current.Id, resultEnumerator.Current.Id); - Assert.Equal(entriesEnumerator.Current.Name, resultEnumerator.Current.Name); - Assert.Equal(entriesEnumerator.Current.ParentId, resultEnumerator.Current.ParentId); - Assert.Equal(entriesEnumerator.Current.FullPath, resultEnumerator.Current.FullPath); - Assert.Equal(entriesEnumerator.Current.FolderPath, resultEnumerator.Current.FolderPath); - Assert.Equal(entriesEnumerator.Current.Creator, resultEnumerator.Current.Creator); - Assert.Equal(entriesEnumerator.Current.CreationTime, resultEnumerator.Current.CreationTime); - Assert.Equal(entriesEnumerator.Current.LastModifiedTime, resultEnumerator.Current.LastModifiedTime); - Assert.Equal(entriesEnumerator.Current.EntryType, resultEnumerator.Current.EntryType); - Assert.Equal(entriesEnumerator.Current.TemplateName, resultEnumerator.Current.TemplateName); - Assert.Equal(entriesEnumerator.Current.TemplateId, resultEnumerator.Current.TemplateId); - Assert.Equal(entriesEnumerator.Current.VolumeName, resultEnumerator.Current.VolumeName); - Assert.Equal(entriesEnumerator.Current.RowNumber, resultEnumerator.Current.RowNumber); - Assert.Equal(typeof(Document), resultEnumerator.Current.GetType()); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Folder/children"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetEntryListingAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - var statusCode = HttpStatusCode.Unauthorized; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.EntriesClient.GetEntryListingAsync(repoId, entryId).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Folder/children"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetEntryListingAsync_WithPreferHeader_WithQueryParameters_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - bool groupByEntryType = true; - string preferHeaderValue = "maxpagesize=1"; - string selectQueryParameter = "name"; - string orderbyQueryParameter = "name"; - int topQueryParameter = 1; - int skipQueryParameter = 1; - bool countQueryParameter = true; - bool formatFields = true; - string culture = "fr"; - ODataValueOfIListOfEntry entries = new ODataValueOfIListOfEntry() - { - Value = new List() - { - new Document() - { - Id = 100, - Name = "entry1", - ParentId = 1, - FullPath = @"\entry1", - FolderPath = @"\", - Creator = "", - CreationTime = DateTimeOffset.Parse("2021-01-01"), - LastModifiedTime = DateTimeOffset.Parse("2021-01-01"), - EntryType = EntryType.Document, - TemplateName = null, - TemplateId = 0, - VolumeName = "default", - RowNumber = 1 - } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(entries)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.GetEntryListingAsync(repoId, entryId, groupByEntryType: groupByEntryType, - fields: new List() { "field1", "field2" }, formatFields: formatFields, prefer: preferHeaderValue, culture: culture, select: selectQueryParameter, - orderby: orderbyQueryParameter,top: topQueryParameter, skip: skipQueryParameter, count: countQueryParameter).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(entries.Value.Count, result.Value.Count); - var entriesEnumerator = entries.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (entriesEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(entriesEnumerator.Current.Id, resultEnumerator.Current.Id); - Assert.Equal(entriesEnumerator.Current.Name, resultEnumerator.Current.Name); - Assert.Equal(entriesEnumerator.Current.ParentId, resultEnumerator.Current.ParentId); - Assert.Equal(entriesEnumerator.Current.FullPath, resultEnumerator.Current.FullPath); - Assert.Equal(entriesEnumerator.Current.FolderPath, resultEnumerator.Current.FolderPath); - Assert.Equal(entriesEnumerator.Current.Creator, resultEnumerator.Current.Creator); - Assert.Equal(entriesEnumerator.Current.CreationTime, resultEnumerator.Current.CreationTime); - Assert.Equal(entriesEnumerator.Current.LastModifiedTime, resultEnumerator.Current.LastModifiedTime); - Assert.Equal(entriesEnumerator.Current.EntryType, resultEnumerator.Current.EntryType); - Assert.Equal(entriesEnumerator.Current.TemplateName, resultEnumerator.Current.TemplateName); - Assert.Equal(entriesEnumerator.Current.TemplateId, resultEnumerator.Current.TemplateId); - Assert.Equal(entriesEnumerator.Current.VolumeName, resultEnumerator.Current.VolumeName); - Assert.Equal(entriesEnumerator.Current.RowNumber, resultEnumerator.Current.RowNumber); - Assert.Equal(typeof(Document), resultEnumerator.Current.GetType()); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/Laserfiche.Repository.Folder/children?" + - $"groupByEntryType={groupByEntryType.ToString().ToLower()}&fields=field1&fields=field2&formatFields={formatFields.ToString().ToLower()}" + - $"&culture={culture}&%24select={selectQueryParameter}&%24orderby={orderbyQueryParameter}&" + - $"%24top={topQueryParameter}&%24skip={skipQueryParameter}&%24count={countQueryParameter.ToString().ToLower()}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - && req.Headers.Contains("Prefer") // and Prefer header with maxpagesize value - && req.Headers.GetValues("Prefer").FirstOrDefault() == preferHeaderValue - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Entries/GetEntryTagsTest.cs b/tests/unit/Entries/GetEntryTagsTest.cs deleted file mode 100644 index 1a0ffeeb..00000000 --- a/tests/unit/Entries/GetEntryTagsTest.cs +++ /dev/null @@ -1,281 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class GetEntryTagsTest - { - [Fact] - public async Task GetTagsAssignedToEntryAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - ODataValueOfIListOfWTagInfo entryTags = new ODataValueOfIListOfWTagInfo() - { - Value = new List() - { - new WTagInfo() - { - Id = 1, - Name = "TagName", - Description = "Description", - IsSecure = true, - Watermark = new Watermark() - { - WatermarkText = "Watermark Text", - WatermarkTextSize = 3, - IsWatermarkMandatory = true, - WatermarkIntensity = 4, - WatermarkPosition = WatermarkPosition.TopLeft, - WatermarkRotationAngle = 5 - } - }, - new WTagInfo() - { - Id = 2, - Name = "TagName2", - Description = "Description2", - IsSecure = false, - Watermark = new Watermark() - { - WatermarkText = "Watermark Text2", - WatermarkTextSize = 6, - IsWatermarkMandatory = false, - WatermarkIntensity = 7, - WatermarkPosition = WatermarkPosition.TopRight, - WatermarkRotationAngle = 8 - } - } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(entryTags)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.GetTagsAssignedToEntryAsync(repoId, entryId).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(entryTags.Value.Count, result.Value.Count); - var tagEnumerator = entryTags.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (tagEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(tagEnumerator.Current.Id, resultEnumerator.Current.Id); - Assert.Equal(tagEnumerator.Current.Name, resultEnumerator.Current.Name); - Assert.Equal(tagEnumerator.Current.Description, resultEnumerator.Current.Description); - Assert.Equal(tagEnumerator.Current.IsSecure, resultEnumerator.Current.IsSecure); - Assert.Equal(tagEnumerator.Current.Watermark.WatermarkText, resultEnumerator.Current.Watermark.WatermarkText); - Assert.Equal(tagEnumerator.Current.Watermark.WatermarkTextSize, resultEnumerator.Current.Watermark.WatermarkTextSize); - Assert.Equal(tagEnumerator.Current.Watermark.IsWatermarkMandatory, resultEnumerator.Current.Watermark.IsWatermarkMandatory); - Assert.Equal(tagEnumerator.Current.Watermark.WatermarkIntensity, resultEnumerator.Current.Watermark.WatermarkIntensity); - Assert.Equal(tagEnumerator.Current.Watermark.WatermarkPosition, resultEnumerator.Current.Watermark.WatermarkPosition); - Assert.Equal(tagEnumerator.Current.Watermark.WatermarkRotationAngle, resultEnumerator.Current.Watermark.WatermarkRotationAngle); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/tags"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetTagsAssignedToEntryAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - var statusCode = HttpStatusCode.Unauthorized; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.EntriesClient.GetTagsAssignedToEntryAsync(repoId, entryId).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/tags"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetTagsAssignedToEntryAsync_WithPreferHeader_WithQueryParameters_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - string preferHeaderValue = "maxpagesize=1"; - string selectQueryParameter = "description"; - string orderbyQueryParameter = "name"; - int topQueryParameter = 1; - int skipQueryParameter = 1; - bool countQueryParameter = true; - ODataValueOfIListOfWTagInfo entryTags = new ODataValueOfIListOfWTagInfo() - { - Value = new List() - { - new WTagInfo() - { - Id = 1, - Name = "TagName", - Description = "Description", - IsSecure = true, - Watermark = new Watermark() - { - WatermarkText = "Watermark Text", - WatermarkTextSize = 3, - IsWatermarkMandatory = true, - WatermarkIntensity = 4, - WatermarkPosition = WatermarkPosition.TopLeft, - WatermarkRotationAngle = 5 - } - } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(entryTags)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.GetTagsAssignedToEntryAsync(repoId, entryId, prefer: preferHeaderValue, - select: selectQueryParameter, orderby: orderbyQueryParameter, top: topQueryParameter, - skip: skipQueryParameter, count: countQueryParameter).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(entryTags.Value.Count, result.Value.Count); - var tagEnumerator = entryTags.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (tagEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(tagEnumerator.Current.Id, resultEnumerator.Current.Id); - Assert.Equal(tagEnumerator.Current.Name, resultEnumerator.Current.Name); - Assert.Equal(tagEnumerator.Current.Description, resultEnumerator.Current.Description); - Assert.Equal(tagEnumerator.Current.IsSecure, resultEnumerator.Current.IsSecure); - Assert.Equal(tagEnumerator.Current.Watermark.WatermarkText, resultEnumerator.Current.Watermark.WatermarkText); - Assert.Equal(tagEnumerator.Current.Watermark.WatermarkTextSize, resultEnumerator.Current.Watermark.WatermarkTextSize); - Assert.Equal(tagEnumerator.Current.Watermark.IsWatermarkMandatory, resultEnumerator.Current.Watermark.IsWatermarkMandatory); - Assert.Equal(tagEnumerator.Current.Watermark.WatermarkIntensity, resultEnumerator.Current.Watermark.WatermarkIntensity); - Assert.Equal(tagEnumerator.Current.Watermark.WatermarkPosition, resultEnumerator.Current.Watermark.WatermarkPosition); - Assert.Equal(tagEnumerator.Current.Watermark.WatermarkRotationAngle, resultEnumerator.Current.Watermark.WatermarkRotationAngle); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/tags?" + - $"%24select={selectQueryParameter}&%24orderby={orderbyQueryParameter}&%24top={topQueryParameter}&" + - $"%24skip={skipQueryParameter}&%24count={countQueryParameter.ToString().ToLower()}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - && req.Headers.Contains("Prefer") // and Prefer header with maxpagesize value - && req.Headers.GetValues("Prefer").FirstOrDefault() == preferHeaderValue - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Entries/GetLinkValuesFromEntryAsyncTest.cs b/tests/unit/Entries/GetLinkValuesFromEntryAsyncTest.cs deleted file mode 100644 index 0c00642b..00000000 --- a/tests/unit/Entries/GetLinkValuesFromEntryAsyncTest.cs +++ /dev/null @@ -1,270 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class GetLinkValuesFromEntryAsyncTest - { - [Fact] - public async Task GetLinkValuesFromEntryAsync_200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - - WEntryLinkInfo entryLinkInfo = new WEntryLinkInfo() - { - LinkId = 1, - SourceId = 2, - SourceFullPath = "sourceFullPath", - SourceLabel = "sourceLabel", - TargetId = 3, - TargetFullPath = "targetFullPath", - TargetLabel = "targetLabel", - Description = "description", - LinkTypeId = 123, - LinkTypeDescription = "linkTypeDescription", - LinkProperties = new Dictionary() { ["1"] = "2" }, - SourceLink = "sourceLink", - TargetLink = "targetLink" - }; - - WEntryLinkInfo entryLinkInfo2 = new WEntryLinkInfo() - { - LinkId = 2, - SourceId = 3, - SourceFullPath = "sourceFullPath2", - SourceLabel = "sourceLabel2", - TargetId = 4, - TargetFullPath = "targetFullPath2", - TargetLabel = "targetLabel2", - Description = "description2", - LinkTypeId = 456, - LinkTypeDescription = "linkTypeDescription2", - LinkProperties = new Dictionary() { ["3"] = "4" }, - SourceLink = "sourceLink2", - TargetLink = "targetLink2" - }; - - IList links = new List() { entryLinkInfo, entryLinkInfo2 }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(new ODataValueOfIListOfWEntryLinkInfo() { Value = links })) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await client.EntriesClient.GetLinkValuesFromEntryAsync(repoId, entryId).ConfigureAwait(false); - - var result = response.Value; - - // ASSERT - Assert.NotNull(result); - Assert.Equal(2, result.Count); - for (int i = 0; i < result.Count; i++) - { - Assert.Equal(links.ElementAt(i).LinkId, result.ElementAt(i).LinkId); - Assert.Equal(links.ElementAt(i).SourceId, result.ElementAt(i).SourceId); - Assert.Equal(links.ElementAt(i).SourceFullPath, result.ElementAt(i).SourceFullPath); - Assert.Equal(links.ElementAt(i).SourceLabel, result.ElementAt(i).SourceLabel); - Assert.Equal(links.ElementAt(i).TargetId, result.ElementAt(i).TargetId); - Assert.Equal(links.ElementAt(i).TargetFullPath, result.ElementAt(i).TargetFullPath); - Assert.Equal(links.ElementAt(i).TargetLabel, result.ElementAt(i).TargetLabel); - Assert.Equal(links.ElementAt(i).TargetLink, result.ElementAt(i).TargetLink); - Assert.Equal(links.ElementAt(i).Description, result.ElementAt(i).Description); - Assert.Equal(links.ElementAt(i).LinkTypeId, result.ElementAt(i).LinkTypeId); - Assert.Equal(links.ElementAt(i).LinkTypeDescription, result.ElementAt(i).LinkTypeDescription); - Assert.Equal(links.ElementAt(i).SourceLink, result.ElementAt(i).SourceLink); - foreach (var x in links.ElementAt(i).LinkProperties) - { - Assert.Equal(links.ElementAt(i).LinkProperties[x.Key], result.ElementAt(i).LinkProperties[x.Key]); - } - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/links"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri - ), // to this uri - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetLinkValuesFromEntryAsync_AnyOther() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.InternalServerError - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.EntriesClient.GetLinkValuesFromEntryAsync(repoId, entryId).ConfigureAwait(false)).ConfigureAwait(false); - - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/links"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetLinkValuesFromEntryAsync_ODataQueryOptions() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - - WEntryLinkInfo entryLinkInfo = new WEntryLinkInfo() - { - LinkId = 1, - SourceId = 2, - SourceFullPath = "sourceFullPath", - SourceLabel = "sourceLabel", - TargetId = 3, - TargetFullPath = "targetFullPath", - TargetLabel = "targetLabel", - Description = "description", - LinkTypeId = 123, - LinkTypeDescription = "linkTypeDescription", - LinkProperties = new Dictionary() { ["1"] = "2" }, - SourceLink = "sourceLink", - TargetLink = "targetLink" - }; - - WEntryLinkInfo entryLinkInfo2 = new WEntryLinkInfo() - { - LinkId = 2, - SourceId = 3, - SourceFullPath = "sourceFullPath2", - SourceLabel = "sourceLabel2", - TargetId = 4, - TargetFullPath = "targetFullPath2", - TargetLabel = "targetLabel2", - Description = "description2", - LinkTypeId = 456, - LinkTypeDescription = "linkTypeDescription2", - LinkProperties = new Dictionary() { ["3"] = "4" }, - SourceLink = "sourceLink2", - TargetLink = "targetLink2" - }; - - IList links = new List() { entryLinkInfo, entryLinkInfo2 }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(new ODataValueOfIListOfWEntryLinkInfo() - { - Value = links - })) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.GetLinkValuesFromEntryAsync(repoId, entryId, prefer: "Prefer", select: "select", orderby: "orderBy", top: 1, skip: 1, count: true).ConfigureAwait(false); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri("http://api.laserfiche.com/v1/Repositories/repoId/Entries/1/links?%24select=select&%24orderby=orderBy&%24top=1&%24skip=1&%24count=true"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Entries/ImportDocumentTest.cs b/tests/unit/Entries/ImportDocumentTest.cs deleted file mode 100644 index af8d9df2..00000000 --- a/tests/unit/Entries/ImportDocumentTest.cs +++ /dev/null @@ -1,450 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class ImportDocumentTest - { - [Fact] - public async Task ImportDocumentAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int parentEntryId = 1; - string fileName = "importdocument"; - string fileContent = "importdocument content"; - using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(fileContent))) - { - var electronicDocument = new FileParameter(stream, fileName, "application/pdf"); - var request = new PostEntryWithEdocMetadataRequest() - { - Template = "template", - Metadata = new PutFieldValsRequest() - { - Fields = new Dictionary() - { - ["field1"] = new FieldToUpdate() - { - Values = new List() - { - new ValueToUpdate() { Value = "new value", Position = 1 }, - new ValueToUpdate() { Value = "second value", Position = 2 } - } - }, - ["field2"] = new FieldToUpdate() - { - Values = new List() - { - new ValueToUpdate() { Value = "new value for field 2", Position = 1 }, - } - } - }, - Tags = new List() { "tag1", "tag2" }, - Links = new List() - { - new LinkToUpdate() - { - LinkTypeId = 1, - OtherSourceId = 123, - IsSource = true - } - } - } - }; - var createEntryResult = new CreateEntryResult() - { - Operations = new CreateEntryOperations() - { - EntryCreate = new EntryCreate() - { - EntryId = 100, - Exceptions = new List() - }, - SetEdoc = new SetEdoc() - { - Exceptions = new List() - }, - SetTemplate = new SetTemplate() - { - Template = request.Template, - Exceptions = new List() - }, - SetFields = new SetFields() - { - FieldCount = request.Metadata.Fields.Count, - Exceptions = new List() - }, - SetTags = new SetTags() - { - AssignedTags = request.Metadata.Tags, - Exceptions = new List() - }, - SetLinks = new SetLinks() - { - OtherEntryIds = request.Metadata.Links.Select(linkToUpdate => linkToUpdate.OtherSourceId).ToList(), - Exceptions = new List() - } - }, - DocumentLink = "link to created document" - }; - - string requestBodyContent = ""; - string requestFileContent = ""; - string requestFileContentType = ""; - string requestFileName = ""; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => - { - if (httpRequestMessage.Content is MultipartFormDataContent multipartFormDataContent) - { - foreach(var formContent in multipartFormDataContent) - { - if (formContent is StringContent stringContent) - { - requestBodyContent = stringContent.ReadAsStringAsync().Result; - } - else if (formContent is StreamContent streamContent) - { - requestFileContent = streamContent.ReadAsStringAsync().Result; - requestFileContentType = streamContent.Headers.ContentType.MediaType; - requestFileName = streamContent.Headers.ContentDisposition.FileName; - } - } - } - }) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.Created, - Content = new StringContent(JsonConvert.SerializeObject(createEntryResult)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.ImportDocumentAsync(repoId, parentEntryId, fileName, electronicDocument: electronicDocument, request: request).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.NotNull(result.Operations); - Assert.Equal(createEntryResult.Operations.EntryCreate.EntryId, result.Operations.EntryCreate.EntryId); - Assert.Equal(createEntryResult.Operations.EntryCreate.Exceptions.Count, result.Operations.EntryCreate.Exceptions.Count); - Assert.Equal(createEntryResult.Operations.SetEdoc.Exceptions.Count, result.Operations.SetEdoc.Exceptions.Count); - Assert.Equal(createEntryResult.Operations.SetTemplate.Template, result.Operations.SetTemplate.Template); - Assert.Equal(createEntryResult.Operations.SetTemplate.Exceptions.Count, result.Operations.SetTemplate.Exceptions.Count); - Assert.Equal(createEntryResult.Operations.SetFields.FieldCount, result.Operations.SetFields.FieldCount); - Assert.Equal(createEntryResult.Operations.SetFields.Exceptions.Count, result.Operations.SetFields.Exceptions.Count); - Assert.Equal(createEntryResult.Operations.SetTags.AssignedTags, result.Operations.SetTags.AssignedTags); - Assert.Equal(createEntryResult.Operations.SetTags.Exceptions.Count, result.Operations.SetTags.Exceptions.Count); - Assert.Equal(createEntryResult.Operations.SetLinks.OtherEntryIds, result.Operations.SetLinks.OtherEntryIds); - Assert.Equal(createEntryResult.Operations.SetLinks.Exceptions.Count, result.Operations.SetLinks.Exceptions.Count); - Assert.Equal(createEntryResult.DocumentLink, result.DocumentLink); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{parentEntryId}/{fileName}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a POST request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(request), requestBodyContent); - Assert.Equal(fileContent, requestFileContent); - Assert.Equal(electronicDocument.ContentType, requestFileContentType); - Assert.Equal(electronicDocument.FileName, requestFileName); - } - } - - [Fact] - public async Task ImportDocumentAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int parentEntryId = 1; - string fileName = "importdocument"; - string fileContent = "importdocument content"; - var statusCode = HttpStatusCode.Unauthorized; - using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(fileContent))) - { - var electronicDocument = new FileParameter(stream, fileName, "application/pdf"); - var request = new PostEntryWithEdocMetadataRequest(); - - string requestBodyContent = ""; - string requestFileContent = ""; - string requestFileContentType = ""; - string requestFileName = ""; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => - { - if (httpRequestMessage.Content is MultipartFormDataContent multipartFormDataContent) - { - foreach (var formContent in multipartFormDataContent) - { - if (formContent is StringContent stringContent) - { - requestBodyContent = stringContent.ReadAsStringAsync().Result; - } - else if (formContent is StreamContent streamContent) - { - requestFileContent = streamContent.ReadAsStringAsync().Result; - requestFileContentType = streamContent.Headers.ContentType.MediaType; - requestFileName = streamContent.Headers.ContentDisposition.FileName; - } - } - } - }) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.EntriesClient.ImportDocumentAsync(repoId, parentEntryId, fileName, electronicDocument: electronicDocument, request: request).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{parentEntryId}/{fileName}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a POST request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(request), requestBodyContent); - Assert.Equal(fileContent, requestFileContent); - Assert.Equal(electronicDocument.ContentType, requestFileContentType); - Assert.Equal(electronicDocument.FileName, requestFileName); - } - } - - [Fact] - public async Task ImportDocumentAsync_WithQueryParameter_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int parentEntryId = 1; - string fileName = "importdocument"; - string fileContent = "importdocument content"; - using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(fileContent))) - { - var electronicDocument = new FileParameter(stream, fileName, "application/pdf"); - var request = new PostEntryWithEdocMetadataRequest() - { - Template = "template", - Metadata = new PutFieldValsRequest() - { - Fields = new Dictionary() - { - ["field1"] = new FieldToUpdate() - { - Values = new List() - { - new ValueToUpdate() { Value = "new value", Position = 1 }, - new ValueToUpdate() { Value = "second value", Position = 2 } - } - }, - ["field2"] = new FieldToUpdate() - { - Values = new List() - { - new ValueToUpdate() { Value = "new value for field 2", Position = 1 }, - } - } - }, - Tags = new List() { "tag1", "tag2" }, - Links = new List() - { - new LinkToUpdate() - { - LinkTypeId = 1, - OtherSourceId = 123, - IsSource = true - } - } - } - }; - var createEntryResult = new CreateEntryResult() - { - Operations = new CreateEntryOperations() - { - EntryCreate = new EntryCreate() - { - EntryId = 100, - Exceptions = new List() - }, - SetEdoc = new SetEdoc() - { - Exceptions = new List() - }, - SetTemplate = new SetTemplate() - { - Template = request.Template, - Exceptions = new List() - }, - SetFields = new SetFields() - { - FieldCount = request.Metadata.Fields.Count, - Exceptions = new List() - }, - SetTags = new SetTags() - { - AssignedTags = request.Metadata.Tags, - Exceptions = new List() - }, - SetLinks = new SetLinks() - { - OtherEntryIds = request.Metadata.Links.Select(linkToUpdate => linkToUpdate.OtherSourceId).ToList(), - Exceptions = new List() - } - }, - DocumentLink = "link to created document" - }; - - string requestBodyContent = ""; - string requestFileContent = ""; - string requestFileContentType = ""; - string requestFileName = ""; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => - { - if (httpRequestMessage.Content is MultipartFormDataContent multipartFormDataContent) - { - foreach (var formContent in multipartFormDataContent) - { - if (formContent is StringContent stringContent) - { - requestBodyContent = stringContent.ReadAsStringAsync().Result; - } - else if (formContent is StreamContent streamContent) - { - requestFileContent = streamContent.ReadAsStringAsync().Result; - requestFileContentType = streamContent.Headers.ContentType.MediaType; - requestFileName = streamContent.Headers.ContentDisposition.FileName; - } - } - } - }) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.Created, - Content = new StringContent(JsonConvert.SerializeObject(createEntryResult)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.ImportDocumentAsync(repoId, parentEntryId, fileName, autoRename: true, electronicDocument: electronicDocument, request: request).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.NotNull(result.Operations); - Assert.Equal(createEntryResult.Operations.EntryCreate.EntryId, result.Operations.EntryCreate.EntryId); - Assert.Equal(createEntryResult.Operations.EntryCreate.Exceptions.Count, result.Operations.EntryCreate.Exceptions.Count); - Assert.Equal(createEntryResult.Operations.SetEdoc.Exceptions.Count, result.Operations.SetEdoc.Exceptions.Count); - Assert.Equal(createEntryResult.Operations.SetTemplate.Template, result.Operations.SetTemplate.Template); - Assert.Equal(createEntryResult.Operations.SetTemplate.Exceptions.Count, result.Operations.SetTemplate.Exceptions.Count); - Assert.Equal(createEntryResult.Operations.SetFields.FieldCount, result.Operations.SetFields.FieldCount); - Assert.Equal(createEntryResult.Operations.SetFields.Exceptions.Count, result.Operations.SetFields.Exceptions.Count); - Assert.Equal(createEntryResult.Operations.SetTags.AssignedTags, result.Operations.SetTags.AssignedTags); - Assert.Equal(createEntryResult.Operations.SetTags.Exceptions.Count, result.Operations.SetTags.Exceptions.Count); - Assert.Equal(createEntryResult.Operations.SetLinks.OtherEntryIds, result.Operations.SetLinks.OtherEntryIds); - Assert.Equal(createEntryResult.Operations.SetLinks.Exceptions.Count, result.Operations.SetLinks.Exceptions.Count); - Assert.Equal(createEntryResult.DocumentLink, result.DocumentLink); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{parentEntryId}/{fileName}?autoRename=true"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a POST request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(request), requestBodyContent); - Assert.Equal(fileContent, requestFileContent); - Assert.Equal(electronicDocument.ContentType, requestFileContentType); - Assert.Equal(electronicDocument.FileName, requestFileName); - } - } - } -} diff --git a/tests/unit/Entries/MoveEntryTest.cs b/tests/unit/Entries/MoveEntryTest.cs deleted file mode 100644 index cdcce7cb..00000000 --- a/tests/unit/Entries/MoveEntryTest.cs +++ /dev/null @@ -1,260 +0,0 @@ -using System; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class MoveEntryTest - { - [Fact] - public async Task MoveOrRenameEntryAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var request = new PatchEntryRequest() - { - ParentId = 10, - Name = "entry1" - }; - var entry = new Document() - { - Id = 100, - Name = "entry1", - ParentId = 1, - FullPath = @"\entry1", - FolderPath = @"\", - Creator = "", - CreationTime = DateTimeOffset.Parse("2021-01-01"), - LastModifiedTime = DateTimeOffset.Parse("2021-01-01"), - EntryType = EntryType.Document, - TemplateName = null, - TemplateId = 0, - VolumeName = "default", - RowNumber = 1 - }; - - string requestContent = ""; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => requestContent = httpRequestMessage.Content.ReadAsStringAsync().Result) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(entry)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.MoveOrRenameEntryAsync(repoId, entry.Id, request).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(entry.Id, result.Id); - Assert.Equal(entry.Name, result.Name); - Assert.Equal(entry.ParentId, result.ParentId); - Assert.Equal(entry.FullPath, result.FullPath); - Assert.Equal(entry.FolderPath, result.FolderPath); - Assert.Equal(entry.Creator, result.Creator); - Assert.Equal(entry.CreationTime, result.CreationTime); - Assert.Equal(entry.LastModifiedTime, result.LastModifiedTime); - Assert.Equal(entry.EntryType, result.EntryType); - Assert.Equal(entry.TemplateName, result.TemplateName); - Assert.Equal(entry.TemplateId, result.TemplateId); - Assert.Equal(entry.VolumeName, result.VolumeName); - Assert.Equal(entry.RowNumber, result.RowNumber); - Assert.Equal(typeof(Document), result.GetType()); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entry.Id}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Patch // we expected a PATCH request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(request), requestContent); - } - - [Fact] - public async Task MoveOrRenameEntryAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - var statusCode = HttpStatusCode.Unauthorized; - var request = new PatchEntryRequest() - { - ParentId = 10, - Name = "entry1" - }; - - string requestContent = ""; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => requestContent = httpRequestMessage.Content.ReadAsStringAsync().Result) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.EntriesClient.MoveOrRenameEntryAsync(repoId, entryId, request).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Patch // we expected a PATCH request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(request), requestContent); - } - - [Fact] - public async Task MoveOrRenameEntryAsync_WithQueryParameter_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var request = new PatchEntryRequest() - { - ParentId = 10, - Name = "entry1" - }; - var entry = new Document() - { - Id = 100, - Name = "entry1", - ParentId = 1, - FullPath = @"\entry1", - FolderPath = @"\", - Creator = "", - CreationTime = DateTimeOffset.Parse("2021-01-01"), - LastModifiedTime = DateTimeOffset.Parse("2021-01-01"), - EntryType = EntryType.Document, - TemplateName = null, - TemplateId = 0, - VolumeName = "default", - RowNumber = 1 - }; - - string requestContent = ""; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => requestContent = httpRequestMessage.Content.ReadAsStringAsync().Result) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(entry)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.MoveOrRenameEntryAsync(repoId, entry.Id, request, autoRename: true).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(entry.Id, result.Id); - Assert.Equal(entry.Name, result.Name); - Assert.Equal(entry.ParentId, result.ParentId); - Assert.Equal(entry.FullPath, result.FullPath); - Assert.Equal(entry.FolderPath, result.FolderPath); - Assert.Equal(entry.Creator, result.Creator); - Assert.Equal(entry.CreationTime, result.CreationTime); - Assert.Equal(entry.LastModifiedTime, result.LastModifiedTime); - Assert.Equal(entry.EntryType, result.EntryType); - Assert.Equal(entry.TemplateName, result.TemplateName); - Assert.Equal(entry.TemplateId, result.TemplateId); - Assert.Equal(entry.VolumeName, result.VolumeName); - Assert.Equal(entry.RowNumber, result.RowNumber); - Assert.Equal(typeof(Document), result.GetType()); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entry.Id}?autoRename=true"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Patch // we expected a PATCH request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(request), requestContent); - } - } -} diff --git a/tests/unit/Entries/SetEntryFieldsTest.cs b/tests/unit/Entries/SetEntryFieldsTest.cs deleted file mode 100644 index 89cc82c6..00000000 --- a/tests/unit/Entries/SetEntryFieldsTest.cs +++ /dev/null @@ -1,213 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class SetEntryFieldsTest - { - [Fact] - public async Task AssignFieldValuesAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - var request = new Dictionary() - { - ["Field1"] = new FieldToUpdate() - { - Values = new List() - { - new ValueToUpdate() { Value = "field value 1", Position = 1 }, - } - }, - ["Field2"] = new FieldToUpdate() - { - Values = new List() - { - new ValueToUpdate() { Value = "field value 2", Position = 1 }, - } - } - }; - ODataValueOfIListOfFieldValue entryFields = new ODataValueOfIListOfFieldValue() - { - Value = new List() - { - new FieldValue() - { - FieldName = "Field1", - FieldType = WFieldType.String, - GroupId = 0, - FieldId = 1, - IsMultiValue = false, - IsRequired = false, - Values = new List>() - { - new Dictionary(){ ["value"] = "field value 1", ["position"] = 0 } - } - }, - new FieldValue() - { - FieldName = "Field2", - FieldType = WFieldType.String, - GroupId = 0, - FieldId = 2, - IsMultiValue = false, - IsRequired = false, - Values = new List>() - { - new Dictionary(){ ["value"] = "field value 2", ["position"] = 0 } - } - } - } - }; - - string requestContent = ""; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => requestContent = httpRequestMessage.Content.ReadAsStringAsync().Result) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(entryFields)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.AssignFieldValuesAsync(repoId, entryId, fieldsToUpdate: request).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(entryFields.Value.Count, result.Value.Count); - var fieldsEnumerator = entryFields.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (fieldsEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(fieldsEnumerator.Current.FieldName, resultEnumerator.Current.FieldName); - Assert.Equal(fieldsEnumerator.Current.FieldType, resultEnumerator.Current.FieldType); - Assert.Equal(fieldsEnumerator.Current.GroupId, resultEnumerator.Current.GroupId); - Assert.Equal(fieldsEnumerator.Current.FieldId, resultEnumerator.Current.FieldId); - Assert.Equal(fieldsEnumerator.Current.IsMultiValue, resultEnumerator.Current.IsMultiValue); - Assert.Equal(fieldsEnumerator.Current.IsRequired, resultEnumerator.Current.IsRequired); - Assert.Equal(fieldsEnumerator.Current.Values.Count, resultEnumerator.Current.Values.Count); - Assert.Equal(fieldsEnumerator.Current.Values.First()["value"], resultEnumerator.Current.Values.First()["value"]); - Assert.Equal(Convert.ToInt32(fieldsEnumerator.Current.Values.First()["position"]), Convert.ToInt32(resultEnumerator.Current.Values.First()["position"])); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/fields"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Put // we expected a PUT request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(request), requestContent); - } - - [Fact] - public async Task AssignFieldValuesAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - var statusCode = HttpStatusCode.Unauthorized; - var request = new Dictionary() - { - ["Field1"] = new FieldToUpdate() - { - Values = new List() - { - new ValueToUpdate() { Value = "field value 1", Position = 1 }, - } - }, - ["Field2"] = new FieldToUpdate() - { - Values = new List() - { - new ValueToUpdate() { Value = "field value 2", Position = 1 }, - } - } - }; - - string requestContent = ""; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => requestContent = httpRequestMessage.Content.ReadAsStringAsync().Result) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.EntriesClient.AssignFieldValuesAsync(repoId, entryId, fieldsToUpdate: request).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/fields"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Put // we expected a PUT request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(request), requestContent); - } - } -} diff --git a/tests/unit/Entries/SetLinkValuesOnEntryAsyncTest.cs b/tests/unit/Entries/SetLinkValuesOnEntryAsyncTest.cs deleted file mode 100644 index ee5ac208..00000000 --- a/tests/unit/Entries/SetLinkValuesOnEntryAsyncTest.cs +++ /dev/null @@ -1,208 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class SetLinkValuesOnEntryAsyncTest - { - [Fact] - public async Task AssignEntryLinksAsync_200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - - WEntryLinkInfo entryLinkInfo = new WEntryLinkInfo() - { - LinkId = 1, - SourceId = 2, - SourceFullPath = "sourceFullPath", - SourceLabel = "sourceLabel", - TargetId = 3, - TargetFullPath = "targetFullPath", - TargetLabel = "targetLabel", - Description = "description", - LinkTypeId = 123, - LinkTypeDescription = "linkTypeDescription", - LinkProperties = new Dictionary() { ["1"] = "2" }, - SourceLink = "sourceLink", - TargetLink = "targetLink" - }; - - WEntryLinkInfo entryLinkInfo2 = new WEntryLinkInfo() - { - LinkId = 2, - SourceId = 3, - SourceFullPath = "sourceFullPath2", - SourceLabel = "sourceLabel2", - TargetId = 4, - TargetFullPath = "targetFullPath2", - TargetLabel = "targetLabel2", - Description = "description2", - LinkTypeId = 456, - LinkTypeDescription = "linkTypeDescription2", - LinkProperties = new Dictionary() { ["3"] = "4" }, - SourceLink = "sourceLink2", - TargetLink = "targetLink2" - }; - - IList links = new List() { entryLinkInfo, entryLinkInfo2 }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(new ODataValueOfIListOfWEntryLinkInfo() { Value = links})) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await client.EntriesClient.AssignEntryLinksAsync(repoId, entryId, new List() - { - new PutLinksRequest() - { - TargetId = entryLinkInfo.TargetId, - LinkTypeId = 2, - CustomProperties = entryLinkInfo.LinkProperties - }, - new PutLinksRequest() - { - TargetId = entryLinkInfo2.TargetId, - LinkTypeId = 2, - CustomProperties = entryLinkInfo2.LinkProperties - } - }).ConfigureAwait(false); - - var result = response.Value; - - // ASSERT - Assert.NotNull(result); - Assert.Equal(2, result.Count); - for (int i = 0; i < result.Count; i++) - { - Assert.Equal(links.ElementAt(i).LinkId, result.ElementAt(i).LinkId); - Assert.Equal(links.ElementAt(i).SourceId, result.ElementAt(i).SourceId); - Assert.Equal(links.ElementAt(i).SourceFullPath, result.ElementAt(i).SourceFullPath); - Assert.Equal(links.ElementAt(i).SourceLabel, result.ElementAt(i).SourceLabel); - Assert.Equal(links.ElementAt(i).TargetId, result.ElementAt(i).TargetId); - Assert.Equal(links.ElementAt(i).TargetFullPath, result.ElementAt(i).TargetFullPath); - Assert.Equal(links.ElementAt(i).TargetLabel, result.ElementAt(i).TargetLabel); - Assert.Equal(links.ElementAt(i).TargetLink, result.ElementAt(i).TargetLink); - Assert.Equal(links.ElementAt(i).Description, result.ElementAt(i).Description); - Assert.Equal(links.ElementAt(i).LinkTypeId, result.ElementAt(i).LinkTypeId); - Assert.Equal(links.ElementAt(i).LinkTypeDescription, result.ElementAt(i).LinkTypeDescription); - Assert.Equal(links.ElementAt(i).SourceLink, result.ElementAt(i).SourceLink); - foreach (var x in links.ElementAt(i).LinkProperties) - { - Assert.Equal(links.ElementAt(i).LinkProperties[x.Key], result.ElementAt(i).LinkProperties[x.Key]); - } - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/links"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Put // we expected a GET request - && req.RequestUri == expectedUri // to this uri - && req.Content.ToString() == new StringContent(JsonConvert.SerializeObject(new List() - { - new PutLinksRequest() - { - TargetId = entryLinkInfo.TargetId, - LinkTypeId = 2, - CustomProperties = entryLinkInfo.LinkProperties - }, - new PutLinksRequest() - { - TargetId = entryLinkInfo2.TargetId, - LinkTypeId = 2, - CustomProperties = entryLinkInfo2.LinkProperties - } - })).ToString() - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task AssignEntryLinksAsync_AnyOther() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.InternalServerError - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.EntriesClient.AssignEntryLinksAsync(repoId, entryId, new List()).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/links"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Put // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Entries/SetTagValuesOnEntryAsyncTest.cs b/tests/unit/Entries/SetTagValuesOnEntryAsyncTest.cs deleted file mode 100644 index 770fc415..00000000 --- a/tests/unit/Entries/SetTagValuesOnEntryAsyncTest.cs +++ /dev/null @@ -1,215 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class SetTagValuesOnEntryAsyncTest - { - [Fact] - public async Task AssignTagsAsync_Return200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - - WTagInfo tagInfo = new WTagInfo() - { - Id = 1, - Name = "TagName", - Description = "Description", - IsSecure = true, - Watermark = new Watermark() - { - WatermarkText = "Watermark Text", - WatermarkTextSize = 3, - IsWatermarkMandatory = true, - WatermarkIntensity = 4, - WatermarkPosition = WatermarkPosition.TopLeft, - WatermarkRotationAngle = 5 - } - }; - WTagInfo tagInfo2 = new WTagInfo() - { - Id = 2, - Name = "TagName2", - Description = "Description2", - IsSecure = false, - Watermark = new Watermark() - { - WatermarkText = "Watermark Text2", - WatermarkTextSize = 6, - IsWatermarkMandatory = false, - WatermarkIntensity = 7, - WatermarkPosition = WatermarkPosition.TopRight, - WatermarkRotationAngle = 8 - } - }; - IList tags = new List() { tagInfo, tagInfo2 }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(new ODataValueOfIListOfWTagInfo() { Value = tags })) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await client.EntriesClient.AssignTagsAsync(repoId, entryId, new PutTagRequest() - { - Tags = new List() { tagInfo.Name, tagInfo2.Name } - }).ConfigureAwait(false); - var result = response.Value; - - // ASSERT - Assert.NotNull(result); - Assert.Equal(2, result.Count); - for (int i = 0; i < result.Count; i++) - { - Assert.Equal(tags.ElementAt(i).Name, result.ElementAt(i).Name); - Assert.Equal(tags.ElementAt(i).Description, result.ElementAt(i).Description); - Assert.Equal(tags.ElementAt(i).IsSecure, result.ElementAt(i).IsSecure); - Assert.Equal(tags.ElementAt(i).Id, result.ElementAt(i).Id); - Assert.Equal(tags.ElementAt(i).Watermark.WatermarkTextSize, result.ElementAt(i).Watermark.WatermarkTextSize); - Assert.Equal(tags.ElementAt(i).Watermark.IsWatermarkMandatory, result.ElementAt(i).Watermark.IsWatermarkMandatory); - Assert.Equal(tags.ElementAt(i).Watermark.WatermarkIntensity, result.ElementAt(i).Watermark.WatermarkIntensity); - Assert.Equal(tags.ElementAt(i).Watermark.WatermarkPosition, result.ElementAt(i).Watermark.WatermarkPosition); - Assert.Equal(tags.ElementAt(i).Watermark.WatermarkRotationAngle, result.ElementAt(i).Watermark.WatermarkRotationAngle); - Assert.Equal(tags.ElementAt(i).Watermark.WatermarkText, result.ElementAt(i).Watermark.WatermarkText); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/tags"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Put // we expected a GET request - && req.RequestUri == expectedUri // to this uri - && req.Content.ToString() == new StringContent(JsonConvert.SerializeObject(new PutTagRequest() - { - Tags = new List() { tagInfo.Name, tagInfo2.Name } - })).ToString() - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task AssignTagsAsync_AnyOther() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int entryId = 1; - - WTagInfo tagInfo = new WTagInfo() - { - Id = 1, - Name = "TagName", - Description = "Description", - IsSecure = true, - Watermark = new Watermark() - { - WatermarkText = "Watermark Text", - WatermarkTextSize = 3, - IsWatermarkMandatory = true, - WatermarkIntensity = 4, - WatermarkPosition = WatermarkPosition.TopLeft, - WatermarkRotationAngle = 5 - } - }; - WTagInfo tagInfo2 = new WTagInfo() - { - Id = 2, - Name = "TagName2", - Description = "Description2", - IsSecure = false, - Watermark = new Watermark() - { - WatermarkText = "Watermark Text2", - WatermarkTextSize = 6, - IsWatermarkMandatory = false, - WatermarkIntensity = 7, - WatermarkPosition = WatermarkPosition.TopRight, - WatermarkRotationAngle = 8 - } - }; - IList tags = new List() { tagInfo, tagInfo2 }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.InternalServerError - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.EntriesClient.AssignTagsAsync(repoId, entryId, new PutTagRequest() - { - Tags = new List() { tagInfo.Name, tagInfo2.Name } - }).ConfigureAwait(false)).ConfigureAwait(false); - - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/tags"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Put // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Entries/WriteTemplateValueToEntryAsyncTest.cs b/tests/unit/Entries/WriteTemplateValueToEntryAsyncTest.cs deleted file mode 100644 index 0db5e018..00000000 --- a/tests/unit/Entries/WriteTemplateValueToEntryAsyncTest.cs +++ /dev/null @@ -1,178 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Entries -{ - public class WriteTemplateValueToEntryAsyncTest - { - [Fact] - public async Task WriteTemplateValueToEntryAsync_200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var entryId = 1; - var entry = new Document() - { - Id = 1, - Name = "entry1", - ParentId = 1, - FullPath = @"\entry1", - FolderPath = @"\", - Creator = "", - CreationTime = DateTimeOffset.Parse("2021-01-01"), - LastModifiedTime = DateTimeOffset.Parse("2021-01-01"), - TemplateName = "templateName1", - TemplateId = 1, - VolumeName = "default", - RowNumber = 1, - EntryType = EntryType.Document, - TemplateFieldNames = new List() { "templateField" } - }; - - PutTemplateRequest request = new PutTemplateRequest() - { - TemplateName = "templateName", - Fields = new Dictionary() - { - ["templateField"] = new FieldToUpdate() - { - Values = new List() { new ValueToUpdate() - { - Value = "value", - Position = 1 - } - } - } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(entry)) - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.WriteTemplateValueToEntryAsync(repoId, entryId, request:request).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.NotNull(result.TemplateFieldNames); - Assert.Equal(1, result.TemplateFieldNames.Count); - Assert.Equal("templateField", result.TemplateFieldNames.ElementAt(0)); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/template"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Put// we expected a GET request - && req.RequestUri == expectedUri // to this uri - && req.Content.ToString() == new StringContent(JsonConvert.SerializeObject(request)).ToString() - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task WriteTemplateValueToEntryAsync_AnyOther() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var entryId = 1; - - PutTemplateRequest request = new PutTemplateRequest() - { - TemplateName = "templateName", - Fields = new Dictionary() - { - ["templateField"] = new FieldToUpdate() - { - Values = new List() { new ValueToUpdate() - { - Value = "value", - Position = 1 - } - } - } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.InternalServerError - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.EntriesClient.WriteTemplateValueToEntryAsync(repoId, entryId, request:request).ConfigureAwait(false)).ConfigureAwait(false); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entryId}/template"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Put// we expected a GET request - && req.RequestUri == expectedUri // to this uri - && req.Content.ToString() == new StringContent(JsonConvert.SerializeObject(request)).ToString() - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/FieldDefinitions/FieldDefinitionsByIdTest.cs b/tests/unit/FieldDefinitions/FieldDefinitionsByIdTest.cs deleted file mode 100644 index 8d5de0c2..00000000 --- a/tests/unit/FieldDefinitions/FieldDefinitionsByIdTest.cs +++ /dev/null @@ -1,152 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.FieldDefinitions -{ - public class FieldDefinitionsByIdTest - { - [Fact] - public async Task GetFieldDefinitionByIdAsync_200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int id = 1; - - WFieldInfo fieldInfo1 = new WFieldInfo() - { - Name = "name1", - Id = id, - Description = "description1", - FieldType = WFieldType.Blob, - Length = 100, - DefaultValue = "default1", - IsMultiValue = false, - IsRequired = false, - Constraint = "constraint1", - ConstraintError = "error1", - ListValues = new List() { "value1" }, - Format = WFieldFormat.Custom, - Currency = "currency1", - FormatPattern = "format1" - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(fieldInfo1)) - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.FieldDefinitionsClient.GetFieldDefinitionByIdAsync(repoId, fieldDefinitionId: id).ConfigureAwait(false); - Assert.Equal(fieldInfo1.Name, result.Name); - Assert.Equal(fieldInfo1.Id, result.Id); - Assert.Equal(fieldInfo1.Description, result.Description); - Assert.Equal(fieldInfo1.FieldType, result.FieldType); - Assert.Equal(fieldInfo1.DefaultValue, result.DefaultValue); - Assert.Equal(fieldInfo1.IsMultiValue, result.IsMultiValue); - Assert.Equal(fieldInfo1.IsRequired, result.IsRequired); - Assert.Equal(fieldInfo1.Constraint, result.Constraint); - Assert.Equal(fieldInfo1.ConstraintError, result.ConstraintError); - Assert.Equal(fieldInfo1.Format, result.Format); - Assert.Equal(fieldInfo1.Currency, result.Currency); - Assert.Equal(fieldInfo1.FormatPattern, result.FormatPattern); - Assert.Equal(fieldInfo1.ListValues.ElementAt(0), result.ListValues.ElementAt(0)); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/FieldDefinitions/{id}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetFieldDefinitionByIdAsync_AnyOther() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var id = 1; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.InternalServerError - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.FieldDefinitionsClient.GetFieldDefinitionByIdAsync(repoId, fieldDefinitionId: id).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/FieldDefinitions/{id}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/FieldDefinitions/FieldDefinitionsTest.cs b/tests/unit/FieldDefinitions/FieldDefinitionsTest.cs deleted file mode 100644 index ed84e50c..00000000 --- a/tests/unit/FieldDefinitions/FieldDefinitionsTest.cs +++ /dev/null @@ -1,266 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.FieldDefinitions -{ - public class FieldDefinitionsTest - { - [Fact] - public async Task GetFieldDefinitionsAsync_200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - - WFieldInfo fieldInfo1 = new WFieldInfo() - { - Name = "name1", - Id = 1, - Description = "description1", - FieldType = WFieldType.Blob, - Length = 100, - DefaultValue = "default1", - IsMultiValue = false, - IsRequired = false, - Constraint = "constraint1", - ConstraintError = "error1", - ListValues = new List() { "value1" }, - Format = WFieldFormat.Custom, - Currency = "currency1", - FormatPattern = "format1" - }; - WFieldInfo fieldInfo2 = new WFieldInfo() - { - Name = "name2", - Id = 2, - Description = "description2", - FieldType = WFieldType.Date, - Length = 200, - DefaultValue = "default2", - IsMultiValue = true, - IsRequired = true, - Constraint = "constraint2", - ConstraintError = "error2", - ListValues = new List() { "value2" }, - Format = WFieldFormat.LongDate, - Currency = "currency2", - FormatPattern = "format2" - }; - ODataValueOfIListOfWFieldInfo ret = new ODataValueOfIListOfWFieldInfo() - { - Value = new List() { fieldInfo1, fieldInfo2 } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(ret)) - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await client.FieldDefinitionsClient.GetFieldDefinitionsAsync(repoId).ConfigureAwait(false); - var result = response.Value; - Assert.Equal(2, result.Count); - for (int i = 0; i < 2; i++) - { - Assert.Equal(ret.Value.ElementAt(i).Name, result.ElementAt(i).Name); - Assert.Equal(ret.Value.ElementAt(i).Id, result.ElementAt(i).Id); - Assert.Equal(ret.Value.ElementAt(i).Description, result.ElementAt(i).Description); - Assert.Equal(ret.Value.ElementAt(i).FieldType, result.ElementAt(i).FieldType); - Assert.Equal(ret.Value.ElementAt(i).DefaultValue, result.ElementAt(i).DefaultValue); - Assert.Equal(ret.Value.ElementAt(i).IsMultiValue, result.ElementAt(i).IsMultiValue); - Assert.Equal(ret.Value.ElementAt(i).IsRequired, result.ElementAt(i).IsRequired); - Assert.Equal(ret.Value.ElementAt(i).Constraint, result.ElementAt(i).Constraint); - Assert.Equal(ret.Value.ElementAt(i).ConstraintError, result.ElementAt(i).ConstraintError); - Assert.Equal(ret.Value.ElementAt(i).Format, result.ElementAt(i).Format); - Assert.Equal(ret.Value.ElementAt(i).Currency, result.ElementAt(i).Currency); - Assert.Equal(ret.Value.ElementAt(i).FormatPattern, result.ElementAt(i).FormatPattern); - Assert.Equal(ret.Value.ElementAt(i).ListValues.ElementAt(0), result.ElementAt(i).ListValues.ElementAt(0)); - } - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/FieldDefinitions"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetFieldDefinitionsAsync_ODataQueryOptions() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - - WFieldInfo fieldInfo1 = new WFieldInfo() - { - Name = "name1", - Id = 1, - Description = "description1", - FieldType = WFieldType.Blob, - Length = 100, - DefaultValue = "default1", - IsMultiValue = false, - IsRequired = false, - Constraint = "constraint1", - ConstraintError = "error1", - ListValues = new List() { "value1" }, - Format = WFieldFormat.Custom, - Currency = "currency1", - FormatPattern = "format1" - }; - WFieldInfo fieldInfo2 = new WFieldInfo() - { - Name = "name2", - Id = 2, - Description = "description2", - FieldType = WFieldType.Date, - Length = 200, - DefaultValue = "default2", - IsMultiValue = true, - IsRequired = true, - Constraint = "constraint2", - ConstraintError = "error2", - ListValues = new List() { "value2" }, - Format = WFieldFormat.LongDate, - Currency = "currency2", - FormatPattern = "format2" - }; - ODataValueOfIListOfWFieldInfo ret = new ODataValueOfIListOfWFieldInfo() - { - Value = new List() { fieldInfo1, fieldInfo2 } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(ret)) - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - _ = await client.FieldDefinitionsClient.GetFieldDefinitionsAsync(repoId, prefer:"Prefer", select:"select", orderby:"orderby", top:1, skip:2, count:true).ConfigureAwait(false); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri("http://api.laserfiche.com/v1/Repositories/repoId/FieldDefinitions?%24select=select&%24orderby=orderby&%24top=1&%24skip=2&%24count=true"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetFieldDefinitionsAsync_AnyOther() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.InternalServerError - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.FieldDefinitionsClient.GetFieldDefinitionsAsync(repoId).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri("http://api.laserfiche.com/v1/Repositories/repoId/FieldDefinitions"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/LinkDefinitions/LinkDefinitionsByIdTest.cs b/tests/unit/LinkDefinitions/LinkDefinitionsByIdTest.cs deleted file mode 100644 index 3c643ba9..00000000 --- a/tests/unit/LinkDefinitions/LinkDefinitionsByIdTest.cs +++ /dev/null @@ -1,131 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.LinkDefinitions -{ - public class LinkDefinitionsByIdTest - { - [Fact] - public async Task GetLinkDefinitionByIdAsync_200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int id = 1; - - EntryLinkTypeInfo linkType1 = new EntryLinkTypeInfo() - { - LinkTypeId = 1, - SourceLabel = "linktype sourcelabel", - TargetLabel = "linktype targetlabel", - LinkTypeDescription = "linktype description" - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(linkType1)) - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.LinkDefinitionsClient.GetLinkDefinitionByIdAsync(repoId, linkTypeId: id).ConfigureAwait(false); - Assert.Equal(linkType1.LinkTypeId, result.LinkTypeId); - Assert.Equal(linkType1.SourceLabel, result.SourceLabel); - Assert.Equal(linkType1.TargetLabel, result.TargetLabel); - Assert.Equal(linkType1.LinkTypeDescription, result.LinkTypeDescription); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/LinkDefinitions/{id}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetLinkDefinitionByIdAsync_AnyOther() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var id = 1; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.InternalServerError - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.LinkDefinitionsClient.GetLinkDefinitionByIdAsync(repoId, linkTypeId: id).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/LinkDefinitions/{id}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/LinkDefinitions/LinkDefinitionsTest.cs b/tests/unit/LinkDefinitions/LinkDefinitionsTest.cs deleted file mode 100644 index 4d2c5a41..00000000 --- a/tests/unit/LinkDefinitions/LinkDefinitionsTest.cs +++ /dev/null @@ -1,217 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.LinkDefinitions -{ - public class LinkDefinitionsTest - { - [Fact] - public async Task GetLinkDefinitionsAsync_200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - - EntryLinkTypeInfo linkType1 = new EntryLinkTypeInfo() - { - LinkTypeId = 1, - SourceLabel = "linktype sourcelabel 1", - TargetLabel = "linktype targetlabel 1", - LinkTypeDescription = "linktype description 1" - }; - EntryLinkTypeInfo linkType2 = new EntryLinkTypeInfo() - { - LinkTypeId = 2, - SourceLabel = "linktype sourcelabel 2", - TargetLabel = "linktype targetlabel 2", - LinkTypeDescription = "linktype description 2" - }; - ODataValueContextOfIListOfEntryLinkTypeInfo ret = new ODataValueContextOfIListOfEntryLinkTypeInfo() - { - Value = new List() { linkType1, linkType2 } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(ret)) - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await client.LinkDefinitionsClient.GetLinkDefinitionsAsync(repoId).ConfigureAwait(false); - var result = response.Value; - Assert.Equal(2, result.Count); - for (int i = 0; i < 2; i++) - { - Assert.Equal(ret.Value.ElementAt(i).LinkTypeId, result.ElementAt(i).LinkTypeId); - Assert.Equal(ret.Value.ElementAt(i).SourceLabel, result.ElementAt(i).SourceLabel); - Assert.Equal(ret.Value.ElementAt(i).TargetLabel, result.ElementAt(i).TargetLabel); - Assert.Equal(ret.Value.ElementAt(i).LinkTypeDescription, result.ElementAt(i).LinkTypeDescription); - } - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/LinkDefinitions"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetLinkDefinitionsAsync_ODataQueryOptions() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - - EntryLinkTypeInfo linkType1 = new EntryLinkTypeInfo() - { - LinkTypeId = 1, - SourceLabel = "linktype sourcelabel 1", - TargetLabel = "linktype targetlabel 1", - LinkTypeDescription = "linktype description 1" - }; - EntryLinkTypeInfo linkType2 = new EntryLinkTypeInfo() - { - LinkTypeId = 2, - SourceLabel = "linktype sourcelabel 2", - TargetLabel = "linktype targetlabel 2", - LinkTypeDescription = "linktype description 2" - }; - ODataValueContextOfIListOfEntryLinkTypeInfo ret = new ODataValueContextOfIListOfEntryLinkTypeInfo() - { - Value = new List() { linkType1, linkType2 } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(ret)) - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - _ = await client.LinkDefinitionsClient.GetLinkDefinitionsAsync(repoId, prefer: "Prefer", select: "select", orderby: "orderby", top: 1, skip: 2, count: true).ConfigureAwait(false); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri("http://api.laserfiche.com/v1/Repositories/repoId/LinkDefinitions?%24select=select&%24orderby=orderby&%24top=1&%24skip=2&%24count=true"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetLinkDefinitionsAsync_AnyOther() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.InternalServerError - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.LinkDefinitionsClient.GetLinkDefinitionsAsync(repoId).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri("http://api.laserfiche.com/v1/Repositories/repoId/LinkDefinitions"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Repositories/GetRepositoryListTest.cs b/tests/unit/Repositories/GetRepositoryListTest.cs deleted file mode 100644 index 17704b8f..00000000 --- a/tests/unit/Repositories/GetRepositoryListTest.cs +++ /dev/null @@ -1,137 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Repositories -{ - public class GetRepositoryListTest - { - [Fact] - public async Task GetRepositoryListAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - var repositories = new List() - { - new RepositoryInfo() - { - RepoId = "r-123", - WebclientUrl = "http://api.laserfiche.com/r-123" - }, - new RepositoryInfo() - { - RepoId = "r-abc", - WebclientUrl = "http://api.laserfiche.com/r-abc" - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(repositories)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.RepositoriesClient.GetRepositoryListAsync().ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(repositories.Count, result.Count); - var repositoriesEnumerator = repositories.GetEnumerator(); - var resultEnumerator = result.GetEnumerator(); - while (repositoriesEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(repositoriesEnumerator.Current.RepoId, resultEnumerator.Current.RepoId); - Assert.Equal(repositoriesEnumerator.Current.WebclientUrl, resultEnumerator.Current.WebclientUrl); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetRepositoryListAsync_AnyOtherStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.NotFound - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.RepositoriesClient.GetRepositoryListAsync().ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Searches/CancelCloseSearchOperationTest.cs b/tests/unit/Searches/CancelCloseSearchOperationTest.cs deleted file mode 100644 index 20ef47e2..00000000 --- a/tests/unit/Searches/CancelCloseSearchOperationTest.cs +++ /dev/null @@ -1,124 +0,0 @@ -using System; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Searches -{ - public class CancelCloseSearchOperationTest - { - [Fact] - public async Task CancelOrCloseSearchAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string searchToken = "123-ABC"; - var odataBoolean = new ODataValueOfBoolean() { Value = true }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(odataBoolean)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.SearchesClient.CancelOrCloseSearchAsync(repoId, searchToken).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(odataBoolean.Value, result.Value); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Searches/{searchToken}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Delete // we expected a DELETE request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task CancelOrCloseSearchAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string searchToken = "123-ABC"; - var statusCode = HttpStatusCode.Unauthorized; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.SearchesClient.CancelOrCloseSearchAsync(repoId, searchToken).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Searches/{searchToken}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Delete // we expected a DELETE request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Searches/CreateSearchOpeartionTest.cs b/tests/unit/Searches/CreateSearchOpeartionTest.cs deleted file mode 100644 index bd3ba8ea..00000000 --- a/tests/unit/Searches/CreateSearchOpeartionTest.cs +++ /dev/null @@ -1,142 +0,0 @@ -using System; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Searches -{ - public class CreateSearchOpeartionTest - { - [Fact] - public async Task CreateSearchOperationAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var searchRequest = new AdvancedSearchRequest() - { - SearchCommand = "({LF:Basic ~= \"search text\", option=\"DFANLT\"})", - FuzzyType = FuzzyType.NumberOfLetters, - FuzzyFactor = 2 - }; - var acceptedOperationResponse = new AcceptedOperation() { Token = "123-ABC" }; - - string requestContent = ""; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => requestContent = httpRequestMessage.Content.ReadAsStringAsync().Result) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.Created, - Content = new StringContent(JsonConvert.SerializeObject(acceptedOperationResponse)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.SearchesClient.CreateSearchOperationAsync(repoId, searchRequest).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(acceptedOperationResponse.Token, result.Token); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Searches"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a POST request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(searchRequest), requestContent); - } - - [Fact] - public async Task CreateSearchOperationAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var searchRequest = new AdvancedSearchRequest() - { - SearchCommand = "({LF:Basic ~= \"search text\", option=\"DFANLT\"})", - FuzzyType = FuzzyType.NumberOfLetters, - FuzzyFactor = 2 - }; - var statusCode = HttpStatusCode.Unauthorized; - - string requestContent = ""; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => requestContent = httpRequestMessage.Content.ReadAsStringAsync().Result) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.SearchesClient.CreateSearchOperationAsync(repoId, searchRequest).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Searches"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a POST request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(searchRequest), requestContent); - } - } -} diff --git a/tests/unit/Searches/GetSearchContextHitsTest.cs b/tests/unit/Searches/GetSearchContextHitsTest.cs deleted file mode 100644 index ba34956e..00000000 --- a/tests/unit/Searches/GetSearchContextHitsTest.cs +++ /dev/null @@ -1,318 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Searches -{ - public class GetSearchContextHitsTest - { - [Fact] - public async Task GetSearchContextHitsAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string searchToken = "123-ABC"; - int rowNumber = 5; - var contextHits = new ODataValueOfIListOfContextHit() - { - Value = new List() - { - new ContextHit() - { - HitNumber = 1, - HitType = HitType.Edoc, - IsAnnotationHit = false, - AnnotationId = 0, - PageNumber = 1, - PageOffset = 0, - Context = "context hit", - Highlight1Offset = 0, - Highlight1Length = 0, - Highlight2Offset = 0, - Highlight2Length = 0, - HitWidth= 0, - EdocHitCount = 10, - FieldHitCount = 0, - FieldName = "" - }, - new ContextHit() - { - HitNumber = 2, - HitType = HitType.Edoc, - IsAnnotationHit = false, - AnnotationId = 0, - PageNumber = 1, - PageOffset = 30, - Context = "context hit", - Highlight1Offset = 0, - Highlight1Length = 0, - Highlight2Offset = 0, - Highlight2Length = 0, - HitWidth= 0, - EdocHitCount = 10, - FieldHitCount = 0, - FieldName = "" - } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(contextHits)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.SearchesClient.GetSearchContextHitsAsync(repoId, searchToken, rowNumber).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(contextHits.Value.Count, result.Value.Count); - var contextHitsEnumerator = contextHits.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (contextHitsEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(contextHitsEnumerator.Current.HitNumber, resultEnumerator.Current.HitNumber); - Assert.Equal(contextHitsEnumerator.Current.HitType, resultEnumerator.Current.HitType); - Assert.Equal(contextHitsEnumerator.Current.IsAnnotationHit, resultEnumerator.Current.IsAnnotationHit); - Assert.Equal(contextHitsEnumerator.Current.AnnotationId, resultEnumerator.Current.AnnotationId); - Assert.Equal(contextHitsEnumerator.Current.PageNumber, resultEnumerator.Current.PageNumber); - Assert.Equal(contextHitsEnumerator.Current.PageOffset, resultEnumerator.Current.PageOffset); - Assert.Equal(contextHitsEnumerator.Current.Context, resultEnumerator.Current.Context); - Assert.Equal(contextHitsEnumerator.Current.Highlight1Offset, resultEnumerator.Current.Highlight1Offset); - Assert.Equal(contextHitsEnumerator.Current.Highlight1Length, resultEnumerator.Current.Highlight1Length); - Assert.Equal(contextHitsEnumerator.Current.Highlight2Offset, resultEnumerator.Current.Highlight2Offset); - Assert.Equal(contextHitsEnumerator.Current.Highlight2Length, resultEnumerator.Current.Highlight2Length); - Assert.Equal(contextHitsEnumerator.Current.HitWidth, resultEnumerator.Current.HitWidth); - Assert.Equal(contextHitsEnumerator.Current.EdocHitCount, resultEnumerator.Current.EdocHitCount); - Assert.Equal(contextHitsEnumerator.Current.FieldHitCount, resultEnumerator.Current.FieldHitCount); - Assert.Equal(contextHitsEnumerator.Current.FieldName, resultEnumerator.Current.FieldName); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Searches/{searchToken}/Results/{rowNumber}/ContextHits"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetSearchContextHitsAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string searchToken = "123-ABC"; - int rowNumber = 5; - var statusCode = HttpStatusCode.Unauthorized; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.SearchesClient.GetSearchContextHitsAsync(repoId, searchToken, rowNumber).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Searches/{searchToken}/Results/{rowNumber}/ContextHits"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetSearchContextHitsAsync_WithPreferHeader_WithQueryParameters_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string searchToken = "123-ABC"; - int rowNumber = 5; - string preferHeaderValue = "maxpagesize=1"; - string selectQueryParameter = "hitNumber"; - string orderbyQueryParameter = "pageNumber"; - int topQueryParameter = 1; - int skipQueryParameter = 1; - bool countQueryParameter = true; - var contextHits = new ODataValueOfIListOfContextHit() - { - Value = new List() - { - new ContextHit() - { - HitNumber = 1, - HitType = HitType.Edoc, - IsAnnotationHit = false, - AnnotationId = 0, - PageNumber = 1, - PageOffset = 0, - Context = "context hit", - Highlight1Offset = 0, - Highlight1Length = 0, - Highlight2Offset = 0, - Highlight2Length = 0, - HitWidth= 0, - EdocHitCount = 10, - FieldHitCount = 0, - FieldName = "" - }, - new ContextHit() - { - HitNumber = 2, - HitType = HitType.Edoc, - IsAnnotationHit = false, - AnnotationId = 0, - PageNumber = 1, - PageOffset = 30, - Context = "context hit", - Highlight1Offset = 0, - Highlight1Length = 0, - Highlight2Offset = 0, - Highlight2Length = 0, - HitWidth= 0, - EdocHitCount = 10, - FieldHitCount = 0, - FieldName = "" - } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(contextHits)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.SearchesClient.GetSearchContextHitsAsync(repoId, searchToken, rowNumber, - prefer: preferHeaderValue, select: selectQueryParameter, orderby: orderbyQueryParameter, - top: topQueryParameter, skip: skipQueryParameter, count: countQueryParameter).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(contextHits.Value.Count, result.Value.Count); - var contextHitsEnumerator = contextHits.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (contextHitsEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(contextHitsEnumerator.Current.HitNumber, resultEnumerator.Current.HitNumber); - Assert.Equal(contextHitsEnumerator.Current.HitType, resultEnumerator.Current.HitType); - Assert.Equal(contextHitsEnumerator.Current.IsAnnotationHit, resultEnumerator.Current.IsAnnotationHit); - Assert.Equal(contextHitsEnumerator.Current.AnnotationId, resultEnumerator.Current.AnnotationId); - Assert.Equal(contextHitsEnumerator.Current.PageNumber, resultEnumerator.Current.PageNumber); - Assert.Equal(contextHitsEnumerator.Current.PageOffset, resultEnumerator.Current.PageOffset); - Assert.Equal(contextHitsEnumerator.Current.Context, resultEnumerator.Current.Context); - Assert.Equal(contextHitsEnumerator.Current.Highlight1Offset, resultEnumerator.Current.Highlight1Offset); - Assert.Equal(contextHitsEnumerator.Current.Highlight1Length, resultEnumerator.Current.Highlight1Length); - Assert.Equal(contextHitsEnumerator.Current.Highlight2Offset, resultEnumerator.Current.Highlight2Offset); - Assert.Equal(contextHitsEnumerator.Current.Highlight2Length, resultEnumerator.Current.Highlight2Length); - Assert.Equal(contextHitsEnumerator.Current.HitWidth, resultEnumerator.Current.HitWidth); - Assert.Equal(contextHitsEnumerator.Current.EdocHitCount, resultEnumerator.Current.EdocHitCount); - Assert.Equal(contextHitsEnumerator.Current.FieldHitCount, resultEnumerator.Current.FieldHitCount); - Assert.Equal(contextHitsEnumerator.Current.FieldName, resultEnumerator.Current.FieldName); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Searches/{searchToken}/Results/{rowNumber}/ContextHits?" + - $"%24select={selectQueryParameter}&%24orderby={orderbyQueryParameter}&%24top={topQueryParameter}&" + - $"%24skip={skipQueryParameter}&%24count={countQueryParameter.ToString().ToLower()}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - && req.Headers.Contains("Prefer") // and Prefer header with maxpagesize value - && req.Headers.GetValues("Prefer").FirstOrDefault() == preferHeaderValue - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Searches/GetSearchResultsTest.cs b/tests/unit/Searches/GetSearchResultsTest.cs deleted file mode 100644 index 10253384..00000000 --- a/tests/unit/Searches/GetSearchResultsTest.cs +++ /dev/null @@ -1,294 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Searches -{ - public class GetSearchResultsTest - { - [Fact] - public async Task GetSearchResultsAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string searchToken = "123-ABC"; - ODataValueContextOfIListOfEntry entries = new ODataValueContextOfIListOfEntry() - { - Value = new List() - { - new Document() - { - Id = 100, - Name = "entry1", - ParentId = 1, - FullPath = @"\entry1", - FolderPath = @"\", - Creator = "", - CreationTime = DateTimeOffset.Parse("2021-01-01"), - LastModifiedTime = DateTimeOffset.Parse("2021-01-01"), - EntryType = EntryType.Document, - TemplateName = null, - TemplateId = 0, - VolumeName = "default", - RowNumber = 1 - }, - new Document() - { - Id = 101, - Name = "entry2", - ParentId = 1, - FullPath = @"\entry2", - FolderPath = @"\", - Creator = "", - CreationTime = DateTimeOffset.Parse("2021-01-01"), - LastModifiedTime = DateTimeOffset.Parse("2021-01-01"), - EntryType = EntryType.Document, - TemplateName = null, - TemplateId = 0, - VolumeName = "default", - RowNumber = 2 - } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(entries)), - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.SearchesClient.GetSearchResultsAsync(repoId, searchToken).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(entries.Value.Count, result.Value.Count); - var entriesEnumerator = entries.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (entriesEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(entriesEnumerator.Current.Id, resultEnumerator.Current.Id); - Assert.Equal(entriesEnumerator.Current.Name, resultEnumerator.Current.Name); - Assert.Equal(entriesEnumerator.Current.ParentId, resultEnumerator.Current.ParentId); - Assert.Equal(entriesEnumerator.Current.FullPath, resultEnumerator.Current.FullPath); - Assert.Equal(entriesEnumerator.Current.FolderPath, resultEnumerator.Current.FolderPath); - Assert.Equal(entriesEnumerator.Current.Creator, resultEnumerator.Current.Creator); - Assert.Equal(entriesEnumerator.Current.CreationTime, resultEnumerator.Current.CreationTime); - Assert.Equal(entriesEnumerator.Current.LastModifiedTime, resultEnumerator.Current.LastModifiedTime); - Assert.Equal(entriesEnumerator.Current.EntryType, resultEnumerator.Current.EntryType); - Assert.Equal(entriesEnumerator.Current.TemplateName, resultEnumerator.Current.TemplateName); - Assert.Equal(entriesEnumerator.Current.TemplateId, resultEnumerator.Current.TemplateId); - Assert.Equal(entriesEnumerator.Current.VolumeName, resultEnumerator.Current.VolumeName); - Assert.Equal(entriesEnumerator.Current.RowNumber, resultEnumerator.Current.RowNumber); - Assert.Equal(typeof(Document), resultEnumerator.Current.GetType()); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Searches/{searchToken}/Results"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetSearchResultsAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string searchToken = "123-ABC"; - var statusCode = HttpStatusCode.Unauthorized; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.SearchesClient.GetSearchResultsAsync(repoId, searchToken).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Searches/{searchToken}/Results"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetSearchResultsAsync_WithPreferHeader_WithQueryParameters_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string searchToken = "123-ABC"; - bool groupByEntryType = true; - bool refresh = true; - string preferHeaderValue = "maxpagesize=1"; - string selectQueryParameter = "name"; - string orderbyQueryParameter = "name"; - int topQueryParameter = 1; - int skipQueryParameter = 1; - bool countQueryParameter = true; - bool formatFields = true; - string culture = "fr"; - ODataValueContextOfIListOfEntry entries = new ODataValueContextOfIListOfEntry() - { - Value = new List() - { - new Document() - { - Id = 100, - Name = "entry1", - ParentId = 1, - FullPath = @"\entry1", - FolderPath = @"\", - Creator = "", - CreationTime = DateTimeOffset.Parse("2021-01-01"), - LastModifiedTime = DateTimeOffset.Parse("2021-01-01"), - EntryType = EntryType.Document, - TemplateName = null, - TemplateId = 0, - VolumeName = "default", - RowNumber = 1 - } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(entries)), - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.SearchesClient.GetSearchResultsAsync(repoId, searchToken, groupByEntryType: groupByEntryType, - refresh: refresh, fields: new List() { "field1", "field2" }, formatFields: formatFields, prefer: preferHeaderValue, culture: culture, - select: selectQueryParameter, orderby: orderbyQueryParameter, top: topQueryParameter, skip: skipQueryParameter, count: countQueryParameter).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(entries.Value.Count, result.Value.Count); - var entriesEnumerator = entries.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (entriesEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(entriesEnumerator.Current.Id, resultEnumerator.Current.Id); - Assert.Equal(entriesEnumerator.Current.Name, resultEnumerator.Current.Name); - Assert.Equal(entriesEnumerator.Current.ParentId, resultEnumerator.Current.ParentId); - Assert.Equal(entriesEnumerator.Current.FullPath, resultEnumerator.Current.FullPath); - Assert.Equal(entriesEnumerator.Current.FolderPath, resultEnumerator.Current.FolderPath); - Assert.Equal(entriesEnumerator.Current.Creator, resultEnumerator.Current.Creator); - Assert.Equal(entriesEnumerator.Current.CreationTime, resultEnumerator.Current.CreationTime); - Assert.Equal(entriesEnumerator.Current.LastModifiedTime, resultEnumerator.Current.LastModifiedTime); - Assert.Equal(entriesEnumerator.Current.EntryType, resultEnumerator.Current.EntryType); - Assert.Equal(entriesEnumerator.Current.TemplateName, resultEnumerator.Current.TemplateName); - Assert.Equal(entriesEnumerator.Current.TemplateId, resultEnumerator.Current.TemplateId); - Assert.Equal(entriesEnumerator.Current.VolumeName, resultEnumerator.Current.VolumeName); - Assert.Equal(entriesEnumerator.Current.RowNumber, resultEnumerator.Current.RowNumber); - Assert.Equal(typeof(Document), resultEnumerator.Current.GetType()); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Searches/{searchToken}/Results?" + - $"groupByEntryType={groupByEntryType.ToString().ToLower()}&refresh={refresh.ToString().ToLower()}&" + - $"fields=field1&fields=field2&formatFields={formatFields.ToString().ToLower()}&culture={culture}&%24select={selectQueryParameter}" + - $"&%24orderby={orderbyQueryParameter}&%24top={topQueryParameter}&%24skip={skipQueryParameter}&%24count={countQueryParameter.ToString().ToLower()}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - && req.Headers.Contains("Prefer") // and Prefer header with maxpagesize value - && req.Headers.GetValues("Prefer").FirstOrDefault() == preferHeaderValue - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Searches/GetSearchStatusTest.cs b/tests/unit/Searches/GetSearchStatusTest.cs deleted file mode 100644 index fb2b3494..00000000 --- a/tests/unit/Searches/GetSearchStatusTest.cs +++ /dev/null @@ -1,273 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Searches -{ - public class GetSearchStatusTest - { - [Fact] - public async Task GetSearchStatusAsync_ReturnOkStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string searchToken = "123-ABC"; - var searchStatus = new OperationProgress() - { - OperationToken = searchToken, - OperationType = "Search", - PercentComplete = 100, - Status = OperationStatus.Failed, - Errors = new List() - { - new OperationErrorItem() { ErrorMessage = "The search failed" } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(searchStatus)), - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.SearchesClient.GetSearchStatusAsync(repoId, searchToken).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(searchStatus.OperationToken, result.OperationToken); - Assert.Equal(searchStatus.OperationType, result.OperationType); - Assert.Equal(searchStatus.PercentComplete, result.PercentComplete); - Assert.Equal(searchStatus.Status, result.Status); - Assert.Equal(searchStatus.Errors.Count, result.Errors.Count); - Assert.Equal(searchStatus.Errors.FirstOrDefault().ErrorMessage, result.Errors.FirstOrDefault()?.ErrorMessage); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Searches/{searchToken}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetSearchStatusAsync_ReturnCreatedStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string searchToken = "123-ABC"; - var searchStatus = new OperationProgress() - { - OperationToken = searchToken, - OperationType = "Search", - PercentComplete = 100, - Status = OperationStatus.Completed, - Errors = new List() - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.Created, - Content = new StringContent(JsonConvert.SerializeObject(searchStatus)), - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.SearchesClient.GetSearchStatusAsync(repoId, searchToken).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(searchStatus.OperationToken, result.OperationToken); - Assert.Equal(searchStatus.OperationType, result.OperationType); - Assert.Equal(searchStatus.PercentComplete, result.PercentComplete); - Assert.Equal(searchStatus.Status, result.Status); - Assert.Equal(searchStatus.Errors.Count, result.Errors.Count); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Searches/{searchToken}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetSearchStatusAsync_ReturnAcceptedStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string searchToken = "123-ABC"; - var searchStatus = new OperationProgress() - { - OperationToken = searchToken, - OperationType = "Search", - PercentComplete = 25, - Status = OperationStatus.InProgress, - Errors = new List() - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.Accepted, - Content = new StringContent(JsonConvert.SerializeObject(searchStatus)), - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.SearchesClient.GetSearchStatusAsync(repoId, searchToken).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(searchStatus.OperationToken, result.OperationToken); - Assert.Equal(searchStatus.OperationType, result.OperationType); - Assert.Equal(searchStatus.PercentComplete, result.PercentComplete); - Assert.Equal(searchStatus.Status, result.Status); - Assert.Equal(searchStatus.Errors.Count, result.Errors.Count); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Searches/{searchToken}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetSearchStatusAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string searchToken = "123-ABC"; - var statusCode = HttpStatusCode.Unauthorized; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.SearchesClient.GetSearchStatusAsync(repoId, searchToken).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Searches/{searchToken}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/SimpleSearches/SimpleSearchTest.cs b/tests/unit/SimpleSearches/SimpleSearchTest.cs deleted file mode 100644 index e051eb31..00000000 --- a/tests/unit/SimpleSearches/SimpleSearchTest.cs +++ /dev/null @@ -1,305 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.SimpleSearches -{ - public class SimpleSearchTest - { - [Fact] - public async Task CreateSimpleSearchOperationAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var request = new SimpleSearchRequest() { SearchCommand = "({LF:Basic ~= \"search text\", option=\"DFANLT\"})" }; - ODataValueOfIListOfEntry entries = new ODataValueOfIListOfEntry() - { - Value = new List() - { - new Document() - { - Id = 100, - Name = "entry1", - ParentId = 1, - FullPath = @"\entry1", - FolderPath = @"\", - Creator = "", - CreationTime = DateTimeOffset.Parse("2021-01-01"), - LastModifiedTime = DateTimeOffset.Parse("2021-01-01"), - EntryType = EntryType.Document, - TemplateName = null, - TemplateId = 0, - VolumeName = "default", - RowNumber = 1 - }, - new Document() - { - Id = 101, - Name = "entry2", - ParentId = 1, - FullPath = @"\entry2", - FolderPath = @"\", - Creator = "", - CreationTime = DateTimeOffset.Parse("2021-01-01"), - LastModifiedTime = DateTimeOffset.Parse("2021-01-01"), - EntryType = EntryType.Document, - TemplateName = null, - TemplateId = 0, - VolumeName = "default", - RowNumber = 2 - } - } - }; - - string requestContent = ""; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => requestContent = httpRequestMessage.Content.ReadAsStringAsync().Result) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(entries)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.SimpleSearchesClient.CreateSimpleSearchOperationAsync(repoId, request: request).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(entries.Value.Count, result.Value.Count); - var entriesEnumerator = entries.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (entriesEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(entriesEnumerator.Current.Id, resultEnumerator.Current.Id); - Assert.Equal(entriesEnumerator.Current.Name, resultEnumerator.Current.Name); - Assert.Equal(entriesEnumerator.Current.ParentId, resultEnumerator.Current.ParentId); - Assert.Equal(entriesEnumerator.Current.FullPath, resultEnumerator.Current.FullPath); - Assert.Equal(entriesEnumerator.Current.FolderPath, resultEnumerator.Current.FolderPath); - Assert.Equal(entriesEnumerator.Current.Creator, resultEnumerator.Current.Creator); - Assert.Equal(entriesEnumerator.Current.CreationTime, resultEnumerator.Current.CreationTime); - Assert.Equal(entriesEnumerator.Current.LastModifiedTime, resultEnumerator.Current.LastModifiedTime); - Assert.Equal(entriesEnumerator.Current.EntryType, resultEnumerator.Current.EntryType); - Assert.Equal(entriesEnumerator.Current.TemplateName, resultEnumerator.Current.TemplateName); - Assert.Equal(entriesEnumerator.Current.TemplateId, resultEnumerator.Current.TemplateId); - Assert.Equal(entriesEnumerator.Current.VolumeName, resultEnumerator.Current.VolumeName); - Assert.Equal(entriesEnumerator.Current.RowNumber, resultEnumerator.Current.RowNumber); - Assert.Equal(typeof(Document), resultEnumerator.Current.GetType()); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/SimpleSearches"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a POST request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(request), requestContent); - } - - [Fact] - public async Task CreateSimpleSearchOperationAsync_WithQueryParameters() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var request = new SimpleSearchRequest() { SearchCommand = "({LF:Basic ~= \"search text\", option=\"DFANLT\"})" }; - ODataValueOfIListOfEntry entries = new ODataValueOfIListOfEntry() - { - Value = new List() - { - new Document() - { - Id = 100, - Name = "entry1", - ParentId = 1, - FullPath = @"\entry1", - FolderPath = @"\", - Creator = "", - CreationTime = DateTimeOffset.Parse("2021-01-01"), - LastModifiedTime = DateTimeOffset.Parse("2021-01-01"), - EntryType = EntryType.Document, - TemplateName = null, - TemplateId = 0, - VolumeName = "default", - RowNumber = 1 - }, - new Document() - { - Id = 101, - Name = "entry2", - ParentId = 1, - FullPath = @"\entry2", - FolderPath = @"\", - Creator = "", - CreationTime = DateTimeOffset.Parse("2021-01-01"), - LastModifiedTime = DateTimeOffset.Parse("2021-01-01"), - EntryType = EntryType.Document, - TemplateName = null, - TemplateId = 0, - VolumeName = "default", - RowNumber = 2 - } - } - }; - - string requestContent = ""; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => requestContent = httpRequestMessage.Content.ReadAsStringAsync().Result) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(entries)) - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.SimpleSearchesClient.CreateSimpleSearchOperationAsync(repoId, select: "select", orderby: "orderby", - count: true, fields: new List() { "field1", "field2" }, formatFields: true, request: request, culture: "fr").ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(entries.Value.Count, result.Value.Count); - var entriesEnumerator = entries.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (entriesEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(entriesEnumerator.Current.Id, resultEnumerator.Current.Id); - Assert.Equal(entriesEnumerator.Current.Name, resultEnumerator.Current.Name); - Assert.Equal(entriesEnumerator.Current.ParentId, resultEnumerator.Current.ParentId); - Assert.Equal(entriesEnumerator.Current.FullPath, resultEnumerator.Current.FullPath); - Assert.Equal(entriesEnumerator.Current.FolderPath, resultEnumerator.Current.FolderPath); - Assert.Equal(entriesEnumerator.Current.Creator, resultEnumerator.Current.Creator); - Assert.Equal(entriesEnumerator.Current.CreationTime, resultEnumerator.Current.CreationTime); - Assert.Equal(entriesEnumerator.Current.LastModifiedTime, resultEnumerator.Current.LastModifiedTime); - Assert.Equal(entriesEnumerator.Current.EntryType, resultEnumerator.Current.EntryType); - Assert.Equal(entriesEnumerator.Current.TemplateName, resultEnumerator.Current.TemplateName); - Assert.Equal(entriesEnumerator.Current.TemplateId, resultEnumerator.Current.TemplateId); - Assert.Equal(entriesEnumerator.Current.VolumeName, resultEnumerator.Current.VolumeName); - Assert.Equal(entriesEnumerator.Current.RowNumber, resultEnumerator.Current.RowNumber); - Assert.Equal(typeof(Document), resultEnumerator.Current.GetType()); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/SimpleSearches?%24select=select&%24orderby=orderby&%24count=true&fields=field1&fields=field2&formatFields=true&culture=fr"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a POST request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(request), requestContent); - } - - [Fact] - public async Task CreateSimpleSearchOperationAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var statusCode = HttpStatusCode.Unauthorized; - var request = new SimpleSearchRequest() { SearchCommand = "({LF:Basic ~= \"search text\", option=\"DFANLT\"})" }; - - string requestContent = ""; - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // Capture the request body - .Callback((httpRequestMessage, _) => requestContent = httpRequestMessage.Content.ReadAsStringAsync().Result) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.SimpleSearchesClient.CreateSimpleSearchOperationAsync(repoId, request: request).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/SimpleSearches"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Post // we expected a POST request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - Assert.Equal(JsonConvert.SerializeObject(request), requestContent); - } - } -} diff --git a/tests/unit/TagDefinitions/TagDefinitionsByIdTest.cs b/tests/unit/TagDefinitions/TagDefinitionsByIdTest.cs deleted file mode 100644 index 0d28d00b..00000000 --- a/tests/unit/TagDefinitions/TagDefinitionsByIdTest.cs +++ /dev/null @@ -1,147 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.TagDefinitions -{ - public class TagDefinitionsByIdTest - { - [Fact] - public async Task GetTagDefinitionByIdAsync_200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - - WTagInfo tagInfo = new WTagInfo() - { - Id = 1, - Name = "TagName", - Description = "Description", - IsSecure = true, - Watermark = new Watermark() - { - WatermarkText = "Watermark Text", - WatermarkTextSize = 3, - IsWatermarkMandatory = true, - WatermarkIntensity = 4, - WatermarkPosition = WatermarkPosition.TopLeft, - WatermarkRotationAngle = 5 - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(tagInfo)), - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.TagDefinitionsClient.GetTagDefinitionByIdAsync(repoId, tagInfo.Id).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(tagInfo.Id, result.Id); - Assert.Equal(tagInfo.Name, result.Name); - Assert.Equal(tagInfo.Description, result.Description); - Assert.Equal(tagInfo.IsSecure, result.IsSecure); - Assert.Equal(tagInfo.Watermark.WatermarkText, result.Watermark.WatermarkText); - Assert.Equal(tagInfo.Watermark.WatermarkTextSize, result.Watermark.WatermarkTextSize); - Assert.Equal(tagInfo.Watermark.IsWatermarkMandatory, result.Watermark.IsWatermarkMandatory); - Assert.Equal(tagInfo.Watermark.WatermarkIntensity, result.Watermark.WatermarkIntensity); - Assert.Equal(tagInfo.Watermark.WatermarkPosition, result.Watermark.WatermarkPosition); - Assert.Equal(tagInfo.Watermark.WatermarkRotationAngle, result.Watermark.WatermarkRotationAngle); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/TagDefinitions/{tagInfo.Id}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetTagDefinitionByIdAsync_AnyOther() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var tagDefinition = 123123; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.NotFound - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.TagDefinitionsClient.GetTagDefinitionByIdAsync(repoId, tagDefinition).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/TagDefinitions/{tagDefinition}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/TagDefinitions/TagDefinitionsTest.cs b/tests/unit/TagDefinitions/TagDefinitionsTest.cs deleted file mode 100644 index 985ae80a..00000000 --- a/tests/unit/TagDefinitions/TagDefinitionsTest.cs +++ /dev/null @@ -1,261 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.TagDefinitions -{ - public class TagDefinitionsTest - { - [Fact] - public async Task GetTagDefinitionsAsync_200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - WTagInfo tagInfo = new WTagInfo() - { - Id = 1, - Name = "TagName", - Description = "Description", - IsSecure = true, - Watermark = new Watermark() - { - WatermarkText = "Watermark Text", - WatermarkTextSize = 3, - IsWatermarkMandatory = true, - WatermarkIntensity = 4, - WatermarkPosition = WatermarkPosition.TopLeft, - WatermarkRotationAngle = 5 - } - }; - WTagInfo tagInfo2 = new WTagInfo() - { - Id = 2, - Name = "TagName2", - Description = "Description2", - IsSecure = false, - Watermark = new Watermark() - { - WatermarkText = "Watermark Text2", - WatermarkTextSize = 6, - IsWatermarkMandatory = false, - WatermarkIntensity = 7, - WatermarkPosition = WatermarkPosition.TopRight, - WatermarkRotationAngle = 8 - } - }; - IList tags = new List() { tagInfo, tagInfo2 }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(new ODataValueOfIListOfWTagInfo() { Value = tags})) - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.TagDefinitionsClient.GetTagDefinitionsAsync(repoId).ConfigureAwait(false); - Assert.Equal(2, result.Value.Count); - Assert.Equal(tagInfo.Id, result.Value.ElementAt(0).Id); - Assert.Equal(tagInfo.Description, result.Value.ElementAt(0).Description); - Assert.Equal(tagInfo.Name, result.Value.ElementAt(0).Name); - Assert.Equal(tagInfo.IsSecure, result.Value.ElementAt(0).IsSecure); - Assert.Equal(tagInfo.Watermark.WatermarkTextSize, result.Value.ElementAt(0).Watermark.WatermarkTextSize); - Assert.Equal(tagInfo.Watermark.IsWatermarkMandatory, result.Value.ElementAt(0).Watermark.IsWatermarkMandatory); - Assert.Equal(tagInfo.Watermark.WatermarkIntensity, result.Value.ElementAt(0).Watermark.WatermarkIntensity); - Assert.Equal(tagInfo.Watermark.WatermarkPosition, result.Value.ElementAt(0).Watermark.WatermarkPosition); - Assert.Equal(tagInfo.Watermark.WatermarkRotationAngle, result.Value.ElementAt(0).Watermark.WatermarkRotationAngle); - Assert.Equal(tagInfo.Watermark.WatermarkText, result.Value.ElementAt(0).Watermark.WatermarkText); - Assert.Equal(tagInfo2.Id, result.Value.ElementAt(1).Id); - Assert.Equal(tagInfo2.Description, result.Value.ElementAt(1).Description); - Assert.Equal(tagInfo2.Name, result.Value.ElementAt(1).Name); - Assert.Equal(tagInfo2.IsSecure, result.Value.ElementAt(1).IsSecure); - Assert.Equal(tagInfo2.Watermark.WatermarkTextSize, result.Value.ElementAt(1).Watermark.WatermarkTextSize); - Assert.Equal(tagInfo2.Watermark.IsWatermarkMandatory, result.Value.ElementAt(1).Watermark.IsWatermarkMandatory); - Assert.Equal(tagInfo2.Watermark.WatermarkIntensity, result.Value.ElementAt(1).Watermark.WatermarkIntensity); - Assert.Equal(tagInfo2.Watermark.WatermarkPosition, result.Value.ElementAt(1).Watermark.WatermarkPosition); - Assert.Equal(tagInfo2.Watermark.WatermarkRotationAngle, result.Value.ElementAt(1).Watermark.WatermarkRotationAngle); - Assert.Equal(tagInfo2.Watermark.WatermarkText, result.Value.ElementAt(1).Watermark.WatermarkText); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/TagDefinitions"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetTagDefinitionsAsync_AnyOther() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.NotFound - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.TagDefinitionsClient.GetTagDefinitionsAsync(repoId).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/TagDefinitions"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetTagDefinitionsAsync_ODataQueryOptions() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - WTagInfo tagInfo = new WTagInfo() - { - Id = 1, - Name = "TagName", - Description = "Description", - IsSecure = true, - Watermark = new Watermark() - { - WatermarkText = "Watermark Text", - WatermarkTextSize = 3, - IsWatermarkMandatory = true, - WatermarkIntensity = 4, - WatermarkPosition = WatermarkPosition.TopLeft, - WatermarkRotationAngle = 5 - } - }; - WTagInfo tagInfo2 = new WTagInfo() - { - Id = 2, - Name = "TagName2", - Description = "Description2", - IsSecure = false, - Watermark = new Watermark() - { - WatermarkText = "Watermark Text2", - WatermarkTextSize = 6, - IsWatermarkMandatory = false, - WatermarkIntensity = 7, - WatermarkPosition = WatermarkPosition.TopRight, - WatermarkRotationAngle = 8 - } - }; - IList tags = new List() { tagInfo, tagInfo2 }; - - var mockHttpResponseMessage = new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(new ODataValueOfIListOfWTagInfo() { Value = tags })) - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(mockHttpResponseMessage) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - _ = await client.TagDefinitionsClient.GetTagDefinitionsAsync(repoId, prefer:"Prefer", select:"select", orderby:"orderBy",top:1, skip:1, count:true).ConfigureAwait(false); - - // ASSERT - // also check the 'http' call was like we expected it - var expectedUri = new Uri("http://api.laserfiche.com/v1/Repositories/repoId/TagDefinitions?%24select=select&%24orderby=orderBy&%24top=1&%24skip=1&%24count=true"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - && req.Headers.GetValues("Prefer").Contains("Prefer") // with the prefer header set to "Prefer" - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Tasks/CancelOperationTest.cs b/tests/unit/Tasks/CancelOperationTest.cs deleted file mode 100644 index 3657d8b8..00000000 --- a/tests/unit/Tasks/CancelOperationTest.cs +++ /dev/null @@ -1,116 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using System; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Operations -{ - public class CancelOperationTest - { - [Fact] - public async Task CancelOperationAsync_204() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string operationToken = "operationToken"; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.NoContent - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await client.TasksClient.CancelOperationAsync(repoId, operationToken).ConfigureAwait(false); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Tasks/{operationToken}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Delete // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - - public async Task CancelOperationAsync_AnyOther() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string operationToken = "operationToken"; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.NotFound - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.TasksClient.CancelOperationAsync(repoId, operationToken).ConfigureAwait(false)).ConfigureAwait(false); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Tasks/{operationToken}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Delete // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/Tasks/GetOperationStatusTest.cs b/tests/unit/Tasks/GetOperationStatusTest.cs deleted file mode 100644 index 462683b4..00000000 --- a/tests/unit/Tasks/GetOperationStatusTest.cs +++ /dev/null @@ -1,197 +0,0 @@ -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Tasks -{ - public class GetOperationStatusTest - { - [Fact] - public async Task GetOperationStatusAndProgressAsync_200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - OperationProgress operationProgress = new OperationProgress() - { - OperationToken = "operationToken", - OperationType = "type", - PercentComplete = 100, - Status = OperationStatus.Completed - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(operationProgress)) - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var swaggerResponse = await client.TasksClient.GetOperationStatusAndProgressAsync(repoId, operationProgress.OperationToken).ConfigureAwait(false); - - // ASSERT - Assert.Equal(operationProgress.OperationToken, swaggerResponse.OperationToken); - Assert.Equal(operationProgress.OperationType, swaggerResponse.OperationType); - Assert.Equal(operationProgress.Status, swaggerResponse.Status); - Assert.Equal(operationProgress.PercentComplete, swaggerResponse.PercentComplete); - - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Tasks/{operationProgress.OperationToken}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetOperationStatusAndProgressAsync_202() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - OperationErrorItem error = new OperationErrorItem() { ObjectId = 1, ErrorMessage = "ErrorMessage" }; - OperationProgress operationProgress = new OperationProgress() - { - OperationToken = "operationToken", - OperationType = "type", - PercentComplete = 100, - Status = OperationStatus.Failed, - Errors = new List() { error } - }; - - var mockHttpResponseMessage = new HttpResponseMessage() - { - StatusCode = HttpStatusCode.Accepted, - Content = new StringContent(JsonConvert.SerializeObject(operationProgress)), - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(mockHttpResponseMessage) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var progress = await client.TasksClient.GetOperationStatusAndProgressAsync(repoId, operationProgress.OperationToken).ConfigureAwait(false); - - // ASSERT - Assert.Equal(operationProgress.OperationToken, progress.OperationToken); - Assert.Equal(operationProgress.OperationType, progress.OperationType); - Assert.Equal(operationProgress.Status, progress.Status); - Assert.Equal(operationProgress.PercentComplete, progress.PercentComplete); - Assert.Equal(error.ObjectId, progress.Errors.First().ObjectId); - Assert.Equal(error.ErrorMessage, progress.Errors.First().ErrorMessage); - - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Tasks/{operationProgress.OperationToken}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetOperationStatusAndProgressAsync_AnyOther() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var mockHttpResponseMessage = new HttpResponseMessage() - { - StatusCode = HttpStatusCode.Unauthorized - }; - var operationToken = "operationToken"; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(mockHttpResponseMessage) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - await Assert.ThrowsAsync(async () => await client.TasksClient.GetOperationStatusAndProgressAsync(repoId, operationToken).ConfigureAwait(false)).ConfigureAwait(false); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Tasks/{operationToken}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/TemplateDefinitions/GetTemplateDefinitionByIdTest.cs b/tests/unit/TemplateDefinitions/GetTemplateDefinitionByIdTest.cs deleted file mode 100644 index df9a29b8..00000000 --- a/tests/unit/TemplateDefinitions/GetTemplateDefinitionByIdTest.cs +++ /dev/null @@ -1,143 +0,0 @@ -using System; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.TemplateDefinitions -{ - public class GetTemplateDefinitionByIdTest - { - [Fact] - public async Task GetTemplateDefinitionByIdAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - WTemplateInfo templateDefinition = new WTemplateInfo() - { - Id = 1, - Name = "Template", - Description = "Template Description", - FieldCount = 2, - Color = new LFColor() - { - A = 255, - R = 255, - G = 255, - B = 255 - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(templateDefinition)), - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.TemplateDefinitionsClient.GetTemplateDefinitionByIdAsync(repoId, templateDefinition.Id).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(templateDefinition.Id, result.Id); - Assert.Equal(templateDefinition.Name, result.Name); - Assert.Equal(templateDefinition.Description, result.Description); - Assert.Equal(templateDefinition.FieldCount, result.FieldCount); - Assert.Equal(templateDefinition.Color.A, result.Color.A); - Assert.Equal(templateDefinition.Color.R, result.Color.R); - Assert.Equal(templateDefinition.Color.G, result.Color.G); - Assert.Equal(templateDefinition.Color.B, result.Color.B); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/TemplateDefinitions/{templateDefinition.Id}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetTemplateDefinitionByIdAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int templateDefinitionId = 1; - var statusCode = HttpStatusCode.Unauthorized; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.TemplateDefinitionsClient.GetTemplateDefinitionByIdAsync(repoId, templateDefinitionId).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/TemplateDefinitions/{templateDefinitionId}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/TemplateDefinitions/GetTemplateDefinitionFieldsByTemplateNameTest.cs b/tests/unit/TemplateDefinitions/GetTemplateDefinitionFieldsByTemplateNameTest.cs deleted file mode 100644 index 41f7b6e0..00000000 --- a/tests/unit/TemplateDefinitions/GetTemplateDefinitionFieldsByTemplateNameTest.cs +++ /dev/null @@ -1,307 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.TemplateDefinitions -{ - public class GetTemplateDefinitionFieldsByTemplateNameTest - { - [Fact] - public async Task GetTemplateFieldDefinitionsByTemplateNameAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string templateDefinitioName = "Template"; - ODataValueOfIListOfTemplateFieldInfo templateFieldDefinitionList = new ODataValueOfIListOfTemplateFieldInfo() - { - Value = new List() - { - new TemplateFieldInfo() - { - Id = 1, - Name = "Field1", - Description = "First Field Description", - FieldType = WFieldType.String, - Length = 100, - DefaultValue = null, - IsMultiValue = false, - IsRequired = false, - Constraint = "", - ConstraintError = "", - ListValues = new List(), - Format = WFieldFormat.None, - Currency = "", - FormatPattern = "", - GroupId = 0, - GroupName = null, - Rule = null - }, - new TemplateFieldInfo() - { - Id = 10, - Name = "Field2", - Description = "Second Field Description", - FieldType = WFieldType.DateTime, - Length = 0, - DefaultValue = null, - IsMultiValue = false, - IsRequired = false, - Constraint = "", - ConstraintError = "", - ListValues = new List(), - Format = WFieldFormat.ShortDateTime, - Currency = "", - FormatPattern = "", - GroupId = 0, - GroupName = null, - Rule = null - } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(templateFieldDefinitionList)), - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.TemplateDefinitionsClient.GetTemplateFieldDefinitionsByTemplateNameAsync(repoId, templateDefinitioName).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(templateFieldDefinitionList.Value.Count, result.Value.Count); - var templateFieldDefinitionListEnumerator = templateFieldDefinitionList.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (templateFieldDefinitionListEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Id, resultEnumerator.Current.Id); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Name, resultEnumerator.Current.Name); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Description, resultEnumerator.Current.Description); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.FieldType, resultEnumerator.Current.FieldType); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Length, resultEnumerator.Current.Length); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.DefaultValue, resultEnumerator.Current.DefaultValue); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.IsMultiValue, resultEnumerator.Current.IsMultiValue); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.IsRequired, resultEnumerator.Current.IsRequired); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Constraint, resultEnumerator.Current.Constraint); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.ConstraintError, resultEnumerator.Current.ConstraintError); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.ListValues.Count, resultEnumerator.Current.ListValues.Count); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Format, resultEnumerator.Current.Format); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Currency, resultEnumerator.Current.Currency); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.FormatPattern, resultEnumerator.Current.FormatPattern); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.GroupId, resultEnumerator.Current.GroupId); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.GroupName, resultEnumerator.Current.GroupName); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Rule, resultEnumerator.Current.Rule); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/TemplateDefinitions/Fields?templateName={templateDefinitioName}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetTemplateFieldDefinitionsByTemplateNameAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string templateDefinitioName = "Template"; - var statusCode = HttpStatusCode.Unauthorized; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode, - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.TemplateDefinitionsClient.GetTemplateFieldDefinitionsByTemplateNameAsync(repoId, templateDefinitioName).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/TemplateDefinitions/Fields?templateName={templateDefinitioName}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetTemplateFieldDefinitionsByTemplateNameAsync_WithPreferHeader_WithQueryParameters_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string templateDefinitioName = "Template"; - string preferHeaderValue = "maxpagesize=1"; - string selectQueryParameter = "description"; - string orderbyQueryParameter = "name"; - int topQueryParameter = 1; - int skipQueryParameter = 1; - bool countQueryParameter = true; - ODataValueOfIListOfTemplateFieldInfo templateFieldDefinitionList = new ODataValueOfIListOfTemplateFieldInfo() - { - Value = new List() - { - new TemplateFieldInfo() - { - Id = 1, - Name = "Field1", - Description = "First Field Description", - FieldType = WFieldType.String, - Length = 100, - DefaultValue = null, - IsMultiValue = false, - IsRequired = false, - Constraint = "", - ConstraintError = "", - ListValues = new List(), - Format = WFieldFormat.None, - Currency = "", - FormatPattern = "", - GroupId = 0, - GroupName = null, - Rule = null - } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(templateFieldDefinitionList)), - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.TemplateDefinitionsClient.GetTemplateFieldDefinitionsByTemplateNameAsync(repoId, templateDefinitioName, prefer: preferHeaderValue, - select: selectQueryParameter, orderby: orderbyQueryParameter, top: topQueryParameter, - skip: skipQueryParameter, count: countQueryParameter).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(templateFieldDefinitionList.Value.Count, result.Value.Count); - var templateFieldDefinitionListEnumerator = templateFieldDefinitionList.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (templateFieldDefinitionListEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Id, resultEnumerator.Current.Id); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Name, resultEnumerator.Current.Name); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Description, resultEnumerator.Current.Description); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.FieldType, resultEnumerator.Current.FieldType); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Length, resultEnumerator.Current.Length); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.DefaultValue, resultEnumerator.Current.DefaultValue); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.IsMultiValue, resultEnumerator.Current.IsMultiValue); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.IsRequired, resultEnumerator.Current.IsRequired); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Constraint, resultEnumerator.Current.Constraint); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.ConstraintError, resultEnumerator.Current.ConstraintError); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.ListValues.Count, resultEnumerator.Current.ListValues.Count); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Format, resultEnumerator.Current.Format); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Currency, resultEnumerator.Current.Currency); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.FormatPattern, resultEnumerator.Current.FormatPattern); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.GroupId, resultEnumerator.Current.GroupId); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.GroupName, resultEnumerator.Current.GroupName); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Rule, resultEnumerator.Current.Rule); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/TemplateDefinitions/Fields?templateName={templateDefinitioName}&" + - $"%24select={selectQueryParameter}&%24orderby={orderbyQueryParameter}&%24top={topQueryParameter}&" + - $"%24skip={skipQueryParameter}&%24count={countQueryParameter.ToString().ToLower()}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - && req.Headers.Contains("Prefer") // and Prefer header with maxpagesize value - && req.Headers.GetValues("Prefer").FirstOrDefault() == preferHeaderValue - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/TemplateDefinitions/GetTemplateDefinitionFieldsTest.cs b/tests/unit/TemplateDefinitions/GetTemplateDefinitionFieldsTest.cs deleted file mode 100644 index fb4fe37f..00000000 --- a/tests/unit/TemplateDefinitions/GetTemplateDefinitionFieldsTest.cs +++ /dev/null @@ -1,307 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.TemplateDefinitions -{ - public class GetTemplateDefinitionFieldsTest - { - [Fact] - public async Task GetTemplateFieldDefinitionsAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int templateDefinitionId = 1; - ODataValueOfIListOfTemplateFieldInfo templateFieldDefinitionList = new ODataValueOfIListOfTemplateFieldInfo() - { - Value = new List() - { - new TemplateFieldInfo() - { - Id = 1, - Name = "Field1", - Description = "First Field Description", - FieldType = WFieldType.String, - Length = 100, - DefaultValue = null, - IsMultiValue = false, - IsRequired = false, - Constraint = "", - ConstraintError = "", - ListValues = new List(), - Format = WFieldFormat.None, - Currency = "", - FormatPattern = "", - GroupId = 0, - GroupName = null, - Rule = null - }, - new TemplateFieldInfo() - { - Id = 10, - Name = "Field2", - Description = "Second Field Description", - FieldType = WFieldType.DateTime, - Length = 0, - DefaultValue = null, - IsMultiValue = false, - IsRequired = false, - Constraint = "", - ConstraintError = "", - ListValues = new List(), - Format = WFieldFormat.ShortDateTime, - Currency = "", - FormatPattern = "", - GroupId = 0, - GroupName = null, - Rule = null - } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(templateFieldDefinitionList)), - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.TemplateDefinitionsClient.GetTemplateFieldDefinitionsAsync(repoId, templateDefinitionId).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(templateFieldDefinitionList.Value.Count, result.Value.Count); - var templateFieldDefinitionListEnumerator = templateFieldDefinitionList.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (templateFieldDefinitionListEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Id, resultEnumerator.Current.Id); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Name, resultEnumerator.Current.Name); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Description, resultEnumerator.Current.Description); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.FieldType, resultEnumerator.Current.FieldType); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Length, resultEnumerator.Current.Length); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.DefaultValue, resultEnumerator.Current.DefaultValue); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.IsMultiValue, resultEnumerator.Current.IsMultiValue); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.IsRequired, resultEnumerator.Current.IsRequired); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Constraint, resultEnumerator.Current.Constraint); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.ConstraintError, resultEnumerator.Current.ConstraintError); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.ListValues.Count, resultEnumerator.Current.ListValues.Count); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Format, resultEnumerator.Current.Format); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Currency, resultEnumerator.Current.Currency); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.FormatPattern, resultEnumerator.Current.FormatPattern); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.GroupId, resultEnumerator.Current.GroupId); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.GroupName, resultEnumerator.Current.GroupName); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Rule, resultEnumerator.Current.Rule); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/TemplateDefinitions/{templateDefinitionId}/Fields"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetTemplateFieldDefinitionsAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int templateDefinitionId = 1; - var statusCode = HttpStatusCode.Unauthorized; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode, - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.TemplateDefinitionsClient.GetTemplateFieldDefinitionsAsync(repoId, templateDefinitionId).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/TemplateDefinitions/{templateDefinitionId}/Fields"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetTemplateFieldDefinitionsAsync_WithPreferHeader_WithQueryParameters_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - int templateDefinitionId = 1; - string preferHeaderValue = "maxpagesize=1"; - string selectQueryParameter = "description"; - string orderbyQueryParameter = "name"; - int topQueryParameter = 1; - int skipQueryParameter = 1; - bool countQueryParameter = true; - ODataValueOfIListOfTemplateFieldInfo templateFieldDefinitionList = new ODataValueOfIListOfTemplateFieldInfo() - { - Value = new List() - { - new TemplateFieldInfo() - { - Id = 1, - Name = "Field1", - Description = "First Field Description", - FieldType = WFieldType.String, - Length = 100, - DefaultValue = null, - IsMultiValue = false, - IsRequired = false, - Constraint = "", - ConstraintError = "", - ListValues = new List(), - Format = WFieldFormat.None, - Currency = "", - FormatPattern = "", - GroupId = 0, - GroupName = null, - Rule = null - } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(templateFieldDefinitionList)), - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.TemplateDefinitionsClient.GetTemplateFieldDefinitionsAsync(repoId, templateDefinitionId, prefer: preferHeaderValue, - select: selectQueryParameter, orderby: orderbyQueryParameter, top: topQueryParameter, - skip: skipQueryParameter, count: countQueryParameter).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(templateFieldDefinitionList.Value.Count, result.Value.Count); - var templateFieldDefinitionListEnumerator = templateFieldDefinitionList.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (templateFieldDefinitionListEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Id, resultEnumerator.Current.Id); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Name, resultEnumerator.Current.Name); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Description, resultEnumerator.Current.Description); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.FieldType, resultEnumerator.Current.FieldType); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Length, resultEnumerator.Current.Length); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.DefaultValue, resultEnumerator.Current.DefaultValue); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.IsMultiValue, resultEnumerator.Current.IsMultiValue); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.IsRequired, resultEnumerator.Current.IsRequired); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Constraint, resultEnumerator.Current.Constraint); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.ConstraintError, resultEnumerator.Current.ConstraintError); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.ListValues.Count, resultEnumerator.Current.ListValues.Count); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Format, resultEnumerator.Current.Format); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Currency, resultEnumerator.Current.Currency); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.FormatPattern, resultEnumerator.Current.FormatPattern); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.GroupId, resultEnumerator.Current.GroupId); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.GroupName, resultEnumerator.Current.GroupName); - Assert.Equal(templateFieldDefinitionListEnumerator.Current.Rule, resultEnumerator.Current.Rule); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/TemplateDefinitions/{templateDefinitionId}/Fields?" + - $"%24select={selectQueryParameter}&%24orderby={orderbyQueryParameter}&%24top={topQueryParameter}&" + - $"%24skip={skipQueryParameter}&%24count={countQueryParameter.ToString().ToLower()}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - && req.Headers.Contains("Prefer") // and Prefer header with maxpagesize value - && req.Headers.GetValues("Prefer").FirstOrDefault() == preferHeaderValue - ), - ItExpr.IsAny() - ); - } - } -} diff --git a/tests/unit/TemplateDefinitions/GetTemplateDefinitionTest.cs b/tests/unit/TemplateDefinitions/GetTemplateDefinitionTest.cs deleted file mode 100644 index ca872691..00000000 --- a/tests/unit/TemplateDefinitions/GetTemplateDefinitionTest.cs +++ /dev/null @@ -1,268 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Laserfiche.Api.Client; -using Moq; -using Moq.Protected; -using Newtonsoft.Json; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.TemplateDefinitions -{ - public class GetTemplateDefinitionTest - { - [Fact] - public async Task GetTemplateDefinitionsAsync_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - ODataValueOfIListOfWTemplateInfo templateDefinitionList = new ODataValueOfIListOfWTemplateInfo() - { - Value = new List() - { - new WTemplateInfo() - { - Id = 1, - Name = "Template1", - Description = "First Template Description", - FieldCount = 2, - Color = new LFColor() - { - A = 255, - R = 255, - G = 255, - B = 255 - } - }, - new WTemplateInfo() - { - Id = 10, - Name = "Template2", - Description = "Second Template Description", - FieldCount = 5, - Color = new LFColor() - { - A = 100, - R = 200, - G = 100, - B = 200 - } - } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(templateDefinitionList)), - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.TemplateDefinitionsClient.GetTemplateDefinitionsAsync(repoId).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(templateDefinitionList.Value.Count, result.Value.Count); - var templateDefinitionListEnumerator = templateDefinitionList.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (templateDefinitionListEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(templateDefinitionListEnumerator.Current.Id, resultEnumerator.Current.Id); - Assert.Equal(templateDefinitionListEnumerator.Current.Name, resultEnumerator.Current.Name); - Assert.Equal(templateDefinitionListEnumerator.Current.Description, resultEnumerator.Current.Description); - Assert.Equal(templateDefinitionListEnumerator.Current.FieldCount, resultEnumerator.Current.FieldCount); - Assert.Equal(templateDefinitionListEnumerator.Current.Color.A, resultEnumerator.Current.Color.A); - Assert.Equal(templateDefinitionListEnumerator.Current.Color.R, resultEnumerator.Current.Color.R); - Assert.Equal(templateDefinitionListEnumerator.Current.Color.G, resultEnumerator.Current.Color.G); - Assert.Equal(templateDefinitionListEnumerator.Current.Color.B, resultEnumerator.Current.Color.B); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/TemplateDefinitions"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetTemplateDefinitionsAsync_ReturnErrorStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - var statusCode = HttpStatusCode.Unauthorized; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = statusCode, - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var response = await Assert.ThrowsAsync(async () => await client.TemplateDefinitionsClient.GetTemplateDefinitionsAsync(repoId).ConfigureAwait(false)).ConfigureAwait(false); - - // ASSERT - Assert.Equal((int)statusCode, response.StatusCode); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/TemplateDefinitions"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - ), - ItExpr.IsAny() - ); - } - - [Fact] - public async Task GetTemplateDefinitionsAsync_WithPreferHeader_WithQueryParameters_ReturnSuccessfulStatusCode() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - string preferHeaderValue = "maxpagesize=1"; - string selectQueryParameter = "description"; - string orderbyQueryParameter = "name"; - int topQueryParameter = 1; - int skipQueryParameter = 1; - bool countQueryParameter = true; - ODataValueOfIListOfWTemplateInfo templateDefinitionList = new ODataValueOfIListOfWTemplateInfo() - { - Value = new List() - { - new WTemplateInfo() - { - Id = 1, - Name = "Template1", - Description = "First Template Description", - FieldCount = 2, - Color = new LFColor() - { - A = 255, - R = 255, - G = 255, - B = 255 - } - } - } - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(templateDefinitionList)), - }) - .Verifiable(); - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.TemplateDefinitionsClient.GetTemplateDefinitionsAsync(repoId, prefer: preferHeaderValue, - select: selectQueryParameter, orderby: orderbyQueryParameter, top: topQueryParameter, - skip: skipQueryParameter, count: countQueryParameter).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(templateDefinitionList.Value.Count, result.Value.Count); - var templateDefinitionListEnumerator = templateDefinitionList.Value.GetEnumerator(); - var resultEnumerator = result.Value.GetEnumerator(); - while (templateDefinitionListEnumerator.MoveNext() && resultEnumerator.MoveNext()) - { - Assert.Equal(templateDefinitionListEnumerator.Current.Id, resultEnumerator.Current.Id); - Assert.Equal(templateDefinitionListEnumerator.Current.Name, resultEnumerator.Current.Name); - Assert.Equal(templateDefinitionListEnumerator.Current.Description, resultEnumerator.Current.Description); - Assert.Equal(templateDefinitionListEnumerator.Current.FieldCount, resultEnumerator.Current.FieldCount); - Assert.Equal(templateDefinitionListEnumerator.Current.Color.A, resultEnumerator.Current.Color.A); - Assert.Equal(templateDefinitionListEnumerator.Current.Color.R, resultEnumerator.Current.Color.R); - Assert.Equal(templateDefinitionListEnumerator.Current.Color.G, resultEnumerator.Current.Color.G); - Assert.Equal(templateDefinitionListEnumerator.Current.Color.B, resultEnumerator.Current.Color.B); - } - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/TemplateDefinitions?" + - $"%24select={selectQueryParameter}&%24orderby={orderbyQueryParameter}&%24top={topQueryParameter}&" + - $"%24skip={skipQueryParameter}&%24count={countQueryParameter.ToString().ToLower()}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - && req.Headers.Contains("Prefer") // and Prefer header with maxpagesize value - && req.Headers.GetValues("Prefer").FirstOrDefault() == preferHeaderValue - ), - ItExpr.IsAny() - ); - } - } -} From 06324abf9e8350bcf2ffd186c3bb3d67f9a3f355 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Fri, 15 Sep 2023 11:17:57 -0400 Subject: [PATCH 87/93] Remove tests since related class no longer exists --- tests/unit/Custom/CreateEntryResultTest.cs | 210 --------------------- 1 file changed, 210 deletions(-) delete mode 100644 tests/unit/Custom/CreateEntryResultTest.cs diff --git a/tests/unit/Custom/CreateEntryResultTest.cs b/tests/unit/Custom/CreateEntryResultTest.cs deleted file mode 100644 index 0c566d53..00000000 --- a/tests/unit/Custom/CreateEntryResultTest.cs +++ /dev/null @@ -1,210 +0,0 @@ -using System.Collections.Generic; -using Xunit; - -namespace Laserfiche.Repository.Api.Client.Test.Custom -{ - public class CreateEntryResultTest - { - [Fact] - public void GetSummary_AllOperationsHaveErrorMessages() - { - int entryId = 123; - string entryCreateErrorMessage = "Error creating entry."; - string setEdocErrorMessage = "Error setting edoc."; - string setTemplateErrorMessage = "Error setting template."; - string setFieldsErrorMessage1 = "Error setting field1."; - string setTagsErrorMessage = "Error setting tag."; - string setLinksErrorMessage = "Error setting link."; - CreateEntryResult createEntryResult = new CreateEntryResult() - { - Operations = new CreateEntryOperations() - { - EntryCreate = new EntryCreate() - { - EntryId = entryId, - Exceptions = new List() - { - new APIServerException() { Message = entryCreateErrorMessage } - } - }, - SetEdoc = new SetEdoc() - { - Exceptions = new List() - { - new APIServerException() { Message = setEdocErrorMessage } - } - }, - SetTemplate = new SetTemplate() - { - Exceptions = new List() - { - new APIServerException() { Message = setTemplateErrorMessage } - } - }, - SetFields = new SetFields() - { - Exceptions = new List() - { - new APIServerException() { Message = setFieldsErrorMessage1 } - } - }, - SetTags = new SetTags() - { - Exceptions = new List() - { - new APIServerException() { Message = setTagsErrorMessage } - } - }, - SetLinks = new SetLinks() - { - Exceptions = new List() - { - new APIServerException() { Message = setLinksErrorMessage } - } - } - } - }; - - string result = createEntryResult.GetSummary(); - - var errorMessages = new string[] { entryCreateErrorMessage, setEdocErrorMessage, setTemplateErrorMessage, - setFieldsErrorMessage1, setTagsErrorMessage, setLinksErrorMessage }; - string expectedMessage = $"{nameof(createEntryResult.Operations.EntryCreate.EntryId)}={entryId}. " + string.Join(" ", errorMessages); - Assert.Equal(expectedMessage, result); - } - - [Fact] - public void GetSummary_OperationHasMultipleErrorMessages() - { - string setTemplateErrorMessage1 = "Error setting template1."; - string setTemplateErrorMessage2 = "Error setting template2."; - string setTagsErrorMessage1 = "Error setting tag1."; - string setTagsErrorMessage2 = "Error setting tag2."; - string setTagsErrorMessage3 = "Error setting tag3."; - CreateEntryResult createEntryResult = new CreateEntryResult() - { - Operations = new CreateEntryOperations() - { - EntryCreate = new EntryCreate(), - SetEdoc = new SetEdoc(), - SetTemplate = new SetTemplate() - { - Exceptions = new List() - { - new APIServerException() { Message = setTemplateErrorMessage1 }, - new APIServerException() { Message = setTemplateErrorMessage2 }, - } - }, - SetFields = new SetFields(), - SetTags = new SetTags() - { - Exceptions = new List() - { - new APIServerException() { Message = setTagsErrorMessage1 }, - new APIServerException() { Message = setTagsErrorMessage2 }, - new APIServerException() { Message = setTagsErrorMessage3 }, - } - }, - SetLinks = new SetLinks() - } - }; - - string result = createEntryResult.GetSummary(); - - var errorMessages = new string[] { setTemplateErrorMessage1, setTemplateErrorMessage2, - setTagsErrorMessage1, setTagsErrorMessage2, setTagsErrorMessage3 }; - string expectedMessage = string.Join(" ", errorMessages); - Assert.Equal(expectedMessage, result); - } - - [Fact] - public void GetSummary_NullOperations() - { - CreateEntryResult createEntryResult = new CreateEntryResult() { Operations = null }; - - string result = createEntryResult.GetSummary(); - - Assert.Equal(string.Empty, result); - } - - [Fact] - public void GetSummary_NullEntryOperations() - { - string setTemplateErrorMessage = "Error setting template."; - CreateEntryResult createEntryResult = new CreateEntryResult() - { - Operations = new CreateEntryOperations() - { - EntryCreate = null, - SetEdoc = null, - SetTemplate = new SetTemplate() - { - Exceptions = new List() - { - new APIServerException() { Message = setTemplateErrorMessage } - } - }, - SetFields = null, - SetTags = null, - SetLinks = null - } - }; - - string result = createEntryResult.GetSummary(); - - Assert.Equal(setTemplateErrorMessage, result); - } - - [Fact] - public void GetSummary_OperationExceptionWithoutMessage() - { - CreateEntryResult createEntryResult = new CreateEntryResult() - { - Operations = new CreateEntryOperations() - { - EntryCreate = null, - SetEdoc = null, - SetTemplate = new SetTemplate() - { - Exceptions = new List() - { - new APIServerException() - } - }, - SetFields = null, - SetTags = null, - SetLinks = null - } - }; - - string result = createEntryResult.GetSummary(); - - Assert.Equal(string.Empty, result); - } - - [Fact] - public void GetSummary_NoErrors() - { - int entryId = 123; - CreateEntryResult createEntryResult = new CreateEntryResult() - { - Operations = new CreateEntryOperations() - { - EntryCreate = new EntryCreate() - { - EntryId = entryId - }, - SetEdoc = new SetEdoc(), - SetTemplate = new SetTemplate(), - SetFields = new SetFields(), - SetTags = new SetTags(), - SetLinks = new SetLinks() - } - }; - - string result = createEntryResult.GetSummary(); - - Assert.Equal($"{nameof(createEntryResult.Operations.EntryCreate.EntryId)}={entryId}.", result); - } - } -} From 20c3a21f900d4d10e022c5857b18a1fcdccf7e52 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Fri, 15 Sep 2023 11:19:05 -0400 Subject: [PATCH 88/93] Again, let's no to test auto-generated implementation --- ...LaserficheRepositoryApiClientCustomTest.cs | 79 ------------------- 1 file changed, 79 deletions(-) diff --git a/tests/unit/Custom/LaserficheRepositoryApiClientCustomTest.cs b/tests/unit/Custom/LaserficheRepositoryApiClientCustomTest.cs index f854239d..320d7a7a 100644 --- a/tests/unit/Custom/LaserficheRepositoryApiClientCustomTest.cs +++ b/tests/unit/Custom/LaserficheRepositoryApiClientCustomTest.cs @@ -34,85 +34,6 @@ public void GetEntryAsync_InvalidUri() Assert.ThrowsAsync(() => client.EntriesClient.GetEntryAsync(uriString)); } - - [Fact] - public async Task GetEntryAsync_Return200() - { - // ARRANGE - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - Entry entry = new Folder() - { - Id = 10, - Name = "EntryName", - ParentId = 1, - FullPath = "/EntryName", - FolderPath = "/EntryName", - Creator = "Creator", - CreationTime = DateTimeOffset.Now, - LastModifiedTime = DateTimeOffset.Now, - EntryType = EntryType.Folder, - TemplateName = "Template", - TemplateId = 2, - VolumeName = "Volume" - }; - string uriString = $"{baseAddress}v1/Repositories/{repoId}/Entries/{entry.Id}?$select=1"; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(entry)), - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - - // ACT - var result = await client.EntriesClient.GetEntryAsync(uriString).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(entry.Id, result.Id); - Assert.Equal(entry.Name, result.Name); - Assert.Equal(entry.ParentId, result.ParentId); - Assert.Equal(entry.FullPath, result.FullPath); - Assert.Equal(entry.FolderPath, result.FolderPath); - Assert.Equal(entry.Creator, result.Creator); - Assert.Equal(entry.CreationTime, result.CreationTime); - Assert.Equal(entry.LastModifiedTime, result.LastModifiedTime); - Assert.Equal(entry.EntryType, result.EntryType); - Assert.Equal(entry.TemplateName, result.TemplateName); - Assert.Equal(entry.TemplateId, result.TemplateId); - Assert.Equal(entry.VolumeName, result.VolumeName); - Assert.Equal(typeof(Folder), result.GetType()); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && HttpUtility.UrlDecode(req.RequestUri.ToString()).Equals(uriString) // to this uri - ), - ItExpr.IsAny() - ); - } #endregion #region SetDefaultHeaders From 6295858a8ddb06adc2eb554dc1e9e2ea4530bbe0 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Fri, 15 Sep 2023 11:19:36 -0400 Subject: [PATCH 89/93] Remove unused import --- tests/unit/Custom/LaserficheRepositoryApiClientCustomTest.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/unit/Custom/LaserficheRepositoryApiClientCustomTest.cs b/tests/unit/Custom/LaserficheRepositoryApiClientCustomTest.cs index 320d7a7a..4050b2c1 100644 --- a/tests/unit/Custom/LaserficheRepositoryApiClientCustomTest.cs +++ b/tests/unit/Custom/LaserficheRepositoryApiClientCustomTest.cs @@ -7,7 +7,6 @@ using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; -using System.Web; using Xunit; namespace Laserfiche.Repository.Api.Client.Test.Custom From bea808b03e04fb0f09ff4be9d6ae718a93357143 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Fri, 15 Sep 2023 11:21:03 -0400 Subject: [PATCH 90/93] Remove tests since CreateEntryResult no longer exists --- .../unit/Custom/ApiExceptionExtensionsTest.cs | 105 ------------------ 1 file changed, 105 deletions(-) diff --git a/tests/unit/Custom/ApiExceptionExtensionsTest.cs b/tests/unit/Custom/ApiExceptionExtensionsTest.cs index b96aadab..6cd41231 100644 --- a/tests/unit/Custom/ApiExceptionExtensionsTest.cs +++ b/tests/unit/Custom/ApiExceptionExtensionsTest.cs @@ -114,110 +114,5 @@ public void Create_WithResponseString_ResponseStringIsProblemDetails_ExceptionHa AssertApiExceptionAreEqual(expectedException, actualException); } - - [Fact] - public void Create_WithCreateEntryResult_ExceptionHasMinimalProblemDetailsWithCreateEntryResult() - { - int statusCode = 400; - string operationId = "123456789"; - int entryId = 123; - string setTemplateErrorMessage = "Error setting template."; - string setFieldsErrorMessage1 = "Error setting field1."; - string setFieldsErrorMessage2 = "Error setting field2."; - string setTagsErrorMessage = "Error setting tag."; - string setLinksErrorMessage = "Error setting link."; - var headers = new Dictionary>() - { - [OPERATION_ID_HEADER] = new List() { operationId } - }; - CreateEntryResult createEntryResult = new CreateEntryResult() - { - Operations = new CreateEntryOperations() - { - EntryCreate = new EntryCreate() { EntryId = entryId }, - SetEdoc = new SetEdoc(), - SetTemplate = new SetTemplate() - { - Exceptions = new List() - { - new APIServerException() { Message = setTemplateErrorMessage } - } - }, - SetFields = new SetFields() - { - Exceptions = new List() - { - new APIServerException() { Message = setFieldsErrorMessage1 }, - new APIServerException() { Message = setFieldsErrorMessage2 }, - } - }, - SetTags = new SetTags() - { - Exceptions = new List() - { - new APIServerException() { Message = setTagsErrorMessage } - } - }, - SetLinks = new SetLinks() - { - Exceptions = new List() - { - new APIServerException() { Message = setLinksErrorMessage } - } - } - } - }; - Exception innerException = new Exception("An error occurred."); - - ApiException exception = ApiExceptionExtensions.Create(statusCode, headers, createEntryResult, innerException); - - var errorMessages = new string[] { setTemplateErrorMessage, setFieldsErrorMessage1, setFieldsErrorMessage2, setTagsErrorMessage, setLinksErrorMessage }; - string expectedMessage = $"{nameof(createEntryResult.Operations.EntryCreate.EntryId)}={entryId}. " + string.Join(" ", errorMessages); - Assert.Equal(expectedMessage, exception.ProblemDetails.Title); - Assert.Equal(statusCode, exception.ProblemDetails.Status); - Assert.Equal(operationId, exception.ProblemDetails.OperationId); - Assert.Equal(1, exception.ProblemDetails.Extensions.Count); - Assert.Equal(createEntryResult, exception.ProblemDetails.Extensions[typeof(CreateEntryResult).Name]); - Assert.Equal(exception.ProblemDetails.Status, exception.StatusCode); - Assert.Equal(exception.ProblemDetails.Title, exception.Message); - Assert.Equal(headers, exception.Headers); - Assert.Equal(innerException, exception.InnerException); - Assert.Null(exception.ProblemDetails.Type); - Assert.Null(exception.ProblemDetails.Detail); - Assert.Null(exception.ProblemDetails.Instance); - Assert.Equal(default, exception.ProblemDetails.ErrorCode); - Assert.Null(exception.ProblemDetails.ErrorSource); - Assert.Null(exception.ProblemDetails.TraceId); - } - - [Fact] - public void Create_WithNullCreateEntryResult_ExceptionHasMinimalProblemDetails() - { - int statusCode = 400; - string operationId = "123456789"; - var headers = new Dictionary>() - { - [OPERATION_ID_HEADER] = new List() { operationId } - }; - CreateEntryResult createEntryResult = null; - Exception innerException = new Exception("An error occurred."); - - ApiException exception = ApiExceptionExtensions.Create(statusCode, headers, createEntryResult, innerException); - - Assert.Equal($"HTTP status code {statusCode}.", exception.ProblemDetails.Title); - Assert.Equal(statusCode, exception.ProblemDetails.Status); - Assert.Equal(operationId, exception.ProblemDetails.OperationId); - Assert.Equal(0, exception.ProblemDetails.Extensions.Count); - Assert.Equal(exception.ProblemDetails.Status, exception.StatusCode); - Assert.Equal(exception.ProblemDetails.Title, exception.Message); - Assert.Equal(headers, exception.Headers); - Assert.Equal(innerException, exception.InnerException); - Assert.Null(exception.ProblemDetails.Type); - Assert.Null(exception.ProblemDetails.Detail); - Assert.Null(exception.ProblemDetails.Instance); - Assert.Equal(default, exception.ProblemDetails.ErrorCode); - Assert.Null(exception.ProblemDetails.ErrorSource); - Assert.Null(exception.ProblemDetails.TraceId); - } } } From d38da1d94ad19da0d81631876d44bb66c60381a1 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Fri, 15 Sep 2023 11:46:20 -0400 Subject: [PATCH 91/93] Remove the test since it's testing .NET HTTP client --- ...LaserficheRepositoryApiClientCustomTest.cs | 77 ------------------- 1 file changed, 77 deletions(-) diff --git a/tests/unit/Custom/LaserficheRepositoryApiClientCustomTest.cs b/tests/unit/Custom/LaserficheRepositoryApiClientCustomTest.cs index 4050b2c1..ddd805b3 100644 --- a/tests/unit/Custom/LaserficheRepositoryApiClientCustomTest.cs +++ b/tests/unit/Custom/LaserficheRepositoryApiClientCustomTest.cs @@ -34,82 +34,5 @@ public void GetEntryAsync_InvalidUri() Assert.ThrowsAsync(() => client.EntriesClient.GetEntryAsync(uriString)); } #endregion - - #region SetDefaultHeaders - - [Fact] - public async Task SetDefaultHeaders_DefaultHeadersInRequest() - { - // ARRANGE - string acceptLanguageHeaderValue = "fr-FR"; - string baseAddress = "http://api.laserfiche.com/"; - string repoId = "repoId"; - Entry entry = new Folder() - { - Id = 10, - Name = "EntryName", - ParentId = 1, - FullPath = "/EntryName", - FolderPath = "/EntryName", - Creator = "Creator", - CreationTime = DateTimeOffset.Now, - LastModifiedTime = DateTimeOffset.Now, - EntryType = EntryType.Folder, - TemplateName = "Template", - TemplateId = 2, - VolumeName = "Volume" - }; - - var handlerMock = new Mock(MockBehavior.Strict); - handlerMock - .Protected() - // Setup the PROTECTED method to mock - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - // prepare the expected response of the mocked http call - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(JsonConvert.SerializeObject(entry)), - }) - .Verifiable(); - - - // use real http client with mocked handler here - var httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri(baseAddress), - }; - - var client = new RepositoryApiClient(httpClient); - client.DefaultRequestHeaders.AcceptLanguage.Add(new StringWithQualityHeaderValue(acceptLanguageHeaderValue)); - - // ACT - var result = await client.EntriesClient.GetEntryAsync(repoId, entry.Id).ConfigureAwait(false); - - // ASSERT - Assert.NotNull(result); - Assert.Equal(entry.Id, result.Id); - Assert.Equal(entry.Name, result.Name); - - // also check the 'http' call was like we expected it - var expectedUri = new Uri(baseAddress + $"v1/Repositories/{repoId}/Entries/{entry.Id}"); - - handlerMock.Protected().Verify( - "SendAsync", - Times.Exactly(1), // we expected a single external request - ItExpr.Is(req => - req.Method == HttpMethod.Get // we expected a GET request - && req.RequestUri == expectedUri // to this uri - && req.Headers.AcceptLanguage.ToString() == acceptLanguageHeaderValue - ), - ItExpr.IsAny() - ); - } - - #endregion } } From 3321fffa4bd178f7cacf5876a00b8a7543a982b9 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Fri, 15 Sep 2023 16:50:51 -0400 Subject: [PATCH 92/93] Use the repository that other client libraries use --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 43c0bcaf..06dac7bc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,7 +39,7 @@ jobs: env: ACCESS_KEY: ${{ secrets.DEV_CA_PUBLIC_USE_INTEGRATION_TEST_ACCESS_KEY }} SERVICE_PRINCIPAL_KEY: ${{ secrets.DEV_CA_PUBLIC_USE_TESTOAUTHSERVICEPRINCIPAL_SERVICE_PRINCIPAL_KEY }} - REPOSITORY_ID: ${{ secrets.DEV_CA_PUBLIC_USE_REPOSITORY_ID_3 }} + REPOSITORY_ID: ${{ secrets.DEV_CA_PUBLIC_USE_REPOSITORY_ID_1 }} AUTHORIZATION_TYPE: ${{ secrets.AUTHORIZATION_TYPE }} TEST_HEADER: ${{ secrets.TEST_HEADER }} run: From 4032034bd1c986206955534439d065f123aea4e5 Mon Sep 17 00:00:00 2001 From: Jason Jia Date: Fri, 15 Sep 2023 16:56:05 -0400 Subject: [PATCH 93/93] Do not run on production --- .github/workflows/main.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 06dac7bc..d4b76846 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,18 +45,6 @@ jobs: run: dotnet test tests/integration/Laserfiche.Repository.Api.Client.IntegrationTest.csproj --no-build --verbosity normal --logger "trx;LogFileName=integration-test-results.trx" - - name: Run integration tests on API Server - continue-on-error: true - env: - REPOSITORY_ID: ${{ secrets.APISERVER_REPOSITORY_ID }} - APISERVER_USERNAME: ${{ secrets.APISERVER_USERNAME }} - APISERVER_PASSWORD: ${{ secrets.APISERVER_PASSWORD }} - APISERVER_REPOSITORY_API_BASE_URL: ${{ secrets.APISERVER_REPOSITORY_API_BASE_URL }} - AUTHORIZATION_TYPE: ${{ secrets.APISERVER_AUTHORIZATION_TYPE }} - TEST_HEADER: ${{ secrets.TEST_HEADER }} - run: - dotnet test tests/integration/Laserfiche.Repository.Api.Client.IntegrationTest.csproj --no-build --verbosity normal --logger "trx;LogFileName=integration-test-self-hosted-results.trx" - - name: Test Report uses: dorny/test-reporter@v1 if: success() || failure() # run this step even if previous step failed