From ed82e1834e8dd64ad2ef5de3bad36a5a7820159f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A4=91=ED=9B=88?= Date: Thu, 18 Aug 2016 15:48:14 +0900 Subject: [PATCH] changed search/replace operation tags to wfs, from ops - bumped version to 0.8.1 - no more OpsApi class in generated codes. Use WfsApi instead --- README-API.md | 6 +- api-spec/swagger.json | 4 +- api-spec/swagger.yaml | 4 +- builder/templates/package.mustache | 2 +- docs/OpsApi.md | 139 --------------------- docs/WfsApi.md | 131 +++++++++++++++++++ package.json | 2 +- src/api/OpsApi.js | 194 ----------------------------- src/api/WfsApi.js | 133 ++++++++++++++++++++ src/index.js | 11 +- test/api/OpsApi.spec.js | 84 ------------- test/api/WfsApi.spec.js | 20 +++ 12 files changed, 296 insertions(+), 434 deletions(-) delete mode 100644 docs/OpsApi.md delete mode 100644 src/api/OpsApi.js delete mode 100644 test/api/OpsApi.spec.js diff --git a/README-API.md b/README-API.md index 1d709d0..92ff592 100644 --- a/README-API.md +++ b/README-API.md @@ -4,7 +4,7 @@ This SDK Contains automatically generated sources & documents with the [Swagger - API version: 0.7.1 - Package version: 0.7.1 -- Build date: 2016-08-09T17:23:32.460+09:00 +- Build date: 2016-08-18T15:47:36.665+09:00 - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Getting Started @@ -54,8 +54,6 @@ Class | Method | HTTP request | Description *WebidaRestfulApi.AuthApi* | [**getInfo**](docs/AuthApi.md#getInfo) | **GET** /auth/info | *WebidaRestfulApi.AuthApi* | [**issueToken**](docs/AuthApi.md#issueToken) | **POST** /auth/token | *WebidaRestfulApi.AuthApi* | [**login**](docs/AuthApi.md#login) | **POST** /auth/login | -*WebidaRestfulApi.OpsApi* | [**replace**](docs/OpsApi.md#replace) | **POST** /wfs/{wfsId}/ops/replace | -*WebidaRestfulApi.OpsApi* | [**search**](docs/OpsApi.md#search) | **GET** /wfs/{wfsId}/ops/search | *WebidaRestfulApi.RemotesApi* | [**findRemoteAccesses**](docs/RemotesApi.md#findRemoteAccesses) | **GET** /remotes | *WebidaRestfulApi.RemotesApi* | [**putRemoteAccess**](docs/RemotesApi.md#putRemoteAccess) | **PUT** /remotes | *WebidaRestfulApi.RemotesApi* | [**removeRemoteAccess**](docs/RemotesApi.md#removeRemoteAccess) | **DELETE** /remotes | @@ -67,6 +65,8 @@ Class | Method | HTTP request | Description *WebidaRestfulApi.WfsApi* | [**move**](docs/WfsApi.md#move) | **POST** /wfs/{wfsId}/any/{wfsPath} | *WebidaRestfulApi.WfsApi* | [**readFile**](docs/WfsApi.md#readFile) | **GET** /wfs/{wfsId}/file/{wfsPath} | *WebidaRestfulApi.WfsApi* | [**remove**](docs/WfsApi.md#remove) | **DELETE** /wfs/{wfsId}/any/{wfsPath} | +*WebidaRestfulApi.WfsApi* | [**replace**](docs/WfsApi.md#replace) | **POST** /wfs/{wfsId}/ops/replace | +*WebidaRestfulApi.WfsApi* | [**search**](docs/WfsApi.md#search) | **GET** /wfs/{wfsId}/ops/search | *WebidaRestfulApi.WfsApi* | [**stat**](docs/WfsApi.md#stat) | **GET** /wfs/{wfsId}/any/{wfsPath} | *WebidaRestfulApi.WfsApi* | [**writeFile**](docs/WfsApi.md#writeFile) | **PUT** /wfs/{wfsId}/file/{wfsPath} | *WebidaRestfulApi.WorkspaceApi* | [**cancel**](docs/WorkspaceApi.md#cancel) | **DELETE** /workspaces/{workspaceId}/procs | diff --git a/api-spec/swagger.json b/api-spec/swagger.json index 06ed868..0acd18d 100644 --- a/api-spec/swagger.json +++ b/api-spec/swagger.json @@ -811,7 +811,7 @@ }, "/wfs/{wfsId}/ops/replace" : { "post" : { - "tags" : [ "ops" ], + "tags" : [ "wfs" ], "description" : "replace file contents with regex matching", "operationId" : "replace", "parameters" : [ { @@ -872,7 +872,7 @@ }, "/wfs/{wfsId}/ops/search" : { "get" : { - "tags" : [ "ops" ], + "tags" : [ "wfs" ], "description" : "search files in some path, with given pattern", "operationId" : "search", "parameters" : [ { diff --git a/api-spec/swagger.yaml b/api-spec/swagger.yaml index 167e958..440922c 100644 --- a/api-spec/swagger.yaml +++ b/api-spec/swagger.yaml @@ -393,7 +393,7 @@ paths: /wfs/{wfsId}/ops/search: get: x-handler: handlers/wfs/search.js - tags: ["ops"] + tags: ["wfs"] description: search files in some path, with given pattern operationId: search security: @@ -421,7 +421,7 @@ paths: /wfs/{wfsId}/ops/replace: post: x-handler: handlers/wfs/replace.js - tags: ["ops"] + tags: ["wfs"] description: replace file contents with regex matching operationId: replace security: diff --git a/builder/templates/package.mustache b/builder/templates/package.mustache index 1dba69a..6972ddd 100644 --- a/builder/templates/package.mustache +++ b/builder/templates/package.mustache @@ -1,6 +1,6 @@ { "name": "webida-restful-api", - "version": "0.8.0", + "version": "0.8.1", "description": "Webida Restful API Spec & generated clients", "license": "Apache-2.0", "main": "{{sourceFolder}}{{#invokerPackage}}/{{invokerPackage}}{{/invokerPackage}}/index.js", diff --git a/docs/OpsApi.md b/docs/OpsApi.md deleted file mode 100644 index d841f69..0000000 --- a/docs/OpsApi.md +++ /dev/null @@ -1,139 +0,0 @@ -# WebidaRestfulApi.OpsApi - -All URIs are relative to *https://localhost/api* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**replace**](OpsApi.md#replace) | **POST** /wfs/{wfsId}/ops/replace | -[**search**](OpsApi.md#search) | **GET** /wfs/{wfsId}/ops/search | - - - -# **replace** -> RestOK replace(wfsId, wfsPathList, patternreplaceTo, opts) - - - -replace file contents with regex matching - -### Example -```javascript -var WebidaRestfulApi = require('webida_restful_api'); -var defaultClient = WebidaRestfulApi.ApiClient.default; - -// Configure API key authorization: webida-simple-auth -var webida-simple-auth = defaultClient.authentications['webida-simple-auth']; -webida-simple-auth.apiKey = 'YOUR API KEY'; -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//webida-simple-auth.apiKeyPrefix = 'Token'; - -var apiInstance = new WebidaRestfulApi.OpsApi(); - -var wfsId = "wfsId_example"; // String | webida file system id (same to workspace id) to access. - -var wfsPathList = ["wfsPathList_example"]; // [String] | array of wfsPath, without heading /. - -var pattern = "pattern_example"; // String | regex pattern to match in search or replace. In replace operation, pattern should be same to the parttern in search operation - -var replaceTo = "replaceTo_example"; // String | string to replace with - -var opts = { - 'ignoreCase': false // Boolean | regex matching option to ignore case. In replace operation, this option should be same to one used in search operation -}; - -var callback = function(error, data, response) { - if (error) { - console.error(error); - } else { - console.log('API called successfully. Returned data: ' + data); - } -}; -apiInstance.replace(wfsId, wfsPathList, patternreplaceTo, opts, callback); -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **wfsId** | **String**| webida file system id (same to workspace id) to access. | - **wfsPathList** | [**[String]**](String.md)| array of wfsPath, without heading /. | - **pattern** | **String**| regex pattern to match in search or replace. In replace operation, pattern should be same to the parttern in search operation | - **replaceTo** | **String**| string to replace with | - **ignoreCase** | **Boolean**| regex matching option to ignore case. In replace operation, this option should be same to one used in search operation | [optional] [default to false] - -### Return type - -[**RestOK**](RestOK.md) - -### Authorization - -[webida-simple-auth](../README.md#webida-simple-auth) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json, application/octet-stream - - -# **search** -> {'String': [Match]} search(wfsId, wfsPathList, pattern, opts) - - - -search files in some path, with given pattern - -### Example -```javascript -var WebidaRestfulApi = require('webida_restful_api'); -var defaultClient = WebidaRestfulApi.ApiClient.default; - -// Configure API key authorization: webida-simple-auth -var webida-simple-auth = defaultClient.authentications['webida-simple-auth']; -webida-simple-auth.apiKey = 'YOUR API KEY'; -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//webida-simple-auth.apiKeyPrefix = 'Token'; - -var apiInstance = new WebidaRestfulApi.OpsApi(); - -var wfsId = "wfsId_example"; // String | webida file system id (same to workspace id) to access. - -var wfsPathList = ["wfsPathList_example"]; // [String] | array of wfsPath, without heading /. - -var pattern = "pattern_example"; // String | regex pattern to match in search or replace. In replace operation, pattern should be same to the parttern in search operation - -var opts = { - 'ignoreCase': false // Boolean | regex matching option to ignore case. In replace operation, this option should be same to one used in search operation -}; - -var callback = function(error, data, response) { - if (error) { - console.error(error); - } else { - console.log('API called successfully. Returned data: ' + data); - } -}; -apiInstance.search(wfsId, wfsPathList, pattern, opts, callback); -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **wfsId** | **String**| webida file system id (same to workspace id) to access. | - **wfsPathList** | [**[String]**](String.md)| array of wfsPath, without heading /. | - **pattern** | **String**| regex pattern to match in search or replace. In replace operation, pattern should be same to the parttern in search operation | - **ignoreCase** | **Boolean**| regex matching option to ignore case. In replace operation, this option should be same to one used in search operation | [optional] [default to false] - -### Return type - -**{'String': [Match]}** - -### Authorization - -[webida-simple-auth](../README.md#webida-simple-auth) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json, application/octet-stream - diff --git a/docs/WfsApi.md b/docs/WfsApi.md index 8fd685d..51ea6e0 100644 --- a/docs/WfsApi.md +++ b/docs/WfsApi.md @@ -10,6 +10,8 @@ Method | HTTP request | Description [**move**](WfsApi.md#move) | **POST** /wfs/{wfsId}/any/{wfsPath} | [**readFile**](WfsApi.md#readFile) | **GET** /wfs/{wfsId}/file/{wfsPath} | [**remove**](WfsApi.md#remove) | **DELETE** /wfs/{wfsId}/any/{wfsPath} | +[**replace**](WfsApi.md#replace) | **POST** /wfs/{wfsId}/ops/replace | +[**search**](WfsApi.md#search) | **GET** /wfs/{wfsId}/ops/search | [**stat**](WfsApi.md#stat) | **GET** /wfs/{wfsId}/any/{wfsPath} | [**writeFile**](WfsApi.md#writeFile) | **PUT** /wfs/{wfsId}/file/{wfsPath} | @@ -376,6 +378,135 @@ Name | Type | Description | Notes [webida-simple-auth](../README.md#webida-simple-auth) +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json, application/octet-stream + + +# **replace** +> RestOK replace(wfsId, wfsPathList, patternreplaceTo, opts) + + + +replace file contents with regex matching + +### Example +```javascript +var WebidaRestfulApi = require('webida_restful_api'); +var defaultClient = WebidaRestfulApi.ApiClient.default; + +// Configure API key authorization: webida-simple-auth +var webida-simple-auth = defaultClient.authentications['webida-simple-auth']; +webida-simple-auth.apiKey = 'YOUR API KEY'; +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//webida-simple-auth.apiKeyPrefix = 'Token'; + +var apiInstance = new WebidaRestfulApi.WfsApi(); + +var wfsId = "wfsId_example"; // String | webida file system id (same to workspace id) to access. + +var wfsPathList = ["wfsPathList_example"]; // [String] | array of wfsPath, without heading /. + +var pattern = "pattern_example"; // String | regex pattern to match in search or replace. In replace operation, pattern should be same to the parttern in search operation + +var replaceTo = "replaceTo_example"; // String | string to replace with + +var opts = { + 'ignoreCase': false // Boolean | regex matching option to ignore case. In replace operation, this option should be same to one used in search operation +}; + +var callback = function(error, data, response) { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}; +apiInstance.replace(wfsId, wfsPathList, patternreplaceTo, opts, callback); +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **wfsId** | **String**| webida file system id (same to workspace id) to access. | + **wfsPathList** | [**[String]**](String.md)| array of wfsPath, without heading /. | + **pattern** | **String**| regex pattern to match in search or replace. In replace operation, pattern should be same to the parttern in search operation | + **replaceTo** | **String**| string to replace with | + **ignoreCase** | **Boolean**| regex matching option to ignore case. In replace operation, this option should be same to one used in search operation | [optional] [default to false] + +### Return type + +[**RestOK**](RestOK.md) + +### Authorization + +[webida-simple-auth](../README.md#webida-simple-auth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json, application/octet-stream + + +# **search** +> {'String': [Match]} search(wfsId, wfsPathList, pattern, opts) + + + +search files in some path, with given pattern + +### Example +```javascript +var WebidaRestfulApi = require('webida_restful_api'); +var defaultClient = WebidaRestfulApi.ApiClient.default; + +// Configure API key authorization: webida-simple-auth +var webida-simple-auth = defaultClient.authentications['webida-simple-auth']; +webida-simple-auth.apiKey = 'YOUR API KEY'; +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//webida-simple-auth.apiKeyPrefix = 'Token'; + +var apiInstance = new WebidaRestfulApi.WfsApi(); + +var wfsId = "wfsId_example"; // String | webida file system id (same to workspace id) to access. + +var wfsPathList = ["wfsPathList_example"]; // [String] | array of wfsPath, without heading /. + +var pattern = "pattern_example"; // String | regex pattern to match in search or replace. In replace operation, pattern should be same to the parttern in search operation + +var opts = { + 'ignoreCase': false // Boolean | regex matching option to ignore case. In replace operation, this option should be same to one used in search operation +}; + +var callback = function(error, data, response) { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}; +apiInstance.search(wfsId, wfsPathList, pattern, opts, callback); +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **wfsId** | **String**| webida file system id (same to workspace id) to access. | + **wfsPathList** | [**[String]**](String.md)| array of wfsPath, without heading /. | + **pattern** | **String**| regex pattern to match in search or replace. In replace operation, pattern should be same to the parttern in search operation | + **ignoreCase** | **Boolean**| regex matching option to ignore case. In replace operation, this option should be same to one used in search operation | [optional] [default to false] + +### Return type + +**{'String': [Match]}** + +### Authorization + +[webida-simple-auth](../README.md#webida-simple-auth) + ### HTTP request headers - **Content-Type**: application/json diff --git a/package.json b/package.json index 9141bb5..13d129b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webida-restful-api", - "version": "0.8.0", + "version": "0.8.1", "description": "Webida Restful API Spec & generated clients", "license": "Apache-2.0", "main": "src/index.js", diff --git a/src/api/OpsApi.js b/src/api/OpsApi.js deleted file mode 100644 index 0b20651..0000000 --- a/src/api/OpsApi.js +++ /dev/null @@ -1,194 +0,0 @@ -/** - * Webida Restful API - * Restful API for Webida clients to use server's data & features - * - * OpenAPI spec version: 0.7.1 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -(function(root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['ApiClient', 'model/RestOK', 'model/RestError'], factory); - } else if (typeof module === 'object' && module.exports) { - // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient'), require('../model/RestOK'), require('../model/RestError')); - } else { - // Browser globals (root is window) - if (!root.WebidaRestfulApi) { - root.WebidaRestfulApi = {}; - } - root.WebidaRestfulApi.OpsApi = factory(root.WebidaRestfulApi.ApiClient, root.WebidaRestfulApi.RestOK, root.WebidaRestfulApi.RestError); - } -}(this, function(ApiClient, RestOK, RestError) { - 'use strict'; - - /** - * Ops service. - * @module api/OpsApi - * @version 0.7.1 - */ - - /** - * Constructs a new OpsApi. - * @alias module:api/OpsApi - * @class - * @param {module:ApiClient} apiClient Optional API client implementation to use, - * default to {@link module:ApiClient#instance} if unspecified. - */ - var exports = function(apiClient) { - this.apiClient = apiClient || ApiClient.instance; - - - /** - * Callback function to receive the result of the replace operation. - * @callback module:api/OpsApi~replaceCallback - * @param {String} error Error message, if any. - * @param {module:model/RestOK} data The data returned by the service call. - * @param {String} response The complete HTTP response. - */ - - /** - * replace file contents with regex matching - * @param {String} wfsId webida file system id (same to workspace id) to access. - * @param {Array.} wfsPathList array of wfsPath, without heading /. - * @param {String} pattern regex pattern to match in search or replace. In replace operation, pattern should be same to the parttern in search operation - * @param {String} replaceTo string to replace with - * @param {Object} opts Optional parameters - * @param {Boolean} opts.ignoreCase regex matching option to ignore case. In replace operation, this option should be same to one used in search operation (default to false) - * @param {module:api/OpsApi~replaceCallback} callback The callback function, accepting three arguments: error, data, response - * data is of type: {module:model/RestOK} - */ - this.replace = function(wfsId, wfsPathList, pattern, replaceTo, opts, callback) { - opts = opts || {}; - var postBody = null; - - // verify the required parameter 'wfsId' is set - if (wfsId == undefined || wfsId == null) { - throw "Missing the required parameter 'wfsId' when calling replace"; - } - - // verify the required parameter 'wfsPathList' is set - if (wfsPathList == undefined || wfsPathList == null) { - throw "Missing the required parameter 'wfsPathList' when calling replace"; - } - - // verify the required parameter 'pattern' is set - if (pattern == undefined || pattern == null) { - throw "Missing the required parameter 'pattern' when calling replace"; - } - - // verify the required parameter 'replaceTo' is set - if (replaceTo == undefined || replaceTo == null) { - throw "Missing the required parameter 'replaceTo' when calling replace"; - } - - - var pathParams = { - 'wfsId': wfsId - }; - var queryParams = { - 'wfsPathList': this.apiClient.buildCollectionParam(wfsPathList, 'multi'), - 'pattern': pattern, - 'ignoreCase': opts['ignoreCase'], - 'replaceTo': replaceTo - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['webida-simple-auth']; - var contentTypes = ['application/json']; - var accepts = ['application/json', 'application/octet-stream']; - var returnType = RestOK; - - return this.apiClient.callApi( - '/wfs/{wfsId}/ops/replace', 'POST', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, callback - ); - } - - /** - * Callback function to receive the result of the search operation. - * @callback module:api/OpsApi~searchCallback - * @param {String} error Error message, if any. - * @param {Object.} data The data returned by the service call. - * @param {String} response The complete HTTP response. - */ - - /** - * search files in some path, with given pattern - * @param {String} wfsId webida file system id (same to workspace id) to access. - * @param {Array.} wfsPathList array of wfsPath, without heading /. - * @param {String} pattern regex pattern to match in search or replace. In replace operation, pattern should be same to the parttern in search operation - * @param {Object} opts Optional parameters - * @param {Boolean} opts.ignoreCase regex matching option to ignore case. In replace operation, this option should be same to one used in search operation (default to false) - * @param {module:api/OpsApi~searchCallback} callback The callback function, accepting three arguments: error, data, response - * data is of type: {Object.} - */ - this.search = function(wfsId, wfsPathList, pattern, opts, callback) { - opts = opts || {}; - var postBody = null; - - // verify the required parameter 'wfsId' is set - if (wfsId == undefined || wfsId == null) { - throw "Missing the required parameter 'wfsId' when calling search"; - } - - // verify the required parameter 'wfsPathList' is set - if (wfsPathList == undefined || wfsPathList == null) { - throw "Missing the required parameter 'wfsPathList' when calling search"; - } - - // verify the required parameter 'pattern' is set - if (pattern == undefined || pattern == null) { - throw "Missing the required parameter 'pattern' when calling search"; - } - - - var pathParams = { - 'wfsId': wfsId - }; - var queryParams = { - 'wfsPathList': this.apiClient.buildCollectionParam(wfsPathList, 'multi'), - 'pattern': pattern, - 'ignoreCase': opts['ignoreCase'] - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['webida-simple-auth']; - var contentTypes = ['application/json']; - var accepts = ['application/json', 'application/octet-stream']; - var returnType = {'String': [Match]}; - - return this.apiClient.callApi( - '/wfs/{wfsId}/ops/search', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, callback - ); - } - }; - - return exports; -})); diff --git a/src/api/WfsApi.js b/src/api/WfsApi.js index 4c0800c..6916e3a 100644 --- a/src/api/WfsApi.js +++ b/src/api/WfsApi.js @@ -411,6 +411,139 @@ ); } + /** + * Callback function to receive the result of the replace operation. + * @callback module:api/WfsApi~replaceCallback + * @param {String} error Error message, if any. + * @param {module:model/RestOK} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * replace file contents with regex matching + * @param {String} wfsId webida file system id (same to workspace id) to access. + * @param {Array.} wfsPathList array of wfsPath, without heading /. + * @param {String} pattern regex pattern to match in search or replace. In replace operation, pattern should be same to the parttern in search operation + * @param {String} replaceTo string to replace with + * @param {Object} opts Optional parameters + * @param {Boolean} opts.ignoreCase regex matching option to ignore case. In replace operation, this option should be same to one used in search operation (default to false) + * @param {module:api/WfsApi~replaceCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {module:model/RestOK} + */ + this.replace = function(wfsId, wfsPathList, pattern, replaceTo, opts, callback) { + opts = opts || {}; + var postBody = null; + + // verify the required parameter 'wfsId' is set + if (wfsId == undefined || wfsId == null) { + throw "Missing the required parameter 'wfsId' when calling replace"; + } + + // verify the required parameter 'wfsPathList' is set + if (wfsPathList == undefined || wfsPathList == null) { + throw "Missing the required parameter 'wfsPathList' when calling replace"; + } + + // verify the required parameter 'pattern' is set + if (pattern == undefined || pattern == null) { + throw "Missing the required parameter 'pattern' when calling replace"; + } + + // verify the required parameter 'replaceTo' is set + if (replaceTo == undefined || replaceTo == null) { + throw "Missing the required parameter 'replaceTo' when calling replace"; + } + + + var pathParams = { + 'wfsId': wfsId + }; + var queryParams = { + 'wfsPathList': this.apiClient.buildCollectionParam(wfsPathList, 'multi'), + 'pattern': pattern, + 'ignoreCase': opts['ignoreCase'], + 'replaceTo': replaceTo + }; + var headerParams = { + }; + var formParams = { + }; + + var authNames = ['webida-simple-auth']; + var contentTypes = ['application/json']; + var accepts = ['application/json', 'application/octet-stream']; + var returnType = RestOK; + + return this.apiClient.callApi( + '/wfs/{wfsId}/ops/replace', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, callback + ); + } + + /** + * Callback function to receive the result of the search operation. + * @callback module:api/WfsApi~searchCallback + * @param {String} error Error message, if any. + * @param {Object.} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * search files in some path, with given pattern + * @param {String} wfsId webida file system id (same to workspace id) to access. + * @param {Array.} wfsPathList array of wfsPath, without heading /. + * @param {String} pattern regex pattern to match in search or replace. In replace operation, pattern should be same to the parttern in search operation + * @param {Object} opts Optional parameters + * @param {Boolean} opts.ignoreCase regex matching option to ignore case. In replace operation, this option should be same to one used in search operation (default to false) + * @param {module:api/WfsApi~searchCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {Object.} + */ + this.search = function(wfsId, wfsPathList, pattern, opts, callback) { + opts = opts || {}; + var postBody = null; + + // verify the required parameter 'wfsId' is set + if (wfsId == undefined || wfsId == null) { + throw "Missing the required parameter 'wfsId' when calling search"; + } + + // verify the required parameter 'wfsPathList' is set + if (wfsPathList == undefined || wfsPathList == null) { + throw "Missing the required parameter 'wfsPathList' when calling search"; + } + + // verify the required parameter 'pattern' is set + if (pattern == undefined || pattern == null) { + throw "Missing the required parameter 'pattern' when calling search"; + } + + + var pathParams = { + 'wfsId': wfsId + }; + var queryParams = { + 'wfsPathList': this.apiClient.buildCollectionParam(wfsPathList, 'multi'), + 'pattern': pattern, + 'ignoreCase': opts['ignoreCase'] + }; + var headerParams = { + }; + var formParams = { + }; + + var authNames = ['webida-simple-auth']; + var contentTypes = ['application/json']; + var accepts = ['application/json', 'application/octet-stream']; + var returnType = {'String': [Match]}; + + return this.apiClient.callApi( + '/wfs/{wfsId}/ops/search', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, callback + ); + } + /** * Callback function to receive the result of the stat operation. * @callback module:api/WfsApi~statCallback diff --git a/src/index.js b/src/index.js index 8b3f957..763d423 100644 --- a/src/index.js +++ b/src/index.js @@ -25,12 +25,12 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['ApiClient', 'model/Alias', 'model/ChildProcess', 'model/Credential', 'model/DirEntry', 'model/Execution', 'model/ExecutionResult', 'model/Match', 'model/RemoteAccess', 'model/RestError', 'model/RestOK', 'model/Session', 'model/Stats', 'model/Token', 'model/User', 'model/Workspace', 'api/AliasApi', 'api/AuthApi', 'api/OpsApi', 'api/RemotesApi', 'api/SessionApi', 'api/WfsApi', 'api/WorkspaceApi'], factory); + define(['ApiClient', 'model/Alias', 'model/ChildProcess', 'model/Credential', 'model/DirEntry', 'model/Execution', 'model/ExecutionResult', 'model/Match', 'model/RemoteAccess', 'model/RestError', 'model/RestOK', 'model/Session', 'model/Stats', 'model/Token', 'model/User', 'model/Workspace', 'api/AliasApi', 'api/AuthApi', 'api/RemotesApi', 'api/SessionApi', 'api/WfsApi', 'api/WorkspaceApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('./ApiClient'), require('./model/Alias'), require('./model/ChildProcess'), require('./model/Credential'), require('./model/DirEntry'), require('./model/Execution'), require('./model/ExecutionResult'), require('./model/Match'), require('./model/RemoteAccess'), require('./model/RestError'), require('./model/RestOK'), require('./model/Session'), require('./model/Stats'), require('./model/Token'), require('./model/User'), require('./model/Workspace'), require('./api/AliasApi'), require('./api/AuthApi'), require('./api/OpsApi'), require('./api/RemotesApi'), require('./api/SessionApi'), require('./api/WfsApi'), require('./api/WorkspaceApi')); + module.exports = factory(require('./ApiClient'), require('./model/Alias'), require('./model/ChildProcess'), require('./model/Credential'), require('./model/DirEntry'), require('./model/Execution'), require('./model/ExecutionResult'), require('./model/Match'), require('./model/RemoteAccess'), require('./model/RestError'), require('./model/RestOK'), require('./model/Session'), require('./model/Stats'), require('./model/Token'), require('./model/User'), require('./model/Workspace'), require('./api/AliasApi'), require('./api/AuthApi'), require('./api/RemotesApi'), require('./api/SessionApi'), require('./api/WfsApi'), require('./api/WorkspaceApi')); } -}(function(ApiClient, Alias, ChildProcess, Credential, DirEntry, Execution, ExecutionResult, Match, RemoteAccess, RestError, RestOK, Session, Stats, Token, User, Workspace, AliasApi, AuthApi, OpsApi, RemotesApi, SessionApi, WfsApi, WorkspaceApi) { +}(function(ApiClient, Alias, ChildProcess, Credential, DirEntry, Execution, ExecutionResult, Match, RemoteAccess, RestError, RestOK, Session, Stats, Token, User, Workspace, AliasApi, AuthApi, RemotesApi, SessionApi, WfsApi, WorkspaceApi) { 'use strict'; /** @@ -155,11 +155,6 @@ * @property {module:api/AuthApi} */ AuthApi: AuthApi, - /** - * The OpsApi service constructor. - * @property {module:api/OpsApi} - */ - OpsApi: OpsApi, /** * The RemotesApi service constructor. * @property {module:api/RemotesApi} diff --git a/test/api/OpsApi.spec.js b/test/api/OpsApi.spec.js deleted file mode 100644 index 00eeb0b..0000000 --- a/test/api/OpsApi.spec.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Webida Restful API - * Restful API for Webida clients to use server's data & features - * - * OpenAPI spec version: 0.7.1 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -(function(root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. - define(['expect.js', '../../src/index'], factory); - } else if (typeof module === 'object' && module.exports) { - // CommonJS-like environments that support module.exports, like Node. - factory(require('expect.js'), require('../../src/index')); - } else { - // Browser globals (root is window) - factory(root.expect, root.WebidaRestfulApi); - } -}(this, function(expect, WebidaRestfulApi) { - 'use strict'; - - var instance; - - beforeEach(function() { - instance = new WebidaRestfulApi.OpsApi(); - }); - - var getProperty = function(object, getter, property) { - // Use getter method if present; otherwise, get the property directly. - if (typeof object[getter] === 'function') - return object[getter](); - else - return object[property]; - } - - var setProperty = function(object, setter, property, value) { - // Use setter method if present; otherwise, set the property directly. - if (typeof object[setter] === 'function') - object[setter](value); - else - object[property] = value; - } - - describe('OpsApi', function() { - describe('replace', function() { - it('should call replace successfully', function(done) { - //uncomment below and update the code to test replace - //instance.replace(pet, function(error) { - // if (error) throw error; - //expect().to.be(); - //}); - done(); - }); - }); - describe('search', function() { - it('should call search successfully', function(done) { - //uncomment below and update the code to test search - //instance.search(pet, function(error) { - // if (error) throw error; - //expect().to.be(); - //}); - done(); - }); - }); - }); - -})); diff --git a/test/api/WfsApi.spec.js b/test/api/WfsApi.spec.js index cad2270..fc079fb 100644 --- a/test/api/WfsApi.spec.js +++ b/test/api/WfsApi.spec.js @@ -119,6 +119,26 @@ done(); }); }); + describe('replace', function() { + it('should call replace successfully', function(done) { + //uncomment below and update the code to test replace + //instance.replace(pet, function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); + describe('search', function() { + it('should call search successfully', function(done) { + //uncomment below and update the code to test search + //instance.search(pet, function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); describe('stat', function() { it('should call stat successfully', function(done) { //uncomment below and update the code to test stat