-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Expand file tree
/
Copy pathplugin_create.go
More file actions
31 lines (25 loc) · 846 Bytes
/
plugin_create.go
File metadata and controls
31 lines (25 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package client
import (
"context"
"io"
"net/http"
"net/url"
)
// PluginCreateOptions hold all options to plugin create.
type PluginCreateOptions struct {
RepoName string
}
// PluginCreateResult represents the result of a plugin create operation.
type PluginCreateResult struct {
// Currently empty; can be extended in the future if needed.
}
// PluginCreate creates a plugin
func (cli *Client) PluginCreate(ctx context.Context, createContext io.Reader, createOptions PluginCreateOptions) (PluginCreateResult, error) {
headers := http.Header(make(map[string][]string))
headers.Set("Content-Type", "application/x-tar")
query := url.Values{}
query.Set("name", createOptions.RepoName)
resp, err := cli.postRaw(ctx, "/plugins/create", query, createContext, headers)
defer ensureReaderClosed(resp)
return PluginCreateResult{}, err
}