Skip to content

Commit 48b3b20

Browse files
committed
RepositoryFiles関連を実装
1 parent c427f77 commit 48b3b20

File tree

4 files changed

+456
-11
lines changed

4 files changed

+456
-11
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ The following functions(APIs) can be used:
2424

2525
### Repository Files
2626
* Get File : Get file from repository. Allows you to receive information about file in repository like name, size, content. Note that file content is Base64 encoded.
27+
* Create File : Create new file in repository
28+
* Update File : Update existing file in repository
29+
* Remove File : Delete existing file in repository
2730

2831
## Copyright and license
2932

gitlab.html

+223-2
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,8 @@
491491
<Strong>(required Number)</Strong> The ID of a project</li>
492492
<li><code>msg.payload.file_path</code> :
493493
<Strong>(required String)</Strong> Full path to file. </li>
494-
<li><code>msg.payload.ref</code> :
495-
<Strong>(required String)</Strong> The name of branch, tag or commit</li>
494+
<li><code>msg.payload.ref</code> :
495+
<Strong>(required String)</Strong> The name of branch, tag or commit</li>
496496
</ul>
497497
</p>
498498
</script>
@@ -524,3 +524,224 @@
524524
}
525525
});
526526
</script>
527+
528+
529+
530+
<!--
531+
GitLab Create RepositoryFile
532+
-->
533+
<script type="text/x-red" data-template-name="GitLab-Create-RepositoryFile">
534+
<div class="form-row">
535+
<label for="node-input-gitlabconfig"><i class="fa fa-globe"></i> API Key</label>
536+
<input type="text" id="node-input-gitlabconfig">
537+
</div>
538+
<div class="form-row">
539+
<label for="node-input-branch_name"><i class="fa fa-tag"></i> Branch</label>
540+
<input type="text" id="node-input-branch_name" placeholder="The name of branch,">
541+
</div>
542+
<div class="form-row">
543+
<label for="node-input-encoding"><i class="fa fa-tag"></i> Encoding</label>
544+
<select type="text" id="node-input-encoding">
545+
<option value="text">text</option>
546+
<option value="base64">base64</option>
547+
</select>
548+
</div>
549+
<div class="form-row">
550+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
551+
<input type="text" id="node-input-name" placeholder="Name">
552+
</div>
553+
</script>
554+
555+
<script type="text/x-red" data-help-name="GitLab-Create-RepositoryFile">
556+
<p>Create new file in repository</p>
557+
<p>
558+
Set the following in the node setting or in the input payload.:
559+
<ul>
560+
<li><code>msg.payload.project_id</code> :
561+
<Strong>(required Number)</Strong> The ID of a project</li>
562+
<li><code>msg.payload.file_path</code> :
563+
<Strong>(required String)</Strong> Full path to file. </li>
564+
<li><code>msg.payload.branch_name</code> :
565+
<Strong>(required String)</Strong> The name of branch</li>
566+
<li><code>msg.payload.encoding</code> : (String) Select encoding to &#39;text&#39; or &#39;base64&#39;. &#39;text&#39; is default.</li>
567+
<li><code>msg.payload.content</code> :
568+
<Strong>(required String)</Strong> File content</li>
569+
<li><code>msg.payload.commit_message</code> :
570+
<Strong>(required String)</Strong> Commit message</li>
571+
</ul>
572+
</p>
573+
</script>
574+
575+
<script type="text/javascript">
576+
RED.nodes.registerType('GitLab-Create-RepositoryFile', {
577+
category: 'GitLab',
578+
defaults: {
579+
name: {
580+
value: ""
581+
},
582+
branch_name: {
583+
value: ""
584+
},
585+
encoding: {
586+
value: "text"
587+
},
588+
gitlabconfig: {
589+
type: "gitlab-config",
590+
required: true
591+
}
592+
},
593+
color: "#a493d4",
594+
inputs: 1,
595+
outputs: 1,
596+
icon: "gitlab_logo.svg",
597+
label: function() {
598+
return this.name || "GitLab Create RepositoryFile";
599+
},
600+
labelStyle: function() {
601+
return this.name ? "node_label_italic" : "";
602+
}
603+
});
604+
</script>
605+
606+
607+
608+
<!--
609+
GitLab Update RepositoryFile
610+
-->
611+
<script type="text/x-red" data-template-name="GitLab-Update-RepositoryFile">
612+
<div class="form-row">
613+
<label for="node-input-gitlabconfig"><i class="fa fa-globe"></i> API Key</label>
614+
<input type="text" id="node-input-gitlabconfig">
615+
</div>
616+
<div class="form-row">
617+
<label for="node-input-branch_name"><i class="fa fa-tag"></i> Branch</label>
618+
<input type="text" id="node-input-branch_name" placeholder="The name of branch,">
619+
</div>
620+
<div class="form-row">
621+
<label for="node-input-encoding"><i class="fa fa-tag"></i> Encoding</label>
622+
<select type="text" id="node-input-encoding">
623+
<option value="text">text</option>
624+
<option value="base64">base64</option>
625+
</select>
626+
</div>
627+
<div class="form-row">
628+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
629+
<input type="text" id="node-input-name" placeholder="Name">
630+
</div>
631+
</script>
632+
633+
<script type="text/x-red" data-help-name="GitLab-Update-RepositoryFile">
634+
<p>Update existing file in repository</p>
635+
<p>
636+
Set the following in the node setting or in the input payload.:
637+
<ul>
638+
<li><code>msg.payload.project_id</code> :
639+
<Strong>(required Number)</Strong> The ID of a project</li>
640+
<li><code>msg.payload.file_path</code> :
641+
<Strong>(required String)</Strong> Full path to file. </li>
642+
<li><code>msg.payload.branch_name</code> :
643+
<Strong>(required String)</Strong> The name of branch</li>
644+
<li><code>msg.payload.encoding</code> : (String) Select encoding to &#39;text&#39; or &#39;base64&#39;. &#39;text&#39; is default.</li>
645+
<li><code>msg.payload.content</code> :
646+
<Strong>(required String)</Strong> File content</li>
647+
<li><code>msg.payload.commit_message</code> :
648+
<Strong>(required String)</Strong> Commit message</li>
649+
</ul>
650+
</p>
651+
</script>
652+
653+
<script type="text/javascript">
654+
RED.nodes.registerType('GitLab-Update-RepositoryFile', {
655+
category: 'GitLab',
656+
defaults: {
657+
name: {
658+
value: ""
659+
},
660+
branch_name: {
661+
value: ""
662+
},
663+
encoding: {
664+
value: "text"
665+
},
666+
gitlabconfig: {
667+
type: "gitlab-config",
668+
required: true
669+
}
670+
},
671+
color: "#a493d4",
672+
inputs: 1,
673+
outputs: 1,
674+
icon: "gitlab_logo.svg",
675+
label: function() {
676+
return this.name || "GitLab Update RepositoryFile";
677+
},
678+
labelStyle: function() {
679+
return this.name ? "node_label_italic" : "";
680+
}
681+
});
682+
</script>
683+
684+
685+
686+
<!--
687+
GitLab Remove RepositoryFile
688+
-->
689+
<script type="text/x-red" data-template-name="GitLab-Remove-RepositoryFile">
690+
<div class="form-row">
691+
<label for="node-input-gitlabconfig"><i class="fa fa-globe"></i> API Key</label>
692+
<input type="text" id="node-input-gitlabconfig">
693+
</div>
694+
<div class="form-row">
695+
<label for="node-input-branch_name"><i class="fa fa-tag"></i> Branch</label>
696+
<input type="text" id="node-input-branch_name" placeholder="The name of branch,">
697+
</div>
698+
<div class="form-row">
699+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
700+
<input type="text" id="node-input-name" placeholder="Name">
701+
</div>
702+
</script>
703+
704+
<script type="text/x-red" data-help-name="GitLab-Remove-RepositoryFile">
705+
<p>Delete existing file in repository</p>
706+
<p>
707+
Set the following in the node setting or in the input payload.:
708+
<ul>
709+
<li><code>msg.payload.project_id</code> :
710+
<Strong>(required Number)</Strong> The ID of a project</li>
711+
<li><code>msg.payload.file_path</code> :
712+
<Strong>(required String)</Strong> Full path to file. </li>
713+
<li><code>msg.payload.branch_name</code> :
714+
<Strong>(required String)</Strong> The name of branch</li>
715+
<li><code>msg.payload.commit_message</code> :
716+
<Strong>(required String)</Strong> Commit message</li>
717+
</ul>
718+
</p>
719+
</script>
720+
721+
<script type="text/javascript">
722+
RED.nodes.registerType('GitLab-Remove-RepositoryFile', {
723+
category: 'GitLab',
724+
defaults: {
725+
name: {
726+
value: ""
727+
},
728+
branch_name: {
729+
value: ""
730+
},
731+
gitlabconfig: {
732+
type: "gitlab-config",
733+
required: true
734+
}
735+
},
736+
color: "#a493d4",
737+
inputs: 1,
738+
outputs: 1,
739+
icon: "gitlab_logo.svg",
740+
label: function() {
741+
return this.name || "GitLab Remove RepositoryFile";
742+
},
743+
labelStyle: function() {
744+
return this.name ? "node_label_italic" : "";
745+
}
746+
});
747+
</script>

0 commit comments

Comments
 (0)