-
Notifications
You must be signed in to change notification settings - Fork 563
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): update via SDK Studio (#1946)
- Loading branch information
1 parent
8ee0ca4
commit 3e9856f
Showing
9 changed files
with
329 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
package ai_gateway | ||
|
||
import ( | ||
"github.com/cloudflare/cloudflare-go/v2/internal/apierror" | ||
"github.com/cloudflare/cloudflare-go/v2/shared" | ||
) | ||
|
||
type Error = apierror.Error | ||
|
||
// This is an alias to an internal type. | ||
type ASN = shared.ASN | ||
|
||
// This is an alias to an internal type. | ||
type ASNParam = shared.ASNParam | ||
|
||
// This is an alias to an internal type. | ||
type AuditLog = shared.AuditLog | ||
|
||
// This is an alias to an internal type. | ||
type AuditLogAction = shared.AuditLogAction | ||
|
||
// This is an alias to an internal type. | ||
type AuditLogActor = shared.AuditLogActor | ||
|
||
// The type of actor, whether a User, Cloudflare Admin, or an Automated System. | ||
// | ||
// This is an alias to an internal type. | ||
type AuditLogActorType = shared.AuditLogActorType | ||
|
||
// This is an alias to an internal value. | ||
const AuditLogActorTypeUser = shared.AuditLogActorTypeUser | ||
|
||
// This is an alias to an internal value. | ||
const AuditLogActorTypeAdmin = shared.AuditLogActorTypeAdmin | ||
|
||
// This is an alias to an internal value. | ||
const AuditLogActorTypeCloudflare = shared.AuditLogActorTypeCloudflare | ||
|
||
// This is an alias to an internal type. | ||
type AuditLogOwner = shared.AuditLogOwner | ||
|
||
// This is an alias to an internal type. | ||
type AuditLogResource = shared.AuditLogResource | ||
|
||
// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. | ||
// | ||
// This is an alias to an internal type. | ||
type CloudflareTunnel = shared.CloudflareTunnel | ||
|
||
// This is an alias to an internal type. | ||
type CloudflareTunnelConnection = shared.CloudflareTunnelConnection | ||
|
||
// The type of tunnel. | ||
// | ||
// This is an alias to an internal type. | ||
type CloudflareTunnelTunType = shared.CloudflareTunnelTunType | ||
|
||
// This is an alias to an internal value. | ||
const CloudflareTunnelTunTypeCfdTunnel = shared.CloudflareTunnelTunTypeCfdTunnel | ||
|
||
// This is an alias to an internal value. | ||
const CloudflareTunnelTunTypeWARPConnector = shared.CloudflareTunnelTunTypeWARPConnector | ||
|
||
// This is an alias to an internal value. | ||
const CloudflareTunnelTunTypeIPSec = shared.CloudflareTunnelTunTypeIPSec | ||
|
||
// This is an alias to an internal value. | ||
const CloudflareTunnelTunTypeGRE = shared.CloudflareTunnelTunTypeGRE | ||
|
||
// This is an alias to an internal value. | ||
const CloudflareTunnelTunTypeCNI = shared.CloudflareTunnelTunTypeCNI | ||
|
||
// This is an alias to an internal type. | ||
type ErrorData = shared.ErrorData | ||
|
||
// This is an alias to an internal type. | ||
type Member = shared.Member | ||
|
||
// This is an alias to an internal type. | ||
type MemberRole = shared.MemberRole | ||
|
||
// This is an alias to an internal type. | ||
type MemberRolesPermissions = shared.MemberRolesPermissions | ||
|
||
// This is an alias to an internal type. | ||
type MemberUser = shared.MemberUser | ||
|
||
// This is an alias to an internal type. | ||
type MemberParam = shared.MemberParam | ||
|
||
// This is an alias to an internal type. | ||
type MemberRoleParam = shared.MemberRoleParam | ||
|
||
// This is an alias to an internal type. | ||
type MemberRolesPermissionsParam = shared.MemberRolesPermissionsParam | ||
|
||
// This is an alias to an internal type. | ||
type MemberUserParam = shared.MemberUserParam | ||
|
||
// This is an alias to an internal type. | ||
type Permission = shared.Permission | ||
|
||
// This is an alias to an internal type. | ||
type PermissionGrant = shared.PermissionGrant | ||
|
||
// This is an alias to an internal type. | ||
type PermissionGrantParam = shared.PermissionGrantParam | ||
|
||
// This is an alias to an internal type. | ||
type ResponseInfo = shared.ResponseInfo | ||
|
||
// This is an alias to an internal type. | ||
type Role = shared.Role |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
package ai_gateway | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"net/http" | ||
"net/url" | ||
"time" | ||
|
||
"github.com/cloudflare/cloudflare-go/v2/internal/apijson" | ||
"github.com/cloudflare/cloudflare-go/v2/internal/apiquery" | ||
"github.com/cloudflare/cloudflare-go/v2/internal/param" | ||
"github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" | ||
"github.com/cloudflare/cloudflare-go/v2/option" | ||
) | ||
|
||
// LogService contains methods and other services that help with interacting with | ||
// the cloudflare API. Note, unlike clients, this service does not read variables | ||
// from the environment automatically. You should not instantiate this service | ||
// directly, and instead use the [NewLogService] method instead. | ||
type LogService struct { | ||
Options []option.RequestOption | ||
} | ||
|
||
// NewLogService generates a new service that applies the given options to each | ||
// request. These options are applied after the parent client's options (if there | ||
// is one), and before any request-specific options. | ||
func NewLogService(opts ...option.RequestOption) (r *LogService) { | ||
r = &LogService{} | ||
r.Options = opts | ||
return | ||
} | ||
|
||
// List Gateway Logs | ||
func (r *LogService) Get(ctx context.Context, accountTag string, id string, query LogGetParams, opts ...option.RequestOption) (res *[]LogGetResponse, err error) { | ||
opts = append(r.Options[:], opts...) | ||
var env LogGetResponseEnvelope | ||
path := fmt.Sprintf("accounts/%s/ai-gateway/gateways/%s/logs", accountTag, id) | ||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) | ||
if err != nil { | ||
return | ||
} | ||
res = &env.Result | ||
return | ||
} | ||
|
||
type LogGetResponse struct { | ||
ID string `json:"id,required" format:"uuid"` | ||
Cached bool `json:"cached,required"` | ||
CreatedAt time.Time `json:"created_at,required" format:"date-time"` | ||
Duration int64 `json:"duration,required"` | ||
Model string `json:"model,required"` | ||
Path string `json:"path,required"` | ||
Provider string `json:"provider,required"` | ||
Request string `json:"request,required"` | ||
Response string `json:"response,required"` | ||
Success bool `json:"success,required"` | ||
TokensIn int64 `json:"tokens_in,required"` | ||
TokensOut int64 `json:"tokens_out,required"` | ||
JSON logGetResponseJSON `json:"-"` | ||
} | ||
|
||
// logGetResponseJSON contains the JSON metadata for the struct [LogGetResponse] | ||
type logGetResponseJSON struct { | ||
ID apijson.Field | ||
Cached apijson.Field | ||
CreatedAt apijson.Field | ||
Duration apijson.Field | ||
Model apijson.Field | ||
Path apijson.Field | ||
Provider apijson.Field | ||
Request apijson.Field | ||
Response apijson.Field | ||
Success apijson.Field | ||
TokensIn apijson.Field | ||
TokensOut apijson.Field | ||
raw string | ||
ExtraFields map[string]apijson.Field | ||
} | ||
|
||
func (r *LogGetResponse) UnmarshalJSON(data []byte) (err error) { | ||
return apijson.UnmarshalRoot(data, r) | ||
} | ||
|
||
func (r logGetResponseJSON) RawJSON() string { | ||
return r.raw | ||
} | ||
|
||
type LogGetParams struct { | ||
Cached param.Field[bool] `query:"cached"` | ||
Direction param.Field[LogGetParamsDirection] `query:"direction"` | ||
EndDate param.Field[time.Time] `query:"end_date" format:"date-time"` | ||
OrderBy param.Field[LogGetParamsOrderBy] `query:"order_by"` | ||
Page param.Field[int64] `query:"page"` | ||
PerPage param.Field[int64] `query:"per_page"` | ||
Search param.Field[string] `query:"search"` | ||
StartDate param.Field[time.Time] `query:"start_date" format:"date-time"` | ||
Success param.Field[bool] `query:"success"` | ||
} | ||
|
||
// URLQuery serializes [LogGetParams]'s query parameters as `url.Values`. | ||
func (r LogGetParams) URLQuery() (v url.Values) { | ||
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ | ||
ArrayFormat: apiquery.ArrayQueryFormatRepeat, | ||
NestedFormat: apiquery.NestedQueryFormatBrackets, | ||
}) | ||
} | ||
|
||
type LogGetParamsDirection string | ||
|
||
const ( | ||
LogGetParamsDirectionAsc LogGetParamsDirection = "asc" | ||
LogGetParamsDirectionDesc LogGetParamsDirection = "desc" | ||
) | ||
|
||
func (r LogGetParamsDirection) IsKnown() bool { | ||
switch r { | ||
case LogGetParamsDirectionAsc, LogGetParamsDirectionDesc: | ||
return true | ||
} | ||
return false | ||
} | ||
|
||
type LogGetParamsOrderBy string | ||
|
||
const ( | ||
LogGetParamsOrderByCreatedAt LogGetParamsOrderBy = "created_at" | ||
LogGetParamsOrderByProvider LogGetParamsOrderBy = "provider" | ||
) | ||
|
||
func (r LogGetParamsOrderBy) IsKnown() bool { | ||
switch r { | ||
case LogGetParamsOrderByCreatedAt, LogGetParamsOrderByProvider: | ||
return true | ||
} | ||
return false | ||
} | ||
|
||
type LogGetResponseEnvelope struct { | ||
Result []LogGetResponse `json:"result,required"` | ||
Success bool `json:"success,required"` | ||
JSON logGetResponseEnvelopeJSON `json:"-"` | ||
} | ||
|
||
// logGetResponseEnvelopeJSON contains the JSON metadata for the struct | ||
// [LogGetResponseEnvelope] | ||
type logGetResponseEnvelopeJSON struct { | ||
Result apijson.Field | ||
Success apijson.Field | ||
raw string | ||
ExtraFields map[string]apijson.Field | ||
} | ||
|
||
func (r *LogGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { | ||
return apijson.UnmarshalRoot(data, r) | ||
} | ||
|
||
func (r logGetResponseEnvelopeJSON) RawJSON() string { | ||
return r.raw | ||
} |
Oops, something went wrong.