text:
.class Lcom/android/internal/policy/impl/sec/ClockWidget$Clock$2;
.super Ljava/lang/Object;
.source "ClockWidget.java"

# interfaces
.implements Landroid/content/DialogInterface$OnClickListener;

# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/android/internal/policy/impl/sec/ClockWidget$Clock;->onResume()V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Lcom/android/internal/policy/impl/sec/ClockWidget$Clock;

# direct methods
.method constructor <init>(Lcom/android/internal/policy/impl/sec/ClockWidget$Clock;)V
    .locals 0
    .parameter

    .prologue
    .line 1051
    iput-object p1, p0, Lcom/android/internal/policy/impl/sec/ClockWidget$Clock$2;->this$0:Lcom/android/internal/policy/impl/sec/ClockWidget$Clock;

    invoke-direct/range {p0 .. p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public onClick(Landroid/content/DialogInterface;I)V
    .locals 3
    .parameter "arg0"
    .parameter "arg1"

    .prologue
    .line 1055
    iget-object v0, p0, Lcom/android/internal/policy/impl/sec/ClockWidget$Clock$2;->this$0:Lcom/android/internal/policy/impl/sec/ClockWidget$Clock;

    #getter for: Lcom/android/internal/policy/impl/sec/ClockWidget$Clock;->mContext:Landroid/content/Context;
    invoke-static {v0}, Lcom/android/internal/policy/impl/sec/ClockWidget$Clock;->access$1800(Lcom/android/internal/policy/impl/sec/ClockWidget$Clock;)Landroid/content/Context;

    move-result-object v0

    invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    const-string v1, "dualclock_menu_settings"

    const/4 v2, 0x0

    invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    .line 1056
    invoke-static {}, Lcom/android/internal/policy/impl/sec/ClockWidget;->access$1700()Lcom/android/internal/policy/impl/KeyguardScreenCallback;

    move-result-object v0

    if-eqz v0, :cond_0

    invoke-static {}, Lcom/android/internal/policy/impl/sec/ClockWidget;->access$1700()Lcom/android/internal/policy/impl/KeyguardScreenCallback;

    move-result-object v0

    iget-object v1, p0, Lcom/android/internal/policy/impl/sec/ClockWidget$Clock$2;->this$0:Lcom/android/internal/policy/impl/sec/ClockWidget$Clock;

    #getter for: Lcom/android/internal/policy/impl/sec/ClockWidget$Clock;->mContext:Landroid/content/Context;
    invoke-static {v1}, Lcom/android/internal/policy/impl/sec/ClockWidget$Clock;->access$1900(Lcom/android/internal/policy/impl/sec/ClockWidget$Clock;)Landroid/content/Context;

    move-result-object v1

    invoke-virtual {v1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    invoke-virtual {v1}, Landroid/content/res/Resources;->getConfiguration()Landroid/content/res/Configuration;

    move-result-object v1

    invoke-interface {v0, v1}, Lcom/android/internal/policy/impl/KeyguardScreenCallback;->recreateMe(Landroid/content/res/Configuration;)V

    .line 1057
    :cond_0
    return-void
.end method


text:
rundeck_server_job 'test-job' do
  project 'project'
  api_token 'random_token'
  config(
    description: '',
    loglevel: 'INFO',
    sequence: {
      commands: [
        exec: 'a command',
      ],
    })
end

redpajama_set_name: RedPajamaGithub


text:
package com.leavessilent.mylibrary.utils;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/**
 * Created by Leavessilent on 2016/8/17.
 */
public class NetworkUtils {

    /**
     * 检查当前网络是否连接
     *
     * @param context
     * @return
     */
    public static boolean checkNetWork(Context context) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
        return networkInfo != null && networkInfo.isConnectedOrConnecting();
    }
}


text:
<?php
/**
 * IntegrationLogApi
 * PHP version 5
 *
 * @category Class
 * @package  ultracart\v2
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */

/**
 * UltraCart Rest API V2
 *
 * UltraCart REST API Version 2
 *
 * OpenAPI spec version: 2.0.0
 * Contact: support@ultracart.com
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 * Swagger Codegen version: 2.4.15-SNAPSHOT
 */

/**
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen
 * Do not edit the class manually.
 */

namespace ultracart\v2\api;

use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use ultracart\v2\ApiException;
use ultracart\v2\Configuration;
use ultracart\v2\HeaderSelector;
use ultracart\v2\ObjectSerializer;

/**
 * IntegrationLogApi Class Doc Comment
 *
 * @category Class
 * @package  ultracart\v2
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class IntegrationLogApi
{
    /**
     * @var ClientInterface
     */
    protected $client;

    /**
     * @var Configuration
     */
    protected $config;

    /**
     * @var HeaderSelector
     */
    protected $headerSelector;

    /**
     * @param ClientInterface $client
     * @param Configuration   $config
     * @param HeaderSelector  $selector
     */
    public function __construct(
        ClientInterface $client = null,
        Configuration $config = null,
        HeaderSelector $selector = null
    ) {
        $this->client = $client ?: new Client();
        $this->config = $config ?: new Configuration();
        $this->headerSelector = $selector ?: new HeaderSelector();
    }

    /**
     * @param string $simple_key api key
     * @param int $max_retry_seconds 0 to disable, else the maximum number of seconds to wait and automatically retry when rate limit is hit
     * @param string $verify passed to Guzzle to enable/disable ssl verify
     */
    public static function usingApiKey( $simple_key, $max_retry_seconds = 0, $verify = true) {
        $config = new Configuration();
        $config->setApiKey('x-ultracart-simple-key', $simple_key);
        $config->setMaxRetrySeconds($max_retry_seconds);

        $client = new Client(['verify' => $verify, 'debug' => false]);
        $headerSelector = new HeaderSelector(/* leave null for version tied to this sdk version */);
        $api = new IntegrationLogApi($client, $config, $headerSelector);
        return $api;
    }

    /**
     * @return Configuration
     */
    public function getConfig()
    {
        return $this->config;
    }

    /**
     * Operation getIntegrationLog
     *
     * Retrieve an integration log
     *
     * @param  string $pk pk (required)
     * @param  string $sk sk (required)
     *
     * @throws \ultracart\v2\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     * @return \ultracart\v2\models\IntegrationLogResponse
     */
    public function getIntegrationLog($pk, $sk)
    {
        list($response) = $this->getIntegrationLogWithHttpInfo($pk, $sk);
        return $response;
    }

    /**
     * Operation getIntegrationLogWithHttpInfo
     *
     * Retrieve an integration log
     *
     * @param  string $pk (required)
     * @param  string $sk (required)
     *
     * @throws \ultracart\v2\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     * @return array of \ultracart\v2\models\IntegrationLogResponse, HTTP status code, HTTP response headers (array of strings)
     */
    public function getIntegrationLogWithHttpInfo($pk, $sk)
    {
        return $this->getIntegrationLogWithHttpInfoRetry(true ,   $pk,   $sk);
    }

    /**
     * Operation getIntegrationLogWithHttpInfoRetry
     *
     * Retrieve an integration log
     *
     * @param boolean $retry should this method retry the call if a rate limit is triggered (required)
     * @param  string $pk (required)
     * @param  string $sk (required)
     *
     * @throws \ultracart\v2\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     * @return array of \ultracart\v2\models\IntegrationLogResponse, HTTP status code, HTTP response headers (array of strings)
     */
    public function getIntegrationLogWithHttpInfoRetry($retry ,  $pk,  $sk)
    {
        $returnType = '\ultracart\v2\models\IntegrationLogResponse';
        $request = $this->getIntegrationLogRequest($pk, $sk);

        try {
            $options = $this->createHttpClientOption();
            try {
                $response = $this->client->send($request, $options);
            } catch (RequestException $e) {

                if($e->getResponse()) {
                    $response = $e->getResponse();
                    $statusCode = $response->getStatusCode();
                    $retryAfter = 0;
                    $headers = $response->getHeaders();
                    if (array_key_exists('Retry-After', $headers)) {
                        $retryAfter = intval($headers['Retry-After'][0]);
                    }

                    if ($statusCode == 429 && $retry && $retryAfter > 0 && $retryAfter <= $this->config->getMaxRetrySeconds()) {
                        sleep($retryAfter);
                        return $this->getIntegrationLogWithHttpInfoRetry(false ,   $pk,   $sk);
                    }
                }

                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    $e->getCode(),
                    $e->getResponse() ? $e->getResponse()->getHeaders() : null,
                    $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
                );
            }

            $responseBody = $response->getBody();
            if ($returnType === '\SplFileObject') {
                $content = $responseBody; //stream goes to serializer
            } else {
                $content = $responseBody->getContents();
                if ($returnType !== 'string') {
                    $content = json_decode($content);
                }
            }

            return [
                ObjectSerializer::deserialize($content, $returnType, []),
                $response->getStatusCode(),
                $response->getHeaders()
            ];

        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\IntegrationLogResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 401:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 410:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 429:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 500:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
            }
            throw $e;
        }
    }

    /**
     * Operation getIntegrationLogAsync
     *
     * Retrieve an integration log
     *
     * @param  string $pk (required)
     * @param  string $sk (required)
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getIntegrationLogAsync($pk, $sk)
    {
        return $this->getIntegrationLogAsyncWithHttpInfo($pk, $sk)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }

    /**
     * Operation getIntegrationLogAsyncWithHttpInfo
     *
     * Retrieve an integration log
     *
     * @param  string $pk (required)
     * @param  string $sk (required)
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getIntegrationLogAsyncWithHttpInfo($pk, $sk)
    {
        $returnType = '\ultracart\v2\models\IntegrationLogResponse';
        $request = $this->getIntegrationLogRequest($pk, $sk);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    $responseBody = $response->getBody();
                    if ($returnType === '\SplFileObject') {
                        $content = $responseBody; //stream goes to serializer
                    } else {
                        $content = $responseBody->getContents();
                        if ($returnType !== 'string') {
                            $content = json_decode($content);
                        }
                    }

                    return [
                        ObjectSerializer::deserialize($content, $returnType, []),
                        $response->getStatusCode(),
                        $response->getHeaders()
                    ];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        $response->getBody()
                    );
                }
            );
    }

    /**
     * Create request for operation 'getIntegrationLog'
     *
     * @param  string $pk (required)
     * @param  string $sk (required)
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Psr7\Request
     */
    protected function getIntegrationLogRequest($pk, $sk)
    {
        // verify the required parameter 'pk' is set
        if ($pk === null || (is_array($pk) && count($pk) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $pk when calling getIntegrationLog'
            );
        }
        // verify the required parameter 'sk' is set
        if ($sk === null || (is_array($sk) && count($sk) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $sk when calling getIntegrationLog'
            );
        }

        $resourcePath = '/integration_log/query/{pk}/{sk}';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;

        // path params
        if ($pk !== null) {
            $resourcePath = str_replace(
                '{' . 'pk' . '}',
                ObjectSerializer::toPathValue($pk),
                $resourcePath
            );
        }
        // path params
        if ($sk !== null) {
            $resourcePath = str_replace(
                '{' . 'sk' . '}',
                ObjectSerializer::toPathValue($sk),
                $resourcePath
            );
        }

        // body params
        $_tempBody = null;

        if ($multipart) {
            $headers = $this->headerSelector->selectHeadersForMultipart(
                ['application/json']
            );
        } else {
            $headers = $this->headerSelector->selectHeaders(
                ['application/json'],
                ['application/json']
            );
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            // $_tempBody is the method argument, if present
            $httpBody = $_tempBody;

            if($headers['Content-Type'] === 'application/json') {
                // \stdClass has no __toString(), so we should encode it manually
                if ($httpBody instanceof \stdClass) {
                    $httpBody = \GuzzleHttp\json_encode($httpBody);
                }
                // array has no __toString(), so we should encode it manually
                if(is_array($httpBody)) {
                    $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
                }
            }
        } elseif (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];
                foreach ($formParams as $formParamName => $formParamValue) {
                    $multipartContents[] = [
                        'name' => $formParamName,
                        'contents' => $formParamValue
                    ];
                }
                // for HTTP post (form)
                $httpBody = new MultipartStream($multipartContents);

            } elseif ($headers['Content-Type'] === 'application/json') {
                $httpBody = \GuzzleHttp\json_encode($formParams);

            } else {
                // for HTTP post (form)
                $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
            }
        }

        // this endpoint requires OAuth (access token)
        if ($this->config->getAccessToken() !== null) {
            $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
        }
        // this endpoint requires API key authentication
        $apiKey = $this->config->getApiKeyWithPrefix('x-ultracart-simple-key');
        if ($apiKey !== null) {
            $headers['x-ultracart-simple-key'] = $apiKey;
        }

        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }

        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );

        $query = \GuzzleHttp\Psr7\build_query($queryParams);
        return new Request(
            'GET',
            $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }

    /**
     * Operation getIntegrationLogFile
     *
     * Retrieve an integration log file
     *
     * @param  string $pk pk (required)
     * @param  string $sk sk (required)
     * @param  string $uuid uuid (required)
     *
     * @throws \ultracart\v2\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     * @return \SplFileObject
     */
    public function getIntegrationLogFile($pk, $sk, $uuid)
    {
        list($response) = $this->getIntegrationLogFileWithHttpInfo($pk, $sk, $uuid);
        return $response;
    }

    /**
     * Operation getIntegrationLogFileWithHttpInfo
     *
     * Retrieve an integration log file
     *
     * @param  string $pk (required)
     * @param  string $sk (required)
     * @param  string $uuid (required)
     *
     * @throws \ultracart\v2\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
     */
    public function getIntegrationLogFileWithHttpInfo($pk, $sk, $uuid)
    {
        return $this->getIntegrationLogFileWithHttpInfoRetry(true ,   $pk,   $sk,   $uuid);
    }

    /**
     * Operation getIntegrationLogFileWithHttpInfoRetry
     *
     * Retrieve an integration log file
     *
     * @param boolean $retry should this method retry the call if a rate limit is triggered (required)
     * @param  string $pk (required)
     * @param  string $sk (required)
     * @param  string $uuid (required)
     *
     * @throws \ultracart\v2\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
     */
    public function getIntegrationLogFileWithHttpInfoRetry($retry ,  $pk,  $sk,  $uuid)
    {
        $returnType = '\SplFileObject';
        $request = $this->getIntegrationLogFileRequest($pk, $sk, $uuid);

        try {
            $options = $this->createHttpClientOption();
            try {
                $response = $this->client->send($request, $options);
            } catch (RequestException $e) {

                if($e->getResponse()) {
                    $response = $e->getResponse();
                    $statusCode = $response->getStatusCode();
                    $retryAfter = 0;
                    $headers = $response->getHeaders();
                    if (array_key_exists('Retry-After', $headers)) {
                        $retryAfter = intval($headers['Retry-After'][0]);
                    }

                    if ($statusCode == 429 && $retry && $retryAfter > 0 && $retryAfter <= $this->config->getMaxRetrySeconds()) {
                        sleep($retryAfter);
                        return $this->getIntegrationLogFileWithHttpInfoRetry(false ,   $pk,   $sk,   $uuid);
                    }
                }

                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    $e->getCode(),
                    $e->getResponse() ? $e->getResponse()->getHeaders() : null,
                    $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
                );
            }

            $responseBody = $response->getBody();
            if ($returnType === '\SplFileObject') {
                $content = $responseBody; //stream goes to serializer
            } else {
                $content = $responseBody->getContents();
                if ($returnType !== 'string') {
                    $content = json_decode($content);
                }
            }

            return [
                ObjectSerializer::deserialize($content, $returnType, []),
                $response->getStatusCode(),
                $response->getHeaders()
            ];

        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\SplFileObject',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 401:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 410:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 429:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 500:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
            }
            throw $e;
        }
    }

    /**
     * Operation getIntegrationLogFileAsync
     *
     * Retrieve an integration log file
     *
     * @param  string $pk (required)
     * @param  string $sk (required)
     * @param  string $uuid (required)
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getIntegrationLogFileAsync($pk, $sk, $uuid)
    {
        return $this->getIntegrationLogFileAsyncWithHttpInfo($pk, $sk, $uuid)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }

    /**
     * Operation getIntegrationLogFileAsyncWithHttpInfo
     *
     * Retrieve an integration log file
     *
     * @param  string $pk (required)
     * @param  string $sk (required)
     * @param  string $uuid (required)
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getIntegrationLogFileAsyncWithHttpInfo($pk, $sk, $uuid)
    {
        $returnType = '\SplFileObject';
        $request = $this->getIntegrationLogFileRequest($pk, $sk, $uuid);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    $responseBody = $response->getBody();
                    if ($returnType === '\SplFileObject') {
                        $content = $responseBody; //stream goes to serializer
                    } else {
                        $content = $responseBody->getContents();
                        if ($returnType !== 'string') {
                            $content = json_decode($content);
                        }
                    }

                    return [
                        ObjectSerializer::deserialize($content, $returnType, []),
                        $response->getStatusCode(),
                        $response->getHeaders()
                    ];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        $response->getBody()
                    );
                }
            );
    }

    /**
     * Create request for operation 'getIntegrationLogFile'
     *
     * @param  string $pk (required)
     * @param  string $sk (required)
     * @param  string $uuid (required)
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Psr7\Request
     */
    protected function getIntegrationLogFileRequest($pk, $sk, $uuid)
    {
        // verify the required parameter 'pk' is set
        if ($pk === null || (is_array($pk) && count($pk) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $pk when calling getIntegrationLogFile'
            );
        }
        // verify the required parameter 'sk' is set
        if ($sk === null || (is_array($sk) && count($sk) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $sk when calling getIntegrationLogFile'
            );
        }
        // verify the required parameter 'uuid' is set
        if ($uuid === null || (is_array($uuid) && count($uuid) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $uuid when calling getIntegrationLogFile'
            );
        }

        $resourcePath = '/integration_log/query/{pk}/{sk}/{uuid}';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;

        // path params
        if ($pk !== null) {
            $resourcePath = str_replace(
                '{' . 'pk' . '}',
                ObjectSerializer::toPathValue($pk),
                $resourcePath
            );
        }
        // path params
        if ($sk !== null) {
            $resourcePath = str_replace(
                '{' . 'sk' . '}',
                ObjectSerializer::toPathValue($sk),
                $resourcePath
            );
        }
        // path params
        if ($uuid !== null) {
            $resourcePath = str_replace(
                '{' . 'uuid' . '}',
                ObjectSerializer::toPathValue($uuid),
                $resourcePath
            );
        }

        // body params
        $_tempBody = null;

        if ($multipart) {
            $headers = $this->headerSelector->selectHeadersForMultipart(
                ['application/octet-stream']
            );
        } else {
            $headers = $this->headerSelector->selectHeaders(
                ['application/octet-stream'],
                ['application/json']
            );
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            // $_tempBody is the method argument, if present
            $httpBody = $_tempBody;

            if($headers['Content-Type'] === 'application/json') {
                // \stdClass has no __toString(), so we should encode it manually
                if ($httpBody instanceof \stdClass) {
                    $httpBody = \GuzzleHttp\json_encode($httpBody);
                }
                // array has no __toString(), so we should encode it manually
                if(is_array($httpBody)) {
                    $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
                }
            }
        } elseif (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];
                foreach ($formParams as $formParamName => $formParamValue) {
                    $multipartContents[] = [
                        'name' => $formParamName,
                        'contents' => $formParamValue
                    ];
                }
                // for HTTP post (form)
                $httpBody = new MultipartStream($multipartContents);

            } elseif ($headers['Content-Type'] === 'application/json') {
                $httpBody = \GuzzleHttp\json_encode($formParams);

            } else {
                // for HTTP post (form)
                $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
            }
        }

        // this endpoint requires OAuth (access token)
        if ($this->config->getAccessToken() !== null) {
            $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
        }
        // this endpoint requires API key authentication
        $apiKey = $this->config->getApiKeyWithPrefix('x-ultracart-simple-key');
        if ($apiKey !== null) {
            $headers['x-ultracart-simple-key'] = $apiKey;
        }

        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }

        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );

        $query = \GuzzleHttp\Psr7\build_query($queryParams);
        return new Request(
            'GET',
            $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }

    /**
     * Operation getIntegrationLogFilePdf
     *
     * Retrieve an integration log file converted to PDF
     *
     * @param  string $pk pk (required)
     * @param  string $sk sk (required)
     * @param  string $uuid uuid (required)
     *
     * @throws \ultracart\v2\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     * @return \SplFileObject
     */
    public function getIntegrationLogFilePdf($pk, $sk, $uuid)
    {
        list($response) = $this->getIntegrationLogFilePdfWithHttpInfo($pk, $sk, $uuid);
        return $response;
    }

    /**
     * Operation getIntegrationLogFilePdfWithHttpInfo
     *
     * Retrieve an integration log file converted to PDF
     *
     * @param  string $pk (required)
     * @param  string $sk (required)
     * @param  string $uuid (required)
     *
     * @throws \ultracart\v2\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
     */
    public function getIntegrationLogFilePdfWithHttpInfo($pk, $sk, $uuid)
    {
        return $this->getIntegrationLogFilePdfWithHttpInfoRetry(true ,   $pk,   $sk,   $uuid);
    }

    /**
     * Operation getIntegrationLogFilePdfWithHttpInfoRetry
     *
     * Retrieve an integration log file converted to PDF
     *
     * @param boolean $retry should this method retry the call if a rate limit is triggered (required)
     * @param  string $pk (required)
     * @param  string $sk (required)
     * @param  string $uuid (required)
     *
     * @throws \ultracart\v2\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
     */
    public function getIntegrationLogFilePdfWithHttpInfoRetry($retry ,  $pk,  $sk,  $uuid)
    {
        $returnType = '\SplFileObject';
        $request = $this->getIntegrationLogFilePdfRequest($pk, $sk, $uuid);

        try {
            $options = $this->createHttpClientOption();
            try {
                $response = $this->client->send($request, $options);
            } catch (RequestException $e) {

                if($e->getResponse()) {
                    $response = $e->getResponse();
                    $statusCode = $response->getStatusCode();
                    $retryAfter = 0;
                    $headers = $response->getHeaders();
                    if (array_key_exists('Retry-After', $headers)) {
                        $retryAfter = intval($headers['Retry-After'][0]);
                    }

                    if ($statusCode == 429 && $retry && $retryAfter > 0 && $retryAfter <= $this->config->getMaxRetrySeconds()) {
                        sleep($retryAfter);
                        return $this->getIntegrationLogFilePdfWithHttpInfoRetry(false ,   $pk,   $sk,   $uuid);
                    }
                }

                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    $e->getCode(),
                    $e->getResponse() ? $e->getResponse()->getHeaders() : null,
                    $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
                );
            }

            $responseBody = $response->getBody();
            if ($returnType === '\SplFileObject') {
                $content = $responseBody; //stream goes to serializer
            } else {
                $content = $responseBody->getContents();
                if ($returnType !== 'string') {
                    $content = json_decode($content);
                }
            }

            return [
                ObjectSerializer::deserialize($content, $returnType, []),
                $response->getStatusCode(),
                $response->getHeaders()
            ];

        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\SplFileObject',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 401:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 410:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 429:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 500:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
            }
            throw $e;
        }
    }

    /**
     * Operation getIntegrationLogFilePdfAsync
     *
     * Retrieve an integration log file converted to PDF
     *
     * @param  string $pk (required)
     * @param  string $sk (required)
     * @param  string $uuid (required)
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getIntegrationLogFilePdfAsync($pk, $sk, $uuid)
    {
        return $this->getIntegrationLogFilePdfAsyncWithHttpInfo($pk, $sk, $uuid)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }

    /**
     * Operation getIntegrationLogFilePdfAsyncWithHttpInfo
     *
     * Retrieve an integration log file converted to PDF
     *
     * @param  string $pk (required)
     * @param  string $sk (required)
     * @param  string $uuid (required)
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getIntegrationLogFilePdfAsyncWithHttpInfo($pk, $sk, $uuid)
    {
        $returnType = '\SplFileObject';
        $request = $this->getIntegrationLogFilePdfRequest($pk, $sk, $uuid);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    $responseBody = $response->getBody();
                    if ($returnType === '\SplFileObject') {
                        $content = $responseBody; //stream goes to serializer
                    } else {
                        $content = $responseBody->getContents();
                        if ($returnType !== 'string') {
                            $content = json_decode($content);
                        }
                    }

                    return [
                        ObjectSerializer::deserialize($content, $returnType, []),
                        $response->getStatusCode(),
                        $response->getHeaders()
                    ];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        $response->getBody()
                    );
                }
            );
    }

    /**
     * Create request for operation 'getIntegrationLogFilePdf'
     *
     * @param  string $pk (required)
     * @param  string $sk (required)
     * @param  string $uuid (required)
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Psr7\Request
     */
    protected function getIntegrationLogFilePdfRequest($pk, $sk, $uuid)
    {
        // verify the required parameter 'pk' is set
        if ($pk === null || (is_array($pk) && count($pk) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $pk when calling getIntegrationLogFilePdf'
            );
        }
        // verify the required parameter 'sk' is set
        if ($sk === null || (is_array($sk) && count($sk) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $sk when calling getIntegrationLogFilePdf'
            );
        }
        // verify the required parameter 'uuid' is set
        if ($uuid === null || (is_array($uuid) && count($uuid) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $uuid when calling getIntegrationLogFilePdf'
            );
        }

        $resourcePath = '/integration_log/query/{pk}/{sk}/{uuid}/pdf';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;

        // path params
        if ($pk !== null) {
            $resourcePath = str_replace(
                '{' . 'pk' . '}',
                ObjectSerializer::toPathValue($pk),
                $resourcePath
            );
        }
        // path params
        if ($sk !== null) {
            $resourcePath = str_replace(
                '{' . 'sk' . '}',
                ObjectSerializer::toPathValue($sk),
                $resourcePath
            );
        }
        // path params
        if ($uuid !== null) {
            $resourcePath = str_replace(
                '{' . 'uuid' . '}',
                ObjectSerializer::toPathValue($uuid),
                $resourcePath
            );
        }

        // body params
        $_tempBody = null;

        if ($multipart) {
            $headers = $this->headerSelector->selectHeadersForMultipart(
                ['application/octet-stream']
            );
        } else {
            $headers = $this->headerSelector->selectHeaders(
                ['application/octet-stream'],
                ['application/json']
            );
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            // $_tempBody is the method argument, if present
            $httpBody = $_tempBody;

            if($headers['Content-Type'] === 'application/json') {
                // \stdClass has no __toString(), so we should encode it manually
                if ($httpBody instanceof \stdClass) {
                    $httpBody = \GuzzleHttp\json_encode($httpBody);
                }
                // array has no __toString(), so we should encode it manually
                if(is_array($httpBody)) {
                    $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
                }
            }
        } elseif (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];
                foreach ($formParams as $formParamName => $formParamValue) {
                    $multipartContents[] = [
                        'name' => $formParamName,
                        'contents' => $formParamValue
                    ];
                }
                // for HTTP post (form)
                $httpBody = new MultipartStream($multipartContents);

            } elseif ($headers['Content-Type'] === 'application/json') {
                $httpBody = \GuzzleHttp\json_encode($formParams);

            } else {
                // for HTTP post (form)
                $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
            }
        }

        // this endpoint requires OAuth (access token)
        if ($this->config->getAccessToken() !== null) {
            $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
        }
        // this endpoint requires API key authentication
        $apiKey = $this->config->getApiKeyWithPrefix('x-ultracart-simple-key');
        if ($apiKey !== null) {
            $headers['x-ultracart-simple-key'] = $apiKey;
        }

        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }

        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );

        $query = \GuzzleHttp\Psr7\build_query($queryParams);
        return new Request(
            'GET',
            $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }

    /**
     * Operation getIntegrationLogSummariesQuery
     *
     * Retrieve integration log summaries
     *
     * @param  \ultracart\v2\models\IntegrationLogSummaryQueryRequest $integration_log_summaries_query Integration log summaries query (required)
     *
     * @throws \ultracart\v2\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     * @return \ultracart\v2\models\IntegrationLogSummaryQueryResponse
     */
    public function getIntegrationLogSummariesQuery($integration_log_summaries_query)
    {
        list($response) = $this->getIntegrationLogSummariesQueryWithHttpInfo($integration_log_summaries_query);
        return $response;
    }

    /**
     * Operation getIntegrationLogSummariesQueryWithHttpInfo
     *
     * Retrieve integration log summaries
     *
     * @param  \ultracart\v2\models\IntegrationLogSummaryQueryRequest $integration_log_summaries_query Integration log summaries query (required)
     *
     * @throws \ultracart\v2\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     * @return array of \ultracart\v2\models\IntegrationLogSummaryQueryResponse, HTTP status code, HTTP response headers (array of strings)
     */
    public function getIntegrationLogSummariesQueryWithHttpInfo($integration_log_summaries_query)
    {
        return $this->getIntegrationLogSummariesQueryWithHttpInfoRetry(true ,   $integration_log_summaries_query);
    }

    /**
     * Operation getIntegrationLogSummariesQueryWithHttpInfoRetry
     *
     * Retrieve integration log summaries
     *
     * @param boolean $retry should this method retry the call if a rate limit is triggered (required)
     * @param  \ultracart\v2\models\IntegrationLogSummaryQueryRequest $integration_log_summaries_query Integration log summaries query (required)
     *
     * @throws \ultracart\v2\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     * @return array of \ultracart\v2\models\IntegrationLogSummaryQueryResponse, HTTP status code, HTTP response headers (array of strings)
     */
    public function getIntegrationLogSummariesQueryWithHttpInfoRetry($retry ,  $integration_log_summaries_query)
    {
        $returnType = '\ultracart\v2\models\IntegrationLogSummaryQueryResponse';
        $request = $this->getIntegrationLogSummariesQueryRequest($integration_log_summaries_query);

        try {
            $options = $this->createHttpClientOption();
            try {
                $response = $this->client->send($request, $options);
            } catch (RequestException $e) {

                if($e->getResponse()) {
                    $response = $e->getResponse();
                    $statusCode = $response->getStatusCode();
                    $retryAfter = 0;
                    $headers = $response->getHeaders();
                    if (array_key_exists('Retry-After', $headers)) {
                        $retryAfter = intval($headers['Retry-After'][0]);
                    }

                    if ($statusCode == 429 && $retry && $retryAfter > 0 && $retryAfter <= $this->config->getMaxRetrySeconds()) {
                        sleep($retryAfter);
                        return $this->getIntegrationLogSummariesQueryWithHttpInfoRetry(false ,   $integration_log_summaries_query);
                    }
                }

                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    $e->getCode(),
                    $e->getResponse() ? $e->getResponse()->getHeaders() : null,
                    $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
                );
            }

            $responseBody = $response->getBody();
            if ($returnType === '\SplFileObject') {
                $content = $responseBody; //stream goes to serializer
            } else {
                $content = $responseBody->getContents();
                if ($returnType !== 'string') {
                    $content = json_decode($content);
                }
            }

            return [
                ObjectSerializer::deserialize($content, $returnType, []),
                $response->getStatusCode(),
                $response->getHeaders()
            ];

        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\IntegrationLogSummaryQueryResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 401:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 410:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 429:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 500:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
            }
            throw $e;
        }
    }

    /**
     * Operation getIntegrationLogSummariesQueryAsync
     *
     * Retrieve integration log summaries
     *
     * @param  \ultracart\v2\models\IntegrationLogSummaryQueryRequest $integration_log_summaries_query Integration log summaries query (required)
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getIntegrationLogSummariesQueryAsync($integration_log_summaries_query)
    {
        return $this->getIntegrationLogSummariesQueryAsyncWithHttpInfo($integration_log_summaries_query)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }

    /**
     * Operation getIntegrationLogSummariesQueryAsyncWithHttpInfo
     *
     * Retrieve integration log summaries
     *
     * @param  \ultracart\v2\models\IntegrationLogSummaryQueryRequest $integration_log_summaries_query Integration log summaries query (required)
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getIntegrationLogSummariesQueryAsyncWithHttpInfo($integration_log_summaries_query)
    {
        $returnType = '\ultracart\v2\models\IntegrationLogSummaryQueryResponse';
        $request = $this->getIntegrationLogSummariesQueryRequest($integration_log_summaries_query);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    $responseBody = $response->getBody();
                    if ($returnType === '\SplFileObject') {
                        $content = $responseBody; //stream goes to serializer
                    } else {
                        $content = $responseBody->getContents();
                        if ($returnType !== 'string') {
                            $content = json_decode($content);
                        }
                    }

                    return [
                        ObjectSerializer::deserialize($content, $returnType, []),
                        $response->getStatusCode(),
                        $response->getHeaders()
                    ];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        $response->getBody()
                    );
                }
            );
    }

    /**
     * Create request for operation 'getIntegrationLogSummariesQuery'
     *
     * @param  \ultracart\v2\models\IntegrationLogSummaryQueryRequest $integration_log_summaries_query Integration log summaries query (required)
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Psr7\Request
     */
    protected function getIntegrationLogSummariesQueryRequest($integration_log_summaries_query)
    {
        // verify the required parameter 'integration_log_summaries_query' is set
        if ($integration_log_summaries_query === null || (is_array($integration_log_summaries_query) && count($integration_log_summaries_query) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $integration_log_summaries_query when calling getIntegrationLogSummariesQuery'
            );
        }

        $resourcePath = '/integration_log/summary/query';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;

        // body params
        $_tempBody = null;
        if (isset($integration_log_summaries_query)) {
            $_tempBody = $integration_log_summaries_query;
        }

        if ($multipart) {
            $headers = $this->headerSelector->selectHeadersForMultipart(
                ['application/json']
            );
        } else {
            $headers = $this->headerSelector->selectHeaders(
                ['application/json'],
                ['application/json']
            );
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            // $_tempBody is the method argument, if present
            $httpBody = $_tempBody;

            if($headers['Content-Type'] === 'application/json') {
                // \stdClass has no __toString(), so we should encode it manually
                if ($httpBody instanceof \stdClass) {
                    $httpBody = \GuzzleHttp\json_encode($httpBody);
                }
                // array has no __toString(), so we should encode it manually
                if(is_array($httpBody)) {
                    $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
                }
            }
        } elseif (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];
                foreach ($formParams as $formParamName => $formParamValue) {
                    $multipartContents[] = [
                        'name' => $formParamName,
                        'contents' => $formParamValue
                    ];
                }
                // for HTTP post (form)
                $httpBody = new MultipartStream($multipartContents);

            } elseif ($headers['Content-Type'] === 'application/json') {
                $httpBody = \GuzzleHttp\json_encode($formParams);

            } else {
                // for HTTP post (form)
                $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
            }
        }

        // this endpoint requires OAuth (access token)
        if ($this->config->getAccessToken() !== null) {
            $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
        }
        // this endpoint requires API key authentication
        $apiKey = $this->config->getApiKeyWithPrefix('x-ultracart-simple-key');
        if ($apiKey !== null) {
            $headers['x-ultracart-simple-key'] = $apiKey;
        }

        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }

        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );

        $query = \GuzzleHttp\Psr7\build_query($queryParams);
        return new Request(
            'POST',
            $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }

    /**
     * Operation getIntegrationLogsQuery
     *
     * Retrieve integration logs
     *
     * @param  \ultracart\v2\models\IntegrationLogQueryRequest $integration_log_query Integration log query (required)
     * @param  int $_limit The maximum number of records to return on this one API call. (Default 100, Max 500) (optional, default to 100)
     * @param  int $_offset Pagination of the record set.  Offset is a zero based index. (optional, default to 0)
     * @param  string $_sort The sort order of the items.  See Sorting documentation for examples of using multiple values and sorting by ascending and descending. (optional)
     *
     * @throws \ultracart\v2\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     * @return \ultracart\v2\models\IntegrationLogQueryResponse
     */
    public function getIntegrationLogsQuery($integration_log_query, $_limit = '100', $_offset = '0', $_sort = null)
    {
        list($response) = $this->getIntegrationLogsQueryWithHttpInfo($integration_log_query, $_limit, $_offset, $_sort);
        return $response;
    }

    /**
     * Operation getIntegrationLogsQueryWithHttpInfo
     *
     * Retrieve integration logs
     *
     * @param  \ultracart\v2\models\IntegrationLogQueryRequest $integration_log_query Integration log query (required)
     * @param  int $_limit The maximum number of records to return on this one API call. (Default 100, Max 500) (optional, default to 100)
     * @param  int $_offset Pagination of the record set.  Offset is a zero based index. (optional, default to 0)
     * @param  string $_sort The sort order of the items.  See Sorting documentation for examples of using multiple values and sorting by ascending and descending. (optional)
     *
     * @throws \ultracart\v2\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     * @return array of \ultracart\v2\models\IntegrationLogQueryResponse, HTTP status code, HTTP response headers (array of strings)
     */
    public function getIntegrationLogsQueryWithHttpInfo($integration_log_query, $_limit = '100', $_offset = '0', $_sort = null)
    {
        return $this->getIntegrationLogsQueryWithHttpInfoRetry(true ,   $integration_log_query,   $_limit,   $_offset,   $_sort);
    }

    /**
     * Operation getIntegrationLogsQueryWithHttpInfoRetry
     *
     * Retrieve integration logs
     *
     * @param boolean $retry should this method retry the call if a rate limit is triggered (required)
     * @param  \ultracart\v2\models\IntegrationLogQueryRequest $integration_log_query Integration log query (required)
     * @param  int $_limit The maximum number of records to return on this one API call. (Default 100, Max 500) (optional, default to 100)
     * @param  int $_offset Pagination of the record set.  Offset is a zero based index. (optional, default to 0)
     * @param  string $_sort The sort order of the items.  See Sorting documentation for examples of using multiple values and sorting by ascending and descending. (optional)
     *
     * @throws \ultracart\v2\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     * @return array of \ultracart\v2\models\IntegrationLogQueryResponse, HTTP status code, HTTP response headers (array of strings)
     */
    public function getIntegrationLogsQueryWithHttpInfoRetry($retry ,  $integration_log_query,  $_limit = '100',  $_offset = '0',  $_sort = null)
    {
        $returnType = '\ultracart\v2\models\IntegrationLogQueryResponse';
        $request = $this->getIntegrationLogsQueryRequest($integration_log_query, $_limit, $_offset, $_sort);

        try {
            $options = $this->createHttpClientOption();
            try {
                $response = $this->client->send($request, $options);
            } catch (RequestException $e) {

                if($e->getResponse()) {
                    $response = $e->getResponse();
                    $statusCode = $response->getStatusCode();
                    $retryAfter = 0;
                    $headers = $response->getHeaders();
                    if (array_key_exists('Retry-After', $headers)) {
                        $retryAfter = intval($headers['Retry-After'][0]);
                    }

                    if ($statusCode == 429 && $retry && $retryAfter > 0 && $retryAfter <= $this->config->getMaxRetrySeconds()) {
                        sleep($retryAfter);
                        return $this->getIntegrationLogsQueryWithHttpInfoRetry(false ,   $integration_log_query,   $_limit,   $_offset,   $_sort);
                    }
                }

                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    $e->getCode(),
                    $e->getResponse() ? $e->getResponse()->getHeaders() : null,
                    $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
                );
            }

            $responseBody = $response->getBody();
            if ($returnType === '\SplFileObject') {
                $content = $responseBody; //stream goes to serializer
            } else {
                $content = $responseBody->getContents();
                if ($returnType !== 'string') {
                    $content = json_decode($content);
                }
            }

            return [
                ObjectSerializer::deserialize($content, $returnType, []),
                $response->getStatusCode(),
                $response->getHeaders()
            ];

        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\IntegrationLogQueryResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 401:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 410:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 429:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
                case 500:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\ultracart\v2\models\ErrorResponse',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
            }
            throw $e;
        }
    }

    /**
     * Operation getIntegrationLogsQueryAsync
     *
     * Retrieve integration logs
     *
     * @param  \ultracart\v2\models\IntegrationLogQueryRequest $integration_log_query Integration log query (required)
     * @param  int $_limit The maximum number of records to return on this one API call. (Default 100, Max 500) (optional, default to 100)
     * @param  int $_offset Pagination of the record set.  Offset is a zero based index. (optional, default to 0)
     * @param  string $_sort The sort order of the items.  See Sorting documentation for examples of using multiple values and sorting by ascending and descending. (optional)
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getIntegrationLogsQueryAsync($integration_log_query, $_limit = '100', $_offset = '0', $_sort = null)
    {
        return $this->getIntegrationLogsQueryAsyncWithHttpInfo($integration_log_query, $_limit, $_offset, $_sort)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }

    /**
     * Operation getIntegrationLogsQueryAsyncWithHttpInfo
     *
     * Retrieve integration logs
     *
     * @param  \ultracart\v2\models\IntegrationLogQueryRequest $integration_log_query Integration log query (required)
     * @param  int $_limit The maximum number of records to return on this one API call. (Default 100, Max 500) (optional, default to 100)
     * @param  int $_offset Pagination of the record set.  Offset is a zero based index. (optional, default to 0)
     * @param  string $_sort The sort order of the items.  See Sorting documentation for examples of using multiple values and sorting by ascending and descending. (optional)
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function getIntegrationLogsQueryAsyncWithHttpInfo($integration_log_query, $_limit = '100', $_offset = '0', $_sort = null)
    {
        $returnType = '\ultracart\v2\models\IntegrationLogQueryResponse';
        $request = $this->getIntegrationLogsQueryRequest($integration_log_query, $_limit, $_offset, $_sort);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    $responseBody = $response->getBody();
                    if ($returnType === '\SplFileObject') {
                        $content = $responseBody; //stream goes to serializer
                    } else {
                        $content = $responseBody->getContents();
                        if ($returnType !== 'string') {
                            $content = json_decode($content);
                        }
                    }

                    return [
                        ObjectSerializer::deserialize($content, $returnType, []),
                        $response->getStatusCode(),
                        $response->getHeaders()
                    ];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        $response->getBody()
                    );
                }
            );
    }

    /**
     * Create request for operation 'getIntegrationLogsQuery'
     *
     * @param  \ultracart\v2\models\IntegrationLogQueryRequest $integration_log_query Integration log query (required)
     * @param  int $_limit The maximum number of records to return on this one API call. (Default 100, Max 500) (optional, default to 100)
     * @param  int $_offset Pagination of the record set.  Offset is a zero based index. (optional, default to 0)
     * @param  string $_sort The sort order of the items.  See Sorting documentation for examples of using multiple values and sorting by ascending and descending. (optional)
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Psr7\Request
     */
    protected function getIntegrationLogsQueryRequest($integration_log_query, $_limit = '100', $_offset = '0', $_sort = null)
    {
        // verify the required parameter 'integration_log_query' is set
        if ($integration_log_query === null || (is_array($integration_log_query) && count($integration_log_query) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $integration_log_query when calling getIntegrationLogsQuery'
            );
        }

        $resourcePath = '/integration_log/query';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;

        // query params
        if ($_limit !== null) {
            $queryParams['_limit'] = ObjectSerializer::toQueryValue($_limit);
        }
        // query params
        if ($_offset !== null) {
            $queryParams['_offset'] = ObjectSerializer::toQueryValue($_offset);
        }
        // query params
        if ($_sort !== null) {
            $queryParams['_sort'] = ObjectSerializer::toQueryValue($_sort);
        }

        // body params
        $_tempBody = null;
        if (isset($integration_log_query)) {
            $_tempBody = $integration_log_query;
        }

        if ($multipart) {
            $headers = $this->headerSelector->selectHeadersForMultipart(
                ['application/json']
            );
        } else {
            $headers = $this->headerSelector->selectHeaders(
                ['application/json'],
                ['application/json']
            );
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            // $_tempBody is the method argument, if present
            $httpBody = $_tempBody;

            if($headers['Content-Type'] === 'application/json') {
                // \stdClass has no __toString(), so we should encode it manually
                if ($httpBody instanceof \stdClass) {
                    $httpBody = \GuzzleHttp\json_encode($httpBody);
                }
                // array has no __toString(), so we should encode it manually
                if(is_array($httpBody)) {
                    $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
                }
            }
        } elseif (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];
                foreach ($formParams as $formParamName => $formParamValue) {
                    $multipartContents[] = [
                        'name' => $formParamName,
                        'contents' => $formParamValue
                    ];
                }
                // for HTTP post (form)
                $httpBody = new MultipartStream($multipartContents);

            } elseif ($headers['Content-Type'] === 'application/json') {
                $httpBody = \GuzzleHttp\json_encode($formParams);

            } else {
                // for HTTP post (form)
                $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
            }
        }

        // this endpoint requires OAuth (access token)
        if ($this->config->getAccessToken() !== null) {
            $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
        }
        // this endpoint requires API key authentication
        $apiKey = $this->config->getApiKeyWithPrefix('x-ultracart-simple-key');
        if ($apiKey !== null) {
            $headers['x-ultracart-simple-key'] = $apiKey;
        }

        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }

        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );

        $query = \GuzzleHttp\Psr7\build_query($queryParams);
        return new Request(
            'POST',
            $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }

    /**
     * Create http client option
     *
     * @throws \RuntimeException on file opening failure
     * @return array of http client options
     */
    protected function createHttpClientOption()
    {
        $options = [];
        if ($this->config->getDebug()) {
            $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
            if (!$options[RequestOptions::DEBUG]) {
                throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
            }
        }

        return $options;
    }
}


text:
using namespace Kore;

namespace {
	std::thread tt[MAX_THREADS];
	uint index = 0;
	Kore::Mutex mutex;
}

Kore::Thread* Kore::createAndRunThread(void (*thread)(void* param), void* param) {
	mutex.Lock();

	uint i = index++;
	//ktassert_d(i != 0xFFFFFFFF);
	std::thread* t = &tt[i];
	t->swap(std::thread(thread, param));

	mutex.Unlock();

	return (Kore::Thread*)t;
}

void Kore::waitForThreadStopThenFree(Kore::Thread* sr) {
	std::thread* t = (std::thread*)sr;
	t->join();
	mutex.Lock();
	uint ti = ((uint)t - (uint)&tt[0]) / sizeof(::Thread);
	//ia.DeallocateIndex(ti);
	mutex.Unlock();
}

bool Kore::isThreadStoppedThenFree(Kore::Thread* sr) {
	std::thread* t = (std::thread*)sr;
	return true;
}

#pragma warning(disable: 4996)
void Kore::threadsInit() {
	mutex.Create();
	//ia.Create(1);//SR_MAX_THREADS32);
}

void Kore::threadsQuit() {
	mutex.Free();
	//ia.Free();
}

void ThreadYield() {

}


text:
#ifndef TENSORFLOW_CORE_PLATFORM_HTTP_REQUEST_FAKE_H_
#define TENSORFLOW_CORE_PLATFORM_HTTP_REQUEST_FAKE_H_

#include <fstream>
#include <string>
#include <vector>
#include <curl/curl.h>
#include "tensorflow/core/lib/core/errors.h"
#include "tensorflow/core/lib/core/status.h"
#include "tensorflow/core/lib/core/status_test_util.h"
#include "tensorflow/core/lib/core/stringpiece.h"
#include "tensorflow/core/platform/cloud/http_request.h"
#include "tensorflow/core/platform/macros.h"
#include "tensorflow/core/platform/protobuf.h"
#include "tensorflow/core/platform/test.h"
#include "tensorflow/core/platform/types.h"

namespace tensorflow {

/// Fake HttpRequest for testing.
class FakeHttpRequest : public HttpRequest {
 public:
  /// Return the response for the given request.
  FakeHttpRequest(const string& request, const string& response)
      : FakeHttpRequest(request, response, Status::OK(), nullptr) {}

  /// \brief Return the response for the request and capture the POST body.
  ///
  /// Post body is not expected to be a part of the 'request' parameter.
  FakeHttpRequest(const string& request, const string& response,
                  string* captured_post_body)
      : FakeHttpRequest(request, response, Status::OK(), captured_post_body) {}

  /// \brief Return the response and the status for the given request.
  FakeHttpRequest(const string& request, const string& response,
                  Status response_status)
      : FakeHttpRequest(request, response, response_status, nullptr) {}

  /// \brief Return the response and the status for the given request
  ///  and capture the POST body.
  ///
  /// Post body is not expected to be a part of the 'request' parameter.
  FakeHttpRequest(const string& request, const string& response,
                  Status response_status, string* captured_post_body)
      : expected_request_(request),
        response_(response),
        response_status_(response_status),
        captured_post_body_(captured_post_body) {}

  Status Init() override { return Status::OK(); }
  Status SetUri(const string& uri) override {
    actual_request_ += "Uri: " + uri + "\n";
    return Status::OK();
  }
  Status SetRange(uint64 start, uint64 end) override {
    actual_request_ += strings::StrCat("Range: ", start, "-", end, "\n");
    return Status::OK();
  }
  Status AddHeader(const string& name, const string& value) override {
    actual_request_ += "Header " + name + ": " + value + "\n";
    return Status::OK();
  }
  Status AddAuthBearerHeader(const string& auth_token) override {
    actual_request_ += "Auth Token: " + auth_token + "\n";
    return Status::OK();
  }
  Status SetDeleteRequest() override {
    actual_request_ += "Delete: yes\n";
    return Status::OK();
  }
  Status SetPostRequest(const string& body_filepath) override {
    std::ifstream stream(body_filepath);
    string content((std::istreambuf_iterator<char>(stream)),
                   std::istreambuf_iterator<char>());
    if (captured_post_body_) {
      *captured_post_body_ = content;
    } else {
      actual_request_ += "Post body: " + content + "\n";
    }
    return Status::OK();
  }
  Status SetPostRequest(const char* buffer, size_t size) override {
    if (captured_post_body_) {
      *captured_post_body_ = string(buffer, size);
    } else {
      actual_request_ +=
          strings::StrCat("Post body: ", StringPiece(buffer, size), "\n");
    }
    return Status::OK();
  }
  Status SetPostRequest() override {
    if (captured_post_body_) {
      *captured_post_body_ = "<empty>";
    } else {
      actual_request_ += "Post: yes\n";
    }
    return Status::OK();
  }
  Status SetResultBuffer(char* scratch, size_t size,
                         StringPiece* result) override {
    scratch_ = scratch;
    size_ = size;
    result_ = result;
    return Status::OK();
  }
  Status Send() override {
    EXPECT_EQ(expected_request_, actual_request_) << "Unexpected HTTP request.";
    if (scratch_ && result_) {
      auto actual_size = std::min(response_.size(), size_);
      memcpy(scratch_, response_.c_str(), actual_size);
      *result_ = StringPiece(scratch_, actual_size);
    }
    return response_status_;
  }

 private:
  char* scratch_ = nullptr;
  size_t size_ = 0;
  StringPiece* result_ = nullptr;
  string expected_request_;
  string actual_request_;
  string response_;
  Status response_status_;
  string* captured_post_body_ = nullptr;
};

/// Fake HttpRequest factory for testing.
class FakeHttpRequestFactory : public HttpRequest::Factory {
 public:
  FakeHttpRequestFactory(const std::vector<HttpRequest*>* requests)
      : requests_(requests) {}

  ~FakeHttpRequestFactory() {
    EXPECT_EQ(current_index_, requests_->size())
        << "Not all expected requests were made.";
  }

  HttpRequest* Create() override {
    EXPECT_LT(current_index_, requests_->size())
        << "Too many calls of HttpRequest factory.";
    return (*requests_)[current_index_++];
  }

 private:
  const std::vector<HttpRequest*>* requests_;
  int current_index_ = 0;
};

}  // namespace tensorflow

#endif  // TENSORFLOW_CORE_PLATFORM_HTTP_REQUEST_FAKE_H_


text:
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.Extensions.Options;
using R4Mvc.Tools.Extensions;
using R4Mvc.Tools.Locators;
using static R4Mvc.Tools.Extensions.SyntaxNodeHelpers;

namespace R4Mvc.Tools.Services
{
    public class StaticFileGeneratorService : IStaticFileGeneratorService
    {
        private readonly IEnumerable<IStaticFileLocator> _staticFileLocators;
        private readonly Settings _settings;

        public StaticFileGeneratorService(IEnumerable<IStaticFileLocator> staticFileLocators, IOptions<Settings> settings)
        {
            _staticFileLocators = staticFileLocators;
            _settings = settings.Value;
        }

        public MemberDeclarationSyntax GenerateStaticFiles(string projectRoot)
        {
            var staticFilesRoot = Path.Combine(projectRoot, "wwwroot");
            var staticfiles = _staticFileLocators.SelectMany(x => x.Find(staticFilesRoot));

            var linksClass = CreateClass(_settings.LinksNamespace, null, SyntaxKind.PublicKeyword, SyntaxKind.StaticKeyword)
                .WithAttributes(CreateGeneratedCodeAttribute(), CreateDebugNonUserCodeAttribute());
            linksClass = AddStaticFiles(linksClass, string.Empty, staticfiles);
            return linksClass;
        }

        private string SanitiseName(string name) => Regex.Replace(Regex.Replace(name, "[^a-z0-9]+", "_"), "^([\\d])", "_$1");

        private ClassDeclarationSyntax AddStaticFiles(ClassDeclarationSyntax parentClass, string path, IEnumerable<StaticFile> files)
        {
            var paths = files
                .Select(f => f.Container)
                .Distinct()
                .OrderBy(p => p)
                .Where(c => c.StartsWith(path) && c.Length > path.Length)
                .Select(c =>
                {
                    var index = c.IndexOf('/', path.Length > 0 ? path.Length + 1 : 0);
                    if (index == -1)
                        return c;
                    return c.Substring(0, index);
                })
                .Distinct();

            foreach (var childPath in paths)
            {
                var childFiles = files.Where(f => f.Container.StartsWith(childPath));
                var className = SanitiseName(childPath.Substring(path.Length > 0 ? path.Length + 1 : 0));
                var containerClass = CreateClass(className, null, SyntaxKind.PublicKeyword, SyntaxKind.StaticKeyword)
                    .WithAttributes(CreateGeneratedCodeAttribute(), CreateDebugNonUserCodeAttribute());
                containerClass = AddStaticFiles(containerClass, childPath, childFiles);
                parentClass = parentClass.AddMembers(containerClass);
            }

            var localFiles = files.Where(f => f.Container == path);
            foreach (var file in localFiles)
            {
                parentClass = parentClass.AddMembers(
                    CreateStringFieldDeclaration(SanitiseName(file.FileName), "~/" + file.RelativePath.ToString(), SyntaxKind.PublicKeyword, SyntaxKind.StaticKeyword));
            }
            return parentClass;
        }
    }
}


text:
import raptureAPI
import multipart
import json
import time
import base64

# TODO These need to be parameters

repo = '//nightly_python'

strucRepoUri = 'structured:'+repo

site = 'localhost:8665/rapture'
username = 'rapture'
password = 'rapture'
rapture = raptureAPI.raptureAPI(site, username, password)
config = "STRUCTURED { } USING POSTGRES { marvin=\"paranoid\" }"

def test_structuredapi():

    # Create a repo
    try:
        rapture.doStructured_DeleteStructuredRepo(strucRepoUri)
    except:
        assert True
    assert not rapture.doStructured_StructuredRepoExists(strucRepoUri)
    rapture.doStructured_CreateStructuredRepo(strucRepoUri, config)
    assert rapture.doStructured_StructuredRepoExists(strucRepoUri)
    assert config == rapture.doStructured_GetStructuredRepoConfig(strucRepoUri)['config']

    # Create a table. Add and remove data
    table = repo + "/table"

    definition = {'id' : 'int', 'name' : 'varchar(255), PRIMARY KEY (id)'}
    rapture.doStructured_CreateTable(table, definition)

    row = {'id' : 42, 'name' : 'Don\'t Panic'}
    rapture.doStructured_InsertRow(table, row)

    contents = rapture.doStructured_SelectRows(table, None, None, None, None, -1)
    assert len(contents) == 1
    assert contents[0] == row

    batch = [ {'id' : 11, 'name' : 'Ford Prefect'}, {'id' : 33, 'name' : 'Zaphod Beeblebrox'}, {'id' : 55, 'name' : 'Arthur Dent'}, {'id' : 44, 'name' : 'Slartibartfast'}, {'id' : 22, 'name' : 'Trillian'} ]

    rapture.doStructured_InsertRows(table, batch)
    contents = rapture.doStructured_SelectRows(table, None, None, None, None, -1)
    assert len(contents) == len(batch) + 1

    rapture.doStructured_DeleteRows(table, "id=42")

    contents = rapture.doStructured_SelectRows(table, None, None, None, None, -1)
    assert len(contents) == len(batch)

    for f in contents:
      if f['id'] == 33:
         assert f['name'] == "Zaphod Beeblebrox"

    # Update a row
    rapture.doStructured_UpdateRows(table, {'id' : 33, 'name' : 'Zarniwoop'}, "id=33")
    contents = rapture.doStructured_SelectRows(table, None, None, None, None, -1)
    assert len(contents) == len(batch)

    for f in contents:
      if f['id'] == 33:
         assert f['name'] == "Zarniwoop"

    rapture.doStructured_DropTable(table)
    try:
        contents = rapture.doStructured_SelectRows(table, None, None, None, None, -1)
        assert False
    except:
        assert True

    # Good enough. Delete the repo.
    rapture.doStructured_DeleteStructuredRepo(strucRepoUri)
    assert not rapture.doStructured_StructuredRepoExists(strucRepoUri)


text:
package com.ksa.dao.logistics.mybatis;

import java.util.UUID;

import org.junit.Assert;
import org.junit.Test;

import com.ksa.dao.MybatisDaoTest;
import com.ksa.dao.logistics.ManifestDao;
import com.ksa.model.logistics.Manifest;

public class MybatisManifestDaoTest extends MybatisDaoTest {

    @Test
    public void testCrudManifest() throws RuntimeException {
        ManifestDao dao = CONTEXT.getBean( "manifestDao", ManifestDao.class );

        Manifest bill = new Manifest();
        String id = UUID.randomUUID().toString();
        bill.setId( id );
        bill.getBookingNote().setId( "test-bookingnote-1" );

        bill.setSaler( "saler" );
        bill.setCode( "code" );
        bill.setFlightDate( "createdDate" );
        bill.setLoadingPort( "departurePort" );
        bill.setDestinationPort( "destinationPort" );
        bill.setAgent( "agent" );

        bill.setHawb( "hawb" );
        bill.setCargoName( "cargoName" );
        bill.setCargoWeight( "cargoWeight" );
        bill.setFinalDestination( "finalDestination" );
        bill.setShipper( "shipper" );
        bill.setConsignee( "consignee" );
        bill.setRe( "re" );

        bill.setTotalHawb( "totalVolumn" );
        bill.setTotalPackages( "totalWeight" );

        // 测试插入是否成功
        dao.insertLogisticsModel( bill );
        Manifest temp = ( Manifest ) ( dao.selectLogisticsModelById(id) );
        Assert.assertEquals( "test-bookingnote-1", temp.getBookingNote().getId() );

        Assert.assertEquals( "saler", temp.getSaler() );
        Assert.assertEquals( "code", temp.getCode() );
        Assert.assertEquals( "createdDate", temp.getFlightDate() );
        Assert.assertEquals( "departurePort", temp.getLoadingPort() );
        Assert.assertEquals( "destinationPort", temp.getDestinationPort() );
        Assert.assertEquals( "agent", temp.getAgent() );

        Assert.assertEquals( "shipper", temp.getShipper() );
        Assert.assertEquals( "consignee", temp.getConsignee() );
        Assert.assertEquals( "re", temp.getRe() );

        Assert.assertEquals( "hawb", temp.getHawb() );
        Assert.assertEquals( "cargoName", temp.getCargoName() );
        Assert.assertEquals( "cargoWeight", temp.getCargoWeight() );
        Assert.assertEquals( "finalDestination", temp.getFinalDestination() );
        Assert.assertEquals( "totalVolumn", temp.getTotalHawb() );
        Assert.assertEquals( "totalWeight", temp.getTotalPackages() );

        // 开始更新
        bill.getBookingNote().setId( "test-bookingnote-2" );

        bill.setSaler( "saler1" );
        bill.setCode( "code1" );
        bill.setFlightDate( "createdDate1" );
        bill.setLoadingPort( "departurePort1" );
        bill.setDestinationPort( "destinationPort1" );
        bill.setAgent( "agent1" );

        bill.setHawb( "hawb1" );
        bill.setCargoName( "cargoName1" );
        bill.setCargoWeight( "cargoWeight1" );
        bill.setFinalDestination( "finalDestination1" );
        bill.setShipper( "shipper1" );
        bill.setConsignee( "consignee1" );
        bill.setRe( "re1" );

        bill.setTotalHawb( "totalVolumn1" );
        bill.setTotalPackages( "totalWeight1" );

        // 测试插入是否成功
        dao.updateLogisticsModel( bill );
        temp = ( Manifest ) ( dao.selectLogisticsModelById(id) );
        Assert.assertEquals( "test-bookingnote-1", temp.getBookingNote().getId() );

        Assert.assertEquals( "saler1", temp.getSaler() );
        Assert.assertEquals( "code1", temp.getCode() );
        Assert.assertEquals( "createdDate1", temp.getFlightDate() );
        Assert.assertEquals( "departurePort1", temp.getLoadingPort() );
        Assert.assertEquals( "destinationPort1", temp.getDestinationPort() );
        Assert.assertEquals( "agent1", temp.getAgent() );

        Assert.assertEquals( "shipper1", temp.getShipper() );
        Assert.assertEquals( "consignee1", temp.getConsignee() );
        Assert.assertEquals( "re1", temp.getRe() );

        Assert.assertEquals( "hawb1", temp.getHawb() );
        Assert.assertEquals( "cargoName1", temp.getCargoName() );
        Assert.assertEquals( "cargoWeight1", temp.getCargoWeight() );
        Assert.assertEquals( "finalDestination1", temp.getFinalDestination() );
        Assert.assertEquals( "totalVolumn1", temp.getTotalHawb() );
        Assert.assertEquals( "totalWeight1", temp.getTotalPackages() );
    }

}


text:
/**
 * react-async-render
 * (c) 2015-2016 eBay Software Foundation
 * react-async-render may be freely distributed under the MIT license.
 */

var React = require('react');
var Q = require('kew');
var {connect, Provider} = require('react-redux');
var {init} = require('./actions');

function Queue(initFunc){
  var queue = [];
  var initAny = initFunc;
  this.addToQueue = function(promise){
    queue.push(promise);
  };
  this.resetQueue = function(){
    queue = [];
  };
  this.resolveAll = function(){
    var p;
    if(queue.length){
      p = Q.all(queue).then(function(results){
        if(results && results.length){
          var _results = results.slice(0);
          for(var i = 0, m = _results.length; i < m; i++){
            var result = _results[i];
            if(typeof initAny == 'function'){
              initAny(result);
            }
          }
        }
        return results;
      }, function(err){
        console.error('##### error:', err.stack);
      });
    }else{
      p = Q.fcall(function(){return [];});
    }
    return p;
  };
}

class InitProvider extends React.Component {
  constructor(props){
    super(props);
    this.state = {
      store: this.props.store || require('./store')()
    };
  }
  getChildContext(){
    return {
      asyncQ: new Queue(this.props.initAny)
    };
  }
  render() {
    return (
      <Provider store={this.state.store}>
        <InnerProvider onResolve={this.props.onResolve}>
          {this.props.children}
        </InnerProvider>
      </Provider>
    );
  }
}

InitProvider.childContextTypes = {
  asyncQ: React.PropTypes.object
};

class InnerProvider extends React.Component {
  constructor(props){
    super(props);
  }

  render() {
    this.context.asyncQ.resetQueue();
    if(typeof this.props.onResolve == 'function'){
      this.props.onResolve(this.context.asyncQ.resolveAll);
    }
    var children = this.props.children;

    if (typeof children === 'function') {
      return children();
    }
    return children;
  }
}

InnerProvider.contextTypes = {
    asyncQ: React.PropTypes.object
};

function mapDispatchToProps(dispatch){
  return {
    initAny: (obj) => dispatch(init(obj.key, obj.data))
  }
}

exports.Provider = connect(null, mapDispatchToProps)(InitProvider);
exports.contextTypes = InnerProvider.contextTypes;


text:
define(function(require) {
	var core = require('core');
	var _ = core._;
	var User = require('../../models/User');

	var ItemView = core.Marionette.ItemView.extend({
		tagName: 'tr',
		template: require('hbs!templates/admin/userListItem'),
		mixins: [
			require('lib/mixins/stickit-view')
		],
		bindings: {
			'.display-name': 'displayName',
			'.email': 'email'
		},
		events: {
			'click .toggle-user': 'onToggleUser',
			'click .delete-user': 'onDeleteUser'
		},
		initialize: function() {
			_(this).bindAll('onError');
		},
		onToggleUser: function(e) {
			e.preventDefault();
		},
		onDeleteUser: function(e) {
			e.preventDefault();
			if( window.confirm('Delete User "' + this.model.get('displayName') + '"?') ) {
				this.model.destroy()
					.fail(this.onError);
			}
		},
		onError: function(xhr) {
			this.trigger('alert:show', 'An error occurred:', xhr.responseJSON.error, 'error');
		}
	});

	return core.Marionette.CompositeView.extend({
		template: require('hbs!templates/admin/userTable'),
		itemView: ItemView,
		itemViewContainer: '#user-list-view',
		itemViewOptions: {
			alertRegion: this.$('.alert-region')
		},
		mixins: [
			require('lib/mixins/form-alert')
		],
		events: {
			'submit form': 'onAddUser'
		},
		ui: {
			emailField: '[name="new-user-email"]'
		},
		initialize: function() {
			_(this).bindAll('onUserAdded', 'onError');
		},
		onAddUser: function(e) {
			e.preventDefault();
			this.model = new User.Model({
				email: this.ui.emailField.val()
			});
			this.model.save()
				.done(this.onUserAdded)
				.fail(this.onError);
		},
		onError: function(xhr) {
			this.trigger('alert:show', 'An error occurred:', xhr.responseJSON.error, 'error');
		},
		onUserAdded: function() {
			this.collection.add(this.model);
			this.ui.emailField.val('');
			this.trigger('alert:show', 'Success', 'User added.', 'success');
		}
	});
});