Konstantin Lebedev
2 years ago
143 changed files with 17192 additions and 0 deletions
-
29other/master-clients/cpp-restsdk/.gitignore
-
23other/master-clients/cpp-restsdk/.openapi-generator-ignore
-
28other/master-clients/cpp-restsdk/.openapi-generator/FILES
-
1other/master-clients/cpp-restsdk/.openapi-generator/VERSION
-
91other/master-clients/cpp-restsdk/CMakeLists.txt
-
5other/master-clients/cpp-restsdk/Config.cmake.in
-
50other/master-clients/cpp-restsdk/README.md
-
57other/master-clients/cpp-restsdk/git_push.sh
-
114other/master-clients/cpp-restsdk/include/CppRestOpenAPIClient/ApiClient.h
-
66other/master-clients/cpp-restsdk/include/CppRestOpenAPIClient/ApiConfiguration.h
-
60other/master-clients/cpp-restsdk/include/CppRestOpenAPIClient/ApiException.h
-
69other/master-clients/cpp-restsdk/include/CppRestOpenAPIClient/HttpContent.h
-
42other/master-clients/cpp-restsdk/include/CppRestOpenAPIClient/IHttpBody.h
-
49other/master-clients/cpp-restsdk/include/CppRestOpenAPIClient/JsonBody.h
-
342other/master-clients/cpp-restsdk/include/CppRestOpenAPIClient/ModelBase.h
-
61other/master-clients/cpp-restsdk/include/CppRestOpenAPIClient/MultipartFormData.h
-
62other/master-clients/cpp-restsdk/include/CppRestOpenAPIClient/Object.h
-
103other/master-clients/cpp-restsdk/include/CppRestOpenAPIClient/api/DefaultApi.h
-
99other/master-clients/cpp-restsdk/include/CppRestOpenAPIClient/model/FileKey.h
-
88other/master-clients/cpp-restsdk/include/CppRestOpenAPIClient/model/Location.h
-
208other/master-clients/cpp-restsdk/src/ApiClient.cpp
-
85other/master-clients/cpp-restsdk/src/ApiConfiguration.cpp
-
53other/master-clients/cpp-restsdk/src/ApiException.cpp
-
86other/master-clients/cpp-restsdk/src/HttpContent.cpp
-
36other/master-clients/cpp-restsdk/src/JsonBody.cpp
-
665other/master-clients/cpp-restsdk/src/ModelBase.cpp
-
112other/master-clients/cpp-restsdk/src/MultipartFormData.cpp
-
91other/master-clients/cpp-restsdk/src/Object.cpp
-
347other/master-clients/cpp-restsdk/src/api/DefaultApi.cpp
-
213other/master-clients/cpp-restsdk/src/model/FileKey.cpp
-
168other/master-clients/cpp-restsdk/src/model/Location.cpp
-
362other/master-clients/csharp/.gitignore
-
23other/master-clients/csharp/.openapi-generator-ignore
-
33other/master-clients/csharp/.openapi-generator/FILES
-
1other/master-clients/csharp/.openapi-generator/VERSION
-
9other/master-clients/csharp/.travis.yml
-
27other/master-clients/csharp/Org.OpenAPITools.sln
-
130other/master-clients/csharp/README.md
-
16other/master-clients/csharp/build.bat
-
68other/master-clients/csharp/build.sh
-
188other/master-clients/csharp/docs/DefaultApi.md
-
15other/master-clients/csharp/docs/FileKey.md
-
14other/master-clients/csharp/docs/Location.md
-
57other/master-clients/csharp/git_push.sh
-
22other/master-clients/csharp/mono_nunit_test.sh
-
105other/master-clients/csharp/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
-
95other/master-clients/csharp/src/Org.OpenAPITools.Test/Model/FileKeyTests.cs
-
87other/master-clients/csharp/src/Org.OpenAPITools.Test/Model/LocationTests.cs
-
88other/master-clients/csharp/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj
-
7other/master-clients/csharp/src/Org.OpenAPITools.Test/packages.config
-
618other/master-clients/csharp/src/Org.OpenAPITools/Api/DefaultApi.cs
-
536other/master-clients/csharp/src/Org.OpenAPITools/Client/ApiClient.cs
-
60other/master-clients/csharp/src/Org.OpenAPITools/Client/ApiException.cs
-
54other/master-clients/csharp/src/Org.OpenAPITools/Client/ApiResponse.cs
-
452other/master-clients/csharp/src/Org.OpenAPITools/Client/Configuration.cs
-
24other/master-clients/csharp/src/Org.OpenAPITools/Client/ExceptionFactory.cs
-
34other/master-clients/csharp/src/Org.OpenAPITools/Client/GlobalConfiguration.cs
-
42other/master-clients/csharp/src/Org.OpenAPITools/Client/IApiAccessor.cs
-
94other/master-clients/csharp/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
-
30other/master-clients/csharp/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs
-
159other/master-clients/csharp/src/Org.OpenAPITools/Model/FileKey.cs
-
142other/master-clients/csharp/src/Org.OpenAPITools/Model/Location.cs
-
79other/master-clients/csharp/src/Org.OpenAPITools/Org.OpenAPITools.csproj
-
41other/master-clients/csharp/src/Org.OpenAPITools/Org.OpenAPITools.nuspec
-
32other/master-clients/csharp/src/Org.OpenAPITools/Properties/AssemblyInfo.cs
-
7other/master-clients/csharp/src/Org.OpenAPITools/packages.config
-
24other/master-clients/go/.gitignore
-
23other/master-clients/go/.openapi-generator-ignore
-
19other/master-clients/go/.openapi-generator/FILES
-
1other/master-clients/go/.openapi-generator/VERSION
-
8other/master-clients/go/.travis.yml
-
114other/master-clients/go/README.md
-
174other/master-clients/go/api/openapi.yaml
-
372other/master-clients/go/api_default.go
-
654other/master-clients/go/client.go
-
214other/master-clients/go/configuration.go
-
168other/master-clients/go/docs/DefaultApi.md
-
138other/master-clients/go/docs/FileKey.md
-
102other/master-clients/go/docs/Location.md
-
57other/master-clients/go/git_push.sh
-
6other/master-clients/go/go.mod
-
11other/master-clients/go/go.sum
-
199other/master-clients/go/model_file_key.go
-
162other/master-clients/go/model_location.go
-
47other/master-clients/go/response.go
-
49other/master-clients/go/test/api_default_test.go
-
347other/master-clients/go/utils.go
-
15other/master-clients/php/.gitignore
-
23other/master-clients/php/.openapi-generator-ignore
-
22other/master-clients/php/.openapi-generator/FILES
-
1other/master-clients/php/.openapi-generator/VERSION
-
29other/master-clients/php/.php-cs-fixer.dist.php
-
8other/master-clients/php/.travis.yml
-
113other/master-clients/php/README.md
-
38other/master-clients/php/composer.json
-
147other/master-clients/php/docs/Api/DefaultApi.md
-
11other/master-clients/php/docs/Model/FileKey.md
-
10other/master-clients/php/docs/Model/Location.md
-
57other/master-clients/php/git_push.sh
-
897other/master-clients/php/lib/Api/DefaultApi.php
@ -0,0 +1,29 @@ |
|||
# Compiled Object files |
|||
*.slo |
|||
*.lo |
|||
*.o |
|||
*.obj |
|||
|
|||
# Precompiled Headers |
|||
*.gch |
|||
*.pch |
|||
|
|||
# Compiled Dynamic libraries |
|||
*.so |
|||
*.dylib |
|||
*.dll |
|||
|
|||
# Fortran module files |
|||
*.mod |
|||
*.smod |
|||
|
|||
# Compiled Static libraries |
|||
*.lai |
|||
*.la |
|||
*.a |
|||
*.lib |
|||
|
|||
# Executables |
|||
*.exe |
|||
*.out |
|||
*.app |
@ -0,0 +1,23 @@ |
|||
# OpenAPI Generator Ignore |
|||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator |
|||
|
|||
# Use this file to prevent files from being overwritten by the generator. |
|||
# The patterns follow closely to .gitignore or .dockerignore. |
|||
|
|||
# As an example, the C# client generator defines ApiClient.cs. |
|||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: |
|||
#ApiClient.cs |
|||
|
|||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): |
|||
#foo/*/qux |
|||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux |
|||
|
|||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): |
|||
#foo/**/qux |
|||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux |
|||
|
|||
# You can also negate patterns with an exclamation (!). |
|||
# For example, you can ignore all files in a docs folder with the file extension .md: |
|||
#docs/*.md |
|||
# Then explicitly reverse the ignore rule for a single file: |
|||
#!docs/README.md |
@ -0,0 +1,28 @@ |
|||
.gitignore |
|||
CMakeLists.txt |
|||
Config.cmake.in |
|||
README.md |
|||
git_push.sh |
|||
include/CppRestOpenAPIClient/ApiClient.h |
|||
include/CppRestOpenAPIClient/ApiConfiguration.h |
|||
include/CppRestOpenAPIClient/ApiException.h |
|||
include/CppRestOpenAPIClient/HttpContent.h |
|||
include/CppRestOpenAPIClient/IHttpBody.h |
|||
include/CppRestOpenAPIClient/JsonBody.h |
|||
include/CppRestOpenAPIClient/ModelBase.h |
|||
include/CppRestOpenAPIClient/MultipartFormData.h |
|||
include/CppRestOpenAPIClient/Object.h |
|||
include/CppRestOpenAPIClient/api/DefaultApi.h |
|||
include/CppRestOpenAPIClient/model/FileKey.h |
|||
include/CppRestOpenAPIClient/model/Location.h |
|||
src/ApiClient.cpp |
|||
src/ApiConfiguration.cpp |
|||
src/ApiException.cpp |
|||
src/HttpContent.cpp |
|||
src/JsonBody.cpp |
|||
src/ModelBase.cpp |
|||
src/MultipartFormData.cpp |
|||
src/Object.cpp |
|||
src/api/DefaultApi.cpp |
|||
src/model/FileKey.cpp |
|||
src/model/Location.cpp |
@ -0,0 +1 @@ |
|||
6.4.0 |
@ -0,0 +1,91 @@ |
|||
# |
|||
# Seaweedfs Master Server API |
|||
# The Seaweedfs Master Server API allows you to store blobs |
|||
# |
|||
# The version of the OpenAPI document: 1.0.0 |
|||
# |
|||
# https://openapi-generator.tech |
|||
# |
|||
# NOTE: Auto generated by OpenAPI Generator (https://openapi-generator.tech). |
|||
|
|||
cmake_minimum_required (VERSION 3.1) |
|||
|
|||
project(CppRestOpenAPIClient) |
|||
|
|||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) |
|||
set(CXX_STANDARD_REQUIRED ON) |
|||
|
|||
if(NOT CMAKE_CXX_STANDARD) |
|||
set(CMAKE_CXX_STANDARD 14) |
|||
endif() |
|||
|
|||
if(NOT CMAKE_BUILD_TYPE) |
|||
set(CMAKE_BUILD_TYPE Release) |
|||
endif() |
|||
|
|||
find_package(cpprestsdk REQUIRED) |
|||
find_package(Boost REQUIRED) |
|||
|
|||
include(GNUInstallDirs) |
|||
include(CMakePackageConfigHelpers) |
|||
|
|||
file(GLOB_RECURSE HEADER_FILES "include/*.h") |
|||
file(GLOB_RECURSE SOURCE_FILES "src/*.cpp") |
|||
|
|||
add_library(${PROJECT_NAME} ${HEADER_FILES} ${SOURCE_FILES}) |
|||
|
|||
target_compile_options(${PROJECT_NAME} |
|||
PRIVATE |
|||
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>: |
|||
-Wall -Wno-unused-variable> |
|||
) |
|||
|
|||
target_include_directories(${PROJECT_NAME} |
|||
PUBLIC |
|||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |
|||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> |
|||
) |
|||
|
|||
target_link_directories(${PROJECT_NAME} |
|||
PRIVATE |
|||
${Boost_LIBRARY_DIRS} |
|||
) |
|||
|
|||
if (UNIX) |
|||
message(STATUS "Building client library for Linux/Unix") |
|||
|
|||
target_link_libraries(${PROJECT_NAME} PUBLIC cpprest ${Boost_LIBRARIES} crypto) |
|||
else() |
|||
message(STATUS "Building client library for Windows") |
|||
|
|||
target_link_libraries(${PROJECT_NAME} PUBLIC cpprestsdk::cpprest ${Boost_LIBRARIES} bcrypt) |
|||
endif() |
|||
|
|||
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in |
|||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" |
|||
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" |
|||
) |
|||
|
|||
install( |
|||
TARGETS ${PROJECT_NAME} |
|||
EXPORT ${PROJECT_NAME}Targets |
|||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" |
|||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" |
|||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" |
|||
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" |
|||
) |
|||
|
|||
install( |
|||
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME} |
|||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} |
|||
) |
|||
|
|||
install( |
|||
FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" |
|||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} |
|||
) |
|||
|
|||
install( |
|||
EXPORT ${PROJECT_NAME}Targets |
|||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} |
|||
) |
@ -0,0 +1,5 @@ |
|||
@PACKAGE_INIT@ |
|||
|
|||
include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake) |
|||
|
|||
check_required_components("@PROJECT_NAME@") |
@ -0,0 +1,50 @@ |
|||
# C++ API client |
|||
|
|||
The Seaweedfs Master Server API allows you to store blobs |
|||
|
|||
## Overview |
|||
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI spec](https://openapis.org) from a remote server, you can easily generate an API client. |
|||
|
|||
- API version: 3.43.0 |
|||
- Package version: |
|||
- Build package: org.openapitools.codegen.languages.CppRestSdkClientCodegen |
|||
|
|||
- API namespace: org.openapitools.client.api |
|||
- Model namespace: org.openapitools.client.model |
|||
|
|||
## Installation |
|||
|
|||
### Prerequisites |
|||
|
|||
Install [cpprestsdk](https://github.com/Microsoft/cpprestsdk). |
|||
|
|||
- Windows: `vcpkg install cpprestsdk cpprestsdk:x64-windows boost-uuid boost-uuid:x64-windows` |
|||
- Mac: `brew install cpprestsdk` |
|||
- Linux: `sudo apt-get install libcpprest-dev` |
|||
|
|||
### Build |
|||
|
|||
```sh |
|||
cmake -DCPPREST_ROOT=/usr -DCMAKE_CXX_FLAGS="-I/usr/local/opt/openssl/include" -DCMAKE_MODULE_LINKER_FLAGS="-L/usr/local/opt/openssl/lib" |
|||
make |
|||
``` |
|||
|
|||
### Build on Windows with Visual Studio (VS2017) |
|||
|
|||
- Right click on folder containing source code |
|||
- Select 'Open in visual studio' |
|||
- Once visual studio opens, CMake should show up in top menu bar. |
|||
- Select CMake > Build All. |
|||
|
|||
*Note: If the CMake menu item doesn't show up in Visual Studio, CMake |
|||
for Visual Studio must be installed. In this case, open the 'Visual Studio |
|||
Installer' application. Select 'modify' Visual Studio 2017. Make sure |
|||
'Desktop Development with C++' is installed, and specifically that 'Visual |
|||
C++ tools for CMake' is selected in the 'Installation Details' section. |
|||
|
|||
Also be sure to review the CMakeLists.txt file. Edits are likely required.* |
|||
|
|||
## Author |
|||
|
|||
|
|||
|
@ -0,0 +1,57 @@ |
|||
#!/bin/sh |
|||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ |
|||
# |
|||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" |
|||
|
|||
git_user_id=$1 |
|||
git_repo_id=$2 |
|||
release_note=$3 |
|||
git_host=$4 |
|||
|
|||
if [ "$git_host" = "" ]; then |
|||
git_host="github.com" |
|||
echo "[INFO] No command line input provided. Set \$git_host to $git_host" |
|||
fi |
|||
|
|||
if [ "$git_user_id" = "" ]; then |
|||
git_user_id="GIT_USER_ID" |
|||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" |
|||
fi |
|||
|
|||
if [ "$git_repo_id" = "" ]; then |
|||
git_repo_id="GIT_REPO_ID" |
|||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" |
|||
fi |
|||
|
|||
if [ "$release_note" = "" ]; then |
|||
release_note="Minor update" |
|||
echo "[INFO] No command line input provided. Set \$release_note to $release_note" |
|||
fi |
|||
|
|||
# Initialize the local directory as a Git repository |
|||
git init |
|||
|
|||
# Adds the files in the local repository and stages them for commit. |
|||
git add . |
|||
|
|||
# Commits the tracked changes and prepares them to be pushed to a remote repository. |
|||
git commit -m "$release_note" |
|||
|
|||
# Sets the new remote |
|||
git_remote=$(git remote) |
|||
if [ "$git_remote" = "" ]; then # git remote not defined |
|||
|
|||
if [ "$GIT_TOKEN" = "" ]; then |
|||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." |
|||
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git |
|||
else |
|||
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git |
|||
fi |
|||
|
|||
fi |
|||
|
|||
git pull origin master |
|||
|
|||
# Pushes (Forces) the changes in the local repository up to the remote repository |
|||
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" |
|||
git push origin master 2>&1 | grep -v 'To https' |
@ -0,0 +1,114 @@ |
|||
/** |
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech |
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
/* |
|||
* ApiClient.h |
|||
* |
|||
* This is an API client responsible for stating the HTTP calls |
|||
*/ |
|||
|
|||
#ifndef ORG_OPENAPITOOLS_CLIENT_API_ApiClient_H_ |
|||
#define ORG_OPENAPITOOLS_CLIENT_API_ApiClient_H_ |
|||
|
|||
|
|||
#include "CppRestOpenAPIClient/ApiConfiguration.h" |
|||
#include "CppRestOpenAPIClient/ApiException.h" |
|||
#include "CppRestOpenAPIClient/IHttpBody.h" |
|||
#include "CppRestOpenAPIClient/HttpContent.h" |
|||
|
|||
#if defined (_WIN32) || defined (_WIN64) |
|||
#undef U |
|||
#endif |
|||
|
|||
#include <cpprest/details/basic_types.h> |
|||
#include <cpprest/http_client.h> |
|||
|
|||
#include <memory> |
|||
#include <vector> |
|||
#include <functional> |
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace api { |
|||
|
|||
using namespace org::openapitools::client::model; |
|||
|
|||
class ApiClient |
|||
{ |
|||
public: |
|||
ApiClient( std::shared_ptr<const ApiConfiguration> configuration = nullptr ); |
|||
virtual ~ApiClient(); |
|||
|
|||
typedef std::function<void(web::http::status_code, const web::http::http_headers&)> ResponseHandlerType; |
|||
|
|||
const ResponseHandlerType& getResponseHandler() const; |
|||
void setResponseHandler(const ResponseHandlerType& responseHandler); |
|||
|
|||
std::shared_ptr<const ApiConfiguration> getConfiguration() const; |
|||
void setConfiguration(std::shared_ptr<const ApiConfiguration> configuration); |
|||
|
|||
static utility::string_t parameterToString(utility::string_t value); |
|||
static utility::string_t parameterToString(int32_t value); |
|||
static utility::string_t parameterToString(int64_t value); |
|||
static utility::string_t parameterToString(float value); |
|||
static utility::string_t parameterToString(double value); |
|||
static utility::string_t parameterToString(const utility::datetime &value); |
|||
static utility::string_t parameterToString(bool value); |
|||
template<class T> |
|||
static utility::string_t parameterToString(const std::vector<T>& value); |
|||
template<class T> |
|||
static utility::string_t parameterToString(const std::shared_ptr<T>& value); |
|||
|
|||
pplx::task<web::http::http_response> callApi( |
|||
const utility::string_t& path, |
|||
const utility::string_t& method, |
|||
const std::map<utility::string_t, utility::string_t>& queryParams, |
|||
const std::shared_ptr<IHttpBody> postBody, |
|||
const std::map<utility::string_t, utility::string_t>& headerParams, |
|||
const std::map<utility::string_t, utility::string_t>& formParams, |
|||
const std::map<utility::string_t, std::shared_ptr<HttpContent>>& fileParams, |
|||
const utility::string_t& contentType |
|||
) const; |
|||
|
|||
protected: |
|||
|
|||
ResponseHandlerType m_ResponseHandler; |
|||
std::shared_ptr<const ApiConfiguration> m_Configuration; |
|||
}; |
|||
|
|||
template<class T> |
|||
utility::string_t ApiClient::parameterToString(const std::vector<T>& value) |
|||
{ |
|||
utility::stringstream_t ss; |
|||
|
|||
for( size_t i = 0; i < value.size(); i++) |
|||
{ |
|||
if( i > 0) ss << utility::conversions::to_string_t(", "); |
|||
ss << ApiClient::parameterToString(value[i]); |
|||
} |
|||
|
|||
return ss.str(); |
|||
} |
|||
|
|||
template<class T> |
|||
utility::string_t ApiClient::parameterToString(const std::shared_ptr<T>& value) |
|||
{ |
|||
return parameterToString(*value.get()); |
|||
} |
|||
|
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
#endif /* ORG_OPENAPITOOLS_CLIENT_API_ApiClient_H_ */ |
@ -0,0 +1,66 @@ |
|||
/** |
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech |
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
/* |
|||
* ApiConfiguration.h |
|||
* |
|||
* This class represents a single item of a multipart-formdata request. |
|||
*/ |
|||
|
|||
#ifndef ORG_OPENAPITOOLS_CLIENT_API_ApiConfiguration_H_ |
|||
#define ORG_OPENAPITOOLS_CLIENT_API_ApiConfiguration_H_ |
|||
|
|||
|
|||
|
|||
#include <cpprest/details/basic_types.h> |
|||
#include <cpprest/http_client.h> |
|||
|
|||
#include <map> |
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace api { |
|||
|
|||
class ApiConfiguration |
|||
{ |
|||
public: |
|||
ApiConfiguration(); |
|||
virtual ~ApiConfiguration(); |
|||
|
|||
const web::http::client::http_client_config& getHttpConfig() const; |
|||
void setHttpConfig( web::http::client::http_client_config& value ); |
|||
|
|||
utility::string_t getBaseUrl() const; |
|||
void setBaseUrl( const utility::string_t value ); |
|||
|
|||
utility::string_t getUserAgent() const; |
|||
void setUserAgent( const utility::string_t value ); |
|||
|
|||
std::map<utility::string_t, utility::string_t>& getDefaultHeaders(); |
|||
const std::map<utility::string_t, utility::string_t>& getDefaultHeaders() const; |
|||
|
|||
utility::string_t getApiKey( const utility::string_t& prefix) const; |
|||
void setApiKey( const utility::string_t& prefix, const utility::string_t& apiKey ); |
|||
|
|||
protected: |
|||
utility::string_t m_BaseUrl; |
|||
std::map<utility::string_t, utility::string_t> m_DefaultHeaders; |
|||
std::map<utility::string_t, utility::string_t> m_ApiKeys; |
|||
web::http::client::http_client_config m_HttpConfig; |
|||
utility::string_t m_UserAgent; |
|||
}; |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
#endif /* ORG_OPENAPITOOLS_CLIENT_API_ApiConfiguration_H_ */ |
@ -0,0 +1,60 @@ |
|||
/** |
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech |
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
/* |
|||
* ApiException.h |
|||
* |
|||
* This is the exception being thrown in case the api call was not successful |
|||
*/ |
|||
|
|||
#ifndef ORG_OPENAPITOOLS_CLIENT_API_ApiException_H_ |
|||
#define ORG_OPENAPITOOLS_CLIENT_API_ApiException_H_ |
|||
|
|||
|
|||
|
|||
#include <cpprest/details/basic_types.h> |
|||
#include <cpprest/http_msg.h> |
|||
|
|||
#include <memory> |
|||
#include <map> |
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace api { |
|||
|
|||
class ApiException |
|||
: public web::http::http_exception |
|||
{ |
|||
public: |
|||
ApiException( int errorCode |
|||
, const utility::string_t& message |
|||
, std::shared_ptr<std::istream> content = nullptr ); |
|||
ApiException( int errorCode |
|||
, const utility::string_t& message |
|||
, std::map<utility::string_t, utility::string_t>& headers |
|||
, std::shared_ptr<std::istream> content = nullptr ); |
|||
virtual ~ApiException(); |
|||
|
|||
std::map<utility::string_t, utility::string_t>& getHeaders(); |
|||
std::shared_ptr<std::istream> getContent() const; |
|||
|
|||
protected: |
|||
std::shared_ptr<std::istream> m_Content; |
|||
std::map<utility::string_t, utility::string_t> m_Headers; |
|||
}; |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
#endif /* ORG_OPENAPITOOLS_CLIENT_API_ApiBase_H_ */ |
@ -0,0 +1,69 @@ |
|||
/** |
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech |
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
/* |
|||
* HttpContent.h |
|||
* |
|||
* This class represents a single item of a multipart-formdata request. |
|||
*/ |
|||
|
|||
#ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_HttpContent_H_ |
|||
#define ORG_OPENAPITOOLS_CLIENT_MODEL_HttpContent_H_ |
|||
|
|||
|
|||
|
|||
#include <cpprest/details/basic_types.h> |
|||
|
|||
#include <memory> |
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace model { |
|||
|
|||
class HttpContent |
|||
{ |
|||
public: |
|||
HttpContent(); |
|||
virtual ~HttpContent(); |
|||
|
|||
virtual utility::string_t getContentDisposition() const; |
|||
virtual void setContentDisposition( const utility::string_t& value ); |
|||
|
|||
virtual utility::string_t getName() const; |
|||
virtual void setName( const utility::string_t& value ); |
|||
|
|||
virtual utility::string_t getFileName() const; |
|||
virtual void setFileName( const utility::string_t& value ); |
|||
|
|||
virtual utility::string_t getContentType() const; |
|||
virtual void setContentType( const utility::string_t& value ); |
|||
|
|||
virtual std::shared_ptr<std::istream> getData() const; |
|||
virtual void setData( std::shared_ptr<std::istream> value ); |
|||
|
|||
virtual void writeTo( std::ostream& stream ); |
|||
|
|||
protected: |
|||
// NOTE: no utility::string_t here because those strings can only contain ascii |
|||
utility::string_t m_ContentDisposition; |
|||
utility::string_t m_Name; |
|||
utility::string_t m_FileName; |
|||
utility::string_t m_ContentType; |
|||
std::shared_ptr<std::istream> m_Data; |
|||
}; |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
#endif /* ORG_OPENAPITOOLS_CLIENT_MODEL_HttpContent_H_ */ |
@ -0,0 +1,42 @@ |
|||
/** |
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech |
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
/* |
|||
* IHttpBody.h |
|||
* |
|||
* This is the interface for contents that can be sent to a remote HTTP server. |
|||
*/ |
|||
|
|||
#ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_IHttpBody_H_ |
|||
#define ORG_OPENAPITOOLS_CLIENT_MODEL_IHttpBody_H_ |
|||
|
|||
|
|||
#include <iostream> |
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace model { |
|||
|
|||
class IHttpBody |
|||
{ |
|||
public: |
|||
virtual ~IHttpBody() { } |
|||
|
|||
virtual void writeTo( std::ostream& stream ) = 0; |
|||
}; |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
#endif /* ORG_OPENAPITOOLS_CLIENT_MODEL_IHttpBody_H_ */ |
@ -0,0 +1,49 @@ |
|||
/** |
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech |
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
/* |
|||
* JsonBody.h |
|||
* |
|||
* This is a JSON http body which can be submitted via http |
|||
*/ |
|||
|
|||
#ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_JsonBody_H_ |
|||
#define ORG_OPENAPITOOLS_CLIENT_MODEL_JsonBody_H_ |
|||
|
|||
|
|||
#include "CppRestOpenAPIClient/IHttpBody.h" |
|||
|
|||
#include <cpprest/json.h> |
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace model { |
|||
|
|||
class JsonBody |
|||
: public IHttpBody |
|||
{ |
|||
public: |
|||
JsonBody( const web::json::value& value ); |
|||
virtual ~JsonBody(); |
|||
|
|||
void writeTo( std::ostream& target ) override; |
|||
|
|||
protected: |
|||
web::json::value m_Json; |
|||
}; |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
#endif /* ORG_OPENAPITOOLS_CLIENT_MODEL_JsonBody_H_ */ |
@ -0,0 +1,342 @@ |
|||
/** |
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech |
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
/* |
|||
* ModelBase.h |
|||
* |
|||
* This is the base class for all model classes |
|||
*/ |
|||
|
|||
#ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_ModelBase_H_ |
|||
#define ORG_OPENAPITOOLS_CLIENT_MODEL_ModelBase_H_ |
|||
|
|||
|
|||
|
|||
#include "CppRestOpenAPIClient/HttpContent.h" |
|||
#include "CppRestOpenAPIClient/MultipartFormData.h" |
|||
|
|||
#include <cpprest/details/basic_types.h> |
|||
#include <cpprest/json.h> |
|||
|
|||
#include <map> |
|||
#include <vector> |
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace model { |
|||
|
|||
class ModelBase |
|||
{ |
|||
public: |
|||
ModelBase(); |
|||
virtual ~ModelBase(); |
|||
|
|||
virtual void validate() = 0; |
|||
|
|||
virtual web::json::value toJson() const = 0; |
|||
virtual bool fromJson( const web::json::value& json ) = 0; |
|||
|
|||
virtual void toMultipart( std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix ) const = 0; |
|||
virtual bool fromMultiPart( std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix ) = 0; |
|||
|
|||
virtual bool isSet() const; |
|||
|
|||
static utility::string_t toString( const bool val ); |
|||
static utility::string_t toString( const float val ); |
|||
static utility::string_t toString( const double val ); |
|||
static utility::string_t toString( const int32_t val ); |
|||
static utility::string_t toString( const int64_t val ); |
|||
static utility::string_t toString( const utility::string_t &val ); |
|||
static utility::string_t toString( const utility::datetime &val ); |
|||
static utility::string_t toString( const web::json::value &val ); |
|||
static utility::string_t toString( const std::shared_ptr<HttpContent>& val ); |
|||
template <typename T> |
|||
static utility::string_t toString( const std::shared_ptr<T>& val ); |
|||
template <typename T> |
|||
static utility::string_t toString( const std::vector<T> & val ); |
|||
|
|||
static web::json::value toJson( bool val ); |
|||
static web::json::value toJson( float val ); |
|||
static web::json::value toJson( double val ); |
|||
static web::json::value toJson( int32_t val ); |
|||
static web::json::value toJson( int64_t val ); |
|||
static web::json::value toJson( const utility::string_t& val ); |
|||
static web::json::value toJson( const utility::datetime& val ); |
|||
static web::json::value toJson( const web::json::value& val ); |
|||
static web::json::value toJson( const std::shared_ptr<HttpContent>& val ); |
|||
template<typename T> |
|||
static web::json::value toJson( const std::shared_ptr<T>& val ); |
|||
static web::json::value toJson( const std::shared_ptr<utility::datetime>& val ); |
|||
template<typename T> |
|||
static web::json::value toJson( const std::vector<T>& val ); |
|||
template<typename T> |
|||
static web::json::value toJson( const std::map<utility::string_t, T>& val ); |
|||
|
|||
static bool fromString( const utility::string_t& val, bool & ); |
|||
static bool fromString( const utility::string_t& val, float & ); |
|||
static bool fromString( const utility::string_t& val, double & ); |
|||
static bool fromString( const utility::string_t& val, int32_t & ); |
|||
static bool fromString( const utility::string_t& val, int64_t & ); |
|||
static bool fromString( const utility::string_t& val, utility::string_t & ); |
|||
static bool fromString( const utility::string_t& val, utility::datetime & ); |
|||
static bool fromString( const utility::string_t& val, web::json::value & ); |
|||
static bool fromString( const utility::string_t& val, std::shared_ptr<HttpContent> & ); |
|||
template<typename T> |
|||
static bool fromString( const utility::string_t& val, std::shared_ptr<T>& ); |
|||
static bool fromString( const utility::string_t& val, std::shared_ptr<utility::datetime>& outVal ); |
|||
template<typename T> |
|||
static bool fromString( const utility::string_t& val, std::vector<T> & ); |
|||
template<typename T> |
|||
static bool fromString( const utility::string_t& val, std::map<utility::string_t, T> & ); |
|||
|
|||
static bool fromJson( const web::json::value& val, bool & ); |
|||
static bool fromJson( const web::json::value& val, float & ); |
|||
static bool fromJson( const web::json::value& val, double & ); |
|||
static bool fromJson( const web::json::value& val, int32_t & ); |
|||
static bool fromJson( const web::json::value& val, int64_t & ); |
|||
static bool fromJson( const web::json::value& val, utility::string_t & ); |
|||
static bool fromJson( const web::json::value& val, utility::datetime & ); |
|||
static bool fromJson( const web::json::value& val, web::json::value & ); |
|||
static bool fromJson( const web::json::value& val, std::shared_ptr<HttpContent> & ); |
|||
template<typename T> |
|||
static bool fromJson( const web::json::value& val, std::shared_ptr<T>& ); |
|||
static bool fromJson( const web::json::value& val, std::shared_ptr<utility::datetime> &outVal ); |
|||
template<typename T> |
|||
static bool fromJson( const web::json::value& val, std::vector<T> & ); |
|||
template<typename T> |
|||
static bool fromJson( const web::json::value& val, std::map<utility::string_t, T> & ); |
|||
|
|||
|
|||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, bool value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); |
|||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, float value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); |
|||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, double value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); |
|||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, int32_t value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); |
|||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, int64_t value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); |
|||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const utility::string_t& value, const utility::string_t& contentType = utility::conversions::to_string_t("")); |
|||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const utility::datetime& value, const utility::string_t& contentType = utility::conversions::to_string_t("")); |
|||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const web::json::value& value, const utility::string_t& contentType = utility::conversions::to_string_t("application/json") ); |
|||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const std::shared_ptr<HttpContent>& ); |
|||
template <typename T> |
|||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const std::shared_ptr<T>& , const utility::string_t& contentType = utility::conversions::to_string_t("application/json") ); |
|||
static std::shared_ptr<HttpContent> toHttpContent(const utility::string_t& name, const std::shared_ptr<utility::datetime>& value , const utility::string_t& contentType = utility::conversions::to_string_t("application/json") ); |
|||
template <typename T> |
|||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const std::vector<T>& value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); |
|||
template <typename T> |
|||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const std::map<utility::string_t, T>& value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); |
|||
|
|||
static bool fromHttpContent( std::shared_ptr<HttpContent> val, bool & ); |
|||
static bool fromHttpContent( std::shared_ptr<HttpContent> val, float & ); |
|||
static bool fromHttpContent( std::shared_ptr<HttpContent> val, double & ); |
|||
static bool fromHttpContent( std::shared_ptr<HttpContent> val, int64_t & ); |
|||
static bool fromHttpContent( std::shared_ptr<HttpContent> val, int32_t & ); |
|||
static bool fromHttpContent( std::shared_ptr<HttpContent> val, utility::string_t & ); |
|||
static bool fromHttpContent( std::shared_ptr<HttpContent> val, utility::datetime & ); |
|||
static bool fromHttpContent( std::shared_ptr<HttpContent> val, web::json::value & ); |
|||
static bool fromHttpContent( std::shared_ptr<HttpContent> val, std::shared_ptr<HttpContent>& ); |
|||
template <typename T> |
|||
static bool fromHttpContent( std::shared_ptr<HttpContent> val, std::shared_ptr<T>& ); |
|||
template <typename T> |
|||
static bool fromHttpContent( std::shared_ptr<HttpContent> val, std::vector<T> & ); |
|||
template <typename T> |
|||
static bool fromHttpContent( std::shared_ptr<HttpContent> val, std::map<utility::string_t, T> & ); |
|||
|
|||
static utility::string_t toBase64( utility::string_t value ); |
|||
static utility::string_t toBase64( std::shared_ptr<std::istream> value ); |
|||
static std::shared_ptr<std::istream> fromBase64( const utility::string_t& encoded ); |
|||
protected: |
|||
bool m_IsSet; |
|||
}; |
|||
|
|||
template <typename T> |
|||
utility::string_t ModelBase::toString( const std::shared_ptr<T>& val ) |
|||
{ |
|||
utility::stringstream_t ss; |
|||
if( val != nullptr ) |
|||
{ |
|||
val->toJson().serialize(ss); |
|||
} |
|||
return utility::string_t(ss.str()); |
|||
} |
|||
template<typename T> |
|||
utility::string_t ModelBase::toString( const std::vector<T> & val ) |
|||
{ |
|||
utility::string_t strArray; |
|||
for ( const auto &item : val ) |
|||
{ |
|||
strArray.append( toString(item) + "," ); |
|||
} |
|||
if (val.count() > 0) |
|||
{ |
|||
strArray.pop_back(); |
|||
} |
|||
return strArray; |
|||
} |
|||
template<typename T> |
|||
web::json::value ModelBase::toJson( const std::shared_ptr<T>& val ) |
|||
{ |
|||
web::json::value retVal; |
|||
if(val != nullptr) |
|||
{ |
|||
retVal = val->toJson(); |
|||
} |
|||
return retVal; |
|||
} |
|||
template<typename T> |
|||
web::json::value ModelBase::toJson( const std::vector<T>& value ) |
|||
{ |
|||
std::vector<web::json::value> ret; |
|||
for ( const auto& x : value ) |
|||
{ |
|||
ret.push_back( toJson(x) ); |
|||
} |
|||
return web::json::value::array(ret); |
|||
} |
|||
template<typename T> |
|||
web::json::value ModelBase::toJson( const std::map<utility::string_t, T>& val ) |
|||
{ |
|||
web::json::value obj; |
|||
for ( const auto &itemkey : val ) |
|||
{ |
|||
obj[itemkey.first] = toJson( itemkey.second ); |
|||
} |
|||
return obj; |
|||
} |
|||
template<typename T> |
|||
bool ModelBase::fromString( const utility::string_t& val, std::shared_ptr<T>& outVal ) |
|||
{ |
|||
bool ok = false; |
|||
if(outVal == nullptr) |
|||
{ |
|||
outVal = std::shared_ptr<T>(new T()); |
|||
} |
|||
if( outVal != nullptr ) |
|||
{ |
|||
ok = outVal->fromJson(web::json::value::parse(val)); |
|||
} |
|||
return ok; |
|||
} |
|||
template<typename T> |
|||
bool ModelBase::fromJson( const web::json::value& val, std::shared_ptr<T> &outVal ) |
|||
{ |
|||
bool ok = false; |
|||
if(outVal == nullptr) |
|||
{ |
|||
outVal = std::shared_ptr<T>(new T()); |
|||
} |
|||
if( outVal != nullptr ) |
|||
{ |
|||
ok = outVal->fromJson(val); |
|||
} |
|||
return ok; |
|||
} |
|||
template<typename T> |
|||
bool ModelBase::fromJson( const web::json::value& val, std::vector<T> &outVal ) |
|||
{ |
|||
bool ok = true; |
|||
if (val.is_array()) |
|||
{ |
|||
for (const auto jitem : val.as_array()) |
|||
{ |
|||
T item; |
|||
ok &= fromJson(jitem, item); |
|||
outVal.push_back(item); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
ok = false; |
|||
} |
|||
return ok; |
|||
} |
|||
template<typename T> |
|||
bool ModelBase::fromJson( const web::json::value& jval, std::map<utility::string_t, T> &outVal ) |
|||
{ |
|||
bool ok = true; |
|||
if ( jval.is_object() ) |
|||
{ |
|||
auto obj = jval.as_object(); |
|||
for( auto objItr = obj.begin() ; objItr != obj.end() ; objItr++ ) |
|||
{ |
|||
T itemVal; |
|||
ok &= fromJson(objItr->second, itemVal); |
|||
outVal.insert(std::pair<utility::string_t, T>(objItr->first, itemVal)); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
ok = false; |
|||
} |
|||
return ok; |
|||
} |
|||
template <typename T> |
|||
std::shared_ptr<HttpContent> ModelBase::toHttpContent(const utility::string_t& name, const std::shared_ptr<T>& value , const utility::string_t& contentType ) |
|||
{ |
|||
std::shared_ptr<HttpContent> content( new HttpContent ); |
|||
if (value != nullptr ) |
|||
{ |
|||
content->setName( name ); |
|||
content->setContentDisposition( utility::conversions::to_string_t("form-data") ); |
|||
content->setContentType( contentType ); |
|||
content->setData( std::shared_ptr<std::istream>( new std::stringstream( utility::conversions::to_utf8string( value->toJson().serialize() ) ) ) ); |
|||
} |
|||
return content; |
|||
} |
|||
template <typename T> |
|||
std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t& name, const std::vector<T>& value, const utility::string_t& contentType ) |
|||
{ |
|||
web::json::value json_array = ModelBase::toJson(value); |
|||
std::shared_ptr<HttpContent> content( new HttpContent ); |
|||
content->setName( name ); |
|||
content->setContentDisposition( utility::conversions::to_string_t("form-data") ); |
|||
content->setContentType( contentType ); |
|||
content->setData( std::shared_ptr<std::istream>( new std::stringstream( utility::conversions::to_utf8string(json_array.serialize()) ) ) ); |
|||
return content; |
|||
} |
|||
template <typename T> |
|||
std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t& name, const std::map<utility::string_t, T>& value, const utility::string_t& contentType ) |
|||
{ |
|||
web::json::value jobj = ModelBase::toJson(value); |
|||
std::shared_ptr<HttpContent> content( new HttpContent ); |
|||
content->setName( name ); |
|||
content->setContentDisposition( utility::conversions::to_string_t("form-data") ); |
|||
content->setContentType( contentType ); |
|||
content->setData( std::shared_ptr<std::istream>( new std::stringstream( utility::conversions::to_utf8string(jobj.serialize()) ) ) ); |
|||
return content; |
|||
} |
|||
template <typename T> |
|||
bool ModelBase::fromHttpContent( std::shared_ptr<HttpContent> val, std::shared_ptr<T>& outVal ) |
|||
{ |
|||
utility::string_t str; |
|||
if(val == nullptr) return false; |
|||
if( outVal == nullptr ) |
|||
{ |
|||
outVal = std::shared_ptr<T>(new T()); |
|||
} |
|||
ModelBase::fromHttpContent(val, str); |
|||
return fromString(str, outVal); |
|||
} |
|||
template <typename T> |
|||
bool ModelBase::fromHttpContent( std::shared_ptr<HttpContent> val, std::vector<T> & ) |
|||
{ |
|||
return true; |
|||
} |
|||
template <typename T> |
|||
bool ModelBase::fromHttpContent( std::shared_ptr<HttpContent> val, std::map<utility::string_t, T> & ) |
|||
{ |
|||
return true; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
#endif /* ORG_OPENAPITOOLS_CLIENT_MODEL_ModelBase_H_ */ |
@ -0,0 +1,61 @@ |
|||
/** |
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech |
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
/* |
|||
* MultipartFormData.h |
|||
* |
|||
* This class represents a container for building application/x-multipart-formdata requests. |
|||
*/ |
|||
|
|||
#ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_MultipartFormData_H_ |
|||
#define ORG_OPENAPITOOLS_CLIENT_MODEL_MultipartFormData_H_ |
|||
|
|||
|
|||
#include "CppRestOpenAPIClient/IHttpBody.h" |
|||
#include "CppRestOpenAPIClient/HttpContent.h" |
|||
|
|||
#include <cpprest/details/basic_types.h> |
|||
|
|||
#include <vector> |
|||
#include <map> |
|||
#include <memory> |
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace model { |
|||
|
|||
class MultipartFormData |
|||
: public IHttpBody |
|||
{ |
|||
public: |
|||
MultipartFormData(); |
|||
MultipartFormData(const utility::string_t& boundary); |
|||
virtual ~MultipartFormData(); |
|||
|
|||
virtual void add( std::shared_ptr<HttpContent> content ); |
|||
virtual utility::string_t getBoundary(); |
|||
virtual std::shared_ptr<HttpContent> getContent(const utility::string_t& name) const; |
|||
virtual bool hasContent(const utility::string_t& name) const; |
|||
virtual void writeTo( std::ostream& target ); |
|||
|
|||
protected: |
|||
std::vector<std::shared_ptr<HttpContent>> m_Contents; |
|||
utility::string_t m_Boundary; |
|||
std::map<utility::string_t, std::shared_ptr<HttpContent>> m_ContentLookup; |
|||
}; |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
#endif /* ORG_OPENAPITOOLS_CLIENT_MODEL_MultipartFormData_H_ */ |
@ -0,0 +1,62 @@ |
|||
/** |
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech |
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
/* |
|||
* Object.h |
|||
* |
|||
* This is the implementation of a JSON object. |
|||
*/ |
|||
|
|||
#ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_Object_H_ |
|||
#define ORG_OPENAPITOOLS_CLIENT_MODEL_Object_H_ |
|||
|
|||
|
|||
#include "CppRestOpenAPIClient/ModelBase.h" |
|||
|
|||
#include <cpprest/details/basic_types.h> |
|||
#include <cpprest/json.h> |
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace model { |
|||
|
|||
class Object : public ModelBase |
|||
{ |
|||
public: |
|||
Object(); |
|||
virtual ~Object(); |
|||
|
|||
///////////////////////////////////////////// |
|||
/// ModelBase overrides |
|||
void validate() override; |
|||
|
|||
web::json::value toJson() const override; |
|||
bool fromJson(const web::json::value& json) override; |
|||
|
|||
void toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) const override; |
|||
bool fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) override; |
|||
|
|||
///////////////////////////////////////////// |
|||
/// Object manipulation |
|||
web::json::value getValue(const utility::string_t& key) const; |
|||
void setValue(const utility::string_t& key, const web::json::value& value); |
|||
|
|||
private: |
|||
web::json::value m_object; |
|||
}; |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
#endif /* ORG_OPENAPITOOLS_CLIENT_MODEL_Object_H_ */ |
@ -0,0 +1,103 @@ |
|||
/** |
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech |
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
/* |
|||
* DefaultApi.h |
|||
* |
|||
* |
|||
*/ |
|||
|
|||
#ifndef ORG_OPENAPITOOLS_CLIENT_API_DefaultApi_H_ |
|||
#define ORG_OPENAPITOOLS_CLIENT_API_DefaultApi_H_ |
|||
|
|||
|
|||
|
|||
#include "CppRestOpenAPIClient/ApiClient.h" |
|||
|
|||
#include "CppRestOpenAPIClient/model/AnyType.h" |
|||
#include "CppRestOpenAPIClient/model/FileKey.h" |
|||
#include <boost/optional.hpp> |
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace api { |
|||
|
|||
using namespace org::openapitools::client::model; |
|||
|
|||
|
|||
|
|||
class DefaultApi |
|||
{ |
|||
public: |
|||
|
|||
explicit DefaultApi( std::shared_ptr<const ApiClient> apiClient ); |
|||
|
|||
virtual ~DefaultApi(); |
|||
|
|||
/// <summary> |
|||
/// Assign a file key |
|||
/// </summary> |
|||
/// <remarks> |
|||
/// This operation is very cheap. Just increase a number in master server's memory. |
|||
/// </remarks> |
|||
/// <param name="count">how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 (optional, default to nullptr)</param> |
|||
/// <param name="collection">required collection name (optional, default to nullptr)</param> |
|||
/// <param name="dataCenter">preferred data center (optional, default to nullptr)</param> |
|||
/// <param name="rack">preferred rack (optional, default to nullptr)</param> |
|||
/// <param name="dataNode">preferred volume server, e.g. 127.0.0.1:8080 (optional, default to nullptr)</param> |
|||
/// <param name="disk">If you have disks labelled, this must be supplied to specify the disk type to allocate on. (optional, default to nullptr)</param> |
|||
/// <param name="replication">replica placement strategy (optional, default to nullptr)</param> |
|||
/// <param name="ttl">file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year (optional, default to nullptr)</param> |
|||
/// <param name="preallocate">If no matching volumes, pre-allocate this number of bytes on disk for new volumes. (optional, default to nullptr)</param> |
|||
/// <param name="memoryMapMaxSizeMb">Only implemented for windows. Use memory mapped files with specified size for new volumes. (optional, default to nullptr)</param> |
|||
/// <param name="writableVolumeCount">If no matching volumes, create specified number of new volumes. (optional, default to nullptr)</param> |
|||
pplx::task<std::shared_ptr<FileKey>> dirAssign( |
|||
boost::optional<std::shared_ptr<AnyType>> count, |
|||
boost::optional<std::shared_ptr<AnyType>> collection, |
|||
boost::optional<std::shared_ptr<AnyType>> dataCenter, |
|||
boost::optional<std::shared_ptr<AnyType>> rack, |
|||
boost::optional<std::shared_ptr<AnyType>> dataNode, |
|||
boost::optional<std::shared_ptr<AnyType>> disk, |
|||
boost::optional<std::shared_ptr<AnyType>> replication, |
|||
boost::optional<std::shared_ptr<AnyType>> ttl, |
|||
boost::optional<std::shared_ptr<AnyType>> preallocate, |
|||
boost::optional<std::shared_ptr<AnyType>> memoryMapMaxSizeMb, |
|||
boost::optional<std::shared_ptr<AnyType>> writableVolumeCount |
|||
) const; |
|||
/// <summary> |
|||
/// Lookup volume |
|||
/// </summary> |
|||
/// <remarks> |
|||
/// We would need to find out whether the volumes have moved. |
|||
/// </remarks> |
|||
/// <param name="volumeId">volume id (optional, default to nullptr)</param> |
|||
/// <param name="collection">optionally to speed up the lookup (optional, default to nullptr)</param> |
|||
/// <param name="fileId">If provided, this returns the fileId location and a JWT to update or delete the file. (optional, default to nullptr)</param> |
|||
/// <param name="read">works together with \"fileId\", if read=yes, JWT is generated for reads. (optional, default to nullptr)</param> |
|||
pplx::task<std::shared_ptr<AnyType>> dirLookup( |
|||
boost::optional<std::shared_ptr<AnyType>> volumeId, |
|||
boost::optional<std::shared_ptr<AnyType>> collection, |
|||
boost::optional<std::shared_ptr<AnyType>> fileId, |
|||
boost::optional<std::shared_ptr<AnyType>> read |
|||
) const; |
|||
|
|||
protected: |
|||
std::shared_ptr<const ApiClient> m_ApiClient; |
|||
}; |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
#endif /* ORG_OPENAPITOOLS_CLIENT_API_DefaultApi_H_ */ |
|||
|
@ -0,0 +1,99 @@ |
|||
/** |
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech |
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
/* |
|||
* FileKey.h |
|||
* |
|||
* |
|||
*/ |
|||
|
|||
#ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_FileKey_H_ |
|||
#define ORG_OPENAPITOOLS_CLIENT_MODEL_FileKey_H_ |
|||
|
|||
|
|||
#include "CppRestOpenAPIClient/ModelBase.h" |
|||
|
|||
#include "CppRestOpenAPIClient/model/AnyType.h" |
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace model { |
|||
|
|||
|
|||
/// <summary> |
|||
/// |
|||
/// </summary> |
|||
class FileKey |
|||
: public ModelBase |
|||
{ |
|||
public: |
|||
FileKey(); |
|||
virtual ~FileKey(); |
|||
|
|||
///////////////////////////////////////////// |
|||
/// ModelBase overrides |
|||
|
|||
void validate() override; |
|||
|
|||
web::json::value toJson() const override; |
|||
bool fromJson(const web::json::value& json) override; |
|||
|
|||
void toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) const override; |
|||
bool fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) override; |
|||
|
|||
///////////////////////////////////////////// |
|||
/// FileKey members |
|||
|
|||
/// <summary> |
|||
/// |
|||
/// </summary> |
|||
std::shared_ptr<AnyType> getCount() const; |
|||
bool countIsSet() const; |
|||
void unsetCount(); |
|||
|
|||
void setCount(const std::shared_ptr<AnyType>& value); |
|||
|
|||
/// <summary> |
|||
/// |
|||
/// </summary> |
|||
std::shared_ptr<AnyType> getFid() const; |
|||
bool fidIsSet() const; |
|||
void unsetFid(); |
|||
|
|||
void setFid(const std::shared_ptr<AnyType>& value); |
|||
|
|||
/// <summary> |
|||
/// |
|||
/// </summary> |
|||
std::shared_ptr<AnyType> getUrl() const; |
|||
bool urlIsSet() const; |
|||
void unsetUrl(); |
|||
|
|||
void setUrl(const std::shared_ptr<AnyType>& value); |
|||
|
|||
|
|||
protected: |
|||
std::shared_ptr<AnyType> m_Count; |
|||
bool m_CountIsSet; |
|||
std::shared_ptr<AnyType> m_Fid; |
|||
bool m_FidIsSet; |
|||
std::shared_ptr<AnyType> m_Url; |
|||
bool m_UrlIsSet; |
|||
}; |
|||
|
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
#endif /* ORG_OPENAPITOOLS_CLIENT_MODEL_FileKey_H_ */ |
@ -0,0 +1,88 @@ |
|||
/** |
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech |
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
/* |
|||
* Location.h |
|||
* |
|||
* |
|||
*/ |
|||
|
|||
#ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_Location_H_ |
|||
#define ORG_OPENAPITOOLS_CLIENT_MODEL_Location_H_ |
|||
|
|||
|
|||
#include "CppRestOpenAPIClient/ModelBase.h" |
|||
|
|||
#include "CppRestOpenAPIClient/model/AnyType.h" |
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace model { |
|||
|
|||
|
|||
/// <summary> |
|||
/// |
|||
/// </summary> |
|||
class Location |
|||
: public ModelBase |
|||
{ |
|||
public: |
|||
Location(); |
|||
virtual ~Location(); |
|||
|
|||
///////////////////////////////////////////// |
|||
/// ModelBase overrides |
|||
|
|||
void validate() override; |
|||
|
|||
web::json::value toJson() const override; |
|||
bool fromJson(const web::json::value& json) override; |
|||
|
|||
void toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) const override; |
|||
bool fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) override; |
|||
|
|||
///////////////////////////////////////////// |
|||
/// Location members |
|||
|
|||
/// <summary> |
|||
/// |
|||
/// </summary> |
|||
std::shared_ptr<AnyType> getPublicUrl() const; |
|||
bool publicUrlIsSet() const; |
|||
void unsetPublicUrl(); |
|||
|
|||
void setPublicUrl(const std::shared_ptr<AnyType>& value); |
|||
|
|||
/// <summary> |
|||
/// |
|||
/// </summary> |
|||
std::shared_ptr<AnyType> getUrl() const; |
|||
bool urlIsSet() const; |
|||
void unsetUrl(); |
|||
|
|||
void setUrl(const std::shared_ptr<AnyType>& value); |
|||
|
|||
|
|||
protected: |
|||
std::shared_ptr<AnyType> m_PublicUrl; |
|||
bool m_PublicUrlIsSet; |
|||
std::shared_ptr<AnyType> m_Url; |
|||
bool m_UrlIsSet; |
|||
}; |
|||
|
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
#endif /* ORG_OPENAPITOOLS_CLIENT_MODEL_Location_H_ */ |
@ -0,0 +1,208 @@ |
|||
/**
|
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech
|
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
#include "CppRestOpenAPIClient/ApiClient.h"
|
|||
#include "CppRestOpenAPIClient/MultipartFormData.h"
|
|||
#include "CppRestOpenAPIClient/ModelBase.h"
|
|||
|
|||
#include <sstream>
|
|||
#include <limits>
|
|||
#include <iomanip>
|
|||
|
|||
template <typename T> |
|||
utility::string_t toString(const T value) |
|||
{ |
|||
utility::ostringstream_t out; |
|||
out << std::setprecision(std::numeric_limits<T>::digits10) << std::fixed << value; |
|||
return out.str(); |
|||
} |
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace api { |
|||
|
|||
using namespace org::openapitools::client::model; |
|||
|
|||
ApiClient::ApiClient(std::shared_ptr<const ApiConfiguration> configuration ) |
|||
: m_Configuration(configuration) |
|||
{ |
|||
} |
|||
ApiClient::~ApiClient() |
|||
{ |
|||
} |
|||
|
|||
const ApiClient::ResponseHandlerType& ApiClient::getResponseHandler() const { |
|||
return m_ResponseHandler; |
|||
} |
|||
|
|||
void ApiClient::setResponseHandler(const ResponseHandlerType& responseHandler) { |
|||
m_ResponseHandler = responseHandler; |
|||
} |
|||
|
|||
std::shared_ptr<const ApiConfiguration> ApiClient::getConfiguration() const |
|||
{ |
|||
return m_Configuration; |
|||
} |
|||
void ApiClient::setConfiguration(std::shared_ptr<const ApiConfiguration> configuration) |
|||
{ |
|||
m_Configuration = configuration; |
|||
} |
|||
|
|||
|
|||
utility::string_t ApiClient::parameterToString(utility::string_t value) |
|||
{ |
|||
return value; |
|||
} |
|||
utility::string_t ApiClient::parameterToString(int64_t value) |
|||
{ |
|||
std::stringstream valueAsStringStream; |
|||
valueAsStringStream << value; |
|||
return utility::conversions::to_string_t(valueAsStringStream.str()); |
|||
} |
|||
utility::string_t ApiClient::parameterToString(int32_t value) |
|||
{ |
|||
std::stringstream valueAsStringStream; |
|||
valueAsStringStream << value; |
|||
return utility::conversions::to_string_t(valueAsStringStream.str()); |
|||
} |
|||
|
|||
utility::string_t ApiClient::parameterToString(float value) |
|||
{ |
|||
return utility::conversions::to_string_t(toString(value)); |
|||
} |
|||
|
|||
utility::string_t ApiClient::parameterToString(double value) |
|||
{ |
|||
return utility::conversions::to_string_t(toString(value)); |
|||
} |
|||
|
|||
utility::string_t ApiClient::parameterToString(const utility::datetime &value) |
|||
{ |
|||
return utility::conversions::to_string_t(value.to_string(utility::datetime::ISO_8601)); |
|||
} |
|||
|
|||
utility::string_t ApiClient::parameterToString(bool value) |
|||
{ |
|||
std::stringstream valueAsStringStream; |
|||
valueAsStringStream << std::boolalpha << value; |
|||
return utility::conversions::to_string_t(valueAsStringStream.str()); |
|||
} |
|||
|
|||
pplx::task<web::http::http_response> ApiClient::callApi( |
|||
const utility::string_t& path, |
|||
const utility::string_t& method, |
|||
const std::map<utility::string_t, utility::string_t>& queryParams, |
|||
const std::shared_ptr<IHttpBody> postBody, |
|||
const std::map<utility::string_t, utility::string_t>& headerParams, |
|||
const std::map<utility::string_t, utility::string_t>& formParams, |
|||
const std::map<utility::string_t, std::shared_ptr<HttpContent>>& fileParams, |
|||
const utility::string_t& contentType |
|||
) const |
|||
{ |
|||
if (postBody != nullptr && formParams.size() != 0) |
|||
{ |
|||
throw ApiException(400, utility::conversions::to_string_t("Cannot have body and form params")); |
|||
} |
|||
|
|||
if (postBody != nullptr && fileParams.size() != 0) |
|||
{ |
|||
throw ApiException(400, utility::conversions::to_string_t("Cannot have body and file params")); |
|||
} |
|||
|
|||
if (fileParams.size() > 0 && contentType != utility::conversions::to_string_t("multipart/form-data")) |
|||
{ |
|||
throw ApiException(400, utility::conversions::to_string_t("Operations with file parameters must be called with multipart/form-data")); |
|||
} |
|||
|
|||
web::http::client::http_client client(m_Configuration->getBaseUrl(), m_Configuration->getHttpConfig()); |
|||
|
|||
web::http::http_request request; |
|||
for (const auto& kvp : headerParams) |
|||
{ |
|||
request.headers().add(kvp.first, kvp.second); |
|||
} |
|||
|
|||
if (fileParams.size() > 0) |
|||
{ |
|||
MultipartFormData uploadData; |
|||
for (const auto& kvp : formParams) |
|||
{ |
|||
uploadData.add(ModelBase::toHttpContent(kvp.first, kvp.second)); |
|||
} |
|||
for (const auto& kvp : fileParams) |
|||
{ |
|||
uploadData.add(ModelBase::toHttpContent(kvp.first, kvp.second)); |
|||
} |
|||
std::stringstream data; |
|||
uploadData.writeTo(data); |
|||
auto bodyString = data.str(); |
|||
const auto length = bodyString.size(); |
|||
request.set_body(concurrency::streams::bytestream::open_istream(std::move(bodyString)), length, utility::conversions::to_string_t("multipart/form-data; boundary=") + uploadData.getBoundary()); |
|||
} |
|||
else |
|||
{ |
|||
if (postBody != nullptr) |
|||
{ |
|||
std::stringstream data; |
|||
postBody->writeTo(data); |
|||
auto bodyString = data.str(); |
|||
const auto length = bodyString.size(); |
|||
request.set_body(concurrency::streams::bytestream::open_istream(std::move(bodyString)), length, contentType); |
|||
} |
|||
else |
|||
{ |
|||
if (contentType == utility::conversions::to_string_t("application/json")) |
|||
{ |
|||
web::json::value body_data = web::json::value::object(); |
|||
for (auto& kvp : formParams) |
|||
{ |
|||
body_data[kvp.first] = ModelBase::toJson(kvp.second); |
|||
} |
|||
if (!formParams.empty()) |
|||
{ |
|||
request.set_body(body_data); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
web::http::uri_builder formData; |
|||
for (const auto& kvp : formParams) |
|||
{ |
|||
formData.append_query(kvp.first, kvp.second); |
|||
} |
|||
if (!formParams.empty()) |
|||
{ |
|||
request.set_body(formData.query(), utility::conversions::to_string_t("application/x-www-form-urlencoded")); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
web::http::uri_builder builder(path); |
|||
for (const auto& kvp : queryParams) |
|||
{ |
|||
builder.append_query(kvp.first, kvp.second); |
|||
} |
|||
request.set_request_uri(builder.to_uri()); |
|||
request.set_method(method); |
|||
if ( !request.headers().has( web::http::header_names::user_agent ) ) |
|||
{ |
|||
request.headers().add( web::http::header_names::user_agent, m_Configuration->getUserAgent() ); |
|||
} |
|||
|
|||
return client.request(request); |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,85 @@ |
|||
/**
|
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech
|
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
#include "CppRestOpenAPIClient/ApiConfiguration.h"
|
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace api { |
|||
|
|||
ApiConfiguration::ApiConfiguration() |
|||
{ |
|||
} |
|||
|
|||
ApiConfiguration::~ApiConfiguration() |
|||
{ |
|||
} |
|||
|
|||
const web::http::client::http_client_config& ApiConfiguration::getHttpConfig() const |
|||
{ |
|||
return m_HttpConfig; |
|||
} |
|||
|
|||
void ApiConfiguration::setHttpConfig( web::http::client::http_client_config& value ) |
|||
{ |
|||
m_HttpConfig = value; |
|||
} |
|||
|
|||
utility::string_t ApiConfiguration::getBaseUrl() const |
|||
{ |
|||
return m_BaseUrl; |
|||
} |
|||
|
|||
void ApiConfiguration::setBaseUrl( const utility::string_t value ) |
|||
{ |
|||
m_BaseUrl = value; |
|||
} |
|||
|
|||
utility::string_t ApiConfiguration::getUserAgent() const |
|||
{ |
|||
return m_UserAgent; |
|||
} |
|||
|
|||
void ApiConfiguration::setUserAgent( const utility::string_t value ) |
|||
{ |
|||
m_UserAgent = value; |
|||
} |
|||
|
|||
std::map<utility::string_t, utility::string_t>& ApiConfiguration::getDefaultHeaders() |
|||
{ |
|||
return m_DefaultHeaders; |
|||
} |
|||
|
|||
const std::map<utility::string_t, utility::string_t>& ApiConfiguration::getDefaultHeaders() const |
|||
{ |
|||
return m_DefaultHeaders; |
|||
} |
|||
|
|||
utility::string_t ApiConfiguration::getApiKey( const utility::string_t& prefix) const |
|||
{ |
|||
auto result = m_ApiKeys.find(prefix); |
|||
if( result != m_ApiKeys.end() ) |
|||
{ |
|||
return result->second; |
|||
} |
|||
return utility::conversions::to_string_t(""); |
|||
} |
|||
|
|||
void ApiConfiguration::setApiKey( const utility::string_t& prefix, const utility::string_t& apiKey ) |
|||
{ |
|||
m_ApiKeys[prefix] = apiKey; |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,53 @@ |
|||
/**
|
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech
|
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
#include "CppRestOpenAPIClient/ApiException.h"
|
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace api { |
|||
|
|||
ApiException::ApiException( int errorCode |
|||
, const utility::string_t& message |
|||
, std::shared_ptr<std::istream> content /*= nullptr*/ ) |
|||
: web::http::http_exception( errorCode, message ) |
|||
, m_Content(content) |
|||
{ |
|||
} |
|||
ApiException::ApiException( int errorCode |
|||
, const utility::string_t& message |
|||
, std::map<utility::string_t, utility::string_t>& headers |
|||
, std::shared_ptr<std::istream> content /*= nullptr*/ ) |
|||
: web::http::http_exception( errorCode, message ) |
|||
, m_Content(content) |
|||
, m_Headers(headers) |
|||
{ |
|||
} |
|||
|
|||
ApiException::~ApiException() |
|||
{ |
|||
} |
|||
|
|||
std::shared_ptr<std::istream> ApiException::getContent() const |
|||
{ |
|||
return m_Content; |
|||
} |
|||
|
|||
std::map<utility::string_t, utility::string_t>& ApiException::getHeaders() |
|||
{ |
|||
return m_Headers; |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,86 @@ |
|||
/**
|
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech
|
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
#include "CppRestOpenAPIClient/HttpContent.h"
|
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace model { |
|||
|
|||
HttpContent::HttpContent() |
|||
{ |
|||
} |
|||
|
|||
HttpContent::~HttpContent() |
|||
{ |
|||
} |
|||
|
|||
utility::string_t HttpContent::getContentDisposition() const |
|||
{ |
|||
return m_ContentDisposition; |
|||
} |
|||
|
|||
void HttpContent::setContentDisposition( const utility::string_t & value ) |
|||
{ |
|||
m_ContentDisposition = value; |
|||
} |
|||
|
|||
utility::string_t HttpContent::getName() const |
|||
{ |
|||
return m_Name; |
|||
} |
|||
|
|||
void HttpContent::setName( const utility::string_t & value ) |
|||
{ |
|||
m_Name = value; |
|||
} |
|||
|
|||
utility::string_t HttpContent::getFileName() const |
|||
{ |
|||
return m_FileName; |
|||
} |
|||
|
|||
void HttpContent::setFileName( const utility::string_t & value ) |
|||
{ |
|||
m_FileName = value; |
|||
} |
|||
|
|||
utility::string_t HttpContent::getContentType() const |
|||
{ |
|||
return m_ContentType; |
|||
} |
|||
|
|||
void HttpContent::setContentType( const utility::string_t & value ) |
|||
{ |
|||
m_ContentType = value; |
|||
} |
|||
|
|||
std::shared_ptr<std::istream> HttpContent::getData() const |
|||
{ |
|||
return m_Data; |
|||
} |
|||
|
|||
void HttpContent::setData( std::shared_ptr<std::istream> value ) |
|||
{ |
|||
m_Data = value; |
|||
} |
|||
|
|||
void HttpContent::writeTo( std::ostream& stream ) |
|||
{ |
|||
m_Data->seekg( 0, m_Data->beg ); |
|||
stream << m_Data->rdbuf(); |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,36 @@ |
|||
/**
|
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech
|
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
#include "CppRestOpenAPIClient/JsonBody.h"
|
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace model { |
|||
|
|||
JsonBody::JsonBody( const web::json::value& json) |
|||
: m_Json(json) |
|||
{ |
|||
} |
|||
|
|||
JsonBody::~JsonBody() |
|||
{ |
|||
} |
|||
|
|||
void JsonBody::writeTo( std::ostream& target ) |
|||
{ |
|||
m_Json.serialize(target); |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,665 @@ |
|||
/**
|
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech
|
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
#include "CppRestOpenAPIClient/ModelBase.h"
|
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace model { |
|||
|
|||
ModelBase::ModelBase(): m_IsSet(false) |
|||
{ |
|||
} |
|||
ModelBase::~ModelBase() |
|||
{ |
|||
} |
|||
bool ModelBase::isSet() const |
|||
{ |
|||
return m_IsSet; |
|||
} |
|||
utility::string_t ModelBase::toString( const bool val ) |
|||
{ |
|||
utility::stringstream_t ss; |
|||
ss << val; |
|||
return utility::string_t(ss.str()); |
|||
} |
|||
utility::string_t ModelBase::toString( const float val ) |
|||
{ |
|||
utility::stringstream_t ss; |
|||
ss << val; |
|||
return utility::string_t(ss.str()); |
|||
} |
|||
utility::string_t ModelBase::toString( const double val ) |
|||
{ |
|||
utility::stringstream_t ss; |
|||
ss << val; |
|||
return utility::string_t(ss.str()); |
|||
} |
|||
utility::string_t ModelBase::toString( const int32_t val ) |
|||
{ |
|||
utility::stringstream_t ss; |
|||
ss << val; |
|||
return utility::string_t(ss.str()); |
|||
} |
|||
utility::string_t ModelBase::toString( const int64_t val ) |
|||
{ |
|||
utility::stringstream_t ss; |
|||
ss << val; |
|||
return utility::string_t(ss.str()); |
|||
} |
|||
utility::string_t ModelBase::toString (const utility::string_t &val ) |
|||
{ |
|||
utility::stringstream_t ss; |
|||
ss << val; |
|||
return utility::string_t(ss.str()); |
|||
} |
|||
utility::string_t ModelBase::toString( const utility::datetime &val ) |
|||
{ |
|||
return val.to_string(utility::datetime::ISO_8601); |
|||
} |
|||
utility::string_t ModelBase::toString( const web::json::value &val ) |
|||
{ |
|||
return val.serialize(); |
|||
} |
|||
utility::string_t ModelBase::toString( const std::shared_ptr<HttpContent>& val ) |
|||
{ |
|||
utility::stringstream_t ss; |
|||
if( val != nullptr ) |
|||
{ |
|||
ss << val->getData(); |
|||
} |
|||
return utility::string_t(ss.str()); |
|||
} |
|||
web::json::value ModelBase::toJson(bool value) |
|||
{ |
|||
return web::json::value::boolean(value); |
|||
} |
|||
web::json::value ModelBase::toJson( float value ) |
|||
{ |
|||
return web::json::value::number(value); |
|||
} |
|||
web::json::value ModelBase::toJson( double value ) |
|||
{ |
|||
return web::json::value::number(value); |
|||
} |
|||
web::json::value ModelBase::toJson( int32_t value ) |
|||
{ |
|||
return web::json::value::number(value); |
|||
} |
|||
web::json::value ModelBase::toJson( int64_t value ) |
|||
{ |
|||
return web::json::value::number(value); |
|||
} |
|||
web::json::value ModelBase::toJson( const utility::string_t& value ) |
|||
{ |
|||
return web::json::value::string(value); |
|||
} |
|||
web::json::value ModelBase::toJson( const utility::datetime& value ) |
|||
{ |
|||
return web::json::value::string(value.to_string(utility::datetime::ISO_8601)); |
|||
} |
|||
web::json::value ModelBase::toJson( const web::json::value& value ) |
|||
{ |
|||
return value; |
|||
} |
|||
web::json::value ModelBase::toJson( const std::shared_ptr<HttpContent>& content ) |
|||
{ |
|||
web::json::value value; |
|||
if(content != nullptr) |
|||
{ |
|||
value[utility::conversions::to_string_t("ContentDisposition")] = ModelBase::toJson(content->getContentDisposition()); |
|||
value[utility::conversions::to_string_t("ContentType")] = ModelBase::toJson(content->getContentType()); |
|||
value[utility::conversions::to_string_t("FileName")] = ModelBase::toJson(content->getFileName()); |
|||
value[utility::conversions::to_string_t("InputStream")] = web::json::value::string( ModelBase::toBase64(content->getData()) ); |
|||
} |
|||
return value; |
|||
} |
|||
web::json::value ModelBase::toJson( const std::shared_ptr<utility::datetime>& val ) |
|||
{ |
|||
web::json::value retVal; |
|||
if(val != nullptr) |
|||
{ |
|||
retVal = toJson(*val); |
|||
} |
|||
return retVal; |
|||
} |
|||
bool ModelBase::fromString( const utility::string_t& val, bool &outVal ) |
|||
{ |
|||
utility::stringstream_t ss(val); |
|||
bool success = true; |
|||
try |
|||
{ |
|||
ss >> outVal; |
|||
} |
|||
catch (...) |
|||
{ |
|||
success = false; |
|||
} |
|||
return success; |
|||
} |
|||
bool ModelBase::fromString( const utility::string_t& val, float &outVal ) |
|||
{ |
|||
utility::stringstream_t ss(val); |
|||
bool success = true; |
|||
try |
|||
{ |
|||
ss >> outVal; |
|||
} |
|||
catch (...) |
|||
{ |
|||
int64_t intVal = 0; |
|||
success = ModelBase::fromString(val, intVal); |
|||
if(success) |
|||
{ |
|||
outVal = static_cast<float>(intVal); |
|||
} |
|||
} |
|||
return success; |
|||
} |
|||
bool ModelBase::fromString( const utility::string_t& val, double &outVal ) |
|||
{ |
|||
utility::stringstream_t ss(val); |
|||
bool success = true; |
|||
try |
|||
{ |
|||
ss >> outVal; |
|||
} |
|||
catch (...) |
|||
{ |
|||
int64_t intVal = 0; |
|||
success = ModelBase::fromString(val, intVal); |
|||
if(success) |
|||
{ |
|||
outVal = static_cast<double>(intVal); |
|||
} |
|||
} |
|||
return success; |
|||
} |
|||
bool ModelBase::fromString( const utility::string_t& val, int32_t &outVal ) |
|||
{ |
|||
utility::stringstream_t ss(val); |
|||
bool success = true; |
|||
try |
|||
{ |
|||
ss >> outVal; |
|||
} |
|||
catch (...) |
|||
{ |
|||
success = false; |
|||
} |
|||
return success; |
|||
} |
|||
bool ModelBase::fromString( const utility::string_t& val, int64_t &outVal ) |
|||
{ |
|||
utility::stringstream_t ss(val); |
|||
bool success = true; |
|||
try |
|||
{ |
|||
ss >> outVal; |
|||
} |
|||
catch (...) |
|||
{ |
|||
success = false; |
|||
} |
|||
return success; |
|||
} |
|||
bool ModelBase::fromString( const utility::string_t& val, utility::string_t &outVal ) |
|||
{ |
|||
utility::stringstream_t ss(val); |
|||
bool success = true; |
|||
try |
|||
{ |
|||
ss >> outVal; |
|||
} |
|||
catch (...) |
|||
{ |
|||
success = false; |
|||
} |
|||
return success; |
|||
} |
|||
bool ModelBase::fromString( const utility::string_t& val, utility::datetime &outVal ) |
|||
{ |
|||
bool success = true; |
|||
auto dt = utility::datetime::from_string(val, utility::datetime::ISO_8601); |
|||
if( dt.is_initialized() ) |
|||
{ |
|||
outVal = dt; |
|||
} |
|||
else |
|||
{ |
|||
success = false; |
|||
} |
|||
return success; |
|||
} |
|||
bool ModelBase::fromString( const utility::string_t& val, web::json::value &outVal ) |
|||
{ |
|||
outVal = web::json::value::parse(val); |
|||
return !outVal.is_null(); |
|||
} |
|||
bool ModelBase::fromString( const utility::string_t& val, std::shared_ptr<HttpContent>& outVal ) |
|||
{ |
|||
bool ok = true; |
|||
if(outVal == nullptr) |
|||
{ |
|||
outVal = std::shared_ptr<HttpContent>(new HttpContent()); |
|||
} |
|||
if(outVal != nullptr) |
|||
{ |
|||
outVal->setData(std::shared_ptr<std::istream>(new std::stringstream(utility::conversions::to_utf8string(val)))); |
|||
} |
|||
else |
|||
{ |
|||
ok = false; |
|||
} |
|||
return ok; |
|||
} |
|||
bool ModelBase::fromString( const utility::string_t& val, std::shared_ptr<utility::datetime>& outVal ) |
|||
{ |
|||
bool ok = false; |
|||
if(outVal == nullptr) |
|||
{ |
|||
outVal = std::shared_ptr<utility::datetime>(new utility::datetime()); |
|||
} |
|||
if( outVal != nullptr ) |
|||
{ |
|||
ok = fromJson(web::json::value::parse(val), *outVal); |
|||
} |
|||
return ok; |
|||
} |
|||
bool ModelBase::fromJson( const web::json::value& val, bool & outVal ) |
|||
{ |
|||
outVal = !val.is_boolean() ? false : val.as_bool(); |
|||
return val.is_boolean(); |
|||
} |
|||
bool ModelBase::fromJson( const web::json::value& val, float & outVal ) |
|||
{ |
|||
outVal = (!val.is_double() && !val.is_integer()) ? std::numeric_limits<float>::quiet_NaN(): static_cast<float>(val.as_double()); |
|||
return val.is_double() || val.is_integer(); |
|||
} |
|||
bool ModelBase::fromJson( const web::json::value& val, double & outVal ) |
|||
{ |
|||
outVal = (!val.is_double() && !val.is_integer()) ? std::numeric_limits<double>::quiet_NaN(): val.as_double(); |
|||
return val.is_double() || val.is_integer(); |
|||
} |
|||
bool ModelBase::fromJson( const web::json::value& val, int32_t & outVal ) |
|||
{ |
|||
outVal = !val.is_integer() ? std::numeric_limits<int32_t>::quiet_NaN() : val.as_integer(); |
|||
return val.is_integer(); |
|||
} |
|||
bool ModelBase::fromJson( const web::json::value& val, int64_t & outVal ) |
|||
{ |
|||
outVal = !val.is_number() ? std::numeric_limits<int64_t>::quiet_NaN() : val.as_number().to_int64(); |
|||
return val.is_number(); |
|||
} |
|||
bool ModelBase::fromJson( const web::json::value& val, utility::string_t & outVal ) |
|||
{ |
|||
outVal = val.is_string() ? val.as_string() : utility::conversions::to_string_t(""); |
|||
return val.is_string(); |
|||
} |
|||
bool ModelBase::fromJson( const web::json::value& val, utility::datetime & outVal ) |
|||
{ |
|||
outVal = val.is_null() ? utility::datetime::from_string(utility::conversions::to_string_t("NULL"), utility::datetime::ISO_8601) : utility::datetime::from_string(val.as_string(), utility::datetime::ISO_8601); |
|||
return outVal.is_initialized(); |
|||
} |
|||
bool ModelBase::fromJson( const web::json::value& val, web::json::value & outVal ) |
|||
{ |
|||
outVal = val; |
|||
return !val.is_null(); |
|||
} |
|||
bool ModelBase::fromJson( const web::json::value& val, std::shared_ptr<HttpContent>& content ) |
|||
{ |
|||
bool result = false; |
|||
if( content != nullptr) |
|||
{ |
|||
result = true; |
|||
if(content == nullptr) |
|||
{ |
|||
content = std::shared_ptr<HttpContent>(new HttpContent()); |
|||
} |
|||
if(val.has_field(utility::conversions::to_string_t("ContentDisposition"))) |
|||
{ |
|||
utility::string_t value; |
|||
result = result && ModelBase::fromJson(val.at(utility::conversions::to_string_t("ContentDisposition")), value); |
|||
content->setContentDisposition( value ); |
|||
} |
|||
if(val.has_field(utility::conversions::to_string_t("ContentType"))) |
|||
{ |
|||
utility::string_t value; |
|||
result = result && ModelBase::fromJson(val.at(utility::conversions::to_string_t("ContentType")), value); |
|||
content->setContentType( value ); |
|||
} |
|||
if(val.has_field(utility::conversions::to_string_t("FileName"))) |
|||
{ |
|||
utility::string_t value; |
|||
result = result && ModelBase::fromJson(val.at(utility::conversions::to_string_t("FileName")), value); |
|||
content->setFileName( value ); |
|||
} |
|||
if(val.has_field(utility::conversions::to_string_t("InputStream"))) |
|||
{ |
|||
utility::string_t value; |
|||
result = result && ModelBase::fromJson(val.at(utility::conversions::to_string_t("InputStream")), value); |
|||
content->setData( ModelBase::fromBase64( value ) ); |
|||
} |
|||
} |
|||
return result; |
|||
} |
|||
bool ModelBase::fromJson( const web::json::value& val, std::shared_ptr<utility::datetime> &outVal ) |
|||
{ |
|||
bool ok = false; |
|||
if(outVal == nullptr) |
|||
{ |
|||
outVal = std::shared_ptr<utility::datetime>(new utility::datetime()); |
|||
} |
|||
if( outVal != nullptr ) |
|||
{ |
|||
ok = fromJson(val, *outVal); |
|||
} |
|||
return ok; |
|||
} |
|||
std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t& name, bool value, const utility::string_t& contentType ) |
|||
{ |
|||
std::shared_ptr<HttpContent> content( new HttpContent ); |
|||
content->setName( name ); |
|||
content->setContentDisposition( utility::conversions::to_string_t("form-data") ); |
|||
content->setContentType( contentType ); |
|||
std::stringstream* valueAsStringStream = new std::stringstream(); |
|||
(*valueAsStringStream) << value; |
|||
content->setData( std::shared_ptr<std::istream>( valueAsStringStream ) ); |
|||
return content; |
|||
} |
|||
std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t& name, float value, const utility::string_t& contentType ) |
|||
{ |
|||
std::shared_ptr<HttpContent> content( new HttpContent ); |
|||
content->setName( name ); |
|||
content->setContentDisposition( utility::conversions::to_string_t("form-data") ); |
|||
content->setContentType( contentType ); |
|||
std::stringstream* valueAsStringStream = new std::stringstream(); |
|||
(*valueAsStringStream) << value; |
|||
content->setData( std::shared_ptr<std::istream>( valueAsStringStream ) ); |
|||
return content; |
|||
} |
|||
std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t& name, double value, const utility::string_t& contentType ) |
|||
{ |
|||
std::shared_ptr<HttpContent> content( new HttpContent ); |
|||
content->setName( name ); |
|||
content->setContentDisposition( utility::conversions::to_string_t("form-data") ); |
|||
content->setContentType( contentType ); |
|||
std::stringstream* valueAsStringStream = new std::stringstream(); |
|||
(*valueAsStringStream) << value; |
|||
content->setData( std::shared_ptr<std::istream>( valueAsStringStream ) ); |
|||
return content; |
|||
} |
|||
std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t& name, int32_t value, const utility::string_t& contentType ) |
|||
{ |
|||
std::shared_ptr<HttpContent> content( new HttpContent ); |
|||
content->setName( name ); |
|||
content->setContentDisposition( utility::conversions::to_string_t("form-data") ); |
|||
content->setContentType( contentType ); |
|||
std::stringstream* valueAsStringStream = new std::stringstream(); |
|||
(*valueAsStringStream) << value; |
|||
content->setData( std::shared_ptr<std::istream>( valueAsStringStream ) ); |
|||
return content; |
|||
} |
|||
std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t& name, int64_t value, const utility::string_t& contentType ) |
|||
{ |
|||
std::shared_ptr<HttpContent> content( new HttpContent ); |
|||
content->setName( name ); |
|||
content->setContentDisposition( utility::conversions::to_string_t("form-data") ); |
|||
content->setContentType( contentType ); |
|||
std::stringstream* valueAsStringStream = new std::stringstream(); |
|||
(*valueAsStringStream) << value; |
|||
content->setData( std::shared_ptr<std::istream>( valueAsStringStream) ) ; |
|||
return content; |
|||
} |
|||
std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t& name, const utility::string_t& value, const utility::string_t& contentType) |
|||
{ |
|||
std::shared_ptr<HttpContent> content(new HttpContent); |
|||
content->setName( name ); |
|||
content->setContentDisposition( utility::conversions::to_string_t("form-data") ); |
|||
content->setContentType( contentType ); |
|||
content->setData( std::shared_ptr<std::istream>( new std::stringstream( utility::conversions::to_utf8string(value) ) ) ); |
|||
return content; |
|||
} |
|||
std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t& name, const utility::datetime& value, const utility::string_t& contentType ) |
|||
{ |
|||
std::shared_ptr<HttpContent> content( new HttpContent ); |
|||
content->setName( name ); |
|||
content->setContentDisposition( utility::conversions::to_string_t("form-data") ); |
|||
content->setContentType( contentType ); |
|||
content->setData( std::shared_ptr<std::istream>( new std::stringstream( utility::conversions::to_utf8string(value.to_string(utility::datetime::ISO_8601) ) ) ) ); |
|||
return content; |
|||
} |
|||
std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t& name, const web::json::value& value, const utility::string_t& contentType ) |
|||
{ |
|||
std::shared_ptr<HttpContent> content( new HttpContent ); |
|||
content->setName( name ); |
|||
content->setContentDisposition( utility::conversions::to_string_t("form-data") ); |
|||
content->setContentType( contentType ); |
|||
content->setData( std::shared_ptr<std::istream>( new std::stringstream( utility::conversions::to_utf8string(value.serialize()) ) ) ); |
|||
return content; |
|||
} |
|||
std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t& name, const std::shared_ptr<HttpContent>& value ) |
|||
{ |
|||
std::shared_ptr<HttpContent> content( new HttpContent ); |
|||
if( value != nullptr ) |
|||
{ |
|||
content->setName( name ); |
|||
content->setContentDisposition( value->getContentDisposition() ); |
|||
content->setContentType( value->getContentType() ); |
|||
content->setData( value->getData() ); |
|||
content->setFileName( value->getFileName() ); |
|||
} |
|||
return content; |
|||
} |
|||
std::shared_ptr<HttpContent> ModelBase::toHttpContent(const utility::string_t& name, const std::shared_ptr<utility::datetime>& value , const utility::string_t& contentType ) |
|||
{ |
|||
std::shared_ptr<HttpContent> content( new HttpContent ); |
|||
if (value != nullptr ) |
|||
{ |
|||
content->setName( name ); |
|||
content->setContentDisposition( utility::conversions::to_string_t("form-data") ); |
|||
content->setContentType( contentType ); |
|||
content->setData( std::shared_ptr<std::istream>( new std::stringstream( utility::conversions::to_utf8string( toJson(*value).serialize() ) ) ) ); |
|||
} |
|||
return content; |
|||
} |
|||
bool ModelBase::fromHttpContent(std::shared_ptr<HttpContent> val, bool & outVal ) |
|||
{ |
|||
utility::string_t str; |
|||
if( val == nullptr ) return false; |
|||
ModelBase::fromHttpContent(val, str); |
|||
return fromString(str, outVal); |
|||
} |
|||
bool ModelBase::fromHttpContent(std::shared_ptr<HttpContent> val, float & outVal ) |
|||
{ |
|||
utility::string_t str; |
|||
if( val == nullptr ) return false; |
|||
ModelBase::fromHttpContent(val, str); |
|||
return fromString(str, outVal); |
|||
} |
|||
bool ModelBase::fromHttpContent(std::shared_ptr<HttpContent> val, double & outVal ) |
|||
{ |
|||
utility::string_t str; |
|||
if( val == nullptr ) return false; |
|||
ModelBase::fromHttpContent(val, str); |
|||
return fromString(str, outVal); |
|||
} |
|||
bool ModelBase::fromHttpContent(std::shared_ptr<HttpContent> val, int32_t & outVal ) |
|||
{ |
|||
utility::string_t str; |
|||
if( val == nullptr ) return false; |
|||
ModelBase::fromHttpContent(val, str); |
|||
return fromString(str, outVal); |
|||
} |
|||
bool ModelBase::fromHttpContent(std::shared_ptr<HttpContent> val, int64_t & outVal ) |
|||
{ |
|||
utility::string_t str; |
|||
if( val == nullptr ) return false; |
|||
ModelBase::fromHttpContent(val, str); |
|||
return fromString(str, outVal); |
|||
} |
|||
bool ModelBase::fromHttpContent(std::shared_ptr<HttpContent> val, utility::string_t & outVal ) |
|||
{ |
|||
if( val == nullptr ) return false; |
|||
std::shared_ptr<std::istream> data = val->getData(); |
|||
data->seekg( 0, data->beg ); |
|||
|
|||
std::string str((std::istreambuf_iterator<char>(*data.get())), |
|||
std::istreambuf_iterator<char>()); |
|||
outVal = utility::conversions::to_string_t(str); |
|||
return true; |
|||
} |
|||
bool ModelBase::fromHttpContent(std::shared_ptr<HttpContent> val, utility::datetime & outVal ) |
|||
{ |
|||
utility::string_t str; |
|||
if( val == nullptr ) return false; |
|||
ModelBase::fromHttpContent(val, str); |
|||
outVal = utility::datetime::from_string(str, utility::datetime::ISO_8601); |
|||
return true; |
|||
} |
|||
bool ModelBase::fromHttpContent(std::shared_ptr<HttpContent> val, web::json::value & outVal ) |
|||
{ |
|||
utility::string_t str; |
|||
if( val == nullptr ) return false; |
|||
ModelBase::fromHttpContent(val, str); |
|||
return fromString(str, outVal); |
|||
} |
|||
bool ModelBase::fromHttpContent(std::shared_ptr<HttpContent> val, std::shared_ptr<HttpContent>& outVal ) |
|||
{ |
|||
utility::string_t str; |
|||
if( val == nullptr ) return false; |
|||
if( outVal == nullptr ) |
|||
{ |
|||
outVal = std::shared_ptr<HttpContent>(new HttpContent()); |
|||
} |
|||
ModelBase::fromHttpContent(val, str); |
|||
return fromString(str, outVal); |
|||
} |
|||
// base64 encoding/decoding based on : https://en.wikibooks.org/wiki/Algorithm_Implementation/Miscellaneous/Base64#C.2B.2B
|
|||
const static char Base64Chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; |
|||
const static char Base64PadChar = '='; |
|||
utility::string_t ModelBase::toBase64( utility::string_t value ) |
|||
{ |
|||
std::shared_ptr<std::istream> source( new std::stringstream( utility::conversions::to_utf8string(value) ) ); |
|||
return ModelBase::toBase64(source); |
|||
} |
|||
utility::string_t ModelBase::toBase64( std::shared_ptr<std::istream> value ) |
|||
{ |
|||
value->seekg( 0, value->end ); |
|||
size_t length = value->tellg(); |
|||
value->seekg( 0, value->beg ); |
|||
utility::string_t base64; |
|||
base64.reserve( ((length / 3) + (length % 3 > 0)) * 4 ); |
|||
char read[3] = { 0 }; |
|||
uint32_t temp; |
|||
for ( size_t idx = 0; idx < length / 3; idx++ ) |
|||
{ |
|||
value->read( read, 3 ); |
|||
temp = (read[0]) << 16; |
|||
temp += (read[1]) << 8; |
|||
temp += (read[2]); |
|||
base64.append( 1, Base64Chars[(temp & 0x00FC0000) >> 18] ); |
|||
base64.append( 1, Base64Chars[(temp & 0x0003F000) >> 12] ); |
|||
base64.append( 1, Base64Chars[(temp & 0x00000FC0) >> 6] ); |
|||
base64.append( 1, Base64Chars[(temp & 0x0000003F)] ); |
|||
} |
|||
switch ( length % 3 ) |
|||
{ |
|||
case 1: |
|||
value->read( read, 1 ); |
|||
temp = read[0] << 16; |
|||
base64.append( 1, Base64Chars[(temp & 0x00FC0000) >> 18] ); |
|||
base64.append( 1, Base64Chars[(temp & 0x0003F000) >> 12] ); |
|||
base64.append( 2, Base64PadChar ); |
|||
break; |
|||
case 2: |
|||
value->read( read, 2 ); |
|||
temp = read[0] << 16; |
|||
temp += read[1] << 8; |
|||
base64.append( 1, Base64Chars[(temp & 0x00FC0000) >> 18] ); |
|||
base64.append( 1, Base64Chars[(temp & 0x0003F000) >> 12] ); |
|||
base64.append( 1, Base64Chars[(temp & 0x00000FC0) >> 6] ); |
|||
base64.append( 1, Base64PadChar ); |
|||
break; |
|||
} |
|||
return base64; |
|||
} |
|||
std::shared_ptr<std::istream> ModelBase::fromBase64( const utility::string_t& encoded ) |
|||
{ |
|||
std::shared_ptr<std::stringstream> result(new std::stringstream); |
|||
|
|||
char outBuf[3] = { 0 }; |
|||
uint32_t temp = 0; |
|||
|
|||
utility::string_t::const_iterator cursor = encoded.begin(); |
|||
while ( cursor < encoded.end() ) |
|||
{ |
|||
for ( size_t quantumPosition = 0; quantumPosition < 4; quantumPosition++ ) |
|||
{ |
|||
temp <<= 6; |
|||
if ( *cursor >= 0x41 && *cursor <= 0x5A ) |
|||
{ |
|||
temp |= *cursor - 0x41; |
|||
} |
|||
else if ( *cursor >= 0x61 && *cursor <= 0x7A ) |
|||
{ |
|||
temp |= *cursor - 0x47; |
|||
} |
|||
else if ( *cursor >= 0x30 && *cursor <= 0x39 ) |
|||
{ |
|||
temp |= *cursor + 0x04; |
|||
} |
|||
else if ( *cursor == 0x2B ) |
|||
{ |
|||
temp |= 0x3E; //change to 0x2D for URL alphabet
|
|||
} |
|||
else if ( *cursor == 0x2F ) |
|||
{ |
|||
temp |= 0x3F; //change to 0x5F for URL alphabet
|
|||
} |
|||
else if ( *cursor == Base64PadChar ) //pad
|
|||
{ |
|||
switch ( encoded.end() - cursor ) |
|||
{ |
|||
case 1: //One pad character
|
|||
outBuf[0] = (temp >> 16) & 0x000000FF; |
|||
outBuf[1] = (temp >> 8) & 0x000000FF; |
|||
result->write( outBuf, 2 ); |
|||
return result; |
|||
case 2: //Two pad characters
|
|||
outBuf[0] = (temp >> 10) & 0x000000FF; |
|||
result->write( outBuf, 1 ); |
|||
return result; |
|||
default: |
|||
throw web::json::json_exception( utility::conversions::to_string_t( "Invalid Padding in Base 64!" ).c_str() ); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
throw web::json::json_exception( utility::conversions::to_string_t( "Non-Valid Character in Base 64!" ).c_str() ); |
|||
} |
|||
++cursor; |
|||
} |
|||
|
|||
outBuf[0] = (temp >> 16) & 0x000000FF; |
|||
outBuf[1] = (temp >> 8) & 0x000000FF; |
|||
outBuf[2] = (temp) & 0x000000FF; |
|||
result->write( outBuf, 3 ); |
|||
} |
|||
|
|||
return result; |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,112 @@ |
|||
/**
|
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech
|
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
#include "CppRestOpenAPIClient/MultipartFormData.h"
|
|||
#include "CppRestOpenAPIClient/ModelBase.h"
|
|||
|
|||
#include <boost/uuid/random_generator.hpp>
|
|||
#include <boost/uuid/uuid_io.hpp>
|
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace model { |
|||
|
|||
MultipartFormData::MultipartFormData() |
|||
{ |
|||
utility::stringstream_t uuidString; |
|||
uuidString << boost::uuids::random_generator()(); |
|||
m_Boundary = uuidString.str(); |
|||
} |
|||
|
|||
MultipartFormData::MultipartFormData(const utility::string_t& boundary) |
|||
: m_Boundary(boundary) |
|||
{ |
|||
|
|||
} |
|||
|
|||
MultipartFormData::~MultipartFormData() |
|||
{ |
|||
} |
|||
|
|||
utility::string_t MultipartFormData::getBoundary() |
|||
{ |
|||
return m_Boundary; |
|||
} |
|||
|
|||
void MultipartFormData::add( std::shared_ptr<HttpContent> content ) |
|||
{ |
|||
m_Contents.push_back( content ); |
|||
m_ContentLookup[content->getName()] = content; |
|||
} |
|||
|
|||
bool MultipartFormData::hasContent(const utility::string_t& name) const |
|||
{ |
|||
return m_ContentLookup.find(name) != m_ContentLookup.end(); |
|||
} |
|||
|
|||
std::shared_ptr<HttpContent> MultipartFormData::getContent(const utility::string_t& name) const |
|||
{ |
|||
auto result = m_ContentLookup.find(name); |
|||
if(result == m_ContentLookup.end()) |
|||
{ |
|||
return std::shared_ptr<HttpContent>(nullptr); |
|||
} |
|||
return result->second; |
|||
} |
|||
|
|||
void MultipartFormData::writeTo( std::ostream& target ) |
|||
{ |
|||
for ( size_t i = 0; i < m_Contents.size(); i++ ) |
|||
{ |
|||
std::shared_ptr<HttpContent> content = m_Contents[i]; |
|||
|
|||
// boundary
|
|||
target << "\r\n" << "--" << utility::conversions::to_utf8string( m_Boundary ) << "\r\n"; |
|||
|
|||
// headers
|
|||
target << "Content-Disposition: " << utility::conversions::to_utf8string( content->getContentDisposition() ); |
|||
if ( content->getName().size() > 0 ) |
|||
{ |
|||
target << "; name=\"" << utility::conversions::to_utf8string( content->getName() ) << "\""; |
|||
} |
|||
if ( content->getFileName().size() > 0 ) |
|||
{ |
|||
target << "; filename=\"" << utility::conversions::to_utf8string( content->getFileName() ) << "\""; |
|||
} |
|||
target << "\r\n"; |
|||
|
|||
if ( content->getContentType().size() > 0 ) |
|||
{ |
|||
target << "Content-Type: " << utility::conversions::to_utf8string( content->getContentType() ) << "\r\n"; |
|||
} |
|||
|
|||
target << "\r\n"; |
|||
|
|||
// body
|
|||
std::shared_ptr<std::istream> data = content->getData(); |
|||
|
|||
data->seekg( 0, data->end ); |
|||
std::vector<char> dataBytes( data->tellg() ); |
|||
|
|||
data->seekg( 0, data->beg ); |
|||
data->read( &dataBytes[0], dataBytes.size() ); |
|||
|
|||
std::copy( dataBytes.begin(), dataBytes.end(), std::ostreambuf_iterator<char>( target ) ); |
|||
} |
|||
|
|||
target << "\r\n--" << utility::conversions::to_utf8string( m_Boundary ) << "--\r\n"; |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,91 @@ |
|||
/**
|
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech
|
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
#include "CppRestOpenAPIClient/Object.h"
|
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace model { |
|||
|
|||
Object::Object() |
|||
{ |
|||
m_object = web::json::value::object(); |
|||
} |
|||
|
|||
Object::~Object() |
|||
{ |
|||
} |
|||
|
|||
void Object::validate() |
|||
{ |
|||
|
|||
} |
|||
|
|||
web::json::value Object::toJson() const |
|||
{ |
|||
return m_object; |
|||
} |
|||
|
|||
bool Object::fromJson(const web::json::value& val) |
|||
{ |
|||
if (val.is_object()) |
|||
{ |
|||
m_object = val; |
|||
m_IsSet = true; |
|||
} |
|||
return isSet(); |
|||
} |
|||
|
|||
void Object::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const |
|||
{ |
|||
utility::string_t namePrefix = prefix; |
|||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) |
|||
{ |
|||
namePrefix += utility::conversions::to_string_t("."); |
|||
} |
|||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("object"), m_object)); |
|||
} |
|||
|
|||
bool Object::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) |
|||
{ |
|||
utility::string_t namePrefix = prefix; |
|||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) |
|||
{ |
|||
namePrefix += utility::conversions::to_string_t("."); |
|||
} |
|||
|
|||
if( ModelBase::fromHttpContent(multipart->getContent(namePrefix + utility::conversions::to_string_t("object")), m_object ) ) |
|||
{ |
|||
m_IsSet = true; |
|||
} |
|||
return isSet(); |
|||
} |
|||
|
|||
web::json::value Object::getValue(const utility::string_t& key) const |
|||
{ |
|||
return m_object.at(key); |
|||
} |
|||
|
|||
|
|||
void Object::setValue(const utility::string_t& key, const web::json::value& value) |
|||
{ |
|||
if( !value.is_null() ) |
|||
{ |
|||
m_object[key] = value; |
|||
m_IsSet = true; |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,347 @@ |
|||
/**
|
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech
|
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
|
|||
#include "CppRestOpenAPIClient/api/DefaultApi.h"
|
|||
#include "CppRestOpenAPIClient/IHttpBody.h"
|
|||
#include "CppRestOpenAPIClient/JsonBody.h"
|
|||
#include "CppRestOpenAPIClient/MultipartFormData.h"
|
|||
|
|||
#include <boost/algorithm/string/replace.hpp>
|
|||
|
|||
#include <unordered_set>
|
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace api { |
|||
|
|||
using namespace org::openapitools::client::model; |
|||
|
|||
DefaultApi::DefaultApi( std::shared_ptr<const ApiClient> apiClient ) |
|||
: m_ApiClient(apiClient) |
|||
{ |
|||
} |
|||
|
|||
DefaultApi::~DefaultApi() |
|||
{ |
|||
} |
|||
|
|||
pplx::task<std::shared_ptr<FileKey>> DefaultApi::dirAssign(boost::optional<std::shared_ptr<AnyType>> count, boost::optional<std::shared_ptr<AnyType>> collection, boost::optional<std::shared_ptr<AnyType>> dataCenter, boost::optional<std::shared_ptr<AnyType>> rack, boost::optional<std::shared_ptr<AnyType>> dataNode, boost::optional<std::shared_ptr<AnyType>> disk, boost::optional<std::shared_ptr<AnyType>> replication, boost::optional<std::shared_ptr<AnyType>> ttl, boost::optional<std::shared_ptr<AnyType>> preallocate, boost::optional<std::shared_ptr<AnyType>> memoryMapMaxSizeMb, boost::optional<std::shared_ptr<AnyType>> writableVolumeCount) const |
|||
{ |
|||
|
|||
|
|||
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration( m_ApiClient->getConfiguration() ); |
|||
utility::string_t localVarPath = utility::conversions::to_string_t("/dir/assign"); |
|||
|
|||
std::map<utility::string_t, utility::string_t> localVarQueryParams; |
|||
std::map<utility::string_t, utility::string_t> localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); |
|||
std::map<utility::string_t, utility::string_t> localVarFormParams; |
|||
std::map<utility::string_t, std::shared_ptr<HttpContent>> localVarFileParams; |
|||
|
|||
std::unordered_set<utility::string_t> localVarResponseHttpContentTypes; |
|||
localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); |
|||
|
|||
utility::string_t localVarResponseHttpContentType; |
|||
|
|||
// use JSON if possible
|
|||
if ( localVarResponseHttpContentTypes.size() == 0 ) |
|||
{ |
|||
localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); |
|||
} |
|||
// JSON
|
|||
else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) |
|||
{ |
|||
localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); |
|||
} |
|||
// multipart formdata
|
|||
else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) |
|||
{ |
|||
localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); |
|||
} |
|||
else |
|||
{ |
|||
throw ApiException(400, utility::conversions::to_string_t("DefaultApi->dirAssign does not produce any supported media type")); |
|||
} |
|||
|
|||
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; |
|||
|
|||
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes; |
|||
|
|||
if (count && *count != nullptr) |
|||
{ |
|||
localVarQueryParams[utility::conversions::to_string_t("count")] = ApiClient::parameterToString(*count); |
|||
} |
|||
if (collection && *collection != nullptr) |
|||
{ |
|||
localVarQueryParams[utility::conversions::to_string_t("collection")] = ApiClient::parameterToString(*collection); |
|||
} |
|||
if (dataCenter && *dataCenter != nullptr) |
|||
{ |
|||
localVarQueryParams[utility::conversions::to_string_t("dataCenter")] = ApiClient::parameterToString(*dataCenter); |
|||
} |
|||
if (rack && *rack != nullptr) |
|||
{ |
|||
localVarQueryParams[utility::conversions::to_string_t("rack")] = ApiClient::parameterToString(*rack); |
|||
} |
|||
if (dataNode && *dataNode != nullptr) |
|||
{ |
|||
localVarQueryParams[utility::conversions::to_string_t("dataNode")] = ApiClient::parameterToString(*dataNode); |
|||
} |
|||
if (disk && *disk != nullptr) |
|||
{ |
|||
localVarQueryParams[utility::conversions::to_string_t("disk")] = ApiClient::parameterToString(*disk); |
|||
} |
|||
if (replication && *replication != nullptr) |
|||
{ |
|||
localVarQueryParams[utility::conversions::to_string_t("replication")] = ApiClient::parameterToString(*replication); |
|||
} |
|||
if (ttl && *ttl != nullptr) |
|||
{ |
|||
localVarQueryParams[utility::conversions::to_string_t("ttl")] = ApiClient::parameterToString(*ttl); |
|||
} |
|||
if (preallocate && *preallocate != nullptr) |
|||
{ |
|||
localVarQueryParams[utility::conversions::to_string_t("preallocate")] = ApiClient::parameterToString(*preallocate); |
|||
} |
|||
if (memoryMapMaxSizeMb && *memoryMapMaxSizeMb != nullptr) |
|||
{ |
|||
localVarQueryParams[utility::conversions::to_string_t("memoryMapMaxSizeMb")] = ApiClient::parameterToString(*memoryMapMaxSizeMb); |
|||
} |
|||
if (writableVolumeCount && *writableVolumeCount != nullptr) |
|||
{ |
|||
localVarQueryParams[utility::conversions::to_string_t("writableVolumeCount")] = ApiClient::parameterToString(*writableVolumeCount); |
|||
} |
|||
|
|||
std::shared_ptr<IHttpBody> localVarHttpBody; |
|||
utility::string_t localVarRequestHttpContentType; |
|||
|
|||
// use JSON if possible
|
|||
if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) |
|||
{ |
|||
localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); |
|||
} |
|||
// multipart formdata
|
|||
else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) |
|||
{ |
|||
localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); |
|||
} |
|||
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end()) |
|||
{ |
|||
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded"); |
|||
} |
|||
else |
|||
{ |
|||
throw ApiException(415, utility::conversions::to_string_t("DefaultApi->dirAssign does not consume any supported media type")); |
|||
} |
|||
|
|||
|
|||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) |
|||
.then([=](web::http::http_response localVarResponse) |
|||
{ |
|||
if (m_ApiClient->getResponseHandler()) |
|||
{ |
|||
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), localVarResponse.headers()); |
|||
} |
|||
|
|||
// 1xx - informational : OK
|
|||
// 2xx - successful : OK
|
|||
// 3xx - redirection : OK
|
|||
// 4xx - client error : not OK
|
|||
// 5xx - client error : not OK
|
|||
if (localVarResponse.status_code() >= 400) |
|||
{ |
|||
throw ApiException(localVarResponse.status_code() |
|||
, utility::conversions::to_string_t("error calling dirAssign: ") + localVarResponse.reason_phrase() |
|||
, std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get())); |
|||
} |
|||
|
|||
// check response content type
|
|||
if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) |
|||
{ |
|||
utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; |
|||
if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) |
|||
{ |
|||
throw ApiException(500 |
|||
, utility::conversions::to_string_t("error calling dirAssign: unexpected response type: ") + localVarContentType |
|||
, std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get())); |
|||
} |
|||
} |
|||
|
|||
return localVarResponse.extract_string(); |
|||
}) |
|||
.then([=](utility::string_t localVarResponse) |
|||
{ |
|||
std::shared_ptr<FileKey> localVarResult(new FileKey()); |
|||
|
|||
if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) |
|||
{ |
|||
web::json::value localVarJson = web::json::value::parse(localVarResponse); |
|||
|
|||
ModelBase::fromJson(localVarJson, localVarResult); |
|||
} |
|||
// else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data"))
|
|||
// {
|
|||
// TODO multipart response parsing
|
|||
// }
|
|||
else |
|||
{ |
|||
throw ApiException(500 |
|||
, utility::conversions::to_string_t("error calling dirAssign: unsupported response type")); |
|||
} |
|||
|
|||
return localVarResult; |
|||
}); |
|||
} |
|||
pplx::task<std::shared_ptr<AnyType>> DefaultApi::dirLookup(boost::optional<std::shared_ptr<AnyType>> volumeId, boost::optional<std::shared_ptr<AnyType>> collection, boost::optional<std::shared_ptr<AnyType>> fileId, boost::optional<std::shared_ptr<AnyType>> read) const |
|||
{ |
|||
|
|||
|
|||
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration( m_ApiClient->getConfiguration() ); |
|||
utility::string_t localVarPath = utility::conversions::to_string_t("/dir/lookup"); |
|||
|
|||
std::map<utility::string_t, utility::string_t> localVarQueryParams; |
|||
std::map<utility::string_t, utility::string_t> localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); |
|||
std::map<utility::string_t, utility::string_t> localVarFormParams; |
|||
std::map<utility::string_t, std::shared_ptr<HttpContent>> localVarFileParams; |
|||
|
|||
std::unordered_set<utility::string_t> localVarResponseHttpContentTypes; |
|||
localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); |
|||
|
|||
utility::string_t localVarResponseHttpContentType; |
|||
|
|||
// use JSON if possible
|
|||
if ( localVarResponseHttpContentTypes.size() == 0 ) |
|||
{ |
|||
localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); |
|||
} |
|||
// JSON
|
|||
else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) |
|||
{ |
|||
localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); |
|||
} |
|||
// multipart formdata
|
|||
else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) |
|||
{ |
|||
localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); |
|||
} |
|||
else |
|||
{ |
|||
throw ApiException(400, utility::conversions::to_string_t("DefaultApi->dirLookup does not produce any supported media type")); |
|||
} |
|||
|
|||
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; |
|||
|
|||
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes; |
|||
|
|||
if (volumeId && *volumeId != nullptr) |
|||
{ |
|||
localVarQueryParams[utility::conversions::to_string_t("volumeId")] = ApiClient::parameterToString(*volumeId); |
|||
} |
|||
if (collection && *collection != nullptr) |
|||
{ |
|||
localVarQueryParams[utility::conversions::to_string_t("collection")] = ApiClient::parameterToString(*collection); |
|||
} |
|||
if (fileId && *fileId != nullptr) |
|||
{ |
|||
localVarQueryParams[utility::conversions::to_string_t("fileId")] = ApiClient::parameterToString(*fileId); |
|||
} |
|||
if (read && *read != nullptr) |
|||
{ |
|||
localVarQueryParams[utility::conversions::to_string_t("read")] = ApiClient::parameterToString(*read); |
|||
} |
|||
|
|||
std::shared_ptr<IHttpBody> localVarHttpBody; |
|||
utility::string_t localVarRequestHttpContentType; |
|||
|
|||
// use JSON if possible
|
|||
if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) |
|||
{ |
|||
localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); |
|||
} |
|||
// multipart formdata
|
|||
else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) |
|||
{ |
|||
localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); |
|||
} |
|||
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end()) |
|||
{ |
|||
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded"); |
|||
} |
|||
else |
|||
{ |
|||
throw ApiException(415, utility::conversions::to_string_t("DefaultApi->dirLookup does not consume any supported media type")); |
|||
} |
|||
|
|||
|
|||
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) |
|||
.then([=](web::http::http_response localVarResponse) |
|||
{ |
|||
if (m_ApiClient->getResponseHandler()) |
|||
{ |
|||
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), localVarResponse.headers()); |
|||
} |
|||
|
|||
// 1xx - informational : OK
|
|||
// 2xx - successful : OK
|
|||
// 3xx - redirection : OK
|
|||
// 4xx - client error : not OK
|
|||
// 5xx - client error : not OK
|
|||
if (localVarResponse.status_code() >= 400) |
|||
{ |
|||
throw ApiException(localVarResponse.status_code() |
|||
, utility::conversions::to_string_t("error calling dirLookup: ") + localVarResponse.reason_phrase() |
|||
, std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get())); |
|||
} |
|||
|
|||
// check response content type
|
|||
if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) |
|||
{ |
|||
utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; |
|||
if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) |
|||
{ |
|||
throw ApiException(500 |
|||
, utility::conversions::to_string_t("error calling dirLookup: unexpected response type: ") + localVarContentType |
|||
, std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get())); |
|||
} |
|||
} |
|||
|
|||
return localVarResponse.extract_string(); |
|||
}) |
|||
.then([=](utility::string_t localVarResponse) |
|||
{ |
|||
std::shared_ptr<AnyType> localVarResult(nullptr); |
|||
|
|||
if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) |
|||
{ |
|||
web::json::value localVarJson = web::json::value::parse(localVarResponse); |
|||
|
|||
ModelBase::fromJson(localVarJson, localVarResult); |
|||
} |
|||
// else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data"))
|
|||
// {
|
|||
// TODO multipart response parsing
|
|||
// }
|
|||
else |
|||
{ |
|||
throw ApiException(500 |
|||
, utility::conversions::to_string_t("error calling dirLookup: unsupported response type")); |
|||
} |
|||
|
|||
return localVarResult; |
|||
}); |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
@ -0,0 +1,213 @@ |
|||
/**
|
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech
|
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
|
|||
|
|||
#include "CppRestOpenAPIClient/model/FileKey.h"
|
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace model { |
|||
|
|||
|
|||
|
|||
FileKey::FileKey() |
|||
{ |
|||
m_CountIsSet = false; |
|||
m_FidIsSet = false; |
|||
m_UrlIsSet = false; |
|||
} |
|||
|
|||
FileKey::~FileKey() |
|||
{ |
|||
} |
|||
|
|||
void FileKey::validate() |
|||
{ |
|||
// TODO: implement validation
|
|||
} |
|||
|
|||
web::json::value FileKey::toJson() const |
|||
{ |
|||
|
|||
web::json::value val = web::json::value::object(); |
|||
|
|||
if(m_CountIsSet) |
|||
{ |
|||
val[utility::conversions::to_string_t(U("count"))] = ModelBase::toJson(m_Count); |
|||
} |
|||
if(m_FidIsSet) |
|||
{ |
|||
val[utility::conversions::to_string_t(U("fid"))] = ModelBase::toJson(m_Fid); |
|||
} |
|||
if(m_UrlIsSet) |
|||
{ |
|||
val[utility::conversions::to_string_t(U("url"))] = ModelBase::toJson(m_Url); |
|||
} |
|||
|
|||
return val; |
|||
} |
|||
|
|||
bool FileKey::fromJson(const web::json::value& val) |
|||
{ |
|||
bool ok = true; |
|||
|
|||
if(val.has_field(utility::conversions::to_string_t(U("count")))) |
|||
{ |
|||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("count"))); |
|||
if(!fieldValue.is_null()) |
|||
{ |
|||
std::shared_ptr<AnyType> refVal_setCount; |
|||
ok &= ModelBase::fromJson(fieldValue, refVal_setCount); |
|||
setCount(refVal_setCount); |
|||
} |
|||
} |
|||
if(val.has_field(utility::conversions::to_string_t(U("fid")))) |
|||
{ |
|||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("fid"))); |
|||
if(!fieldValue.is_null()) |
|||
{ |
|||
std::shared_ptr<AnyType> refVal_setFid; |
|||
ok &= ModelBase::fromJson(fieldValue, refVal_setFid); |
|||
setFid(refVal_setFid); |
|||
} |
|||
} |
|||
if(val.has_field(utility::conversions::to_string_t(U("url")))) |
|||
{ |
|||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("url"))); |
|||
if(!fieldValue.is_null()) |
|||
{ |
|||
std::shared_ptr<AnyType> refVal_setUrl; |
|||
ok &= ModelBase::fromJson(fieldValue, refVal_setUrl); |
|||
setUrl(refVal_setUrl); |
|||
} |
|||
} |
|||
return ok; |
|||
} |
|||
|
|||
void FileKey::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const |
|||
{ |
|||
utility::string_t namePrefix = prefix; |
|||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) |
|||
{ |
|||
namePrefix += utility::conversions::to_string_t(U(".")); |
|||
} |
|||
if(m_CountIsSet) |
|||
{ |
|||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("count")), m_Count)); |
|||
} |
|||
if(m_FidIsSet) |
|||
{ |
|||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("fid")), m_Fid)); |
|||
} |
|||
if(m_UrlIsSet) |
|||
{ |
|||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("url")), m_Url)); |
|||
} |
|||
} |
|||
|
|||
bool FileKey::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) |
|||
{ |
|||
bool ok = true; |
|||
utility::string_t namePrefix = prefix; |
|||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) |
|||
{ |
|||
namePrefix += utility::conversions::to_string_t(U(".")); |
|||
} |
|||
|
|||
if(multipart->hasContent(utility::conversions::to_string_t(U("count")))) |
|||
{ |
|||
std::shared_ptr<AnyType> refVal_setCount; |
|||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("count"))), refVal_setCount ); |
|||
setCount(refVal_setCount); |
|||
} |
|||
if(multipart->hasContent(utility::conversions::to_string_t(U("fid")))) |
|||
{ |
|||
std::shared_ptr<AnyType> refVal_setFid; |
|||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("fid"))), refVal_setFid ); |
|||
setFid(refVal_setFid); |
|||
} |
|||
if(multipart->hasContent(utility::conversions::to_string_t(U("url")))) |
|||
{ |
|||
std::shared_ptr<AnyType> refVal_setUrl; |
|||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("url"))), refVal_setUrl ); |
|||
setUrl(refVal_setUrl); |
|||
} |
|||
return ok; |
|||
} |
|||
|
|||
std::shared_ptr<AnyType> FileKey::getCount() const |
|||
{ |
|||
return m_Count; |
|||
} |
|||
|
|||
void FileKey::setCount(const std::shared_ptr<AnyType>& value) |
|||
{ |
|||
m_Count = value; |
|||
m_CountIsSet = true; |
|||
} |
|||
|
|||
bool FileKey::countIsSet() const |
|||
{ |
|||
return m_CountIsSet; |
|||
} |
|||
|
|||
void FileKey::unsetCount() |
|||
{ |
|||
m_CountIsSet = false; |
|||
} |
|||
std::shared_ptr<AnyType> FileKey::getFid() const |
|||
{ |
|||
return m_Fid; |
|||
} |
|||
|
|||
void FileKey::setFid(const std::shared_ptr<AnyType>& value) |
|||
{ |
|||
m_Fid = value; |
|||
m_FidIsSet = true; |
|||
} |
|||
|
|||
bool FileKey::fidIsSet() const |
|||
{ |
|||
return m_FidIsSet; |
|||
} |
|||
|
|||
void FileKey::unsetFid() |
|||
{ |
|||
m_FidIsSet = false; |
|||
} |
|||
std::shared_ptr<AnyType> FileKey::getUrl() const |
|||
{ |
|||
return m_Url; |
|||
} |
|||
|
|||
void FileKey::setUrl(const std::shared_ptr<AnyType>& value) |
|||
{ |
|||
m_Url = value; |
|||
m_UrlIsSet = true; |
|||
} |
|||
|
|||
bool FileKey::urlIsSet() const |
|||
{ |
|||
return m_UrlIsSet; |
|||
} |
|||
|
|||
void FileKey::unsetUrl() |
|||
{ |
|||
m_UrlIsSet = false; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
@ -0,0 +1,168 @@ |
|||
/**
|
|||
* Seaweedfs Master Server API |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* NOTE: This class is auto generated by OpenAPI-Generator 6.4.0. |
|||
* https://openapi-generator.tech
|
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
|
|||
|
|||
#include "CppRestOpenAPIClient/model/Location.h"
|
|||
|
|||
namespace org { |
|||
namespace openapitools { |
|||
namespace client { |
|||
namespace model { |
|||
|
|||
|
|||
|
|||
Location::Location() |
|||
{ |
|||
m_PublicUrlIsSet = false; |
|||
m_UrlIsSet = false; |
|||
} |
|||
|
|||
Location::~Location() |
|||
{ |
|||
} |
|||
|
|||
void Location::validate() |
|||
{ |
|||
// TODO: implement validation
|
|||
} |
|||
|
|||
web::json::value Location::toJson() const |
|||
{ |
|||
|
|||
web::json::value val = web::json::value::object(); |
|||
|
|||
if(m_PublicUrlIsSet) |
|||
{ |
|||
val[utility::conversions::to_string_t(U("publicUrl"))] = ModelBase::toJson(m_PublicUrl); |
|||
} |
|||
if(m_UrlIsSet) |
|||
{ |
|||
val[utility::conversions::to_string_t(U("url"))] = ModelBase::toJson(m_Url); |
|||
} |
|||
|
|||
return val; |
|||
} |
|||
|
|||
bool Location::fromJson(const web::json::value& val) |
|||
{ |
|||
bool ok = true; |
|||
|
|||
if(val.has_field(utility::conversions::to_string_t(U("publicUrl")))) |
|||
{ |
|||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("publicUrl"))); |
|||
if(!fieldValue.is_null()) |
|||
{ |
|||
std::shared_ptr<AnyType> refVal_setPublicUrl; |
|||
ok &= ModelBase::fromJson(fieldValue, refVal_setPublicUrl); |
|||
setPublicUrl(refVal_setPublicUrl); |
|||
} |
|||
} |
|||
if(val.has_field(utility::conversions::to_string_t(U("url")))) |
|||
{ |
|||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("url"))); |
|||
if(!fieldValue.is_null()) |
|||
{ |
|||
std::shared_ptr<AnyType> refVal_setUrl; |
|||
ok &= ModelBase::fromJson(fieldValue, refVal_setUrl); |
|||
setUrl(refVal_setUrl); |
|||
} |
|||
} |
|||
return ok; |
|||
} |
|||
|
|||
void Location::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const |
|||
{ |
|||
utility::string_t namePrefix = prefix; |
|||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) |
|||
{ |
|||
namePrefix += utility::conversions::to_string_t(U(".")); |
|||
} |
|||
if(m_PublicUrlIsSet) |
|||
{ |
|||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("publicUrl")), m_PublicUrl)); |
|||
} |
|||
if(m_UrlIsSet) |
|||
{ |
|||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("url")), m_Url)); |
|||
} |
|||
} |
|||
|
|||
bool Location::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) |
|||
{ |
|||
bool ok = true; |
|||
utility::string_t namePrefix = prefix; |
|||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) |
|||
{ |
|||
namePrefix += utility::conversions::to_string_t(U(".")); |
|||
} |
|||
|
|||
if(multipart->hasContent(utility::conversions::to_string_t(U("publicUrl")))) |
|||
{ |
|||
std::shared_ptr<AnyType> refVal_setPublicUrl; |
|||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("publicUrl"))), refVal_setPublicUrl ); |
|||
setPublicUrl(refVal_setPublicUrl); |
|||
} |
|||
if(multipart->hasContent(utility::conversions::to_string_t(U("url")))) |
|||
{ |
|||
std::shared_ptr<AnyType> refVal_setUrl; |
|||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("url"))), refVal_setUrl ); |
|||
setUrl(refVal_setUrl); |
|||
} |
|||
return ok; |
|||
} |
|||
|
|||
std::shared_ptr<AnyType> Location::getPublicUrl() const |
|||
{ |
|||
return m_PublicUrl; |
|||
} |
|||
|
|||
void Location::setPublicUrl(const std::shared_ptr<AnyType>& value) |
|||
{ |
|||
m_PublicUrl = value; |
|||
m_PublicUrlIsSet = true; |
|||
} |
|||
|
|||
bool Location::publicUrlIsSet() const |
|||
{ |
|||
return m_PublicUrlIsSet; |
|||
} |
|||
|
|||
void Location::unsetPublicUrl() |
|||
{ |
|||
m_PublicUrlIsSet = false; |
|||
} |
|||
std::shared_ptr<AnyType> Location::getUrl() const |
|||
{ |
|||
return m_Url; |
|||
} |
|||
|
|||
void Location::setUrl(const std::shared_ptr<AnyType>& value) |
|||
{ |
|||
m_Url = value; |
|||
m_UrlIsSet = true; |
|||
} |
|||
|
|||
bool Location::urlIsSet() const |
|||
{ |
|||
return m_UrlIsSet; |
|||
} |
|||
|
|||
void Location::unsetUrl() |
|||
{ |
|||
m_UrlIsSet = false; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
@ -0,0 +1,362 @@ |
|||
## Ignore Visual Studio temporary files, build results, and |
|||
## files generated by popular Visual Studio add-ons. |
|||
## |
|||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore |
|||
|
|||
# User-specific files |
|||
*.rsuser |
|||
*.suo |
|||
*.user |
|||
*.userosscache |
|||
*.sln.docstates |
|||
|
|||
# User-specific files (MonoDevelop/Xamarin Studio) |
|||
*.userprefs |
|||
|
|||
# Mono auto generated files |
|||
mono_crash.* |
|||
|
|||
# Build results |
|||
[Dd]ebug/ |
|||
[Dd]ebugPublic/ |
|||
[Rr]elease/ |
|||
[Rr]eleases/ |
|||
x64/ |
|||
x86/ |
|||
[Ww][Ii][Nn]32/ |
|||
[Aa][Rr][Mm]/ |
|||
[Aa][Rr][Mm]64/ |
|||
bld/ |
|||
[Bb]in/ |
|||
[Oo]bj/ |
|||
[Ll]og/ |
|||
[Ll]ogs/ |
|||
|
|||
# Visual Studio 2015/2017 cache/options directory |
|||
.vs/ |
|||
# Uncomment if you have tasks that create the project's static files in wwwroot |
|||
#wwwroot/ |
|||
|
|||
# Visual Studio 2017 auto generated files |
|||
Generated\ Files/ |
|||
|
|||
# MSTest test Results |
|||
[Tt]est[Rr]esult*/ |
|||
[Bb]uild[Ll]og.* |
|||
|
|||
# NUnit |
|||
*.VisualState.xml |
|||
TestResult.xml |
|||
nunit-*.xml |
|||
|
|||
# Build Results of an ATL Project |
|||
[Dd]ebugPS/ |
|||
[Rr]eleasePS/ |
|||
dlldata.c |
|||
|
|||
# Benchmark Results |
|||
BenchmarkDotNet.Artifacts/ |
|||
|
|||
# .NET Core |
|||
project.lock.json |
|||
project.fragment.lock.json |
|||
artifacts/ |
|||
|
|||
# ASP.NET Scaffolding |
|||
ScaffoldingReadMe.txt |
|||
|
|||
# StyleCop |
|||
StyleCopReport.xml |
|||
|
|||
# Files built by Visual Studio |
|||
*_i.c |
|||
*_p.c |
|||
*_h.h |
|||
*.ilk |
|||
*.meta |
|||
*.obj |
|||
*.iobj |
|||
*.pch |
|||
*.pdb |
|||
*.ipdb |
|||
*.pgc |
|||
*.pgd |
|||
*.rsp |
|||
*.sbr |
|||
*.tlb |
|||
*.tli |
|||
*.tlh |
|||
*.tmp |
|||
*.tmp_proj |
|||
*_wpftmp.csproj |
|||
*.log |
|||
*.vspscc |
|||
*.vssscc |
|||
.builds |
|||
*.pidb |
|||
*.svclog |
|||
*.scc |
|||
|
|||
# Chutzpah Test files |
|||
_Chutzpah* |
|||
|
|||
# Visual C++ cache files |
|||
ipch/ |
|||
*.aps |
|||
*.ncb |
|||
*.opendb |
|||
*.opensdf |
|||
*.sdf |
|||
*.cachefile |
|||
*.VC.db |
|||
*.VC.VC.opendb |
|||
|
|||
# Visual Studio profiler |
|||
*.psess |
|||
*.vsp |
|||
*.vspx |
|||
*.sap |
|||
|
|||
# Visual Studio Trace Files |
|||
*.e2e |
|||
|
|||
# TFS 2012 Local Workspace |
|||
$tf/ |
|||
|
|||
# Guidance Automation Toolkit |
|||
*.gpState |
|||
|
|||
# ReSharper is a .NET coding add-in |
|||
_ReSharper*/ |
|||
*.[Rr]e[Ss]harper |
|||
*.DotSettings.user |
|||
|
|||
# TeamCity is a build add-in |
|||
_TeamCity* |
|||
|
|||
# DotCover is a Code Coverage Tool |
|||
*.dotCover |
|||
|
|||
# AxoCover is a Code Coverage Tool |
|||
.axoCover/* |
|||
!.axoCover/settings.json |
|||
|
|||
# Coverlet is a free, cross platform Code Coverage Tool |
|||
coverage*.json |
|||
coverage*.xml |
|||
coverage*.info |
|||
|
|||
# Visual Studio code coverage results |
|||
*.coverage |
|||
*.coveragexml |
|||
|
|||
# NCrunch |
|||
_NCrunch_* |
|||
.*crunch*.local.xml |
|||
nCrunchTemp_* |
|||
|
|||
# MightyMoose |
|||
*.mm.* |
|||
AutoTest.Net/ |
|||
|
|||
# Web workbench (sass) |
|||
.sass-cache/ |
|||
|
|||
# Installshield output folder |
|||
[Ee]xpress/ |
|||
|
|||
# DocProject is a documentation generator add-in |
|||
DocProject/buildhelp/ |
|||
DocProject/Help/*.HxT |
|||
DocProject/Help/*.HxC |
|||
DocProject/Help/*.hhc |
|||
DocProject/Help/*.hhk |
|||
DocProject/Help/*.hhp |
|||
DocProject/Help/Html2 |
|||
DocProject/Help/html |
|||
|
|||
# Click-Once directory |
|||
publish/ |
|||
|
|||
# Publish Web Output |
|||
*.[Pp]ublish.xml |
|||
*.azurePubxml |
|||
# Note: Comment the next line if you want to checkin your web deploy settings, |
|||
# but database connection strings (with potential passwords) will be unencrypted |
|||
*.pubxml |
|||
*.publishproj |
|||
|
|||
# Microsoft Azure Web App publish settings. Comment the next line if you want to |
|||
# checkin your Azure Web App publish settings, but sensitive information contained |
|||
# in these scripts will be unencrypted |
|||
PublishScripts/ |
|||
|
|||
# NuGet Packages |
|||
*.nupkg |
|||
# NuGet Symbol Packages |
|||
*.snupkg |
|||
# The packages folder can be ignored because of Package Restore |
|||
**/[Pp]ackages/* |
|||
# except build/, which is used as an MSBuild target. |
|||
!**/[Pp]ackages/build/ |
|||
# Uncomment if necessary however generally it will be regenerated when needed |
|||
#!**/[Pp]ackages/repositories.config |
|||
# NuGet v3's project.json files produces more ignorable files |
|||
*.nuget.props |
|||
*.nuget.targets |
|||
|
|||
# Microsoft Azure Build Output |
|||
csx/ |
|||
*.build.csdef |
|||
|
|||
# Microsoft Azure Emulator |
|||
ecf/ |
|||
rcf/ |
|||
|
|||
# Windows Store app package directories and files |
|||
AppPackages/ |
|||
BundleArtifacts/ |
|||
Package.StoreAssociation.xml |
|||
_pkginfo.txt |
|||
*.appx |
|||
*.appxbundle |
|||
*.appxupload |
|||
|
|||
# Visual Studio cache files |
|||
# files ending in .cache can be ignored |
|||
*.[Cc]ache |
|||
# but keep track of directories ending in .cache |
|||
!?*.[Cc]ache/ |
|||
|
|||
# Others |
|||
ClientBin/ |
|||
~$* |
|||
*~ |
|||
*.dbmdl |
|||
*.dbproj.schemaview |
|||
*.jfm |
|||
*.pfx |
|||
*.publishsettings |
|||
orleans.codegen.cs |
|||
|
|||
# Including strong name files can present a security risk |
|||
# (https://github.com/github/gitignore/pull/2483#issue-259490424) |
|||
#*.snk |
|||
|
|||
# Since there are multiple workflows, uncomment next line to ignore bower_components |
|||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) |
|||
#bower_components/ |
|||
|
|||
# RIA/Silverlight projects |
|||
Generated_Code/ |
|||
|
|||
# Backup & report files from converting an old project file |
|||
# to a newer Visual Studio version. Backup files are not needed, |
|||
# because we have git ;-) |
|||
_UpgradeReport_Files/ |
|||
Backup*/ |
|||
UpgradeLog*.XML |
|||
UpgradeLog*.htm |
|||
ServiceFabricBackup/ |
|||
*.rptproj.bak |
|||
|
|||
# SQL Server files |
|||
*.mdf |
|||
*.ldf |
|||
*.ndf |
|||
|
|||
# Business Intelligence projects |
|||
*.rdl.data |
|||
*.bim.layout |
|||
*.bim_*.settings |
|||
*.rptproj.rsuser |
|||
*- [Bb]ackup.rdl |
|||
*- [Bb]ackup ([0-9]).rdl |
|||
*- [Bb]ackup ([0-9][0-9]).rdl |
|||
|
|||
# Microsoft Fakes |
|||
FakesAssemblies/ |
|||
|
|||
# GhostDoc plugin setting file |
|||
*.GhostDoc.xml |
|||
|
|||
# Node.js Tools for Visual Studio |
|||
.ntvs_analysis.dat |
|||
node_modules/ |
|||
|
|||
# Visual Studio 6 build log |
|||
*.plg |
|||
|
|||
# Visual Studio 6 workspace options file |
|||
*.opt |
|||
|
|||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) |
|||
*.vbw |
|||
|
|||
# Visual Studio LightSwitch build output |
|||
**/*.HTMLClient/GeneratedArtifacts |
|||
**/*.DesktopClient/GeneratedArtifacts |
|||
**/*.DesktopClient/ModelManifest.xml |
|||
**/*.Server/GeneratedArtifacts |
|||
**/*.Server/ModelManifest.xml |
|||
_Pvt_Extensions |
|||
|
|||
# Paket dependency manager |
|||
.paket/paket.exe |
|||
paket-files/ |
|||
|
|||
# FAKE - F# Make |
|||
.fake/ |
|||
|
|||
# CodeRush personal settings |
|||
.cr/personal |
|||
|
|||
# Python Tools for Visual Studio (PTVS) |
|||
__pycache__/ |
|||
*.pyc |
|||
|
|||
# Cake - Uncomment if you are using it |
|||
# tools/** |
|||
# !tools/packages.config |
|||
|
|||
# Tabs Studio |
|||
*.tss |
|||
|
|||
# Telerik's JustMock configuration file |
|||
*.jmconfig |
|||
|
|||
# BizTalk build output |
|||
*.btp.cs |
|||
*.btm.cs |
|||
*.odx.cs |
|||
*.xsd.cs |
|||
|
|||
# OpenCover UI analysis results |
|||
OpenCover/ |
|||
|
|||
# Azure Stream Analytics local run output |
|||
ASALocalRun/ |
|||
|
|||
# MSBuild Binary and Structured Log |
|||
*.binlog |
|||
|
|||
# NVidia Nsight GPU debugger configuration file |
|||
*.nvuser |
|||
|
|||
# MFractors (Xamarin productivity tool) working folder |
|||
.mfractor/ |
|||
|
|||
# Local History for Visual Studio |
|||
.localhistory/ |
|||
|
|||
# BeatPulse healthcheck temp database |
|||
healthchecksdb |
|||
|
|||
# Backup folder for Package Reference Convert tool in Visual Studio 2017 |
|||
MigrationBackup/ |
|||
|
|||
# Ionide (cross platform F# VS Code tools) working folder |
|||
.ionide/ |
|||
|
|||
# Fody - auto-generated XML schema |
|||
FodyWeavers.xsd |
@ -0,0 +1,23 @@ |
|||
# OpenAPI Generator Ignore |
|||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator |
|||
|
|||
# Use this file to prevent files from being overwritten by the generator. |
|||
# The patterns follow closely to .gitignore or .dockerignore. |
|||
|
|||
# As an example, the C# client generator defines ApiClient.cs. |
|||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: |
|||
#ApiClient.cs |
|||
|
|||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): |
|||
#foo/*/qux |
|||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux |
|||
|
|||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): |
|||
#foo/**/qux |
|||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux |
|||
|
|||
# You can also negate patterns with an exclamation (!). |
|||
# For example, you can ignore all files in a docs folder with the file extension .md: |
|||
#docs/*.md |
|||
# Then explicitly reverse the ignore rule for a single file: |
|||
#!docs/README.md |
@ -0,0 +1,33 @@ |
|||
.gitignore |
|||
.openapi-generator-ignore |
|||
.travis.yml |
|||
Org.OpenAPITools.sln |
|||
README.md |
|||
build.bat |
|||
build.sh |
|||
docs/DefaultApi.md |
|||
docs/FileKey.md |
|||
docs/Location.md |
|||
git_push.sh |
|||
mono_nunit_test.sh |
|||
src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs |
|||
src/Org.OpenAPITools.Test/Model/FileKeyTests.cs |
|||
src/Org.OpenAPITools.Test/Model/LocationTests.cs |
|||
src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj |
|||
src/Org.OpenAPITools.Test/packages.config |
|||
src/Org.OpenAPITools/Api/DefaultApi.cs |
|||
src/Org.OpenAPITools/Client/ApiClient.cs |
|||
src/Org.OpenAPITools/Client/ApiException.cs |
|||
src/Org.OpenAPITools/Client/ApiResponse.cs |
|||
src/Org.OpenAPITools/Client/Configuration.cs |
|||
src/Org.OpenAPITools/Client/ExceptionFactory.cs |
|||
src/Org.OpenAPITools/Client/GlobalConfiguration.cs |
|||
src/Org.OpenAPITools/Client/IApiAccessor.cs |
|||
src/Org.OpenAPITools/Client/IReadableConfiguration.cs |
|||
src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs |
|||
src/Org.OpenAPITools/Model/FileKey.cs |
|||
src/Org.OpenAPITools/Model/Location.cs |
|||
src/Org.OpenAPITools/Org.OpenAPITools.csproj |
|||
src/Org.OpenAPITools/Org.OpenAPITools.nuspec |
|||
src/Org.OpenAPITools/Properties/AssemblyInfo.cs |
|||
src/Org.OpenAPITools/packages.config |
@ -0,0 +1 @@ |
|||
6.4.0 |
@ -0,0 +1,9 @@ |
|||
# |
|||
# Generated by: https://github.com/openapitools/openapi-generator.git |
|||
# |
|||
language: csharp |
|||
mono: |
|||
- latest |
|||
solution: Org.OpenAPITools.sln |
|||
script: |
|||
- /bin/sh ./mono_nunit_test.sh |
@ -0,0 +1,27 @@ |
|||
Microsoft Visual Studio Solution File, Format Version 12.00 |
|||
# Visual Studio 2012 |
|||
VisualStudioVersion = 12.0.0.0 |
|||
MinimumVisualStudioVersion = 10.0.0.1 |
|||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{BC7B99B9-DA58-46D9-BFF5-76505068ECE5}" |
|||
EndProject |
|||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools.Test", "src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" |
|||
EndProject |
|||
Global |
|||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|||
Debug|Any CPU = Debug|Any CPU |
|||
Release|Any CPU = Release|Any CPU |
|||
EndGlobalSection |
|||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
|||
{BC7B99B9-DA58-46D9-BFF5-76505068ECE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{BC7B99B9-DA58-46D9-BFF5-76505068ECE5}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{BC7B99B9-DA58-46D9-BFF5-76505068ECE5}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{BC7B99B9-DA58-46D9-BFF5-76505068ECE5}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
EndGlobalSection |
|||
GlobalSection(SolutionProperties) = preSolution |
|||
HideSolutionNode = FALSE |
|||
EndGlobalSection |
|||
EndGlobal |
@ -0,0 +1,130 @@ |
|||
# Org.OpenAPITools - the C# library for the Seaweedfs Master Server API |
|||
|
|||
The Seaweedfs Master Server API allows you to store blobs |
|||
|
|||
This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: |
|||
|
|||
- API version: 3.43.0 |
|||
- SDK version: 1.0.0 |
|||
- Build package: org.openapitools.codegen.languages.CSharpClientCodegen |
|||
|
|||
## Frameworks supported |
|||
|
|||
|
|||
- .NET 4.0 or later |
|||
- Windows Phone 7.1 (Mango) |
|||
|
|||
## Dependencies |
|||
|
|||
|
|||
- [RestSharp](https://www.nuget.org/packages/RestSharp) - 105.1.0 or later |
|||
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later |
|||
- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.2.0 or later |
|||
|
|||
The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: |
|||
|
|||
``` |
|||
Install-Package RestSharp |
|||
Install-Package Newtonsoft.Json |
|||
Install-Package JsonSubTypes |
|||
``` |
|||
|
|||
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742) |
|||
|
|||
## Installation |
|||
|
|||
Run the following command to generate the DLL |
|||
|
|||
- [Mac/Linux] `/bin/sh build.sh` |
|||
- [Windows] `build.bat` |
|||
|
|||
Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces: |
|||
|
|||
```csharp |
|||
using Org.OpenAPITools.Api; |
|||
using Org.OpenAPITools.Client; |
|||
using Org.OpenAPITools.Model; |
|||
|
|||
``` |
|||
|
|||
|
|||
## Packaging |
|||
|
|||
A `.nuspec` is included with the project. You can follow the Nuget quickstart to [create](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#create-the-package) and [publish](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#publish-the-package) packages. |
|||
|
|||
This `.nuspec` uses placeholders from the `.csproj`, so build the `.csproj` directly: |
|||
|
|||
``` |
|||
nuget pack -Build -OutputDirectory out Org.OpenAPITools.csproj |
|||
``` |
|||
|
|||
Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-packages/local-feeds) or [other host](https://docs.microsoft.com/en-us/nuget/hosting-packages/overview) and consume the new package via Nuget as usual. |
|||
|
|||
|
|||
## Getting Started |
|||
|
|||
```csharp |
|||
using System.Collections.Generic; |
|||
using System.Diagnostics; |
|||
using Org.OpenAPITools.Api; |
|||
using Org.OpenAPITools.Client; |
|||
using Org.OpenAPITools.Model; |
|||
|
|||
namespace Example |
|||
{ |
|||
public class Example |
|||
{ |
|||
public static void Main() |
|||
{ |
|||
|
|||
Configuration.Default.BasePath = "https://127.0.0.1:9333"; |
|||
var apiInstance = new DefaultApi(Configuration.Default); |
|||
var count = new Object(); // Object | how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 (optional) |
|||
var collection = new Object(); // Object | required collection name (optional) |
|||
var dataCenter = new Object(); // Object | preferred data center (optional) |
|||
var rack = new Object(); // Object | preferred rack (optional) |
|||
var dataNode = new Object(); // Object | preferred volume server, e.g. 127.0.0.1:8080 (optional) |
|||
var disk = new Object(); // Object | If you have disks labelled, this must be supplied to specify the disk type to allocate on. (optional) |
|||
var replication = new Object(); // Object | replica placement strategy (optional) |
|||
var ttl = new Object(); // Object | file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year (optional) |
|||
var preallocate = new Object(); // Object | If no matching volumes, pre-allocate this number of bytes on disk for new volumes. (optional) |
|||
var memoryMapMaxSizeMb = new Object(); // Object | Only implemented for windows. Use memory mapped files with specified size for new volumes. (optional) |
|||
var writableVolumeCount = new Object(); // Object | If no matching volumes, create specified number of new volumes. (optional) |
|||
|
|||
try |
|||
{ |
|||
// Assign a file key |
|||
FileKey result = apiInstance.DirAssign(count, collection, dataCenter, rack, dataNode, disk, replication, ttl, preallocate, memoryMapMaxSizeMb, writableVolumeCount); |
|||
Debug.WriteLine(result); |
|||
} |
|||
catch (ApiException e) |
|||
{ |
|||
Debug.Print("Exception when calling DefaultApi.DirAssign: " + e.Message ); |
|||
Debug.Print("Status Code: "+ e.ErrorCode); |
|||
Debug.Print(e.StackTrace); |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
``` |
|||
|
|||
## Documentation for API Endpoints |
|||
|
|||
All URIs are relative to *https://127.0.0.1:9333* |
|||
|
|||
Class | Method | HTTP request | Description |
|||
------------ | ------------- | ------------- | ------------- |
|||
*DefaultApi* | [**DirAssign**](docs/DefaultApi.md#dirassign) | **GET** /dir/assign | Assign a file key |
|||
*DefaultApi* | [**DirLookup**](docs/DefaultApi.md#dirlookup) | **GET** /dir/lookup | Lookup volume |
|||
|
|||
|
|||
## Documentation for Models |
|||
|
|||
- [Model.FileKey](docs/FileKey.md) |
|||
- [Model.Location](docs/Location.md) |
|||
|
|||
|
|||
## Documentation for Authorization |
|||
|
|||
All endpoints do not require authorization. |
@ -0,0 +1,16 @@ |
|||
:: Generated by: https://github.com/openapitools/openapi-generator.git |
|||
:: |
|||
|
|||
@echo off |
|||
|
|||
SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319 |
|||
|
|||
if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '.\nuget.exe')" |
|||
.\nuget.exe install src\Org.OpenAPITools\packages.config -o packages |
|||
|
|||
if not exist ".\bin" mkdir bin |
|||
|
|||
copy packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll |
|||
copy packages\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll bin\JsonSubTypes.dll |
|||
copy packages\RestSharp.105.1.0\lib\net45\RestSharp.dll bin\RestSharp.dll |
|||
%CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\JsonSubTypes.dll;bin\RestSharp.dll;System.ComponentModel.DataAnnotations.dll /target:library /out:bin\Org.OpenAPITools.dll /recurse:src\Org.OpenAPITools\*.cs /doc:bin\Org.OpenAPITools.xml |
@ -0,0 +1,68 @@ |
|||
#!/usr/bin/env bash |
|||
# |
|||
# Generated by: https://github.com/openapitools/openapi-generator.git |
|||
# |
|||
|
|||
frameworkVersion=net45 |
|||
|
|||
# sdk must match installed frameworks under PREFIX/lib/mono/[value] |
|||
sdk=4.5.2-api |
|||
|
|||
# langversion refers to C# language features. see man mcs for details. |
|||
langversion=${sdk} |
|||
nuget_cmd=nuget |
|||
|
|||
# Match against our known SDK possibilities |
|||
case "${sdk}" in |
|||
4) |
|||
langversion=4 |
|||
;; |
|||
4.5*) |
|||
langversion=5 |
|||
;; |
|||
4.6*) |
|||
langversion=6 |
|||
;; |
|||
4.7*) |
|||
langversion=7 # ignoring 7.1 for now. |
|||
;; |
|||
*) |
|||
langversion=6 |
|||
;; |
|||
esac |
|||
|
|||
echo "[INFO] Target framework: ${frameworkVersion}" |
|||
|
|||
if ! type nuget &>/dev/null; then |
|||
echo "[INFO] Download nuget and packages" |
|||
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe; |
|||
nuget_cmd="mono nuget.exe" |
|||
fi |
|||
|
|||
mozroots --import --sync |
|||
${nuget_cmd} install src/Org.OpenAPITools/packages.config -o packages; |
|||
|
|||
echo "[INFO] Copy DLLs to the 'bin' folder" |
|||
mkdir -p bin; |
|||
cp packages/Newtonsoft.Json.12.0.3/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; |
|||
cp packages/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll; |
|||
cp packages/JsonSubTypes.1.6.0/lib/net45/JsonSubTypes.dll bin/JsonSubTypes.dll |
|||
|
|||
echo "[INFO] Run 'mcs' to build bin/Org.OpenAPITools.dll" |
|||
mcs -langversion:${langversion} -sdk:${sdk} -r:bin/Newtonsoft.Json.dll,bin/JsonSubTypes.dll,\ |
|||
bin/RestSharp.dll,\ |
|||
System.ComponentModel.DataAnnotations.dll,\ |
|||
System.Runtime.Serialization.dll \ |
|||
-target:library \ |
|||
-out:bin/Org.OpenAPITools.dll \ |
|||
-recurse:'src/Org.OpenAPITools/*.cs' \ |
|||
-doc:bin/Org.OpenAPITools.xml \ |
|||
-platform:anycpu |
|||
|
|||
if [ $? -ne 0 ] |
|||
then |
|||
echo "[ERROR] Compilation failed with exit code $?" |
|||
exit 1 |
|||
else |
|||
echo "[INFO] bin/Org.OpenAPITools.dll was created successfully" |
|||
fi |
@ -0,0 +1,188 @@ |
|||
# Org.OpenAPITools.Api.DefaultApi |
|||
|
|||
All URIs are relative to *https://127.0.0.1:9333* |
|||
|
|||
Method | HTTP request | Description |
|||
------------- | ------------- | ------------- |
|||
[**DirAssign**](DefaultApi.md#dirassign) | **GET** /dir/assign | Assign a file key |
|||
[**DirLookup**](DefaultApi.md#dirlookup) | **GET** /dir/lookup | Lookup volume |
|||
|
|||
|
|||
|
|||
## DirAssign |
|||
|
|||
> FileKey DirAssign (Object count = null, Object collection = null, Object dataCenter = null, Object rack = null, Object dataNode = null, Object disk = null, Object replication = null, Object ttl = null, Object preallocate = null, Object memoryMapMaxSizeMb = null, Object writableVolumeCount = null) |
|||
|
|||
Assign a file key |
|||
|
|||
This operation is very cheap. Just increase a number in master server's memory. |
|||
|
|||
### Example |
|||
|
|||
```csharp |
|||
using System.Collections.Generic; |
|||
using System.Diagnostics; |
|||
using Org.OpenAPITools.Api; |
|||
using Org.OpenAPITools.Client; |
|||
using Org.OpenAPITools.Model; |
|||
|
|||
namespace Example |
|||
{ |
|||
public class DirAssignExample |
|||
{ |
|||
public static void Main() |
|||
{ |
|||
Configuration.Default.BasePath = "https://127.0.0.1:9333"; |
|||
var apiInstance = new DefaultApi(Configuration.Default); |
|||
var count = new Object(); // Object | how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 (optional) |
|||
var collection = new Object(); // Object | required collection name (optional) |
|||
var dataCenter = new Object(); // Object | preferred data center (optional) |
|||
var rack = new Object(); // Object | preferred rack (optional) |
|||
var dataNode = new Object(); // Object | preferred volume server, e.g. 127.0.0.1:8080 (optional) |
|||
var disk = new Object(); // Object | If you have disks labelled, this must be supplied to specify the disk type to allocate on. (optional) |
|||
var replication = new Object(); // Object | replica placement strategy (optional) |
|||
var ttl = new Object(); // Object | file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year (optional) |
|||
var preallocate = new Object(); // Object | If no matching volumes, pre-allocate this number of bytes on disk for new volumes. (optional) |
|||
var memoryMapMaxSizeMb = new Object(); // Object | Only implemented for windows. Use memory mapped files with specified size for new volumes. (optional) |
|||
var writableVolumeCount = new Object(); // Object | If no matching volumes, create specified number of new volumes. (optional) |
|||
|
|||
try |
|||
{ |
|||
// Assign a file key |
|||
FileKey result = apiInstance.DirAssign(count, collection, dataCenter, rack, dataNode, disk, replication, ttl, preallocate, memoryMapMaxSizeMb, writableVolumeCount); |
|||
Debug.WriteLine(result); |
|||
} |
|||
catch (ApiException e) |
|||
{ |
|||
Debug.Print("Exception when calling DefaultApi.DirAssign: " + e.Message ); |
|||
Debug.Print("Status Code: "+ e.ErrorCode); |
|||
Debug.Print(e.StackTrace); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
``` |
|||
|
|||
### Parameters |
|||
|
|||
|
|||
Name | Type | Description | Notes |
|||
------------- | ------------- | ------------- | ------------- |
|||
**count** | [**Object**](Object.md)| how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 | [optional] |
|||
**collection** | [**Object**](Object.md)| required collection name | [optional] |
|||
**dataCenter** | [**Object**](Object.md)| preferred data center | [optional] |
|||
**rack** | [**Object**](Object.md)| preferred rack | [optional] |
|||
**dataNode** | [**Object**](Object.md)| preferred volume server, e.g. 127.0.0.1:8080 | [optional] |
|||
**disk** | [**Object**](Object.md)| If you have disks labelled, this must be supplied to specify the disk type to allocate on. | [optional] |
|||
**replication** | [**Object**](Object.md)| replica placement strategy | [optional] |
|||
**ttl** | [**Object**](Object.md)| file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year | [optional] |
|||
**preallocate** | [**Object**](Object.md)| If no matching volumes, pre-allocate this number of bytes on disk for new volumes. | [optional] |
|||
**memoryMapMaxSizeMb** | [**Object**](Object.md)| Only implemented for windows. Use memory mapped files with specified size for new volumes. | [optional] |
|||
**writableVolumeCount** | [**Object**](Object.md)| If no matching volumes, create specified number of new volumes. | [optional] |
|||
|
|||
### Return type |
|||
|
|||
[**FileKey**](FileKey.md) |
|||
|
|||
### Authorization |
|||
|
|||
No authorization required |
|||
|
|||
### HTTP request headers |
|||
|
|||
- **Content-Type**: Not defined |
|||
- **Accept**: application/json |
|||
|
|||
|
|||
### HTTP response details |
|||
| Status code | Description | Response headers | |
|||
|-------------|-------------|------------------| |
|||
| **200** | successful operation | - | |
|||
|
|||
[[Back to top]](#) |
|||
[[Back to API list]](../README.md#documentation-for-api-endpoints) |
|||
[[Back to Model list]](../README.md#documentation-for-models) |
|||
[[Back to README]](../README.md) |
|||
|
|||
|
|||
## DirLookup |
|||
|
|||
> Object DirLookup (Object volumeId = null, Object collection = null, Object fileId = null, Object read = null) |
|||
|
|||
Lookup volume |
|||
|
|||
We would need to find out whether the volumes have moved. |
|||
|
|||
### Example |
|||
|
|||
```csharp |
|||
using System.Collections.Generic; |
|||
using System.Diagnostics; |
|||
using Org.OpenAPITools.Api; |
|||
using Org.OpenAPITools.Client; |
|||
using Org.OpenAPITools.Model; |
|||
|
|||
namespace Example |
|||
{ |
|||
public class DirLookupExample |
|||
{ |
|||
public static void Main() |
|||
{ |
|||
Configuration.Default.BasePath = "https://127.0.0.1:9333"; |
|||
var apiInstance = new DefaultApi(Configuration.Default); |
|||
var volumeId = new Object(); // Object | volume id (optional) |
|||
var collection = new Object(); // Object | optionally to speed up the lookup (optional) |
|||
var fileId = new Object(); // Object | If provided, this returns the fileId location and a JWT to update or delete the file. (optional) |
|||
var read = new Object(); // Object | works together with \"fileId\", if read=yes, JWT is generated for reads. (optional) |
|||
|
|||
try |
|||
{ |
|||
// Lookup volume |
|||
Object result = apiInstance.DirLookup(volumeId, collection, fileId, read); |
|||
Debug.WriteLine(result); |
|||
} |
|||
catch (ApiException e) |
|||
{ |
|||
Debug.Print("Exception when calling DefaultApi.DirLookup: " + e.Message ); |
|||
Debug.Print("Status Code: "+ e.ErrorCode); |
|||
Debug.Print(e.StackTrace); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
``` |
|||
|
|||
### Parameters |
|||
|
|||
|
|||
Name | Type | Description | Notes |
|||
------------- | ------------- | ------------- | ------------- |
|||
**volumeId** | [**Object**](Object.md)| volume id | [optional] |
|||
**collection** | [**Object**](Object.md)| optionally to speed up the lookup | [optional] |
|||
**fileId** | [**Object**](Object.md)| If provided, this returns the fileId location and a JWT to update or delete the file. | [optional] |
|||
**read** | [**Object**](Object.md)| works together with \"fileId\", if read=yes, JWT is generated for reads. | [optional] |
|||
|
|||
### Return type |
|||
|
|||
**Object** |
|||
|
|||
### Authorization |
|||
|
|||
No authorization required |
|||
|
|||
### HTTP request headers |
|||
|
|||
- **Content-Type**: Not defined |
|||
- **Accept**: application/json |
|||
|
|||
|
|||
### HTTP response details |
|||
| Status code | Description | Response headers | |
|||
|-------------|-------------|------------------| |
|||
| **200** | successful operation | - | |
|||
|
|||
[[Back to top]](#) |
|||
[[Back to API list]](../README.md#documentation-for-api-endpoints) |
|||
[[Back to Model list]](../README.md#documentation-for-models) |
|||
[[Back to README]](../README.md) |
|||
|
@ -0,0 +1,15 @@ |
|||
|
|||
# Org.OpenAPITools.Model.FileKey |
|||
|
|||
## Properties |
|||
|
|||
Name | Type | Description | Notes |
|||
------------ | ------------- | ------------- | ------------- |
|||
**Count** | **Object** | | [optional] |
|||
**Fid** | **Object** | | [optional] |
|||
**Url** | **Object** | | [optional] |
|||
|
|||
[[Back to Model list]](../README.md#documentation-for-models) |
|||
[[Back to API list]](../README.md#documentation-for-api-endpoints) |
|||
[[Back to README]](../README.md) |
|||
|
@ -0,0 +1,14 @@ |
|||
|
|||
# Org.OpenAPITools.Model.Location |
|||
|
|||
## Properties |
|||
|
|||
Name | Type | Description | Notes |
|||
------------ | ------------- | ------------- | ------------- |
|||
**PublicUrl** | **Object** | | [optional] |
|||
**Url** | **Object** | | [optional] |
|||
|
|||
[[Back to Model list]](../README.md#documentation-for-models) |
|||
[[Back to API list]](../README.md#documentation-for-api-endpoints) |
|||
[[Back to README]](../README.md) |
|||
|
@ -0,0 +1,57 @@ |
|||
#!/bin/sh |
|||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ |
|||
# |
|||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" |
|||
|
|||
git_user_id=$1 |
|||
git_repo_id=$2 |
|||
release_note=$3 |
|||
git_host=$4 |
|||
|
|||
if [ "$git_host" = "" ]; then |
|||
git_host="github.com" |
|||
echo "[INFO] No command line input provided. Set \$git_host to $git_host" |
|||
fi |
|||
|
|||
if [ "$git_user_id" = "" ]; then |
|||
git_user_id="GIT_USER_ID" |
|||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" |
|||
fi |
|||
|
|||
if [ "$git_repo_id" = "" ]; then |
|||
git_repo_id="GIT_REPO_ID" |
|||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" |
|||
fi |
|||
|
|||
if [ "$release_note" = "" ]; then |
|||
release_note="Minor update" |
|||
echo "[INFO] No command line input provided. Set \$release_note to $release_note" |
|||
fi |
|||
|
|||
# Initialize the local directory as a Git repository |
|||
git init |
|||
|
|||
# Adds the files in the local repository and stages them for commit. |
|||
git add . |
|||
|
|||
# Commits the tracked changes and prepares them to be pushed to a remote repository. |
|||
git commit -m "$release_note" |
|||
|
|||
# Sets the new remote |
|||
git_remote=$(git remote) |
|||
if [ "$git_remote" = "" ]; then # git remote not defined |
|||
|
|||
if [ "$GIT_TOKEN" = "" ]; then |
|||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." |
|||
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git |
|||
else |
|||
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git |
|||
fi |
|||
|
|||
fi |
|||
|
|||
git pull origin master |
|||
|
|||
# Pushes (Forces) the changes in the local repository up to the remote repository |
|||
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" |
|||
git push origin master 2>&1 | grep -v 'To https' |
@ -0,0 +1,22 @@ |
|||
#!/usr/bin/env bash |
|||
# |
|||
# Generated by: https://github.com/openapitools/openapi-generator.git |
|||
# |
|||
|
|||
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe |
|||
mozroots --import --sync |
|||
|
|||
echo "[INFO] remove bin/Debug/Org.OpenAPITools.Test.dll" |
|||
rm src/Org.OpenAPITools.Test/bin/Debug/Org.OpenAPITools.Test.dll 2> /dev/null |
|||
|
|||
echo "[INFO] install NUnit runners via NuGet" |
|||
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe |
|||
mozroots --import --sync |
|||
mono nuget.exe install src/Org.OpenAPITools.Test/packages.config -o packages |
|||
|
|||
echo "[INFO] Install NUnit Console 3.x runners via NuGet" |
|||
mono nuget.exe install NUnit.ConsoleRunner -Version 3.10.0 -OutputDirectory packages |
|||
|
|||
echo "[INFO] Build the solution and run the unit test" |
|||
xbuild Org.OpenAPITools.sln && \ |
|||
mono ./packages/NUnit.ConsoleRunner.3.10.0/tools/nunit3-console.exe src/Org.OpenAPITools.Test/bin/Debug/Org.OpenAPITools.Test.dll |
@ -0,0 +1,105 @@ |
|||
/* |
|||
* Seaweedfs Master Server API |
|||
* |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
|||
*/ |
|||
|
|||
using System; |
|||
using System.IO; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
using System.Linq; |
|||
using System.Reflection; |
|||
using RestSharp; |
|||
using NUnit.Framework; |
|||
|
|||
using Org.OpenAPITools.Client; |
|||
using Org.OpenAPITools.Api; |
|||
using Org.OpenAPITools.Model; |
|||
|
|||
namespace Org.OpenAPITools.Test |
|||
{ |
|||
/// <summary>
|
|||
/// Class for testing DefaultApi
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
|
|||
/// Please update the test case below to test the API endpoint.
|
|||
/// </remarks>
|
|||
public class DefaultApiTests |
|||
{ |
|||
private DefaultApi instance; |
|||
|
|||
/// <summary>
|
|||
/// Setup before each unit test
|
|||
/// </summary>
|
|||
[SetUp] |
|||
public void Init() |
|||
{ |
|||
instance = new DefaultApi(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Clean up after each unit test
|
|||
/// </summary>
|
|||
[TearDown] |
|||
public void Cleanup() |
|||
{ |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Test an instance of DefaultApi
|
|||
/// </summary>
|
|||
[Test] |
|||
public void InstanceTest() |
|||
{ |
|||
// TODO uncomment below to test 'IsInstanceOf' DefaultApi
|
|||
//Assert.IsInstanceOf(typeof(DefaultApi), instance);
|
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// Test DirAssign
|
|||
/// </summary>
|
|||
[Test] |
|||
public void DirAssignTest() |
|||
{ |
|||
// TODO uncomment below to test the method and replace null with proper value
|
|||
//Object count = null;
|
|||
//Object collection = null;
|
|||
//Object dataCenter = null;
|
|||
//Object rack = null;
|
|||
//Object dataNode = null;
|
|||
//Object disk = null;
|
|||
//Object replication = null;
|
|||
//Object ttl = null;
|
|||
//Object preallocate = null;
|
|||
//Object memoryMapMaxSizeMb = null;
|
|||
//Object writableVolumeCount = null;
|
|||
//var response = instance.DirAssign(count, collection, dataCenter, rack, dataNode, disk, replication, ttl, preallocate, memoryMapMaxSizeMb, writableVolumeCount);
|
|||
//Assert.IsInstanceOf(typeof(FileKey), response, "response is FileKey");
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Test DirLookup
|
|||
/// </summary>
|
|||
[Test] |
|||
public void DirLookupTest() |
|||
{ |
|||
// TODO uncomment below to test the method and replace null with proper value
|
|||
//Object volumeId = null;
|
|||
//Object collection = null;
|
|||
//Object fileId = null;
|
|||
//Object read = null;
|
|||
//var response = instance.DirLookup(volumeId, collection, fileId, read);
|
|||
//Assert.IsInstanceOf(typeof(Object), response, "response is Object");
|
|||
} |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,95 @@ |
|||
/* |
|||
* Seaweedfs Master Server API |
|||
* |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
|||
*/ |
|||
|
|||
|
|||
using NUnit.Framework; |
|||
|
|||
using System; |
|||
using System.Linq; |
|||
using System.IO; |
|||
using System.Collections.Generic; |
|||
using Org.OpenAPITools.Api; |
|||
using Org.OpenAPITools.Model; |
|||
using Org.OpenAPITools.Client; |
|||
using System.Reflection; |
|||
using Newtonsoft.Json; |
|||
|
|||
namespace Org.OpenAPITools.Test |
|||
{ |
|||
/// <summary>
|
|||
/// Class for testing FileKey
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
|
|||
/// Please update the test case below to test the model.
|
|||
/// </remarks>
|
|||
public class FileKeyTests |
|||
{ |
|||
// TODO uncomment below to declare an instance variable for FileKey
|
|||
//private FileKey instance;
|
|||
|
|||
/// <summary>
|
|||
/// Setup before each test
|
|||
/// </summary>
|
|||
[SetUp] |
|||
public void Init() |
|||
{ |
|||
// TODO uncomment below to create an instance of FileKey
|
|||
//instance = new FileKey();
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Clean up after each test
|
|||
/// </summary>
|
|||
[TearDown] |
|||
public void Cleanup() |
|||
{ |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Test an instance of FileKey
|
|||
/// </summary>
|
|||
[Test] |
|||
public void FileKeyInstanceTest() |
|||
{ |
|||
// TODO uncomment below to test "IsInstanceOf" FileKey
|
|||
//Assert.IsInstanceOf(typeof(FileKey), instance);
|
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// Test the property 'Count'
|
|||
/// </summary>
|
|||
[Test] |
|||
public void CountTest() |
|||
{ |
|||
// TODO unit test for the property 'Count'
|
|||
} |
|||
/// <summary>
|
|||
/// Test the property 'Fid'
|
|||
/// </summary>
|
|||
[Test] |
|||
public void FidTest() |
|||
{ |
|||
// TODO unit test for the property 'Fid'
|
|||
} |
|||
/// <summary>
|
|||
/// Test the property 'Url'
|
|||
/// </summary>
|
|||
[Test] |
|||
public void UrlTest() |
|||
{ |
|||
// TODO unit test for the property 'Url'
|
|||
} |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,87 @@ |
|||
/* |
|||
* Seaweedfs Master Server API |
|||
* |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
|||
*/ |
|||
|
|||
|
|||
using NUnit.Framework; |
|||
|
|||
using System; |
|||
using System.Linq; |
|||
using System.IO; |
|||
using System.Collections.Generic; |
|||
using Org.OpenAPITools.Api; |
|||
using Org.OpenAPITools.Model; |
|||
using Org.OpenAPITools.Client; |
|||
using System.Reflection; |
|||
using Newtonsoft.Json; |
|||
|
|||
namespace Org.OpenAPITools.Test |
|||
{ |
|||
/// <summary>
|
|||
/// Class for testing Location
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
|
|||
/// Please update the test case below to test the model.
|
|||
/// </remarks>
|
|||
public class LocationTests |
|||
{ |
|||
// TODO uncomment below to declare an instance variable for Location
|
|||
//private Location instance;
|
|||
|
|||
/// <summary>
|
|||
/// Setup before each test
|
|||
/// </summary>
|
|||
[SetUp] |
|||
public void Init() |
|||
{ |
|||
// TODO uncomment below to create an instance of Location
|
|||
//instance = new Location();
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Clean up after each test
|
|||
/// </summary>
|
|||
[TearDown] |
|||
public void Cleanup() |
|||
{ |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Test an instance of Location
|
|||
/// </summary>
|
|||
[Test] |
|||
public void LocationInstanceTest() |
|||
{ |
|||
// TODO uncomment below to test "IsInstanceOf" Location
|
|||
//Assert.IsInstanceOf(typeof(Location), instance);
|
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// Test the property 'PublicUrl'
|
|||
/// </summary>
|
|||
[Test] |
|||
public void PublicUrlTest() |
|||
{ |
|||
// TODO unit test for the property 'PublicUrl'
|
|||
} |
|||
/// <summary>
|
|||
/// Test the property 'Url'
|
|||
/// </summary>
|
|||
[Test] |
|||
public void UrlTest() |
|||
{ |
|||
// TODO unit test for the property 'Url'
|
|||
} |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,88 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
Seaweedfs Master Server API |
|||
|
|||
The Seaweedfs Master Server API allows you to store blobs |
|||
|
|||
The version of the OpenAPI document: 3.43.0 |
|||
|
|||
--> |
|||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup> |
|||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|||
<ProjectGuid>{19F1DEBC-DE5E-4517-8062-F000CD499087}</ProjectGuid> |
|||
<OutputType>Library</OutputType> |
|||
<AppDesignerFolder>Properties</AppDesignerFolder> |
|||
<RootNamespace>Org.OpenAPITools.Test</RootNamespace> |
|||
<AssemblyName>Org.OpenAPITools.Test</AssemblyName> |
|||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> |
|||
<FileAlignment>512</FileAlignment> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|||
<DebugSymbols>true</DebugSymbols> |
|||
<DebugType>full</DebugType> |
|||
<Optimize>false</Optimize> |
|||
<OutputPath>bin\Debug\</OutputPath> |
|||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|||
<DebugType>pdbonly</DebugType> |
|||
<Optimize>true</Optimize> |
|||
<OutputPath>bin\Release\</OutputPath> |
|||
<DefineConstants>TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<Reference Include="System" /> |
|||
<Reference Include="System.Core" /> |
|||
<Reference Include="System.Xml.Linq" /> |
|||
<Reference Include="System.Data.DataSetExtensions" /> |
|||
<Reference Include="System.ComponentModel.DataAnnotations" /> |
|||
<Reference Include="Microsoft.CSharp" /> |
|||
<Reference Include="System.Data" /> |
|||
<Reference Include="System.Runtime.Serialization" /> |
|||
<Reference Include="System.Xml" /> |
|||
<Reference Include="Newtonsoft.Json"> |
|||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> |
|||
<HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> |
|||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> |
|||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> |
|||
</Reference> |
|||
<Reference Include="JsonSubTypes"> |
|||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll</HintPath> |
|||
<HintPath Condition="Exists('..\packages')">..\packages\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll</HintPath> |
|||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll</HintPath> |
|||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll</HintPath> |
|||
</Reference> |
|||
<Reference Include="RestSharp"> |
|||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath> |
|||
<HintPath Condition="Exists('..\packages')">..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath> |
|||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath> |
|||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath> |
|||
</Reference> |
|||
<Reference Include="nunit.framework"> |
|||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll</HintPath> |
|||
<HintPath Condition="Exists('..\packages')">..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll</HintPath> |
|||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll</HintPath> |
|||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\NUnit.3.11.0\lib\net45\nunit.framework.dll</HintPath> |
|||
</Reference> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<Compile Include="**\*.cs" |
|||
Exclude="obj\**"/> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<None Include="packages.config" /> |
|||
</ItemGroup> |
|||
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" /> |
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Org.OpenAPITools\Org.OpenAPITools.csproj"> |
|||
<Project>{BC7B99B9-DA58-46D9-BFF5-76505068ECE5}</Project> |
|||
<Name>Org.OpenAPITools</Name> |
|||
</ProjectReference> |
|||
</ItemGroup> |
|||
</Project> |
@ -0,0 +1,7 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<packages> |
|||
<package id="NUnit" version="3.11.0" targetFramework="net45" /> |
|||
<package id="RestSharp" version="105.1.0" targetFramework="net45" developmentDependency="true" /> |
|||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net45" developmentDependency="true" /> |
|||
<package id="JsonSubTypes" version="1.6.0" targetFramework="net45" developmentDependency="true" /> |
|||
</packages> |
@ -0,0 +1,618 @@ |
|||
/* |
|||
* Seaweedfs Master Server API |
|||
* |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
|||
*/ |
|||
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
using System.Linq; |
|||
using System.Threading; |
|||
using RestSharp; |
|||
using Org.OpenAPITools.Client; |
|||
using Org.OpenAPITools.Model; |
|||
|
|||
namespace Org.OpenAPITools.Api |
|||
{ |
|||
/// <summary>
|
|||
/// Represents a collection of functions to interact with the API endpoints
|
|||
/// </summary>
|
|||
public interface IDefaultApi : IApiAccessor |
|||
{ |
|||
#region Synchronous Operations
|
|||
/// <summary>
|
|||
/// Assign a file key
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// This operation is very cheap. Just increase a number in master server's memory.
|
|||
/// </remarks>
|
|||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
|||
/// <param name="count">how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 (optional)</param>
|
|||
/// <param name="collection">required collection name (optional)</param>
|
|||
/// <param name="dataCenter">preferred data center (optional)</param>
|
|||
/// <param name="rack">preferred rack (optional)</param>
|
|||
/// <param name="dataNode">preferred volume server, e.g. 127.0.0.1:8080 (optional)</param>
|
|||
/// <param name="disk">If you have disks labelled, this must be supplied to specify the disk type to allocate on. (optional)</param>
|
|||
/// <param name="replication">replica placement strategy (optional)</param>
|
|||
/// <param name="ttl">file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year (optional)</param>
|
|||
/// <param name="preallocate">If no matching volumes, pre-allocate this number of bytes on disk for new volumes. (optional)</param>
|
|||
/// <param name="memoryMapMaxSizeMb">Only implemented for windows. Use memory mapped files with specified size for new volumes. (optional)</param>
|
|||
/// <param name="writableVolumeCount">If no matching volumes, create specified number of new volumes. (optional)</param>
|
|||
/// <returns>FileKey</returns>
|
|||
FileKey DirAssign (Object count = default(Object), Object collection = default(Object), Object dataCenter = default(Object), Object rack = default(Object), Object dataNode = default(Object), Object disk = default(Object), Object replication = default(Object), Object ttl = default(Object), Object preallocate = default(Object), Object memoryMapMaxSizeMb = default(Object), Object writableVolumeCount = default(Object)); |
|||
|
|||
/// <summary>
|
|||
/// Assign a file key
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// This operation is very cheap. Just increase a number in master server's memory.
|
|||
/// </remarks>
|
|||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
|||
/// <param name="count">how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 (optional)</param>
|
|||
/// <param name="collection">required collection name (optional)</param>
|
|||
/// <param name="dataCenter">preferred data center (optional)</param>
|
|||
/// <param name="rack">preferred rack (optional)</param>
|
|||
/// <param name="dataNode">preferred volume server, e.g. 127.0.0.1:8080 (optional)</param>
|
|||
/// <param name="disk">If you have disks labelled, this must be supplied to specify the disk type to allocate on. (optional)</param>
|
|||
/// <param name="replication">replica placement strategy (optional)</param>
|
|||
/// <param name="ttl">file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year (optional)</param>
|
|||
/// <param name="preallocate">If no matching volumes, pre-allocate this number of bytes on disk for new volumes. (optional)</param>
|
|||
/// <param name="memoryMapMaxSizeMb">Only implemented for windows. Use memory mapped files with specified size for new volumes. (optional)</param>
|
|||
/// <param name="writableVolumeCount">If no matching volumes, create specified number of new volumes. (optional)</param>
|
|||
/// <returns>ApiResponse of FileKey</returns>
|
|||
ApiResponse<FileKey> DirAssignWithHttpInfo (Object count = default(Object), Object collection = default(Object), Object dataCenter = default(Object), Object rack = default(Object), Object dataNode = default(Object), Object disk = default(Object), Object replication = default(Object), Object ttl = default(Object), Object preallocate = default(Object), Object memoryMapMaxSizeMb = default(Object), Object writableVolumeCount = default(Object)); |
|||
/// <summary>
|
|||
/// Lookup volume
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// We would need to find out whether the volumes have moved.
|
|||
/// </remarks>
|
|||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
|||
/// <param name="volumeId">volume id (optional)</param>
|
|||
/// <param name="collection">optionally to speed up the lookup (optional)</param>
|
|||
/// <param name="fileId">If provided, this returns the fileId location and a JWT to update or delete the file. (optional)</param>
|
|||
/// <param name="read">works together with \"fileId\", if read=yes, JWT is generated for reads. (optional)</param>
|
|||
/// <returns>Object</returns>
|
|||
Object DirLookup (Object volumeId = default(Object), Object collection = default(Object), Object fileId = default(Object), Object read = default(Object)); |
|||
|
|||
/// <summary>
|
|||
/// Lookup volume
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// We would need to find out whether the volumes have moved.
|
|||
/// </remarks>
|
|||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
|||
/// <param name="volumeId">volume id (optional)</param>
|
|||
/// <param name="collection">optionally to speed up the lookup (optional)</param>
|
|||
/// <param name="fileId">If provided, this returns the fileId location and a JWT to update or delete the file. (optional)</param>
|
|||
/// <param name="read">works together with \"fileId\", if read=yes, JWT is generated for reads. (optional)</param>
|
|||
/// <returns>ApiResponse of Object</returns>
|
|||
ApiResponse<Object> DirLookupWithHttpInfo (Object volumeId = default(Object), Object collection = default(Object), Object fileId = default(Object), Object read = default(Object)); |
|||
#endregion Synchronous Operations
|
|||
#region Asynchronous Operations
|
|||
/// <summary>
|
|||
/// Assign a file key
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// This operation is very cheap. Just increase a number in master server's memory.
|
|||
/// </remarks>
|
|||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
|||
/// <param name="count">how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 (optional)</param>
|
|||
/// <param name="collection">required collection name (optional)</param>
|
|||
/// <param name="dataCenter">preferred data center (optional)</param>
|
|||
/// <param name="rack">preferred rack (optional)</param>
|
|||
/// <param name="dataNode">preferred volume server, e.g. 127.0.0.1:8080 (optional)</param>
|
|||
/// <param name="disk">If you have disks labelled, this must be supplied to specify the disk type to allocate on. (optional)</param>
|
|||
/// <param name="replication">replica placement strategy (optional)</param>
|
|||
/// <param name="ttl">file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year (optional)</param>
|
|||
/// <param name="preallocate">If no matching volumes, pre-allocate this number of bytes on disk for new volumes. (optional)</param>
|
|||
/// <param name="memoryMapMaxSizeMb">Only implemented for windows. Use memory mapped files with specified size for new volumes. (optional)</param>
|
|||
/// <param name="writableVolumeCount">If no matching volumes, create specified number of new volumes. (optional)</param>
|
|||
/// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
|
|||
/// <returns>Task of FileKey</returns>
|
|||
System.Threading.Tasks.Task<FileKey> DirAssignAsync (Object count = default(Object), Object collection = default(Object), Object dataCenter = default(Object), Object rack = default(Object), Object dataNode = default(Object), Object disk = default(Object), Object replication = default(Object), Object ttl = default(Object), Object preallocate = default(Object), Object memoryMapMaxSizeMb = default(Object), Object writableVolumeCount = default(Object), CancellationToken cancellationToken = default(CancellationToken)); |
|||
|
|||
/// <summary>
|
|||
/// Assign a file key
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// This operation is very cheap. Just increase a number in master server's memory.
|
|||
/// </remarks>
|
|||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
|||
/// <param name="count">how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 (optional)</param>
|
|||
/// <param name="collection">required collection name (optional)</param>
|
|||
/// <param name="dataCenter">preferred data center (optional)</param>
|
|||
/// <param name="rack">preferred rack (optional)</param>
|
|||
/// <param name="dataNode">preferred volume server, e.g. 127.0.0.1:8080 (optional)</param>
|
|||
/// <param name="disk">If you have disks labelled, this must be supplied to specify the disk type to allocate on. (optional)</param>
|
|||
/// <param name="replication">replica placement strategy (optional)</param>
|
|||
/// <param name="ttl">file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year (optional)</param>
|
|||
/// <param name="preallocate">If no matching volumes, pre-allocate this number of bytes on disk for new volumes. (optional)</param>
|
|||
/// <param name="memoryMapMaxSizeMb">Only implemented for windows. Use memory mapped files with specified size for new volumes. (optional)</param>
|
|||
/// <param name="writableVolumeCount">If no matching volumes, create specified number of new volumes. (optional)</param>
|
|||
/// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
|
|||
/// <returns>Task of ApiResponse (FileKey)</returns>
|
|||
System.Threading.Tasks.Task<ApiResponse<FileKey>> DirAssignWithHttpInfoAsync (Object count = default(Object), Object collection = default(Object), Object dataCenter = default(Object), Object rack = default(Object), Object dataNode = default(Object), Object disk = default(Object), Object replication = default(Object), Object ttl = default(Object), Object preallocate = default(Object), Object memoryMapMaxSizeMb = default(Object), Object writableVolumeCount = default(Object), CancellationToken cancellationToken = default(CancellationToken)); |
|||
/// <summary>
|
|||
/// Lookup volume
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// We would need to find out whether the volumes have moved.
|
|||
/// </remarks>
|
|||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
|||
/// <param name="volumeId">volume id (optional)</param>
|
|||
/// <param name="collection">optionally to speed up the lookup (optional)</param>
|
|||
/// <param name="fileId">If provided, this returns the fileId location and a JWT to update or delete the file. (optional)</param>
|
|||
/// <param name="read">works together with \"fileId\", if read=yes, JWT is generated for reads. (optional)</param>
|
|||
/// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
|
|||
/// <returns>Task of Object</returns>
|
|||
System.Threading.Tasks.Task<Object> DirLookupAsync (Object volumeId = default(Object), Object collection = default(Object), Object fileId = default(Object), Object read = default(Object), CancellationToken cancellationToken = default(CancellationToken)); |
|||
|
|||
/// <summary>
|
|||
/// Lookup volume
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// We would need to find out whether the volumes have moved.
|
|||
/// </remarks>
|
|||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
|||
/// <param name="volumeId">volume id (optional)</param>
|
|||
/// <param name="collection">optionally to speed up the lookup (optional)</param>
|
|||
/// <param name="fileId">If provided, this returns the fileId location and a JWT to update or delete the file. (optional)</param>
|
|||
/// <param name="read">works together with \"fileId\", if read=yes, JWT is generated for reads. (optional)</param>
|
|||
/// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
|
|||
/// <returns>Task of ApiResponse (Object)</returns>
|
|||
System.Threading.Tasks.Task<ApiResponse<Object>> DirLookupWithHttpInfoAsync (Object volumeId = default(Object), Object collection = default(Object), Object fileId = default(Object), Object read = default(Object), CancellationToken cancellationToken = default(CancellationToken)); |
|||
#endregion Asynchronous Operations
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Represents a collection of functions to interact with the API endpoints
|
|||
/// </summary>
|
|||
public partial class DefaultApi : IDefaultApi |
|||
{ |
|||
private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="DefaultApi"/> class.
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
public DefaultApi(String basePath) |
|||
{ |
|||
this.Configuration = new Org.OpenAPITools.Client.Configuration { BasePath = basePath }; |
|||
|
|||
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="DefaultApi"/> class
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
public DefaultApi() |
|||
{ |
|||
this.Configuration = Org.OpenAPITools.Client.Configuration.Default; |
|||
|
|||
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="DefaultApi"/> class
|
|||
/// using Configuration object
|
|||
/// </summary>
|
|||
/// <param name="configuration">An instance of Configuration</param>
|
|||
/// <returns></returns>
|
|||
public DefaultApi(Org.OpenAPITools.Client.Configuration configuration = null) |
|||
{ |
|||
if (configuration == null) // use the default one in Configuration
|
|||
this.Configuration = Org.OpenAPITools.Client.Configuration.Default; |
|||
else |
|||
this.Configuration = configuration; |
|||
|
|||
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the base path of the API client.
|
|||
/// </summary>
|
|||
/// <value>The base path</value>
|
|||
public String GetBasePath() |
|||
{ |
|||
return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Sets the base path of the API client.
|
|||
/// </summary>
|
|||
/// <value>The base path</value>
|
|||
[Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")] |
|||
public void SetBasePath(String basePath) |
|||
{ |
|||
// do nothing
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the configuration object
|
|||
/// </summary>
|
|||
/// <value>An instance of the Configuration</value>
|
|||
public Org.OpenAPITools.Client.Configuration Configuration {get; set;} |
|||
|
|||
/// <summary>
|
|||
/// Provides a factory method hook for the creation of exceptions.
|
|||
/// </summary>
|
|||
public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory |
|||
{ |
|||
get |
|||
{ |
|||
if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) |
|||
{ |
|||
throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); |
|||
} |
|||
return _exceptionFactory; |
|||
} |
|||
set { _exceptionFactory = value; } |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the default header.
|
|||
/// </summary>
|
|||
/// <returns>Dictionary of HTTP header</returns>
|
|||
[Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] |
|||
public IDictionary<String, String> DefaultHeader() |
|||
{ |
|||
return new ReadOnlyDictionary<string, string>(this.Configuration.DefaultHeader); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Add default header.
|
|||
/// </summary>
|
|||
/// <param name="key">Header field name.</param>
|
|||
/// <param name="value">Header field value.</param>
|
|||
/// <returns></returns>
|
|||
[Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] |
|||
public void AddDefaultHeader(string key, string value) |
|||
{ |
|||
this.Configuration.AddDefaultHeader(key, value); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Assign a file key This operation is very cheap. Just increase a number in master server's memory.
|
|||
/// </summary>
|
|||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
|||
/// <param name="count">how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 (optional)</param>
|
|||
/// <param name="collection">required collection name (optional)</param>
|
|||
/// <param name="dataCenter">preferred data center (optional)</param>
|
|||
/// <param name="rack">preferred rack (optional)</param>
|
|||
/// <param name="dataNode">preferred volume server, e.g. 127.0.0.1:8080 (optional)</param>
|
|||
/// <param name="disk">If you have disks labelled, this must be supplied to specify the disk type to allocate on. (optional)</param>
|
|||
/// <param name="replication">replica placement strategy (optional)</param>
|
|||
/// <param name="ttl">file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year (optional)</param>
|
|||
/// <param name="preallocate">If no matching volumes, pre-allocate this number of bytes on disk for new volumes. (optional)</param>
|
|||
/// <param name="memoryMapMaxSizeMb">Only implemented for windows. Use memory mapped files with specified size for new volumes. (optional)</param>
|
|||
/// <param name="writableVolumeCount">If no matching volumes, create specified number of new volumes. (optional)</param>
|
|||
/// <returns>FileKey</returns>
|
|||
public FileKey DirAssign (Object count = default(Object), Object collection = default(Object), Object dataCenter = default(Object), Object rack = default(Object), Object dataNode = default(Object), Object disk = default(Object), Object replication = default(Object), Object ttl = default(Object), Object preallocate = default(Object), Object memoryMapMaxSizeMb = default(Object), Object writableVolumeCount = default(Object)) |
|||
{ |
|||
ApiResponse<FileKey> localVarResponse = DirAssignWithHttpInfo(count, collection, dataCenter, rack, dataNode, disk, replication, ttl, preallocate, memoryMapMaxSizeMb, writableVolumeCount); |
|||
return localVarResponse.Data; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Assign a file key This operation is very cheap. Just increase a number in master server's memory.
|
|||
/// </summary>
|
|||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
|||
/// <param name="count">how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 (optional)</param>
|
|||
/// <param name="collection">required collection name (optional)</param>
|
|||
/// <param name="dataCenter">preferred data center (optional)</param>
|
|||
/// <param name="rack">preferred rack (optional)</param>
|
|||
/// <param name="dataNode">preferred volume server, e.g. 127.0.0.1:8080 (optional)</param>
|
|||
/// <param name="disk">If you have disks labelled, this must be supplied to specify the disk type to allocate on. (optional)</param>
|
|||
/// <param name="replication">replica placement strategy (optional)</param>
|
|||
/// <param name="ttl">file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year (optional)</param>
|
|||
/// <param name="preallocate">If no matching volumes, pre-allocate this number of bytes on disk for new volumes. (optional)</param>
|
|||
/// <param name="memoryMapMaxSizeMb">Only implemented for windows. Use memory mapped files with specified size for new volumes. (optional)</param>
|
|||
/// <param name="writableVolumeCount">If no matching volumes, create specified number of new volumes. (optional)</param>
|
|||
/// <returns>ApiResponse of FileKey</returns>
|
|||
public ApiResponse<FileKey> DirAssignWithHttpInfo (Object count = default(Object), Object collection = default(Object), Object dataCenter = default(Object), Object rack = default(Object), Object dataNode = default(Object), Object disk = default(Object), Object replication = default(Object), Object ttl = default(Object), Object preallocate = default(Object), Object memoryMapMaxSizeMb = default(Object), Object writableVolumeCount = default(Object)) |
|||
{ |
|||
|
|||
var localVarPath = "/dir/assign"; |
|||
var localVarPathParams = new Dictionary<String, String>(); |
|||
var localVarQueryParams = new List<KeyValuePair<String, String>>(); |
|||
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader); |
|||
var localVarFormParams = new Dictionary<String, String>(); |
|||
var localVarFileParams = new Dictionary<String, FileParameter>(); |
|||
Object localVarPostBody = null; |
|||
|
|||
// to determine the Content-Type header
|
|||
String[] localVarHttpContentTypes = new String[] { |
|||
}; |
|||
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); |
|||
|
|||
// to determine the Accept header
|
|||
String[] localVarHttpHeaderAccepts = new String[] { |
|||
"application/json" |
|||
}; |
|||
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); |
|||
if (localVarHttpHeaderAccept != null) |
|||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); |
|||
|
|||
if (count != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "count", count)); // query parameter
|
|||
if (collection != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "collection", collection)); // query parameter
|
|||
if (dataCenter != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "dataCenter", dataCenter)); // query parameter
|
|||
if (rack != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "rack", rack)); // query parameter
|
|||
if (dataNode != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "dataNode", dataNode)); // query parameter
|
|||
if (disk != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "disk", disk)); // query parameter
|
|||
if (replication != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "replication", replication)); // query parameter
|
|||
if (ttl != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "ttl", ttl)); // query parameter
|
|||
if (preallocate != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "preallocate", preallocate)); // query parameter
|
|||
if (memoryMapMaxSizeMb != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "memoryMapMaxSizeMb", memoryMapMaxSizeMb)); // query parameter
|
|||
if (writableVolumeCount != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "writableVolumeCount", writableVolumeCount)); // query parameter
|
|||
|
|||
|
|||
// make the HTTP request
|
|||
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, |
|||
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, |
|||
localVarPathParams, localVarHttpContentType); |
|||
|
|||
int localVarStatusCode = (int) localVarResponse.StatusCode; |
|||
|
|||
if (ExceptionFactory != null) |
|||
{ |
|||
Exception exception = ExceptionFactory("DirAssign", localVarResponse); |
|||
if (exception != null) throw exception; |
|||
} |
|||
|
|||
return new ApiResponse<FileKey>(localVarStatusCode, |
|||
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), |
|||
(FileKey) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(FileKey))); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Assign a file key This operation is very cheap. Just increase a number in master server's memory.
|
|||
/// </summary>
|
|||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
|||
/// <param name="count">how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 (optional)</param>
|
|||
/// <param name="collection">required collection name (optional)</param>
|
|||
/// <param name="dataCenter">preferred data center (optional)</param>
|
|||
/// <param name="rack">preferred rack (optional)</param>
|
|||
/// <param name="dataNode">preferred volume server, e.g. 127.0.0.1:8080 (optional)</param>
|
|||
/// <param name="disk">If you have disks labelled, this must be supplied to specify the disk type to allocate on. (optional)</param>
|
|||
/// <param name="replication">replica placement strategy (optional)</param>
|
|||
/// <param name="ttl">file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year (optional)</param>
|
|||
/// <param name="preallocate">If no matching volumes, pre-allocate this number of bytes on disk for new volumes. (optional)</param>
|
|||
/// <param name="memoryMapMaxSizeMb">Only implemented for windows. Use memory mapped files with specified size for new volumes. (optional)</param>
|
|||
/// <param name="writableVolumeCount">If no matching volumes, create specified number of new volumes. (optional)</param>
|
|||
/// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
|
|||
/// <returns>Task of FileKey</returns>
|
|||
public async System.Threading.Tasks.Task<FileKey> DirAssignAsync (Object count = default(Object), Object collection = default(Object), Object dataCenter = default(Object), Object rack = default(Object), Object dataNode = default(Object), Object disk = default(Object), Object replication = default(Object), Object ttl = default(Object), Object preallocate = default(Object), Object memoryMapMaxSizeMb = default(Object), Object writableVolumeCount = default(Object), CancellationToken cancellationToken = default(CancellationToken)) |
|||
{ |
|||
ApiResponse<FileKey> localVarResponse = await DirAssignWithHttpInfoAsync(count, collection, dataCenter, rack, dataNode, disk, replication, ttl, preallocate, memoryMapMaxSizeMb, writableVolumeCount, cancellationToken); |
|||
return localVarResponse.Data; |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Assign a file key This operation is very cheap. Just increase a number in master server's memory.
|
|||
/// </summary>
|
|||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
|||
/// <param name="count">how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 (optional)</param>
|
|||
/// <param name="collection">required collection name (optional)</param>
|
|||
/// <param name="dataCenter">preferred data center (optional)</param>
|
|||
/// <param name="rack">preferred rack (optional)</param>
|
|||
/// <param name="dataNode">preferred volume server, e.g. 127.0.0.1:8080 (optional)</param>
|
|||
/// <param name="disk">If you have disks labelled, this must be supplied to specify the disk type to allocate on. (optional)</param>
|
|||
/// <param name="replication">replica placement strategy (optional)</param>
|
|||
/// <param name="ttl">file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year (optional)</param>
|
|||
/// <param name="preallocate">If no matching volumes, pre-allocate this number of bytes on disk for new volumes. (optional)</param>
|
|||
/// <param name="memoryMapMaxSizeMb">Only implemented for windows. Use memory mapped files with specified size for new volumes. (optional)</param>
|
|||
/// <param name="writableVolumeCount">If no matching volumes, create specified number of new volumes. (optional)</param>
|
|||
/// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
|
|||
/// <returns>Task of ApiResponse (FileKey)</returns>
|
|||
public async System.Threading.Tasks.Task<ApiResponse<FileKey>> DirAssignWithHttpInfoAsync (Object count = default(Object), Object collection = default(Object), Object dataCenter = default(Object), Object rack = default(Object), Object dataNode = default(Object), Object disk = default(Object), Object replication = default(Object), Object ttl = default(Object), Object preallocate = default(Object), Object memoryMapMaxSizeMb = default(Object), Object writableVolumeCount = default(Object), CancellationToken cancellationToken = default(CancellationToken)) |
|||
{ |
|||
|
|||
var localVarPath = "/dir/assign"; |
|||
var localVarPathParams = new Dictionary<String, String>(); |
|||
var localVarQueryParams = new List<KeyValuePair<String, String>>(); |
|||
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader); |
|||
var localVarFormParams = new Dictionary<String, String>(); |
|||
var localVarFileParams = new Dictionary<String, FileParameter>(); |
|||
Object localVarPostBody = null; |
|||
|
|||
// to determine the Content-Type header
|
|||
String[] localVarHttpContentTypes = new String[] { |
|||
}; |
|||
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); |
|||
|
|||
// to determine the Accept header
|
|||
String[] localVarHttpHeaderAccepts = new String[] { |
|||
"application/json" |
|||
}; |
|||
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); |
|||
if (localVarHttpHeaderAccept != null) |
|||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); |
|||
|
|||
if (count != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "count", count)); // query parameter
|
|||
if (collection != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "collection", collection)); // query parameter
|
|||
if (dataCenter != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "dataCenter", dataCenter)); // query parameter
|
|||
if (rack != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "rack", rack)); // query parameter
|
|||
if (dataNode != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "dataNode", dataNode)); // query parameter
|
|||
if (disk != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "disk", disk)); // query parameter
|
|||
if (replication != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "replication", replication)); // query parameter
|
|||
if (ttl != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "ttl", ttl)); // query parameter
|
|||
if (preallocate != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "preallocate", preallocate)); // query parameter
|
|||
if (memoryMapMaxSizeMb != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "memoryMapMaxSizeMb", memoryMapMaxSizeMb)); // query parameter
|
|||
if (writableVolumeCount != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "writableVolumeCount", writableVolumeCount)); // query parameter
|
|||
|
|||
|
|||
// make the HTTP request
|
|||
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, |
|||
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, |
|||
localVarPathParams, localVarHttpContentType, cancellationToken); |
|||
|
|||
int localVarStatusCode = (int) localVarResponse.StatusCode; |
|||
|
|||
if (ExceptionFactory != null) |
|||
{ |
|||
Exception exception = ExceptionFactory("DirAssign", localVarResponse); |
|||
if (exception != null) throw exception; |
|||
} |
|||
|
|||
return new ApiResponse<FileKey>(localVarStatusCode, |
|||
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), |
|||
(FileKey) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(FileKey))); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Lookup volume We would need to find out whether the volumes have moved.
|
|||
/// </summary>
|
|||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
|||
/// <param name="volumeId">volume id (optional)</param>
|
|||
/// <param name="collection">optionally to speed up the lookup (optional)</param>
|
|||
/// <param name="fileId">If provided, this returns the fileId location and a JWT to update or delete the file. (optional)</param>
|
|||
/// <param name="read">works together with \"fileId\", if read=yes, JWT is generated for reads. (optional)</param>
|
|||
/// <returns>Object</returns>
|
|||
public Object DirLookup (Object volumeId = default(Object), Object collection = default(Object), Object fileId = default(Object), Object read = default(Object)) |
|||
{ |
|||
ApiResponse<Object> localVarResponse = DirLookupWithHttpInfo(volumeId, collection, fileId, read); |
|||
return localVarResponse.Data; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Lookup volume We would need to find out whether the volumes have moved.
|
|||
/// </summary>
|
|||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
|||
/// <param name="volumeId">volume id (optional)</param>
|
|||
/// <param name="collection">optionally to speed up the lookup (optional)</param>
|
|||
/// <param name="fileId">If provided, this returns the fileId location and a JWT to update or delete the file. (optional)</param>
|
|||
/// <param name="read">works together with \"fileId\", if read=yes, JWT is generated for reads. (optional)</param>
|
|||
/// <returns>ApiResponse of Object</returns>
|
|||
public ApiResponse<Object> DirLookupWithHttpInfo (Object volumeId = default(Object), Object collection = default(Object), Object fileId = default(Object), Object read = default(Object)) |
|||
{ |
|||
|
|||
var localVarPath = "/dir/lookup"; |
|||
var localVarPathParams = new Dictionary<String, String>(); |
|||
var localVarQueryParams = new List<KeyValuePair<String, String>>(); |
|||
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader); |
|||
var localVarFormParams = new Dictionary<String, String>(); |
|||
var localVarFileParams = new Dictionary<String, FileParameter>(); |
|||
Object localVarPostBody = null; |
|||
|
|||
// to determine the Content-Type header
|
|||
String[] localVarHttpContentTypes = new String[] { |
|||
}; |
|||
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); |
|||
|
|||
// to determine the Accept header
|
|||
String[] localVarHttpHeaderAccepts = new String[] { |
|||
"application/json" |
|||
}; |
|||
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); |
|||
if (localVarHttpHeaderAccept != null) |
|||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); |
|||
|
|||
if (volumeId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "volumeId", volumeId)); // query parameter
|
|||
if (collection != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "collection", collection)); // query parameter
|
|||
if (fileId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "fileId", fileId)); // query parameter
|
|||
if (read != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "read", read)); // query parameter
|
|||
|
|||
|
|||
// make the HTTP request
|
|||
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, |
|||
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, |
|||
localVarPathParams, localVarHttpContentType); |
|||
|
|||
int localVarStatusCode = (int) localVarResponse.StatusCode; |
|||
|
|||
if (ExceptionFactory != null) |
|||
{ |
|||
Exception exception = ExceptionFactory("DirLookup", localVarResponse); |
|||
if (exception != null) throw exception; |
|||
} |
|||
|
|||
return new ApiResponse<Object>(localVarStatusCode, |
|||
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), |
|||
(Object) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object))); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Lookup volume We would need to find out whether the volumes have moved.
|
|||
/// </summary>
|
|||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
|||
/// <param name="volumeId">volume id (optional)</param>
|
|||
/// <param name="collection">optionally to speed up the lookup (optional)</param>
|
|||
/// <param name="fileId">If provided, this returns the fileId location and a JWT to update or delete the file. (optional)</param>
|
|||
/// <param name="read">works together with \"fileId\", if read=yes, JWT is generated for reads. (optional)</param>
|
|||
/// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
|
|||
/// <returns>Task of Object</returns>
|
|||
public async System.Threading.Tasks.Task<Object> DirLookupAsync (Object volumeId = default(Object), Object collection = default(Object), Object fileId = default(Object), Object read = default(Object), CancellationToken cancellationToken = default(CancellationToken)) |
|||
{ |
|||
ApiResponse<Object> localVarResponse = await DirLookupWithHttpInfoAsync(volumeId, collection, fileId, read, cancellationToken); |
|||
return localVarResponse.Data; |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Lookup volume We would need to find out whether the volumes have moved.
|
|||
/// </summary>
|
|||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
|||
/// <param name="volumeId">volume id (optional)</param>
|
|||
/// <param name="collection">optionally to speed up the lookup (optional)</param>
|
|||
/// <param name="fileId">If provided, this returns the fileId location and a JWT to update or delete the file. (optional)</param>
|
|||
/// <param name="read">works together with \"fileId\", if read=yes, JWT is generated for reads. (optional)</param>
|
|||
/// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
|
|||
/// <returns>Task of ApiResponse (Object)</returns>
|
|||
public async System.Threading.Tasks.Task<ApiResponse<Object>> DirLookupWithHttpInfoAsync (Object volumeId = default(Object), Object collection = default(Object), Object fileId = default(Object), Object read = default(Object), CancellationToken cancellationToken = default(CancellationToken)) |
|||
{ |
|||
|
|||
var localVarPath = "/dir/lookup"; |
|||
var localVarPathParams = new Dictionary<String, String>(); |
|||
var localVarQueryParams = new List<KeyValuePair<String, String>>(); |
|||
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader); |
|||
var localVarFormParams = new Dictionary<String, String>(); |
|||
var localVarFileParams = new Dictionary<String, FileParameter>(); |
|||
Object localVarPostBody = null; |
|||
|
|||
// to determine the Content-Type header
|
|||
String[] localVarHttpContentTypes = new String[] { |
|||
}; |
|||
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); |
|||
|
|||
// to determine the Accept header
|
|||
String[] localVarHttpHeaderAccepts = new String[] { |
|||
"application/json" |
|||
}; |
|||
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); |
|||
if (localVarHttpHeaderAccept != null) |
|||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); |
|||
|
|||
if (volumeId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "volumeId", volumeId)); // query parameter
|
|||
if (collection != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "collection", collection)); // query parameter
|
|||
if (fileId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "fileId", fileId)); // query parameter
|
|||
if (read != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "read", read)); // query parameter
|
|||
|
|||
|
|||
// make the HTTP request
|
|||
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, |
|||
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, |
|||
localVarPathParams, localVarHttpContentType, cancellationToken); |
|||
|
|||
int localVarStatusCode = (int) localVarResponse.StatusCode; |
|||
|
|||
if (ExceptionFactory != null) |
|||
{ |
|||
Exception exception = ExceptionFactory("DirLookup", localVarResponse); |
|||
if (exception != null) throw exception; |
|||
} |
|||
|
|||
return new ApiResponse<Object>(localVarStatusCode, |
|||
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), |
|||
(Object) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object))); |
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,536 @@ |
|||
/* |
|||
* Seaweedfs Master Server API |
|||
* |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
|||
*/ |
|||
|
|||
using System; |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using System.Globalization; |
|||
using System.Text.RegularExpressions; |
|||
using System.IO; |
|||
using System.Threading; |
|||
using System.Web; |
|||
using System.Linq; |
|||
using System.Net; |
|||
using System.Text; |
|||
using Newtonsoft.Json; |
|||
using RestSharp; |
|||
|
|||
namespace Org.OpenAPITools.Client |
|||
{ |
|||
/// <summary>
|
|||
/// API client is mainly responsible for making the HTTP call to the API backend.
|
|||
/// </summary>
|
|||
public partial class ApiClient |
|||
{ |
|||
public JsonSerializerSettings serializerSettings = new JsonSerializerSettings |
|||
{ |
|||
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor |
|||
}; |
|||
|
|||
/// <summary>
|
|||
/// Allows for extending request processing for <see cref="ApiClient"/> generated code.
|
|||
/// </summary>
|
|||
/// <param name="request">The RestSharp request object</param>
|
|||
partial void InterceptRequest(IRestRequest request); |
|||
|
|||
/// <summary>
|
|||
/// Allows for extending response processing for <see cref="ApiClient"/> generated code.
|
|||
/// </summary>
|
|||
/// <param name="request">The RestSharp request object</param>
|
|||
/// <param name="response">The RestSharp response object</param>
|
|||
partial void InterceptResponse(IRestRequest request, IRestResponse response); |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ApiClient" /> class
|
|||
/// with default configuration.
|
|||
/// </summary>
|
|||
public ApiClient() |
|||
{ |
|||
Configuration = Org.OpenAPITools.Client.Configuration.Default; |
|||
RestClient = new RestClient("https://127.0.0.1:9333"); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ApiClient" /> class
|
|||
/// with default base path (https://127.0.0.1:9333).
|
|||
/// </summary>
|
|||
/// <param name="config">An instance of Configuration.</param>
|
|||
public ApiClient(Configuration config) |
|||
{ |
|||
Configuration = config ?? Org.OpenAPITools.Client.Configuration.Default; |
|||
|
|||
RestClient = new RestClient(Configuration.BasePath); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ApiClient" /> class
|
|||
/// with default configuration.
|
|||
/// </summary>
|
|||
/// <param name="basePath">The base path.</param>
|
|||
public ApiClient(String basePath = "https://127.0.0.1:9333") |
|||
{ |
|||
if (String.IsNullOrEmpty(basePath)) |
|||
throw new ArgumentException("basePath cannot be empty"); |
|||
|
|||
RestClient = new RestClient(basePath); |
|||
Configuration = Client.Configuration.Default; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the default API client for making HTTP calls.
|
|||
/// </summary>
|
|||
/// <value>The default API client.</value>
|
|||
[Obsolete("ApiClient.Default is deprecated, please use 'Configuration.Default.ApiClient' instead.")] |
|||
public static ApiClient Default; |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets an instance of the IReadableConfiguration.
|
|||
/// </summary>
|
|||
/// <value>An instance of the IReadableConfiguration.</value>
|
|||
/// <remarks>
|
|||
/// <see cref="IReadableConfiguration"/> helps us to avoid modifying possibly global
|
|||
/// configuration values from within a given client. It does not guarantee thread-safety
|
|||
/// of the <see cref="Configuration"/> instance in any way.
|
|||
/// </remarks>
|
|||
public IReadableConfiguration Configuration { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the RestClient.
|
|||
/// </summary>
|
|||
/// <value>An instance of the RestClient</value>
|
|||
public RestClient RestClient { get; set; } |
|||
|
|||
// Creates and sets up a RestRequest prior to a call.
|
|||
private RestRequest PrepareRequest( |
|||
String path, RestSharp.Method method, List<KeyValuePair<String, String>> queryParams, Object postBody, |
|||
Dictionary<String, String> headerParams, Dictionary<String, String> formParams, |
|||
Dictionary<String, FileParameter> fileParams, Dictionary<String, String> pathParams, |
|||
String contentType) |
|||
{ |
|||
var request = new RestRequest(path, method); |
|||
|
|||
// add path parameter, if any
|
|||
foreach(var param in pathParams) |
|||
request.AddParameter(param.Key, param.Value, ParameterType.UrlSegment); |
|||
|
|||
// add header parameter, if any
|
|||
foreach(var param in headerParams) |
|||
request.AddHeader(param.Key, param.Value); |
|||
|
|||
// add query parameter, if any
|
|||
foreach(var param in queryParams) |
|||
request.AddQueryParameter(param.Key, param.Value); |
|||
|
|||
// add form parameter, if any
|
|||
foreach(var param in formParams) |
|||
request.AddParameter(param.Key, param.Value); |
|||
|
|||
// add file parameter, if any
|
|||
foreach(var param in fileParams) |
|||
{ |
|||
request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentType); |
|||
} |
|||
|
|||
if (postBody != null) // http body (model or byte[]) parameter
|
|||
{ |
|||
request.AddParameter(contentType, postBody, ParameterType.RequestBody); |
|||
} |
|||
|
|||
return request; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Makes the HTTP request (Sync).
|
|||
/// </summary>
|
|||
/// <param name="path">URL path.</param>
|
|||
/// <param name="method">HTTP method.</param>
|
|||
/// <param name="queryParams">Query parameters.</param>
|
|||
/// <param name="postBody">HTTP body (POST request).</param>
|
|||
/// <param name="headerParams">Header parameters.</param>
|
|||
/// <param name="formParams">Form parameters.</param>
|
|||
/// <param name="fileParams">File parameters.</param>
|
|||
/// <param name="pathParams">Path parameters.</param>
|
|||
/// <param name="contentType">Content Type of the request</param>
|
|||
/// <returns>Object</returns>
|
|||
public Object CallApi( |
|||
String path, RestSharp.Method method, List<KeyValuePair<String, String>> queryParams, Object postBody, |
|||
Dictionary<String, String> headerParams, Dictionary<String, String> formParams, |
|||
Dictionary<String, FileParameter> fileParams, Dictionary<String, String> pathParams, |
|||
String contentType) |
|||
{ |
|||
var request = PrepareRequest( |
|||
path, method, queryParams, postBody, headerParams, formParams, fileParams, |
|||
pathParams, contentType); |
|||
|
|||
// set timeout
|
|||
|
|||
RestClient.Timeout = Configuration.Timeout; |
|||
// set user agent
|
|||
RestClient.UserAgent = Configuration.UserAgent; |
|||
|
|||
InterceptRequest(request); |
|||
var response = RestClient.Execute(request); |
|||
InterceptResponse(request, response); |
|||
|
|||
return (Object) response; |
|||
} |
|||
/// <summary>
|
|||
/// Makes the asynchronous HTTP request.
|
|||
/// </summary>
|
|||
/// <param name="path">URL path.</param>
|
|||
/// <param name="method">HTTP method.</param>
|
|||
/// <param name="queryParams">Query parameters.</param>
|
|||
/// <param name="postBody">HTTP body (POST request).</param>
|
|||
/// <param name="headerParams">Header parameters.</param>
|
|||
/// <param name="formParams">Form parameters.</param>
|
|||
/// <param name="fileParams">File parameters.</param>
|
|||
/// <param name="pathParams">Path parameters.</param>
|
|||
/// <param name="contentType">Content type.</param>
|
|||
/// <param name="cancellationToken">Cancellation Token.</param>
|
|||
/// <returns>The Task instance.</returns>
|
|||
public async System.Threading.Tasks.Task<Object> CallApiAsync( |
|||
String path, RestSharp.Method method, List<KeyValuePair<String, String>> queryParams, Object postBody, |
|||
Dictionary<String, String> headerParams, Dictionary<String, String> formParams, |
|||
Dictionary<String, FileParameter> fileParams, Dictionary<String, String> pathParams, |
|||
String contentType, CancellationToken cancellationToken) |
|||
{ |
|||
var request = PrepareRequest( |
|||
path, method, queryParams, postBody, headerParams, formParams, fileParams, |
|||
pathParams, contentType); |
|||
RestClient.UserAgent = Configuration.UserAgent; |
|||
InterceptRequest(request); |
|||
var response = await RestClient.ExecuteTaskAsync(request, cancellationToken); |
|||
InterceptResponse(request, response); |
|||
return (Object)response; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Escape string (url-encoded).
|
|||
/// </summary>
|
|||
/// <param name="str">String to be escaped.</param>
|
|||
/// <returns>Escaped string.</returns>
|
|||
public string EscapeString(string str) |
|||
{ |
|||
return UrlEncode(str); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Create FileParameter based on Stream.
|
|||
/// </summary>
|
|||
/// <param name="name">Parameter name.</param>
|
|||
/// <param name="stream">Input stream.</param>
|
|||
/// <returns>FileParameter.</returns>
|
|||
public FileParameter ParameterToFile(string name, Stream stream) |
|||
{ |
|||
if (stream is FileStream) |
|||
return FileParameter.Create(name, ReadAsBytes(stream), Path.GetFileName(((FileStream)stream).Name)); |
|||
else |
|||
return FileParameter.Create(name, ReadAsBytes(stream), "no_file_name_provided"); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
|
|||
/// If parameter is a list, join the list with ",".
|
|||
/// Otherwise just return the string.
|
|||
/// </summary>
|
|||
/// <param name="obj">The parameter (header, path, query, form).</param>
|
|||
/// <returns>Formatted string.</returns>
|
|||
public string ParameterToString(object obj) |
|||
{ |
|||
if (obj is DateTime) |
|||
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
|
|||
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
|
|||
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
|||
// For example: 2009-06-15T13:45:30.0000000
|
|||
return ((DateTime)obj).ToString (Configuration.DateTimeFormat); |
|||
else if (obj is DateTimeOffset) |
|||
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
|
|||
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
|
|||
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
|||
// For example: 2009-06-15T13:45:30.0000000
|
|||
return ((DateTimeOffset)obj).ToString (Configuration.DateTimeFormat); |
|||
else if (obj is bool) |
|||
return (bool)obj ? "true" : "false"; |
|||
else if (obj is IList) |
|||
{ |
|||
var flattenedString = new StringBuilder(); |
|||
foreach (var param in (IList)obj) |
|||
{ |
|||
if (flattenedString.Length > 0) |
|||
flattenedString.Append(","); |
|||
flattenedString.Append(param); |
|||
} |
|||
return flattenedString.ToString(); |
|||
} |
|||
else |
|||
return Convert.ToString (obj); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Deserialize the JSON string into a proper object.
|
|||
/// </summary>
|
|||
/// <param name="response">The HTTP response.</param>
|
|||
/// <param name="type">Object type.</param>
|
|||
/// <returns>Object representation of the JSON string.</returns>
|
|||
public object Deserialize(IRestResponse response, Type type) |
|||
{ |
|||
IList<Parameter> headers = response.Headers; |
|||
if (type == typeof(byte[])) // return byte array
|
|||
{ |
|||
return response.RawBytes; |
|||
} |
|||
|
|||
// TODO: ? if (type.IsAssignableFrom(typeof(Stream)))
|
|||
if (type == typeof(Stream)) |
|||
{ |
|||
if (headers != null) |
|||
{ |
|||
var filePath = String.IsNullOrEmpty(Configuration.TempFolderPath) |
|||
? Path.GetTempPath() |
|||
: Configuration.TempFolderPath; |
|||
var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); |
|||
foreach (var header in headers) |
|||
{ |
|||
var match = regex.Match(header.ToString()); |
|||
if (match.Success) |
|||
{ |
|||
string fileName = filePath + SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); |
|||
File.WriteAllBytes(fileName, response.RawBytes); |
|||
return new FileStream(fileName, FileMode.Open); |
|||
} |
|||
} |
|||
} |
|||
var stream = new MemoryStream(response.RawBytes); |
|||
return stream; |
|||
} |
|||
|
|||
if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object
|
|||
{ |
|||
return DateTime.Parse(response.Content, null, System.Globalization.DateTimeStyles.RoundtripKind); |
|||
} |
|||
|
|||
if (type == typeof(String) || type.Name.StartsWith("System.Nullable")) // return primitive type
|
|||
{ |
|||
return ConvertType(response.Content, type); |
|||
} |
|||
|
|||
// at this point, it must be a model (json)
|
|||
try |
|||
{ |
|||
return JsonConvert.DeserializeObject(response.Content, type, serializerSettings); |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
throw new ApiException(500, e.Message); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Serialize an input (model) into JSON string
|
|||
/// </summary>
|
|||
/// <param name="obj">Object.</param>
|
|||
/// <returns>JSON string.</returns>
|
|||
public String Serialize(object obj) |
|||
{ |
|||
try |
|||
{ |
|||
return obj != null ? JsonConvert.SerializeObject(obj) : null; |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
throw new ApiException(500, e.Message); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
///Check if the given MIME is a JSON MIME.
|
|||
///JSON MIME examples:
|
|||
/// application/json
|
|||
/// application/json; charset=UTF8
|
|||
/// APPLICATION/JSON
|
|||
/// application/vnd.company+json
|
|||
/// </summary>
|
|||
/// <param name="mime">MIME</param>
|
|||
/// <returns>Returns True if MIME type is json.</returns>
|
|||
public bool IsJsonMime(String mime) |
|||
{ |
|||
var jsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); |
|||
return mime != null && (jsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json")); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Select the Content-Type header's value from the given content-type array:
|
|||
/// if JSON type exists in the given array, use it;
|
|||
/// otherwise use the first one defined in 'consumes'
|
|||
/// </summary>
|
|||
/// <param name="contentTypes">The Content-Type array to select from.</param>
|
|||
/// <returns>The Content-Type header to use.</returns>
|
|||
public String SelectHeaderContentType(String[] contentTypes) |
|||
{ |
|||
if (contentTypes.Length == 0) |
|||
return "application/json"; |
|||
|
|||
foreach (var contentType in contentTypes) |
|||
{ |
|||
if (IsJsonMime(contentType.ToLower())) |
|||
return contentType; |
|||
} |
|||
|
|||
return contentTypes[0]; // use the first content type specified in 'consumes'
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Select the Accept header's value from the given accepts array:
|
|||
/// if JSON exists in the given array, use it;
|
|||
/// otherwise use all of them (joining into a string)
|
|||
/// </summary>
|
|||
/// <param name="accepts">The accepts array to select from.</param>
|
|||
/// <returns>The Accept header to use.</returns>
|
|||
public String SelectHeaderAccept(String[] accepts) |
|||
{ |
|||
if (accepts.Length == 0) |
|||
return null; |
|||
|
|||
if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) |
|||
return "application/json"; |
|||
|
|||
return String.Join(",", accepts); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Encode string in base64 format.
|
|||
/// </summary>
|
|||
/// <param name="text">String to be encoded.</param>
|
|||
/// <returns>Encoded string.</returns>
|
|||
public static string Base64Encode(string text) |
|||
{ |
|||
return System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Dynamically cast the object into target type.
|
|||
/// </summary>
|
|||
/// <param name="fromObject">Object to be casted</param>
|
|||
/// <param name="toObject">Target type</param>
|
|||
/// <returns>Casted object</returns>
|
|||
public static dynamic ConvertType(dynamic fromObject, Type toObject) |
|||
{ |
|||
return Convert.ChangeType(fromObject, toObject); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Convert stream to byte array
|
|||
/// </summary>
|
|||
/// <param name="inputStream">Input stream to be converted</param>
|
|||
/// <returns>Byte array</returns>
|
|||
public static byte[] ReadAsBytes(Stream inputStream) |
|||
{ |
|||
byte[] buf = new byte[16*1024]; |
|||
using (MemoryStream ms = new MemoryStream()) |
|||
{ |
|||
int count; |
|||
while ((count = inputStream.Read(buf, 0, buf.Length)) > 0) |
|||
{ |
|||
ms.Write(buf, 0, count); |
|||
} |
|||
return ms.ToArray(); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// URL encode a string
|
|||
/// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50
|
|||
/// </summary>
|
|||
/// <param name="input">String to be URL encoded</param>
|
|||
/// <returns>Byte array</returns>
|
|||
public static string UrlEncode(string input) |
|||
{ |
|||
const int maxLength = 32766; |
|||
|
|||
if (input == null) |
|||
{ |
|||
throw new ArgumentNullException("input"); |
|||
} |
|||
|
|||
if (input.Length <= maxLength) |
|||
{ |
|||
return Uri.EscapeDataString(input); |
|||
} |
|||
|
|||
StringBuilder sb = new StringBuilder(input.Length * 2); |
|||
int index = 0; |
|||
|
|||
while (index < input.Length) |
|||
{ |
|||
int length = Math.Min(input.Length - index, maxLength); |
|||
string subString = input.Substring(index, length); |
|||
|
|||
sb.Append(Uri.EscapeDataString(subString)); |
|||
index += subString.Length; |
|||
} |
|||
|
|||
return sb.ToString(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Sanitize filename by removing the path
|
|||
/// </summary>
|
|||
/// <param name="filename">Filename</param>
|
|||
/// <returns>Filename</returns>
|
|||
public static string SanitizeFilename(string filename) |
|||
{ |
|||
Match match = Regex.Match(filename, @".*[/\\](.*)$"); |
|||
|
|||
if (match.Success) |
|||
{ |
|||
return match.Groups[1].Value; |
|||
} |
|||
else |
|||
{ |
|||
return filename; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Convert params to key/value pairs.
|
|||
/// Use collectionFormat to properly format lists and collections.
|
|||
/// </summary>
|
|||
/// <param name="collectionFormat">Collection format.</param>
|
|||
/// <param name="name">Key name.</param>
|
|||
/// <param name="value">Value object.</param>
|
|||
/// <returns>A list of KeyValuePairs</returns>
|
|||
public IEnumerable<KeyValuePair<string, string>> ParameterToKeyValuePairs(string collectionFormat, string name, object value) |
|||
{ |
|||
var parameters = new List<KeyValuePair<string, string>>(); |
|||
|
|||
if (IsCollection(value) && collectionFormat == "multi") |
|||
{ |
|||
var valueCollection = value as IEnumerable; |
|||
parameters.AddRange(from object item in valueCollection select new KeyValuePair<string, string>(name, ParameterToString(item))); |
|||
} |
|||
else |
|||
{ |
|||
parameters.Add(new KeyValuePair<string, string>(name, ParameterToString(value))); |
|||
} |
|||
|
|||
return parameters; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Check if generic object is a collection.
|
|||
/// </summary>
|
|||
/// <param name="value"></param>
|
|||
/// <returns>True if object is a collection type</returns>
|
|||
private static bool IsCollection(object value) |
|||
{ |
|||
return value is IList || value is ICollection; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,60 @@ |
|||
/* |
|||
* Seaweedfs Master Server API |
|||
* |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
|||
*/ |
|||
|
|||
using System; |
|||
|
|||
namespace Org.OpenAPITools.Client |
|||
{ |
|||
/// <summary>
|
|||
/// API Exception
|
|||
/// </summary>
|
|||
public class ApiException : Exception |
|||
{ |
|||
/// <summary>
|
|||
/// Gets or sets the error code (HTTP status code)
|
|||
/// </summary>
|
|||
/// <value>The error code (HTTP status code).</value>
|
|||
public int ErrorCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the error content (body json object)
|
|||
/// </summary>
|
|||
/// <value>The error content (Http response body).</value>
|
|||
public dynamic ErrorContent { get; private set; } |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ApiException"/> class.
|
|||
/// </summary>
|
|||
public ApiException() {} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ApiException"/> class.
|
|||
/// </summary>
|
|||
/// <param name="errorCode">HTTP status code.</param>
|
|||
/// <param name="message">Error message.</param>
|
|||
public ApiException(int errorCode, string message) : base(message) |
|||
{ |
|||
this.ErrorCode = errorCode; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ApiException"/> class.
|
|||
/// </summary>
|
|||
/// <param name="errorCode">HTTP status code.</param>
|
|||
/// <param name="message">Error message.</param>
|
|||
/// <param name="errorContent">Error content.</param>
|
|||
public ApiException(int errorCode, string message, dynamic errorContent = null) : base(message) |
|||
{ |
|||
this.ErrorCode = errorCode; |
|||
this.ErrorContent = errorContent; |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,54 @@ |
|||
/* |
|||
* Seaweedfs Master Server API |
|||
* |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
|||
*/ |
|||
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Org.OpenAPITools.Client |
|||
{ |
|||
/// <summary>
|
|||
/// API Response
|
|||
/// </summary>
|
|||
public class ApiResponse<T> |
|||
{ |
|||
/// <summary>
|
|||
/// Gets or sets the status code (HTTP status code)
|
|||
/// </summary>
|
|||
/// <value>The status code.</value>
|
|||
public int StatusCode { get; private set; } |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the HTTP headers
|
|||
/// </summary>
|
|||
/// <value>HTTP headers</value>
|
|||
public IDictionary<string, string> Headers { get; private set; } |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the data (parsed HTTP body)
|
|||
/// </summary>
|
|||
/// <value>The data.</value>
|
|||
public T Data { get; private set; } |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ApiResponse<T>" /> class.
|
|||
/// </summary>
|
|||
/// <param name="statusCode">HTTP status code.</param>
|
|||
/// <param name="headers">HTTP headers.</param>
|
|||
/// <param name="data">Data (parsed HTTP body)</param>
|
|||
public ApiResponse(int statusCode, IDictionary<string, string> headers, T data) |
|||
{ |
|||
this.StatusCode= statusCode; |
|||
this.Headers = headers; |
|||
this.Data = data; |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,452 @@ |
|||
/* |
|||
* Seaweedfs Master Server API |
|||
* |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
|||
*/ |
|||
|
|||
using System; |
|||
using System.Reflection; |
|||
using System.Collections.Concurrent; |
|||
using System.Collections.Generic; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Text; |
|||
|
|||
namespace Org.OpenAPITools.Client |
|||
{ |
|||
/// <summary>
|
|||
/// Represents a set of configuration settings
|
|||
/// </summary>
|
|||
public class Configuration : IReadableConfiguration |
|||
{ |
|||
#region Constants
|
|||
|
|||
/// <summary>
|
|||
/// Version of the package.
|
|||
/// </summary>
|
|||
/// <value>Version of the package.</value>
|
|||
public const string Version = "1.0.0"; |
|||
|
|||
/// <summary>
|
|||
/// Identifier for ISO 8601 DateTime Format
|
|||
/// </summary>
|
|||
/// <remarks>See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information.</remarks>
|
|||
// ReSharper disable once InconsistentNaming
|
|||
public const string ISO8601_DATETIME_FORMAT = "o"; |
|||
|
|||
#endregion Constants
|
|||
|
|||
#region Static Members
|
|||
|
|||
private static readonly object GlobalConfigSync = new { }; |
|||
private static Configuration _globalConfiguration; |
|||
|
|||
/// <summary>
|
|||
/// Default creation of exceptions for a given method name and response object
|
|||
/// </summary>
|
|||
public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => |
|||
{ |
|||
var status = (int)response.StatusCode; |
|||
if (status >= 400) |
|||
{ |
|||
return new ApiException(status, |
|||
string.Format("Error calling {0}: {1}", methodName, response.Content), |
|||
response.Content); |
|||
} |
|||
if (status == 0) |
|||
{ |
|||
return new ApiException(status, |
|||
string.Format("Error calling {0}: {1}", methodName, response.ErrorMessage), response.ErrorMessage); |
|||
} |
|||
return null; |
|||
}; |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the default Configuration.
|
|||
/// </summary>
|
|||
/// <value>Configuration.</value>
|
|||
public static Configuration Default |
|||
{ |
|||
get { return _globalConfiguration; } |
|||
set |
|||
{ |
|||
lock (GlobalConfigSync) |
|||
{ |
|||
_globalConfiguration = value; |
|||
} |
|||
} |
|||
} |
|||
|
|||
#endregion Static Members
|
|||
|
|||
#region Private Members
|
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the API key based on the authentication name.
|
|||
/// </summary>
|
|||
/// <value>The API key.</value>
|
|||
private IDictionary<string, string> _apiKey = null; |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
|
|||
/// </summary>
|
|||
/// <value>The prefix of the API key.</value>
|
|||
private IDictionary<string, string> _apiKeyPrefix = null; |
|||
|
|||
private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; |
|||
private string _tempFolderPath = Path.GetTempPath(); |
|||
|
|||
#endregion Private Members
|
|||
|
|||
#region Constructors
|
|||
|
|||
static Configuration() |
|||
{ |
|||
_globalConfiguration = new GlobalConfiguration(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="Configuration" /> class
|
|||
/// </summary>
|
|||
public Configuration() |
|||
{ |
|||
UserAgent = "OpenAPI-Generator/1.0.0/csharp"; |
|||
BasePath = "https://127.0.0.1:9333"; |
|||
DefaultHeader = new ConcurrentDictionary<string, string>(); |
|||
ApiKey = new ConcurrentDictionary<string, string>(); |
|||
ApiKeyPrefix = new ConcurrentDictionary<string, string>(); |
|||
|
|||
// Setting Timeout has side effects (forces ApiClient creation).
|
|||
Timeout = 100000; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="Configuration" /> class
|
|||
/// </summary>
|
|||
public Configuration( |
|||
IDictionary<string, string> defaultHeader, |
|||
IDictionary<string, string> apiKey, |
|||
IDictionary<string, string> apiKeyPrefix, |
|||
string basePath = "https://127.0.0.1:9333") : this() |
|||
{ |
|||
if (string.IsNullOrWhiteSpace(basePath)) |
|||
throw new ArgumentException("The provided basePath is invalid.", "basePath"); |
|||
if (defaultHeader == null) |
|||
throw new ArgumentNullException("defaultHeader"); |
|||
if (apiKey == null) |
|||
throw new ArgumentNullException("apiKey"); |
|||
if (apiKeyPrefix == null) |
|||
throw new ArgumentNullException("apiKeyPrefix"); |
|||
|
|||
BasePath = basePath; |
|||
|
|||
foreach (var keyValuePair in defaultHeader) |
|||
{ |
|||
DefaultHeader.Add(keyValuePair); |
|||
} |
|||
|
|||
foreach (var keyValuePair in apiKey) |
|||
{ |
|||
ApiKey.Add(keyValuePair); |
|||
} |
|||
|
|||
foreach (var keyValuePair in apiKeyPrefix) |
|||
{ |
|||
ApiKeyPrefix.Add(keyValuePair); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="Configuration" /> class with different settings
|
|||
/// </summary>
|
|||
/// <param name="apiClient">Api client</param>
|
|||
/// <param name="defaultHeader">Dictionary of default HTTP header</param>
|
|||
/// <param name="username">Username</param>
|
|||
/// <param name="password">Password</param>
|
|||
/// <param name="accessToken">accessToken</param>
|
|||
/// <param name="apiKey">Dictionary of API key</param>
|
|||
/// <param name="apiKeyPrefix">Dictionary of API key prefix</param>
|
|||
/// <param name="tempFolderPath">Temp folder path</param>
|
|||
/// <param name="dateTimeFormat">DateTime format string</param>
|
|||
/// <param name="timeout">HTTP connection timeout (in milliseconds)</param>
|
|||
/// <param name="userAgent">HTTP user agent</param>
|
|||
[Obsolete("Use explicit object construction and setting of properties.", true)] |
|||
public Configuration( |
|||
// ReSharper disable UnusedParameter.Local
|
|||
ApiClient apiClient = null, |
|||
IDictionary<string, string> defaultHeader = null, |
|||
string username = null, |
|||
string password = null, |
|||
string accessToken = null, |
|||
IDictionary<string, string> apiKey = null, |
|||
IDictionary<string, string> apiKeyPrefix = null, |
|||
string tempFolderPath = null, |
|||
string dateTimeFormat = null, |
|||
int timeout = 100000, |
|||
string userAgent = "OpenAPI-Generator/1.0.0/csharp" |
|||
// ReSharper restore UnusedParameter.Local
|
|||
) |
|||
{ |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the Configuration class.
|
|||
/// </summary>
|
|||
/// <param name="apiClient">Api client.</param>
|
|||
[Obsolete("This constructor caused unexpected sharing of static data. It is no longer supported.", true)] |
|||
// ReSharper disable once UnusedParameter.Local
|
|||
public Configuration(ApiClient apiClient) |
|||
{ |
|||
|
|||
} |
|||
|
|||
#endregion Constructors
|
|||
|
|||
|
|||
#region Properties
|
|||
|
|||
private ApiClient _apiClient = null; |
|||
/// <summary>
|
|||
/// Gets an instance of an ApiClient for this configuration
|
|||
/// </summary>
|
|||
public virtual ApiClient ApiClient |
|||
{ |
|||
get |
|||
{ |
|||
if (_apiClient == null) _apiClient = CreateApiClient(); |
|||
return _apiClient; |
|||
} |
|||
} |
|||
|
|||
private String _basePath = null; |
|||
/// <summary>
|
|||
/// Gets or sets the base path for API access.
|
|||
/// </summary>
|
|||
public virtual string BasePath { |
|||
get { return _basePath; } |
|||
set { |
|||
_basePath = value; |
|||
// pass-through to ApiClient if it's set.
|
|||
if(_apiClient != null) { |
|||
_apiClient.RestClient.BaseUrl = new Uri(_basePath); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the default header.
|
|||
/// </summary>
|
|||
public virtual IDictionary<string, string> DefaultHeader { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds.
|
|||
/// </summary>
|
|||
public virtual int Timeout |
|||
{ |
|||
|
|||
get { return ApiClient.RestClient.Timeout; } |
|||
set { ApiClient.RestClient.Timeout = value; } |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the HTTP user agent.
|
|||
/// </summary>
|
|||
/// <value>Http user agent.</value>
|
|||
public virtual string UserAgent { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the username (HTTP basic authentication).
|
|||
/// </summary>
|
|||
/// <value>The username.</value>
|
|||
public virtual string Username { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the password (HTTP basic authentication).
|
|||
/// </summary>
|
|||
/// <value>The password.</value>
|
|||
public virtual string Password { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the API key with prefix.
|
|||
/// </summary>
|
|||
/// <param name="apiKeyIdentifier">API key identifier (authentication scheme).</param>
|
|||
/// <returns>API key with prefix.</returns>
|
|||
public string GetApiKeyWithPrefix(string apiKeyIdentifier) |
|||
{ |
|||
var apiKeyValue = ""; |
|||
ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue); |
|||
var apiKeyPrefix = ""; |
|||
if (ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix)) |
|||
return apiKeyPrefix + " " + apiKeyValue; |
|||
else |
|||
return apiKeyValue; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the access token for OAuth2 authentication.
|
|||
/// </summary>
|
|||
/// <value>The access token.</value>
|
|||
public virtual string AccessToken { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the temporary folder path to store the files downloaded from the server.
|
|||
/// </summary>
|
|||
/// <value>Folder path.</value>
|
|||
public virtual string TempFolderPath |
|||
{ |
|||
get { return _tempFolderPath; } |
|||
|
|||
set |
|||
{ |
|||
if (string.IsNullOrEmpty(value)) |
|||
{ |
|||
_tempFolderPath = Path.GetTempPath(); |
|||
return; |
|||
} |
|||
|
|||
// create the directory if it does not exist
|
|||
if (!Directory.Exists(value)) |
|||
{ |
|||
Directory.CreateDirectory(value); |
|||
} |
|||
|
|||
// check if the path contains directory separator at the end
|
|||
if (value[value.Length - 1] == Path.DirectorySeparatorChar) |
|||
{ |
|||
_tempFolderPath = value; |
|||
} |
|||
else |
|||
{ |
|||
_tempFolderPath = value + Path.DirectorySeparatorChar; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the date time format used when serializing in the ApiClient
|
|||
/// By default, it's set to ISO 8601 - "o", for others see:
|
|||
/// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx
|
|||
/// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx
|
|||
/// No validation is done to ensure that the string you're providing is valid
|
|||
/// </summary>
|
|||
/// <value>The DateTimeFormat string</value>
|
|||
public virtual string DateTimeFormat |
|||
{ |
|||
get { return _dateTimeFormat; } |
|||
set |
|||
{ |
|||
if (string.IsNullOrEmpty(value)) |
|||
{ |
|||
// Never allow a blank or null string, go back to the default
|
|||
_dateTimeFormat = ISO8601_DATETIME_FORMAT; |
|||
return; |
|||
} |
|||
|
|||
// Caution, no validation when you choose date time format other than ISO 8601
|
|||
// Take a look at the above links
|
|||
_dateTimeFormat = value; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
|
|||
/// </summary>
|
|||
/// <value>The prefix of the API key.</value>
|
|||
public virtual IDictionary<string, string> ApiKeyPrefix |
|||
{ |
|||
get { return _apiKeyPrefix; } |
|||
set |
|||
{ |
|||
if (value == null) |
|||
{ |
|||
throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); |
|||
} |
|||
_apiKeyPrefix = value; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the API key based on the authentication name.
|
|||
/// </summary>
|
|||
/// <value>The API key.</value>
|
|||
public virtual IDictionary<string, string> ApiKey |
|||
{ |
|||
get { return _apiKey; } |
|||
set |
|||
{ |
|||
if (value == null) |
|||
{ |
|||
throw new InvalidOperationException("ApiKey collection may not be null."); |
|||
} |
|||
_apiKey = value; |
|||
} |
|||
} |
|||
|
|||
#endregion Properties
|
|||
|
|||
#region Methods
|
|||
|
|||
/// <summary>
|
|||
/// Add default header.
|
|||
/// </summary>
|
|||
/// <param name="key">Header field name.</param>
|
|||
/// <param name="value">Header field value.</param>
|
|||
/// <returns></returns>
|
|||
public void AddDefaultHeader(string key, string value) |
|||
{ |
|||
DefaultHeader[key] = value; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Creates a new <see cref="ApiClient" /> based on this <see cref="Configuration" /> instance.
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
public ApiClient CreateApiClient() |
|||
{ |
|||
return new ApiClient(BasePath) { Configuration = this }; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// Returns a string with essential information for debugging.
|
|||
/// </summary>
|
|||
public static String ToDebugReport() |
|||
{ |
|||
String report = "C# SDK (Org.OpenAPITools) Debug Report:\n"; |
|||
report += " OS: " + System.Environment.OSVersion + "\n"; |
|||
report += " .NET Framework Version: " + System.Environment.Version + "\n"; |
|||
report += " Version of the API: 3.43.0\n"; |
|||
report += " SDK Package Version: 1.0.0\n"; |
|||
|
|||
return report; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Add Api Key Header.
|
|||
/// </summary>
|
|||
/// <param name="key">Api Key name.</param>
|
|||
/// <param name="value">Api Key value.</param>
|
|||
/// <returns></returns>
|
|||
public void AddApiKey(string key, string value) |
|||
{ |
|||
ApiKey[key] = value; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Sets the API key prefix.
|
|||
/// </summary>
|
|||
/// <param name="key">Api Key name.</param>
|
|||
/// <param name="value">Api Key value.</param>
|
|||
public void AddApiKeyPrefix(string key, string value) |
|||
{ |
|||
ApiKeyPrefix[key] = value; |
|||
} |
|||
|
|||
#endregion Methods
|
|||
} |
|||
} |
@ -0,0 +1,24 @@ |
|||
/* |
|||
* Seaweedfs Master Server API |
|||
* |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
|||
*/ |
|||
|
|||
|
|||
using System; |
|||
using RestSharp; |
|||
|
|||
namespace Org.OpenAPITools.Client |
|||
{ |
|||
/// <summary>
|
|||
/// A delegate to ExceptionFactory method
|
|||
/// </summary>
|
|||
/// <param name="methodName">Method name</param>
|
|||
/// <param name="response">Response</param>
|
|||
/// <returns>Exceptions</returns>
|
|||
public delegate Exception ExceptionFactory(string methodName, IRestResponse response); |
|||
} |
@ -0,0 +1,34 @@ |
|||
/* |
|||
* Seaweedfs Master Server API |
|||
* |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
|||
*/ |
|||
|
|||
|
|||
using System; |
|||
using System.Reflection; |
|||
using System.Collections.Generic; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading; |
|||
|
|||
namespace Org.OpenAPITools.Client |
|||
{ |
|||
/// <summary>
|
|||
/// <see cref="GlobalConfiguration"/> provides a compile-time extension point for globally configuring
|
|||
/// API Clients.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// A customized implementation via partial class may reside in another file and may
|
|||
/// be excluded from automatic generation via a .openapi-generator-ignore file.
|
|||
/// </remarks>
|
|||
public partial class GlobalConfiguration : Configuration |
|||
{ |
|||
|
|||
} |
|||
} |
@ -0,0 +1,42 @@ |
|||
/* |
|||
* Seaweedfs Master Server API |
|||
* |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
|||
*/ |
|||
|
|||
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
using System.Linq; |
|||
using RestSharp; |
|||
|
|||
namespace Org.OpenAPITools.Client |
|||
{ |
|||
/// <summary>
|
|||
/// Represents configuration aspects required to interact with the API endpoints.
|
|||
/// </summary>
|
|||
public interface IApiAccessor |
|||
{ |
|||
/// <summary>
|
|||
/// Gets or sets the configuration object
|
|||
/// </summary>
|
|||
/// <value>An instance of the Configuration</value>
|
|||
Configuration Configuration {get; set;} |
|||
|
|||
/// <summary>
|
|||
/// Gets the base path of the API client.
|
|||
/// </summary>
|
|||
/// <value>The base path</value>
|
|||
String GetBasePath(); |
|||
|
|||
/// <summary>
|
|||
/// Provides a factory method hook for the creation of exceptions.
|
|||
/// </summary>
|
|||
ExceptionFactory ExceptionFactory { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,94 @@ |
|||
/* |
|||
* Seaweedfs Master Server API |
|||
* |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
|||
*/ |
|||
|
|||
|
|||
using System.Collections.Generic; |
|||
|
|||
namespace Org.OpenAPITools.Client |
|||
{ |
|||
/// <summary>
|
|||
/// Represents a readable-only configuration contract.
|
|||
/// </summary>
|
|||
public interface IReadableConfiguration |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the access token.
|
|||
/// </summary>
|
|||
/// <value>Access token.</value>
|
|||
string AccessToken { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the API key.
|
|||
/// </summary>
|
|||
/// <value>API key.</value>
|
|||
IDictionary<string, string> ApiKey { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the API key prefix.
|
|||
/// </summary>
|
|||
/// <value>API key prefix.</value>
|
|||
IDictionary<string, string> ApiKeyPrefix { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the base path.
|
|||
/// </summary>
|
|||
/// <value>Base path.</value>
|
|||
string BasePath { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the date time format.
|
|||
/// </summary>
|
|||
/// <value>Date time format.</value>
|
|||
string DateTimeFormat { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the default header.
|
|||
/// </summary>
|
|||
/// <value>Default header.</value>
|
|||
IDictionary<string, string> DefaultHeader { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the temp folder path.
|
|||
/// </summary>
|
|||
/// <value>Temp folder path.</value>
|
|||
string TempFolderPath { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the HTTP connection timeout (in milliseconds)
|
|||
/// </summary>
|
|||
/// <value>HTTP connection timeout.</value>
|
|||
int Timeout { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the user agent.
|
|||
/// </summary>
|
|||
/// <value>User agent.</value>
|
|||
string UserAgent { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the username.
|
|||
/// </summary>
|
|||
/// <value>Username.</value>
|
|||
string Username { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the password.
|
|||
/// </summary>
|
|||
/// <value>Password.</value>
|
|||
string Password { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the API key with prefix.
|
|||
/// </summary>
|
|||
/// <param name="apiKeyIdentifier">API key identifier (authentication scheme).</param>
|
|||
/// <returns>API key with prefix.</returns>
|
|||
string GetApiKeyWithPrefix(string apiKeyIdentifier); |
|||
} |
|||
} |
@ -0,0 +1,30 @@ |
|||
/* |
|||
* Seaweedfs Master Server API |
|||
* |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
|||
*/ |
|||
|
|||
using Newtonsoft.Json.Converters; |
|||
|
|||
namespace Org.OpenAPITools.Client |
|||
{ |
|||
/// <summary>
|
|||
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
|
|||
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
|
|||
/// </summary>
|
|||
public class OpenAPIDateConverter : IsoDateTimeConverter |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="OpenAPIDateConverter" /> class.
|
|||
/// </summary>
|
|||
public OpenAPIDateConverter() |
|||
{ |
|||
// full-date = date-fullyear "-" date-month "-" date-mday
|
|||
DateTimeFormat = "yyyy-MM-dd"; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,159 @@ |
|||
/* |
|||
* Seaweedfs Master Server API |
|||
* |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
|||
*/ |
|||
|
|||
using System; |
|||
using System.Linq; |
|||
using System.IO; |
|||
using System.Text; |
|||
using System.Text.RegularExpressions; |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
using System.Runtime.Serialization; |
|||
using Newtonsoft.Json; |
|||
using Newtonsoft.Json.Converters; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; |
|||
|
|||
namespace Org.OpenAPITools.Model |
|||
{ |
|||
/// <summary>
|
|||
/// FileKey
|
|||
/// </summary>
|
|||
[DataContract] |
|||
public partial class FileKey : IEquatable<FileKey>, IValidatableObject |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="FileKey" /> class.
|
|||
/// </summary>
|
|||
/// <param name="count">count.</param>
|
|||
/// <param name="fid">fid.</param>
|
|||
/// <param name="url">url.</param>
|
|||
public FileKey(Object count = default(Object), Object fid = default(Object), Object url = default(Object)) |
|||
{ |
|||
this.Count = count; |
|||
this.Fid = fid; |
|||
this.Url = url; |
|||
this.Count = count; |
|||
this.Fid = fid; |
|||
this.Url = url; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets or Sets Count
|
|||
/// </summary>
|
|||
[DataMember(Name="count", EmitDefaultValue=true)] |
|||
public Object Count { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Gets or Sets Fid
|
|||
/// </summary>
|
|||
[DataMember(Name="fid", EmitDefaultValue=true)] |
|||
public Object Fid { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Gets or Sets Url
|
|||
/// </summary>
|
|||
[DataMember(Name="url", EmitDefaultValue=true)] |
|||
public Object Url { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Returns the string presentation of the object
|
|||
/// </summary>
|
|||
/// <returns>String presentation of the object</returns>
|
|||
public override string ToString() |
|||
{ |
|||
var sb = new StringBuilder(); |
|||
sb.Append("class FileKey {\n"); |
|||
sb.Append(" Count: ").Append(Count).Append("\n"); |
|||
sb.Append(" Fid: ").Append(Fid).Append("\n"); |
|||
sb.Append(" Url: ").Append(Url).Append("\n"); |
|||
sb.Append("}\n"); |
|||
return sb.ToString(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Returns the JSON string presentation of the object
|
|||
/// </summary>
|
|||
/// <returns>JSON string presentation of the object</returns>
|
|||
public virtual string ToJson() |
|||
{ |
|||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Returns true if objects are equal
|
|||
/// </summary>
|
|||
/// <param name="input">Object to be compared</param>
|
|||
/// <returns>Boolean</returns>
|
|||
public override bool Equals(object input) |
|||
{ |
|||
return this.Equals(input as FileKey); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Returns true if FileKey instances are equal
|
|||
/// </summary>
|
|||
/// <param name="input">Instance of FileKey to be compared</param>
|
|||
/// <returns>Boolean</returns>
|
|||
public bool Equals(FileKey input) |
|||
{ |
|||
if (input == null) |
|||
return false; |
|||
|
|||
return |
|||
( |
|||
this.Count == input.Count || |
|||
(this.Count != null && |
|||
this.Count.Equals(input.Count)) |
|||
) && |
|||
( |
|||
this.Fid == input.Fid || |
|||
(this.Fid != null && |
|||
this.Fid.Equals(input.Fid)) |
|||
) && |
|||
( |
|||
this.Url == input.Url || |
|||
(this.Url != null && |
|||
this.Url.Equals(input.Url)) |
|||
); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the hash code
|
|||
/// </summary>
|
|||
/// <returns>Hash code</returns>
|
|||
public override int GetHashCode() |
|||
{ |
|||
unchecked // Overflow is fine, just wrap
|
|||
{ |
|||
int hashCode = 41; |
|||
if (this.Count != null) |
|||
hashCode = hashCode * 59 + this.Count.GetHashCode(); |
|||
if (this.Fid != null) |
|||
hashCode = hashCode * 59 + this.Fid.GetHashCode(); |
|||
if (this.Url != null) |
|||
hashCode = hashCode * 59 + this.Url.GetHashCode(); |
|||
return hashCode; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// To validate all properties of the instance
|
|||
/// </summary>
|
|||
/// <param name="validationContext">Validation context</param>
|
|||
/// <returns>Validation Result</returns>
|
|||
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext) |
|||
{ |
|||
yield break; |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,142 @@ |
|||
/* |
|||
* Seaweedfs Master Server API |
|||
* |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* |
|||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
|||
*/ |
|||
|
|||
using System; |
|||
using System.Linq; |
|||
using System.IO; |
|||
using System.Text; |
|||
using System.Text.RegularExpressions; |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
using System.Runtime.Serialization; |
|||
using Newtonsoft.Json; |
|||
using Newtonsoft.Json.Converters; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; |
|||
|
|||
namespace Org.OpenAPITools.Model |
|||
{ |
|||
/// <summary>
|
|||
/// Location
|
|||
/// </summary>
|
|||
[DataContract] |
|||
public partial class Location : IEquatable<Location>, IValidatableObject |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="Location" /> class.
|
|||
/// </summary>
|
|||
/// <param name="publicUrl">publicUrl.</param>
|
|||
/// <param name="url">url.</param>
|
|||
public Location(Object publicUrl = default(Object), Object url = default(Object)) |
|||
{ |
|||
this.PublicUrl = publicUrl; |
|||
this.Url = url; |
|||
this.PublicUrl = publicUrl; |
|||
this.Url = url; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets or Sets PublicUrl
|
|||
/// </summary>
|
|||
[DataMember(Name="publicUrl", EmitDefaultValue=true)] |
|||
public Object PublicUrl { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Gets or Sets Url
|
|||
/// </summary>
|
|||
[DataMember(Name="url", EmitDefaultValue=true)] |
|||
public Object Url { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Returns the string presentation of the object
|
|||
/// </summary>
|
|||
/// <returns>String presentation of the object</returns>
|
|||
public override string ToString() |
|||
{ |
|||
var sb = new StringBuilder(); |
|||
sb.Append("class Location {\n"); |
|||
sb.Append(" PublicUrl: ").Append(PublicUrl).Append("\n"); |
|||
sb.Append(" Url: ").Append(Url).Append("\n"); |
|||
sb.Append("}\n"); |
|||
return sb.ToString(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Returns the JSON string presentation of the object
|
|||
/// </summary>
|
|||
/// <returns>JSON string presentation of the object</returns>
|
|||
public virtual string ToJson() |
|||
{ |
|||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Returns true if objects are equal
|
|||
/// </summary>
|
|||
/// <param name="input">Object to be compared</param>
|
|||
/// <returns>Boolean</returns>
|
|||
public override bool Equals(object input) |
|||
{ |
|||
return this.Equals(input as Location); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Returns true if Location instances are equal
|
|||
/// </summary>
|
|||
/// <param name="input">Instance of Location to be compared</param>
|
|||
/// <returns>Boolean</returns>
|
|||
public bool Equals(Location input) |
|||
{ |
|||
if (input == null) |
|||
return false; |
|||
|
|||
return |
|||
( |
|||
this.PublicUrl == input.PublicUrl || |
|||
(this.PublicUrl != null && |
|||
this.PublicUrl.Equals(input.PublicUrl)) |
|||
) && |
|||
( |
|||
this.Url == input.Url || |
|||
(this.Url != null && |
|||
this.Url.Equals(input.Url)) |
|||
); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the hash code
|
|||
/// </summary>
|
|||
/// <returns>Hash code</returns>
|
|||
public override int GetHashCode() |
|||
{ |
|||
unchecked // Overflow is fine, just wrap
|
|||
{ |
|||
int hashCode = 41; |
|||
if (this.PublicUrl != null) |
|||
hashCode = hashCode * 59 + this.PublicUrl.GetHashCode(); |
|||
if (this.Url != null) |
|||
hashCode = hashCode * 59 + this.Url.GetHashCode(); |
|||
return hashCode; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// To validate all properties of the instance
|
|||
/// </summary>
|
|||
/// <param name="validationContext">Validation context</param>
|
|||
/// <returns>Validation Result</returns>
|
|||
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext) |
|||
{ |
|||
yield break; |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,79 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
Seaweedfs Master Server API |
|||
|
|||
The Seaweedfs Master Server API allows you to store blobs |
|||
|
|||
The version of the OpenAPI document: 3.43.0 |
|||
|
|||
--> |
|||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup> |
|||
|
|||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|||
<ProjectGuid>{BC7B99B9-DA58-46D9-BFF5-76505068ECE5}</ProjectGuid> |
|||
<OutputType>Library</OutputType> |
|||
<AppDesignerFolder>Properties</AppDesignerFolder> |
|||
<RootNamespace>Org.OpenAPITools</RootNamespace> |
|||
<AssemblyName>Org.OpenAPITools</AssemblyName> |
|||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> |
|||
<FileAlignment>512</FileAlignment> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|||
<DebugSymbols>true</DebugSymbols> |
|||
<DebugType>full</DebugType> |
|||
<Optimize>false</Optimize> |
|||
<OutputPath>bin\Debug\</OutputPath> |
|||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
<DocumentationFile>bin\Debug\Org.OpenAPITools.xml</DocumentationFile> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|||
<DebugType>pdbonly</DebugType> |
|||
<Optimize>true</Optimize> |
|||
<OutputPath>bin\Release\</OutputPath> |
|||
<DefineConstants>TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
<DocumentationFile>bin\Release\Org.OpenAPITools.xml</DocumentationFile> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<Reference Include="System" /> |
|||
<Reference Include="System.Core" /> |
|||
<Reference Include="System.Xml.Linq" /> |
|||
<Reference Include="System.Data.DataSetExtensions" /> |
|||
<Reference Include="System.ComponentModel.DataAnnotations" /> |
|||
<Reference Include="Microsoft.CSharp" /> |
|||
<Reference Include="System.Data" /> |
|||
<Reference Include="System.Runtime.Serialization" /> |
|||
<Reference Include="System.Xml" /> |
|||
<Reference Include="Newtonsoft.Json"> |
|||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> |
|||
<HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> |
|||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> |
|||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> |
|||
</Reference> |
|||
<Reference Include="JsonSubTypes"> |
|||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll</HintPath> |
|||
<HintPath Condition="Exists('..\packages')">..\packages\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll</HintPath> |
|||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll</HintPath> |
|||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll</HintPath> |
|||
</Reference> |
|||
<Reference Include="RestSharp"> |
|||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath> |
|||
<HintPath Condition="Exists('..\packages')">..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath> |
|||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath> |
|||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath> |
|||
</Reference> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<Compile Include="**\*.cs" |
|||
Exclude="obj\**" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<None Include="packages.config" /> |
|||
</ItemGroup> |
|||
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" /> |
|||
</Project> |
@ -0,0 +1,41 @@ |
|||
<?xml version="1.0"?> |
|||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> |
|||
<metadata> |
|||
<!-- The identifier that must be unique within the hosting gallery --> |
|||
<id>$id$</id> |
|||
<title>OpenAPI Library</title> |
|||
|
|||
<!-- The package version number that is used when resolving dependencies --> |
|||
<version>$version$</version> |
|||
|
|||
<!-- Authors contain text that appears directly on the gallery --> |
|||
<authors>$author$</authors> |
|||
|
|||
<!-- Owners are typically nuget.org identities that allow gallery |
|||
users to easily find other packages by the same owners. --> |
|||
<owners>$author$</owners> |
|||
<requireLicenseAcceptance>false</requireLicenseAcceptance> |
|||
<developmentDependency>false</developmentDependency> |
|||
|
|||
<!-- The description can be used in package manager UI. Note that the |
|||
nuget.org gallery uses information you add in the portal. --> |
|||
<description>A library generated from a OpenAPI doc</description> |
|||
<licenseUrl>http://localhost</licenseUrl> |
|||
|
|||
<!-- Dependencies are automatically installed when the package is installed --> |
|||
<dependencies> |
|||
|
|||
<dependency id="NewtonSoft.Json" version="12.0.3" /> |
|||
<dependency id="JsonSubTypes" version="1.6.0" /> |
|||
<dependency id="RestSharp" version="105.1.0" /> |
|||
|
|||
</dependencies> |
|||
</metadata> |
|||
<files> |
|||
|
|||
<!-- A readme.txt will be displayed when the package is installed --> |
|||
<file src="..\..\README.md" target="" /> |
|||
<file src="..\..\docs\**\*.*" target="docs" /> |
|||
|
|||
</files> |
|||
</package> |
@ -0,0 +1,32 @@ |
|||
using System.Reflection; |
|||
using System.Runtime.InteropServices; |
|||
|
|||
// General Information about an assembly is controlled through the following
|
|||
// set of attributes. Change these attribute values to modify the information
|
|||
// associated with an assembly.
|
|||
[assembly: AssemblyTitle("OpenAPI Library")] |
|||
[assembly: AssemblyDescription("A library generated from a OpenAPI doc")] |
|||
[assembly: AssemblyConfiguration("")] |
|||
[assembly: AssemblyCompany("OpenAPI")] |
|||
[assembly: AssemblyProduct("OpenAPILibrary")] |
|||
[assembly: AssemblyCopyright("No Copyright")] |
|||
[assembly: AssemblyTrademark("")] |
|||
[assembly: AssemblyCulture("")] |
|||
|
|||
// Setting ComVisible to false makes the types in this assembly not visible
|
|||
// to COM components. If you need to access a type in this assembly from
|
|||
// COM, set the ComVisible attribute to true on that type.
|
|||
[assembly: ComVisible(false)] |
|||
|
|||
// Version information for an assembly consists of the following four values:
|
|||
//
|
|||
// Major Version
|
|||
// Minor Version
|
|||
// Build Number
|
|||
// Revision
|
|||
//
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
|||
// by using the '*' as shown below:
|
|||
// [assembly: AssemblyVersion("1.0.*")]
|
|||
[assembly: AssemblyVersion("1.0.0")] |
|||
[assembly: AssemblyFileVersion("1.0.0")] |
@ -0,0 +1,7 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<packages> |
|||
<package id="NUnit" version="3.11.0" targetFramework="net45" /> |
|||
<package id="RestSharp" version="105.1.0" targetFramework="net45" developmentDependency="true" /> |
|||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net45" developmentDependency="true" /> |
|||
<package id="JsonSubTypes" version="1.6.0" targetFramework="net45" developmentDependency="true" /> |
|||
</packages> |
@ -0,0 +1,24 @@ |
|||
# Compiled Object files, Static and Dynamic libs (Shared Objects) |
|||
*.o |
|||
*.a |
|||
*.so |
|||
|
|||
# Folders |
|||
_obj |
|||
_test |
|||
|
|||
# Architecture specific extensions/prefixes |
|||
*.[568vq] |
|||
[568vq].out |
|||
|
|||
*.cgo1.go |
|||
*.cgo2.c |
|||
_cgo_defun.c |
|||
_cgo_gotypes.go |
|||
_cgo_export.* |
|||
|
|||
_testmain.go |
|||
|
|||
*.exe |
|||
*.test |
|||
*.prof |
@ -0,0 +1,23 @@ |
|||
# OpenAPI Generator Ignore |
|||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator |
|||
|
|||
# Use this file to prevent files from being overwritten by the generator. |
|||
# The patterns follow closely to .gitignore or .dockerignore. |
|||
|
|||
# As an example, the C# client generator defines ApiClient.cs. |
|||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: |
|||
#ApiClient.cs |
|||
|
|||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): |
|||
#foo/*/qux |
|||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux |
|||
|
|||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): |
|||
#foo/**/qux |
|||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux |
|||
|
|||
# You can also negate patterns with an exclamation (!). |
|||
# For example, you can ignore all files in a docs folder with the file extension .md: |
|||
#docs/*.md |
|||
# Then explicitly reverse the ignore rule for a single file: |
|||
#!docs/README.md |
@ -0,0 +1,19 @@ |
|||
.gitignore |
|||
.openapi-generator-ignore |
|||
.travis.yml |
|||
README.md |
|||
api/openapi.yaml |
|||
api_default.go |
|||
client.go |
|||
configuration.go |
|||
docs/DefaultApi.md |
|||
docs/FileKey.md |
|||
docs/Location.md |
|||
git_push.sh |
|||
go.mod |
|||
go.sum |
|||
model_file_key.go |
|||
model_location.go |
|||
response.go |
|||
test/api_default_test.go |
|||
utils.go |
@ -0,0 +1 @@ |
|||
6.4.0 |
@ -0,0 +1,8 @@ |
|||
language: go |
|||
|
|||
install: |
|||
- go get -d -v . |
|||
|
|||
script: |
|||
- go build -v ./ |
|||
|
@ -0,0 +1,114 @@ |
|||
# Go API client for openapi |
|||
|
|||
The Seaweedfs Master Server API allows you to store blobs |
|||
|
|||
## Overview |
|||
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. |
|||
|
|||
- API version: 3.43.0 |
|||
- Package version: 1.0.0 |
|||
- Build package: org.openapitools.codegen.languages.GoClientCodegen |
|||
|
|||
## Installation |
|||
|
|||
Install the following dependencies: |
|||
|
|||
```shell |
|||
go get github.com/stretchr/testify/assert |
|||
go get golang.org/x/net/context |
|||
``` |
|||
|
|||
Put the package under your project folder and add the following in import: |
|||
|
|||
```golang |
|||
import openapi "github.com/GIT_USER_ID/GIT_REPO_ID" |
|||
``` |
|||
|
|||
To use a proxy, set the environment variable `HTTP_PROXY`: |
|||
|
|||
```golang |
|||
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") |
|||
``` |
|||
|
|||
## Configuration of Server URL |
|||
|
|||
Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. |
|||
|
|||
### Select Server Configuration |
|||
|
|||
For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. |
|||
|
|||
```golang |
|||
ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1) |
|||
``` |
|||
|
|||
### Templated Server URL |
|||
|
|||
Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. |
|||
|
|||
```golang |
|||
ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{ |
|||
"basePath": "v2", |
|||
}) |
|||
``` |
|||
|
|||
Note, enum values are always validated and all unused variables are silently ignored. |
|||
|
|||
### URLs Configuration per Operation |
|||
|
|||
Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. |
|||
An operation is uniquely identified by `"{classname}Service.{nickname}"` string. |
|||
Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. |
|||
|
|||
```golang |
|||
ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{ |
|||
"{classname}Service.{nickname}": 2, |
|||
}) |
|||
ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{ |
|||
"{classname}Service.{nickname}": { |
|||
"port": "8443", |
|||
}, |
|||
}) |
|||
``` |
|||
|
|||
## Documentation for API Endpoints |
|||
|
|||
All URIs are relative to *https://127.0.0.1:9333* |
|||
|
|||
Class | Method | HTTP request | Description |
|||
------------ | ------------- | ------------- | ------------- |
|||
*DefaultApi* | [**DirAssign**](docs/DefaultApi.md#dirassign) | **Get** /dir/assign | Assign a file key |
|||
*DefaultApi* | [**DirLookup**](docs/DefaultApi.md#dirlookup) | **Get** /dir/lookup | Lookup volume |
|||
|
|||
|
|||
## Documentation For Models |
|||
|
|||
- [FileKey](docs/FileKey.md) |
|||
- [Location](docs/Location.md) |
|||
|
|||
|
|||
## Documentation For Authorization |
|||
|
|||
Endpoints do not require authorization. |
|||
|
|||
|
|||
## Documentation for Utility Methods |
|||
|
|||
Due to the fact that model structure members are all pointers, this package contains |
|||
a number of utility functions to easily obtain pointers to values of basic types. |
|||
Each of these functions takes a value of the given basic type and returns a pointer to it: |
|||
|
|||
* `PtrBool` |
|||
* `PtrInt` |
|||
* `PtrInt32` |
|||
* `PtrInt64` |
|||
* `PtrFloat` |
|||
* `PtrFloat32` |
|||
* `PtrFloat64` |
|||
* `PtrString` |
|||
* `PtrTime` |
|||
|
|||
## Author |
|||
|
|||
|
|||
|
@ -0,0 +1,174 @@ |
|||
openapi: 3.1.0 |
|||
info: |
|||
description: The Seaweedfs Master Server API allows you to store blobs |
|||
title: Seaweedfs Master Server API |
|||
version: 3.43.0 |
|||
servers: |
|||
- url: https://127.0.0.1:9333/ |
|||
paths: |
|||
/dir/assign: |
|||
get: |
|||
description: This operation is very cheap. Just increase a number in master |
|||
server's memory. |
|||
operationId: dirAssign |
|||
parameters: |
|||
- description: "how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned\ |
|||
\ additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2" |
|||
explode: true |
|||
in: query |
|||
name: count |
|||
required: false |
|||
schema: |
|||
format: int32 |
|||
style: form |
|||
- description: required collection name |
|||
explode: true |
|||
in: query |
|||
name: collection |
|||
required: false |
|||
schema: {} |
|||
style: form |
|||
- description: preferred data center |
|||
explode: true |
|||
in: query |
|||
name: dataCenter |
|||
required: false |
|||
schema: {} |
|||
style: form |
|||
- description: preferred rack |
|||
explode: true |
|||
in: query |
|||
name: rack |
|||
required: false |
|||
schema: {} |
|||
style: form |
|||
- description: "preferred volume server, e.g. 127.0.0.1:8080" |
|||
explode: true |
|||
in: query |
|||
name: dataNode |
|||
required: false |
|||
schema: {} |
|||
style: form |
|||
- description: "If you have disks labelled, this must be supplied to specify\ |
|||
\ the disk type to allocate on." |
|||
explode: true |
|||
in: query |
|||
name: disk |
|||
required: false |
|||
schema: {} |
|||
style: form |
|||
- description: replica placement strategy |
|||
explode: true |
|||
in: query |
|||
name: replication |
|||
required: false |
|||
schema: {} |
|||
style: form |
|||
- description: "file expiration time limit, example: 3m for 3 minutes. units:\ |
|||
\ m-minute, h-hour, d-day, w-week, M-month, y-year" |
|||
explode: true |
|||
in: query |
|||
name: ttl |
|||
required: false |
|||
schema: {} |
|||
style: form |
|||
- description: "If no matching volumes, pre-allocate this number of bytes on\ |
|||
\ disk for new volumes." |
|||
explode: true |
|||
in: query |
|||
name: preallocate |
|||
required: false |
|||
schema: |
|||
format: int64 |
|||
style: form |
|||
- description: Only implemented for windows. Use memory mapped files with specified |
|||
size for new volumes. |
|||
explode: true |
|||
in: query |
|||
name: memoryMapMaxSizeMb |
|||
required: false |
|||
schema: |
|||
format: int32 |
|||
style: form |
|||
- description: "If no matching volumes, create specified number of new volumes." |
|||
explode: true |
|||
in: query |
|||
name: writableVolumeCount |
|||
required: false |
|||
schema: |
|||
format: int32 |
|||
style: form |
|||
responses: |
|||
"200": |
|||
content: |
|||
application/json: |
|||
schema: |
|||
$ref: '#/components/schemas/FileKey' |
|||
description: successful operation |
|||
summary: Assign a file key |
|||
/dir/lookup: |
|||
get: |
|||
description: We would need to find out whether the volumes have moved. |
|||
operationId: dirLookup |
|||
parameters: |
|||
- description: volume id |
|||
explode: true |
|||
in: query |
|||
name: volumeId |
|||
required: false |
|||
schema: |
|||
format: int32 |
|||
style: form |
|||
- description: optionally to speed up the lookup |
|||
explode: true |
|||
in: query |
|||
name: collection |
|||
required: false |
|||
schema: {} |
|||
style: form |
|||
- description: "If provided, this returns the fileId location and a JWT to update\ |
|||
\ or delete the file." |
|||
explode: true |
|||
in: query |
|||
name: fileId |
|||
required: false |
|||
schema: {} |
|||
style: form |
|||
- description: "works together with \"fileId\", if read=yes, JWT is generated\ |
|||
\ for reads." |
|||
explode: true |
|||
in: query |
|||
name: read |
|||
required: false |
|||
schema: {} |
|||
style: form |
|||
responses: |
|||
"200": |
|||
content: |
|||
application/json: |
|||
schema: |
|||
items: |
|||
$ref: '#/components/schemas/Location' |
|||
description: successful operation |
|||
summary: Lookup volume |
|||
components: |
|||
schemas: |
|||
FileKey: |
|||
example: |
|||
fid: "3,01637037d6" |
|||
count: 10 |
|||
url: 127.0.0.1:8080 |
|||
properties: |
|||
count: |
|||
example: 10 |
|||
format: int64 |
|||
fid: |
|||
example: "3,01637037d6" |
|||
url: |
|||
example: 127.0.0.1:8080 |
|||
Location: |
|||
properties: |
|||
publicUrl: |
|||
example: localhost:8080 |
|||
url: |
|||
example: localhost:8080 |
@ -0,0 +1,372 @@ |
|||
/* |
|||
Seaweedfs Master Server API |
|||
|
|||
The Seaweedfs Master Server API allows you to store blobs |
|||
|
|||
API version: 3.43.0 |
|||
*/ |
|||
|
|||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|||
|
|||
package openapi |
|||
|
|||
import ( |
|||
"bytes" |
|||
"context" |
|||
"io" |
|||
"net/http" |
|||
"net/url" |
|||
) |
|||
|
|||
// DefaultApiService DefaultApi service
|
|||
type DefaultApiService service |
|||
|
|||
type ApiDirAssignRequest struct { |
|||
ctx context.Context |
|||
ApiService *DefaultApiService |
|||
count *interface{} |
|||
collection *interface{} |
|||
dataCenter *interface{} |
|||
rack *interface{} |
|||
dataNode *interface{} |
|||
disk *interface{} |
|||
replication *interface{} |
|||
ttl *interface{} |
|||
preallocate *interface{} |
|||
memoryMapMaxSizeMb *interface{} |
|||
writableVolumeCount *interface{} |
|||
} |
|||
|
|||
// how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2
|
|||
func (r ApiDirAssignRequest) Count(count interface{}) ApiDirAssignRequest { |
|||
r.count = &count |
|||
return r |
|||
} |
|||
|
|||
// required collection name
|
|||
func (r ApiDirAssignRequest) Collection(collection interface{}) ApiDirAssignRequest { |
|||
r.collection = &collection |
|||
return r |
|||
} |
|||
|
|||
// preferred data center
|
|||
func (r ApiDirAssignRequest) DataCenter(dataCenter interface{}) ApiDirAssignRequest { |
|||
r.dataCenter = &dataCenter |
|||
return r |
|||
} |
|||
|
|||
// preferred rack
|
|||
func (r ApiDirAssignRequest) Rack(rack interface{}) ApiDirAssignRequest { |
|||
r.rack = &rack |
|||
return r |
|||
} |
|||
|
|||
// preferred volume server, e.g. 127.0.0.1:8080
|
|||
func (r ApiDirAssignRequest) DataNode(dataNode interface{}) ApiDirAssignRequest { |
|||
r.dataNode = &dataNode |
|||
return r |
|||
} |
|||
|
|||
// If you have disks labelled, this must be supplied to specify the disk type to allocate on.
|
|||
func (r ApiDirAssignRequest) Disk(disk interface{}) ApiDirAssignRequest { |
|||
r.disk = &disk |
|||
return r |
|||
} |
|||
|
|||
// replica placement strategy
|
|||
func (r ApiDirAssignRequest) Replication(replication interface{}) ApiDirAssignRequest { |
|||
r.replication = &replication |
|||
return r |
|||
} |
|||
|
|||
// file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year
|
|||
func (r ApiDirAssignRequest) Ttl(ttl interface{}) ApiDirAssignRequest { |
|||
r.ttl = &ttl |
|||
return r |
|||
} |
|||
|
|||
// If no matching volumes, pre-allocate this number of bytes on disk for new volumes.
|
|||
func (r ApiDirAssignRequest) Preallocate(preallocate interface{}) ApiDirAssignRequest { |
|||
r.preallocate = &preallocate |
|||
return r |
|||
} |
|||
|
|||
// Only implemented for windows. Use memory mapped files with specified size for new volumes.
|
|||
func (r ApiDirAssignRequest) MemoryMapMaxSizeMb(memoryMapMaxSizeMb interface{}) ApiDirAssignRequest { |
|||
r.memoryMapMaxSizeMb = &memoryMapMaxSizeMb |
|||
return r |
|||
} |
|||
|
|||
// If no matching volumes, create specified number of new volumes.
|
|||
func (r ApiDirAssignRequest) WritableVolumeCount(writableVolumeCount interface{}) ApiDirAssignRequest { |
|||
r.writableVolumeCount = &writableVolumeCount |
|||
return r |
|||
} |
|||
|
|||
func (r ApiDirAssignRequest) Execute() (*FileKey, *http.Response, error) { |
|||
return r.ApiService.DirAssignExecute(r) |
|||
} |
|||
|
|||
/* |
|||
DirAssign Assign a file key |
|||
|
|||
This operation is very cheap. Just increase a number in master server's memory. |
|||
|
|||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). |
|||
@return ApiDirAssignRequest |
|||
*/ |
|||
func (a *DefaultApiService) DirAssign(ctx context.Context) ApiDirAssignRequest { |
|||
return ApiDirAssignRequest{ |
|||
ApiService: a, |
|||
ctx: ctx, |
|||
} |
|||
} |
|||
|
|||
// Execute executes the request
|
|||
//
|
|||
// @return FileKey
|
|||
func (a *DefaultApiService) DirAssignExecute(r ApiDirAssignRequest) (*FileKey, *http.Response, error) { |
|||
var ( |
|||
localVarHTTPMethod = http.MethodGet |
|||
localVarPostBody interface{} |
|||
formFiles []formFile |
|||
localVarReturnValue *FileKey |
|||
) |
|||
|
|||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DirAssign") |
|||
if err != nil { |
|||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} |
|||
} |
|||
|
|||
localVarPath := localBasePath + "/dir/assign" |
|||
|
|||
localVarHeaderParams := make(map[string]string) |
|||
localVarQueryParams := url.Values{} |
|||
localVarFormParams := url.Values{} |
|||
|
|||
if r.count != nil { |
|||
parameterAddToHeaderOrQuery(localVarQueryParams, "count", r.count, "") |
|||
} |
|||
if r.collection != nil { |
|||
parameterAddToHeaderOrQuery(localVarQueryParams, "collection", r.collection, "") |
|||
} |
|||
if r.dataCenter != nil { |
|||
parameterAddToHeaderOrQuery(localVarQueryParams, "dataCenter", r.dataCenter, "") |
|||
} |
|||
if r.rack != nil { |
|||
parameterAddToHeaderOrQuery(localVarQueryParams, "rack", r.rack, "") |
|||
} |
|||
if r.dataNode != nil { |
|||
parameterAddToHeaderOrQuery(localVarQueryParams, "dataNode", r.dataNode, "") |
|||
} |
|||
if r.disk != nil { |
|||
parameterAddToHeaderOrQuery(localVarQueryParams, "disk", r.disk, "") |
|||
} |
|||
if r.replication != nil { |
|||
parameterAddToHeaderOrQuery(localVarQueryParams, "replication", r.replication, "") |
|||
} |
|||
if r.ttl != nil { |
|||
parameterAddToHeaderOrQuery(localVarQueryParams, "ttl", r.ttl, "") |
|||
} |
|||
if r.preallocate != nil { |
|||
parameterAddToHeaderOrQuery(localVarQueryParams, "preallocate", r.preallocate, "") |
|||
} |
|||
if r.memoryMapMaxSizeMb != nil { |
|||
parameterAddToHeaderOrQuery(localVarQueryParams, "memoryMapMaxSizeMb", r.memoryMapMaxSizeMb, "") |
|||
} |
|||
if r.writableVolumeCount != nil { |
|||
parameterAddToHeaderOrQuery(localVarQueryParams, "writableVolumeCount", r.writableVolumeCount, "") |
|||
} |
|||
// to determine the Content-Type header
|
|||
localVarHTTPContentTypes := []string{} |
|||
|
|||
// set Content-Type header
|
|||
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) |
|||
if localVarHTTPContentType != "" { |
|||
localVarHeaderParams["Content-Type"] = localVarHTTPContentType |
|||
} |
|||
|
|||
// to determine the Accept header
|
|||
localVarHTTPHeaderAccepts := []string{"application/json"} |
|||
|
|||
// set Accept header
|
|||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) |
|||
if localVarHTTPHeaderAccept != "" { |
|||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept |
|||
} |
|||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) |
|||
if err != nil { |
|||
return localVarReturnValue, nil, err |
|||
} |
|||
|
|||
localVarHTTPResponse, err := a.client.callAPI(req) |
|||
if err != nil || localVarHTTPResponse == nil { |
|||
return localVarReturnValue, localVarHTTPResponse, err |
|||
} |
|||
|
|||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) |
|||
localVarHTTPResponse.Body.Close() |
|||
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) |
|||
if err != nil { |
|||
return localVarReturnValue, localVarHTTPResponse, err |
|||
} |
|||
|
|||
if localVarHTTPResponse.StatusCode >= 300 { |
|||
newErr := &GenericOpenAPIError{ |
|||
body: localVarBody, |
|||
error: localVarHTTPResponse.Status, |
|||
} |
|||
return localVarReturnValue, localVarHTTPResponse, newErr |
|||
} |
|||
|
|||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) |
|||
if err != nil { |
|||
newErr := &GenericOpenAPIError{ |
|||
body: localVarBody, |
|||
error: err.Error(), |
|||
} |
|||
return localVarReturnValue, localVarHTTPResponse, newErr |
|||
} |
|||
|
|||
return localVarReturnValue, localVarHTTPResponse, nil |
|||
} |
|||
|
|||
type ApiDirLookupRequest struct { |
|||
ctx context.Context |
|||
ApiService *DefaultApiService |
|||
volumeId *interface{} |
|||
collection *interface{} |
|||
fileId *interface{} |
|||
read *interface{} |
|||
} |
|||
|
|||
// volume id
|
|||
func (r ApiDirLookupRequest) VolumeId(volumeId interface{}) ApiDirLookupRequest { |
|||
r.volumeId = &volumeId |
|||
return r |
|||
} |
|||
|
|||
// optionally to speed up the lookup
|
|||
func (r ApiDirLookupRequest) Collection(collection interface{}) ApiDirLookupRequest { |
|||
r.collection = &collection |
|||
return r |
|||
} |
|||
|
|||
// If provided, this returns the fileId location and a JWT to update or delete the file.
|
|||
func (r ApiDirLookupRequest) FileId(fileId interface{}) ApiDirLookupRequest { |
|||
r.fileId = &fileId |
|||
return r |
|||
} |
|||
|
|||
// works together with \"fileId\", if read=yes, JWT is generated for reads.
|
|||
func (r ApiDirLookupRequest) Read(read interface{}) ApiDirLookupRequest { |
|||
r.read = &read |
|||
return r |
|||
} |
|||
|
|||
func (r ApiDirLookupRequest) Execute() (interface{}, *http.Response, error) { |
|||
return r.ApiService.DirLookupExecute(r) |
|||
} |
|||
|
|||
/* |
|||
DirLookup Lookup volume |
|||
|
|||
We would need to find out whether the volumes have moved. |
|||
|
|||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). |
|||
@return ApiDirLookupRequest |
|||
*/ |
|||
func (a *DefaultApiService) DirLookup(ctx context.Context) ApiDirLookupRequest { |
|||
return ApiDirLookupRequest{ |
|||
ApiService: a, |
|||
ctx: ctx, |
|||
} |
|||
} |
|||
|
|||
// Execute executes the request
|
|||
//
|
|||
// @return interface{}
|
|||
func (a *DefaultApiService) DirLookupExecute(r ApiDirLookupRequest) (interface{}, *http.Response, error) { |
|||
var ( |
|||
localVarHTTPMethod = http.MethodGet |
|||
localVarPostBody interface{} |
|||
formFiles []formFile |
|||
localVarReturnValue interface{} |
|||
) |
|||
|
|||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DirLookup") |
|||
if err != nil { |
|||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} |
|||
} |
|||
|
|||
localVarPath := localBasePath + "/dir/lookup" |
|||
|
|||
localVarHeaderParams := make(map[string]string) |
|||
localVarQueryParams := url.Values{} |
|||
localVarFormParams := url.Values{} |
|||
|
|||
if r.volumeId != nil { |
|||
parameterAddToHeaderOrQuery(localVarQueryParams, "volumeId", r.volumeId, "") |
|||
} |
|||
if r.collection != nil { |
|||
parameterAddToHeaderOrQuery(localVarQueryParams, "collection", r.collection, "") |
|||
} |
|||
if r.fileId != nil { |
|||
parameterAddToHeaderOrQuery(localVarQueryParams, "fileId", r.fileId, "") |
|||
} |
|||
if r.read != nil { |
|||
parameterAddToHeaderOrQuery(localVarQueryParams, "read", r.read, "") |
|||
} |
|||
// to determine the Content-Type header
|
|||
localVarHTTPContentTypes := []string{} |
|||
|
|||
// set Content-Type header
|
|||
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) |
|||
if localVarHTTPContentType != "" { |
|||
localVarHeaderParams["Content-Type"] = localVarHTTPContentType |
|||
} |
|||
|
|||
// to determine the Accept header
|
|||
localVarHTTPHeaderAccepts := []string{"application/json"} |
|||
|
|||
// set Accept header
|
|||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) |
|||
if localVarHTTPHeaderAccept != "" { |
|||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept |
|||
} |
|||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) |
|||
if err != nil { |
|||
return localVarReturnValue, nil, err |
|||
} |
|||
|
|||
localVarHTTPResponse, err := a.client.callAPI(req) |
|||
if err != nil || localVarHTTPResponse == nil { |
|||
return localVarReturnValue, localVarHTTPResponse, err |
|||
} |
|||
|
|||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) |
|||
localVarHTTPResponse.Body.Close() |
|||
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) |
|||
if err != nil { |
|||
return localVarReturnValue, localVarHTTPResponse, err |
|||
} |
|||
|
|||
if localVarHTTPResponse.StatusCode >= 300 { |
|||
newErr := &GenericOpenAPIError{ |
|||
body: localVarBody, |
|||
error: localVarHTTPResponse.Status, |
|||
} |
|||
return localVarReturnValue, localVarHTTPResponse, newErr |
|||
} |
|||
|
|||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) |
|||
if err != nil { |
|||
newErr := &GenericOpenAPIError{ |
|||
body: localVarBody, |
|||
error: err.Error(), |
|||
} |
|||
return localVarReturnValue, localVarHTTPResponse, newErr |
|||
} |
|||
|
|||
return localVarReturnValue, localVarHTTPResponse, nil |
|||
} |
@ -0,0 +1,654 @@ |
|||
/* |
|||
Seaweedfs Master Server API |
|||
|
|||
The Seaweedfs Master Server API allows you to store blobs |
|||
|
|||
API version: 3.43.0 |
|||
*/ |
|||
|
|||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|||
|
|||
package openapi |
|||
|
|||
import ( |
|||
"bytes" |
|||
"context" |
|||
"encoding/json" |
|||
"encoding/xml" |
|||
"errors" |
|||
"fmt" |
|||
"io" |
|||
"log" |
|||
"mime/multipart" |
|||
"net/http" |
|||
"net/http/httputil" |
|||
"net/url" |
|||
"os" |
|||
"path/filepath" |
|||
"reflect" |
|||
"regexp" |
|||
"strconv" |
|||
"strings" |
|||
"time" |
|||
"unicode/utf8" |
|||
) |
|||
|
|||
var ( |
|||
jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) |
|||
xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) |
|||
queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) |
|||
queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") |
|||
) |
|||
|
|||
// APIClient manages communication with the Seaweedfs Master Server API API v3.43.0
|
|||
// In most cases there should be only one, shared, APIClient.
|
|||
type APIClient struct { |
|||
cfg *Configuration |
|||
common service // Reuse a single struct instead of allocating one for each service on the heap.
|
|||
|
|||
// API Services
|
|||
|
|||
DefaultApi *DefaultApiService |
|||
} |
|||
|
|||
type service struct { |
|||
client *APIClient |
|||
} |
|||
|
|||
// NewAPIClient creates a new API client. Requires a userAgent string describing your application.
|
|||
// optionally a custom http.Client to allow for advanced features such as caching.
|
|||
func NewAPIClient(cfg *Configuration) *APIClient { |
|||
if cfg.HTTPClient == nil { |
|||
cfg.HTTPClient = http.DefaultClient |
|||
} |
|||
|
|||
c := &APIClient{} |
|||
c.cfg = cfg |
|||
c.common.client = c |
|||
|
|||
// API Services
|
|||
c.DefaultApi = (*DefaultApiService)(&c.common) |
|||
|
|||
return c |
|||
} |
|||
|
|||
func atoi(in string) (int, error) { |
|||
return strconv.Atoi(in) |
|||
} |
|||
|
|||
// selectHeaderContentType select a content type from the available list.
|
|||
func selectHeaderContentType(contentTypes []string) string { |
|||
if len(contentTypes) == 0 { |
|||
return "" |
|||
} |
|||
if contains(contentTypes, "application/json") { |
|||
return "application/json" |
|||
} |
|||
return contentTypes[0] // use the first content type specified in 'consumes'
|
|||
} |
|||
|
|||
// selectHeaderAccept join all accept types and return
|
|||
func selectHeaderAccept(accepts []string) string { |
|||
if len(accepts) == 0 { |
|||
return "" |
|||
} |
|||
|
|||
if contains(accepts, "application/json") { |
|||
return "application/json" |
|||
} |
|||
|
|||
return strings.Join(accepts, ",") |
|||
} |
|||
|
|||
// contains is a case insensitive match, finding needle in a haystack
|
|||
func contains(haystack []string, needle string) bool { |
|||
for _, a := range haystack { |
|||
if strings.EqualFold(a, needle) { |
|||
return true |
|||
} |
|||
} |
|||
return false |
|||
} |
|||
|
|||
// Verify optional parameters are of the correct type.
|
|||
func typeCheckParameter(obj interface{}, expected string, name string) error { |
|||
// Make sure there is an object.
|
|||
if obj == nil { |
|||
return nil |
|||
} |
|||
|
|||
// Check the type is as expected.
|
|||
if reflect.TypeOf(obj).String() != expected { |
|||
return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) |
|||
} |
|||
return nil |
|||
} |
|||
|
|||
func parameterValueToString(obj interface{}, key string) string { |
|||
if reflect.TypeOf(obj).Kind() != reflect.Ptr { |
|||
return fmt.Sprintf("%v", obj) |
|||
} |
|||
var param, ok = obj.(MappedNullable) |
|||
if !ok { |
|||
return "" |
|||
} |
|||
dataMap, err := param.ToMap() |
|||
if err != nil { |
|||
return "" |
|||
} |
|||
return fmt.Sprintf("%v", dataMap[key]) |
|||
} |
|||
|
|||
// parameterAddToHeaderOrQuery adds the provided object to the request header or url query
|
|||
// supporting deep object syntax
|
|||
func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { |
|||
var v = reflect.ValueOf(obj) |
|||
var value = "" |
|||
if v == reflect.ValueOf(nil) { |
|||
value = "null" |
|||
} else { |
|||
switch v.Kind() { |
|||
case reflect.Invalid: |
|||
value = "invalid" |
|||
|
|||
case reflect.Struct: |
|||
if t, ok := obj.(MappedNullable); ok { |
|||
dataMap, err := t.ToMap() |
|||
if err != nil { |
|||
return |
|||
} |
|||
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) |
|||
return |
|||
} |
|||
if t, ok := obj.(time.Time); ok { |
|||
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) |
|||
return |
|||
} |
|||
value = v.Type().String() + " value" |
|||
case reflect.Slice: |
|||
var indValue = reflect.ValueOf(obj) |
|||
if indValue == reflect.ValueOf(nil) { |
|||
return |
|||
} |
|||
var lenIndValue = indValue.Len() |
|||
for i := 0; i < lenIndValue; i++ { |
|||
var arrayValue = indValue.Index(i) |
|||
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) |
|||
} |
|||
return |
|||
|
|||
case reflect.Map: |
|||
var indValue = reflect.ValueOf(obj) |
|||
if indValue == reflect.ValueOf(nil) { |
|||
return |
|||
} |
|||
iter := indValue.MapRange() |
|||
for iter.Next() { |
|||
k, v := iter.Key(), iter.Value() |
|||
parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) |
|||
} |
|||
return |
|||
|
|||
case reflect.Interface: |
|||
fallthrough |
|||
case reflect.Ptr: |
|||
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) |
|||
return |
|||
|
|||
case reflect.Int, reflect.Int8, reflect.Int16, |
|||
reflect.Int32, reflect.Int64: |
|||
value = strconv.FormatInt(v.Int(), 10) |
|||
case reflect.Uint, reflect.Uint8, reflect.Uint16, |
|||
reflect.Uint32, reflect.Uint64, reflect.Uintptr: |
|||
value = strconv.FormatUint(v.Uint(), 10) |
|||
case reflect.Float32, reflect.Float64: |
|||
value = strconv.FormatFloat(v.Float(), 'g', -1, 32) |
|||
case reflect.Bool: |
|||
value = strconv.FormatBool(v.Bool()) |
|||
case reflect.String: |
|||
value = v.String() |
|||
default: |
|||
value = v.Type().String() + " value" |
|||
} |
|||
} |
|||
|
|||
switch valuesMap := headerOrQueryParams.(type) { |
|||
case url.Values: |
|||
if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { |
|||
valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) |
|||
} else { |
|||
valuesMap.Add(keyPrefix, value) |
|||
} |
|||
break |
|||
case map[string]string: |
|||
valuesMap[keyPrefix] = value |
|||
break |
|||
} |
|||
} |
|||
|
|||
// helper for converting interface{} parameters to json strings
|
|||
func parameterToJson(obj interface{}) (string, error) { |
|||
jsonBuf, err := json.Marshal(obj) |
|||
if err != nil { |
|||
return "", err |
|||
} |
|||
return string(jsonBuf), err |
|||
} |
|||
|
|||
// callAPI do the request.
|
|||
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { |
|||
if c.cfg.Debug { |
|||
dump, err := httputil.DumpRequestOut(request, true) |
|||
if err != nil { |
|||
return nil, err |
|||
} |
|||
log.Printf("\n%s\n", string(dump)) |
|||
} |
|||
|
|||
resp, err := c.cfg.HTTPClient.Do(request) |
|||
if err != nil { |
|||
return resp, err |
|||
} |
|||
|
|||
if c.cfg.Debug { |
|||
dump, err := httputil.DumpResponse(resp, true) |
|||
if err != nil { |
|||
return resp, err |
|||
} |
|||
log.Printf("\n%s\n", string(dump)) |
|||
} |
|||
return resp, err |
|||
} |
|||
|
|||
// Allow modification of underlying config for alternate implementations and testing
|
|||
// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior
|
|||
func (c *APIClient) GetConfig() *Configuration { |
|||
return c.cfg |
|||
} |
|||
|
|||
type formFile struct { |
|||
fileBytes []byte |
|||
fileName string |
|||
formFileName string |
|||
} |
|||
|
|||
// prepareRequest build the request
|
|||
func (c *APIClient) prepareRequest( |
|||
ctx context.Context, |
|||
path string, method string, |
|||
postBody interface{}, |
|||
headerParams map[string]string, |
|||
queryParams url.Values, |
|||
formParams url.Values, |
|||
formFiles []formFile) (localVarRequest *http.Request, err error) { |
|||
|
|||
var body *bytes.Buffer |
|||
|
|||
// Detect postBody type and post.
|
|||
if postBody != nil { |
|||
contentType := headerParams["Content-Type"] |
|||
if contentType == "" { |
|||
contentType = detectContentType(postBody) |
|||
headerParams["Content-Type"] = contentType |
|||
} |
|||
|
|||
body, err = setBody(postBody, contentType) |
|||
if err != nil { |
|||
return nil, err |
|||
} |
|||
} |
|||
|
|||
// add form parameters and file if available.
|
|||
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { |
|||
if body != nil { |
|||
return nil, errors.New("Cannot specify postBody and multipart form at the same time.") |
|||
} |
|||
body = &bytes.Buffer{} |
|||
w := multipart.NewWriter(body) |
|||
|
|||
for k, v := range formParams { |
|||
for _, iv := range v { |
|||
if strings.HasPrefix(k, "@") { // file
|
|||
err = addFile(w, k[1:], iv) |
|||
if err != nil { |
|||
return nil, err |
|||
} |
|||
} else { // form value
|
|||
w.WriteField(k, iv) |
|||
} |
|||
} |
|||
} |
|||
for _, formFile := range formFiles { |
|||
if len(formFile.fileBytes) > 0 && formFile.fileName != "" { |
|||
w.Boundary() |
|||
part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) |
|||
if err != nil { |
|||
return nil, err |
|||
} |
|||
_, err = part.Write(formFile.fileBytes) |
|||
if err != nil { |
|||
return nil, err |
|||
} |
|||
} |
|||
} |
|||
|
|||
// Set the Boundary in the Content-Type
|
|||
headerParams["Content-Type"] = w.FormDataContentType() |
|||
|
|||
// Set Content-Length
|
|||
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) |
|||
w.Close() |
|||
} |
|||
|
|||
if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { |
|||
if body != nil { |
|||
return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") |
|||
} |
|||
body = &bytes.Buffer{} |
|||
body.WriteString(formParams.Encode()) |
|||
// Set Content-Length
|
|||
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) |
|||
} |
|||
|
|||
// Setup path and query parameters
|
|||
url, err := url.Parse(path) |
|||
if err != nil { |
|||
return nil, err |
|||
} |
|||
|
|||
// Override request host, if applicable
|
|||
if c.cfg.Host != "" { |
|||
url.Host = c.cfg.Host |
|||
} |
|||
|
|||
// Override request scheme, if applicable
|
|||
if c.cfg.Scheme != "" { |
|||
url.Scheme = c.cfg.Scheme |
|||
} |
|||
|
|||
// Adding Query Param
|
|||
query := url.Query() |
|||
for k, v := range queryParams { |
|||
for _, iv := range v { |
|||
query.Add(k, iv) |
|||
} |
|||
} |
|||
|
|||
// Encode the parameters.
|
|||
url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { |
|||
pieces := strings.Split(s, "=") |
|||
pieces[0] = queryDescape.Replace(pieces[0]) |
|||
return strings.Join(pieces, "=") |
|||
}) |
|||
|
|||
// Generate a new request
|
|||
if body != nil { |
|||
localVarRequest, err = http.NewRequest(method, url.String(), body) |
|||
} else { |
|||
localVarRequest, err = http.NewRequest(method, url.String(), nil) |
|||
} |
|||
if err != nil { |
|||
return nil, err |
|||
} |
|||
|
|||
// add header parameters, if any
|
|||
if len(headerParams) > 0 { |
|||
headers := http.Header{} |
|||
for h, v := range headerParams { |
|||
headers[h] = []string{v} |
|||
} |
|||
localVarRequest.Header = headers |
|||
} |
|||
|
|||
// Add the user agent to the request.
|
|||
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) |
|||
|
|||
if ctx != nil { |
|||
// add context to the request
|
|||
localVarRequest = localVarRequest.WithContext(ctx) |
|||
|
|||
// Walk through any authentication.
|
|||
|
|||
} |
|||
|
|||
for header, value := range c.cfg.DefaultHeader { |
|||
localVarRequest.Header.Add(header, value) |
|||
} |
|||
return localVarRequest, nil |
|||
} |
|||
|
|||
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { |
|||
if len(b) == 0 { |
|||
return nil |
|||
} |
|||
if s, ok := v.(*string); ok { |
|||
*s = string(b) |
|||
return nil |
|||
} |
|||
if f, ok := v.(*os.File); ok { |
|||
f, err = os.CreateTemp("", "HttpClientFile") |
|||
if err != nil { |
|||
return |
|||
} |
|||
_, err = f.Write(b) |
|||
if err != nil { |
|||
return |
|||
} |
|||
_, err = f.Seek(0, io.SeekStart) |
|||
return |
|||
} |
|||
if f, ok := v.(**os.File); ok { |
|||
*f, err = os.CreateTemp("", "HttpClientFile") |
|||
if err != nil { |
|||
return |
|||
} |
|||
_, err = (*f).Write(b) |
|||
if err != nil { |
|||
return |
|||
} |
|||
_, err = (*f).Seek(0, io.SeekStart) |
|||
return |
|||
} |
|||
if xmlCheck.MatchString(contentType) { |
|||
if err = xml.Unmarshal(b, v); err != nil { |
|||
return err |
|||
} |
|||
return nil |
|||
} |
|||
if jsonCheck.MatchString(contentType) { |
|||
if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas
|
|||
if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined
|
|||
if err = unmarshalObj.UnmarshalJSON(b); err != nil { |
|||
return err |
|||
} |
|||
} else { |
|||
return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") |
|||
} |
|||
} else if err = json.Unmarshal(b, v); err != nil { // simple model
|
|||
return err |
|||
} |
|||
return nil |
|||
} |
|||
return errors.New("undefined response type") |
|||
} |
|||
|
|||
// Add a file to the multipart request
|
|||
func addFile(w *multipart.Writer, fieldName, path string) error { |
|||
file, err := os.Open(filepath.Clean(path)) |
|||
if err != nil { |
|||
return err |
|||
} |
|||
err = file.Close() |
|||
if err != nil { |
|||
return err |
|||
} |
|||
|
|||
part, err := w.CreateFormFile(fieldName, filepath.Base(path)) |
|||
if err != nil { |
|||
return err |
|||
} |
|||
_, err = io.Copy(part, file) |
|||
|
|||
return err |
|||
} |
|||
|
|||
// Prevent trying to import "fmt"
|
|||
func reportError(format string, a ...interface{}) error { |
|||
return fmt.Errorf(format, a...) |
|||
} |
|||
|
|||
// A wrapper for strict JSON decoding
|
|||
func newStrictDecoder(data []byte) *json.Decoder { |
|||
dec := json.NewDecoder(bytes.NewBuffer(data)) |
|||
dec.DisallowUnknownFields() |
|||
return dec |
|||
} |
|||
|
|||
// Set request body from an interface{}
|
|||
func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { |
|||
if bodyBuf == nil { |
|||
bodyBuf = &bytes.Buffer{} |
|||
} |
|||
|
|||
if reader, ok := body.(io.Reader); ok { |
|||
_, err = bodyBuf.ReadFrom(reader) |
|||
} else if fp, ok := body.(*os.File); ok { |
|||
_, err = bodyBuf.ReadFrom(fp) |
|||
} else if b, ok := body.([]byte); ok { |
|||
_, err = bodyBuf.Write(b) |
|||
} else if s, ok := body.(string); ok { |
|||
_, err = bodyBuf.WriteString(s) |
|||
} else if s, ok := body.(*string); ok { |
|||
_, err = bodyBuf.WriteString(*s) |
|||
} else if jsonCheck.MatchString(contentType) { |
|||
err = json.NewEncoder(bodyBuf).Encode(body) |
|||
} else if xmlCheck.MatchString(contentType) { |
|||
err = xml.NewEncoder(bodyBuf).Encode(body) |
|||
} |
|||
|
|||
if err != nil { |
|||
return nil, err |
|||
} |
|||
|
|||
if bodyBuf.Len() == 0 { |
|||
err = fmt.Errorf("invalid body type %s\n", contentType) |
|||
return nil, err |
|||
} |
|||
return bodyBuf, nil |
|||
} |
|||
|
|||
// detectContentType method is used to figure out `Request.Body` content type for request header
|
|||
func detectContentType(body interface{}) string { |
|||
contentType := "text/plain; charset=utf-8" |
|||
kind := reflect.TypeOf(body).Kind() |
|||
|
|||
switch kind { |
|||
case reflect.Struct, reflect.Map, reflect.Ptr: |
|||
contentType = "application/json; charset=utf-8" |
|||
case reflect.String: |
|||
contentType = "text/plain; charset=utf-8" |
|||
default: |
|||
if b, ok := body.([]byte); ok { |
|||
contentType = http.DetectContentType(b) |
|||
} else if kind == reflect.Slice { |
|||
contentType = "application/json; charset=utf-8" |
|||
} |
|||
} |
|||
|
|||
return contentType |
|||
} |
|||
|
|||
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
|
|||
type cacheControl map[string]string |
|||
|
|||
func parseCacheControl(headers http.Header) cacheControl { |
|||
cc := cacheControl{} |
|||
ccHeader := headers.Get("Cache-Control") |
|||
for _, part := range strings.Split(ccHeader, ",") { |
|||
part = strings.Trim(part, " ") |
|||
if part == "" { |
|||
continue |
|||
} |
|||
if strings.ContainsRune(part, '=') { |
|||
keyval := strings.Split(part, "=") |
|||
cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") |
|||
} else { |
|||
cc[part] = "" |
|||
} |
|||
} |
|||
return cc |
|||
} |
|||
|
|||
// CacheExpires helper function to determine remaining time before repeating a request.
|
|||
func CacheExpires(r *http.Response) time.Time { |
|||
// Figure out when the cache expires.
|
|||
var expires time.Time |
|||
now, err := time.Parse(time.RFC1123, r.Header.Get("date")) |
|||
if err != nil { |
|||
return time.Now() |
|||
} |
|||
respCacheControl := parseCacheControl(r.Header) |
|||
|
|||
if maxAge, ok := respCacheControl["max-age"]; ok { |
|||
lifetime, err := time.ParseDuration(maxAge + "s") |
|||
if err != nil { |
|||
expires = now |
|||
} else { |
|||
expires = now.Add(lifetime) |
|||
} |
|||
} else { |
|||
expiresHeader := r.Header.Get("Expires") |
|||
if expiresHeader != "" { |
|||
expires, err = time.Parse(time.RFC1123, expiresHeader) |
|||
if err != nil { |
|||
expires = now |
|||
} |
|||
} |
|||
} |
|||
return expires |
|||
} |
|||
|
|||
func strlen(s string) int { |
|||
return utf8.RuneCountInString(s) |
|||
} |
|||
|
|||
// GenericOpenAPIError Provides access to the body, error and model on returned errors.
|
|||
type GenericOpenAPIError struct { |
|||
body []byte |
|||
error string |
|||
model interface{} |
|||
} |
|||
|
|||
// Error returns non-empty string if there was an error.
|
|||
func (e GenericOpenAPIError) Error() string { |
|||
return e.error |
|||
} |
|||
|
|||
// Body returns the raw bytes of the response
|
|||
func (e GenericOpenAPIError) Body() []byte { |
|||
return e.body |
|||
} |
|||
|
|||
// Model returns the unpacked model of the error
|
|||
func (e GenericOpenAPIError) Model() interface{} { |
|||
return e.model |
|||
} |
|||
|
|||
// format error message using title and detail when model implements rfc7807
|
|||
func formatErrorMessage(status string, v interface{}) string { |
|||
str := "" |
|||
metaValue := reflect.ValueOf(v).Elem() |
|||
|
|||
field := metaValue.FieldByName("Title") |
|||
if field != (reflect.Value{}) { |
|||
str = fmt.Sprintf("%s", field.Interface()) |
|||
} |
|||
|
|||
field = metaValue.FieldByName("Detail") |
|||
if field != (reflect.Value{}) { |
|||
str = fmt.Sprintf("%s (%s)", str, field.Interface()) |
|||
} |
|||
|
|||
// status title (detail)
|
|||
return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) |
|||
} |
@ -0,0 +1,214 @@ |
|||
/* |
|||
Seaweedfs Master Server API |
|||
|
|||
The Seaweedfs Master Server API allows you to store blobs |
|||
|
|||
API version: 3.43.0 |
|||
*/ |
|||
|
|||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|||
|
|||
package openapi |
|||
|
|||
import ( |
|||
"context" |
|||
"fmt" |
|||
"net/http" |
|||
"strings" |
|||
) |
|||
|
|||
// contextKeys are used to identify the type of value in the context.
|
|||
// Since these are string, it is possible to get a short description of the
|
|||
// context key for logging and debugging using key.String().
|
|||
|
|||
type contextKey string |
|||
|
|||
func (c contextKey) String() string { |
|||
return "auth " + string(c) |
|||
} |
|||
|
|||
var ( |
|||
// ContextServerIndex uses a server configuration from the index.
|
|||
ContextServerIndex = contextKey("serverIndex") |
|||
|
|||
// ContextOperationServerIndices uses a server configuration from the index mapping.
|
|||
ContextOperationServerIndices = contextKey("serverOperationIndices") |
|||
|
|||
// ContextServerVariables overrides a server configuration variables.
|
|||
ContextServerVariables = contextKey("serverVariables") |
|||
|
|||
// ContextOperationServerVariables overrides a server configuration variables using operation specific values.
|
|||
ContextOperationServerVariables = contextKey("serverOperationVariables") |
|||
) |
|||
|
|||
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
|
|||
type BasicAuth struct { |
|||
UserName string `json:"userName,omitempty"` |
|||
Password string `json:"password,omitempty"` |
|||
} |
|||
|
|||
// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
|
|||
type APIKey struct { |
|||
Key string |
|||
Prefix string |
|||
} |
|||
|
|||
// ServerVariable stores the information about a server variable
|
|||
type ServerVariable struct { |
|||
Description string |
|||
DefaultValue string |
|||
EnumValues []string |
|||
} |
|||
|
|||
// ServerConfiguration stores the information about a server
|
|||
type ServerConfiguration struct { |
|||
URL string |
|||
Description string |
|||
Variables map[string]ServerVariable |
|||
} |
|||
|
|||
// ServerConfigurations stores multiple ServerConfiguration items
|
|||
type ServerConfigurations []ServerConfiguration |
|||
|
|||
// Configuration stores the configuration of the API client
|
|||
type Configuration struct { |
|||
Host string `json:"host,omitempty"` |
|||
Scheme string `json:"scheme,omitempty"` |
|||
DefaultHeader map[string]string `json:"defaultHeader,omitempty"` |
|||
UserAgent string `json:"userAgent,omitempty"` |
|||
Debug bool `json:"debug,omitempty"` |
|||
Servers ServerConfigurations |
|||
OperationServers map[string]ServerConfigurations |
|||
HTTPClient *http.Client |
|||
} |
|||
|
|||
// NewConfiguration returns a new Configuration object
|
|||
func NewConfiguration() *Configuration { |
|||
cfg := &Configuration{ |
|||
DefaultHeader: make(map[string]string), |
|||
UserAgent: "OpenAPI-Generator/1.0.0/go", |
|||
Debug: false, |
|||
Servers: ServerConfigurations{ |
|||
{ |
|||
URL: "https://127.0.0.1:9333", |
|||
Description: "No description provided", |
|||
}, |
|||
}, |
|||
OperationServers: map[string]ServerConfigurations{}, |
|||
} |
|||
return cfg |
|||
} |
|||
|
|||
// AddDefaultHeader adds a new HTTP header to the default header in the request
|
|||
func (c *Configuration) AddDefaultHeader(key string, value string) { |
|||
c.DefaultHeader[key] = value |
|||
} |
|||
|
|||
// URL formats template on a index using given variables
|
|||
func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { |
|||
if index < 0 || len(sc) <= index { |
|||
return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) |
|||
} |
|||
server := sc[index] |
|||
url := server.URL |
|||
|
|||
// go through variables and replace placeholders
|
|||
for name, variable := range server.Variables { |
|||
if value, ok := variables[name]; ok { |
|||
found := bool(len(variable.EnumValues) == 0) |
|||
for _, enumValue := range variable.EnumValues { |
|||
if value == enumValue { |
|||
found = true |
|||
} |
|||
} |
|||
if !found { |
|||
return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) |
|||
} |
|||
url = strings.Replace(url, "{"+name+"}", value, -1) |
|||
} else { |
|||
url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) |
|||
} |
|||
} |
|||
return url, nil |
|||
} |
|||
|
|||
// ServerURL returns URL based on server settings
|
|||
func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { |
|||
return c.Servers.URL(index, variables) |
|||
} |
|||
|
|||
func getServerIndex(ctx context.Context) (int, error) { |
|||
si := ctx.Value(ContextServerIndex) |
|||
if si != nil { |
|||
if index, ok := si.(int); ok { |
|||
return index, nil |
|||
} |
|||
return 0, reportError("Invalid type %T should be int", si) |
|||
} |
|||
return 0, nil |
|||
} |
|||
|
|||
func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { |
|||
osi := ctx.Value(ContextOperationServerIndices) |
|||
if osi != nil { |
|||
if operationIndices, ok := osi.(map[string]int); !ok { |
|||
return 0, reportError("Invalid type %T should be map[string]int", osi) |
|||
} else { |
|||
index, ok := operationIndices[endpoint] |
|||
if ok { |
|||
return index, nil |
|||
} |
|||
} |
|||
} |
|||
return getServerIndex(ctx) |
|||
} |
|||
|
|||
func getServerVariables(ctx context.Context) (map[string]string, error) { |
|||
sv := ctx.Value(ContextServerVariables) |
|||
if sv != nil { |
|||
if variables, ok := sv.(map[string]string); ok { |
|||
return variables, nil |
|||
} |
|||
return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) |
|||
} |
|||
return nil, nil |
|||
} |
|||
|
|||
func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { |
|||
osv := ctx.Value(ContextOperationServerVariables) |
|||
if osv != nil { |
|||
if operationVariables, ok := osv.(map[string]map[string]string); !ok { |
|||
return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) |
|||
} else { |
|||
variables, ok := operationVariables[endpoint] |
|||
if ok { |
|||
return variables, nil |
|||
} |
|||
} |
|||
} |
|||
return getServerVariables(ctx) |
|||
} |
|||
|
|||
// ServerURLWithContext returns a new server URL given an endpoint
|
|||
func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { |
|||
sc, ok := c.OperationServers[endpoint] |
|||
if !ok { |
|||
sc = c.Servers |
|||
} |
|||
|
|||
if ctx == nil { |
|||
return sc.URL(0, nil) |
|||
} |
|||
|
|||
index, err := getServerOperationIndex(ctx, endpoint) |
|||
if err != nil { |
|||
return "", err |
|||
} |
|||
|
|||
variables, err := getServerOperationVariables(ctx, endpoint) |
|||
if err != nil { |
|||
return "", err |
|||
} |
|||
|
|||
return sc.URL(index, variables) |
|||
} |
@ -0,0 +1,168 @@ |
|||
# \DefaultApi |
|||
|
|||
All URIs are relative to *https://127.0.0.1:9333* |
|||
|
|||
Method | HTTP request | Description |
|||
------------- | ------------- | ------------- |
|||
[**DirAssign**](DefaultApi.md#DirAssign) | **Get** /dir/assign | Assign a file key |
|||
[**DirLookup**](DefaultApi.md#DirLookup) | **Get** /dir/lookup | Lookup volume |
|||
|
|||
|
|||
|
|||
## DirAssign |
|||
|
|||
> FileKey DirAssign(ctx).Count(count).Collection(collection).DataCenter(dataCenter).Rack(rack).DataNode(dataNode).Disk(disk).Replication(replication).Ttl(ttl).Preallocate(preallocate).MemoryMapMaxSizeMb(memoryMapMaxSizeMb).WritableVolumeCount(writableVolumeCount).Execute() |
|||
|
|||
Assign a file key |
|||
|
|||
|
|||
|
|||
### Example |
|||
|
|||
```go |
|||
package main |
|||
|
|||
import ( |
|||
"context" |
|||
"fmt" |
|||
"os" |
|||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" |
|||
) |
|||
|
|||
func main() { |
|||
count := TODO // interface{} | how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 (optional) |
|||
collection := TODO // interface{} | required collection name (optional) |
|||
dataCenter := TODO // interface{} | preferred data center (optional) |
|||
rack := TODO // interface{} | preferred rack (optional) |
|||
dataNode := TODO // interface{} | preferred volume server, e.g. 127.0.0.1:8080 (optional) |
|||
disk := TODO // interface{} | If you have disks labelled, this must be supplied to specify the disk type to allocate on. (optional) |
|||
replication := TODO // interface{} | replica placement strategy (optional) |
|||
ttl := TODO // interface{} | file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year (optional) |
|||
preallocate := TODO // interface{} | If no matching volumes, pre-allocate this number of bytes on disk for new volumes. (optional) |
|||
memoryMapMaxSizeMb := TODO // interface{} | Only implemented for windows. Use memory mapped files with specified size for new volumes. (optional) |
|||
writableVolumeCount := TODO // interface{} | If no matching volumes, create specified number of new volumes. (optional) |
|||
|
|||
configuration := openapiclient.NewConfiguration() |
|||
apiClient := openapiclient.NewAPIClient(configuration) |
|||
resp, r, err := apiClient.DefaultApi.DirAssign(context.Background()).Count(count).Collection(collection).DataCenter(dataCenter).Rack(rack).DataNode(dataNode).Disk(disk).Replication(replication).Ttl(ttl).Preallocate(preallocate).MemoryMapMaxSizeMb(memoryMapMaxSizeMb).WritableVolumeCount(writableVolumeCount).Execute() |
|||
if err != nil { |
|||
fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.DirAssign``: %v\n", err) |
|||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) |
|||
} |
|||
// response from `DirAssign`: FileKey |
|||
fmt.Fprintf(os.Stdout, "Response from `DefaultApi.DirAssign`: %v\n", resp) |
|||
} |
|||
``` |
|||
|
|||
### Path Parameters |
|||
|
|||
|
|||
|
|||
### Other Parameters |
|||
|
|||
Other parameters are passed through a pointer to a apiDirAssignRequest struct via the builder pattern |
|||
|
|||
|
|||
Name | Type | Description | Notes |
|||
------------- | ------------- | ------------- | ------------- |
|||
**count** | [**interface{}**](interface{}.md) | how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 | |
|||
**collection** | [**interface{}**](interface{}.md) | required collection name | |
|||
**dataCenter** | [**interface{}**](interface{}.md) | preferred data center | |
|||
**rack** | [**interface{}**](interface{}.md) | preferred rack | |
|||
**dataNode** | [**interface{}**](interface{}.md) | preferred volume server, e.g. 127.0.0.1:8080 | |
|||
**disk** | [**interface{}**](interface{}.md) | If you have disks labelled, this must be supplied to specify the disk type to allocate on. | |
|||
**replication** | [**interface{}**](interface{}.md) | replica placement strategy | |
|||
**ttl** | [**interface{}**](interface{}.md) | file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year | |
|||
**preallocate** | [**interface{}**](interface{}.md) | If no matching volumes, pre-allocate this number of bytes on disk for new volumes. | |
|||
**memoryMapMaxSizeMb** | [**interface{}**](interface{}.md) | Only implemented for windows. Use memory mapped files with specified size for new volumes. | |
|||
**writableVolumeCount** | [**interface{}**](interface{}.md) | If no matching volumes, create specified number of new volumes. | |
|||
|
|||
### Return type |
|||
|
|||
[**FileKey**](FileKey.md) |
|||
|
|||
### Authorization |
|||
|
|||
No authorization required |
|||
|
|||
### HTTP request headers |
|||
|
|||
- **Content-Type**: Not defined |
|||
- **Accept**: application/json |
|||
|
|||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) |
|||
[[Back to Model list]](../README.md#documentation-for-models) |
|||
[[Back to README]](../README.md) |
|||
|
|||
|
|||
## DirLookup |
|||
|
|||
> interface{} DirLookup(ctx).VolumeId(volumeId).Collection(collection).FileId(fileId).Read(read).Execute() |
|||
|
|||
Lookup volume |
|||
|
|||
|
|||
|
|||
### Example |
|||
|
|||
```go |
|||
package main |
|||
|
|||
import ( |
|||
"context" |
|||
"fmt" |
|||
"os" |
|||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" |
|||
) |
|||
|
|||
func main() { |
|||
volumeId := TODO // interface{} | volume id (optional) |
|||
collection := TODO // interface{} | optionally to speed up the lookup (optional) |
|||
fileId := TODO // interface{} | If provided, this returns the fileId location and a JWT to update or delete the file. (optional) |
|||
read := TODO // interface{} | works together with \"fileId\", if read=yes, JWT is generated for reads. (optional) |
|||
|
|||
configuration := openapiclient.NewConfiguration() |
|||
apiClient := openapiclient.NewAPIClient(configuration) |
|||
resp, r, err := apiClient.DefaultApi.DirLookup(context.Background()).VolumeId(volumeId).Collection(collection).FileId(fileId).Read(read).Execute() |
|||
if err != nil { |
|||
fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.DirLookup``: %v\n", err) |
|||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) |
|||
} |
|||
// response from `DirLookup`: interface{} |
|||
fmt.Fprintf(os.Stdout, "Response from `DefaultApi.DirLookup`: %v\n", resp) |
|||
} |
|||
``` |
|||
|
|||
### Path Parameters |
|||
|
|||
|
|||
|
|||
### Other Parameters |
|||
|
|||
Other parameters are passed through a pointer to a apiDirLookupRequest struct via the builder pattern |
|||
|
|||
|
|||
Name | Type | Description | Notes |
|||
------------- | ------------- | ------------- | ------------- |
|||
**volumeId** | [**interface{}**](interface{}.md) | volume id | |
|||
**collection** | [**interface{}**](interface{}.md) | optionally to speed up the lookup | |
|||
**fileId** | [**interface{}**](interface{}.md) | If provided, this returns the fileId location and a JWT to update or delete the file. | |
|||
**read** | [**interface{}**](interface{}.md) | works together with \"fileId\", if read=yes, JWT is generated for reads. | |
|||
|
|||
### Return type |
|||
|
|||
**interface{}** |
|||
|
|||
### Authorization |
|||
|
|||
No authorization required |
|||
|
|||
### HTTP request headers |
|||
|
|||
- **Content-Type**: Not defined |
|||
- **Accept**: application/json |
|||
|
|||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) |
|||
[[Back to Model list]](../README.md#documentation-for-models) |
|||
[[Back to README]](../README.md) |
|||
|
@ -0,0 +1,138 @@ |
|||
# FileKey |
|||
|
|||
## Properties |
|||
|
|||
Name | Type | Description | Notes |
|||
------------ | ------------- | ------------- | ------------- |
|||
**Count** | Pointer to **interface{}** | | [optional] |
|||
**Fid** | Pointer to **interface{}** | | [optional] |
|||
**Url** | Pointer to **interface{}** | | [optional] |
|||
|
|||
## Methods |
|||
|
|||
### NewFileKey |
|||
|
|||
`func NewFileKey() *FileKey` |
|||
|
|||
NewFileKey instantiates a new FileKey object |
|||
This constructor will assign default values to properties that have it defined, |
|||
and makes sure properties required by API are set, but the set of arguments |
|||
will change when the set of required properties is changed |
|||
|
|||
### NewFileKeyWithDefaults |
|||
|
|||
`func NewFileKeyWithDefaults() *FileKey` |
|||
|
|||
NewFileKeyWithDefaults instantiates a new FileKey object |
|||
This constructor will only assign default values to properties that have it defined, |
|||
but it doesn't guarantee that properties required by API are set |
|||
|
|||
### GetCount |
|||
|
|||
`func (o *FileKey) GetCount() interface{}` |
|||
|
|||
GetCount returns the Count field if non-nil, zero value otherwise. |
|||
|
|||
### GetCountOk |
|||
|
|||
`func (o *FileKey) GetCountOk() (*interface{}, bool)` |
|||
|
|||
GetCountOk returns a tuple with the Count field if it's non-nil, zero value otherwise |
|||
and a boolean to check if the value has been set. |
|||
|
|||
### SetCount |
|||
|
|||
`func (o *FileKey) SetCount(v interface{})` |
|||
|
|||
SetCount sets Count field to given value. |
|||
|
|||
### HasCount |
|||
|
|||
`func (o *FileKey) HasCount() bool` |
|||
|
|||
HasCount returns a boolean if a field has been set. |
|||
|
|||
### SetCountNil |
|||
|
|||
`func (o *FileKey) SetCountNil(b bool)` |
|||
|
|||
SetCountNil sets the value for Count to be an explicit nil |
|||
|
|||
### UnsetCount |
|||
`func (o *FileKey) UnsetCount()` |
|||
|
|||
UnsetCount ensures that no value is present for Count, not even an explicit nil |
|||
### GetFid |
|||
|
|||
`func (o *FileKey) GetFid() interface{}` |
|||
|
|||
GetFid returns the Fid field if non-nil, zero value otherwise. |
|||
|
|||
### GetFidOk |
|||
|
|||
`func (o *FileKey) GetFidOk() (*interface{}, bool)` |
|||
|
|||
GetFidOk returns a tuple with the Fid field if it's non-nil, zero value otherwise |
|||
and a boolean to check if the value has been set. |
|||
|
|||
### SetFid |
|||
|
|||
`func (o *FileKey) SetFid(v interface{})` |
|||
|
|||
SetFid sets Fid field to given value. |
|||
|
|||
### HasFid |
|||
|
|||
`func (o *FileKey) HasFid() bool` |
|||
|
|||
HasFid returns a boolean if a field has been set. |
|||
|
|||
### SetFidNil |
|||
|
|||
`func (o *FileKey) SetFidNil(b bool)` |
|||
|
|||
SetFidNil sets the value for Fid to be an explicit nil |
|||
|
|||
### UnsetFid |
|||
`func (o *FileKey) UnsetFid()` |
|||
|
|||
UnsetFid ensures that no value is present for Fid, not even an explicit nil |
|||
### GetUrl |
|||
|
|||
`func (o *FileKey) GetUrl() interface{}` |
|||
|
|||
GetUrl returns the Url field if non-nil, zero value otherwise. |
|||
|
|||
### GetUrlOk |
|||
|
|||
`func (o *FileKey) GetUrlOk() (*interface{}, bool)` |
|||
|
|||
GetUrlOk returns a tuple with the Url field if it's non-nil, zero value otherwise |
|||
and a boolean to check if the value has been set. |
|||
|
|||
### SetUrl |
|||
|
|||
`func (o *FileKey) SetUrl(v interface{})` |
|||
|
|||
SetUrl sets Url field to given value. |
|||
|
|||
### HasUrl |
|||
|
|||
`func (o *FileKey) HasUrl() bool` |
|||
|
|||
HasUrl returns a boolean if a field has been set. |
|||
|
|||
### SetUrlNil |
|||
|
|||
`func (o *FileKey) SetUrlNil(b bool)` |
|||
|
|||
SetUrlNil sets the value for Url to be an explicit nil |
|||
|
|||
### UnsetUrl |
|||
`func (o *FileKey) UnsetUrl()` |
|||
|
|||
UnsetUrl ensures that no value is present for Url, not even an explicit nil |
|||
|
|||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) |
|||
|
|||
|
@ -0,0 +1,102 @@ |
|||
# Location |
|||
|
|||
## Properties |
|||
|
|||
Name | Type | Description | Notes |
|||
------------ | ------------- | ------------- | ------------- |
|||
**PublicUrl** | Pointer to **interface{}** | | [optional] |
|||
**Url** | Pointer to **interface{}** | | [optional] |
|||
|
|||
## Methods |
|||
|
|||
### NewLocation |
|||
|
|||
`func NewLocation() *Location` |
|||
|
|||
NewLocation instantiates a new Location object |
|||
This constructor will assign default values to properties that have it defined, |
|||
and makes sure properties required by API are set, but the set of arguments |
|||
will change when the set of required properties is changed |
|||
|
|||
### NewLocationWithDefaults |
|||
|
|||
`func NewLocationWithDefaults() *Location` |
|||
|
|||
NewLocationWithDefaults instantiates a new Location object |
|||
This constructor will only assign default values to properties that have it defined, |
|||
but it doesn't guarantee that properties required by API are set |
|||
|
|||
### GetPublicUrl |
|||
|
|||
`func (o *Location) GetPublicUrl() interface{}` |
|||
|
|||
GetPublicUrl returns the PublicUrl field if non-nil, zero value otherwise. |
|||
|
|||
### GetPublicUrlOk |
|||
|
|||
`func (o *Location) GetPublicUrlOk() (*interface{}, bool)` |
|||
|
|||
GetPublicUrlOk returns a tuple with the PublicUrl field if it's non-nil, zero value otherwise |
|||
and a boolean to check if the value has been set. |
|||
|
|||
### SetPublicUrl |
|||
|
|||
`func (o *Location) SetPublicUrl(v interface{})` |
|||
|
|||
SetPublicUrl sets PublicUrl field to given value. |
|||
|
|||
### HasPublicUrl |
|||
|
|||
`func (o *Location) HasPublicUrl() bool` |
|||
|
|||
HasPublicUrl returns a boolean if a field has been set. |
|||
|
|||
### SetPublicUrlNil |
|||
|
|||
`func (o *Location) SetPublicUrlNil(b bool)` |
|||
|
|||
SetPublicUrlNil sets the value for PublicUrl to be an explicit nil |
|||
|
|||
### UnsetPublicUrl |
|||
`func (o *Location) UnsetPublicUrl()` |
|||
|
|||
UnsetPublicUrl ensures that no value is present for PublicUrl, not even an explicit nil |
|||
### GetUrl |
|||
|
|||
`func (o *Location) GetUrl() interface{}` |
|||
|
|||
GetUrl returns the Url field if non-nil, zero value otherwise. |
|||
|
|||
### GetUrlOk |
|||
|
|||
`func (o *Location) GetUrlOk() (*interface{}, bool)` |
|||
|
|||
GetUrlOk returns a tuple with the Url field if it's non-nil, zero value otherwise |
|||
and a boolean to check if the value has been set. |
|||
|
|||
### SetUrl |
|||
|
|||
`func (o *Location) SetUrl(v interface{})` |
|||
|
|||
SetUrl sets Url field to given value. |
|||
|
|||
### HasUrl |
|||
|
|||
`func (o *Location) HasUrl() bool` |
|||
|
|||
HasUrl returns a boolean if a field has been set. |
|||
|
|||
### SetUrlNil |
|||
|
|||
`func (o *Location) SetUrlNil(b bool)` |
|||
|
|||
SetUrlNil sets the value for Url to be an explicit nil |
|||
|
|||
### UnsetUrl |
|||
`func (o *Location) UnsetUrl()` |
|||
|
|||
UnsetUrl ensures that no value is present for Url, not even an explicit nil |
|||
|
|||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) |
|||
|
|||
|
@ -0,0 +1,57 @@ |
|||
#!/bin/sh |
|||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ |
|||
# |
|||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" |
|||
|
|||
git_user_id=$1 |
|||
git_repo_id=$2 |
|||
release_note=$3 |
|||
git_host=$4 |
|||
|
|||
if [ "$git_host" = "" ]; then |
|||
git_host="github.com" |
|||
echo "[INFO] No command line input provided. Set \$git_host to $git_host" |
|||
fi |
|||
|
|||
if [ "$git_user_id" = "" ]; then |
|||
git_user_id="GIT_USER_ID" |
|||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" |
|||
fi |
|||
|
|||
if [ "$git_repo_id" = "" ]; then |
|||
git_repo_id="GIT_REPO_ID" |
|||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" |
|||
fi |
|||
|
|||
if [ "$release_note" = "" ]; then |
|||
release_note="Minor update" |
|||
echo "[INFO] No command line input provided. Set \$release_note to $release_note" |
|||
fi |
|||
|
|||
# Initialize the local directory as a Git repository |
|||
git init |
|||
|
|||
# Adds the files in the local repository and stages them for commit. |
|||
git add . |
|||
|
|||
# Commits the tracked changes and prepares them to be pushed to a remote repository. |
|||
git commit -m "$release_note" |
|||
|
|||
# Sets the new remote |
|||
git_remote=$(git remote) |
|||
if [ "$git_remote" = "" ]; then # git remote not defined |
|||
|
|||
if [ "$GIT_TOKEN" = "" ]; then |
|||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." |
|||
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git |
|||
else |
|||
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git |
|||
fi |
|||
|
|||
fi |
|||
|
|||
git pull origin master |
|||
|
|||
# Pushes (Forces) the changes in the local repository up to the remote repository |
|||
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" |
|||
git push origin master 2>&1 | grep -v 'To https' |
@ -0,0 +1,6 @@ |
|||
module github.com/GIT_USER_ID/GIT_REPO_ID |
|||
|
|||
go 1.18 |
|||
|
|||
require ( |
|||
) |
@ -0,0 +1,11 @@ |
|||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= |
|||
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= |
|||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= |
|||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= |
|||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= |
|||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= |
|||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= |
|||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= |
|||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= |
|||
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= |
|||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= |
@ -0,0 +1,199 @@ |
|||
/* |
|||
Seaweedfs Master Server API |
|||
|
|||
The Seaweedfs Master Server API allows you to store blobs |
|||
|
|||
API version: 3.43.0 |
|||
*/ |
|||
|
|||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|||
|
|||
package openapi |
|||
|
|||
import ( |
|||
"encoding/json" |
|||
) |
|||
|
|||
// checks if the FileKey type satisfies the MappedNullable interface at compile time
|
|||
var _ MappedNullable = &FileKey{} |
|||
|
|||
// FileKey struct for FileKey
|
|||
type FileKey struct { |
|||
Count interface{} `json:"count,omitempty"` |
|||
Fid interface{} `json:"fid,omitempty"` |
|||
Url interface{} `json:"url,omitempty"` |
|||
} |
|||
|
|||
// NewFileKey instantiates a new FileKey object
|
|||
// This constructor will assign default values to properties that have it defined,
|
|||
// and makes sure properties required by API are set, but the set of arguments
|
|||
// will change when the set of required properties is changed
|
|||
func NewFileKey() *FileKey { |
|||
this := FileKey{} |
|||
return &this |
|||
} |
|||
|
|||
// NewFileKeyWithDefaults instantiates a new FileKey object
|
|||
// This constructor will only assign default values to properties that have it defined,
|
|||
// but it doesn't guarantee that properties required by API are set
|
|||
func NewFileKeyWithDefaults() *FileKey { |
|||
this := FileKey{} |
|||
return &this |
|||
} |
|||
|
|||
// GetCount returns the Count field value if set, zero value otherwise (both if not set or set to explicit null).
|
|||
func (o *FileKey) GetCount() interface{} { |
|||
if o == nil { |
|||
var ret interface{} |
|||
return ret |
|||
} |
|||
return o.Count |
|||
} |
|||
|
|||
// GetCountOk returns a tuple with the Count field value if set, nil otherwise
|
|||
// and a boolean to check if the value has been set.
|
|||
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|||
func (o *FileKey) GetCountOk() (*interface{}, bool) { |
|||
if o == nil || IsNil(o.Count) { |
|||
return nil, false |
|||
} |
|||
return &o.Count, true |
|||
} |
|||
|
|||
// HasCount returns a boolean if a field has been set.
|
|||
func (o *FileKey) HasCount() bool { |
|||
if o != nil && IsNil(o.Count) { |
|||
return true |
|||
} |
|||
|
|||
return false |
|||
} |
|||
|
|||
// SetCount gets a reference to the given interface{} and assigns it to the Count field.
|
|||
func (o *FileKey) SetCount(v interface{}) { |
|||
o.Count = v |
|||
} |
|||
|
|||
// GetFid returns the Fid field value if set, zero value otherwise (both if not set or set to explicit null).
|
|||
func (o *FileKey) GetFid() interface{} { |
|||
if o == nil { |
|||
var ret interface{} |
|||
return ret |
|||
} |
|||
return o.Fid |
|||
} |
|||
|
|||
// GetFidOk returns a tuple with the Fid field value if set, nil otherwise
|
|||
// and a boolean to check if the value has been set.
|
|||
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|||
func (o *FileKey) GetFidOk() (*interface{}, bool) { |
|||
if o == nil || IsNil(o.Fid) { |
|||
return nil, false |
|||
} |
|||
return &o.Fid, true |
|||
} |
|||
|
|||
// HasFid returns a boolean if a field has been set.
|
|||
func (o *FileKey) HasFid() bool { |
|||
if o != nil && IsNil(o.Fid) { |
|||
return true |
|||
} |
|||
|
|||
return false |
|||
} |
|||
|
|||
// SetFid gets a reference to the given interface{} and assigns it to the Fid field.
|
|||
func (o *FileKey) SetFid(v interface{}) { |
|||
o.Fid = v |
|||
} |
|||
|
|||
// GetUrl returns the Url field value if set, zero value otherwise (both if not set or set to explicit null).
|
|||
func (o *FileKey) GetUrl() interface{} { |
|||
if o == nil { |
|||
var ret interface{} |
|||
return ret |
|||
} |
|||
return o.Url |
|||
} |
|||
|
|||
// GetUrlOk returns a tuple with the Url field value if set, nil otherwise
|
|||
// and a boolean to check if the value has been set.
|
|||
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|||
func (o *FileKey) GetUrlOk() (*interface{}, bool) { |
|||
if o == nil || IsNil(o.Url) { |
|||
return nil, false |
|||
} |
|||
return &o.Url, true |
|||
} |
|||
|
|||
// HasUrl returns a boolean if a field has been set.
|
|||
func (o *FileKey) HasUrl() bool { |
|||
if o != nil && IsNil(o.Url) { |
|||
return true |
|||
} |
|||
|
|||
return false |
|||
} |
|||
|
|||
// SetUrl gets a reference to the given interface{} and assigns it to the Url field.
|
|||
func (o *FileKey) SetUrl(v interface{}) { |
|||
o.Url = v |
|||
} |
|||
|
|||
func (o FileKey) MarshalJSON() ([]byte, error) { |
|||
toSerialize, err := o.ToMap() |
|||
if err != nil { |
|||
return []byte{}, err |
|||
} |
|||
return json.Marshal(toSerialize) |
|||
} |
|||
|
|||
func (o FileKey) ToMap() (map[string]interface{}, error) { |
|||
toSerialize := map[string]interface{}{} |
|||
if o.Count != nil { |
|||
toSerialize["count"] = o.Count |
|||
} |
|||
if o.Fid != nil { |
|||
toSerialize["fid"] = o.Fid |
|||
} |
|||
if o.Url != nil { |
|||
toSerialize["url"] = o.Url |
|||
} |
|||
return toSerialize, nil |
|||
} |
|||
|
|||
type NullableFileKey struct { |
|||
value *FileKey |
|||
isSet bool |
|||
} |
|||
|
|||
func (v NullableFileKey) Get() *FileKey { |
|||
return v.value |
|||
} |
|||
|
|||
func (v *NullableFileKey) Set(val *FileKey) { |
|||
v.value = val |
|||
v.isSet = true |
|||
} |
|||
|
|||
func (v NullableFileKey) IsSet() bool { |
|||
return v.isSet |
|||
} |
|||
|
|||
func (v *NullableFileKey) Unset() { |
|||
v.value = nil |
|||
v.isSet = false |
|||
} |
|||
|
|||
func NewNullableFileKey(val *FileKey) *NullableFileKey { |
|||
return &NullableFileKey{value: val, isSet: true} |
|||
} |
|||
|
|||
func (v NullableFileKey) MarshalJSON() ([]byte, error) { |
|||
return json.Marshal(v.value) |
|||
} |
|||
|
|||
func (v *NullableFileKey) UnmarshalJSON(src []byte) error { |
|||
v.isSet = true |
|||
return json.Unmarshal(src, &v.value) |
|||
} |
@ -0,0 +1,162 @@ |
|||
/* |
|||
Seaweedfs Master Server API |
|||
|
|||
The Seaweedfs Master Server API allows you to store blobs |
|||
|
|||
API version: 3.43.0 |
|||
*/ |
|||
|
|||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|||
|
|||
package openapi |
|||
|
|||
import ( |
|||
"encoding/json" |
|||
) |
|||
|
|||
// checks if the Location type satisfies the MappedNullable interface at compile time
|
|||
var _ MappedNullable = &Location{} |
|||
|
|||
// Location struct for Location
|
|||
type Location struct { |
|||
PublicUrl interface{} `json:"publicUrl,omitempty"` |
|||
Url interface{} `json:"url,omitempty"` |
|||
} |
|||
|
|||
// NewLocation instantiates a new Location object
|
|||
// This constructor will assign default values to properties that have it defined,
|
|||
// and makes sure properties required by API are set, but the set of arguments
|
|||
// will change when the set of required properties is changed
|
|||
func NewLocation() *Location { |
|||
this := Location{} |
|||
return &this |
|||
} |
|||
|
|||
// NewLocationWithDefaults instantiates a new Location object
|
|||
// This constructor will only assign default values to properties that have it defined,
|
|||
// but it doesn't guarantee that properties required by API are set
|
|||
func NewLocationWithDefaults() *Location { |
|||
this := Location{} |
|||
return &this |
|||
} |
|||
|
|||
// GetPublicUrl returns the PublicUrl field value if set, zero value otherwise (both if not set or set to explicit null).
|
|||
func (o *Location) GetPublicUrl() interface{} { |
|||
if o == nil { |
|||
var ret interface{} |
|||
return ret |
|||
} |
|||
return o.PublicUrl |
|||
} |
|||
|
|||
// GetPublicUrlOk returns a tuple with the PublicUrl field value if set, nil otherwise
|
|||
// and a boolean to check if the value has been set.
|
|||
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|||
func (o *Location) GetPublicUrlOk() (*interface{}, bool) { |
|||
if o == nil || IsNil(o.PublicUrl) { |
|||
return nil, false |
|||
} |
|||
return &o.PublicUrl, true |
|||
} |
|||
|
|||
// HasPublicUrl returns a boolean if a field has been set.
|
|||
func (o *Location) HasPublicUrl() bool { |
|||
if o != nil && IsNil(o.PublicUrl) { |
|||
return true |
|||
} |
|||
|
|||
return false |
|||
} |
|||
|
|||
// SetPublicUrl gets a reference to the given interface{} and assigns it to the PublicUrl field.
|
|||
func (o *Location) SetPublicUrl(v interface{}) { |
|||
o.PublicUrl = v |
|||
} |
|||
|
|||
// GetUrl returns the Url field value if set, zero value otherwise (both if not set or set to explicit null).
|
|||
func (o *Location) GetUrl() interface{} { |
|||
if o == nil { |
|||
var ret interface{} |
|||
return ret |
|||
} |
|||
return o.Url |
|||
} |
|||
|
|||
// GetUrlOk returns a tuple with the Url field value if set, nil otherwise
|
|||
// and a boolean to check if the value has been set.
|
|||
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|||
func (o *Location) GetUrlOk() (*interface{}, bool) { |
|||
if o == nil || IsNil(o.Url) { |
|||
return nil, false |
|||
} |
|||
return &o.Url, true |
|||
} |
|||
|
|||
// HasUrl returns a boolean if a field has been set.
|
|||
func (o *Location) HasUrl() bool { |
|||
if o != nil && IsNil(o.Url) { |
|||
return true |
|||
} |
|||
|
|||
return false |
|||
} |
|||
|
|||
// SetUrl gets a reference to the given interface{} and assigns it to the Url field.
|
|||
func (o *Location) SetUrl(v interface{}) { |
|||
o.Url = v |
|||
} |
|||
|
|||
func (o Location) MarshalJSON() ([]byte, error) { |
|||
toSerialize, err := o.ToMap() |
|||
if err != nil { |
|||
return []byte{}, err |
|||
} |
|||
return json.Marshal(toSerialize) |
|||
} |
|||
|
|||
func (o Location) ToMap() (map[string]interface{}, error) { |
|||
toSerialize := map[string]interface{}{} |
|||
if o.PublicUrl != nil { |
|||
toSerialize["publicUrl"] = o.PublicUrl |
|||
} |
|||
if o.Url != nil { |
|||
toSerialize["url"] = o.Url |
|||
} |
|||
return toSerialize, nil |
|||
} |
|||
|
|||
type NullableLocation struct { |
|||
value *Location |
|||
isSet bool |
|||
} |
|||
|
|||
func (v NullableLocation) Get() *Location { |
|||
return v.value |
|||
} |
|||
|
|||
func (v *NullableLocation) Set(val *Location) { |
|||
v.value = val |
|||
v.isSet = true |
|||
} |
|||
|
|||
func (v NullableLocation) IsSet() bool { |
|||
return v.isSet |
|||
} |
|||
|
|||
func (v *NullableLocation) Unset() { |
|||
v.value = nil |
|||
v.isSet = false |
|||
} |
|||
|
|||
func NewNullableLocation(val *Location) *NullableLocation { |
|||
return &NullableLocation{value: val, isSet: true} |
|||
} |
|||
|
|||
func (v NullableLocation) MarshalJSON() ([]byte, error) { |
|||
return json.Marshal(v.value) |
|||
} |
|||
|
|||
func (v *NullableLocation) UnmarshalJSON(src []byte) error { |
|||
v.isSet = true |
|||
return json.Unmarshal(src, &v.value) |
|||
} |
@ -0,0 +1,47 @@ |
|||
/* |
|||
Seaweedfs Master Server API |
|||
|
|||
The Seaweedfs Master Server API allows you to store blobs |
|||
|
|||
API version: 3.43.0 |
|||
*/ |
|||
|
|||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|||
|
|||
package openapi |
|||
|
|||
import ( |
|||
"net/http" |
|||
) |
|||
|
|||
// APIResponse stores the API response returned by the server.
|
|||
type APIResponse struct { |
|||
*http.Response `json:"-"` |
|||
Message string `json:"message,omitempty"` |
|||
// Operation is the name of the OpenAPI operation.
|
|||
Operation string `json:"operation,omitempty"` |
|||
// RequestURL is the request URL. This value is always available, even if the
|
|||
// embedded *http.Response is nil.
|
|||
RequestURL string `json:"url,omitempty"` |
|||
// Method is the HTTP method used for the request. This value is always
|
|||
// available, even if the embedded *http.Response is nil.
|
|||
Method string `json:"method,omitempty"` |
|||
// Payload holds the contents of the response body (which may be nil or empty).
|
|||
// This is provided here as the raw response.Body() reader will have already
|
|||
// been drained.
|
|||
Payload []byte `json:"-"` |
|||
} |
|||
|
|||
// NewAPIResponse returns a new APIResponse object.
|
|||
func NewAPIResponse(r *http.Response) *APIResponse { |
|||
|
|||
response := &APIResponse{Response: r} |
|||
return response |
|||
} |
|||
|
|||
// NewAPIResponseWithError returns a new APIResponse object with the provided error message.
|
|||
func NewAPIResponseWithError(errorMessage string) *APIResponse { |
|||
|
|||
response := &APIResponse{Message: errorMessage} |
|||
return response |
|||
} |
@ -0,0 +1,49 @@ |
|||
/* |
|||
Seaweedfs Master Server API |
|||
|
|||
Testing DefaultApiService |
|||
|
|||
*/ |
|||
|
|||
// Code generated by OpenAPI Generator (https://openapi-generator.tech);
|
|||
|
|||
package openapi |
|||
|
|||
import ( |
|||
"context" |
|||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" |
|||
"github.com/stretchr/testify/assert" |
|||
"github.com/stretchr/testify/require" |
|||
"testing" |
|||
) |
|||
|
|||
func Test_openapi_DefaultApiService(t *testing.T) { |
|||
|
|||
configuration := openapiclient.NewConfiguration() |
|||
apiClient := openapiclient.NewAPIClient(configuration) |
|||
|
|||
t.Run("Test DefaultApiService DirAssign", func(t *testing.T) { |
|||
|
|||
t.Skip("skip test") // remove to run test
|
|||
|
|||
resp, httpRes, err := apiClient.DefaultApi.DirAssign(context.Background()).Execute() |
|||
|
|||
require.Nil(t, err) |
|||
require.NotNil(t, resp) |
|||
assert.Equal(t, 200, httpRes.StatusCode) |
|||
|
|||
}) |
|||
|
|||
t.Run("Test DefaultApiService DirLookup", func(t *testing.T) { |
|||
|
|||
t.Skip("skip test") // remove to run test
|
|||
|
|||
resp, httpRes, err := apiClient.DefaultApi.DirLookup(context.Background()).Execute() |
|||
|
|||
require.Nil(t, err) |
|||
require.NotNil(t, resp) |
|||
assert.Equal(t, 200, httpRes.StatusCode) |
|||
|
|||
}) |
|||
|
|||
} |
@ -0,0 +1,347 @@ |
|||
/* |
|||
Seaweedfs Master Server API |
|||
|
|||
The Seaweedfs Master Server API allows you to store blobs |
|||
|
|||
API version: 3.43.0 |
|||
*/ |
|||
|
|||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|||
|
|||
package openapi |
|||
|
|||
import ( |
|||
"encoding/json" |
|||
"reflect" |
|||
"time" |
|||
) |
|||
|
|||
// PtrBool is a helper routine that returns a pointer to given boolean value.
|
|||
func PtrBool(v bool) *bool { return &v } |
|||
|
|||
// PtrInt is a helper routine that returns a pointer to given integer value.
|
|||
func PtrInt(v int) *int { return &v } |
|||
|
|||
// PtrInt32 is a helper routine that returns a pointer to given integer value.
|
|||
func PtrInt32(v int32) *int32 { return &v } |
|||
|
|||
// PtrInt64 is a helper routine that returns a pointer to given integer value.
|
|||
func PtrInt64(v int64) *int64 { return &v } |
|||
|
|||
// PtrFloat32 is a helper routine that returns a pointer to given float value.
|
|||
func PtrFloat32(v float32) *float32 { return &v } |
|||
|
|||
// PtrFloat64 is a helper routine that returns a pointer to given float value.
|
|||
func PtrFloat64(v float64) *float64 { return &v } |
|||
|
|||
// PtrString is a helper routine that returns a pointer to given string value.
|
|||
func PtrString(v string) *string { return &v } |
|||
|
|||
// PtrTime is helper routine that returns a pointer to given Time value.
|
|||
func PtrTime(v time.Time) *time.Time { return &v } |
|||
|
|||
type NullableBool struct { |
|||
value *bool |
|||
isSet bool |
|||
} |
|||
|
|||
func (v NullableBool) Get() *bool { |
|||
return v.value |
|||
} |
|||
|
|||
func (v *NullableBool) Set(val *bool) { |
|||
v.value = val |
|||
v.isSet = true |
|||
} |
|||
|
|||
func (v NullableBool) IsSet() bool { |
|||
return v.isSet |
|||
} |
|||
|
|||
func (v *NullableBool) Unset() { |
|||
v.value = nil |
|||
v.isSet = false |
|||
} |
|||
|
|||
func NewNullableBool(val *bool) *NullableBool { |
|||
return &NullableBool{value: val, isSet: true} |
|||
} |
|||
|
|||
func (v NullableBool) MarshalJSON() ([]byte, error) { |
|||
return json.Marshal(v.value) |
|||
} |
|||
|
|||
func (v *NullableBool) UnmarshalJSON(src []byte) error { |
|||
v.isSet = true |
|||
return json.Unmarshal(src, &v.value) |
|||
} |
|||
|
|||
type NullableInt struct { |
|||
value *int |
|||
isSet bool |
|||
} |
|||
|
|||
func (v NullableInt) Get() *int { |
|||
return v.value |
|||
} |
|||
|
|||
func (v *NullableInt) Set(val *int) { |
|||
v.value = val |
|||
v.isSet = true |
|||
} |
|||
|
|||
func (v NullableInt) IsSet() bool { |
|||
return v.isSet |
|||
} |
|||
|
|||
func (v *NullableInt) Unset() { |
|||
v.value = nil |
|||
v.isSet = false |
|||
} |
|||
|
|||
func NewNullableInt(val *int) *NullableInt { |
|||
return &NullableInt{value: val, isSet: true} |
|||
} |
|||
|
|||
func (v NullableInt) MarshalJSON() ([]byte, error) { |
|||
return json.Marshal(v.value) |
|||
} |
|||
|
|||
func (v *NullableInt) UnmarshalJSON(src []byte) error { |
|||
v.isSet = true |
|||
return json.Unmarshal(src, &v.value) |
|||
} |
|||
|
|||
type NullableInt32 struct { |
|||
value *int32 |
|||
isSet bool |
|||
} |
|||
|
|||
func (v NullableInt32) Get() *int32 { |
|||
return v.value |
|||
} |
|||
|
|||
func (v *NullableInt32) Set(val *int32) { |
|||
v.value = val |
|||
v.isSet = true |
|||
} |
|||
|
|||
func (v NullableInt32) IsSet() bool { |
|||
return v.isSet |
|||
} |
|||
|
|||
func (v *NullableInt32) Unset() { |
|||
v.value = nil |
|||
v.isSet = false |
|||
} |
|||
|
|||
func NewNullableInt32(val *int32) *NullableInt32 { |
|||
return &NullableInt32{value: val, isSet: true} |
|||
} |
|||
|
|||
func (v NullableInt32) MarshalJSON() ([]byte, error) { |
|||
return json.Marshal(v.value) |
|||
} |
|||
|
|||
func (v *NullableInt32) UnmarshalJSON(src []byte) error { |
|||
v.isSet = true |
|||
return json.Unmarshal(src, &v.value) |
|||
} |
|||
|
|||
type NullableInt64 struct { |
|||
value *int64 |
|||
isSet bool |
|||
} |
|||
|
|||
func (v NullableInt64) Get() *int64 { |
|||
return v.value |
|||
} |
|||
|
|||
func (v *NullableInt64) Set(val *int64) { |
|||
v.value = val |
|||
v.isSet = true |
|||
} |
|||
|
|||
func (v NullableInt64) IsSet() bool { |
|||
return v.isSet |
|||
} |
|||
|
|||
func (v *NullableInt64) Unset() { |
|||
v.value = nil |
|||
v.isSet = false |
|||
} |
|||
|
|||
func NewNullableInt64(val *int64) *NullableInt64 { |
|||
return &NullableInt64{value: val, isSet: true} |
|||
} |
|||
|
|||
func (v NullableInt64) MarshalJSON() ([]byte, error) { |
|||
return json.Marshal(v.value) |
|||
} |
|||
|
|||
func (v *NullableInt64) UnmarshalJSON(src []byte) error { |
|||
v.isSet = true |
|||
return json.Unmarshal(src, &v.value) |
|||
} |
|||
|
|||
type NullableFloat32 struct { |
|||
value *float32 |
|||
isSet bool |
|||
} |
|||
|
|||
func (v NullableFloat32) Get() *float32 { |
|||
return v.value |
|||
} |
|||
|
|||
func (v *NullableFloat32) Set(val *float32) { |
|||
v.value = val |
|||
v.isSet = true |
|||
} |
|||
|
|||
func (v NullableFloat32) IsSet() bool { |
|||
return v.isSet |
|||
} |
|||
|
|||
func (v *NullableFloat32) Unset() { |
|||
v.value = nil |
|||
v.isSet = false |
|||
} |
|||
|
|||
func NewNullableFloat32(val *float32) *NullableFloat32 { |
|||
return &NullableFloat32{value: val, isSet: true} |
|||
} |
|||
|
|||
func (v NullableFloat32) MarshalJSON() ([]byte, error) { |
|||
return json.Marshal(v.value) |
|||
} |
|||
|
|||
func (v *NullableFloat32) UnmarshalJSON(src []byte) error { |
|||
v.isSet = true |
|||
return json.Unmarshal(src, &v.value) |
|||
} |
|||
|
|||
type NullableFloat64 struct { |
|||
value *float64 |
|||
isSet bool |
|||
} |
|||
|
|||
func (v NullableFloat64) Get() *float64 { |
|||
return v.value |
|||
} |
|||
|
|||
func (v *NullableFloat64) Set(val *float64) { |
|||
v.value = val |
|||
v.isSet = true |
|||
} |
|||
|
|||
func (v NullableFloat64) IsSet() bool { |
|||
return v.isSet |
|||
} |
|||
|
|||
func (v *NullableFloat64) Unset() { |
|||
v.value = nil |
|||
v.isSet = false |
|||
} |
|||
|
|||
func NewNullableFloat64(val *float64) *NullableFloat64 { |
|||
return &NullableFloat64{value: val, isSet: true} |
|||
} |
|||
|
|||
func (v NullableFloat64) MarshalJSON() ([]byte, error) { |
|||
return json.Marshal(v.value) |
|||
} |
|||
|
|||
func (v *NullableFloat64) UnmarshalJSON(src []byte) error { |
|||
v.isSet = true |
|||
return json.Unmarshal(src, &v.value) |
|||
} |
|||
|
|||
type NullableString struct { |
|||
value *string |
|||
isSet bool |
|||
} |
|||
|
|||
func (v NullableString) Get() *string { |
|||
return v.value |
|||
} |
|||
|
|||
func (v *NullableString) Set(val *string) { |
|||
v.value = val |
|||
v.isSet = true |
|||
} |
|||
|
|||
func (v NullableString) IsSet() bool { |
|||
return v.isSet |
|||
} |
|||
|
|||
func (v *NullableString) Unset() { |
|||
v.value = nil |
|||
v.isSet = false |
|||
} |
|||
|
|||
func NewNullableString(val *string) *NullableString { |
|||
return &NullableString{value: val, isSet: true} |
|||
} |
|||
|
|||
func (v NullableString) MarshalJSON() ([]byte, error) { |
|||
return json.Marshal(v.value) |
|||
} |
|||
|
|||
func (v *NullableString) UnmarshalJSON(src []byte) error { |
|||
v.isSet = true |
|||
return json.Unmarshal(src, &v.value) |
|||
} |
|||
|
|||
type NullableTime struct { |
|||
value *time.Time |
|||
isSet bool |
|||
} |
|||
|
|||
func (v NullableTime) Get() *time.Time { |
|||
return v.value |
|||
} |
|||
|
|||
func (v *NullableTime) Set(val *time.Time) { |
|||
v.value = val |
|||
v.isSet = true |
|||
} |
|||
|
|||
func (v NullableTime) IsSet() bool { |
|||
return v.isSet |
|||
} |
|||
|
|||
func (v *NullableTime) Unset() { |
|||
v.value = nil |
|||
v.isSet = false |
|||
} |
|||
|
|||
func NewNullableTime(val *time.Time) *NullableTime { |
|||
return &NullableTime{value: val, isSet: true} |
|||
} |
|||
|
|||
func (v NullableTime) MarshalJSON() ([]byte, error) { |
|||
return v.value.MarshalJSON() |
|||
} |
|||
|
|||
func (v *NullableTime) UnmarshalJSON(src []byte) error { |
|||
v.isSet = true |
|||
return json.Unmarshal(src, &v.value) |
|||
} |
|||
|
|||
// IsNil checks if an input is nil
|
|||
func IsNil(i interface{}) bool { |
|||
if i == nil { |
|||
return true |
|||
} |
|||
switch reflect.TypeOf(i).Kind() { |
|||
case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: |
|||
return reflect.ValueOf(i).IsNil() |
|||
case reflect.Array: |
|||
return reflect.ValueOf(i).IsZero() |
|||
} |
|||
return false |
|||
} |
|||
|
|||
type MappedNullable interface { |
|||
ToMap() (map[string]interface{}, error) |
|||
} |
@ -0,0 +1,15 @@ |
|||
# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore |
|||
|
|||
composer.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 |
|||
|
|||
# php-cs-fixer cache |
|||
.php_cs.cache |
|||
.php-cs-fixer.cache |
|||
|
|||
# PHPUnit cache |
|||
.phpunit.result.cache |
@ -0,0 +1,23 @@ |
|||
# OpenAPI Generator Ignore |
|||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator |
|||
|
|||
# Use this file to prevent files from being overwritten by the generator. |
|||
# The patterns follow closely to .gitignore or .dockerignore. |
|||
|
|||
# As an example, the C# client generator defines ApiClient.cs. |
|||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: |
|||
#ApiClient.cs |
|||
|
|||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): |
|||
#foo/*/qux |
|||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux |
|||
|
|||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): |
|||
#foo/**/qux |
|||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux |
|||
|
|||
# You can also negate patterns with an exclamation (!). |
|||
# For example, you can ignore all files in a docs folder with the file extension .md: |
|||
#docs/*.md |
|||
# Then explicitly reverse the ignore rule for a single file: |
|||
#!docs/README.md |
@ -0,0 +1,22 @@ |
|||
.gitignore |
|||
.openapi-generator-ignore |
|||
.php-cs-fixer.dist.php |
|||
.travis.yml |
|||
README.md |
|||
composer.json |
|||
docs/Api/DefaultApi.md |
|||
docs/Model/FileKey.md |
|||
docs/Model/Location.md |
|||
git_push.sh |
|||
lib/Api/DefaultApi.php |
|||
lib/ApiException.php |
|||
lib/Configuration.php |
|||
lib/HeaderSelector.php |
|||
lib/Model/FileKey.php |
|||
lib/Model/Location.php |
|||
lib/Model/ModelInterface.php |
|||
lib/ObjectSerializer.php |
|||
phpunit.xml.dist |
|||
test/Api/DefaultApiTest.php |
|||
test/Model/FileKeyTest.php |
|||
test/Model/LocationTest.php |
@ -0,0 +1 @@ |
|||
6.4.0 |
@ -0,0 +1,29 @@ |
|||
<?php |
|||
|
|||
/** |
|||
* @generated |
|||
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/HEAD/doc/config.rst |
|||
*/ |
|||
$finder = PhpCsFixer\Finder::create() |
|||
->in(__DIR__) |
|||
->exclude('vendor') |
|||
->exclude('test') |
|||
->exclude('tests') |
|||
; |
|||
|
|||
$config = new PhpCsFixer\Config(); |
|||
return $config->setRules([ |
|||
'@PSR12' => true, |
|||
'phpdoc_order' => true, |
|||
'array_syntax' => [ 'syntax' => 'short' ], |
|||
'strict_comparison' => true, |
|||
'strict_param' => true, |
|||
'no_trailing_whitespace' => false, |
|||
'no_trailing_whitespace_in_comment' => false, |
|||
'braces' => false, |
|||
'single_blank_line_at_eof' => false, |
|||
'blank_line_after_namespace' => false, |
|||
'no_leading_import_slash' => false, |
|||
]) |
|||
->setFinder($finder) |
|||
; |
@ -0,0 +1,8 @@ |
|||
language: php |
|||
# Bionic environment has preinstalled PHP from 7.1 to 7.4 |
|||
# https://docs.travis-ci.com/user/reference/bionic/#php-support |
|||
dist: bionic |
|||
php: |
|||
- 7.4 |
|||
before_install: "composer install" |
|||
script: "vendor/bin/phpunit" |
@ -0,0 +1,113 @@ |
|||
# OpenAPIClient-php |
|||
|
|||
The Seaweedfs Master Server API allows you to store blobs |
|||
|
|||
|
|||
## Installation & Usage |
|||
|
|||
### Requirements |
|||
|
|||
PHP 7.4 and later. |
|||
Should also work with PHP 8.0. |
|||
|
|||
### Composer |
|||
|
|||
To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`: |
|||
|
|||
```json |
|||
{ |
|||
"repositories": [ |
|||
{ |
|||
"type": "vcs", |
|||
"url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git" |
|||
} |
|||
], |
|||
"require": { |
|||
"GIT_USER_ID/GIT_REPO_ID": "*@dev" |
|||
} |
|||
} |
|||
``` |
|||
|
|||
Then run `composer install` |
|||
|
|||
### Manual Installation |
|||
|
|||
Download the files and include `autoload.php`: |
|||
|
|||
```php |
|||
<?php |
|||
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php'); |
|||
``` |
|||
|
|||
## Getting Started |
|||
|
|||
Please follow the [installation procedure](#installation--usage) and then run the following: |
|||
|
|||
```php |
|||
<?php |
|||
require_once(__DIR__ . '/vendor/autoload.php'); |
|||
|
|||
|
|||
|
|||
|
|||
$apiInstance = new OpenAPI\Client\Api\DefaultApi( |
|||
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. |
|||
// This is optional, `GuzzleHttp\Client` will be used as default. |
|||
new GuzzleHttp\Client() |
|||
); |
|||
$count = NULL; // mixed | how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 |
|||
$collection = NULL; // mixed | required collection name |
|||
$data_center = NULL; // mixed | preferred data center |
|||
$rack = NULL; // mixed | preferred rack |
|||
$data_node = NULL; // mixed | preferred volume server, e.g. 127.0.0.1:8080 |
|||
$disk = NULL; // mixed | If you have disks labelled, this must be supplied to specify the disk type to allocate on. |
|||
$replication = NULL; // mixed | replica placement strategy |
|||
$ttl = NULL; // mixed | file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year |
|||
$preallocate = NULL; // mixed | If no matching volumes, pre-allocate this number of bytes on disk for new volumes. |
|||
$memory_map_max_size_mb = NULL; // mixed | Only implemented for windows. Use memory mapped files with specified size for new volumes. |
|||
$writable_volume_count = NULL; // mixed | If no matching volumes, create specified number of new volumes. |
|||
|
|||
try { |
|||
$result = $apiInstance->dirAssign($count, $collection, $data_center, $rack, $data_node, $disk, $replication, $ttl, $preallocate, $memory_map_max_size_mb, $writable_volume_count); |
|||
print_r($result); |
|||
} catch (Exception $e) { |
|||
echo 'Exception when calling DefaultApi->dirAssign: ', $e->getMessage(), PHP_EOL; |
|||
} |
|||
|
|||
``` |
|||
|
|||
## API Endpoints |
|||
|
|||
All URIs are relative to *https://127.0.0.1:9333* |
|||
|
|||
Class | Method | HTTP request | Description |
|||
------------ | ------------- | ------------- | ------------- |
|||
*DefaultApi* | [**dirAssign**](docs/Api/DefaultApi.md#dirassign) | **GET** /dir/assign | Assign a file key |
|||
*DefaultApi* | [**dirLookup**](docs/Api/DefaultApi.md#dirlookup) | **GET** /dir/lookup | Lookup volume |
|||
|
|||
## Models |
|||
|
|||
- [FileKey](docs/Model/FileKey.md) |
|||
- [Location](docs/Model/Location.md) |
|||
|
|||
## Authorization |
|||
All endpoints do not require authorization. |
|||
## Tests |
|||
|
|||
To run the tests, use: |
|||
|
|||
```bash |
|||
composer install |
|||
vendor/bin/phpunit |
|||
``` |
|||
|
|||
## Author |
|||
|
|||
|
|||
|
|||
## About this package |
|||
|
|||
This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: |
|||
|
|||
- API version: `3.43.0` |
|||
- Build package: `org.openapitools.codegen.languages.PhpClientCodegen` |
@ -0,0 +1,38 @@ |
|||
{ |
|||
"description": "The Seaweedfs Master Server API allows you to store blobs", |
|||
"keywords": [ |
|||
"openapitools", |
|||
"openapi-generator", |
|||
"openapi", |
|||
"php", |
|||
"sdk", |
|||
"rest", |
|||
"api" |
|||
], |
|||
"homepage": "https://openapi-generator.tech", |
|||
"license": "unlicense", |
|||
"authors": [ |
|||
{ |
|||
"name": "OpenAPI-Generator contributors", |
|||
"homepage": "https://openapi-generator.tech" |
|||
} |
|||
], |
|||
"require": { |
|||
"php": "^7.4 || ^8.0", |
|||
"ext-curl": "*", |
|||
"ext-json": "*", |
|||
"ext-mbstring": "*", |
|||
"guzzlehttp/guzzle": "^7.3", |
|||
"guzzlehttp/psr7": "^1.7 || ^2.0" |
|||
}, |
|||
"require-dev": { |
|||
"phpunit/phpunit": "^8.0 || ^9.0", |
|||
"friendsofphp/php-cs-fixer": "^3.5" |
|||
}, |
|||
"autoload": { |
|||
"psr-4": { "OpenAPI\\Client\\" : "lib/" } |
|||
}, |
|||
"autoload-dev": { |
|||
"psr-4": { "OpenAPI\\Client\\Test\\" : "test/" } |
|||
} |
|||
} |
@ -0,0 +1,147 @@ |
|||
# OpenAPI\Client\DefaultApi |
|||
|
|||
All URIs are relative to https://127.0.0.1:9333, except if the operation defines another base path. |
|||
|
|||
| Method | HTTP request | Description | |
|||
| ------------- | ------------- | ------------- | |
|||
| [**dirAssign()**](DefaultApi.md#dirAssign) | **GET** /dir/assign | Assign a file key | |
|||
| [**dirLookup()**](DefaultApi.md#dirLookup) | **GET** /dir/lookup | Lookup volume | |
|||
|
|||
|
|||
## `dirAssign()` |
|||
|
|||
```php |
|||
dirAssign($count, $collection, $data_center, $rack, $data_node, $disk, $replication, $ttl, $preallocate, $memory_map_max_size_mb, $writable_volume_count): \OpenAPI\Client\Model\FileKey |
|||
``` |
|||
|
|||
Assign a file key |
|||
|
|||
This operation is very cheap. Just increase a number in master server's memory. |
|||
|
|||
### Example |
|||
|
|||
```php |
|||
<?php |
|||
require_once(__DIR__ . '/vendor/autoload.php'); |
|||
|
|||
|
|||
|
|||
$apiInstance = new OpenAPI\Client\Api\DefaultApi( |
|||
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. |
|||
// This is optional, `GuzzleHttp\Client` will be used as default. |
|||
new GuzzleHttp\Client() |
|||
); |
|||
$count = NULL; // mixed | how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 |
|||
$collection = NULL; // mixed | required collection name |
|||
$data_center = NULL; // mixed | preferred data center |
|||
$rack = NULL; // mixed | preferred rack |
|||
$data_node = NULL; // mixed | preferred volume server, e.g. 127.0.0.1:8080 |
|||
$disk = NULL; // mixed | If you have disks labelled, this must be supplied to specify the disk type to allocate on. |
|||
$replication = NULL; // mixed | replica placement strategy |
|||
$ttl = NULL; // mixed | file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year |
|||
$preallocate = NULL; // mixed | If no matching volumes, pre-allocate this number of bytes on disk for new volumes. |
|||
$memory_map_max_size_mb = NULL; // mixed | Only implemented for windows. Use memory mapped files with specified size for new volumes. |
|||
$writable_volume_count = NULL; // mixed | If no matching volumes, create specified number of new volumes. |
|||
|
|||
try { |
|||
$result = $apiInstance->dirAssign($count, $collection, $data_center, $rack, $data_node, $disk, $replication, $ttl, $preallocate, $memory_map_max_size_mb, $writable_volume_count); |
|||
print_r($result); |
|||
} catch (Exception $e) { |
|||
echo 'Exception when calling DefaultApi->dirAssign: ', $e->getMessage(), PHP_EOL; |
|||
} |
|||
``` |
|||
|
|||
### Parameters |
|||
|
|||
| Name | Type | Description | Notes | |
|||
| ------------- | ------------- | ------------- | ------------- | |
|||
| **count** | [**mixed**](../Model/.md)| how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 | [optional] | |
|||
| **collection** | [**mixed**](../Model/.md)| required collection name | [optional] | |
|||
| **data_center** | [**mixed**](../Model/.md)| preferred data center | [optional] | |
|||
| **rack** | [**mixed**](../Model/.md)| preferred rack | [optional] | |
|||
| **data_node** | [**mixed**](../Model/.md)| preferred volume server, e.g. 127.0.0.1:8080 | [optional] | |
|||
| **disk** | [**mixed**](../Model/.md)| If you have disks labelled, this must be supplied to specify the disk type to allocate on. | [optional] | |
|||
| **replication** | [**mixed**](../Model/.md)| replica placement strategy | [optional] | |
|||
| **ttl** | [**mixed**](../Model/.md)| file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year | [optional] | |
|||
| **preallocate** | [**mixed**](../Model/.md)| If no matching volumes, pre-allocate this number of bytes on disk for new volumes. | [optional] | |
|||
| **memory_map_max_size_mb** | [**mixed**](../Model/.md)| Only implemented for windows. Use memory mapped files with specified size for new volumes. | [optional] | |
|||
| **writable_volume_count** | [**mixed**](../Model/.md)| If no matching volumes, create specified number of new volumes. | [optional] | |
|||
|
|||
### Return type |
|||
|
|||
[**\OpenAPI\Client\Model\FileKey**](../Model/FileKey.md) |
|||
|
|||
### Authorization |
|||
|
|||
No authorization required |
|||
|
|||
### HTTP request headers |
|||
|
|||
- **Content-Type**: Not defined |
|||
- **Accept**: `application/json` |
|||
|
|||
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) |
|||
[[Back to Model list]](../../README.md#models) |
|||
[[Back to README]](../../README.md) |
|||
|
|||
## `dirLookup()` |
|||
|
|||
```php |
|||
dirLookup($volume_id, $collection, $file_id, $read): mixed |
|||
``` |
|||
|
|||
Lookup volume |
|||
|
|||
We would need to find out whether the volumes have moved. |
|||
|
|||
### Example |
|||
|
|||
```php |
|||
<?php |
|||
require_once(__DIR__ . '/vendor/autoload.php'); |
|||
|
|||
|
|||
|
|||
$apiInstance = new OpenAPI\Client\Api\DefaultApi( |
|||
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. |
|||
// This is optional, `GuzzleHttp\Client` will be used as default. |
|||
new GuzzleHttp\Client() |
|||
); |
|||
$volume_id = NULL; // mixed | volume id |
|||
$collection = NULL; // mixed | optionally to speed up the lookup |
|||
$file_id = NULL; // mixed | If provided, this returns the fileId location and a JWT to update or delete the file. |
|||
$read = NULL; // mixed | works together with \"fileId\", if read=yes, JWT is generated for reads. |
|||
|
|||
try { |
|||
$result = $apiInstance->dirLookup($volume_id, $collection, $file_id, $read); |
|||
print_r($result); |
|||
} catch (Exception $e) { |
|||
echo 'Exception when calling DefaultApi->dirLookup: ', $e->getMessage(), PHP_EOL; |
|||
} |
|||
``` |
|||
|
|||
### Parameters |
|||
|
|||
| Name | Type | Description | Notes | |
|||
| ------------- | ------------- | ------------- | ------------- | |
|||
| **volume_id** | [**mixed**](../Model/.md)| volume id | [optional] | |
|||
| **collection** | [**mixed**](../Model/.md)| optionally to speed up the lookup | [optional] | |
|||
| **file_id** | [**mixed**](../Model/.md)| If provided, this returns the fileId location and a JWT to update or delete the file. | [optional] | |
|||
| **read** | [**mixed**](../Model/.md)| works together with \"fileId\", if read=yes, JWT is generated for reads. | [optional] | |
|||
|
|||
### Return type |
|||
|
|||
**mixed** |
|||
|
|||
### Authorization |
|||
|
|||
No authorization required |
|||
|
|||
### HTTP request headers |
|||
|
|||
- **Content-Type**: Not defined |
|||
- **Accept**: `application/json` |
|||
|
|||
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) |
|||
[[Back to Model list]](../../README.md#models) |
|||
[[Back to README]](../../README.md) |
@ -0,0 +1,11 @@ |
|||
# # FileKey |
|||
|
|||
## Properties |
|||
|
|||
Name | Type | Description | Notes |
|||
------------ | ------------- | ------------- | ------------- |
|||
**count** | **mixed** | | [optional] |
|||
**fid** | **mixed** | | [optional] |
|||
**url** | **mixed** | | [optional] |
|||
|
|||
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) |
@ -0,0 +1,10 @@ |
|||
# # Location |
|||
|
|||
## Properties |
|||
|
|||
Name | Type | Description | Notes |
|||
------------ | ------------- | ------------- | ------------- |
|||
**public_url** | **mixed** | | [optional] |
|||
**url** | **mixed** | | [optional] |
|||
|
|||
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) |
@ -0,0 +1,57 @@ |
|||
#!/bin/sh |
|||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ |
|||
# |
|||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" |
|||
|
|||
git_user_id=$1 |
|||
git_repo_id=$2 |
|||
release_note=$3 |
|||
git_host=$4 |
|||
|
|||
if [ "$git_host" = "" ]; then |
|||
git_host="github.com" |
|||
echo "[INFO] No command line input provided. Set \$git_host to $git_host" |
|||
fi |
|||
|
|||
if [ "$git_user_id" = "" ]; then |
|||
git_user_id="GIT_USER_ID" |
|||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" |
|||
fi |
|||
|
|||
if [ "$git_repo_id" = "" ]; then |
|||
git_repo_id="GIT_REPO_ID" |
|||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" |
|||
fi |
|||
|
|||
if [ "$release_note" = "" ]; then |
|||
release_note="Minor update" |
|||
echo "[INFO] No command line input provided. Set \$release_note to $release_note" |
|||
fi |
|||
|
|||
# Initialize the local directory as a Git repository |
|||
git init |
|||
|
|||
# Adds the files in the local repository and stages them for commit. |
|||
git add . |
|||
|
|||
# Commits the tracked changes and prepares them to be pushed to a remote repository. |
|||
git commit -m "$release_note" |
|||
|
|||
# Sets the new remote |
|||
git_remote=$(git remote) |
|||
if [ "$git_remote" = "" ]; then # git remote not defined |
|||
|
|||
if [ "$GIT_TOKEN" = "" ]; then |
|||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." |
|||
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git |
|||
else |
|||
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git |
|||
fi |
|||
|
|||
fi |
|||
|
|||
git pull origin master |
|||
|
|||
# Pushes (Forces) the changes in the local repository up to the remote repository |
|||
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" |
|||
git push origin master 2>&1 | grep -v 'To https' |
@ -0,0 +1,897 @@ |
|||
<?php |
|||
/** |
|||
* DefaultApi |
|||
* PHP version 7.4 |
|||
* |
|||
* @category Class |
|||
* @package OpenAPI\Client |
|||
* @author OpenAPI Generator team |
|||
* @link https://openapi-generator.tech |
|||
*/ |
|||
|
|||
/** |
|||
* Seaweedfs Master Server API |
|||
* |
|||
* The Seaweedfs Master Server API allows you to store blobs |
|||
* |
|||
* The version of the OpenAPI document: 3.43.0 |
|||
* Generated by: https://openapi-generator.tech |
|||
* OpenAPI Generator version: 6.4.0 |
|||
*/ |
|||
|
|||
/** |
|||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). |
|||
* https://openapi-generator.tech |
|||
* Do not edit the class manually. |
|||
*/ |
|||
|
|||
namespace OpenAPI\Client\Api; |
|||
|
|||
use GuzzleHttp\Client; |
|||
use GuzzleHttp\ClientInterface; |
|||
use GuzzleHttp\Exception\ConnectException; |
|||
use GuzzleHttp\Exception\RequestException; |
|||
use GuzzleHttp\Psr7\MultipartStream; |
|||
use GuzzleHttp\Psr7\Request; |
|||
use GuzzleHttp\RequestOptions; |
|||
use OpenAPI\Client\ApiException; |
|||
use OpenAPI\Client\Configuration; |
|||
use OpenAPI\Client\HeaderSelector; |
|||
use OpenAPI\Client\ObjectSerializer; |
|||
|
|||
/** |
|||
* DefaultApi Class Doc Comment |
|||
* |
|||
* @category Class |
|||
* @package OpenAPI\Client |
|||
* @author OpenAPI Generator team |
|||
* @link https://openapi-generator.tech |
|||
*/ |
|||
class DefaultApi |
|||
{ |
|||
/** |
|||
* @var ClientInterface |
|||
*/ |
|||
protected $client; |
|||
|
|||
/** |
|||
* @var Configuration |
|||
*/ |
|||
protected $config; |
|||
|
|||
/** |
|||
* @var HeaderSelector |
|||
*/ |
|||
protected $headerSelector; |
|||
|
|||
/** |
|||
* @var int Host index |
|||
*/ |
|||
protected $hostIndex; |
|||
|
|||
/** @var string[] $contentTypes **/ |
|||
public const contentTypes = [ |
|||
'dirAssign' => [ |
|||
'application/json', |
|||
], |
|||
'dirLookup' => [ |
|||
'application/json', |
|||
], |
|||
]; |
|||
|
|||
/** |
|||
* @param ClientInterface $client |
|||
* @param Configuration $config |
|||
* @param HeaderSelector $selector |
|||
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec |
|||
*/ |
|||
public function __construct( |
|||
ClientInterface $client = null, |
|||
Configuration $config = null, |
|||
HeaderSelector $selector = null, |
|||
$hostIndex = 0 |
|||
) { |
|||
$this->client = $client ?: new Client(); |
|||
$this->config = $config ?: new Configuration(); |
|||
$this->headerSelector = $selector ?: new HeaderSelector(); |
|||
$this->hostIndex = $hostIndex; |
|||
} |
|||
|
|||
/** |
|||
* Set the host index |
|||
* |
|||
* @param int $hostIndex Host index (required) |
|||
*/ |
|||
public function setHostIndex($hostIndex): void |
|||
{ |
|||
$this->hostIndex = $hostIndex; |
|||
} |
|||
|
|||
/** |
|||
* Get the host index |
|||
* |
|||
* @return int Host index |
|||
*/ |
|||
public function getHostIndex() |
|||
{ |
|||
return $this->hostIndex; |
|||
} |
|||
|
|||
/** |
|||
* @return Configuration |
|||
*/ |
|||
public function getConfig() |
|||
{ |
|||
return $this->config; |
|||
} |
|||
|
|||
/** |
|||
* Operation dirAssign |
|||
* |
|||
* Assign a file key |
|||
* |
|||
* @param mixed $count how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 (optional) |
|||
* @param mixed $collection required collection name (optional) |
|||
* @param mixed $data_center preferred data center (optional) |
|||
* @param mixed $rack preferred rack (optional) |
|||
* @param mixed $data_node preferred volume server, e.g. 127.0.0.1:8080 (optional) |
|||
* @param mixed $disk If you have disks labelled, this must be supplied to specify the disk type to allocate on. (optional) |
|||
* @param mixed $replication replica placement strategy (optional) |
|||
* @param mixed $ttl file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year (optional) |
|||
* @param mixed $preallocate If no matching volumes, pre-allocate this number of bytes on disk for new volumes. (optional) |
|||
* @param mixed $memory_map_max_size_mb Only implemented for windows. Use memory mapped files with specified size for new volumes. (optional) |
|||
* @param mixed $writable_volume_count If no matching volumes, create specified number of new volumes. (optional) |
|||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['dirAssign'] to see the possible values for this operation |
|||
* |
|||
* @throws \OpenAPI\Client\ApiException on non-2xx response |
|||
* @throws \InvalidArgumentException |
|||
* @return \OpenAPI\Client\Model\FileKey |
|||
*/ |
|||
public function dirAssign($count = null, $collection = null, $data_center = null, $rack = null, $data_node = null, $disk = null, $replication = null, $ttl = null, $preallocate = null, $memory_map_max_size_mb = null, $writable_volume_count = null, string $contentType = self::contentTypes['dirAssign'][0]) |
|||
{ |
|||
list($response) = $this->dirAssignWithHttpInfo($count, $collection, $data_center, $rack, $data_node, $disk, $replication, $ttl, $preallocate, $memory_map_max_size_mb, $writable_volume_count, $contentType); |
|||
return $response; |
|||
} |
|||
|
|||
/** |
|||
* Operation dirAssignWithHttpInfo |
|||
* |
|||
* Assign a file key |
|||
* |
|||
* @param mixed $count how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 (optional) |
|||
* @param mixed $collection required collection name (optional) |
|||
* @param mixed $data_center preferred data center (optional) |
|||
* @param mixed $rack preferred rack (optional) |
|||
* @param mixed $data_node preferred volume server, e.g. 127.0.0.1:8080 (optional) |
|||
* @param mixed $disk If you have disks labelled, this must be supplied to specify the disk type to allocate on. (optional) |
|||
* @param mixed $replication replica placement strategy (optional) |
|||
* @param mixed $ttl file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year (optional) |
|||
* @param mixed $preallocate If no matching volumes, pre-allocate this number of bytes on disk for new volumes. (optional) |
|||
* @param mixed $memory_map_max_size_mb Only implemented for windows. Use memory mapped files with specified size for new volumes. (optional) |
|||
* @param mixed $writable_volume_count If no matching volumes, create specified number of new volumes. (optional) |
|||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['dirAssign'] to see the possible values for this operation |
|||
* |
|||
* @throws \OpenAPI\Client\ApiException on non-2xx response |
|||
* @throws \InvalidArgumentException |
|||
* @return array of \OpenAPI\Client\Model\FileKey, HTTP status code, HTTP response headers (array of strings) |
|||
*/ |
|||
public function dirAssignWithHttpInfo($count = null, $collection = null, $data_center = null, $rack = null, $data_node = null, $disk = null, $replication = null, $ttl = null, $preallocate = null, $memory_map_max_size_mb = null, $writable_volume_count = null, string $contentType = self::contentTypes['dirAssign'][0]) |
|||
{ |
|||
$request = $this->dirAssignRequest($count, $collection, $data_center, $rack, $data_node, $disk, $replication, $ttl, $preallocate, $memory_map_max_size_mb, $writable_volume_count, $contentType); |
|||
|
|||
try { |
|||
$options = $this->createHttpClientOption(); |
|||
try { |
|||
$response = $this->client->send($request, $options); |
|||
} catch (RequestException $e) { |
|||
throw new ApiException( |
|||
"[{$e->getCode()}] {$e->getMessage()}", |
|||
(int) $e->getCode(), |
|||
$e->getResponse() ? $e->getResponse()->getHeaders() : null, |
|||
$e->getResponse() ? (string) $e->getResponse()->getBody() : null |
|||
); |
|||
} catch (ConnectException $e) { |
|||
throw new ApiException( |
|||
"[{$e->getCode()}] {$e->getMessage()}", |
|||
(int) $e->getCode(), |
|||
null, |
|||
null |
|||
); |
|||
} |
|||
|
|||
$statusCode = $response->getStatusCode(); |
|||
|
|||
if ($statusCode < 200 || $statusCode > 299) { |
|||
throw new ApiException( |
|||
sprintf( |
|||
'[%d] Error connecting to the API (%s)', |
|||
$statusCode, |
|||
(string) $request->getUri() |
|||
), |
|||
$statusCode, |
|||
$response->getHeaders(), |
|||
(string) $response->getBody() |
|||
); |
|||
} |
|||
|
|||
switch($statusCode) { |
|||
case 200: |
|||
if ('\OpenAPI\Client\Model\FileKey' === '\SplFileObject') { |
|||
$content = $response->getBody(); //stream goes to serializer
|
|||
} else { |
|||
$content = (string) $response->getBody(); |
|||
if ('\OpenAPI\Client\Model\FileKey' !== 'string') { |
|||
$content = json_decode($content); |
|||
} |
|||
} |
|||
|
|||
return [ |
|||
ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\FileKey', []), |
|||
$response->getStatusCode(), |
|||
$response->getHeaders() |
|||
]; |
|||
} |
|||
|
|||
$returnType = '\OpenAPI\Client\Model\FileKey'; |
|||
if ($returnType === '\SplFileObject') { |
|||
$content = $response->getBody(); //stream goes to serializer
|
|||
} else { |
|||
$content = (string) $response->getBody(); |
|||
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(), |
|||
'\OpenAPI\Client\Model\FileKey', |
|||
$e->getResponseHeaders() |
|||
); |
|||
$e->setResponseObject($data); |
|||
break; |
|||
} |
|||
throw $e; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Operation dirAssignAsync |
|||
* |
|||
* Assign a file key |
|||
* |
|||
* @param mixed $count how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 (optional) |
|||
* @param mixed $collection required collection name (optional) |
|||
* @param mixed $data_center preferred data center (optional) |
|||
* @param mixed $rack preferred rack (optional) |
|||
* @param mixed $data_node preferred volume server, e.g. 127.0.0.1:8080 (optional) |
|||
* @param mixed $disk If you have disks labelled, this must be supplied to specify the disk type to allocate on. (optional) |
|||
* @param mixed $replication replica placement strategy (optional) |
|||
* @param mixed $ttl file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year (optional) |
|||
* @param mixed $preallocate If no matching volumes, pre-allocate this number of bytes on disk for new volumes. (optional) |
|||
* @param mixed $memory_map_max_size_mb Only implemented for windows. Use memory mapped files with specified size for new volumes. (optional) |
|||
* @param mixed $writable_volume_count If no matching volumes, create specified number of new volumes. (optional) |
|||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['dirAssign'] to see the possible values for this operation |
|||
* |
|||
* @throws \InvalidArgumentException |
|||
* @return \GuzzleHttp\Promise\PromiseInterface |
|||
*/ |
|||
public function dirAssignAsync($count = null, $collection = null, $data_center = null, $rack = null, $data_node = null, $disk = null, $replication = null, $ttl = null, $preallocate = null, $memory_map_max_size_mb = null, $writable_volume_count = null, string $contentType = self::contentTypes['dirAssign'][0]) |
|||
{ |
|||
return $this->dirAssignAsyncWithHttpInfo($count, $collection, $data_center, $rack, $data_node, $disk, $replication, $ttl, $preallocate, $memory_map_max_size_mb, $writable_volume_count, $contentType) |
|||
->then( |
|||
function ($response) { |
|||
return $response[0]; |
|||
} |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* Operation dirAssignAsyncWithHttpInfo |
|||
* |
|||
* Assign a file key |
|||
* |
|||
* @param mixed $count how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 (optional) |
|||
* @param mixed $collection required collection name (optional) |
|||
* @param mixed $data_center preferred data center (optional) |
|||
* @param mixed $rack preferred rack (optional) |
|||
* @param mixed $data_node preferred volume server, e.g. 127.0.0.1:8080 (optional) |
|||
* @param mixed $disk If you have disks labelled, this must be supplied to specify the disk type to allocate on. (optional) |
|||
* @param mixed $replication replica placement strategy (optional) |
|||
* @param mixed $ttl file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year (optional) |
|||
* @param mixed $preallocate If no matching volumes, pre-allocate this number of bytes on disk for new volumes. (optional) |
|||
* @param mixed $memory_map_max_size_mb Only implemented for windows. Use memory mapped files with specified size for new volumes. (optional) |
|||
* @param mixed $writable_volume_count If no matching volumes, create specified number of new volumes. (optional) |
|||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['dirAssign'] to see the possible values for this operation |
|||
* |
|||
* @throws \InvalidArgumentException |
|||
* @return \GuzzleHttp\Promise\PromiseInterface |
|||
*/ |
|||
public function dirAssignAsyncWithHttpInfo($count = null, $collection = null, $data_center = null, $rack = null, $data_node = null, $disk = null, $replication = null, $ttl = null, $preallocate = null, $memory_map_max_size_mb = null, $writable_volume_count = null, string $contentType = self::contentTypes['dirAssign'][0]) |
|||
{ |
|||
$returnType = '\OpenAPI\Client\Model\FileKey'; |
|||
$request = $this->dirAssignRequest($count, $collection, $data_center, $rack, $data_node, $disk, $replication, $ttl, $preallocate, $memory_map_max_size_mb, $writable_volume_count, $contentType); |
|||
|
|||
return $this->client |
|||
->sendAsync($request, $this->createHttpClientOption()) |
|||
->then( |
|||
function ($response) use ($returnType) { |
|||
if ($returnType === '\SplFileObject') { |
|||
$content = $response->getBody(); //stream goes to serializer
|
|||
} else { |
|||
$content = (string) $response->getBody(); |
|||
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(), |
|||
(string) $response->getBody() |
|||
); |
|||
} |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* Create request for operation 'dirAssign' |
|||
* |
|||
* @param mixed $count how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2 (optional) |
|||
* @param mixed $collection required collection name (optional) |
|||
* @param mixed $data_center preferred data center (optional) |
|||
* @param mixed $rack preferred rack (optional) |
|||
* @param mixed $data_node preferred volume server, e.g. 127.0.0.1:8080 (optional) |
|||
* @param mixed $disk If you have disks labelled, this must be supplied to specify the disk type to allocate on. (optional) |
|||
* @param mixed $replication replica placement strategy (optional) |
|||
* @param mixed $ttl file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year (optional) |
|||
* @param mixed $preallocate If no matching volumes, pre-allocate this number of bytes on disk for new volumes. (optional) |
|||
* @param mixed $memory_map_max_size_mb Only implemented for windows. Use memory mapped files with specified size for new volumes. (optional) |
|||
* @param mixed $writable_volume_count If no matching volumes, create specified number of new volumes. (optional) |
|||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['dirAssign'] to see the possible values for this operation |
|||
* |
|||
* @throws \InvalidArgumentException |
|||
* @return \GuzzleHttp\Psr7\Request |
|||
*/ |
|||
public function dirAssignRequest($count = null, $collection = null, $data_center = null, $rack = null, $data_node = null, $disk = null, $replication = null, $ttl = null, $preallocate = null, $memory_map_max_size_mb = null, $writable_volume_count = null, string $contentType = self::contentTypes['dirAssign'][0]) |
|||
{ |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
$resourcePath = '/dir/assign'; |
|||
$formParams = []; |
|||
$queryParams = []; |
|||
$headerParams = []; |
|||
$httpBody = ''; |
|||
$multipart = false; |
|||
|
|||
// query params
|
|||
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( |
|||
$count, |
|||
'count', // param base name
|
|||
'mixed', // openApiType
|
|||
'form', // style
|
|||
true, // explode
|
|||
false // required
|
|||
) ?? []); |
|||
// query params
|
|||
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( |
|||
$collection, |
|||
'collection', // param base name
|
|||
'mixed', // openApiType
|
|||
'form', // style
|
|||
true, // explode
|
|||
false // required
|
|||
) ?? []); |
|||
// query params
|
|||
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( |
|||
$data_center, |
|||
'dataCenter', // param base name
|
|||
'mixed', // openApiType
|
|||
'form', // style
|
|||
true, // explode
|
|||
false // required
|
|||
) ?? []); |
|||
// query params
|
|||
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( |
|||
$rack, |
|||
'rack', // param base name
|
|||
'mixed', // openApiType
|
|||
'form', // style
|
|||
true, // explode
|
|||
false // required
|
|||
) ?? []); |
|||
// query params
|
|||
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( |
|||
$data_node, |
|||
'dataNode', // param base name
|
|||
'mixed', // openApiType
|
|||
'form', // style
|
|||
true, // explode
|
|||
false // required
|
|||
) ?? []); |
|||
// query params
|
|||
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( |
|||
$disk, |
|||
'disk', // param base name
|
|||
'mixed', // openApiType
|
|||
'form', // style
|
|||
true, // explode
|
|||
false // required
|
|||
) ?? []); |
|||
// query params
|
|||
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( |
|||
$replication, |
|||
'replication', // param base name
|
|||
'mixed', // openApiType
|
|||
'form', // style
|
|||
true, // explode
|
|||
false // required
|
|||
) ?? []); |
|||
// query params
|
|||
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( |
|||
$ttl, |
|||
'ttl', // param base name
|
|||
'mixed', // openApiType
|
|||
'form', // style
|
|||
true, // explode
|
|||
false // required
|
|||
) ?? []); |
|||
// query params
|
|||
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( |
|||
$preallocate, |
|||
'preallocate', // param base name
|
|||
'mixed', // openApiType
|
|||
'form', // style
|
|||
true, // explode
|
|||
false // required
|
|||
) ?? []); |
|||
// query params
|
|||
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( |
|||
$memory_map_max_size_mb, |
|||
'memoryMapMaxSizeMb', // param base name
|
|||
'mixed', // openApiType
|
|||
'form', // style
|
|||
true, // explode
|
|||
false // required
|
|||
) ?? []); |
|||
// query params
|
|||
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( |
|||
$writable_volume_count, |
|||
'writableVolumeCount', // param base name
|
|||
'mixed', // openApiType
|
|||
'form', // style
|
|||
true, // explode
|
|||
false // required
|
|||
) ?? []); |
|||
|
|||
|
|||
|
|||
|
|||
$headers = $this->headerSelector->selectHeaders( |
|||
['application/json', ], |
|||
$contentType, |
|||
$multipart |
|||
); |
|||
|
|||
// for model (json/xml)
|
|||
if (count($formParams) > 0) { |
|||
if ($multipart) { |
|||
$multipartContents = []; |
|||
foreach ($formParams as $formParamName => $formParamValue) { |
|||
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; |
|||
foreach ($formParamValueItems as $formParamValueItem) { |
|||
$multipartContents[] = [ |
|||
'name' => $formParamName, |
|||
'contents' => $formParamValueItem |
|||
]; |
|||
} |
|||
} |
|||
// for HTTP post (form)
|
|||
$httpBody = new MultipartStream($multipartContents); |
|||
|
|||
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) { |
|||
# if Content-Type contains "application/json", json_encode the form parameters
|
|||
$httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); |
|||
} else { |
|||
// for HTTP post (form)
|
|||
$httpBody = ObjectSerializer::buildQuery($formParams); |
|||
} |
|||
} |
|||
|
|||
|
|||
$defaultHeaders = []; |
|||
if ($this->config->getUserAgent()) { |
|||
$defaultHeaders['User-Agent'] = $this->config->getUserAgent(); |
|||
} |
|||
|
|||
$headers = array_merge( |
|||
$defaultHeaders, |
|||
$headerParams, |
|||
$headers |
|||
); |
|||
|
|||
$operationHost = $this->config->getHost(); |
|||
$query = ObjectSerializer::buildQuery($queryParams); |
|||
return new Request( |
|||
'GET', |
|||
$operationHost . $resourcePath . ($query ? "?{$query}" : ''), |
|||
$headers, |
|||
$httpBody |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* Operation dirLookup |
|||
* |
|||
* Lookup volume |
|||
* |
|||
* @param mixed $volume_id volume id (optional) |
|||
* @param mixed $collection optionally to speed up the lookup (optional) |
|||
* @param mixed $file_id If provided, this returns the fileId location and a JWT to update or delete the file. (optional) |
|||
* @param mixed $read works together with \"fileId\", if read=yes, JWT is generated for reads. (optional)
|
|||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['dirLookup'] to see the possible values for this operation |
|||
* |
|||
* @throws \OpenAPI\Client\ApiException on non-2xx response |
|||
* @throws \InvalidArgumentException |
|||
* @return mixed |
|||
*/ |
|||
public function dirLookup($volume_id = null, $collection = null, $file_id = null, $read = null, string $contentType = self::contentTypes['dirLookup'][0]) |
|||
{ |
|||
list($response) = $this->dirLookupWithHttpInfo($volume_id, $collection, $file_id, $read, $contentType); |
|||
return $response; |
|||
} |
|||
|
|||
/** |
|||
* Operation dirLookupWithHttpInfo |
|||
* |
|||
* Lookup volume |
|||
* |
|||
* @param mixed $volume_id volume id (optional) |
|||
* @param mixed $collection optionally to speed up the lookup (optional) |
|||
* @param mixed $file_id If provided, this returns the fileId location and a JWT to update or delete the file. (optional) |
|||
* @param mixed $read works together with \"fileId\", if read=yes, JWT is generated for reads. (optional)
|
|||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['dirLookup'] to see the possible values for this operation |
|||
* |
|||
* @throws \OpenAPI\Client\ApiException on non-2xx response |
|||
* @throws \InvalidArgumentException |
|||
* @return array of mixed, HTTP status code, HTTP response headers (array of strings) |
|||
*/ |
|||
public function dirLookupWithHttpInfo($volume_id = null, $collection = null, $file_id = null, $read = null, string $contentType = self::contentTypes['dirLookup'][0]) |
|||
{ |
|||
$request = $this->dirLookupRequest($volume_id, $collection, $file_id, $read, $contentType); |
|||
|
|||
try { |
|||
$options = $this->createHttpClientOption(); |
|||
try { |
|||
$response = $this->client->send($request, $options); |
|||
} catch (RequestException $e) { |
|||
throw new ApiException( |
|||
"[{$e->getCode()}] {$e->getMessage()}", |
|||
(int) $e->getCode(), |
|||
$e->getResponse() ? $e->getResponse()->getHeaders() : null, |
|||
$e->getResponse() ? (string) $e->getResponse()->getBody() : null |
|||
); |
|||
} catch (ConnectException $e) { |
|||
throw new ApiException( |
|||
"[{$e->getCode()}] {$e->getMessage()}", |
|||
(int) $e->getCode(), |
|||
null, |
|||
null |
|||
); |
|||
} |
|||
|
|||
$statusCode = $response->getStatusCode(); |
|||
|
|||
if ($statusCode < 200 || $statusCode > 299) { |
|||
throw new ApiException( |
|||
sprintf( |
|||
'[%d] Error connecting to the API (%s)', |
|||
$statusCode, |
|||
(string) $request->getUri() |
|||
), |
|||
$statusCode, |
|||
$response->getHeaders(), |
|||
(string) $response->getBody() |
|||
); |
|||
} |
|||
|
|||
switch($statusCode) { |
|||
case 200: |
|||
if ('mixed' === '\SplFileObject') { |
|||
$content = $response->getBody(); //stream goes to serializer
|
|||
} else { |
|||
$content = (string) $response->getBody(); |
|||
if ('mixed' !== 'string') { |
|||
$content = json_decode($content); |
|||
} |
|||
} |
|||
|
|||
return [ |
|||
ObjectSerializer::deserialize($content, 'mixed', []), |
|||
$response->getStatusCode(), |
|||
$response->getHeaders() |
|||
]; |
|||
} |
|||
|
|||
$returnType = 'mixed'; |
|||
if ($returnType === '\SplFileObject') { |
|||
$content = $response->getBody(); //stream goes to serializer
|
|||
} else { |
|||
$content = (string) $response->getBody(); |
|||
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(), |
|||
'mixed', |
|||
$e->getResponseHeaders() |
|||
); |
|||
$e->setResponseObject($data); |
|||
break; |
|||
} |
|||
throw $e; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Operation dirLookupAsync |
|||
* |
|||
* Lookup volume |
|||
* |
|||
* @param mixed $volume_id volume id (optional) |
|||
* @param mixed $collection optionally to speed up the lookup (optional) |
|||
* @param mixed $file_id If provided, this returns the fileId location and a JWT to update or delete the file. (optional) |
|||
* @param mixed $read works together with \"fileId\", if read=yes, JWT is generated for reads. (optional)
|
|||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['dirLookup'] to see the possible values for this operation |
|||
* |
|||
* @throws \InvalidArgumentException |
|||
* @return \GuzzleHttp\Promise\PromiseInterface |
|||
*/ |
|||
public function dirLookupAsync($volume_id = null, $collection = null, $file_id = null, $read = null, string $contentType = self::contentTypes['dirLookup'][0]) |
|||
{ |
|||
return $this->dirLookupAsyncWithHttpInfo($volume_id, $collection, $file_id, $read, $contentType) |
|||
->then( |
|||
function ($response) { |
|||
return $response[0]; |
|||
} |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* Operation dirLookupAsyncWithHttpInfo |
|||
* |
|||
* Lookup volume |
|||
* |
|||
* @param mixed $volume_id volume id (optional) |
|||
* @param mixed $collection optionally to speed up the lookup (optional) |
|||
* @param mixed $file_id If provided, this returns the fileId location and a JWT to update or delete the file. (optional) |
|||
* @param mixed $read works together with \"fileId\", if read=yes, JWT is generated for reads. (optional)
|
|||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['dirLookup'] to see the possible values for this operation |
|||
* |
|||
* @throws \InvalidArgumentException |
|||
* @return \GuzzleHttp\Promise\PromiseInterface |
|||
*/ |
|||
public function dirLookupAsyncWithHttpInfo($volume_id = null, $collection = null, $file_id = null, $read = null, string $contentType = self::contentTypes['dirLookup'][0]) |
|||
{ |
|||
$returnType = 'mixed'; |
|||
$request = $this->dirLookupRequest($volume_id, $collection, $file_id, $read, $contentType); |
|||
|
|||
return $this->client |
|||
->sendAsync($request, $this->createHttpClientOption()) |
|||
->then( |
|||
function ($response) use ($returnType) { |
|||
if ($returnType === '\SplFileObject') { |
|||
$content = $response->getBody(); //stream goes to serializer
|
|||
} else { |
|||
$content = (string) $response->getBody(); |
|||
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(), |
|||
(string) $response->getBody() |
|||
); |
|||
} |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* Create request for operation 'dirLookup' |
|||
* |
|||
* @param mixed $volume_id volume id (optional) |
|||
* @param mixed $collection optionally to speed up the lookup (optional) |
|||
* @param mixed $file_id If provided, this returns the fileId location and a JWT to update or delete the file. (optional) |
|||
* @param mixed $read works together with \"fileId\", if read=yes, JWT is generated for reads. (optional)
|
|||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['dirLookup'] to see the possible values for this operation |
|||
* |
|||
* @throws \InvalidArgumentException |
|||
* @return \GuzzleHttp\Psr7\Request |
|||
*/ |
|||
public function dirLookupRequest($volume_id = null, $collection = null, $file_id = null, $read = null, string $contentType = self::contentTypes['dirLookup'][0]) |
|||
{ |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
$resourcePath = '/dir/lookup'; |
|||
$formParams = []; |
|||
$queryParams = []; |
|||
$headerParams = []; |
|||
$httpBody = ''; |
|||
$multipart = false; |
|||
|
|||
// query params
|
|||
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( |
|||
$volume_id, |
|||
'volumeId', // param base name
|
|||
'mixed', // openApiType
|
|||
'form', // style
|
|||
true, // explode
|
|||
false // required
|
|||
) ?? []); |
|||
// query params
|
|||
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( |
|||
$collection, |
|||
'collection', // param base name
|
|||
'mixed', // openApiType
|
|||
'form', // style
|
|||
true, // explode
|
|||
false // required
|
|||
) ?? []); |
|||
// query params
|
|||
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( |
|||
$file_id, |
|||
'fileId', // param base name
|
|||
'mixed', // openApiType
|
|||
'form', // style
|
|||
true, // explode
|
|||
false // required
|
|||
) ?? []); |
|||
// query params
|
|||
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( |
|||
$read, |
|||
'read', // param base name
|
|||
'mixed', // openApiType
|
|||
'form', // style
|
|||
true, // explode
|
|||
false // required
|
|||
) ?? []); |
|||
|
|||
|
|||
|
|||
|
|||
$headers = $this->headerSelector->selectHeaders( |
|||
['application/json', ], |
|||
$contentType, |
|||
$multipart |
|||
); |
|||
|
|||
// for model (json/xml)
|
|||
if (count($formParams) > 0) { |
|||
if ($multipart) { |
|||
$multipartContents = []; |
|||
foreach ($formParams as $formParamName => $formParamValue) { |
|||
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; |
|||
foreach ($formParamValueItems as $formParamValueItem) { |
|||
$multipartContents[] = [ |
|||
'name' => $formParamName, |
|||
'contents' => $formParamValueItem |
|||
]; |
|||
} |
|||
} |
|||
// for HTTP post (form)
|
|||
$httpBody = new MultipartStream($multipartContents); |
|||
|
|||
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) { |
|||
# if Content-Type contains "application/json", json_encode the form parameters
|
|||
$httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); |
|||
} else { |
|||
// for HTTP post (form)
|
|||
$httpBody = ObjectSerializer::buildQuery($formParams); |
|||
} |
|||
} |
|||
|
|||
|
|||
$defaultHeaders = []; |
|||
if ($this->config->getUserAgent()) { |
|||
$defaultHeaders['User-Agent'] = $this->config->getUserAgent(); |
|||
} |
|||
|
|||
$headers = array_merge( |
|||
$defaultHeaders, |
|||
$headerParams, |
|||
$headers |
|||
); |
|||
|
|||
$operationHost = $this->config->getHost(); |
|||
$query = ObjectSerializer::buildQuery($queryParams); |
|||
return new Request( |
|||
'GET', |
|||
$operationHost . $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; |
|||
} |
|||
} |
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue