From 2e9ec4e70ab348206e800a446e74d8a10b92f9e6 Mon Sep 17 00:00:00 2001 From: Tony Date: Sat, 20 Nov 2021 16:15:29 -0600 Subject: [PATCH] first commit --- .gitignore | 81 ++ commands.yaml | 671 +++++++++++++++ generate_schema_file.py | 27 + queries.yaml | 1767 +++++++++++++++++++++++++++++++++++++++ scratch.py | 0 teamsnap/__init__.py | 3 + teamsnap/api.py | 111 +++ teamsnap/models.py | 21 + tests/credentials.py | 2 + tests/private_test.py | 22 + 10 files changed, 2705 insertions(+) create mode 100644 .gitignore create mode 100644 commands.yaml create mode 100644 generate_schema_file.py create mode 100644 queries.yaml create mode 100644 scratch.py create mode 100644 teamsnap/__init__.py create mode 100644 teamsnap/api.py create mode 100644 teamsnap/models.py create mode 100644 tests/credentials.py create mode 100644 tests/private_test.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..71f2c85 --- /dev/null +++ b/.gitignore @@ -0,0 +1,81 @@ +# Backup files # +*.bak + +# If you are using PyCharm # +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/gradle.xml +.idea/**/libraries +*.iws /out/ +.idea/ + +# Python # +*.py[cod] +*$py.class + +# Distribution / packaging +.Python build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +.pytest_cache/ +nosetests.xml +coverage.xml +*.cover +.hypothesis/ + +# pyenv +.python-version + +# celery +celerybeat-schedule.* + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ diff --git a/commands.yaml b/commands.yaml new file mode 100644 index 0000000..fcaef8c --- /dev/null +++ b/commands.yaml @@ -0,0 +1,671 @@ +apn_devices: + send_push: + - name: device_token +assignments: + create_bulk_assignments: + - name: event_set + prompt: A comma-delimited string of keywords and/or event_ids. Keywords include + 'future_events', 'future_games', and 'future_games_and_events' + - name: create_as_member_id + prompt: aaa + - name: team_id + prompt: aaa + - name: description + prompt: aaa + - name: member_id + prompt: aaa + reorder_assignments: + - name: event_id + - name: sorted_ids + prompt: An array of the ids in the order that they are to be moved to + send_assignment_emails: + - name: event_ids + prompt: A comma-delimited list of event ids. + - name: message + - name: sending_member_id + - name: team_id +availabilities: + bulk_mark_unset_availabilities: + - name: status_code + - name: member_id + - name: started_after +batch_invoices: + cancel: + - name: id + create_with_invoices: + - name: title + - name: description + - name: due_at + - name: is_recipient_paying_transaction_fees + - name: processing_fee_paid_by + - name: type + - name: division_id + - name: team_id + - name: batch_invoice_line_items +broadcast_alerts: + bulk_delete: + - name: id +broadcast_email_attachments: + upload_broadcast_email_attachment: + - name: broadcast_email_id + - name: member_id + - name: file +broadcast_emails: + bulk_delete: + - name: id + unflag_spam: + - name: id +contact_email_addresses: + invite: + - name: team_id + - name: contact_email_address_ids + - name: introduction +division_events: + delete_events: + - name: division_event_ids +division_events_imports: + create_events_import: + - name: division_id + - name: file + delete_imported_events: + - name: division_id + - name: division_events_import_id + process_import: + - name: id +division_flipgive_widgets: + consumed: + - name: division_id + type: Integer +division_locations: + import_from_division: + - name: destination_division_id + - name: source_location_ids +division_regsaver_options: + dismiss_configure_modal: + - name: division_id + type: Integer + - name: forever + type: Boolean +division_stores: + configure: + - name: division_id + type: Integer + - name: is_active + type: Boolean + dismiss_configure_modal: + - name: division_id + type: Integer + - name: forever + type: Boolean +divisions: + archive: + - name: id + connect_season: + - name: division_id + - name: organization_id + - name: program_id + - name: season_id + - name: season_name + - name: league_owner_first_name + - name: league_owner_last_name + - name: league_owner_email + - name: league_owner_phone_number + - name: user_id + create_root: + - name: name + - name: sport_id + - name: country + - name: time_zone + - name: postal_code + - name: teams_in_plan + - name: league_owner_email + - name: league_owner_phone_number + - name: league_owner_first_name + - name: league_owner_last_name + create_season: + - name: name + - name: season_name + - name: organization_id + - name: program_id + - name: season_id + - name: sport_id + - name: plan_id + - name: payment_provider + - name: business_type + - name: billing_address + - name: country + - name: time_zone + - name: postal_code + - name: league_owner_email + - name: league_owner_first_name + - name: league_owner_last_name + - name: user_id + - name: from_division_id + - name: copy_division_structure + - name: copy_team_structure + disable: + - name: id + - name: persistent_uuid + enable: + - name: id + - name: persistent_uuid + update_plan: + - name: division_id + - name: persistent_uuid + - name: plan_id + - name: teams_in_plan +divisions_preferences: + remove_division_logo: + - name: division_preferences_id + upload_division_logo: + - name: division_preferences_id + - name: file +event_lineup_entries: + bulk_update_event_lineup_entries: + - name: templates + prompt: 'An array of the event_lineup_entry templates to be updated that correspond + to the template for the rel ''event_lineup_entries''. Each template must have + the following elements present: event_lineup_id, member_id, label, sequence.' +events: + bulk_create: + - name: templates + - name: team_id + - name: notify_team_as_member_id + - name: notify_team + send_availability_reminders: + - name: id + - name: members_to_notify + - name: notify_team_as_member_id + update_final_score: + - name: id + - name: points_for_team + - name: points_for_opponent + - name: shootout_points_for_team + - name: shootout_points_for_opponent + - name: is_overtime + - name: is_shootout + - name: results + - name: results_url +gcm_devices: + refresh_device: + - name: id + - name: registration_id + - name: user_id + - name: app_version + send_push: + - name: registration_id +invoice_messages: + payment_request: + - name: batch_invoice_id + - name: member_ids + - name: status + - name: subject + - name: body +invoice_payment_schedules: + update_default_payment_method: + - name: invoice_payment_schedule_id + - name: credit_card_id + update_stripe_default_payment_method: + - name: invoice_payment_schedule_id + - name: credit_card_id + - name: email_address +invoice_payments: + pay_offline_cash: + - name: invoice_id + - name: amount + - name: detail + pay_offline_check: + - name: invoice_id + - name: amount + - name: detail + pay_stripe_credit_card: + - name: invoice_id + - name: credit_card_id + - name: amount + - name: email_address + pay_wepay_credit_card: + - name: invoice_id + - name: credit_card_id + - name: amount + pay_with_payment_schedule_stripe_credit_card: + - name: invoice_id + - name: credit_card_id + - name: email_address + - name: confirm_dates_amounts + prompt: 'Confirm dates and amounts presented (including fees) for each payment + (deposit and scheduled). Expected: [{''payment_date'': ''2018-05-08'', ''payment_total'': + 258.47, ''is_deposit'': true}, {...}, ...]. If they don''t match the generated + dates and amounts, an error will be returned.' + pay_with_payment_schedule_wepay_credit_card: + - name: invoice_id + - name: credit_card_id + - name: confirm_dates_amounts + prompt: 'Confirm dates and amounts presented (including fees) for each payment + (deposit and scheduled). Expected: [{''payment_date'': ''2018-05-08'', ''payment_total'': + 258.47, ''is_deposit'': true}, {...}, ...]. If they don''t match the generated + dates and amounts, an error will be returned.' + record_failed_stripe_payment: + - name: invoice_payment_id + - name: error_description + record_failed_wepay_payment: + - name: invoice_payment_id + - name: wepay_error_id + - name: error_description + record_paid_wepay_payment: + - name: invoice_payment_id + - name: credit_card_id + - name: amount + - name: teamsnap_processing_fee + - name: wepay_processing_fee + record_pending_wepay_payment: + - name: invoice_payment_id + - name: wepay_checkout_id + - name: credit_card_id + - name: reference_id + - name: amount + - name: teamsnap_processing_fee + - name: wepay_processing_fee + record_refunded_wepay_payment: + - name: invoice_payment_id + - name: credit_card_id + - name: amount + - name: refund_reason + - name: teamsnap_processing_fee + - name: wepay_processing_fee + refund_offline_cash: + - name: invoice_payment_id + - name: amount + - name: detail + refund_offline_check: + - name: invoice_payment_id + - name: amount + - name: detail + refund_online_payment: + - name: invoice_payment_id + - name: detail +invoices: + cancel: + - name: id + create_from_batch_invoice: + - name: batch_invoice_id + - name: member_ids + prompt: An array of member ids for whom the invoices will be created. +league_custom_fields: + reorder: + - name: sorted_ids + - name: division_id +locations: + import_from_team: + - name: destination_team_id + - name: source_location_ids +me: + send_email_validation: [] + send_fomo_email: + - name: sender_user_id + - name: recipient_user_ids + - name: team_id + - name: message + send_trial_expiring_reminder: [] +member_email_addresses: + invite: + - name: team_id + - name: member_id + - name: member_email_address_ids + - name: introduction + - name: notify_as_member_id +member_files: + upload_member_file: + - name: member_file_id + - name: file +member_payments: + transaction: + - name: member_payment_id + - name: amount + - name: note +members: + bulk_delete: + - name: member_id + prompt: The id of the member to be deleted, this can either be passed as a comma-delimited + list of integers or as an array if the post data is JSON. + delete_pending_member: + - name: member_id + prompt: The id of the pending member or pending members to be moved, this can + either be passed as a comma-delimited list of integers or as an array if the + post data is JSON. + - name: division_id + prompt: The id of the division or divisions to determine pending members, this + can either be passed as a comma-delimited list of integers or as an array if + the post data is JSON. + - name: team_id + prompt: The id of the team or teams to determine pending members, this can either + be passed as a comma-delimited list of integers or as an array if the post data + is JSON. + disable_member: + - name: member_id + generate_member_thumbnail: + - name: member_id + - name: x + - name: y + - name: width + - name: height + import_from_team: + - name: source_member_ids + - name: destination_team_id + - name: send_invites + prompt: Whether or not to create and send invitations for each imported member. + Valid values are either 'true' or 'false' and will default to 'false' + move_member: + - name: member_id + prompt: The id of the member or members to be moved, this can either be passed + as a comma-delimited list of integers or as an array if the post data is JSON. + - name: division_id + - name: team_id + - name: pending + move_pending_member: + - name: member_id + prompt: The id of the pending member or pending members to be moved, this can + either be passed as a comma-delimited list of integers or as an array if the + post data is JSON. + - name: division_id + prompt: The id of the division or divisions to determine pending members, this + can either be passed as a comma-delimited list of integers or as an array if + the post data is JSON. + - name: team_id + prompt: The id of the team or teams to determine pending members, this can either + be passed as a comma-delimited list of integers or as an array if the post data + is JSON. + remove_member_photo: + - name: member_id + set_commissioner_access: + - name: member_id + - name: division_id + upload_member_photo: + - name: member_id + - name: file + - name: x + - name: y + - name: width + - name: height +messages: + bulk_delete: + - name: id + mark_message_as_read: + - name: id +mobile_advertising_identities: + mobile_advertising_identities: + - name: device_advertising_uuid + - name: user_id + - name: platform + - name: ip_address +program_members: + run_pipeline: + - name: division_ids + prompt: A comma-delimited list of division ids. + - name: action + prompt: A string with the originating action. +root: + initiate_registration: + - name: email_address + - name: client_id + - name: redirect_uri + send_invitations: + - name: email_address + welcome: + - name: email_address + - name: client_id + - name: redirect_uri +self: + initiate_registration: + - name: email_address + - name: client_id + - name: redirect_uri + send_invitations: + - name: email_address + welcome: + - name: email_address + - name: client_id + - name: redirect_uri +sponsors: + remove_sponsor_logo: + - name: sponsor_id + upload_sponsor_logo: + - name: sponsor_id + - name: file +statistic_data: + bulk_delete_statistic_data: + - name: member_id + - name: event_id + bulk_update_statistic_data: + - name: templates + prompt: 'An array of the statistic_datum templates to be updated that correspond + to the template for the rel ''statistic_datum''. Each template must have the + following elements present: team_id, event_id, statistic_id.' +statistic_groups: + reorder_statistic_groups: + - name: team_id + - name: sorted_ids + prompt: An array of the ids in the order that they are to be moved to +statistics: + import_from_team: + - name: source_team_id + - name: destination_team_id + import_from_template: + - name: destination_team_id + - name: sport_id + reorder_statistics: + - name: team_id + - name: sorted_ids + prompt: An array of the ids in the order that they are to be moved to +stripe_account_access_grants: + grant: + - name: division_id + - name: team_id + - name: stripe_account_id + revoke: + - name: id +stripe_accounts: + update_by_stripe_account_id: + - name: account_id + - name: is_merchant + - name: has_charges_enabled +team_media: + assign_media_to_group: + - name: team_medium_ids + prompt: A comma delimited list of team medium ids + - name: team_media_group_id + bulk_delete_team_media: + - name: team_medium_ids + prompt: A comma delimited list of team medium ids + create_team_video_link: + - name: team_id + - name: member_id + - name: team_media_group_id + - name: description + - name: position + - name: video_url + facebook_share_team_medium: + - name: team_medium_id + - name: is_suppressed_from_feed + prompt: Whether or not to post this to the facebook news feed. Valid values are + either 'true' or 'false' and will default to 'false' + - name: caption + prompt: Caption for the team media. + - name: facebook_page_id + prompt: The id to the page on facebook to post to. + reorder_team_media: + - name: team_id + - name: sorted_ids + prompt: An array of the ids in the order that they are to be moved to. + rotate_team_medium_image: + - name: team_medium_id + - name: rotate_direction + prompt: The direction to rotate the image, valid valiuse are "clockwise" or "counterclockwise" + set_medium_as_member_photo: + - name: team_medium_id + - name: member_id + set_medium_as_team_photo: + - name: team_medium_id + upload_team_medium: + - name: team_id + - name: member_id + - name: media_format + prompt: The format of the media, either "image" or "file" + - name: team_media_group_id + - name: description + - name: position + - name: file +team_media_groups: + facebook_share_team_media_group: + - name: team_media_group_id + - name: is_suppressed_from_feed + prompt: Whether or not to post this to the facebook news feed. Valid values are + either 'true' or 'false' and will default to 'false' + - name: album_name + prompt: The caption used when sharing the medium on facebook. This will default + to the description of the medium + - name: facebook_page_id + prompt: The id used by facebook of the page to post the medium to. If omitted, + this will go to the user's personal page. + reorder_team_media_groups: + - name: team_id + - name: sorted_ids + prompt: An array of the ids in the order that they are to be moved to +team_public_sites: + remove_team_public_photo: + - name: team_public_site_id + upload_team_public_photo: + - name: team_public_site_id + - name: file + validate_subdomain: + - name: subdomain +team_stores: + configure_team_store: + - name: team_id +teams: + apply_promotion: + - name: team_ids + - name: promotion_name + - name: promotion_length + - name: plan_id + change_owner: + - name: team_id + - name: member_id + enable_fundraising: + - name: team_id + - name: goal_cents + invite: + - name: team_id + - name: contact_id + - name: member_id + - name: introduction + - name: notify_as_member_id + invite_team_owners: + - name: id + reset_statistics: + - name: team_id + send_upsell_message_from_contact: + - name: team_id + - name: contact_id + - name: feature + send_upsell_message_from_owner: + - name: team_id + - name: feature + toggle_team_visibility_on_dashboard: + - name: team_ids + update_team_plan: + - name: team_ids + - name: plan_id + update_time_zone: + - name: team_id + - name: time_zone + - deprecated: true + name: offset_team_times + prompt: '%{old} is deprecated and will be removed in a future version, use %{new} + instead.' +teams_preferences: + remove_team_logo: + - name: team_preferences_id + remove_team_photo: + - name: team_preferences_id + upload_team_logo: + - name: team_preferences_id + - name: file + upload_team_photo: + - name: team_preferences_id + - name: file +tsl_chats: + send_push: + - name: device_token + - name: event_id + - name: firebase_id + - name: member_id + - name: message + - name: team_id + - name: timestamp + - name: type + - name: url + - name: username +tsl_photos: + upload: + - name: team_id + - name: event_id + - name: user_id + - name: redirect + - name: max_file_size + - name: max_file_count + - name: expires + - name: signature + - name: file1 +tsl_scores: + send_push: + - name: device_token + - name: event_id + - name: firebase_id + - name: game_state + - name: member_id + - name: opponent_name + - name: score_for + - name: score_against + - name: sport_score_style + - name: team_id + - name: team_name + - name: timestamp +user_team_experiences: + record_occurrence_user_team_experience: + - name: experience + - name: team_id +users: + send_email_validation: [] + send_fomo_email: + - name: sender_user_id + - name: recipient_user_ids + - name: team_id + - name: message + send_trial_expiring_reminder: [] +wepay_account_access_grants: + grant: + - name: team_id + - name: wepay_account_id + revoke: + - name: id +wepay_accounts: + create_with_access: + - name: team_id + - name: email + - name: first_name + - name: last_name + - name: account_name + - name: account_description + - name: country_code + record_wepay_account_data: + - name: reference_id + - name: wepay_account_id + - name: wepay_account_state + - name: wepay_access_token + - name: wepay_action_reasons + - name: wepay_disabled_at + - name: wepay_user_id + revoke_access: + - name: reference_id + send_confirmation: + - name: id diff --git a/generate_schema_file.py b/generate_schema_file.py new file mode 100644 index 0000000..c6ec29a --- /dev/null +++ b/generate_schema_file.py @@ -0,0 +1,27 @@ +from apiclient import HeaderAuthentication +from apiclient import JsonResponseHandler +from tests.credentials import token +from tests.private_test import TeamSnap +import yaml + +schema = {} + +c = TeamSnap(authentication_method=HeaderAuthentication(token=token), response_handler=JsonResponseHandler) + +def generate_schema(verb='queries'): + for rel, link in c._links.items(): + for query, details in c._by_rel(link['href'], verb).items(): + if not schema.get(rel): + schema[rel] = {} + try: + d = details['data'] + schema[rel][query] = [{k:v for k,v in data.items() if k not in ['value']} for data in details['data']] + except: + continue + print (f"{query=}") + + with open(f'{verb}.yaml', 'w') as f: + yaml.dump(schema,f) + pass + +generate_schema('queries') \ No newline at end of file diff --git a/queries.yaml b/queries.yaml new file mode 100644 index 0000000..7a6bd12 --- /dev/null +++ b/queries.yaml @@ -0,0 +1,1767 @@ +advertisements: + search: + - name: team_id + - name: member_id + - name: medium + - name: page + - name: ad_spot + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +android_subscriptions: + search: + - name: sku + - name: token + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +apn_devices: + search: + - name: id + - name: user_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +apple_paid_features: + search: + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +assignments: + search: + - name: team_id + - name: event_id + - name: member_id + - name: started_before + - name: started_after + - name: id + - name: teamsnap_plus + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +availabilities: + search: + - name: team_id + - name: event_id + - name: member_id + - name: started_before + - name: started_after + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. + - name: sort_event_id + prompt: Sort the returned dataset based on the event_id field, valid values are + 'asc' or 'desc'. + - name: sort_start_date + prompt: Sort the returned dataset based on the start_date field, valid values + are 'asc' or 'desc'. +availability_summaries: + search: + - name: team_id + - name: event_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +batch_invoice_line_items: + search: + - name: id + - name: batch_invoice_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +batch_invoice_payment_schedule_details: + search: + - name: id + - name: batch_invoice_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +batch_invoice_payment_schedules: + search: + - name: id + - name: batch_invoice_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +batch_invoices: + search: + - name: id + - name: division_id + - name: team_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +batch_invoices_aggregates: + search: + - name: division_id + - name: team_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +broadcast_alerts: + search: + - name: id + - name: member_id + - name: team_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +broadcast_email_attachments: + search: + - name: id + - name: broadcast_email_id + - name: member_id + - name: team_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +broadcast_emails: + search: + - name: id + - name: member_id + - name: team_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. + - name: sort_created_at + prompt: Sort the returned dataset based on the created_at field, valid values + are 'asc' or 'desc'. +contact_email_addresses: + search: + - name: contact_id + - name: member_id + - name: team_id + - name: id + - name: email + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +contact_phone_numbers: + search: + - name: team_id + - name: id + - name: contact_id + - name: member_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +contacts: + search: + - name: team_id + - name: member_id + - name: user_id + - name: id + - name: can_receive_push_notifications + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +countries: + search: + - name: id + - name: name +currencies: + search: + - name: id +custom_data: + search: + - name: id + - name: team_id + - name: member_id + - name: custom_field_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +custom_fields: + search: + - name: id + - name: team_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +division_aggregates: + search: + - name: division_id + - name: ancestor_division_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +division_behaviors: + search: + - name: division_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +division_contact_email_addresses: + search: + - name: contact_id + - name: team_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +division_contact_phone_numbers: + search: + - name: team_id + - name: id + - name: contact_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +division_contacts: + search: + - name: team_id + - name: member_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +division_events: + search: + - name: division_id + - name: id + - name: division_event_import_id + - name: division_location_id + - name: started_after + - name: is_game + - name: repeating_uuid + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. + - name: sort_start_date + prompt: Sort the returned dataset based on the start_date field, valid values + are 'asc' or 'desc'. +division_events_imports: + search: + - name: division_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +division_flipgive_widgets: + should_show_widget: + - name: division_id +division_locations: + search: + - name: division_id + - name: team_id + - name: id + - name: persistent_uuid + - name: organization_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +division_member_email_addresses: + search: + - name: team_id + - name: member_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +division_member_phone_numbers: + search: + - name: team_id + - name: id + - name: member_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +division_members: + search: + - name: team_id + prompt: Find a division member by the id of the team they are a commissioner of. + - name: division_id + - name: user_id + - name: id + - name: birthday_month + prompt: Find a division member by the month of their birthday. + - name: is_commissioner + - name: is_ownership_pending + - name: is_unassigned + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +division_members_preferences: + search: + - name: team_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +division_rate_packages: + active: + - name: division_id + search: + - name: id + - name: division_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +division_regsaver_options: + search: + - name: division_id + type: Integer + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. + should_show_configure_modal: + - name: division_id + type: Integer +division_stores: + search: + - name: division_id + type: Integer + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. + should_show_configure_modal: + - name: division_id + type: Integer +division_structure_health_data: + search: + - name: division_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +division_team_standings: + search: + - name: team_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +divisions: + active_divisions: + - name: user_id + active_trials: + - name: user_id + ancestors: + - name: id + children: + - name: id + - name: is_archived + - name: is_disabled + descendants: + - name: id + leaves: + - name: id + search: + - name: id + - name: organization_id + - name: persistent_uuid + - name: user_id + - name: parent_id + - name: is_root + - name: is_trial + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. + tree: + - name: id + - name: persistent_uuid + - name: organization_id +divisions_preferences: + search: + - name: id + - name: division_id + - name: user_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +event_lineup_entries: + search: + - name: id + - name: team_id + - name: event_id + - name: event_lineup_id + - name: member_id +event_lineups: + search: + - name: id + - name: event_id +event_statistics: + search: + - name: id + - name: statistic_id + - name: event_id + - name: team_id +events: + overview: + - name: team_id + search: + - name: team_id + - name: user_id + - name: location_id + - name: opponent_id + - name: started_after + - name: started_before + - name: repeating_uuid + - name: id + - name: is_game + - name: updated_since + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. + - name: sort_start_date + prompt: Sort the returned dataset based on the start_date field, valid values + are 'asc' or 'desc'. + search_games: + - name: team_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +facebook_pages: + search: + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +forecasts: + search: + - name: team_id + - name: event_id + - name: day_index + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +forum_posts: + search: + - name: forum_topic_id + - name: id + - name: division_member_id + - name: member_id + - name: team_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +forum_subscriptions: + search: + - name: forum_topic_id + - name: id + - name: member_id + - name: team_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +forum_topics: + search: + - name: team_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +fundraising_campaigns: + search: + - name: id + - name: team_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +gcm_devices: + search: + - name: id + - name: user_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +geocoded_locations: + search: + - name: country + - name: postal_code + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +health_check_questionnaire_template_questions: + search: + - name: id + - name: health_check_questionnaire_template_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +health_check_questionnaire_templates: + search: + - name: id + - name: division_id + - name: is_default_template + - name: type + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +health_check_questionnaires: + search: + - name: id + - name: event_id + - name: member_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +invitations: + search: + - name: code + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +invoice_line_items: + search: + - name: id + - name: invoice_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +invoice_payment_options_amounts: + search: + - name: invoice_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +invoice_payment_schedules: + search: + - name: id + - name: invoice_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +invoice_payment_transactions: + search: + - name: id + - name: invoice_id + - name: invoice_payment_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +invoice_payments: + search: + - name: id + - name: invoice_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +invoice_recipients: + search: + - name: id + - name: invoice_id + - name: batch_invoice_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +invoice_recipients_invoices_aggregates: + search: + - name: member_ids + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +invoice_schedule_payment_options_amounts: + search: + - name: invoice_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +invoice_schedule_payments_payment_options_amounts: + search: + - name: invoice_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +invoices: + search: + - name: id + - name: batch_invoice_id + - name: user_id + - name: status + - name: member_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +invoicing_health_data: + search: + - name: division_id + - name: team_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +league_custom_data: + search: + - name: id + - name: team_id + - name: member_id + - name: division_id + - name: league_custom_field_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +league_custom_fields: + search: + - name: id + - name: team_id + - name: division_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +league_registrant_documents: + search: + - name: team_id + - name: member_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +locations: + search: + - name: team_id + - name: event_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +me: + search: + - name: id + - name: email + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +member_assignments: + search: + - name: assignment_id + - name: event_id + - name: member_id + - name: team_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +member_balances: + search: + - name: member_id + - name: team_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +member_email_addresses: + search: + - name: team_id + - name: member_id + - name: id + - name: email + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +member_files: + search: + - name: team_id + - name: member_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +member_links: + search: + - name: team_id + - name: member_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +member_participations: + search: + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +member_payments: + search: + - name: id + - name: member_id + - name: team_fee_id + - name: team_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +member_phone_numbers: + search: + - name: team_id + - name: id + - name: member_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +member_photos: + search: + - name: id + - name: member_id + - name: team_id + - name: height + - name: width + - name: crop + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +member_registration_signups: + search: + - name: member_id + - name: division_id + - name: id + - name: registration_signup_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +member_statistics: + search: + - name: id + - name: statistic_id + - name: member_id + - name: team_id +members: + advanced_division_search: + - name: division_id + prompt: Id of the division and descendants to search + - name: id + prompt: Id of the member to search + - name: user_id + prompt: Id of the user to search + - name: is_commissioner + prompt: true/false - For all members in a division that are or are not a commissioner. + Not used if blank. + - name: birthday + prompt: date - Accepts advanced search operators 'less_than' and 'greater_than'. + - name: team_id + prompt: integer - Find all members in a division with the specified team_id(s). + - name: is_coach + prompt: true/false - Find all members in a division that are or are not a coach. + Not used if blank. + - name: is_manager + prompt: true/false - Find all members in a division that are or are not a team + manager. Not used if blank. + - name: is_non_player + prompt: true/false - Find all members in a division that are or are not a players. + Not used if blank. + - name: is_owner + prompt: true/false - Find all members in a division that are or are not owners. + Not used if blank. + - name: is_ownership_pending + prompt: true/false - Find all members in a division that are or are not pending + ownership. Not used if blank. + - name: gender + prompt: Male/Female - Find all members in a division with the specified gender. + - name: first_name + prompt: string - Accepts advanced search operators 'equals', 'contains' and 'starts_with'. + - name: last_name + prompt: string - Accepts advanced search operators 'equals', 'contains' and 'starts_with'. + - name: email + prompt: string - Accepts advanced search operators 'equals', 'contains' and 'starts_with'. + - name: custom_field + prompt: string - Required advanced search parameter of 'id' that should be the + id of the custom field to be searched on. Accepts advanced search operators + 'equals', 'contains' and 'starts_with'. + - name: registration_form_id + prompt: string - Find all members in a division with the specified registration_form_id. + - name: registration_form_line_item_id + prompt: string - Find all members in a division who have selected the specified + registration_form_line_item_id. + - name: registration_form_line_item_option_id + prompt: string - Find all members in a division who have selected a given registration_form_line_item_option_id. + - name: is_assigned + prompt: true/false - For all members in a division that are assigned to a team. + Not used if blank. + - name: is_activated + prompt: true/false - For all members in a division that have a user. Not used + if blank. + - name: checkout_type + prompt: 'string - Search for a registration checkout type. Valid values are: "1" + - In Progress, "2" - Pay Now, "3" - Installment Plan, "4" - Pay Offline, "5" + - No Fees' + - name: signup_status + prompt: 'string - Search for a registration based on it''s signup status. Value + values are: "authorized" - Authorized, "refunded" - Refunded, "failed" - Failed, + "active" - Active, "canceled" - Canceled, "charged_back" - Charged Back, "on_checkout" + - On Checkout, "paid" - Paid' + - name: search_subdivisions + prompt: true/false - Search all the subdivisions of the division provided. True + by default. + - name: batch_invoice_id + prompt: Id of batch invoice to search + - name: invoice_status + prompt: 'string - Search for all members based on a selected batch_invoice_id + invoice status, valid values are: "open", "submitted", "pending", "paid", "canceled"' + - name: pending_assignments + prompt: string - Search pending assignments for members. "include", "exclude", + "only". "exclude" is the default + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. + commissioners: + - name: team_id + - name: division_id + division_search: + - name: division_id + prompt: Id of the division and descendants to search + - name: is_unassigned + prompt: true/false - For all members in a division that aren't assigned to a team. + Not used if blank. + - name: is_activated + prompt: true/false - For all members in a division that have a user. Not used + if blank. + - name: is_commissioner + prompt: true/false - For all members in a division that are or are not a commissioner. + Not used if blank. + - name: is_ownership_pending + prompt: true/false - Find all members in a division that are or are not pending + ownership. Not used if blank. + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. + importable_members: + - name: user_id + - name: include_archived_teams + managers: + - name: team_id + owner: + - name: team_id + personas: + - name: user_id + search: + - name: division_id + - name: team_id + - name: user_id + - name: id + - name: can_receive_push_notifications + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +members_preferences: + search: + - name: team_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +message_data: + search: + - name: team_id + - name: user_id + - name: member_id + - name: contact_id + - name: message_type +message_reply_statuses: + search: + - name: id +messages: + search: + - name: team_id + - name: division_id + - name: member_id + - name: division_member_id + - name: message_id + prompt: message_id is deprecated and will be removed in a future version, use + message_source_id instead. + - name: message_source_id + - name: message_type + - name: contact_id + - name: user_id + - name: id + - name: thread_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +opponents: + search: + - name: team_id + - name: league_team_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +opponents_results: + search: + - name: team_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +partners_preferences: + search: + - name: user_id + - name: team_id + - name: member_id + - name: partner_id + - name: partner_name + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +partners_user_preferences: + search: + - name: user_id + - name: division_id + - name: partner_preference_id +payment_method_wepay_credit_cards: + search: + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +payment_notes: + search: + - name: id + - name: member_payment_id + - name: team_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +payment_options: + search: + - name: id + - name: payment_provider_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +payment_providers: + search: + - name: id + - name: name + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +paypal_currencies: + search: + - name: id + - name: team_id +plans: + search: + - name: id + - name: team_id +plans_all: + search: + - name: id + - name: team_id +program_members: + search: + - name: division_id + - name: member_name + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +program_memberships: + search: + - name: program_member_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +registration_dates_aggregates: + search: + - name: division_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +registration_form_line_item_options: + search: + - name: id + - name: division_id + - name: registration_form_id + - name: registration_form_line_item_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +registration_form_line_items: + search: + - name: registration_form_id + - name: id + - name: division_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +registration_forms: + search: + - name: division_id + - name: id + - name: is_retired + - name: registration_signup_id + - name: persistent_uuid + - name: organization_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +registration_health_data: + search: + - name: division_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +registration_signup_statuses: + search: + - name: id +registration_signups: + search: + - name: id +root: + bulk_load: + - name: team_id + prompt: The team_id(s) to return results for, this can be a single id or a comma-separated + list of ids. + - name: scope_to + prompt: A comma separated list of singular types that you would like to scope + the rest of the related result sets to. For instance, scoping assignments to + events and providing a filter on events will return only assignments for the + events returned. + - name: types + prompt: A comma separated list of singular types that you want returned. + feature: + - name: id + - name: type + - name: feature_name + forecast: + - name: team_id + - name: event_id + - name: day_index + generate_firebase_token: + - name: team_id + - name: version + geocode: + - name: country + - name: postal_code + invitation_finder: + - name: email_address + messaging_permissions: + - name: team_id + partners_preferences: + - name: user_id + - name: team_id + - name: member_id + - name: partner_id + - name: partner_name + partners_user_preferences: + - name: user_id + - name: team_id + - name: partner_preference_id + query: + - name: scope_to + prompt: A comma separated list of singular types that you would like to scope + the rest of the related result sets to. For instance, scoping assignments to + events and providing a filter on events will return only assignments for the + events returned. + - name: types + prompt: A comma separated list of singular types that you want returned. You may + also specify a query by proceeding the type with a '__'. For instance + 'member__personas' will use 'personas' query on the 'members' endpoint. +self: + bulk_load: + - name: team_id + prompt: The team_id(s) to return results for, this can be a single id or a comma-separated + list of ids. + - name: scope_to + prompt: A comma separated list of singular types that you would like to scope + the rest of the related result sets to. For instance, scoping assignments to + events and providing a filter on events will return only assignments for the + events returned. + - name: types + prompt: A comma separated list of singular types that you want returned. + feature: + - name: id + - name: type + - name: feature_name + forecast: + - name: team_id + - name: event_id + - name: day_index + generate_firebase_token: + - name: team_id + - name: version + geocode: + - name: country + - name: postal_code + invitation_finder: + - name: email_address + messaging_permissions: + - name: team_id + partners_preferences: + - name: user_id + - name: team_id + - name: member_id + - name: partner_id + - name: partner_name + partners_user_preferences: + - name: user_id + - name: team_id + - name: partner_preference_id + query: + - name: scope_to + prompt: A comma separated list of singular types that you would like to scope + the rest of the related result sets to. For instance, scoping assignments to + events and providing a filter on events will return only assignments for the + events returned. + - name: types + prompt: A comma separated list of singular types that you want returned. You may + also specify a query by proceeding the type with a '__'. For instance + 'member__personas' will use 'personas' query on the 'members' endpoint. +sms_gateways: + search: + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +sponsors: + search: + - name: team_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +sport_positions: + search: + - name: id + - name: sport_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +sports: + search: + - name: id + - name: team_id + - name: division_id +statistic_aggregates: + search: + - name: id + - name: team_id + - name: statistic_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +statistic_data: + search: + - name: id + - name: event_id + - name: statistic_id + - name: team_id + - name: member_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +statistic_groups: + search: + - name: team_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +statistics: + search: + - name: statistic_group_id + - name: team_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +stripe_account_access_grants: + search: + - name: id + - name: division_id + - name: team_id + - name: stripe_account_id + - name: is_granted + - name: user_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +stripe_accounts: + search: + - name: id + - name: division_id + - name: team_id + - name: is_active + - name: user_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +suggested_assignments: + search: + - name: team_id + - name: teamsnap_plus +team_fees: + search: + - name: team_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +team_media: + search: + - name: team_id + - name: team_media_group_id + - name: member_id + - name: id + - name: height + - name: width + - name: crop + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +team_media_groups: + search: + - name: team_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +team_medium_comments: + search: + - name: team_media_group_id + - name: team_medium_id + - name: member_id + - name: team_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +team_names: + search: + - name: team_id + - name: id + - name: division_id + - name: ancestor_division_id + - name: is_active + - name: organization_id + - name: persistent_uuid + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +team_photos: + search: + - name: id + - name: team_id + - name: height + - name: width + - name: crop + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +team_public_sites: + search: + - name: id + - name: team_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +team_statistics: + search: + - name: id + - name: statistic_id + - name: team_id +team_stores: + search: + - name: id + - name: team_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +teams: + active_teams: + - name: user_id + - name: division_id + available_for_statistic_import: + - name: sport_id + division_search: + - name: division_id + - name: user_id + - name: is_active + - name: is_commissioner + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. + search: + - name: id + - name: team_id + - name: user_id + - name: division_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. + - name: sort_name + prompt: Sort the returned dataset based on the name field, valid values are 'asc' + or 'desc'. +teams_paypal_preferences: + search: + - name: team_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +teams_preferences: + search: + - name: id + - name: team_id + - name: user_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +teams_results: + search: + - name: team_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +time_zones: + search: + - name: id + - name: team_id +tracked_item_statuses: + search: + - name: team_id + - name: member_id + - name: tracked_item_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +tracked_items: + search: + - name: team_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +tsl_metadata: + search: + - name: user_id + - name: id + - name: version + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +tsl_scores: + search: + - name: event_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +user_team_experiences: + search: + - name: user_id + - name: team_id + - name: id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +users: + search: + - name: id + - name: email + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +wepay_account_access_grants: + search: + - name: id + - name: team_id + - name: wepay_account_id + - name: is_granted + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +wepay_accounts: + search: + - name: id + - name: division_id + - name: user_id + - name: is_active + - name: wepay_account_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. +wepay_invoice_payment_details: + search: + - name: id + - name: invoice_payment_id + - name: wepay_checkout_id + - name: reference_id + - name: page_size + prompt: The number of items to return for each page. Sending this parameter with + the query will enable paging for the returned collection. + - name: page_number + prompt: The number of the page to be returned. This requires that paging be turned + on by also providing the page_size parameter. diff --git a/scratch.py b/scratch.py new file mode 100644 index 0000000..e69de29 diff --git a/teamsnap/__init__.py b/teamsnap/__init__.py new file mode 100644 index 0000000..31d7a75 --- /dev/null +++ b/teamsnap/__init__.py @@ -0,0 +1,3 @@ +from .api import TeamSnap + +__all__ = ['TeamSnap'] \ No newline at end of file diff --git a/teamsnap/api.py b/teamsnap/api.py new file mode 100644 index 0000000..c467c1f --- /dev/null +++ b/teamsnap/api.py @@ -0,0 +1,111 @@ +__all__ = ['TeamSnap', 'Team', 'Event', 'Availability'] + +from apiclient import APIClient, HeaderAuthentication, JsonResponseHandler +from collection_json import Collection +import json + + +class ApiObject(): + rel = None + + def __init__(self, client, rel=rel, data={}): + self.client = client + self.data = data + self.rel = rel + + @classmethod + def search(cls, client, **kwargs): + results = client.query(cls.rel, "search", **kwargs) + return [cls(client,rel=cls.rel, data=r) for r in results] + + @classmethod + def get(cls, client, id): + r = client.get(f"{client.link(cls.rel)}/{id}") + return cls(client, cls.rel, client.parse_response(r)[0]) + +class Me (ApiObject): + rel = "me" + + def __init__(self, client): + super().__init__(client=client, rel=self.rel, data=client.get(client.link(self.rel))) + +class Event (ApiObject): + rel = "events" + +class Team (ApiObject): + rel = "teams" + pass + +class Availability (ApiObject): + rel = "availabilities" + pass + +class TeamSnap(APIClient): + base_url = 'https://api.teamsnap.com/v3' + + def __init__(self, token, *args, **kwargs): + super().__init__(*args, + authentication_method=HeaderAuthentication(token=token), + response_handler=JsonResponseHandler, + **kwargs) + self._root_collection = self.get(self.base_url)['collection'] + self._links = self._by_rel(self.base_url, 'links') + self._queries = self._by_rel(self.base_url, 'queries') + self._commands = self._by_rel(self.base_url, 'commands') + pass + + def link(self, link_name): + d = {l['rel']:l['href'] for l in self._root_collection["links"]} + return d.get(link_name) + + def _by_rel (self, url, k): + try: + {l['rel']: l for l in self._root_collection[k]} + except Exception as e: + return {} + self.get(url)['collection'][k] + return {l['rel']:l for l in self.get(url)['collection'][k]} + + def query (self, rel, query, **kwargs): + queries = self._by_rel(self._get_href(rel), 'queries') + response = self.get(self._get_href(query, queries), params=kwargs) + return self.parse_response(response) + + def command (self, rel, command, **kwargs): + commands = self._by_rel(self._get_href(rel), 'commands') + response = self.get(self._get_href(command, commands), params=kwargs) + return self.parse_response(response) + + def _get_href (self, rel: str, links:dict = None, url = base_url) -> str: + """returns a hyperlink from a the links dictionary. Each item in the links dictionary is a + dictionary with a rel and href key""" + if links is None: links = self._by_rel(url, 'links') + link = links[rel]['href'] + return link + + def get_item (self, rel, id): + r = self.get(f"{self.link(rel)}/{id}") + return self.parse_response(r)[0] + + def get_collection(self, rel, id=None): + if id: + url = f"{self.link(rel)}/{id}" + else: + url = f"{self.link(rel)}" + r = self.get(url) + return Collection.from_json(json.dumps(r)) + + @classmethod + def parse_response(self, response): + result = [] + items = [item['data'] for item in response['collection'].get('items',[])] + for item in response['collection'].get('items',[]): + details = {} + for detail in item['data']: + # TODO type casting and validation based on item['type'] + details[detail['name']] = detail['value'] + result.append(details) + + return result + # return [{detail['name']: detail['value'] for detail in item} for item in items] + diff --git a/teamsnap/models.py b/teamsnap/models.py new file mode 100644 index 0000000..9194c61 --- /dev/null +++ b/teamsnap/models.py @@ -0,0 +1,21 @@ +from dataclasses import dataclass +from typing import Optional +from teamsnap.api import TeamSnap +from urllib.parse import urljoin + +class Item: + id: int + type: str + data: dict = {} + + def __init__(self, client:TeamSnap, rel, id, data: dict = {}): + self._client = client + self.type = rel + self.id = id + self._data = data + + @property + def data(self): + if self._data: return self._data + else: + return self._client.get_item(self.type, self.id) diff --git a/tests/credentials.py b/tests/credentials.py new file mode 100644 index 0000000..4640e5d --- /dev/null +++ b/tests/credentials.py @@ -0,0 +1,2 @@ +token="u2SqDq78FumVvhkt1D-V1CQ2ZIaB-nUVlzGwd1YhGtA" +team_id = 7644001 \ No newline at end of file diff --git a/tests/private_test.py b/tests/private_test.py new file mode 100644 index 0000000..af50b38 --- /dev/null +++ b/tests/private_test.py @@ -0,0 +1,22 @@ +import unittest +from credentials import team_id as TEAM_ID +from credentials import token as TOKEN +from teamsnap import TeamSnap +from teamsnap.models import Item +from teamsnap.api import Team, Event, Availability, Me, ApiObject +import teamsnap +TEAM_ID = 7644001 +EVENT_1 = 239261604 + +c = TeamSnap(token=TOKEN) +es = Event.search(c, team_id=TEAM_ID) +q1 = c.query("events", "search", team_id=TEAM_ID) +team = c.teams.get(TEAM_ID) +event = Item(client=c, rel="events", id=EVENT_1) +# event = c.events.get(239261604) +col = c.get_collection(rel="events", id=EVENT_1) +print(event.data) +pass +# q2 = c.events.search(team_id=TEAM_ID) +# a = c.availabilities.search(event_id=q2[0]['id']) +# print(q1==q2)