Skip to content

Commit 5a09cc4

Browse files
feat(api): api update
1 parent 0ff6d3a commit 5a09cc4

10 files changed

Lines changed: 1883 additions & 4 deletions

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 19
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/arcade-ai%2Farcade-engine-8c15fa101ceb4bf0f446fce918d2092361770e32ce43e6f88e1ece57244e8fa6.yml
3-
openapi_spec_hash: 008132037e04c877822a61f59c789647
4-
config_hash: 214997e49eded7cde9997ecb3bb24f68
1+
configured_endpoints: 28
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/arcade-ai%2Farcade-engine-51958c25f4f5f8d03d873744f15369a2ce2894f246f162aecac70d1b4d2b6008.yml
3+
openapi_spec_hash: 5f61d1691a2c83c8067bc837b0000237
4+
config_hash: 6eb072febff9e7aba9cdeb6901761b97

admin.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
package arcadego
4+
5+
import (
6+
"github.com/ArcadeAI/arcade-go/option"
7+
)
8+
9+
// AdminService contains methods and other services that help with interacting with
10+
// the Arcade API.
11+
//
12+
// Note, unlike clients, this service does not read variables from the environment
13+
// automatically. You should not instantiate this service directly, and instead use
14+
// the [NewAdminService] method instead.
15+
type AdminService struct {
16+
Options []option.RequestOption
17+
UserConnections *AdminUserConnectionService
18+
AuthProviders *AdminAuthProviderService
19+
Secrets *AdminSecretService
20+
}
21+
22+
// NewAdminService generates a new service that applies the given options to each
23+
// request. These options are applied after the parent client's options (if there
24+
// is one), and before any request-specific options.
25+
func NewAdminService(opts ...option.RequestOption) (r *AdminService) {
26+
r = &AdminService{}
27+
r.Options = opts
28+
r.UserConnections = NewAdminUserConnectionService(opts...)
29+
r.AuthProviders = NewAdminAuthProviderService(opts...)
30+
r.Secrets = NewAdminSecretService(opts...)
31+
return
32+
}

adminauthprovider.go

Lines changed: 1073 additions & 0 deletions
Large diffs are not rendered by default.

adminauthprovider_test.go

Lines changed: 291 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,291 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
package arcadego_test
4+
5+
import (
6+
"context"
7+
"errors"
8+
"os"
9+
"testing"
10+
11+
"github.com/ArcadeAI/arcade-go"
12+
"github.com/ArcadeAI/arcade-go/internal/testutil"
13+
"github.com/ArcadeAI/arcade-go/option"
14+
)
15+
16+
func TestAdminAuthProviderNewWithOptionalParams(t *testing.T) {
17+
baseURL := "http://localhost:4010"
18+
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
19+
baseURL = envURL
20+
}
21+
if !testutil.CheckTestServer(t, baseURL) {
22+
return
23+
}
24+
client := arcadego.NewClient(
25+
option.WithBaseURL(baseURL),
26+
option.WithAPIKey("My API Key"),
27+
)
28+
_, err := client.Admin.AuthProviders.New(context.TODO(), arcadego.AdminAuthProviderNewParams{
29+
AuthProviderCreateRequest: arcadego.AuthProviderCreateRequestParam{
30+
ID: arcadego.F("id"),
31+
Description: arcadego.F("description"),
32+
Oauth2: arcadego.F(arcadego.AuthProviderCreateRequestOauth2Param{
33+
ClientID: arcadego.F("client_id"),
34+
AuthorizeRequest: arcadego.F(arcadego.AuthProviderCreateRequestOauth2AuthorizeRequestParam{
35+
Endpoint: arcadego.F("endpoint"),
36+
AuthMethod: arcadego.F("auth_method"),
37+
Method: arcadego.F("method"),
38+
Params: arcadego.F(map[string]string{
39+
"foo": "string",
40+
}),
41+
RequestContentType: arcadego.F(arcadego.AuthProviderCreateRequestOauth2AuthorizeRequestRequestContentTypeApplicationXWwwFormUrlencoded),
42+
ResponseContentType: arcadego.F(arcadego.AuthProviderCreateRequestOauth2AuthorizeRequestResponseContentTypeApplicationXWwwFormUrlencoded),
43+
ResponseMap: arcadego.F(map[string]string{
44+
"foo": "string",
45+
}),
46+
}),
47+
ClientSecret: arcadego.F("client_secret"),
48+
Pkce: arcadego.F(arcadego.AuthProviderCreateRequestOauth2PkceParam{
49+
CodeChallengeMethod: arcadego.F("code_challenge_method"),
50+
Enabled: arcadego.F(true),
51+
}),
52+
RefreshRequest: arcadego.F(arcadego.AuthProviderCreateRequestOauth2RefreshRequestParam{
53+
Endpoint: arcadego.F("endpoint"),
54+
AuthMethod: arcadego.F("auth_method"),
55+
Method: arcadego.F("method"),
56+
Params: arcadego.F(map[string]string{
57+
"foo": "string",
58+
}),
59+
RequestContentType: arcadego.F(arcadego.AuthProviderCreateRequestOauth2RefreshRequestRequestContentTypeApplicationXWwwFormUrlencoded),
60+
ResponseContentType: arcadego.F(arcadego.AuthProviderCreateRequestOauth2RefreshRequestResponseContentTypeApplicationXWwwFormUrlencoded),
61+
ResponseMap: arcadego.F(map[string]string{
62+
"foo": "string",
63+
}),
64+
}),
65+
ScopeDelimiter: arcadego.F(arcadego.AuthProviderCreateRequestOauth2ScopeDelimiterUnknown0),
66+
TokenIntrospectionRequest: arcadego.F(arcadego.AuthProviderCreateRequestOauth2TokenIntrospectionRequestParam{
67+
Endpoint: arcadego.F("endpoint"),
68+
Triggers: arcadego.F(arcadego.AuthProviderCreateRequestOauth2TokenIntrospectionRequestTriggersParam{
69+
OnTokenGrant: arcadego.F(true),
70+
OnTokenRefresh: arcadego.F(true),
71+
}),
72+
AuthMethod: arcadego.F("auth_method"),
73+
Method: arcadego.F("method"),
74+
Params: arcadego.F(map[string]string{
75+
"foo": "string",
76+
}),
77+
RequestContentType: arcadego.F(arcadego.AuthProviderCreateRequestOauth2TokenIntrospectionRequestRequestContentTypeApplicationXWwwFormUrlencoded),
78+
ResponseContentType: arcadego.F(arcadego.AuthProviderCreateRequestOauth2TokenIntrospectionRequestResponseContentTypeApplicationXWwwFormUrlencoded),
79+
ResponseMap: arcadego.F(map[string]string{
80+
"foo": "string",
81+
}),
82+
}),
83+
TokenRequest: arcadego.F(arcadego.AuthProviderCreateRequestOauth2TokenRequestParam{
84+
Endpoint: arcadego.F("endpoint"),
85+
AuthMethod: arcadego.F("auth_method"),
86+
Method: arcadego.F("method"),
87+
Params: arcadego.F(map[string]string{
88+
"foo": "string",
89+
}),
90+
RequestContentType: arcadego.F(arcadego.AuthProviderCreateRequestOauth2TokenRequestRequestContentTypeApplicationXWwwFormUrlencoded),
91+
ResponseContentType: arcadego.F(arcadego.AuthProviderCreateRequestOauth2TokenRequestResponseContentTypeApplicationXWwwFormUrlencoded),
92+
ResponseMap: arcadego.F(map[string]string{
93+
"foo": "string",
94+
}),
95+
}),
96+
UserInfoRequest: arcadego.F(arcadego.AuthProviderCreateRequestOauth2UserInfoRequestParam{
97+
Endpoint: arcadego.F("endpoint"),
98+
Triggers: arcadego.F(arcadego.AuthProviderCreateRequestOauth2UserInfoRequestTriggersParam{
99+
OnTokenGrant: arcadego.F(true),
100+
OnTokenRefresh: arcadego.F(true),
101+
}),
102+
AuthMethod: arcadego.F("auth_method"),
103+
Method: arcadego.F("method"),
104+
Params: arcadego.F(map[string]string{
105+
"foo": "string",
106+
}),
107+
RequestContentType: arcadego.F(arcadego.AuthProviderCreateRequestOauth2UserInfoRequestRequestContentTypeApplicationXWwwFormUrlencoded),
108+
ResponseContentType: arcadego.F(arcadego.AuthProviderCreateRequestOauth2UserInfoRequestResponseContentTypeApplicationXWwwFormUrlencoded),
109+
ResponseMap: arcadego.F(map[string]string{
110+
"foo": "string",
111+
}),
112+
}),
113+
}),
114+
ProviderID: arcadego.F("provider_id"),
115+
Status: arcadego.F("status"),
116+
Type: arcadego.F("type"),
117+
},
118+
})
119+
if err != nil {
120+
var apierr *arcadego.Error
121+
if errors.As(err, &apierr) {
122+
t.Log(string(apierr.DumpRequest(true)))
123+
}
124+
t.Fatalf("err should be nil: %s", err.Error())
125+
}
126+
}
127+
128+
func TestAdminAuthProviderList(t *testing.T) {
129+
baseURL := "http://localhost:4010"
130+
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
131+
baseURL = envURL
132+
}
133+
if !testutil.CheckTestServer(t, baseURL) {
134+
return
135+
}
136+
client := arcadego.NewClient(
137+
option.WithBaseURL(baseURL),
138+
option.WithAPIKey("My API Key"),
139+
)
140+
_, err := client.Admin.AuthProviders.List(context.TODO())
141+
if err != nil {
142+
var apierr *arcadego.Error
143+
if errors.As(err, &apierr) {
144+
t.Log(string(apierr.DumpRequest(true)))
145+
}
146+
t.Fatalf("err should be nil: %s", err.Error())
147+
}
148+
}
149+
150+
func TestAdminAuthProviderDelete(t *testing.T) {
151+
baseURL := "http://localhost:4010"
152+
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
153+
baseURL = envURL
154+
}
155+
if !testutil.CheckTestServer(t, baseURL) {
156+
return
157+
}
158+
client := arcadego.NewClient(
159+
option.WithBaseURL(baseURL),
160+
option.WithAPIKey("My API Key"),
161+
)
162+
_, err := client.Admin.AuthProviders.Delete(context.TODO(), "id")
163+
if err != nil {
164+
var apierr *arcadego.Error
165+
if errors.As(err, &apierr) {
166+
t.Log(string(apierr.DumpRequest(true)))
167+
}
168+
t.Fatalf("err should be nil: %s", err.Error())
169+
}
170+
}
171+
172+
func TestAdminAuthProviderGet(t *testing.T) {
173+
baseURL := "http://localhost:4010"
174+
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
175+
baseURL = envURL
176+
}
177+
if !testutil.CheckTestServer(t, baseURL) {
178+
return
179+
}
180+
client := arcadego.NewClient(
181+
option.WithBaseURL(baseURL),
182+
option.WithAPIKey("My API Key"),
183+
)
184+
_, err := client.Admin.AuthProviders.Get(context.TODO(), "id")
185+
if err != nil {
186+
var apierr *arcadego.Error
187+
if errors.As(err, &apierr) {
188+
t.Log(string(apierr.DumpRequest(true)))
189+
}
190+
t.Fatalf("err should be nil: %s", err.Error())
191+
}
192+
}
193+
194+
func TestAdminAuthProviderPatchWithOptionalParams(t *testing.T) {
195+
baseURL := "http://localhost:4010"
196+
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
197+
baseURL = envURL
198+
}
199+
if !testutil.CheckTestServer(t, baseURL) {
200+
return
201+
}
202+
client := arcadego.NewClient(
203+
option.WithBaseURL(baseURL),
204+
option.WithAPIKey("My API Key"),
205+
)
206+
_, err := client.Admin.AuthProviders.Patch(
207+
context.TODO(),
208+
"id",
209+
arcadego.AdminAuthProviderPatchParams{
210+
AuthProviderUpdateRequest: arcadego.AuthProviderUpdateRequestParam{
211+
ID: arcadego.F("id"),
212+
Description: arcadego.F("description"),
213+
Oauth2: arcadego.F(arcadego.AuthProviderUpdateRequestOauth2Param{
214+
AuthorizeRequest: arcadego.F(arcadego.AuthProviderUpdateRequestOauth2AuthorizeRequestParam{
215+
AuthMethod: arcadego.F("auth_method"),
216+
Endpoint: arcadego.F("endpoint"),
217+
Method: arcadego.F("method"),
218+
Params: arcadego.F(map[string]string{
219+
"foo": "string",
220+
}),
221+
RequestContentType: arcadego.F(arcadego.AuthProviderUpdateRequestOauth2AuthorizeRequestRequestContentTypeApplicationXWwwFormUrlencoded),
222+
ResponseContentType: arcadego.F(arcadego.AuthProviderUpdateRequestOauth2AuthorizeRequestResponseContentTypeApplicationXWwwFormUrlencoded),
223+
ResponseMap: arcadego.F(map[string]string{
224+
"foo": "string",
225+
}),
226+
}),
227+
ClientID: arcadego.F("client_id"),
228+
ClientSecret: arcadego.F("client_secret"),
229+
Pkce: arcadego.F(arcadego.AuthProviderUpdateRequestOauth2PkceParam{
230+
CodeChallengeMethod: arcadego.F("code_challenge_method"),
231+
Enabled: arcadego.F(true),
232+
}),
233+
RefreshRequest: arcadego.F(arcadego.AuthProviderUpdateRequestOauth2RefreshRequestParam{
234+
AuthMethod: arcadego.F("auth_method"),
235+
Endpoint: arcadego.F("endpoint"),
236+
Method: arcadego.F("method"),
237+
Params: arcadego.F(map[string]string{
238+
"foo": "string",
239+
}),
240+
RequestContentType: arcadego.F(arcadego.AuthProviderUpdateRequestOauth2RefreshRequestRequestContentTypeApplicationXWwwFormUrlencoded),
241+
ResponseContentType: arcadego.F(arcadego.AuthProviderUpdateRequestOauth2RefreshRequestResponseContentTypeApplicationXWwwFormUrlencoded),
242+
ResponseMap: arcadego.F(map[string]string{
243+
"foo": "string",
244+
}),
245+
}),
246+
ScopeDelimiter: arcadego.F(arcadego.AuthProviderUpdateRequestOauth2ScopeDelimiterUnknown1),
247+
TokenRequest: arcadego.F(arcadego.AuthProviderUpdateRequestOauth2TokenRequestParam{
248+
AuthMethod: arcadego.F("auth_method"),
249+
Endpoint: arcadego.F("endpoint"),
250+
Method: arcadego.F("method"),
251+
Params: arcadego.F(map[string]string{
252+
"foo": "string",
253+
}),
254+
RequestContentType: arcadego.F(arcadego.AuthProviderUpdateRequestOauth2TokenRequestRequestContentTypeApplicationXWwwFormUrlencoded),
255+
ResponseContentType: arcadego.F(arcadego.AuthProviderUpdateRequestOauth2TokenRequestResponseContentTypeApplicationXWwwFormUrlencoded),
256+
ResponseMap: arcadego.F(map[string]string{
257+
"foo": "string",
258+
}),
259+
}),
260+
UserInfoRequest: arcadego.F(arcadego.AuthProviderUpdateRequestOauth2UserInfoRequestParam{
261+
AuthMethod: arcadego.F("auth_method"),
262+
Endpoint: arcadego.F("endpoint"),
263+
Method: arcadego.F("method"),
264+
Params: arcadego.F(map[string]string{
265+
"foo": "string",
266+
}),
267+
RequestContentType: arcadego.F(arcadego.AuthProviderUpdateRequestOauth2UserInfoRequestRequestContentTypeApplicationXWwwFormUrlencoded),
268+
ResponseContentType: arcadego.F(arcadego.AuthProviderUpdateRequestOauth2UserInfoRequestResponseContentTypeApplicationXWwwFormUrlencoded),
269+
ResponseMap: arcadego.F(map[string]string{
270+
"foo": "string",
271+
}),
272+
Triggers: arcadego.F(arcadego.AuthProviderUpdateRequestOauth2UserInfoRequestTriggersParam{
273+
OnTokenGrant: arcadego.F(true),
274+
OnTokenRefresh: arcadego.F(true),
275+
}),
276+
}),
277+
}),
278+
ProviderID: arcadego.F("provider_id"),
279+
Status: arcadego.F("status"),
280+
Type: arcadego.F("type"),
281+
},
282+
},
283+
)
284+
if err != nil {
285+
var apierr *arcadego.Error
286+
if errors.As(err, &apierr) {
287+
t.Log(string(apierr.DumpRequest(true)))
288+
}
289+
t.Fatalf("err should be nil: %s", err.Error())
290+
}
291+
}

0 commit comments

Comments
 (0)