Example #1
0
        public static async Task <byte[]> GetSIEAsync(FortnoxApiRequest request, SIETypes type, int?finnancialYear = null)
        {
            var route = $"{ApiEndpoints.SIE}/{(int) type}";

            if (finnancialYear.HasValue)
            {
                route = $"{route}?financialyear={finnancialYear.Value}";
            }

            var apiRequest = new FortnoxApiClientRequest <byte[]>(HttpMethod.Get, request.AccessToken, request.ClientSecret, route);

            return(await FortnoxAPIClient.CallAsync(apiRequest));
        }
Example #2
0
        // NOTE: Writes the SIE byte array to the specified file. If the file already exists it is overwritten.
        public static async Task GetAndSaveSIEToDiskAsync(FortnoxApiRequest request, SIETypes type, string filePath, int?finnancialYear = null)
        {
            var route = $"{ApiEndpoints.SIE}/{(int)type}";

            if (finnancialYear.HasValue)
            {
                route = $"{route}?financialyear={finnancialYear.Value}";
            }

            var apiRequest         = new FortnoxApiClientRequest <byte[]>(HttpMethod.Get, request.AccessToken, request.ClientSecret, route);
            var resultingByteArray = await FortnoxAPIClient.CallAsync(apiRequest);

            File.WriteAllBytes(filePath, resultingByteArray);
        }