.gitignore000064400000000521146412216730006540 0ustar00composer.phar /vendor/ # Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file composer.lock .vscode/ .idea .DS_Store cache/ *.cache runtime/ .php_cs.cache .php_cs.dist000064400000005666146412216730007006 0ustar00setRiskyAllowed(true) ->setIndent(' ') ->setRules([ '@PSR2' => true, '@PhpCsFixer' => true, '@Symfony:risky' => true, 'concat_space' => ['spacing' => 'one'], 'array_syntax' => ['syntax' => 'short'], 'array_indentation' => true, 'combine_consecutive_unsets' => true, 'method_separation' => true, 'single_quote' => true, 'declare_equal_normalize' => true, 'function_typehint_space' => true, 'hash_to_slash_comment' => true, 'include' => true, 'lowercase_cast' => true, 'no_multiline_whitespace_before_semicolons' => true, 'no_leading_import_slash' => true, 'no_multiline_whitespace_around_double_arrow' => true, 'no_spaces_around_offset' => true, 'no_unneeded_control_parentheses' => true, 'no_unused_imports' => true, 'no_whitespace_before_comma_in_array' => true, 'no_whitespace_in_blank_line' => true, 'object_operator_without_whitespace' => true, 'single_blank_line_before_namespace' => true, 'single_class_element_per_statement' => true, 'space_after_semicolon' => true, 'standardize_not_equals' => true, 'ternary_operator_spaces' => true, 'trailing_comma_in_multiline_array' => true, 'trim_array_spaces' => true, 'unary_operator_spaces' => true, 'whitespace_after_comma_in_array' => true, 'no_extra_consecutive_blank_lines' => [ 'curly_brace_block', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'throw', 'use', ], 'binary_operator_spaces' => [ 'align_double_arrow' => true, 'align_equals' => true, ], 'braces' => [ 'allow_single_line_closure' => true, ], ]) ->setFinder( PhpCsFixer\Finder::create() ->exclude('vendor') ->exclude('tests') ->in(__DIR__) ); autoload.php000064400000001063146412216730007073 0ustar005.5", "alibabacloud/gateway-spi": "^1", "alibabacloud/tea-utils": "^0.2.18" }, "autoload": { "psr-4": { "Darabonba\\GatewayDingTalk\\": "src" } }, "scripts": { "fixer": "php-cs-fixer fix ./" }, "config": { "sort-packages": true, "preferred-install": "dist", "optimize-autoloader": true }, "prefer-stable": true }src/Client.php000064400000007652146412216730007302 0ustar00request; $config = $context->configuration; $request->headers = Tea::merge([ "host" => $config->endpoint, "user-agent" => $request->userAgent, "accept" => "application/json" ], $request->headers); if (!Utils::isUnset($request->body)) { $jsonObj = Utils::toJSONString($request->body); $request->stream = $jsonObj; $request->headers["content-type"] = "application/json; charset=utf-8"; } } /** * @param InterceptorContext $context * @param AttributeMap $attributeMap * @return void * @throws TeaError */ public function modifyResponse($context, $attributeMap){ $request = $context->request; $response = $context->response; if (Utils::is4xx($response->statusCode) || Utils::is5xx($response->statusCode)) { $_res = Utils::readAsJSON($response->body); $err = Utils::assertAsMap($_res); @$err["statusCode"] = $response->statusCode; throw new TeaError([ "code" => "" . (string) ($this->defaultAny(@$err["Code"], @$err["code"])) . "", "message" => "code: " . (string) ($response->statusCode) . ", " . (string) ($this->defaultAny(@$err["Message"], @$err["message"])) . " request id: " . (string) ($this->defaultAny(@$err["RequestId"], @$err["requestid"])) . "", "data" => $err, "description" => "" . (string) ($this->defaultAny(@$err["Description"], @$err["description"])) . "", "accessDeniedDetail" => $this->defaultAny(@$err["AccessDeniedDetail"], @$err["accessdenieddetail"]) ]); } if (Utils::equalNumber($response->statusCode, 204)) { Utils::readAsString($response->body); } else if (Utils::equalString($request->bodyType, "binary")) { $response->deserializedBody = $response->body; } else if (Utils::equalString($request->bodyType, "byte")) { $byt = Utils::readAsBytes($response->body); $response->deserializedBody = $byt; } else if (Utils::equalString($request->bodyType, "string")) { $str = Utils::readAsString($response->body); $response->deserializedBody = $str; } else if (Utils::equalString($request->bodyType, "json")) { $obj = Utils::readAsJSON($response->body); $res = Utils::assertAsMap($obj); $response->deserializedBody = $res; } else if (Utils::equalString($request->bodyType, "array")) { $arr = Utils::readAsJSON($response->body); $response->deserializedBody = $arr; } else { $response->deserializedBody = Utils::readAsString($response->body); } } /** * @param mixed $inputValue * @param mixed $defaultValue * @return any */ public function defaultAny($inputValue, $defaultValue){ if (Utils::isUnset($inputValue)) { return $defaultValue; } return $inputValue; } }