File size: 2,303 Bytes
9853396
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.

package graphql

import (
	"context"

	"github.com/Khan/genqlient/graphql"
)

// CreateAPIKeyCreateLLMAPIKey includes the requested fields of the GraphQL type APIKey.
type CreateAPIKeyCreateLLMAPIKey struct {
	Key    string   `json:"key"`
	Name   string   `json:"name"`
	Scopes []string `json:"scopes"`
}

// GetKey returns CreateAPIKeyCreateLLMAPIKey.Key, and is useful for accessing the field via an interface.
func (v *CreateAPIKeyCreateLLMAPIKey) GetKey() string { return v.Key }

// GetName returns CreateAPIKeyCreateLLMAPIKey.Name, and is useful for accessing the field via an interface.
func (v *CreateAPIKeyCreateLLMAPIKey) GetName() string { return v.Name }

// GetScopes returns CreateAPIKeyCreateLLMAPIKey.Scopes, and is useful for accessing the field via an interface.
func (v *CreateAPIKeyCreateLLMAPIKey) GetScopes() []string { return v.Scopes }

// CreateAPIKeyResponse is returned by CreateAPIKey on success.
type CreateAPIKeyResponse struct {
	CreateLLMAPIKey *CreateAPIKeyCreateLLMAPIKey `json:"createLLMAPIKey"`
}

// GetCreateLLMAPIKey returns CreateAPIKeyResponse.CreateLLMAPIKey, and is useful for accessing the field via an interface.
func (v *CreateAPIKeyResponse) GetCreateLLMAPIKey() *CreateAPIKeyCreateLLMAPIKey {
	return v.CreateLLMAPIKey
}

// __CreateAPIKeyInput is used internally by genqlient
type __CreateAPIKeyInput struct {
	Name string `json:"name"`
}

// GetName returns __CreateAPIKeyInput.Name, and is useful for accessing the field via an interface.
func (v *__CreateAPIKeyInput) GetName() string { return v.Name }

// The mutation executed by CreateAPIKey.
const CreateAPIKey_Operation = `

mutation CreateAPIKey ($name: String!) {

	createLLMAPIKey(name: $name) {

		key

		name

		scopes

	}

}

`

func CreateAPIKey(

	ctx_ context.Context,

	client_ graphql.Client,

	name string,

) (data_ *CreateAPIKeyResponse, err_ error) {
	req_ := &graphql.Request{
		OpName: "CreateAPIKey",
		Query:  CreateAPIKey_Operation,
		Variables: &__CreateAPIKeyInput{
			Name: name,
		},
	}

	data_ = &CreateAPIKeyResponse{}
	resp_ := &graphql.Response{Data: data_}

	err_ = client_.MakeRequest(
		ctx_,
		req_,
		resp_,
	)

	return data_, err_
}