Skip to content

Commit

Permalink
feat(api): api update (#3855)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Jan 23, 2025
1 parent c6ebba3 commit e126ccb
Show file tree
Hide file tree
Showing 9 changed files with 265 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1493
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-1e73ee53fddc61d4ddfa1837bcbc2792e682a435439373fff24a718b4d8f7783.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-ed24ef293c8f10ea1c884e533b435244b266e97c6e01211430ac9d39e6daebb0.yml
8 changes: 8 additions & 0 deletions shared/union.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ func (UnionString) ImplementsZeroTrustAccessApplicationUpdateParamsBodyDeviceEnr
}
func (UnionString) ImplementsZeroTrustAccessApplicationUpdateParamsBodyBrowserIsolationPermissionsApplicationPolicyUnion() {
}
func (UnionString) ImplementsZeroTrustDLPEmailRuleNewResponseConditionsValueUnion() {}
func (UnionString) ImplementsZeroTrustDLPEmailRuleUpdateResponseConditionsValueUnion() {}
func (UnionString) ImplementsZeroTrustDLPEmailRuleListResponseConditionsValueUnion() {}
func (UnionString) ImplementsZeroTrustDLPEmailRuleDeleteResponseConditionsValueUnion() {}
func (UnionString) ImplementsZeroTrustDLPEmailRuleBulkEditResponseConditionsValueUnion() {}
func (UnionString) ImplementsZeroTrustDLPEmailRuleGetResponseConditionsValueUnion() {}
func (UnionString) ImplementsZeroTrustDLPEmailRuleNewParamsConditionsValueUnion() {}
func (UnionString) ImplementsZeroTrustDLPEmailRuleUpdateParamsConditionsValueUnion() {}
func (UnionString) ImplementsRadarRankingTimeseriesGroupsResponseSerie0Union() {}
func (UnionString) ImplementsHostnamesSettingValueUnionParam() {}
func (UnionString) ImplementsHostnamesSettingValueUnion() {}
Expand Down
6 changes: 2 additions & 4 deletions url_scanner/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ func (r *ScanService) New(ctx context.Context, params ScanNewParams, opts ...opt
// "microsoft".<br/>- 'apikey:me AND date:[2024-01 TO 2024-10]': my scans from 2024
// January to 2024 October.<br/>- 'page.domain:(blogspot OR www.blogspot)':
// Searches for scans whose main domain starts with "blogspot" or with
// "www.blogspot"<br/>- 'date:>now-7d AND path:okta-sign-in.min.js: scans from the
// last 7 days with any request path that ends with "okta-sign-in.min.js"<br/>-
// 'page.asn:AS24940 AND hash:xxx': Websites hosted in AS24940 where a resource
// with the given hash was downloaded.
// "www.blogspot"<br/>- 'page.asn:AS24940 AND hash:xxx': Websites hosted in AS24940
// where a resource with the given hash was downloaded.
func (r *ScanService) List(ctx context.Context, params ScanListParams, opts ...option.RequestOption) (res *ScanListResponse, err error) {
opts = append(r.Options[:], opts...)
if params.AccountID.Value == "" {
Expand Down
21 changes: 18 additions & 3 deletions zero_trust/dlpdatasetupload.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
package zero_trust

import (
"bytes"
"context"
"errors"
"fmt"
"io"
"mime/multipart"
"net/http"

"github.com/cloudflare/cloudflare-go/v4/internal/apiform"
"github.com/cloudflare/cloudflare-go/v4/internal/apijson"
"github.com/cloudflare/cloudflare-go/v4/internal/param"
"github.com/cloudflare/cloudflare-go/v4/internal/requestconfig"
Expand Down Expand Up @@ -201,11 +205,22 @@ func (r DLPDatasetUploadNewResponseEnvelopeSuccess) IsKnown() bool {

type DLPDatasetUploadEditParams struct {
AccountID param.Field[string] `path:"account_id,required"`
Body string `json:"body,required"`
Body io.Reader `json:"body,required" format:"binary"`
}

func (r DLPDatasetUploadEditParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r.Body)
func (r DLPDatasetUploadEditParams) MarshalMultipart() (data []byte, contentType string, err error) {
buf := bytes.NewBuffer(nil)
writer := multipart.NewWriter(buf)
err = apiform.MarshalRoot(r, writer)
if err != nil {
writer.Close()
return nil, "", err
}
err = writer.Close()
if err != nil {
return nil, "", err
}
return buf.Bytes(), writer.FormDataContentType(), nil
}

type DLPDatasetUploadEditResponseEnvelope struct {
Expand Down
4 changes: 3 additions & 1 deletion zero_trust/dlpdatasetupload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
package zero_trust_test

import (
"bytes"
"context"
"errors"
"io"
"os"
"testing"

Expand Down Expand Up @@ -63,7 +65,7 @@ func TestDLPDatasetUploadEdit(t *testing.T) {
int64(0),
zero_trust.DLPDatasetUploadEditParams{
AccountID: cloudflare.F("account_id"),
Body: "body",
Body: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
},
)
if err != nil {
Expand Down
21 changes: 18 additions & 3 deletions zero_trust/dlpdatasetversionentry.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
package zero_trust

import (
"bytes"
"context"
"errors"
"fmt"
"io"
"mime/multipart"
"net/http"

"github.com/cloudflare/cloudflare-go/v4/internal/apiform"
"github.com/cloudflare/cloudflare-go/v4/internal/apijson"
"github.com/cloudflare/cloudflare-go/v4/internal/param"
"github.com/cloudflare/cloudflare-go/v4/internal/requestconfig"
Expand Down Expand Up @@ -107,11 +111,22 @@ func (r DLPDatasetVersionEntryNewResponseUploadStatus) IsKnown() bool {

type DLPDatasetVersionEntryNewParams struct {
AccountID param.Field[string] `path:"account_id,required"`
Body string `json:"body,required"`
Body io.Reader `json:"body,required" format:"binary"`
}

func (r DLPDatasetVersionEntryNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r.Body)
func (r DLPDatasetVersionEntryNewParams) MarshalMultipart() (data []byte, contentType string, err error) {
buf := bytes.NewBuffer(nil)
writer := multipart.NewWriter(buf)
err = apiform.MarshalRoot(r, writer)
if err != nil {
writer.Close()
return nil, "", err
}
err = writer.Close()
if err != nil {
return nil, "", err
}
return buf.Bytes(), writer.FormDataContentType(), nil
}

type DLPDatasetVersionEntryNewResponseEnvelope struct {
Expand Down
4 changes: 3 additions & 1 deletion zero_trust/dlpdatasetversionentry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
package zero_trust_test

import (
"bytes"
"context"
"errors"
"io"
"os"
"testing"

Expand Down Expand Up @@ -35,7 +37,7 @@ func TestDLPDatasetVersionEntryNew(t *testing.T) {
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
zero_trust.DLPDatasetVersionEntryNewParams{
AccountID: cloudflare.F("account_id"),
Body: "body",
Body: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
},
)
if err != nil {
Expand Down
Loading

0 comments on commit e126ccb

Please sign in to comment.