npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

genedock-sdk

v1.0.5

Published

GeneDock的官方sdk,帮助第三方开发者调用genedock服务的工具库

Downloads

6

Readme

1.0.5 添加两个接口

下载:

压缩版

普通版

安装:

开始使用:

<script type="text/javascript" src="genedock-sdk.min.js"></script>

或者:

<script type="text/javascript" src="genedock-sdk.js"></script>

获取AccessKeyId和AccessKeySecret

如果你需要自己的AccessKeyId和AccessKeySecret,可以向GeneDok开发人员索要,当前还没开放用户获取AccessKeyId和AccessKeySecret接口;

##开始使用:##


/*---------需要自己的AccessKeyId和AccessKeySecret----
 *---------访问到Genedock服务------------------------
 */

var example = new GeneDockAPI(
       "Your AccessKeyId",         // AccessKeyId
       "Your AccessKeySecret"      // AccessKeySecret
       "https://www.genedock.com"			// urlbase_address
       "true"						// async
);

//------在和genedock服务接通之后,即可以访问api了-------

example.listworkflow(
	{
		//这里的data是需要传回genedock后段服务的
		//请严格按照下边的api列表中的data属性,给出相应的值,否则不成功
	},
	function(data){
		//this is Successfully returns
	},
	function(errormsg){
		//this is error returns
	}
)

##API列表:##

  • ###数据接口###

|接口|属性| |----------|---------| | listData | data |

  • ###工作流接口###

| 接口 | 属性 | |--------------------------|------------------------ | |new_plan |data | |list_workflow |data | |get_workflow |null | |update_workflow |data | |delete_workflow |null | |get_workflow_parameters |null | |set_workflow_parameters |data |

  • ###任务接口###

| 接口 | 属性 | |--------------------------|------------------------- | |new_task |JSON.stringify(data) | |listTasks |data | |get_task |null | |update_task |data | |delete_task |null | |stop_task |null | |get_jobs_info |null | |get_job_log |null | |get_log_signature |null |

  • ###报告接口###

| 接口 | 属性 | |--------------------------|-------------------------| |listReports |null| |getReports |null|

上传文件

这里用到了jquery.form.js 。它能很方便的传递form里面的内容,并将其引入进来.

html:

<form role="form" onsubmit="return UploadForm();" enctype="multipart/form-data" >
      <input type="hidden" value="" id="access_id" name="access_id">
      <input type="hidden" value="" id="access_key" name="access_key">
      <button type="submit">上传</button>
</form>

javascript:

function UploadForm() {
    $("form").ajaxSubmit({
      type: 'post',
      url: "https://www.genedock.com/api/v2/uploadTinyFile/",
      success:function(data){
        //提交成功的回调函数
        //返回上传成功的信息
      },
      error:function(errormsg){
        //返回上传失败的错误信息
      }
    });
    return false;
  };

获取workflowid

获取workflowid的方法有两种方式:

  • GeneDock官方网站,登录到后台,选择市场,安装你需要的workflow,之后就可以拿到workflow的id
  • 需要配置SDK,使用list_workflow接口,便可以很方便的在代码中获取workflow的id,字段_id就是workflowid;
example.list_workflow(
	{type:"private"},
	function(data){
    	// 成功的返回
	},function(error){
    	// 错误的返回
	}
)

跑通workflow示例:##

以下例子仅供参考(不适合用于生产环境):

接下来的示例,必须在按照上面的步骤,能够跑通的情况下,尝试着跑一个workflow;

环境配置,请移步到 开始使用

现在开始...

首先,必须要知道需要跑的workflow的ID,如果没有这个ID

请移步获取workflowid;

环境配置成功,而且已经有了workflowid;接下来就可以几行代码便可以跑通你的workflow;

通过workflowid获取详细信息:

example.getworkflow(workflowid,function(data){

	//正确的返回

},function(errormsg){

	//错误的返回

})

编译workflow:

这里需要更新compiledata,更新过程请看下边示例:
编译的过程,需要workflow的名称和workflow输出的名称不相同,
example.new_plan(compiledata,function(data){

	//正确的返回

},function(errormsg){

	//错误的返回

})

运行workflow

运行的时候需要获取编译之后的数据
example.runTask(rundata,function(data){

	//成功的返回

},function(errormsg){

	//错误的返回

})

显示workflow成功之后的报告,任务信息等;需要根据renTask之后的taskid

    /**

    1、显示报告:
    example.getReports(task_id,function(data){},function(data){})

    2、显示参数:
    example.getTask(task_id,function(data){},function(data){})

    3、显示日志:
    example.getTaskLogList(task_id,function(data){},function(data){})

    4、显示日志的更多信息
    example.getTaskLogDetail(task_id,job_id,function(data){},function(data){})


    **/

官方网站 www.genedock.com