Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#1574)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Mar 18, 2024
1 parent d10cd88 commit b7478f6
Show file tree
Hide file tree
Showing 7 changed files with 179 additions and 91 deletions.
135 changes: 96 additions & 39 deletions dns/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -16611,19 +16611,19 @@ func (r recordScanResponseJSON) RawJSON() string {

type RecordNewParams struct {
// Identifier
ZoneID param.Field[string] `path:"zone_id,required"`
ZoneID param.Field[string] `path:"zone_id,required"`
Data param.Field[RecordNewParamsData] `json:"data,required"`
// DNS record name (or @ for the zone apex) in Punycode.
Name param.Field[string] `json:"name,required"`
// Required for MX, SRV and URI records; unused by other record types. Records with
// lower priorities are preferred.
Priority param.Field[float64] `json:"priority,required"`
// Record type.
Type param.Field[RecordNewParamsType] `json:"type,required"`
// Comments or notes about the DNS record. This field has no effect on DNS
// responses.
Comment param.Field[string] `json:"comment"`
Data param.Field[RecordNewParamsData] `json:"data"`
Meta param.Field[RecordNewParamsMeta] `json:"meta"`
// Required for MX, SRV and URI records; unused by other record types. Records with
// lower priorities are preferred.
Priority param.Field[float64] `json:"priority"`
// Whether the record is receiving the performance and security benefits of
// Cloudflare.
Proxied param.Field[bool] `json:"proxied"`
Expand All @@ -16639,13 +16639,6 @@ func (r RecordNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

// Record type.
type RecordNewParamsType string

const (
RecordNewParamsTypeURI RecordNewParamsType = "URI"
)

type RecordNewParamsData struct {
// algorithm.
Algorithm param.Field[float64] `json:"algorithm"`
Expand All @@ -16662,7 +16655,7 @@ type RecordNewParamsData struct {
// fingerprint.
Fingerprint param.Field[string] `json:"fingerprint"`
// Flags.
Flags param.Field[string] `json:"flags"`
Flags param.Field[interface{}] `json:"flags"`
// Key Tag.
KeyTag param.Field[float64] `json:"key_tag"`
// Degrees of latitude.
Expand Down Expand Up @@ -16753,6 +16746,32 @@ const (
RecordNewParamsDataLongDirectionW RecordNewParamsDataLongDirection = "W"
)

// Record type.
type RecordNewParamsType string

const (
RecordNewParamsTypeURI RecordNewParamsType = "URI"
RecordNewParamsTypeTXT RecordNewParamsType = "TXT"
RecordNewParamsTypeTLSA RecordNewParamsType = "TLSA"
RecordNewParamsTypeSVCB RecordNewParamsType = "SVCB"
RecordNewParamsTypeSSHFP RecordNewParamsType = "SSHFP"
RecordNewParamsTypeSRV RecordNewParamsType = "SRV"
RecordNewParamsTypeSmimea RecordNewParamsType = "SMIMEA"
RecordNewParamsTypePTR RecordNewParamsType = "PTR"
RecordNewParamsTypeNS RecordNewParamsType = "NS"
RecordNewParamsTypeNAPTR RecordNewParamsType = "NAPTR"
RecordNewParamsTypeMX RecordNewParamsType = "MX"
RecordNewParamsTypeLOC RecordNewParamsType = "LOC"
RecordNewParamsTypeHTTPS RecordNewParamsType = "HTTPS"
RecordNewParamsTypeDS RecordNewParamsType = "DS"
RecordNewParamsTypeDNSKEY RecordNewParamsType = "DNSKEY"
RecordNewParamsTypeCNAME RecordNewParamsType = "CNAME"
RecordNewParamsTypeCert RecordNewParamsType = "CERT"
RecordNewParamsTypeCAA RecordNewParamsType = "CAA"
RecordNewParamsTypeAAAA RecordNewParamsType = "AAAA"
RecordNewParamsTypeA RecordNewParamsType = "A"
)

type RecordNewParamsMeta struct {
// Will exist if Cloudflare automatically added this DNS record during initial
// setup.
Expand Down Expand Up @@ -16863,19 +16882,19 @@ const (

type RecordUpdateParams struct {
// Identifier
ZoneID param.Field[string] `path:"zone_id,required"`
ZoneID param.Field[string] `path:"zone_id,required"`
Data param.Field[RecordUpdateParamsData] `json:"data,required"`
// DNS record name (or @ for the zone apex) in Punycode.
Name param.Field[string] `json:"name,required"`
// Required for MX, SRV and URI records; unused by other record types. Records with
// lower priorities are preferred.
Priority param.Field[float64] `json:"priority,required"`
// Record type.
Type param.Field[RecordUpdateParamsType] `json:"type,required"`
// Comments or notes about the DNS record. This field has no effect on DNS
// responses.
Comment param.Field[string] `json:"comment"`
Data param.Field[RecordUpdateParamsData] `json:"data"`
Meta param.Field[RecordUpdateParamsMeta] `json:"meta"`
// Required for MX, SRV and URI records; unused by other record types. Records with
// lower priorities are preferred.
Priority param.Field[float64] `json:"priority"`
// Whether the record is receiving the performance and security benefits of
// Cloudflare.
Proxied param.Field[bool] `json:"proxied"`
Expand All @@ -16891,13 +16910,6 @@ func (r RecordUpdateParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

// Record type.
type RecordUpdateParamsType string

const (
RecordUpdateParamsTypeURI RecordUpdateParamsType = "URI"
)

type RecordUpdateParamsData struct {
// algorithm.
Algorithm param.Field[float64] `json:"algorithm"`
Expand All @@ -16914,7 +16926,7 @@ type RecordUpdateParamsData struct {
// fingerprint.
Fingerprint param.Field[string] `json:"fingerprint"`
// Flags.
Flags param.Field[string] `json:"flags"`
Flags param.Field[interface{}] `json:"flags"`
// Key Tag.
KeyTag param.Field[float64] `json:"key_tag"`
// Degrees of latitude.
Expand Down Expand Up @@ -17005,6 +17017,32 @@ const (
RecordUpdateParamsDataLongDirectionW RecordUpdateParamsDataLongDirection = "W"
)

// Record type.
type RecordUpdateParamsType string

const (
RecordUpdateParamsTypeURI RecordUpdateParamsType = "URI"
RecordUpdateParamsTypeTXT RecordUpdateParamsType = "TXT"
RecordUpdateParamsTypeTLSA RecordUpdateParamsType = "TLSA"
RecordUpdateParamsTypeSVCB RecordUpdateParamsType = "SVCB"
RecordUpdateParamsTypeSSHFP RecordUpdateParamsType = "SSHFP"
RecordUpdateParamsTypeSRV RecordUpdateParamsType = "SRV"
RecordUpdateParamsTypeSmimea RecordUpdateParamsType = "SMIMEA"
RecordUpdateParamsTypePTR RecordUpdateParamsType = "PTR"
RecordUpdateParamsTypeNS RecordUpdateParamsType = "NS"
RecordUpdateParamsTypeNAPTR RecordUpdateParamsType = "NAPTR"
RecordUpdateParamsTypeMX RecordUpdateParamsType = "MX"
RecordUpdateParamsTypeLOC RecordUpdateParamsType = "LOC"
RecordUpdateParamsTypeHTTPS RecordUpdateParamsType = "HTTPS"
RecordUpdateParamsTypeDS RecordUpdateParamsType = "DS"
RecordUpdateParamsTypeDNSKEY RecordUpdateParamsType = "DNSKEY"
RecordUpdateParamsTypeCNAME RecordUpdateParamsType = "CNAME"
RecordUpdateParamsTypeCert RecordUpdateParamsType = "CERT"
RecordUpdateParamsTypeCAA RecordUpdateParamsType = "CAA"
RecordUpdateParamsTypeAAAA RecordUpdateParamsType = "AAAA"
RecordUpdateParamsTypeA RecordUpdateParamsType = "A"
)

type RecordUpdateParamsMeta struct {
// Will exist if Cloudflare automatically added this DNS record during initial
// setup.
Expand Down Expand Up @@ -17313,19 +17351,19 @@ func (r recordDeleteResponseEnvelopeJSON) RawJSON() string {

type RecordEditParams struct {
// Identifier
ZoneID param.Field[string] `path:"zone_id,required"`
ZoneID param.Field[string] `path:"zone_id,required"`
Data param.Field[RecordEditParamsData] `json:"data,required"`
// DNS record name (or @ for the zone apex) in Punycode.
Name param.Field[string] `json:"name,required"`
// Required for MX, SRV and URI records; unused by other record types. Records with
// lower priorities are preferred.
Priority param.Field[float64] `json:"priority,required"`
// Record type.
Type param.Field[RecordEditParamsType] `json:"type,required"`
// Comments or notes about the DNS record. This field has no effect on DNS
// responses.
Comment param.Field[string] `json:"comment"`
Data param.Field[RecordEditParamsData] `json:"data"`
Meta param.Field[RecordEditParamsMeta] `json:"meta"`
// Required for MX, SRV and URI records; unused by other record types. Records with
// lower priorities are preferred.
Priority param.Field[float64] `json:"priority"`
// Whether the record is receiving the performance and security benefits of
// Cloudflare.
Proxied param.Field[bool] `json:"proxied"`
Expand All @@ -17341,13 +17379,6 @@ func (r RecordEditParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

// Record type.
type RecordEditParamsType string

const (
RecordEditParamsTypeURI RecordEditParamsType = "URI"
)

type RecordEditParamsData struct {
// algorithm.
Algorithm param.Field[float64] `json:"algorithm"`
Expand All @@ -17364,7 +17395,7 @@ type RecordEditParamsData struct {
// fingerprint.
Fingerprint param.Field[string] `json:"fingerprint"`
// Flags.
Flags param.Field[string] `json:"flags"`
Flags param.Field[interface{}] `json:"flags"`
// Key Tag.
KeyTag param.Field[float64] `json:"key_tag"`
// Degrees of latitude.
Expand Down Expand Up @@ -17455,6 +17486,32 @@ const (
RecordEditParamsDataLongDirectionW RecordEditParamsDataLongDirection = "W"
)

// Record type.
type RecordEditParamsType string

const (
RecordEditParamsTypeURI RecordEditParamsType = "URI"
RecordEditParamsTypeTXT RecordEditParamsType = "TXT"
RecordEditParamsTypeTLSA RecordEditParamsType = "TLSA"
RecordEditParamsTypeSVCB RecordEditParamsType = "SVCB"
RecordEditParamsTypeSSHFP RecordEditParamsType = "SSHFP"
RecordEditParamsTypeSRV RecordEditParamsType = "SRV"
RecordEditParamsTypeSmimea RecordEditParamsType = "SMIMEA"
RecordEditParamsTypePTR RecordEditParamsType = "PTR"
RecordEditParamsTypeNS RecordEditParamsType = "NS"
RecordEditParamsTypeNAPTR RecordEditParamsType = "NAPTR"
RecordEditParamsTypeMX RecordEditParamsType = "MX"
RecordEditParamsTypeLOC RecordEditParamsType = "LOC"
RecordEditParamsTypeHTTPS RecordEditParamsType = "HTTPS"
RecordEditParamsTypeDS RecordEditParamsType = "DS"
RecordEditParamsTypeDNSKEY RecordEditParamsType = "DNSKEY"
RecordEditParamsTypeCNAME RecordEditParamsType = "CNAME"
RecordEditParamsTypeCert RecordEditParamsType = "CERT"
RecordEditParamsTypeCAA RecordEditParamsType = "CAA"
RecordEditParamsTypeAAAA RecordEditParamsType = "AAAA"
RecordEditParamsTypeA RecordEditParamsType = "A"
)

type RecordEditParamsMeta struct {
// Will exist if Cloudflare automatically added this DNS record during initial
// setup.
Expand Down
54 changes: 27 additions & 27 deletions dns/record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,9 @@ func TestRecordNewWithOptionalParams(t *testing.T) {
option.WithAPIEmail("user@example.com"),
)
_, err := client.DNS.Records.New(context.TODO(), dns.RecordNewParams{
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Name: cloudflare.F("example.com"),
Type: cloudflare.F(dns.RecordNewParamsTypeURI),
Comment: cloudflare.F("Domain verification record"),
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Data: cloudflare.F(dns.RecordNewParamsData{
Flags: cloudflare.F("string"),
Flags: cloudflare.F[any](map[string]interface{}{}),
Tag: cloudflare.F("issue"),
Value: cloudflare.F("alpn=\"h3,h2\" ipv4hint=\"127.0.0.1\" ipv6hint=\"::1\""),
Algorithm: cloudflare.F(2.000000),
Expand Down Expand Up @@ -75,14 +72,17 @@ func TestRecordNewWithOptionalParams(t *testing.T) {
Fingerprint: cloudflare.F("string"),
Content: cloudflare.F("http://example.com/example.html"),
}),
Name: cloudflare.F("example.com"),
Priority: cloudflare.F(10.000000),
Type: cloudflare.F(dns.RecordNewParamsTypeURI),
Comment: cloudflare.F("Domain verification record"),
Meta: cloudflare.F(dns.RecordNewParamsMeta{
AutoAdded: cloudflare.F(true),
Source: cloudflare.F("primary"),
}),
Priority: cloudflare.F(10.000000),
Proxied: cloudflare.F(false),
Tags: cloudflare.F([]string{"owner:dns-team", "owner:dns-team", "owner:dns-team"}),
TTL: cloudflare.F[dns.RecordNewParamsTTL](shared.UnionFloat(3600.000000)),
Proxied: cloudflare.F(false),
Tags: cloudflare.F([]string{"owner:dns-team", "owner:dns-team", "owner:dns-team"}),
TTL: cloudflare.F[dns.RecordNewParamsTTL](shared.UnionFloat(3600.000000)),
})
if err != nil {
var apierr *cloudflare.Error
Expand Down Expand Up @@ -111,12 +111,9 @@ func TestRecordUpdateWithOptionalParams(t *testing.T) {
context.TODO(),
"023e105f4ecef8ad9ca31a8372d0c353",
dns.RecordUpdateParams{
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Name: cloudflare.F("example.com"),
Type: cloudflare.F(dns.RecordUpdateParamsTypeURI),
Comment: cloudflare.F("Domain verification record"),
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Data: cloudflare.F(dns.RecordUpdateParamsData{
Flags: cloudflare.F("string"),
Flags: cloudflare.F[any](map[string]interface{}{}),
Tag: cloudflare.F("issue"),
Value: cloudflare.F("alpn=\"h3,h2\" ipv4hint=\"127.0.0.1\" ipv6hint=\"::1\""),
Algorithm: cloudflare.F(2.000000),
Expand Down Expand Up @@ -156,14 +153,17 @@ func TestRecordUpdateWithOptionalParams(t *testing.T) {
Fingerprint: cloudflare.F("string"),
Content: cloudflare.F("http://example.com/example.html"),
}),
Name: cloudflare.F("example.com"),
Priority: cloudflare.F(10.000000),
Type: cloudflare.F(dns.RecordUpdateParamsTypeURI),
Comment: cloudflare.F("Domain verification record"),
Meta: cloudflare.F(dns.RecordUpdateParamsMeta{
AutoAdded: cloudflare.F(true),
Source: cloudflare.F("primary"),
}),
Priority: cloudflare.F(10.000000),
Proxied: cloudflare.F(false),
Tags: cloudflare.F([]string{"owner:dns-team", "owner:dns-team", "owner:dns-team"}),
TTL: cloudflare.F[dns.RecordUpdateParamsTTL](shared.UnionFloat(3600.000000)),
Proxied: cloudflare.F(false),
Tags: cloudflare.F([]string{"owner:dns-team", "owner:dns-team", "owner:dns-team"}),
TTL: cloudflare.F[dns.RecordUpdateParamsTTL](shared.UnionFloat(3600.000000)),
},
)
if err != nil {
Expand Down Expand Up @@ -276,12 +276,9 @@ func TestRecordEditWithOptionalParams(t *testing.T) {
context.TODO(),
"023e105f4ecef8ad9ca31a8372d0c353",
dns.RecordEditParams{
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Name: cloudflare.F("example.com"),
Type: cloudflare.F(dns.RecordEditParamsTypeURI),
Comment: cloudflare.F("Domain verification record"),
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Data: cloudflare.F(dns.RecordEditParamsData{
Flags: cloudflare.F("string"),
Flags: cloudflare.F[any](map[string]interface{}{}),
Tag: cloudflare.F("issue"),
Value: cloudflare.F("alpn=\"h3,h2\" ipv4hint=\"127.0.0.1\" ipv6hint=\"::1\""),
Algorithm: cloudflare.F(2.000000),
Expand Down Expand Up @@ -321,14 +318,17 @@ func TestRecordEditWithOptionalParams(t *testing.T) {
Fingerprint: cloudflare.F("string"),
Content: cloudflare.F("http://example.com/example.html"),
}),
Name: cloudflare.F("example.com"),
Priority: cloudflare.F(10.000000),
Type: cloudflare.F(dns.RecordEditParamsTypeURI),
Comment: cloudflare.F("Domain verification record"),
Meta: cloudflare.F(dns.RecordEditParamsMeta{
AutoAdded: cloudflare.F(true),
Source: cloudflare.F("primary"),
}),
Priority: cloudflare.F(10.000000),
Proxied: cloudflare.F(false),
Tags: cloudflare.F([]string{"owner:dns-team", "owner:dns-team", "owner:dns-team"}),
TTL: cloudflare.F[dns.RecordEditParamsTTL](shared.UnionFloat(3600.000000)),
Proxied: cloudflare.F(false),
Tags: cloudflare.F([]string{"owner:dns-team", "owner:dns-team", "owner:dns-team"}),
TTL: cloudflare.F[dns.RecordEditParamsTTL](shared.UnionFloat(3600.000000)),
},
)
if err != nil {
Expand Down
20 changes: 10 additions & 10 deletions pcaps/pcap.go
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,14 @@ const (
type PCAPNewParams struct {
// Identifier
AccountID param.Field[string] `path:"account_id,required"`
// The name of the data center used for the packet capture. This can be a specific
// colo (ord02) or a multi-colo name (ORD). This field only applies to `full`
// packet captures.
ColoName param.Field[string] `json:"colo_name,required"`
// The full URI for the bucket. This field only applies to `full` packet captures.
DestinationConf param.Field[string] `json:"destination_conf,required"`
// The limit of packets contained in a packet capture.
PacketLimit param.Field[float64] `json:"packet_limit,required"`
// The system used to collect packet captures.
System param.Field[PCAPNewParamsSystem] `json:"system,required"`
// The packet capture duration in seconds.
Expand All @@ -852,16 +860,8 @@ type PCAPNewParams struct {
Type param.Field[PCAPNewParamsType] `json:"type,required"`
// The maximum number of bytes to capture. This field only applies to `full` packet
// captures.
ByteLimit param.Field[float64] `json:"byte_limit"`
// The name of the data center used for the packet capture. This can be a specific
// colo (ord02) or a multi-colo name (ORD). This field only applies to `full`
// packet captures.
ColoName param.Field[string] `json:"colo_name"`
// The full URI for the bucket. This field only applies to `full` packet captures.
DestinationConf param.Field[string] `json:"destination_conf"`
FilterV1 param.Field[PCAPNewParamsFilterV1] `json:"filter_v1"`
// The limit of packets contained in a packet capture.
PacketLimit param.Field[float64] `json:"packet_limit"`
ByteLimit param.Field[float64] `json:"byte_limit"`
FilterV1 param.Field[PCAPNewParamsFilterV1] `json:"filter_v1"`
}

func (r PCAPNewParams) MarshalJSON() (data []byte, err error) {
Expand Down

0 comments on commit b7478f6

Please sign in to comment.