diff --git a/README.md b/README.md index 95c2dc44c7..01295eff7e 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,7 @@ The full API of this library can be found in [api.md](api.md). ```js import Cloudflare from 'cloudflare'; -const cloudflare = new Cloudflare({ - apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted - apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted -}); +const cloudflare = new Cloudflare(); async function main() { const zoneCreateResponse = await cloudflare.zones.create({ @@ -49,10 +46,7 @@ This library includes TypeScript definitions for all request params and response ```ts import Cloudflare from 'cloudflare'; -const cloudflare = new Cloudflare({ - apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted - apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted -}); +const cloudflare = new Cloudflare(); async function main() { const params: Cloudflare.ZoneCreateParams = { diff --git a/api.md b/api.md index f890976470..47ad8b295e 100644 --- a/api.md +++ b/api.md @@ -34,8 +34,6 @@ Methods: Types: -- Role -- RoleWithID - RoleListResponse - RoleGetResponse diff --git a/src/index.ts b/src/index.ts index 21832df8fd..1807dc3344 100644 --- a/src/index.ts +++ b/src/index.ts @@ -261,23 +261,6 @@ export class Cloudflare extends Core.APIClient { const apiKeyAuth = this.apiKeyAuth(opts); const apiTokenAuth = this.apiTokenAuth(opts); const userServiceKeyAuth = this.userServiceKeyAuth(opts); - - if ( - apiEmailAuth != null && - !Core.isEmptyObj(apiEmailAuth) && - apiKeyAuth != null && - !Core.isEmptyObj(apiKeyAuth) - ) { - return { ...apiEmailAuth, ...apiKeyAuth }; - } - - if (apiTokenAuth != null && !Core.isEmptyObj(apiTokenAuth)) { - return apiTokenAuth; - } - - if (userServiceKeyAuth != null && !Core.isEmptyObj(userServiceKeyAuth)) { - return userServiceKeyAuth; - } return {}; } diff --git a/src/resources/accounts/accounts.ts b/src/resources/accounts/accounts.ts index 05d7e2c593..e37cabafd0 100644 --- a/src/resources/accounts/accounts.ts +++ b/src/resources/accounts/accounts.ts @@ -207,8 +207,6 @@ export namespace Accounts { export import MemberDeleteParams = MembersAPI.MemberDeleteParams; export import MemberGetParams = MembersAPI.MemberGetParams; export import Roles = RolesAPI.Roles; - export import Role = RolesAPI.Role; - export import RoleWithID = RolesAPI.RoleWithID; export import RoleListResponse = RolesAPI.RoleListResponse; export import RoleGetResponse = RolesAPI.RoleGetResponse; export import RoleListParams = RolesAPI.RoleListParams; diff --git a/src/resources/accounts/index.ts b/src/resources/accounts/index.ts index 03d0a31ae8..c6da65a109 100644 --- a/src/resources/accounts/index.ts +++ b/src/resources/accounts/index.ts @@ -24,12 +24,4 @@ export { MemberListResponsesV4PagePaginationArray, Members, } from './members'; -export { - Role, - RoleWithID, - RoleListResponse, - RoleGetResponse, - RoleListParams, - RoleGetParams, - Roles, -} from './roles'; +export { RoleListResponse, RoleGetResponse, RoleListParams, RoleGetParams, Roles } from './roles'; diff --git a/src/resources/accounts/members.ts b/src/resources/accounts/members.ts index 08233391be..eea75d7b67 100644 --- a/src/resources/accounts/members.ts +++ b/src/resources/accounts/members.ts @@ -3,7 +3,6 @@ import * as Core from 'cloudflare/core'; import { APIResource } from 'cloudflare/resource'; import * as MembersAPI from 'cloudflare/resources/accounts/members'; -import * as RolesAPI from 'cloudflare/resources/accounts/roles'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from 'cloudflare/pagination'; export class Members extends APIResource { @@ -444,7 +443,7 @@ export interface MemberListResponse { /** * Roles assigned to this Member. */ - roles: Array; + roles: Array; /** * A member's status in the organization. @@ -452,6 +451,30 @@ export interface MemberListResponse { status: 'accepted' | 'invited'; } +export namespace MemberListResponse { + export interface Role { + /** + * Role identifier tag. + */ + id: string; + + /** + * Description of role's permissions. + */ + description: string; + + /** + * Role Name. + */ + name: string; + + /** + * Access permissions for this User. + */ + permissions: Array; + } +} + export interface MemberDeleteResponse { /** * Identifier diff --git a/src/resources/accounts/roles.ts b/src/resources/accounts/roles.ts index bf832872c5..c433526f6a 100644 --- a/src/resources/accounts/roles.ts +++ b/src/resources/accounts/roles.ts @@ -34,52 +34,32 @@ export class Roles extends APIResource { } } -export interface Role { - /** - * Role identifier tag. - */ - id: string; - - /** - * Description of role's permissions. - */ - description: string; - - /** - * Role Name. - */ - name: string; - - /** - * Access permissions for this User. - */ - permissions: Array; -} - -export interface RoleWithID { - /** - * Role identifier tag. - */ - id: string; - - /** - * Description of role's permissions. - */ - description: string; - - /** - * Role Name. - */ - name: string; - - /** - * Access permissions for this User. - */ - permissions: Array; +export type RoleListResponse = Array; + +export namespace RoleListResponse { + export interface RoleListResponseItem { + /** + * Role identifier tag. + */ + id: string; + + /** + * Description of role's permissions. + */ + description: string; + + /** + * Role Name. + */ + name: string; + + /** + * Access permissions for this User. + */ + permissions: Array; + } } -export type RoleListResponse = Array; - export type RoleGetResponse = unknown | string | null; export interface RoleListParams { @@ -91,8 +71,6 @@ export interface RoleGetParams { } export namespace Roles { - export import Role = RolesAPI.Role; - export import RoleWithID = RolesAPI.RoleWithID; export import RoleListResponse = RolesAPI.RoleListResponse; export import RoleGetResponse = RolesAPI.RoleGetResponse; export import RoleListParams = RolesAPI.RoleListParams; diff --git a/src/resources/user/invites.ts b/src/resources/user/invites.ts index 0086b111fb..a49aeb04ec 100644 --- a/src/resources/user/invites.ts +++ b/src/resources/user/invites.ts @@ -3,7 +3,6 @@ import * as Core from 'cloudflare/core'; import { APIResource } from 'cloudflare/resource'; import * as InvitesAPI from 'cloudflare/resources/user/invites'; -import * as RolesAPI from 'cloudflare/resources/accounts/roles'; export class Invites extends APIResource { /** @@ -87,13 +86,37 @@ export namespace InviteListResponse { /** * Roles to be assigned to this user. */ - roles?: Array; + roles?: Array; /** * Current status of the invitation. */ status?: 'pending' | 'accepted' | 'rejected' | 'expired'; } + + export namespace InviteListResponseItem { + export interface Role { + /** + * Role identifier tag. + */ + id: string; + + /** + * Description of role's permissions. + */ + description: string; + + /** + * Role Name. + */ + name: string; + + /** + * Access permissions for this User. + */ + permissions: Array; + } + } } export type InviteEditResponse = unknown | string | null;