استخدام البحث
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يتطلّب جلب مراجع لفئات proto عند استخدام واجهة برمجة التطبيقات أن يكون لديك فهم جوهري لواجهة برمجة التطبيقات أو أن تحتاج إلى البحث بشكل متكرّر في مستندات مرجع proto عن المسار الدقيق.
ProtoLookupUtil
تتيح أداة البحث عن نماذج أولية البحث عن مثيلات للخدمات والعمليات والتعدادات والموارد وإنشائها بدون الحاجة إلى تتبُّع أرقام إصدارات واجهات برمجة التطبيقات ومساحات الأسماء.
في ما يلي كيفية إنشاء مثيل لحملة عادةً:
campaign = Google::Ads::GoogleAds::V21::Resources::Campaign.new
ولكن باستخدام أداة البحث عن تعريفات البروتوكول، يمكنك استخدام نموذج أبسط:
campaign = client.resource.campaign
عند جلب مورد أو خدمة أو عملية، يتم عرض مثيل لهذا العنصر. عند جلب تعداد، يتم عرض مرجع إلى الفئة،
بدون إنشاء مثيل.
بالنسبة إلى التعدادات، يمكنك استخدام اختصار لتجنُّب الحاجة إلى البحث عن بروتوكولات التعداد.
campaign.status = :PAUSED
ننصحك باستخدام طريقة client.service
لجلب الخدمات حتى إذا لم تستخدم هذه الأداة المساعدة في أي حالات استخدام أخرى. تتضمّن هذه الطريقة منطقًا إضافيًا لنقل رمز المطوِّر وتفاصيل المصادقة، وهو ما عليك التعامل معه يدويًا إذا استخدمت طريقة أخرى.
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-09-05 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-09-05 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThe ProtoLookupUtil simplifies interactions with the Google Ads API by removing the need to specify API version numbers and namespaces when working with services, operations, enumerations, and resources.\u003c/p\u003e\n"],["\u003cp\u003eInstead of manually instantiating proto classes with complex paths, the utility allows you to create and access them using a more concise and intuitive syntax, such as \u003ccode\u003eclient.resource.campaign\u003c/code\u003e instead of \u003ccode\u003eGoogle::Ads::GoogleAds::V18::Resources::Campaign.new\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt offers a shortcut for using enumerations directly, like assigning \u003ccode\u003e:PAUSED\u003c/code\u003e to a campaign status, without requiring explicit proto lookups.\u003c/p\u003e\n"],["\u003cp\u003eUsing \u003ccode\u003eclient.service\u003c/code\u003e is recommended for fetching services, as it automatically handles developer token and authentication details.\u003c/p\u003e\n"]]],[],null,["# Lookup Util\n\nFetching references to proto classes when using the API requires that you either\nhave an intrinsic understanding of the API or need to frequently look up the\nproto reference documentation for the exact path.\n\nProtoLookupUtil\n---------------\n\nThe proto lookup util lets you look up and create instances of services,\noperations, enumerations, and resources without having to keep track of API\nversion numbers and namespaces.\n\nHere's how you typically instantiate a campaign: \n\n campaign = Google::Ads::GoogleAds::V21::Resources::Campaign.new\n\nBut with the proto lookup util, you can use a simpler form: \n\n campaign = client.resource.campaign\n\nWhen fetching a resource, service, or operation, an instance of that entity is\nreturned. When fetching an enumeration, a reference to the class is returned,\nwithout instantiation.\n\nFor enumerations, you can use a shortcut to bypass the need for looking up the\nenumeration protos. \n\n campaign.status = :PAUSED\n\nWe recommend using the `client.service` method to fetch services even if you\ndon't use this utility for any other use cases. There is extra logic built into\nthis method to pass along your developer token and authentication details, which\nyou would have to handle manually if you used another method."]]