Skip to content

Commit 8675c4c

Browse files
chore(api): update composite API spec
1 parent c582b3d commit 8675c4c

File tree

211 files changed

+23805
-5841
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

211 files changed

+23805
-5841
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 1827
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-cceecd20dfd89884f795e75b433848994bed610b79802c65104f0c70d3ada54e.yml
3-
openapi_spec_hash: c33c0e26e48c004c1781a36748d0144c
1+
configured_endpoints: 1877
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-14a3b2ebf89026a58339dccffb181f8ebaf2a0d6b49c425e80ab440df531543b.yml
3+
openapi_spec_hash: d0bd60b1ac48f6781bc40ecc5ce8e959
44
config_hash: 7e9a9c5842165e28e0901309e95ab577

abuse_reports/abusereport.go

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

abuse_reports/abusereport_test.go

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
package abuse_reports_test
4+
5+
import (
6+
"context"
7+
"errors"
8+
"os"
9+
"testing"
10+
11+
"github.com/cloudflare/cloudflare-go/v6"
12+
"github.com/cloudflare/cloudflare-go/v6/abuse_reports"
13+
"github.com/cloudflare/cloudflare-go/v6/internal/testutil"
14+
"github.com/cloudflare/cloudflare-go/v6/option"
15+
)
16+
17+
func TestAbuseReportNewWithOptionalParams(t *testing.T) {
18+
t.Skip("TODO: investigate unauthorized HTTP response")
19+
baseURL := "http://localhost:4010"
20+
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
21+
baseURL = envURL
22+
}
23+
if !testutil.CheckTestServer(t, baseURL) {
24+
return
25+
}
26+
client := cloudflare.NewClient(
27+
option.WithBaseURL(baseURL),
28+
option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
29+
option.WithAPIEmail("user@example.com"),
30+
)
31+
_, err := client.AbuseReports.New(
32+
context.TODO(),
33+
"report_param",
34+
abuse_reports.AbuseReportNewParams{
35+
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
36+
Body: abuse_reports.AbuseReportNewParamsBodyAbuseReportsDmcaReport{
37+
Act: cloudflare.F(abuse_reports.AbuseReportNewParamsBodyAbuseReportsDmcaReportActAbuseDmca),
38+
Address1: cloudflare.F("x"),
39+
AgentName: cloudflare.F("x"),
40+
Agree: cloudflare.F(abuse_reports.AbuseReportNewParamsBodyAbuseReportsDmcaReportAgree1),
41+
City: cloudflare.F("x"),
42+
Country: cloudflare.F("x"),
43+
Email: cloudflare.F("email"),
44+
Email2: cloudflare.F("email2"),
45+
HostNotification: cloudflare.F(abuse_reports.AbuseReportNewParamsBodyAbuseReportsDmcaReportHostNotificationSend),
46+
Name: cloudflare.F("x"),
47+
OriginalWork: cloudflare.F("x"),
48+
OwnerNotification: cloudflare.F(abuse_reports.AbuseReportNewParamsBodyAbuseReportsDmcaReportOwnerNotificationSend),
49+
Signature: cloudflare.F("signature"),
50+
State: cloudflare.F("x"),
51+
URLs: cloudflare.F("urls"),
52+
Comments: cloudflare.F("x"),
53+
Company: cloudflare.F("x"),
54+
ReportedCountry: cloudflare.F("xx"),
55+
ReportedUserAgent: cloudflare.F("x"),
56+
Tele: cloudflare.F("x"),
57+
Title: cloudflare.F("x"),
58+
},
59+
},
60+
)
61+
if err != nil {
62+
var apierr *cloudflare.Error
63+
if errors.As(err, &apierr) {
64+
t.Log(string(apierr.DumpRequest(true)))
65+
}
66+
t.Fatalf("err should be nil: %s", err.Error())
67+
}
68+
}

accounts/account.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ type Account struct {
149149
Type AccountType `json:"type,required"`
150150
// Timestamp for the creation of the account
151151
CreatedOn time.Time `json:"created_on" format:"date-time"`
152+
// Parent container details
153+
ManagedBy AccountManagedBy `json:"managed_by"`
152154
// Account settings
153155
Settings AccountSettings `json:"settings"`
154156
JSON accountJSON `json:"-"`
@@ -160,6 +162,7 @@ type accountJSON struct {
160162
Name apijson.Field
161163
Type apijson.Field
162164
CreatedOn apijson.Field
165+
ManagedBy apijson.Field
163166
Settings apijson.Field
164167
raw string
165168
ExtraFields map[string]apijson.Field
@@ -188,6 +191,32 @@ func (r AccountType) IsKnown() bool {
188191
return false
189192
}
190193

194+
// Parent container details
195+
type AccountManagedBy struct {
196+
// ID of the parent Organization, if one exists
197+
ParentOrgID string `json:"parent_org_id"`
198+
// Name of the parent Organization, if one exists
199+
ParentOrgName string `json:"parent_org_name"`
200+
JSON accountManagedByJSON `json:"-"`
201+
}
202+
203+
// accountManagedByJSON contains the JSON metadata for the struct
204+
// [AccountManagedBy]
205+
type accountManagedByJSON struct {
206+
ParentOrgID apijson.Field
207+
ParentOrgName apijson.Field
208+
raw string
209+
ExtraFields map[string]apijson.Field
210+
}
211+
212+
func (r *AccountManagedBy) UnmarshalJSON(data []byte) (err error) {
213+
return apijson.UnmarshalRoot(data, r)
214+
}
215+
216+
func (r accountManagedByJSON) RawJSON() string {
217+
return r.raw
218+
}
219+
191220
// Account settings
192221
type AccountSettings struct {
193222
// Sets an abuse contact email to notify for abuse reports.
@@ -220,6 +249,8 @@ type AccountParam struct {
220249
// Account name
221250
Name param.Field[string] `json:"name,required"`
222251
Type param.Field[AccountType] `json:"type,required"`
252+
// Parent container details
253+
ManagedBy param.Field[AccountManagedByParam] `json:"managed_by"`
223254
// Account settings
224255
Settings param.Field[AccountSettingsParam] `json:"settings"`
225256
}
@@ -228,6 +259,14 @@ func (r AccountParam) MarshalJSON() (data []byte, err error) {
228259
return apijson.MarshalRoot(r)
229260
}
230261

262+
// Parent container details
263+
type AccountManagedByParam struct {
264+
}
265+
266+
func (r AccountManagedByParam) MarshalJSON() (data []byte, err error) {
267+
return apijson.MarshalRoot(r)
268+
}
269+
231270
// Account settings
232271
type AccountSettingsParam struct {
233272
// Sets an abuse contact email to notify for abuse reports.

accounts/account_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ func TestAccountUpdateWithOptionalParams(t *testing.T) {
5959
_, err := client.Accounts.Update(context.TODO(), accounts.AccountUpdateParams{
6060
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
6161
Account: accounts.AccountParam{
62-
ID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
63-
Name: cloudflare.F("Demo Account"),
64-
Type: cloudflare.F(accounts.AccountTypeStandard),
62+
ID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
63+
Name: cloudflare.F("Demo Account"),
64+
Type: cloudflare.F(accounts.AccountTypeStandard),
65+
ManagedBy: cloudflare.F(accounts.AccountManagedByParam{}),
6566
Settings: cloudflare.F(accounts.AccountSettingsParam{
6667
AbuseContactEmail: cloudflare.F("abuse_contact_email"),
6768
EnforceTwofactor: cloudflare.F(true),

accounts/accountorganization.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ func NewAccountOrganizationService(opts ...option.RequestOption) (r *AccountOrga
3636
}
3737

3838
// Move an account within an organization hierarchy or an account outside an
39-
// organization.
39+
// organization. (Currently in Closed Beta - see
40+
// https://developers.cloudflare.com/fundamentals/organizations/)
4041
func (r *AccountOrganizationService) New(ctx context.Context, params AccountOrganizationNewParams, opts ...option.RequestOption) (res *AccountOrganizationNewResponse, err error) {
4142
var env AccountOrganizationNewResponseEnvelope
4243
opts = slices.Concat(r.Options, opts)

0 commit comments

Comments
 (0)