Skip to content

Commit

Permalink
feat: update via SDK Studio
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Feb 26, 2024
1 parent 7636789 commit 2c3506b
Show file tree
Hide file tree
Showing 69 changed files with 20,671 additions and 2,620 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 1200
configured_endpoints: 1249
116 changes: 116 additions & 0 deletions accessbookmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ func NewAccessBookmarkService(opts ...option.RequestOption) (r *AccessBookmarkSe
return
}

// Create a new Bookmark application.
func (r *AccessBookmarkService) New(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccessBookmarkNewResponse, err error) {
opts = append(r.Options[:], opts...)
var env AccessBookmarkNewResponseEnvelope
path := fmt.Sprintf("accounts/%v/access/bookmarks/%s", identifier, uuid)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...)
if err != nil {
return
}
res = &env.Result
return
}

// Updates a configured Bookmark application.
func (r *AccessBookmarkService) Update(ctx context.Context, identifier interface{}, uuid string, opts ...option.RequestOption) (res *AccessBookmarkUpdateResponse, err error) {
opts = append(r.Options[:], opts...)
Expand Down Expand Up @@ -83,6 +96,40 @@ func (r *AccessBookmarkService) Get(ctx context.Context, identifier interface{},
return
}

type AccessBookmarkNewResponse struct {
// The unique identifier for the Bookmark application.
ID interface{} `json:"id"`
// Displays the application in the App Launcher.
AppLauncherVisible bool `json:"app_launcher_visible"`
CreatedAt time.Time `json:"created_at" format:"date-time"`
// The domain of the Bookmark application.
Domain string `json:"domain"`
// The image URL for the logo shown in the App Launcher dashboard.
LogoURL string `json:"logo_url"`
// The name of the Bookmark application.
Name string `json:"name"`
UpdatedAt time.Time `json:"updated_at" format:"date-time"`
JSON accessBookmarkNewResponseJSON `json:"-"`
}

// accessBookmarkNewResponseJSON contains the JSON metadata for the struct
// [AccessBookmarkNewResponse]
type accessBookmarkNewResponseJSON struct {
ID apijson.Field
AppLauncherVisible apijson.Field
CreatedAt apijson.Field
Domain apijson.Field
LogoURL apijson.Field
Name apijson.Field
UpdatedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *AccessBookmarkNewResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

type AccessBookmarkUpdateResponse struct {
// The unique identifier for the Bookmark application.
ID interface{} `json:"id"`
Expand Down Expand Up @@ -203,6 +250,75 @@ func (r *AccessBookmarkGetResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

type AccessBookmarkNewResponseEnvelope struct {
Errors []AccessBookmarkNewResponseEnvelopeErrors `json:"errors,required"`
Messages []AccessBookmarkNewResponseEnvelopeMessages `json:"messages,required"`
Result AccessBookmarkNewResponse `json:"result,required"`
// Whether the API call was successful
Success AccessBookmarkNewResponseEnvelopeSuccess `json:"success,required"`
JSON accessBookmarkNewResponseEnvelopeJSON `json:"-"`
}

// accessBookmarkNewResponseEnvelopeJSON contains the JSON metadata for the struct
// [AccessBookmarkNewResponseEnvelope]
type accessBookmarkNewResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Result apijson.Field
Success apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *AccessBookmarkNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

type AccessBookmarkNewResponseEnvelopeErrors struct {
Code int64 `json:"code,required"`
Message string `json:"message,required"`
JSON accessBookmarkNewResponseEnvelopeErrorsJSON `json:"-"`
}

// accessBookmarkNewResponseEnvelopeErrorsJSON contains the JSON metadata for the
// struct [AccessBookmarkNewResponseEnvelopeErrors]
type accessBookmarkNewResponseEnvelopeErrorsJSON struct {
Code apijson.Field
Message apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *AccessBookmarkNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

type AccessBookmarkNewResponseEnvelopeMessages struct {
Code int64 `json:"code,required"`
Message string `json:"message,required"`
JSON accessBookmarkNewResponseEnvelopeMessagesJSON `json:"-"`
}

// accessBookmarkNewResponseEnvelopeMessagesJSON contains the JSON metadata for the
// struct [AccessBookmarkNewResponseEnvelopeMessages]
type accessBookmarkNewResponseEnvelopeMessagesJSON struct {
Code apijson.Field
Message apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *AccessBookmarkNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

// Whether the API call was successful
type AccessBookmarkNewResponseEnvelopeSuccess bool

const (
AccessBookmarkNewResponseEnvelopeSuccessTrue AccessBookmarkNewResponseEnvelopeSuccess = true
)

type AccessBookmarkUpdateResponseEnvelope struct {
Errors []AccessBookmarkUpdateResponseEnvelopeErrors `json:"errors,required"`
Messages []AccessBookmarkUpdateResponseEnvelopeMessages `json:"messages,required"`
Expand Down
30 changes: 30 additions & 0 deletions accessbookmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,36 @@ import (
"github.com/cloudflare/cloudflare-sdk-go/option"
)

func TestAccessBookmarkNew(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
client := cloudflare.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
option.WithAPIEmail("user@example.com"),
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"),
)
_, err := client.Access.Bookmarks.New(
context.TODO(),
"699d98642c564d2e855e9661899b7252",
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
)
if err != nil {
var apierr *cloudflare.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
t.Fatalf("err should be nil: %s", err.Error())
}
}

func TestAccessBookmarkUpdate(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
baseURL := "http://localhost:4010"
Expand Down
Loading

0 comments on commit 2c3506b

Please sign in to comment.