示例#1
0
        /// <summary>
        /// adds a fixed asset type Adds an fixed asset type to the system
        /// </summary>
        /// <exception cref="Xero.NetStandard.OAuth2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="xeroTenantId">Xero identifier for Tenant</param>
        /// <param name="assetType">Asset type to add (optional)</param>
        /// <returns>Task of ApiResponse (AssetType)</returns>
        public async System.Threading.Tasks.Task <Xero.NetStandard.OAuth2.Client.ApiResponse <AssetType> > CreateAssetTypeAsyncWithHttpInfo(string accessToken, string xeroTenantId, AssetType assetType = null)
        {
            // verify the required parameter 'xeroTenantId' is set
            if (xeroTenantId == null)
            {
                throw new Xero.NetStandard.OAuth2.Client.ApiException(400, "Missing required parameter 'xeroTenantId' when calling AssetApi->CreateAssetType");
            }


            Xero.NetStandard.OAuth2.Client.RequestOptions requestOptions = new Xero.NetStandard.OAuth2.Client.RequestOptions();

            String[] @contentTypes = new String[] {
                "application/json"
            };

            // to determine the Accept header
            String[] @accepts = new String[] {
                "application/json"
            };

            foreach (var cType in @contentTypes)
            {
                requestOptions.HeaderParameters.Add("Content-Type", cType);
            }

            foreach (var accept in @accepts)
            {
                requestOptions.HeaderParameters.Add("Accept", accept);
            }

            if (xeroTenantId != null)
            {
                requestOptions.HeaderParameters.Add("xero-tenant-id", Xero.NetStandard.OAuth2.Client.ClientUtils.ParameterToString(xeroTenantId)); // header parameter
            }
            requestOptions.Data = assetType;

            // authentication (OAuth2) required
            // oauth required
            if (!String.IsNullOrEmpty(accessToken))
            {
                requestOptions.HeaderParameters.Add("Authorization", "Bearer " + accessToken);
            }
            // make the HTTP request



            var response = await this.AsynchronousClient.PostAsync <AssetType>("/AssetTypes", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("CreateAssetType", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }
示例#2
0
        /// <summary>
        /// Allows you to retrieve the connections for this user Override the base server url that include version
        /// </summary>
        /// <exception cref="Xero.NetStandard.OAuth2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authEventId">Filter by authEventId (optional)</param>
        /// <returns>Task of ApiResponse (List&lt;Connection&gt;)</returns>
        public async System.Threading.Tasks.Task <Xero.NetStandard.OAuth2.Client.ApiResponse <List <Connection> > > GetConnectionsAsyncWithHttpInfo(string accessToken, Guid?authEventId = null)
        {
            Xero.NetStandard.OAuth2.Client.RequestOptions requestOptions = new Xero.NetStandard.OAuth2.Client.RequestOptions();

            String[] @contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] @accepts = new String[] {
                "application/json"
            };

            foreach (var cType in @contentTypes)
            {
                requestOptions.HeaderParameters.Add("Content-Type", cType);
            }

            foreach (var accept in @accepts)
            {
                requestOptions.HeaderParameters.Add("Accept", accept);
            }


            if (authEventId != null)
            {
                foreach (var kvp in Xero.NetStandard.OAuth2.Client.ClientUtils.ParameterToMultiMap("", "authEventId", authEventId))
                {
                    foreach (var value in kvp.Value)
                    {
                        requestOptions.QueryParameters.Add(kvp.Key, value);
                    }
                }
            }

            // authentication (OAuth2) required
            // oauth required
            if (!String.IsNullOrEmpty(accessToken))
            {
                requestOptions.HeaderParameters.Add("Authorization", "Bearer " + accessToken);
            }
            // make the HTTP request



            var response = await this.AsynchronousClient.GetAsync <List <Connection> >("/connections", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("GetConnections", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }
示例#3
0
        /// <summary>
        /// Retrieves a subscription for a given subscriptionId
        /// </summary>
        /// <exception cref="Xero.NetStandard.OAuth2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accessToken">Xero API OAuth 2.0 accessToken</param>
        /// <param name="subscriptionId">Unique identifier for Subscription object</param>
        /// <returns>Task of ApiResponse (Subscription)</returns>
        public async System.Threading.Tasks.Task <Xero.NetStandard.OAuth2.Client.ApiResponse <Subscription> > GetSubscriptionAsyncWithHttpInfo(string accessToken, Guid subscriptionId)
        {
            // verify the required parameter 'subscriptionId' is set
            if (subscriptionId == null)
            {
                throw new Xero.NetStandard.OAuth2.Client.ApiException(400, "Missing required parameter 'subscriptionId' when calling AppStoreApi->GetSubscription");
            }


            Xero.NetStandard.OAuth2.Client.RequestOptions requestOptions = new Xero.NetStandard.OAuth2.Client.RequestOptions();

            String[] @contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] @accepts = new String[] {
                "application/json"
            };

            foreach (var cType in @contentTypes)
            {
                requestOptions.HeaderParameters.Add("Content-Type", cType);
            }

            foreach (var accept in @accepts)
            {
                requestOptions.HeaderParameters.Add("Accept", accept);
            }

            if (subscriptionId != null)
            {
                requestOptions.PathParameters.Add("subscriptionId", Xero.NetStandard.OAuth2.Client.ClientUtils.ParameterToString(subscriptionId)); // path parameter
            }
            // authentication (OAuth2) required
            // oauth required
            if (!String.IsNullOrEmpty(accessToken))
            {
                requestOptions.HeaderParameters.Add("Authorization", "Bearer " + accessToken);
            }
            // make the HTTP request



            var response = await this.AsynchronousClient.GetAsync <Subscription>("/subscriptions/{subscriptionId}", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("GetSubscription", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }
示例#4
0
        /// <summary>
        /// searches fixed asset By passing in the appropriate options, you can search for available fixed asset in the system
        /// </summary>
        /// <exception cref="Xero.NetStandard.OAuth2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="xeroTenantId">Xero identifier for Tenant</param>
        /// <param name="status">Required when retrieving a collection of assets. See Asset Status Codes</param>
        /// <param name="page">Results are paged. This specifies which page of the results to return. The default page is 1. (optional)</param>
        /// <param name="pageSize">The number of records returned per page. By default the number of records returned is 10. (optional)</param>
        /// <param name="orderBy">Requests can be ordered by AssetType, AssetName, AssetNumber, PurchaseDate and PurchasePrice. If the asset status is DISPOSED it also allows DisposalDate and DisposalPrice. (optional)</param>
        /// <param name="sortDirection">ASC or DESC (optional)</param>
        /// <param name="filterBy">A string that can be used to filter the list to only return assets containing the text. Checks it against the AssetName, AssetNumber, Description and AssetTypeName fields. (optional)</param>
        /// <returns>Task of ApiResponse (Assets)</returns>
        public async System.Threading.Tasks.Task <Xero.NetStandard.OAuth2.Client.ApiResponse <Assets> > GetAssetsAsyncWithHttpInfo(string accessToken, string xeroTenantId, AssetStatusQueryParam status, int?page = null, int?pageSize = null, string orderBy = null, string sortDirection = null, string filterBy = null)
        {
            // verify the required parameter 'xeroTenantId' is set
            if (xeroTenantId == null)
            {
                throw new Xero.NetStandard.OAuth2.Client.ApiException(400, "Missing required parameter 'xeroTenantId' when calling AssetApi->GetAssets");
            }

            // verify the required parameter 'status' is set
            if (status == null)
            {
                throw new Xero.NetStandard.OAuth2.Client.ApiException(400, "Missing required parameter 'status' when calling AssetApi->GetAssets");
            }


            Xero.NetStandard.OAuth2.Client.RequestOptions requestOptions = new Xero.NetStandard.OAuth2.Client.RequestOptions();

            String[] @contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] @accepts = new String[] {
                "application/json"
            };

            foreach (var cType in @contentTypes)
            {
                requestOptions.HeaderParameters.Add("Content-Type", cType);
            }

            foreach (var accept in @accepts)
            {
                requestOptions.HeaderParameters.Add("Accept", accept);
            }


            if (status != null)
            {
                foreach (var kvp in Xero.NetStandard.OAuth2.Client.ClientUtils.ParameterToMultiMap("", "status", status))
                {
                    foreach (var value in kvp.Value)
                    {
                        requestOptions.QueryParameters.Add(kvp.Key, value);
                    }
                }
            }

            if (page != null)
            {
                foreach (var kvp in Xero.NetStandard.OAuth2.Client.ClientUtils.ParameterToMultiMap("", "page", page))
                {
                    foreach (var value in kvp.Value)
                    {
                        requestOptions.QueryParameters.Add(kvp.Key, value);
                    }
                }
            }

            if (pageSize != null)
            {
                foreach (var kvp in Xero.NetStandard.OAuth2.Client.ClientUtils.ParameterToMultiMap("", "pageSize", pageSize))
                {
                    foreach (var value in kvp.Value)
                    {
                        requestOptions.QueryParameters.Add(kvp.Key, value);
                    }
                }
            }

            if (orderBy != null)
            {
                foreach (var kvp in Xero.NetStandard.OAuth2.Client.ClientUtils.ParameterToMultiMap("", "orderBy", orderBy))
                {
                    foreach (var value in kvp.Value)
                    {
                        requestOptions.QueryParameters.Add(kvp.Key, value);
                    }
                }
            }

            if (sortDirection != null)
            {
                foreach (var kvp in Xero.NetStandard.OAuth2.Client.ClientUtils.ParameterToMultiMap("", "sortDirection", sortDirection))
                {
                    foreach (var value in kvp.Value)
                    {
                        requestOptions.QueryParameters.Add(kvp.Key, value);
                    }
                }
            }

            if (filterBy != null)
            {
                foreach (var kvp in Xero.NetStandard.OAuth2.Client.ClientUtils.ParameterToMultiMap("", "filterBy", filterBy))
                {
                    foreach (var value in kvp.Value)
                    {
                        requestOptions.QueryParameters.Add(kvp.Key, value);
                    }
                }
            }
            if (xeroTenantId != null)
            {
                requestOptions.HeaderParameters.Add("xero-tenant-id", Xero.NetStandard.OAuth2.Client.ClientUtils.ParameterToString(xeroTenantId)); // header parameter
            }
            // authentication (OAuth2) required
            // oauth required
            if (!String.IsNullOrEmpty(accessToken))
            {
                requestOptions.HeaderParameters.Add("Authorization", "Bearer " + accessToken);
            }
            // make the HTTP request



            var response = await this.AsynchronousClient.GetAsync <Assets>("/Assets", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("GetAssets", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }