Skip to main content

<a id=“SuperOffice_WebApi_Agents_ImportAgent”></a> Class ImportAgent

Namespace: SuperOffice.WebApi.Agents
Assembly: SuperOffice.WebApi.dll
This agent can be used to import data into the system

Inheritance

objectAgentBaseImportAgent

Implements

IImportAgent, IAgentBase, IDisposable

Inherited Members

AgentBase._json, AgentBase._binary, AgentBase._config, AgentBase._client, AgentBase._disposeClient, AgentBase.Merge(RequestOptions), AgentBase.BuildRequestFromObject(HttpMethod, string, object, WebApiOptions, string), AgentBase.BuildRequestFromStream(HttpMethod, string, Stream, WebApiOptions, string), AgentBase.BuildRequestFromObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string), AgentBase.ParseAuthorization(IAuthorization), AgentBase.CancelRequest(), AgentBase.SendRequestObject(HttpMethod, string, object, WebApiOptions, string), AgentBase.SendRequestObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string), AgentBase.SendRequest(HttpRequestMessage, RequestOptions), AgentBase.ThrowOnResponseErrorAsync(HttpRequestMessage, HttpResponseMessage), AgentBase.ParseResponse<T&gt;(HttpResponseMessage), AgentBase.Finally(RequestOptions), AgentBase.Dispose(), AgentBase.Configuration, AgentBase.Client, AgentBase.HasRunningRequest, AgentBase.ClientCancellationTokenSource, AgentBase.ProgressListener, AgentBase.UploadProgressListener, object.ToString(), object.Equals(object), object.Equals(object, object), object.ReferenceEquals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone()

Examples

<pre><code class=“lang-csharp”>using SuperOffice.WebApi; using SuperOffice.WebApi.Agents; var mySession = new WebApiOptions(“http://example.com/super/api”); mySession.Authorization = new AuthorizationUsernamePassword(“user”, “pass”); using (ImportAgent agent = new ImportAgent(mySession)) { // call methods on agent here… }</code></pre>

Constructors

<a id=“SuperOffice_WebApi_Agents_ImportAgent__ctor_System_Net_Http_HttpClient_”></a> ImportAgent(HttpClient)

Constructor: This agent can be used to import data into the system

Parameters

httpClient HttpClient Use this HTTP client instead of making own HttpClient instance.

<a id=“SuperOffice_WebApi_Agents_ImportAgent__ctor_SuperOffice_WebApi_WebApiOptions_System_Net_Http_HttpClient_”></a> ImportAgent(WebApiOptions, HttpClient)

Constructor: This agent can be used to import data into the system

Parameters

options WebApiOptions Base URL and authentication values. httpClient HttpClient Optional: Use this HTTP client instead of making a new one.

Methods

<a id=“SuperOffice_WebApi_Agents_ImportAgent_CreateDefaultImportLineAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultImportLineAsync(int, RequestOptions)

Create a new empty import row with x count of values

Parameters

countColumns int The count of values that will can be filled out requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ImportLine&gt; A new ImportLine

<a id=“SuperOffice_WebApi_Agents_ImportAgent_CreateErpImportDataAsync_SuperOffice_WebApi_Data_ArchiveRestrictionInfo___System_String___System_Int32_SuperOffice_WebApi_Data_ErpActorType_SuperOffice_WebApi_RequestOptions_”></a> CreateErpImportDataAsync(ArchiveRestrictionInfo[], string[], int, ErpActorType, RequestOptions)

Populates the ImportLines and columnDefs basedfrom erp system

Parameters

restriction ArchiveRestrictionInfo[] Archive restrictions. columns string[] Columns. connectionId int Connection id for Erp system erpActorType ErpActorType Erp Actor type requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ImportErpData&gt; The ImportLines and ColumnDefs

<a id=“SuperOffice_WebApi_Agents_ImportAgent_PreviewImportAsync_SuperOffice_WebApi_Data_ImportLine___System_String___System_String_System_String_SuperOffice_WebApi_RequestOptions_”></a> PreviewImportAsync(ImportLine[], string[], string, string, RequestOptions)

Preview the import

Parameters

importLines ImportLine[] The rows that will be manipulated and according to Import rules columnDefinition string[] An array of the columndefinitions, like firstname, lastname, … culture string The current culture used in the import. Used to match language specific strings context string Optional context for the import. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ImportLine[]&gt; An array of the the rows that can be imported, manipulated according to Import rules given

<a id=“SuperOffice_WebApi_Agents_ImportAgent_SaveImportAsync_SuperOffice_WebApi_Data_ImportLine___System_String___System_Boolean_System_String_System_String_SuperOffice_WebApi_RequestOptions_”></a> SaveImportAsync(ImportLine[], string[], bool, string, string, RequestOptions)

Do the actual import

Parameters

importLines ImportLine[] The rows that will be imported columnDefinition string[] An array of the columndefinitions, like firstname, lastname, … createSelection bool true if a selection of the imported entities shall be made culture string The current culture used in the import. Used to match language specific strings context string Optional context for the import. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int[]&gt; First part: the id of the selection created after the import, 0 if no selection is created. Second part: The number of rows actually imported