Skip to content

Commit dbd3501

Browse files
chore(api): update composite API spec
1 parent e0ec1c9 commit dbd3501

File tree

103 files changed

+2153
-3553
lines changed

Some content is hidden

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

103 files changed

+2153
-3553
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: 1867
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-7c981c72c3b84f1b39c664311bcc286c0965bf2833955853107bc1988cc5ff25.yml
3-
openapi_spec_hash: d4b77a5657c299c78a79bb3e5b326fef
1+
configured_endpoints: 1866
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-30a19b0d3813d162ef87b7f4b9b29582d83afbab5291c85bf2522516fd1264c5.yml
3+
openapi_spec_hash: 2f89047322a2f7a306150dd6c7afdcfa
44
config_hash: b005a07fe728e7a9d190900f93eaa41f

addressing/loadocument.go

Lines changed: 0 additions & 222 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,12 @@
33
package addressing
44

55
import (
6-
"bytes"
76
"context"
87
"errors"
98
"fmt"
10-
"mime/multipart"
119
"net/http"
1210
"slices"
13-
"time"
1411

15-
"github.com/cloudflare/cloudflare-go/v6/internal/apiform"
16-
"github.com/cloudflare/cloudflare-go/v6/internal/apijson"
1712
"github.com/cloudflare/cloudflare-go/v6/internal/param"
1813
"github.com/cloudflare/cloudflare-go/v6/internal/requestconfig"
1914
"github.com/cloudflare/cloudflare-go/v6/option"
@@ -38,23 +33,6 @@ func NewLOADocumentService(opts ...option.RequestOption) (r *LOADocumentService)
3833
return
3934
}
4035

41-
// Submit LOA document (pdf format) under the account.
42-
func (r *LOADocumentService) New(ctx context.Context, params LOADocumentNewParams, opts ...option.RequestOption) (res *LOADocumentNewResponse, err error) {
43-
var env LOADocumentNewResponseEnvelope
44-
opts = slices.Concat(r.Options, opts)
45-
if params.AccountID.Value == "" {
46-
err = errors.New("missing required account_id parameter")
47-
return
48-
}
49-
path := fmt.Sprintf("accounts/%s/addressing/loa_documents", params.AccountID)
50-
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...)
51-
if err != nil {
52-
return
53-
}
54-
res = &env.Result
55-
return
56-
}
57-
5836
// Download specified LOA document under the account.
5937
func (r *LOADocumentService) Get(ctx context.Context, loaDocumentID string, query LOADocumentGetParams, opts ...option.RequestOption) (res *http.Response, err error) {
6038
opts = slices.Concat(r.Options, opts)
@@ -72,206 +50,6 @@ func (r *LOADocumentService) Get(ctx context.Context, loaDocumentID string, quer
7250
return
7351
}
7452

75-
type LOADocumentNewResponse struct {
76-
// Identifier for the uploaded LOA document.
77-
ID string `json:"id,nullable"`
78-
// Identifier of a Cloudflare account.
79-
AccountID string `json:"account_id"`
80-
Created time.Time `json:"created" format:"date-time"`
81-
// Name of LOA document. Max file size 10MB, and supported filetype is pdf.
82-
Filename string `json:"filename"`
83-
// File size of the uploaded LOA document.
84-
SizeBytes int64 `json:"size_bytes"`
85-
// Whether the LOA has been verified by Cloudflare staff.
86-
Verified bool `json:"verified"`
87-
// Timestamp of the moment the LOA was marked as validated.
88-
VerifiedAt time.Time `json:"verified_at,nullable" format:"date-time"`
89-
JSON loaDocumentNewResponseJSON `json:"-"`
90-
}
91-
92-
// loaDocumentNewResponseJSON contains the JSON metadata for the struct
93-
// [LOADocumentNewResponse]
94-
type loaDocumentNewResponseJSON struct {
95-
ID apijson.Field
96-
AccountID apijson.Field
97-
Created apijson.Field
98-
Filename apijson.Field
99-
SizeBytes apijson.Field
100-
Verified apijson.Field
101-
VerifiedAt apijson.Field
102-
raw string
103-
ExtraFields map[string]apijson.Field
104-
}
105-
106-
func (r *LOADocumentNewResponse) UnmarshalJSON(data []byte) (err error) {
107-
return apijson.UnmarshalRoot(data, r)
108-
}
109-
110-
func (r loaDocumentNewResponseJSON) RawJSON() string {
111-
return r.raw
112-
}
113-
114-
type LOADocumentNewParams struct {
115-
// Identifier of a Cloudflare account.
116-
AccountID param.Field[string] `path:"account_id,required"`
117-
// LOA document to upload.
118-
LOADocument param.Field[string] `json:"loa_document,required"`
119-
}
120-
121-
func (r LOADocumentNewParams) MarshalMultipart() (data []byte, contentType string, err error) {
122-
buf := bytes.NewBuffer(nil)
123-
writer := multipart.NewWriter(buf)
124-
err = apiform.MarshalRoot(r, writer)
125-
if err != nil {
126-
writer.Close()
127-
return nil, "", err
128-
}
129-
err = writer.Close()
130-
if err != nil {
131-
return nil, "", err
132-
}
133-
return buf.Bytes(), writer.FormDataContentType(), nil
134-
}
135-
136-
type LOADocumentNewResponseEnvelope struct {
137-
Errors []LOADocumentNewResponseEnvelopeErrors `json:"errors,required"`
138-
Messages []LOADocumentNewResponseEnvelopeMessages `json:"messages,required"`
139-
// Whether the API call was successful.
140-
Success LOADocumentNewResponseEnvelopeSuccess `json:"success,required"`
141-
Result LOADocumentNewResponse `json:"result"`
142-
JSON loaDocumentNewResponseEnvelopeJSON `json:"-"`
143-
}
144-
145-
// loaDocumentNewResponseEnvelopeJSON contains the JSON metadata for the struct
146-
// [LOADocumentNewResponseEnvelope]
147-
type loaDocumentNewResponseEnvelopeJSON struct {
148-
Errors apijson.Field
149-
Messages apijson.Field
150-
Success apijson.Field
151-
Result apijson.Field
152-
raw string
153-
ExtraFields map[string]apijson.Field
154-
}
155-
156-
func (r *LOADocumentNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
157-
return apijson.UnmarshalRoot(data, r)
158-
}
159-
160-
func (r loaDocumentNewResponseEnvelopeJSON) RawJSON() string {
161-
return r.raw
162-
}
163-
164-
type LOADocumentNewResponseEnvelopeErrors struct {
165-
Code int64 `json:"code,required"`
166-
Message string `json:"message,required"`
167-
DocumentationURL string `json:"documentation_url"`
168-
Source LOADocumentNewResponseEnvelopeErrorsSource `json:"source"`
169-
JSON loaDocumentNewResponseEnvelopeErrorsJSON `json:"-"`
170-
}
171-
172-
// loaDocumentNewResponseEnvelopeErrorsJSON contains the JSON metadata for the
173-
// struct [LOADocumentNewResponseEnvelopeErrors]
174-
type loaDocumentNewResponseEnvelopeErrorsJSON struct {
175-
Code apijson.Field
176-
Message apijson.Field
177-
DocumentationURL apijson.Field
178-
Source apijson.Field
179-
raw string
180-
ExtraFields map[string]apijson.Field
181-
}
182-
183-
func (r *LOADocumentNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) {
184-
return apijson.UnmarshalRoot(data, r)
185-
}
186-
187-
func (r loaDocumentNewResponseEnvelopeErrorsJSON) RawJSON() string {
188-
return r.raw
189-
}
190-
191-
type LOADocumentNewResponseEnvelopeErrorsSource struct {
192-
Pointer string `json:"pointer"`
193-
JSON loaDocumentNewResponseEnvelopeErrorsSourceJSON `json:"-"`
194-
}
195-
196-
// loaDocumentNewResponseEnvelopeErrorsSourceJSON contains the JSON metadata for
197-
// the struct [LOADocumentNewResponseEnvelopeErrorsSource]
198-
type loaDocumentNewResponseEnvelopeErrorsSourceJSON struct {
199-
Pointer apijson.Field
200-
raw string
201-
ExtraFields map[string]apijson.Field
202-
}
203-
204-
func (r *LOADocumentNewResponseEnvelopeErrorsSource) UnmarshalJSON(data []byte) (err error) {
205-
return apijson.UnmarshalRoot(data, r)
206-
}
207-
208-
func (r loaDocumentNewResponseEnvelopeErrorsSourceJSON) RawJSON() string {
209-
return r.raw
210-
}
211-
212-
type LOADocumentNewResponseEnvelopeMessages struct {
213-
Code int64 `json:"code,required"`
214-
Message string `json:"message,required"`
215-
DocumentationURL string `json:"documentation_url"`
216-
Source LOADocumentNewResponseEnvelopeMessagesSource `json:"source"`
217-
JSON loaDocumentNewResponseEnvelopeMessagesJSON `json:"-"`
218-
}
219-
220-
// loaDocumentNewResponseEnvelopeMessagesJSON contains the JSON metadata for the
221-
// struct [LOADocumentNewResponseEnvelopeMessages]
222-
type loaDocumentNewResponseEnvelopeMessagesJSON struct {
223-
Code apijson.Field
224-
Message apijson.Field
225-
DocumentationURL apijson.Field
226-
Source apijson.Field
227-
raw string
228-
ExtraFields map[string]apijson.Field
229-
}
230-
231-
func (r *LOADocumentNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) {
232-
return apijson.UnmarshalRoot(data, r)
233-
}
234-
235-
func (r loaDocumentNewResponseEnvelopeMessagesJSON) RawJSON() string {
236-
return r.raw
237-
}
238-
239-
type LOADocumentNewResponseEnvelopeMessagesSource struct {
240-
Pointer string `json:"pointer"`
241-
JSON loaDocumentNewResponseEnvelopeMessagesSourceJSON `json:"-"`
242-
}
243-
244-
// loaDocumentNewResponseEnvelopeMessagesSourceJSON contains the JSON metadata for
245-
// the struct [LOADocumentNewResponseEnvelopeMessagesSource]
246-
type loaDocumentNewResponseEnvelopeMessagesSourceJSON struct {
247-
Pointer apijson.Field
248-
raw string
249-
ExtraFields map[string]apijson.Field
250-
}
251-
252-
func (r *LOADocumentNewResponseEnvelopeMessagesSource) UnmarshalJSON(data []byte) (err error) {
253-
return apijson.UnmarshalRoot(data, r)
254-
}
255-
256-
func (r loaDocumentNewResponseEnvelopeMessagesSourceJSON) RawJSON() string {
257-
return r.raw
258-
}
259-
260-
// Whether the API call was successful.
261-
type LOADocumentNewResponseEnvelopeSuccess bool
262-
263-
const (
264-
LOADocumentNewResponseEnvelopeSuccessTrue LOADocumentNewResponseEnvelopeSuccess = true
265-
)
266-
267-
func (r LOADocumentNewResponseEnvelopeSuccess) IsKnown() bool {
268-
switch r {
269-
case LOADocumentNewResponseEnvelopeSuccessTrue:
270-
return true
271-
}
272-
return false
273-
}
274-
27553
type LOADocumentGetParams struct {
27654
// Identifier of a Cloudflare account.
27755
AccountID param.Field[string] `path:"account_id,required"`

addressing/loadocument_test.go

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,13 @@ import (
99
"io"
1010
"net/http"
1111
"net/http/httptest"
12-
"os"
1312
"testing"
1413

1514
"github.com/cloudflare/cloudflare-go/v6"
1615
"github.com/cloudflare/cloudflare-go/v6/addressing"
17-
"github.com/cloudflare/cloudflare-go/v6/internal/testutil"
1816
"github.com/cloudflare/cloudflare-go/v6/option"
1917
)
2018

21-
func TestLOADocumentNew(t *testing.T) {
22-
t.Skip("TODO: investigate broken test")
23-
baseURL := "http://localhost:4010"
24-
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
25-
baseURL = envURL
26-
}
27-
if !testutil.CheckTestServer(t, baseURL) {
28-
return
29-
}
30-
client := cloudflare.NewClient(
31-
option.WithBaseURL(baseURL),
32-
option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
33-
option.WithAPIEmail("user@example.com"),
34-
)
35-
_, err := client.Addressing.LOADocuments.New(context.TODO(), addressing.LOADocumentNewParams{
36-
AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"),
37-
LOADocument: cloudflare.F("@document.pdf"),
38-
})
39-
if err != nil {
40-
var apierr *cloudflare.Error
41-
if errors.As(err, &apierr) {
42-
t.Log(string(apierr.DumpRequest(true)))
43-
}
44-
t.Fatalf("err should be nil: %s", err.Error())
45-
}
46-
}
47-
4819
func TestLOADocumentGet(t *testing.T) {
4920
t.Skip("TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489")
5021
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

0 commit comments

Comments
 (0)