google-ads-api-client
Version:
A friendly and exhaustive client to the google-ads-api, code generated directly from google's published protobuf schema.
363 lines (362 loc) • 14.4 kB
TypeScript
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
import type { IBinaryWriter } from "@protobuf-ts/runtime";
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
import type { IBinaryReader } from "@protobuf-ts/runtime";
import type { PartialMessage } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
/**
* `Authentication` defines the authentication configuration for API methods
* provided by an API service.
*
* Example:
*
* name: calendar.googleapis.com
* authentication:
* providers:
* - id: google_calendar_auth
* jwks_uri: https://www.googleapis.com/oauth2/v1/certs
* issuer: https://securetoken.google.com
* rules:
* - selector: "*"
* requirements:
* provider_id: google_calendar_auth
* - selector: google.calendar.Delegate
* oauth:
* canonical_scopes: https://www.googleapis.com/auth/calendar.read
*
* @generated from protobuf message google.api.Authentication
*/
export interface Authentication {
/**
* A list of authentication rules that apply to individual API methods.
*
* **NOTE:** All service configuration rules follow "last one wins" order.
*
* @generated from protobuf field: repeated google.api.AuthenticationRule rules = 3;
*/
rules: AuthenticationRule[];
/**
* Defines a set of authentication providers that a service supports.
*
* @generated from protobuf field: repeated google.api.AuthProvider providers = 4;
*/
providers: AuthProvider[];
}
/**
* Authentication rules for the service.
*
* By default, if a method has any authentication requirements, every request
* must include a valid credential matching one of the requirements.
* It's an error to include more than one kind of credential in a single
* request.
*
* If a method doesn't have any auth requirements, request credentials will be
* ignored.
*
* @generated from protobuf message google.api.AuthenticationRule
*/
export interface AuthenticationRule {
/**
* Selects the methods to which this rule applies.
*
* Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
*
* @generated from protobuf field: string selector = 1;
*/
selector: string;
/**
* The requirements for OAuth credentials.
*
* @generated from protobuf field: google.api.OAuthRequirements oauth = 2;
*/
oauth?: OAuthRequirements;
/**
* If true, the service accepts API keys without any other credential.
* This flag only applies to HTTP and gRPC requests.
*
* @generated from protobuf field: bool allow_without_credential = 5;
*/
allowWithoutCredential: boolean;
/**
* Requirements for additional authentication providers.
*
* @generated from protobuf field: repeated google.api.AuthRequirement requirements = 7;
*/
requirements: AuthRequirement[];
}
/**
* Specifies a location to extract JWT from an API request.
*
* @generated from protobuf message google.api.JwtLocation
*/
export interface JwtLocation {
/**
* @generated from protobuf oneof: in
*/
in: {
oneofKind: "header";
/**
* Specifies HTTP header name to extract JWT token.
*
* @generated from protobuf field: string header = 1;
*/
header: string;
} | {
oneofKind: "query";
/**
* Specifies URL query parameter name to extract JWT token.
*
* @generated from protobuf field: string query = 2;
*/
query: string;
} | {
oneofKind: undefined;
};
/**
* The value prefix. The value format is "value_prefix{token}"
* Only applies to "in" header type. Must be empty for "in" query type.
* If not empty, the header value has to match (case sensitive) this prefix.
* If not matched, JWT will not be extracted. If matched, JWT will be
* extracted after the prefix is removed.
*
* For example, for "Authorization: Bearer {JWT}",
* value_prefix="Bearer " with a space at the end.
*
* @generated from protobuf field: string value_prefix = 3;
*/
valuePrefix: string;
}
/**
* Configuration for an authentication provider, including support for
* [JSON Web Token
* (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
*
* @generated from protobuf message google.api.AuthProvider
*/
export interface AuthProvider {
/**
* The unique identifier of the auth provider. It will be referred to by
* `AuthRequirement.provider_id`.
*
* Example: "bookstore_auth".
*
* @generated from protobuf field: string id = 1;
*/
id: string;
/**
* Identifies the principal that issued the JWT. See
* https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1
* Usually a URL or an email address.
*
* Example: https://securetoken.google.com
* Example: 1234567-compute@developer.gserviceaccount.com
*
* @generated from protobuf field: string issuer = 2;
*/
issuer: string;
/**
* URL of the provider's public key set to validate signature of the JWT. See
* [OpenID
* Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata).
* Optional if the key set document:
* - can be retrieved from
* [OpenID
* Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html)
* of the issuer.
* - can be inferred from the email domain of the issuer (e.g. a Google
* service account).
*
* Example: https://www.googleapis.com/oauth2/v1/certs
*
* @generated from protobuf field: string jwks_uri = 3;
*/
jwksUri: string;
/**
* The list of JWT
* [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
* that are allowed to access. A JWT containing any of these audiences will
* be accepted. When this setting is absent, JWTs with audiences:
* - "https://[service.name]/[google.protobuf.Api.name]"
* - "https://[service.name]/"
* will be accepted.
* For example, if no audiences are in the setting, LibraryService API will
* accept JWTs with the following audiences:
* -
* https://library-example.googleapis.com/google.example.library.v1.LibraryService
* - https://library-example.googleapis.com/
*
* Example:
*
* audiences: bookstore_android.apps.googleusercontent.com,
* bookstore_web.apps.googleusercontent.com
*
* @generated from protobuf field: string audiences = 4;
*/
audiences: string;
/**
* Redirect URL if JWT token is required but not present or is expired.
* Implement authorizationUrl of securityDefinitions in OpenAPI spec.
*
* @generated from protobuf field: string authorization_url = 5;
*/
authorizationUrl: string;
/**
* Defines the locations to extract the JWT.
*
* JWT locations can be either from HTTP headers or URL query parameters.
* The rule is that the first match wins. The checking order is: checking
* all headers first, then URL query parameters.
*
* If not specified, default to use following 3 locations:
* 1) Authorization: Bearer
* 2) x-goog-iap-jwt-assertion
* 3) access_token query parameter
*
* Default locations can be specified as followings:
* jwt_locations:
* - header: Authorization
* value_prefix: "Bearer "
* - header: x-goog-iap-jwt-assertion
* - query: access_token
*
* @generated from protobuf field: repeated google.api.JwtLocation jwt_locations = 6;
*/
jwtLocations: JwtLocation[];
}
/**
* OAuth scopes are a way to define data and permissions on data. For example,
* there are scopes defined for "Read-only access to Google Calendar" and
* "Access to Cloud Platform". Users can consent to a scope for an application,
* giving it permission to access that data on their behalf.
*
* OAuth scope specifications should be fairly coarse grained; a user will need
* to see and understand the text description of what your scope means.
*
* In most cases: use one or at most two OAuth scopes for an entire family of
* products. If your product has multiple APIs, you should probably be sharing
* the OAuth scope across all of those APIs.
*
* When you need finer grained OAuth consent screens: talk with your product
* management about how developers will use them in practice.
*
* Please note that even though each of the canonical scopes is enough for a
* request to be accepted and passed to the backend, a request can still fail
* due to the backend requiring additional scopes or permissions.
*
* @generated from protobuf message google.api.OAuthRequirements
*/
export interface OAuthRequirements {
/**
* The list of publicly documented OAuth scopes that are allowed access. An
* OAuth token containing any of these scopes will be accepted.
*
* Example:
*
* canonical_scopes: https://www.googleapis.com/auth/calendar,
* https://www.googleapis.com/auth/calendar.read
*
* @generated from protobuf field: string canonical_scopes = 1;
*/
canonicalScopes: string;
}
/**
* User-defined authentication requirements, including support for
* [JSON Web Token
* (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
*
* @generated from protobuf message google.api.AuthRequirement
*/
export interface AuthRequirement {
/**
* [id][google.api.AuthProvider.id] from authentication provider.
*
* Example:
*
* provider_id: bookstore_auth
*
* @generated from protobuf field: string provider_id = 1;
*/
providerId: string;
/**
* NOTE: This will be deprecated soon, once AuthProvider.audiences is
* implemented and accepted in all the runtime components.
*
* The list of JWT
* [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
* that are allowed to access. A JWT containing any of these audiences will
* be accepted. When this setting is absent, only JWTs with audience
* "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]"
* will be accepted. For example, if no audiences are in the setting,
* LibraryService API will only accept JWTs with the following audience
* "https://library-example.googleapis.com/google.example.library.v1.LibraryService".
*
* Example:
*
* audiences: bookstore_android.apps.googleusercontent.com,
* bookstore_web.apps.googleusercontent.com
*
* @generated from protobuf field: string audiences = 2;
*/
audiences: string;
}
declare class Authentication$Type extends MessageType<Authentication> {
constructor();
create(value?: PartialMessage<Authentication>): Authentication;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Authentication): Authentication;
internalBinaryWrite(message: Authentication, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message google.api.Authentication
*/
export declare const Authentication: Authentication$Type;
declare class AuthenticationRule$Type extends MessageType<AuthenticationRule> {
constructor();
create(value?: PartialMessage<AuthenticationRule>): AuthenticationRule;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AuthenticationRule): AuthenticationRule;
internalBinaryWrite(message: AuthenticationRule, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message google.api.AuthenticationRule
*/
export declare const AuthenticationRule: AuthenticationRule$Type;
declare class JwtLocation$Type extends MessageType<JwtLocation> {
constructor();
create(value?: PartialMessage<JwtLocation>): JwtLocation;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: JwtLocation): JwtLocation;
internalBinaryWrite(message: JwtLocation, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message google.api.JwtLocation
*/
export declare const JwtLocation: JwtLocation$Type;
declare class AuthProvider$Type extends MessageType<AuthProvider> {
constructor();
create(value?: PartialMessage<AuthProvider>): AuthProvider;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AuthProvider): AuthProvider;
internalBinaryWrite(message: AuthProvider, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message google.api.AuthProvider
*/
export declare const AuthProvider: AuthProvider$Type;
declare class OAuthRequirements$Type extends MessageType<OAuthRequirements> {
constructor();
create(value?: PartialMessage<OAuthRequirements>): OAuthRequirements;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: OAuthRequirements): OAuthRequirements;
internalBinaryWrite(message: OAuthRequirements, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message google.api.OAuthRequirements
*/
export declare const OAuthRequirements: OAuthRequirements$Type;
declare class AuthRequirement$Type extends MessageType<AuthRequirement> {
constructor();
create(value?: PartialMessage<AuthRequirement>): AuthRequirement;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AuthRequirement): AuthRequirement;
internalBinaryWrite(message: AuthRequirement, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message google.api.AuthRequirement
*/
export declare const AuthRequirement: AuthRequirement$Type;
export {};