From c18616f314d550c1752c54f52f64c7d692c9dd53 Mon Sep 17 00:00:00 2001 From: Agash Date: Wed, 25 Feb 2026 08:18:36 +0100 Subject: [PATCH 1/8] chore: spec from api probing results --- openapi/goaffpro-canonical.yaml | 933 ++++++++++++++++++++++++++++++++ 1 file changed, 933 insertions(+) create mode 100644 openapi/goaffpro-canonical.yaml diff --git a/openapi/goaffpro-canonical.yaml b/openapi/goaffpro-canonical.yaml new file mode 100644 index 0000000..c8b1af6 --- /dev/null +++ b/openapi/goaffpro-canonical.yaml @@ -0,0 +1,933 @@ +openapi: 3.0.3 +info: + title: GOAFFPRO Canonical API (User/Public) + version: 2026.2.25 + description: > + Maintained canonical contract for GoAffPro user/public endpoints. + This spec intentionally corrects known response-shape drift from upstream docs. +servers: + - url: https://api.goaffpro.com/v1/ + +paths: + /user/login: + post: + summary: Log in to get the access token + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + required: + - email + - password + properties: + email: + type: string + password: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/LoginResponse' + - $ref: '#/components/schemas/ErrorResponse' + + /user/sites: + get: + summary: List of stores the user is enrolled in + parameters: + - in: query + name: limit + schema: + type: integer + - in: query + name: offset + schema: + type: integer + - in: query + name: status + schema: + type: string + enum: [approved, pending, blocked] + - in: query + name: fields + required: true + explode: false + schema: + type: array + items: + type: string + enum: [id, name, logo, website, status, currency, affiliate_portal, ref_code, referral_link, coupon] + responses: + '200': + description: Success + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/UserSiteListResponse' + - $ref: '#/components/schemas/ErrorResponse' + '403': + $ref: '#/components/responses/AuthErrorResponse' + + /user: + get: + summary: Get information about logged in user profile + responses: + '200': + description: Success + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/UserProfileEnvelope' + - $ref: '#/components/schemas/ErrorResponse' + '403': + $ref: '#/components/responses/AuthErrorResponse' + post: + summary: Update your profile + responses: + '200': + description: Success + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/UserProfileUpdateResponse' + - $ref: '#/components/schemas/ErrorResponse' + '403': + $ref: '#/components/responses/AuthErrorResponse' + + /user/stats/aggregate: + get: + summary: Aggregates of user stats + parameters: + - in: query + name: site_ids + schema: + type: string + - in: query + name: start_time + schema: + type: string + - in: query + name: end_time + schema: + type: string + - in: query + name: fields + required: true + explode: false + schema: + type: array + items: + type: string + enum: [total_sales, other_commission_earned, revenue_generated, sale_commission_earned, commission_paid] + responses: + '200': + description: Success + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/UserStatsAggregateResponse' + - $ref: '#/components/schemas/ErrorResponse' + '403': + $ref: '#/components/responses/AuthErrorResponse' + + /user/feed/orders: + get: + summary: Feed of user orders + parameters: + - in: query + name: site_ids + schema: + type: string + - in: query + name: since_id + schema: + type: string + - in: query + name: max_id + schema: + type: string + - in: query + name: created_at_max + schema: + type: string + - in: query + name: created_at_min + schema: + type: string + - in: query + name: fields + required: true + explode: false + schema: + type: array + items: + type: string + enum: [id, number, total, subtotal, line_items, commission, created_at, currency, site_id, sub_id, conversion_details] + - in: query + name: limit + schema: + type: integer + - in: query + name: offset + schema: + type: integer + responses: + '200': + description: Success + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/UserOrderFeedResponse' + - $ref: '#/components/schemas/ErrorResponse' + '403': + $ref: '#/components/responses/AuthErrorResponse' + + /user/feed/payouts: + get: + summary: Feed of user payouts + parameters: + - in: query + name: site_ids + schema: + type: string + - in: query + name: start_time + schema: + type: string + - in: query + name: end_time + schema: + type: string + - in: query + name: since_id + schema: + type: integer + - in: query + name: limit + schema: + type: integer + - in: query + name: offset + schema: + type: integer + responses: + '200': + description: Success + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/UserPayoutFeedResponse' + - $ref: '#/components/schemas/ErrorResponse' + '403': + $ref: '#/components/responses/AuthErrorResponse' + + /user/feed/products: + get: + summary: Feed of products available for promotion + parameters: + - in: query + name: limit + schema: + type: integer + - in: query + name: offset + schema: + type: integer + responses: + '200': + description: Success + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/UserProductFeedResponse' + - $ref: '#/components/schemas/ErrorResponse' + '403': + $ref: '#/components/responses/AuthErrorResponse' + '502': + $ref: '#/components/responses/PlainTextErrorResponse' + + /user/feed/rewards: + get: + summary: Feed of user rewards + parameters: + - in: query + name: site_ids + schema: + type: string + - in: query + name: start_time + schema: + type: string + - in: query + name: end_time + schema: + type: string + - in: query + name: since_id + schema: + type: integer + - in: query + name: limit + schema: + type: integer + - in: query + name: offset + schema: + type: integer + responses: + '200': + description: Success + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/UserRewardFeedResponse' + - $ref: '#/components/schemas/ErrorResponse' + '404': + $ref: '#/components/responses/PlainTextErrorResponse' + + /user/feed/traffic: + get: + summary: Feed of user traffic + parameters: + - in: query + name: site_ids + schema: + type: string + - in: query + name: start_time + schema: + type: string + - in: query + name: end_time + schema: + type: string + - in: query + name: since_id + schema: + type: integer + - in: query + name: limit + schema: + type: integer + - in: query + name: offset + schema: + type: integer + responses: + '200': + description: Success + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/UserTrafficFeedResponse' + - $ref: '#/components/schemas/ErrorResponse' + '403': + $ref: '#/components/responses/AuthErrorResponse' + + /user/feed/transactions: + get: + summary: Feed of user transactions + parameters: + - in: query + name: limit + schema: + type: integer + - in: query + name: offset + schema: + type: integer + responses: + '200': + description: Success + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/UserTransactionFeedResponse' + - $ref: '#/components/schemas/ErrorResponse' + '403': + $ref: '#/components/responses/AuthErrorResponse' + '500': + $ref: '#/components/responses/PlainTextErrorResponse' + + /user/commissions: + get: + summary: Get commission structure + parameters: + - in: query + name: site_ids + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/UserCommissionsResponse' + - $ref: '#/components/schemas/ErrorResponse' + '403': + $ref: '#/components/responses/AuthErrorResponse' + + /user/payouts/pending: + get: + summary: Get pending payout amount (and its breakdown) + responses: + '200': + description: Success + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/UserPendingPayoutsResponse' + - $ref: '#/components/schemas/ErrorResponse' + '403': + $ref: '#/components/responses/AuthErrorResponse' + + /public/sites: + get: + summary: Public marketplace sites + parameters: + - in: query + name: site_ids + schema: + type: string + - in: query + name: currency + schema: + type: string + - in: query + name: keyword + schema: + type: string + - in: query + name: limit + schema: + type: integer + - in: query + name: offset + schema: + type: integer + responses: + '200': + description: Success + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PublicSitesResponse' + - $ref: '#/components/schemas/ErrorResponse' + '500': + $ref: '#/components/responses/PlainTextErrorResponse' + '502': + $ref: '#/components/responses/PlainTextErrorResponse' + + /public/products: + get: + summary: Public marketplace products + parameters: + - in: query + name: limit + schema: + type: integer + - in: query + name: offset + schema: + type: integer + - in: query + name: site_ids + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PublicProductsResponse' + - $ref: '#/components/schemas/ErrorResponse' + '500': + $ref: '#/components/responses/PlainTextErrorResponse' + '502': + $ref: '#/components/responses/PlainTextErrorResponse' + +components: + responses: + AuthErrorResponse: + description: Authentication or authorization failure. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + text/plain: + schema: + type: string + PlainTextErrorResponse: + description: Upstream service error response in plain text. + content: + text/plain: + schema: + type: string + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + schemas: + LoginResponse: + type: object + required: [access_token] + properties: + access_token: + type: string + + UserProfileEnvelope: + type: object + required: [user] + properties: + user: + type: object + additionalProperties: true + additionalProperties: true + + UserProfileUpdateResponse: + type: object + required: [success] + properties: + success: + type: integer + additionalProperties: true + + UserSiteListResponse: + type: object + required: [sites, count] + properties: + sites: + type: array + items: + $ref: '#/components/schemas/UserSite' + count: + type: integer + additionalProperties: true + + UserSite: + type: object + properties: + id: + type: string + name: + type: string + logo: + type: string + website: + type: string + status: + type: string + currency: + type: string + affiliate_portal: + type: string + ref_code: + type: string + referral_link: + type: string + coupon: + type: object + additionalProperties: true + additionalProperties: true + + UserStatsAggregateResponse: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/UserStatsAggregateItem' + additionalProperties: true + + UserStatsAggregateItem: + type: object + properties: + site_id: + type: integer + total_sales: + type: number + currency: + type: string + sale_commission_earned: + type: number + revenue_generated: + type: number + commission_paid: + type: number + additionalProperties: true + + CountLimitOffsetEnvelope: + type: object + required: [count, limit, offset] + properties: + count: + type: integer + limit: + type: integer + offset: + type: integer + additionalProperties: true + + CountLimitOffsetEnvelopeFlexibleOffset: + type: object + required: [count, limit, offset] + properties: + count: + type: integer + limit: + type: integer + offset: + oneOf: + - type: integer + - type: string + additionalProperties: true + + SinceIdEcho: + type: object + properties: + since_id: + oneOf: + - type: integer + - type: string + additionalProperties: true + + UserOrderFeedResponse: + allOf: + - $ref: '#/components/schemas/CountLimitOffsetEnvelope' + - type: object + required: [orders] + properties: + orders: + type: array + items: + $ref: '#/components/schemas/UserOrderFeedItem' + additionalProperties: true + + UserOrderFeedItem: + type: object + properties: + id: + type: string + number: + type: string + total: + type: number + subtotal: + type: number + line_items: + type: array + items: + type: object + additionalProperties: true + commission: + type: number + created_at: + type: string + currency: + type: string + site_id: + type: string + sub_id: + type: string + conversion_details: + type: object + additionalProperties: true + additionalProperties: true + + UserPayoutFeedResponse: + allOf: + - $ref: '#/components/schemas/CountLimitOffsetEnvelope' + - $ref: '#/components/schemas/SinceIdEcho' + - type: object + required: [payouts] + properties: + payouts: + type: array + items: + type: object + additionalProperties: true + additionalProperties: true + + UserProductFeedResponse: + allOf: + - $ref: '#/components/schemas/CountLimitOffsetEnvelopeFlexibleOffset' + - type: object + required: [products] + properties: + products: + type: array + items: + type: object + additionalProperties: true + additionalProperties: true + + UserRewardFeedResponse: + allOf: + - $ref: '#/components/schemas/CountLimitOffsetEnvelope' + - type: object + required: [rewards] + properties: + rewards: + type: array + items: + $ref: '#/components/schemas/UserRewardFeedItem' + additionalProperties: true + + UserRewardFeedItem: + type: object + properties: + id: + type: string + affiliate_id: + type: string + type: + type: string + metadata: + type: string + order_id: + type: string + level: + type: integer + amount: + type: number + status: + type: string + created: + type: string + additionalProperties: true + + UserTrafficFeedResponse: + allOf: + - $ref: '#/components/schemas/CountLimitOffsetEnvelope' + - $ref: '#/components/schemas/SinceIdEcho' + - type: object + required: [traffic] + properties: + traffic: + type: array + items: + type: object + additionalProperties: true + additionalProperties: true + + UserCommissionsResponse: + type: object + properties: + standard: + type: object + additionalProperties: true + special: + type: array + items: + type: object + additionalProperties: true + royalties: + type: array + items: + type: object + additionalProperties: true + mlm: + type: object + additionalProperties: true + commissions: + type: array + items: + nullable: true + additionalProperties: true + + UserTransactionFeedResponse: + type: object + required: [transactions] + properties: + transactions: + type: array + items: + $ref: '#/components/schemas/UserTransactionItem' + count: + type: integer + limit: + type: integer + offset: + oneOf: + - type: integer + - type: string + additionalProperties: true + + UserTransactionItem: + type: object + properties: + id: + type: string + tx_id: + type: integer + affiliate_id: + type: integer + amount: + type: number + currency: + type: string + startingBalance: + type: number + endingBalance: + type: number + created_at: + type: string + entity_type: + type: string + enum: [orders, rewards, payouts, ORDERS, REWARDS, PAYOUTS] + event_type: + type: string + enum: [insert, update, delete] + entity_id: + type: string + is_paid: + type: boolean + metadata: + type: object + additionalProperties: true + additionalProperties: true + + UserPendingPayoutsResponse: + type: object + required: [pending] + properties: + pending: + oneOf: + - type: array + items: + $ref: '#/components/schemas/PendingPayoutItem' + - $ref: '#/components/schemas/PendingPayoutBreakdown' + additionalProperties: true + + PendingPayoutItem: + type: object + properties: + affiliate_id: + oneOf: + - type: integer + - type: string + amount: + oneOf: + - type: number + - type: string + total_earned: + oneOf: + - type: number + - type: string + total_paid: + oneOf: + - type: number + - type: string + additionalProperties: true + + PendingPayoutBreakdown: + type: object + properties: + sale_earnings: + type: number + other_earnings: + type: number + paid_earnings: + type: number + amount_pending: + type: number + additionalProperties: true + + PublicSitesResponse: + allOf: + - $ref: '#/components/schemas/CountLimitOffsetEnvelopeFlexibleOffset' + - type: object + required: [stores] + properties: + stores: + type: array + items: + $ref: '#/components/schemas/PublicStore' + currency: + type: string + keyword: + type: string + additionalProperties: true + + PublicStore: + type: object + properties: + id: + type: integer + name: + type: string + website: + type: string + logo: + type: string + currency: + type: string + affiliatePortal: + type: string + cookieDuration: + type: integer + areRegistrationsOpen: + type: integer + isApprovedAutomatically: + type: integer + commission: + $ref: '#/components/schemas/CommissionLike' + additionalProperties: true + + PublicProductsResponse: + allOf: + - $ref: '#/components/schemas/CountLimitOffsetEnvelopeFlexibleOffset' + - type: object + required: [products] + properties: + products: + type: array + items: + type: object + additionalProperties: true + site_ids: + type: string + additionalProperties: true + + CommissionLike: + type: object + properties: + type: + type: string + amount: + type: number + on: + type: string + additionalProperties: true + + ErrorResponse: + type: object + required: [error] + properties: + error: + type: string + code: + oneOf: + - type: integer + - type: string + additionalProperties: true From fc52bc9e126419fa44fab54d3999f2a010d58649 Mon Sep 17 00:00:00 2001 From: Agash Date: Wed, 25 Feb 2026 08:36:02 +0100 Subject: [PATCH 2/8] refactor(generator): default to canonical spec and minimize feed wrappers --- README.md | 10 +- api-spec-summary.md | 34 + openapi/goaffpro-canonical.json | 1569 +++++++++++++++ openapi/goaffpro-canonical.yaml | 34 +- scripts/analyze-api.ps1 | 268 +++ scripts/probe-openapi-spec.ps1 | 446 ++++ .../GeneratorRunner.cs | 66 +- .../build/GoAffPro.Client.Generator.targets | 2 +- .../Generated/GoAffProPublicClient.g.cs | 914 ++++----- .../Generated/GoAffProUserClient.g.cs | 1786 ++++++++--------- src/GoAffPro.Client/GoAffPro.Client.csproj | 2 +- src/GoAffPro.Client/GoAffProClient.cs | 56 +- .../GeneratedClientSignatures.snapshot | 56 +- 13 files changed, 3670 insertions(+), 1573 deletions(-) create mode 100644 api-spec-summary.md create mode 100644 openapi/goaffpro-canonical.json create mode 100644 scripts/analyze-api.ps1 create mode 100644 scripts/probe-openapi-spec.ps1 diff --git a/README.md b/README.md index ff200c0..ad15536 100644 --- a/README.md +++ b/README.md @@ -137,12 +137,10 @@ dotnet run --project examples/GoAffPro.Client.Example On build, `GoAffPro.Client.Generator`: -1. Fetches `https://api.goaffpro.com/docs/admin/swagger-ui-init.js` - (or uses `openapi/swagger-ui-init.js` only if you provide a local override file) -2. Extracts OpenAPI JSON -3. Filters to `/user/*` and `/public/*` -4. Normalizes schema gaps for generation -5. Generates: +1. Loads local canonical spec `openapi/goaffpro-canonical.json` by default + (or uses a configured `GoAffProSwaggerInitPath`; supports both full OpenAPI `.json` and `swagger-ui-init.js`) +2. If `swagger-ui-init.js` is used, extracts embedded OpenAPI JSON and applies legacy normalization +3. Generates: - `src/GoAffPro.Client/Generated/GoAffProUserClient.g.cs` - `src/GoAffPro.Client/Generated/GoAffProPublicClient.g.cs` diff --git a/api-spec-summary.md b/api-spec-summary.md new file mode 100644 index 0000000..bad3b27 --- /dev/null +++ b/api-spec-summary.md @@ -0,0 +1,34 @@ +# API Spec Summary + +This repo now has a maintained canonical spec for GoAffPro user/public APIs: + +- `openapi/goaffpro-canonical.yaml` + +## Key decisions + +- Canonical source is YAML and is decoupled from upstream `swagger-ui-init.js` schema drift. +- Response envelopes are normalized with shared wrappers (`allOf`) for recurring pagination-like shapes. +- Drift-prone payloads keep `additionalProperties: true`. +- Known logical failures that still return HTTP `200` are modeled via `oneOf` success/error responses. +- Known plain-text failure cases are modeled (`/user/feed/rewards` -> `404`, `/user/feed/products` -> `502`). + +## Added/normalized user endpoints + +- `/user/sites` -> `{ sites: [], count }` (fixed from upstream singular-object mismatch) +- `/user/stats/aggregate` -> `{ data: [] }` +- `/user/feed/orders|payouts|products|rewards|traffic` envelopes normalized +- `/user/commissions` supports observed variant payloads +- `/user/payouts/pending` added (observed working with bearer token) +- `/user/feed/transactions` added (currently returns `500` with bearer token but endpoint appears present) + +## Probe scripts retained + +- `scripts/analyze-api.ps1` + Scenario-based probe (auth/no-auth, body-aware, logical `200` error detection). +- `scripts/probe-openapi-spec.ps1` + Spec-driven probe for JSON/YAML OpenAPI files, nested shape summaries, optional no-auth user probes. + +## Notes + +- No access token is stored in repo files. +- Probe outputs are intentionally not kept as committed artifacts. diff --git a/openapi/goaffpro-canonical.json b/openapi/goaffpro-canonical.json new file mode 100644 index 0000000..ff3a8f3 --- /dev/null +++ b/openapi/goaffpro-canonical.json @@ -0,0 +1,1569 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "GOAFFPRO Canonical API (User/Public)", + "version": "2026.2.25", + "description": "Maintained canonical contract for GoAffPro user/public endpoints. This spec intentionally corrects known response-shape drift from upstream docs.\n" + }, + "servers": [ + { + "url": "https://api.goaffpro.com/v1/" + } + ], + "paths": { + "/user/login": { + "post": { + "summary": "Log in to get the access token", + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "required": [ + "email", + "password" + ], + "properties": { + "email": { + "type": "string" + }, + "password": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/LoginResponse" + }, + { + "$ref": "#/components/schemas/ErrorResponse" + } + ] + } + } + } + } + } + } + }, + "/user/sites": { + "get": { + "summary": "List of stores the user is enrolled in", + "parameters": [ + { + "in": "query", + "name": "limit", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "offset", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "status", + "schema": { + "type": "string", + "enum": [ + "approved", + "pending", + "blocked" + ] + } + }, + { + "in": "query", + "name": "fields", + "required": true, + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "id", + "name", + "logo", + "website", + "status", + "currency", + "affiliate_portal", + "ref_code", + "referral_link", + "coupon" + ] + } + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserSiteListResponse" + }, + { + "$ref": "#/components/schemas/ErrorResponse" + } + ] + } + } + } + }, + "403": { + "$ref": "#/components/responses/AuthErrorResponse" + } + } + } + }, + "/user": { + "get": { + "summary": "Get information about logged in user profile", + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserProfileEnvelope" + }, + { + "$ref": "#/components/schemas/ErrorResponse" + } + ] + } + } + } + }, + "403": { + "$ref": "#/components/responses/AuthErrorResponse" + } + } + }, + "post": { + "summary": "Update your profile", + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserProfileUpdateResponse" + }, + { + "$ref": "#/components/schemas/ErrorResponse" + } + ] + } + } + } + }, + "403": { + "$ref": "#/components/responses/AuthErrorResponse" + } + } + } + }, + "/user/stats/aggregate": { + "get": { + "summary": "Aggregates of user stats", + "parameters": [ + { + "in": "query", + "name": "site_ids", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "start_time", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "end_time", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "fields", + "required": true, + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "total_sales", + "other_commission_earned", + "revenue_generated", + "sale_commission_earned", + "commission_paid" + ] + } + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserStatsAggregateResponse" + }, + { + "$ref": "#/components/schemas/ErrorResponse" + } + ] + } + } + } + }, + "403": { + "$ref": "#/components/responses/AuthErrorResponse" + } + } + } + }, + "/user/feed/orders": { + "get": { + "summary": "Feed of user orders", + "parameters": [ + { + "in": "query", + "name": "site_ids", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "since_id", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "max_id", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "created_at_max", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "created_at_min", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "fields", + "required": true, + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "id", + "number", + "total", + "subtotal", + "line_items", + "commission", + "created_at", + "currency", + "site_id", + "sub_id", + "conversion_details" + ] + } + } + }, + { + "in": "query", + "name": "limit", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "offset", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserOrderFeedResponse" + }, + { + "$ref": "#/components/schemas/ErrorResponse" + } + ] + } + } + } + }, + "403": { + "$ref": "#/components/responses/AuthErrorResponse" + } + } + } + }, + "/user/feed/payouts": { + "get": { + "summary": "Feed of user payouts", + "parameters": [ + { + "in": "query", + "name": "site_ids", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "start_time", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "end_time", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "since_id", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "limit", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "offset", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserPayoutFeedResponse" + }, + { + "$ref": "#/components/schemas/ErrorResponse" + } + ] + } + } + } + }, + "403": { + "$ref": "#/components/responses/AuthErrorResponse" + } + } + } + }, + "/user/feed/products": { + "get": { + "summary": "Feed of products available for promotion", + "parameters": [ + { + "in": "query", + "name": "limit", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "offset", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserProductFeedResponse" + }, + { + "$ref": "#/components/schemas/ErrorResponse" + } + ] + } + } + } + }, + "403": { + "$ref": "#/components/responses/AuthErrorResponse" + }, + "502": { + "$ref": "#/components/responses/PlainTextErrorResponse" + } + } + } + }, + "/user/feed/rewards": { + "get": { + "summary": "Feed of user rewards", + "parameters": [ + { + "in": "query", + "name": "site_ids", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "start_time", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "end_time", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "since_id", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "limit", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "offset", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserRewardFeedResponse" + }, + { + "$ref": "#/components/schemas/ErrorResponse" + } + ] + } + } + } + }, + "404": { + "$ref": "#/components/responses/PlainTextErrorResponse" + } + } + } + }, + "/user/feed/traffic": { + "get": { + "summary": "Feed of user traffic", + "parameters": [ + { + "in": "query", + "name": "site_ids", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "start_time", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "end_time", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "since_id", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "limit", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "offset", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserTrafficFeedResponse" + }, + { + "$ref": "#/components/schemas/ErrorResponse" + } + ] + } + } + } + }, + "403": { + "$ref": "#/components/responses/AuthErrorResponse" + } + } + } + }, + "/user/feed/transactions": { + "get": { + "summary": "Feed of user transactions", + "parameters": [ + { + "in": "query", + "name": "limit", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "offset", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserTransactionFeedResponse" + }, + { + "$ref": "#/components/schemas/ErrorResponse" + } + ] + } + } + } + }, + "403": { + "$ref": "#/components/responses/AuthErrorResponse" + }, + "500": { + "$ref": "#/components/responses/PlainTextErrorResponse" + } + } + } + }, + "/user/commissions": { + "get": { + "summary": "Get commission structure", + "parameters": [ + { + "in": "query", + "name": "site_ids", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserCommissionsResponse" + }, + { + "$ref": "#/components/schemas/ErrorResponse" + } + ] + } + } + } + }, + "403": { + "$ref": "#/components/responses/AuthErrorResponse" + } + } + } + }, + "/user/payouts/pending": { + "get": { + "summary": "Get pending payout amount (and its breakdown)", + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserPendingPayoutsResponse" + }, + { + "$ref": "#/components/schemas/ErrorResponse" + } + ] + } + } + } + }, + "403": { + "$ref": "#/components/responses/AuthErrorResponse" + } + } + } + }, + "/public/sites": { + "get": { + "summary": "Public marketplace sites", + "parameters": [ + { + "in": "query", + "name": "site_ids", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "currency", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "keyword", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "limit", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "offset", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/PublicSitesResponse" + }, + { + "$ref": "#/components/schemas/ErrorResponse" + } + ] + } + } + } + }, + "500": { + "$ref": "#/components/responses/PlainTextErrorResponse" + }, + "502": { + "$ref": "#/components/responses/PlainTextErrorResponse" + } + } + } + }, + "/public/products": { + "get": { + "summary": "Public marketplace products", + "parameters": [ + { + "in": "query", + "name": "limit", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "offset", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "site_ids", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/PublicProductsResponse" + }, + { + "$ref": "#/components/schemas/ErrorResponse" + } + ] + } + } + } + }, + "500": { + "$ref": "#/components/responses/PlainTextErrorResponse" + }, + "502": { + "$ref": "#/components/responses/PlainTextErrorResponse" + } + } + } + } + }, + "components": { + "responses": { + "AuthErrorResponse": { + "description": "Authentication or authorization failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + }, + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "PlainTextErrorResponse": { + "description": "Upstream service error response in plain text.", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "schemas": { + "LoginResponse": { + "type": "object", + "required": [ + "access_token" + ], + "properties": { + "access_token": { + "type": "string" + } + } + }, + "UserProfileEnvelope": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "object", + "additionalProperties": true + } + }, + "additionalProperties": true + }, + "UserProfileUpdateResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "integer" + } + }, + "additionalProperties": true + }, + "UserSiteListResponse": { + "type": "object", + "required": [ + "sites", + "count" + ], + "properties": { + "sites": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserSite" + } + }, + "count": { + "type": "integer" + } + }, + "additionalProperties": true + }, + "UserSite": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "logo": { + "type": "string" + }, + "website": { + "type": "string" + }, + "status": { + "type": "string" + }, + "currency": { + "type": "string" + }, + "affiliate_portal": { + "type": "string" + }, + "ref_code": { + "type": "string" + }, + "referral_link": { + "type": "string" + }, + "coupon": { + "type": "object", + "additionalProperties": true + } + }, + "additionalProperties": true + }, + "UserStatsAggregateResponse": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserStatsAggregateItem" + } + } + }, + "additionalProperties": true + }, + "UserStatsAggregateItem": { + "type": "object", + "properties": { + "site_id": { + "type": "integer" + }, + "total_sales": { + "type": "number" + }, + "currency": { + "type": "string" + }, + "sale_commission_earned": { + "type": "number" + }, + "revenue_generated": { + "type": "number" + }, + "commission_paid": { + "type": "number" + } + }, + "additionalProperties": true + }, + "CountLimitOffsetEnvelope": { + "type": "object", + "required": [ + "count", + "limit", + "offset" + ], + "properties": { + "count": { + "type": "integer" + }, + "limit": { + "type": "integer" + }, + "offset": { + "type": "integer" + } + }, + "additionalProperties": true + }, + "CountLimitOffsetEnvelopeFlexibleOffset": { + "type": "object", + "required": [ + "count", + "limit", + "offset" + ], + "properties": { + "count": { + "type": "integer" + }, + "limit": { + "type": "integer" + }, + "offset": { + "oneOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ] + } + }, + "additionalProperties": true + }, + "SinceIdEcho": { + "type": "object", + "properties": { + "since_id": { + "oneOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ] + } + }, + "additionalProperties": true + }, + "UserOrderFeedResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/CountLimitOffsetEnvelope" + }, + { + "type": "object", + "required": [ + "orders" + ], + "properties": { + "orders": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + } + }, + "additionalProperties": true + } + ] + }, + "UserPayoutFeedResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/CountLimitOffsetEnvelope" + }, + { + "$ref": "#/components/schemas/SinceIdEcho" + }, + { + "type": "object", + "required": [ + "payouts" + ], + "properties": { + "payouts": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + } + }, + "additionalProperties": true + } + ] + }, + "UserProductFeedResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/CountLimitOffsetEnvelopeFlexibleOffset" + }, + { + "type": "object", + "required": [ + "products" + ], + "properties": { + "products": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + } + }, + "additionalProperties": true + } + ] + }, + "UserRewardFeedResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/CountLimitOffsetEnvelope" + }, + { + "type": "object", + "required": [ + "rewards" + ], + "properties": { + "rewards": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserRewardFeedItem" + } + } + }, + "additionalProperties": true + } + ] + }, + "UserRewardFeedItem": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "affiliate_id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "metadata": { + "type": "string" + }, + "order_id": { + "type": "string" + }, + "level": { + "type": "integer" + }, + "amount": { + "type": "number" + }, + "status": { + "type": "string" + }, + "created": { + "type": "string" + } + }, + "additionalProperties": true + }, + "UserTrafficFeedResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/CountLimitOffsetEnvelope" + }, + { + "$ref": "#/components/schemas/SinceIdEcho" + }, + { + "type": "object", + "required": [ + "traffic" + ], + "properties": { + "traffic": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + } + }, + "additionalProperties": true + } + ] + }, + "UserCommissionsResponse": { + "type": "object", + "properties": { + "standard": { + "type": "object", + "additionalProperties": true + }, + "special": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + }, + "royalties": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + }, + "mlm": { + "type": "object", + "additionalProperties": true + }, + "commissions": { + "type": "array", + "items": { + "nullable": true + } + } + }, + "additionalProperties": true + }, + "UserTransactionFeedResponse": { + "type": "object", + "required": [ + "transactions" + ], + "properties": { + "transactions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserTransactionItem" + } + }, + "count": { + "type": "integer" + }, + "limit": { + "type": "integer" + }, + "offset": { + "oneOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ] + } + }, + "additionalProperties": true + }, + "UserTransactionItem": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "tx_id": { + "type": "integer" + }, + "affiliate_id": { + "type": "integer" + }, + "amount": { + "type": "number" + }, + "currency": { + "type": "string" + }, + "startingBalance": { + "type": "number" + }, + "endingBalance": { + "type": "number" + }, + "created_at": { + "type": "string" + }, + "entity_type": { + "type": "string", + "enum": [ + "orders", + "rewards", + "payouts", + "ORDERS", + "REWARDS", + "PAYOUTS" + ] + }, + "event_type": { + "type": "string", + "enum": [ + "insert", + "update", + "delete" + ] + }, + "entity_id": { + "type": "string" + }, + "is_paid": { + "type": "boolean" + }, + "metadata": { + "type": "object", + "additionalProperties": true + } + }, + "additionalProperties": true + }, + "UserPendingPayoutsResponse": { + "type": "object", + "required": [ + "pending" + ], + "properties": { + "pending": { + "oneOf": [ + { + "type": "array", + "items": { + "$ref": "#/components/schemas/PendingPayoutItem" + } + }, + { + "$ref": "#/components/schemas/PendingPayoutBreakdown" + } + ] + } + }, + "additionalProperties": true + }, + "PendingPayoutItem": { + "type": "object", + "properties": { + "affiliate_id": { + "oneOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ] + }, + "amount": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ] + }, + "total_earned": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ] + }, + "total_paid": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ] + } + }, + "additionalProperties": true + }, + "PendingPayoutBreakdown": { + "type": "object", + "properties": { + "sale_earnings": { + "type": "number" + }, + "other_earnings": { + "type": "number" + }, + "paid_earnings": { + "type": "number" + }, + "amount_pending": { + "type": "number" + } + }, + "additionalProperties": true + }, + "PublicSitesResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/CountLimitOffsetEnvelopeFlexibleOffset" + }, + { + "type": "object", + "required": [ + "stores" + ], + "properties": { + "stores": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PublicStore" + } + }, + "currency": { + "type": "string" + }, + "keyword": { + "type": "string" + } + }, + "additionalProperties": true + } + ] + }, + "PublicStore": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "website": { + "type": "string" + }, + "logo": { + "type": "string" + }, + "currency": { + "type": "string" + }, + "affiliatePortal": { + "type": "string" + }, + "cookieDuration": { + "type": "integer" + }, + "areRegistrationsOpen": { + "type": "integer" + }, + "isApprovedAutomatically": { + "type": "integer" + }, + "commission": { + "$ref": "#/components/schemas/CommissionLike" + } + }, + "additionalProperties": true + }, + "PublicProductsResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/CountLimitOffsetEnvelopeFlexibleOffset" + }, + { + "type": "object", + "required": [ + "products" + ], + "properties": { + "products": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + }, + "site_ids": { + "type": "string" + } + }, + "additionalProperties": true + } + ] + }, + "CommissionLike": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "amount": { + "type": "number" + }, + "true": { + "type": "string" + } + }, + "additionalProperties": true + }, + "ErrorResponse": { + "type": "object", + "required": [ + "error" + ], + "properties": { + "error": { + "type": "string" + }, + "code": { + "oneOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ] + } + }, + "additionalProperties": true + } + } + } +} diff --git a/openapi/goaffpro-canonical.yaml b/openapi/goaffpro-canonical.yaml index c8b1af6..6e3fa8d 100644 --- a/openapi/goaffpro-canonical.yaml +++ b/openapi/goaffpro-canonical.yaml @@ -620,39 +620,9 @@ components: orders: type: array items: - $ref: '#/components/schemas/UserOrderFeedItem' - additionalProperties: true - - UserOrderFeedItem: - type: object - properties: - id: - type: string - number: - type: string - total: - type: number - subtotal: - type: number - line_items: - type: array - items: - type: object - additionalProperties: true - commission: - type: number - created_at: - type: string - currency: - type: string - site_id: - type: string - sub_id: - type: string - conversion_details: - type: object + type: object + additionalProperties: true additionalProperties: true - additionalProperties: true UserPayoutFeedResponse: allOf: diff --git a/scripts/analyze-api.ps1 b/scripts/analyze-api.ps1 new file mode 100644 index 0000000..8e263c0 --- /dev/null +++ b/scripts/analyze-api.ps1 @@ -0,0 +1,268 @@ +param( + [Parameter(Mandatory = $true)] + [string]$BearerToken, + [string]$OutputPath = "api-analysis-data.json", + [int]$MaxDepth = 6 +) + +$ErrorActionPreference = "Stop" +$ProgressPreference = "SilentlyContinue" + +function Resolve-Schema { + param([hashtable]$Doc, [object]$Schema) + if ($null -eq $Schema) { return $null } + if ($Schema -is [hashtable] -and $Schema.ContainsKey('$ref')) { + $ref = [string]$Schema['$ref'] + if ($ref.StartsWith("#/components/schemas/")) { + $name = $ref.Substring("#/components/schemas/".Length) + if ($Doc.components.schemas.ContainsKey($name)) { return $Doc.components.schemas[$name] } + } + } + return $Schema +} + +function Get-SchemaTypeSummary { + param([hashtable]$Doc, [object]$Schema, [int]$Depth = 0, [int]$MaxDepth = 6) + if ($Depth -ge $MaxDepth) { return @{ type = "max-depth-reached" } } + $resolved = Resolve-Schema -Doc $Doc -Schema $Schema + if ($null -eq $resolved -or $resolved -isnot [hashtable]) { return @{ type = "unknown" } } + + if ($resolved.ContainsKey("oneOf")) { + return @{ + type = "oneOf" + variants = @($resolved.oneOf | ForEach-Object { Get-SchemaTypeSummary -Doc $Doc -Schema $_ -Depth ($Depth + 1) -MaxDepth $MaxDepth }) + } + } + + if ($resolved.ContainsKey("allOf")) { + return @{ + type = "allOf" + variants = @($resolved.allOf | ForEach-Object { Get-SchemaTypeSummary -Doc $Doc -Schema $_ -Depth ($Depth + 1) -MaxDepth $MaxDepth }) + } + } + + if ($resolved.ContainsKey("type") -and $resolved["type"] -eq "array") { + return @{ + type = "array" + items = Get-SchemaTypeSummary -Doc $Doc -Schema $resolved.items -Depth ($Depth + 1) -MaxDepth $MaxDepth + } + } + + if ($resolved.ContainsKey("properties") -or ($resolved.ContainsKey("type") -and $resolved["type"] -eq "object")) { + $properties = @{} + if ($resolved.ContainsKey("properties")) { + foreach ($k in $resolved.properties.Keys) { + $properties[$k] = Get-SchemaTypeSummary -Doc $Doc -Schema $resolved.properties[$k] -Depth ($Depth + 1) -MaxDepth $MaxDepth + } + } + return @{ + type = "object" + properties = $properties + additionalProperties = if ($resolved.ContainsKey("additionalProperties")) { $resolved.additionalProperties } else { $false } + } + } + + if ($resolved.ContainsKey("type")) { return @{ type = [string]$resolved.type } } + return @{ type = "unknown" } +} + +function Get-JsonShapeSummary { + param([object]$Node, [int]$Depth = 0, [int]$MaxDepth = 6) + if ($Depth -ge $MaxDepth) { return @{ type = "max-depth-reached" } } + if ($null -eq $Node) { return @{ type = "null" } } + + if ($Node -is [System.Collections.IDictionary]) { + $props = @{} + foreach ($k in $Node.Keys) { + $props[[string]$k] = Get-JsonShapeSummary -Node $Node[$k] -Depth ($Depth + 1) -MaxDepth $MaxDepth + } + return @{ type = "object"; properties = $props } + } + + if ($Node -is [System.Collections.IEnumerable] -and $Node -isnot [string]) { + $items = @($Node) + if ($items.Count -eq 0) { return @{ type = "array"; items = @{ type = "unknown-empty" } } } + return @{ type = "array"; items = Get-JsonShapeSummary -Node $items[0] -Depth ($Depth + 1) -MaxDepth $MaxDepth } + } + + if ($Node -is [bool]) { return @{ type = "boolean" } } + if ($Node -is [int] -or $Node -is [long]) { return @{ type = "integer" } } + if ($Node -is [double] -or $Node -is [decimal] -or $Node -is [float]) { return @{ type = "number" } } + return @{ type = "string" } +} + +function Get-SampleQueryValue { + param([hashtable]$Param) + $name = [string]$Param.name + $schema = if ($Param.ContainsKey("schema")) { $Param.schema } else { $null } + + if ($name -eq "fields") { + if ($schema -is [hashtable] -and $schema.ContainsKey("items") -and $schema.items.ContainsKey("enum")) { + return (($schema.items.enum | ForEach-Object { [string]$_ }) -join ",") + } + return "id,name" + } + + if ($schema -is [hashtable] -and $schema.ContainsKey("enum") -and $schema.enum.Count -gt 0) { + return [string]$schema.enum[0] + } + + switch ($name) { + "limit" { "1" } + "offset" { "0" } + "status" { "approved" } + "site_ids" { "1" } + "currency" { "USD" } + "keyword" { "test" } + "since_id" { "1" } + "max_id" { "1" } + "created_at_min" { "2026-01-01T00:00:00Z" } + "created_at_max" { "2026-12-31T23:59:59Z" } + "start_time" { "2026-01-01T00:00:00Z" } + "end_time" { "2026-12-31T23:59:59Z" } + default { "sample" } + } +} + +function Build-QueryString { + param([object[]]$Parameters) + $parts = @() + foreach ($param in $Parameters) { + if ([string]$param.in -ne "query") { continue } + $required = [bool]($param.required) + $name = [string]$param.name + if (-not $required -and $name -notin @("limit", "offset", "fields", "status", "site_ids", "currency", "keyword", "since_id", "max_id", "created_at_min", "created_at_max", "start_time", "end_time")) { + continue + } + $value = Get-SampleQueryValue -Param $param + $parts += ([System.Uri]::EscapeDataString($name) + "=" + [System.Uri]::EscapeDataString($value)) + } + if ($parts.Count -eq 0) { return "" } + return "?" + ($parts -join "&") +} + +function Build-RequestBody { + param([hashtable]$Operation) + if (-not $Operation.ContainsKey("requestBody")) { return $null } + $content = $Operation.requestBody.content + if ($content -and $content.ContainsKey("application/x-www-form-urlencoded")) { + $form = @{ email = "invalid@example.com"; password = "invalid-password" } + return @{ Body = $form; ContentType = "application/x-www-form-urlencoded" } + } + return $null +} + +function Invoke-Probe { + param( + [string]$Method, + [string]$Url, + [hashtable]$Headers, + [hashtable]$RequestBody + ) + + $statusCode = -1 + $bodyText = "" + $contentType = "" + try { + if ($null -eq $RequestBody) { + $resp = Invoke-WebRequest -UseBasicParsing -Uri $Url -Method $Method -Headers $Headers -TimeoutSec 60 -ErrorAction Stop + } + else { + $resp = Invoke-WebRequest -UseBasicParsing -Uri $Url -Method $Method -Headers $Headers -Body $RequestBody.Body -ContentType $RequestBody.ContentType -TimeoutSec 60 -ErrorAction Stop + } + $statusCode = [int]$resp.StatusCode + $bodyText = [string]$resp.Content + $contentType = [string]$resp.Headers["Content-Type"] + } + catch { + if ($_.Exception.Response) { + $statusCode = [int]$_.Exception.Response.StatusCode.value__ + try { $contentType = [string]$_.Exception.Response.Headers["Content-Type"] } catch {} + } + if ($_.ErrorDetails -and $_.ErrorDetails.Message) { + $bodyText = [string]$_.ErrorDetails.Message + } + elseif ($_.Exception.Message) { + $bodyText = [string]$_.Exception.Message + } + } + + $actualShape = @{ type = "non-json" } + $isLogicalError = $false + $errorCode = $null + if (-not [string]::IsNullOrWhiteSpace($bodyText)) { + try { + $parsed = $bodyText | ConvertFrom-Json -AsHashtable -Depth 100 + $actualShape = Get-JsonShapeSummary -Node $parsed -Depth 0 -MaxDepth $MaxDepth + if ($parsed -is [System.Collections.IDictionary] -and $parsed.ContainsKey("error")) { + $isLogicalError = $true + if ($parsed.ContainsKey("code")) { $errorCode = [string]$parsed.code } + } + } + catch { + $actualShape = @{ type = "non-json" } + } + } + + return @{ + statusCode = $statusCode + contentType = $contentType + isLogicalError = $isLogicalError + errorCode = $errorCode + actualShape = $actualShape + bodyPreview = if ($bodyText.Length -gt 2500) { $bodyText.Substring(0, 2500) } else { $bodyText } + } +} + +$docs = @( + @{ Name = "user"; Path = "openapi/goaffpro-user.openapi.json"; Prefix = "/user" }, + @{ Name = "public"; Path = "openapi/goaffpro-public.openapi.json"; Prefix = "/public" } +) + +$results = @() +foreach ($docInfo in $docs) { + $doc = Get-Content -Raw $docInfo.Path | ConvertFrom-Json -AsHashtable -Depth 120 + foreach ($path in ($doc.paths.Keys | Sort-Object)) { + if (-not $path.StartsWith($docInfo.Prefix)) { continue } + $pathItem = $doc.paths[$path] + foreach ($method in @("get", "post", "put", "patch", "delete")) { + if (-not $pathItem.ContainsKey($method)) { continue } + $operation = $pathItem[$method] + $parameters = if ($operation.ContainsKey("parameters")) { @($operation.parameters) } else { @() } + $query = Build-QueryString -Parameters $parameters + $url = "https://api.goaffpro.com/v1$path$query" + $specShape = $null + if ($operation.responses -and $operation.responses["200"] -and $operation.responses["200"].content -and $operation.responses["200"].content["application/json"]) { + $specShape = Get-SchemaTypeSummary -Doc $doc -Schema $operation.responses["200"].content["application/json"].schema -Depth 0 -MaxDepth $MaxDepth + } + if ($null -eq $specShape) { $specShape = @{ type = "unknown" } } + $requestBody = Build-RequestBody -Operation $operation + + $scenarios = @() + if ($docInfo.Name -eq "user") { + $scenarios += @{ authMode = "auth"; headers = @{ Authorization = "Bearer $BearerToken" } } + $scenarios += @{ authMode = "no_auth"; headers = @{} } + } + else { + $scenarios += @{ authMode = "public"; headers = @{} } + } + + foreach ($scenario in $scenarios) { + $probe = Invoke-Probe -Method $method.ToUpperInvariant() -Url $url -Headers $scenario.headers -RequestBody $requestBody + $results += @{ + domain = $docInfo.Name + method = $method.ToUpperInvariant() + path = $path + summary = if ($operation.ContainsKey("summary")) { [string]$operation.summary } else { "" } + authMode = $scenario.authMode + requestParameters = $parameters + specShape = $specShape + probe = ($probe + @{ url = $url }) + } + } + } + } +} + +$results | ConvertTo-Json -Depth 100 | Set-Content -Encoding UTF8 $OutputPath +Write-Output "Wrote $OutputPath with $($results.Count) operation scenario records." diff --git a/scripts/probe-openapi-spec.ps1 b/scripts/probe-openapi-spec.ps1 new file mode 100644 index 0000000..0e3c1d1 --- /dev/null +++ b/scripts/probe-openapi-spec.ps1 @@ -0,0 +1,446 @@ +param( + [Parameter(Mandatory = $true)] + [string]$SpecPath, + [Parameter(Mandatory = $true)] + [string]$OutputPath, + [string]$BearerToken, + [string[]]$IncludePathPrefixes = @("/user", "/public"), + [int]$MaxDepth = 6, + [switch]$ProbeNoAuthForUser +) + +$ErrorActionPreference = "Stop" +$ProgressPreference = "SilentlyContinue" + +function Read-OpenApiSpecAsHashtable { + param([string]$Path) + + $ext = [System.IO.Path]::GetExtension($Path).ToLowerInvariant() + if ($ext -in @(".yaml", ".yml")) { + $tmpPath = [System.IO.Path]::GetTempFileName() + try { + $escapedInput = $Path.Replace("'", "''") + $escapedOutput = $tmpPath.Replace("'", "''") + $py = "import yaml,json,pathlib; p=pathlib.Path(r'$escapedInput'); data=yaml.safe_load(p.read_text(encoding='utf-8')); pathlib.Path(r'$escapedOutput').write_text(json.dumps(data), encoding='utf-8')" + python -c $py | Out-Null + return (Get-Content -Raw $tmpPath | ConvertFrom-Json -AsHashtable -Depth 120) + } + finally { + if (Test-Path $tmpPath) { Remove-Item $tmpPath -Force } + } + } + + return (Get-Content -Raw $Path | ConvertFrom-Json -AsHashtable -Depth 120) +} + +function Resolve-Schema { + param( + [hashtable]$Spec, + [object]$Schema + ) + + if ($null -eq $Schema) { + return $null + } + + if ($Schema -is [hashtable] -and $Schema.ContainsKey('$ref')) { + $ref = [string]$Schema['$ref'] + if ($ref.StartsWith("#/components/schemas/")) { + $name = $ref.Substring("#/components/schemas/".Length) + if ($Spec.components -and $Spec.components.schemas -and $Spec.components.schemas.ContainsKey($name)) { + return $Spec.components.schemas[$name] + } + } + } + + return $Schema +} + +function Get-SpecSchemaShape { + param( + [hashtable]$Spec, + [object]$Schema, + [int]$Depth = 0, + [int]$MaxDepth = 6 + ) + + if ($Depth -ge $MaxDepth) { + return @{ type = "max-depth-reached" } + } + + $resolved = Resolve-Schema -Spec $Spec -Schema $Schema + if ($null -eq $resolved -or $resolved -isnot [hashtable]) { + return @{ type = "unknown" } + } + + if ($resolved.ContainsKey("oneOf")) { + return @{ + type = "oneOf" + variants = @($resolved.oneOf | ForEach-Object { + Get-SpecSchemaShape -Spec $Spec -Schema $_ -Depth ($Depth + 1) -MaxDepth $MaxDepth + }) + } + } + + if ($resolved.ContainsKey("anyOf")) { + return @{ + type = "anyOf" + variants = @($resolved.anyOf | ForEach-Object { + Get-SpecSchemaShape -Spec $Spec -Schema $_ -Depth ($Depth + 1) -MaxDepth $MaxDepth + }) + } + } + + $schemaType = if ($resolved.ContainsKey("type")) { [string]$resolved.type } else { "" } + + if ($schemaType -eq "array") { + return @{ + type = "array" + items = Get-SpecSchemaShape -Spec $Spec -Schema $resolved.items -Depth ($Depth + 1) -MaxDepth $MaxDepth + } + } + + if ($schemaType -eq "object" -or $resolved.ContainsKey("properties")) { + $properties = @{} + if ($resolved.ContainsKey("properties")) { + foreach ($key in $resolved.properties.Keys) { + $properties[$key] = Get-SpecSchemaShape -Spec $Spec -Schema $resolved.properties[$key] -Depth ($Depth + 1) -MaxDepth $MaxDepth + } + } + + $additionalProperties = $false + if ($resolved.ContainsKey("additionalProperties")) { + $additionalProperties = $resolved.additionalProperties + } + + return @{ + type = "object" + properties = $properties + additionalProperties = $additionalProperties + } + } + + if (-not [string]::IsNullOrWhiteSpace($schemaType)) { + return @{ type = $schemaType } + } + + return @{ type = "unknown" } +} + +function Get-JsonShape { + param( + [object]$Node, + [int]$Depth = 0, + [int]$MaxDepth = 6 + ) + + if ($Depth -ge $MaxDepth) { + return @{ type = "max-depth-reached" } + } + + if ($null -eq $Node) { + return @{ type = "null" } + } + + if ($Node -is [System.Collections.IDictionary]) { + $properties = @{} + foreach ($key in $Node.Keys) { + $properties[[string]$key] = Get-JsonShape -Node $Node[$key] -Depth ($Depth + 1) -MaxDepth $MaxDepth + } + + return @{ + type = "object" + properties = $properties + } + } + + if ($Node -is [System.Collections.IEnumerable] -and $Node -isnot [string]) { + $items = @($Node) + if ($items.Count -eq 0) { + return @{ + type = "array" + items = @{ type = "unknown-empty" } + } + } + + return @{ + type = "array" + items = Get-JsonShape -Node $items[0] -Depth ($Depth + 1) -MaxDepth $MaxDepth + } + } + + if ($Node -is [bool]) { return @{ type = "boolean" } } + if ($Node -is [int] -or $Node -is [long]) { return @{ type = "integer" } } + if ($Node -is [double] -or $Node -is [decimal] -or $Node -is [float]) { return @{ type = "number" } } + return @{ type = "string" } +} + +function Get-SampleValueFromSchema { + param( + [hashtable]$Schema, + [string]$Name + ) + + if ($Schema -and $Schema.ContainsKey("enum") -and $Schema.enum.Count -gt 0) { + return [string]$Schema.enum[0] + } + + if ($Name -eq "fields") { + if ($Schema -and $Schema.ContainsKey("items") -and $Schema.items.ContainsKey("enum")) { + return (($Schema.items.enum | ForEach-Object { [string]$_ }) -join ",") + } + return "id,name" + } + + switch ($Name) { + "limit" { return "1" } + "offset" { return "0" } + "status" { return "approved" } + "site_ids" { return "1" } + "currency" { return "USD" } + "keyword" { return "test" } + "since_id" { return "1" } + "max_id" { return "1" } + "created_at_min" { return "2026-01-01T00:00:00Z" } + "created_at_max" { return "2026-12-31T23:59:59Z" } + "start_time" { return "2026-01-01T00:00:00Z" } + "end_time" { return "2026-12-31T23:59:59Z" } + "email" { return "invalid@example.com" } + "password" { return "invalid-password" } + default { + if ($Schema -and $Schema.ContainsKey("type")) { + switch ([string]$Schema.type) { + "integer" { return "1" } + "number" { return "1" } + "boolean" { return "true" } + default { return "sample" } + } + } + + return "sample" + } + } +} + +function Build-QueryString { + param( + [object[]]$Parameters + ) + + $parts = @() + foreach ($parameter in $Parameters) { + if (-not $parameter -or [string]$parameter.in -ne "query") { + continue + } + + $name = [string]$parameter.name + $required = [bool]($parameter.required) + + # Include required parameters and known useful optional filters. + if (-not $required -and $name -notin @("limit", "offset", "fields", "status", "site_ids", "currency", "keyword", "since_id", "max_id", "created_at_min", "created_at_max", "start_time", "end_time")) { + continue + } + + $schema = if ($parameter.schema -is [hashtable]) { $parameter.schema } else { @{} } + $value = Get-SampleValueFromSchema -Schema $schema -Name $name + $parts += ([System.Uri]::EscapeDataString($name) + "=" + [System.Uri]::EscapeDataString([string]$value)) + } + + if ($parts.Count -eq 0) { + return "" + } + + return "?" + ($parts -join "&") +} + +function Build-RequestBody { + param( + [hashtable]$Operation + ) + + if (-not $Operation.ContainsKey("requestBody")) { + return $null + } + + $requestBody = $Operation.requestBody + if (-not $requestBody -or -not $requestBody.ContainsKey("content")) { + return $null + } + + $content = $requestBody.content + if ($content.ContainsKey("application/x-www-form-urlencoded")) { + return @{ + Body = @{ + email = "invalid@example.com" + password = "invalid-password" + } + ContentType = "application/x-www-form-urlencoded" + } + } + + if ($content.ContainsKey("application/json")) { + $schema = $content["application/json"].schema + if ($schema -and $schema.ContainsKey("properties")) { + $obj = @{} + foreach ($propName in $schema.properties.Keys) { + $propSchema = if ($schema.properties[$propName] -is [hashtable]) { $schema.properties[$propName] } else { @{} } + $obj[$propName] = Get-SampleValueFromSchema -Schema $propSchema -Name $propName + } + + return @{ + Body = ($obj | ConvertTo-Json -Depth 20 -Compress) + ContentType = "application/json" + } + } + } + + return $null +} + +$spec = Read-OpenApiSpecAsHashtable -Path $SpecPath +$baseUrl = [string]$spec.servers[0].url +if (-not $baseUrl.EndsWith("/")) { + $baseUrl += "/" +} +$baseUrl = $baseUrl.TrimEnd("/") + +$records = @() + +foreach ($path in ($spec.paths.Keys | Sort-Object)) { + $include = $false + foreach ($prefix in $IncludePathPrefixes) { + if ($path.StartsWith($prefix)) { + $include = $true + break + } + } + + if (-not $include) { + continue + } + + $pathItem = $spec.paths[$path] + $pathParameters = @() + if ($pathItem.ContainsKey("parameters")) { + $pathParameters = @($pathItem.parameters) + } + + foreach ($method in @("get", "post", "put", "patch", "delete")) { + if (-not $pathItem.ContainsKey($method)) { + continue + } + + $operation = $pathItem[$method] + $operationParameters = @() + if ($operation.ContainsKey("parameters")) { + $operationParameters = @($operation.parameters) + } + + $allParameters = @($pathParameters + $operationParameters) + $pathWithValues = $path + foreach ($param in $allParameters) { + if ([string]$param.in -eq "path") { + $token = "{" + [string]$param.name + "}" + $pathWithValues = $pathWithValues.Replace($token, "1") + } + } + + $query = Build-QueryString -Parameters $allParameters + $url = "$baseUrl$pathWithValues$query" + + $requestBody = Build-RequestBody -Operation $operation + + $scenarios = @() + if ($path.StartsWith("/user")) { + if (-not [string]::IsNullOrWhiteSpace($BearerToken)) { + $scenarios += @{ authMode = "auth"; headers = @{ Authorization = "Bearer $BearerToken" } } + } + if ($ProbeNoAuthForUser.IsPresent) { + $scenarios += @{ authMode = "no_auth"; headers = @{} } + } + } + else { + $scenarios += @{ authMode = "public"; headers = @{} } + } + + foreach ($scenario in $scenarios) { + $statusCode = -1 + $responseText = "" + $contentType = "" + try { + if ($null -eq $requestBody) { + $response = Invoke-WebRequest -UseBasicParsing -Uri $url -Method $method.ToUpperInvariant() -Headers $scenario.headers -TimeoutSec 60 -ErrorAction Stop + } + else { + $response = Invoke-WebRequest -UseBasicParsing -Uri $url -Method $method.ToUpperInvariant() -Headers $scenario.headers -Body $requestBody.Body -ContentType $requestBody.ContentType -TimeoutSec 60 -ErrorAction Stop + } + + $statusCode = [int]$response.StatusCode + $responseText = [string]$response.Content + $contentType = [string]$response.Headers["Content-Type"] + } + catch { + if ($_.Exception.Response) { + $statusCode = [int]$_.Exception.Response.StatusCode.value__ + try { $contentType = [string]$_.Exception.Response.Headers["Content-Type"] } catch {} + } + + if ($_.ErrorDetails -and $_.ErrorDetails.Message) { + $responseText = [string]$_.ErrorDetails.Message + } + elseif ($_.Exception.Message) { + $responseText = [string]$_.Exception.Message + } + } + + $actualShape = @{ type = "non-json" } + $isLogicalError = $false + $errorCode = $null + if (-not [string]::IsNullOrWhiteSpace($responseText)) { + try { + $parsed = $responseText | ConvertFrom-Json -AsHashtable -Depth 100 + $actualShape = Get-JsonShape -Node $parsed -Depth 0 -MaxDepth $MaxDepth + if ($parsed -is [System.Collections.IDictionary] -and $parsed.ContainsKey("error")) { + $isLogicalError = $true + if ($parsed.ContainsKey("code")) { + $errorCode = [string]$parsed.code + } + } + } + catch { + $actualShape = @{ type = "non-json" } + } + } + + $responseSchema = $null + if ($operation.ContainsKey("responses") -and $operation.responses.ContainsKey("200")) { + $r200 = $operation.responses["200"] + if ($r200 -is [hashtable] -and $r200.ContainsKey("content") -and $r200.content.ContainsKey("application/json")) { + $media = $r200.content["application/json"] + if ($media -is [hashtable] -and $media.ContainsKey("schema")) { + $responseSchema = $media.schema + } + } + } + + $records += @{ + method = $method.ToUpperInvariant() + path = $path + summary = if ($operation.ContainsKey("summary")) { [string]$operation.summary } else { "" } + authMode = $scenario.authMode + url = $url + statusCode = $statusCode + contentType = $contentType + isLogicalError = $isLogicalError + errorCode = $errorCode + requestParameters = $allParameters + specResponseShape = Get-SpecSchemaShape -Spec $spec -Schema $responseSchema -Depth 0 -MaxDepth $MaxDepth + actualResponseShape = $actualShape + responsePreview = if ($responseText.Length -gt 4000) { $responseText.Substring(0, 4000) } else { $responseText } + } + } + } +} + +$records | ConvertTo-Json -Depth 100 | Set-Content -Encoding UTF8 $OutputPath +Write-Output "Wrote $OutputPath with $($records.Count) records from $SpecPath." diff --git a/src/GoAffPro.Client.Generator/GeneratorRunner.cs b/src/GoAffPro.Client.Generator/GeneratorRunner.cs index c7671cc..3e5129a 100644 --- a/src/GoAffPro.Client.Generator/GeneratorRunner.cs +++ b/src/GoAffPro.Client.Generator/GeneratorRunner.cs @@ -23,7 +23,8 @@ internal static class GeneratorRunner private const string PublicClientFileName = "GoAffProPublicClient.g.cs"; private const string HashFileName = "GoAffPro.Client.Generator.hash"; private const string LockFileName = "GoAffPro.Client.Generator.lock"; - private const string GeneratorCacheVersion = "3"; + private const string GeneratorCacheVersion = "4"; + private const string CanonicalSpecFileName = "goaffpro-canonical.json"; public static async Task RunAsync(GeneratorOptions options, CancellationToken cancellationToken) { @@ -43,13 +44,8 @@ public static async Task RunAsync(GeneratorOptions options, CancellationToken ca try { - (string swaggerUiInitContents, string swaggerSource) = - await LoadSwaggerUiInitContentsAsync(options, projectDirectory, cancellationToken).ConfigureAwait(false); - - string swaggerDocumentJson = SpecExtractor.ExtractSwaggerDocumentJson(swaggerUiInitContents); - JsonNode parsedNode = JsonNode.Parse(swaggerDocumentJson) - ?? throw new InvalidOperationException("Failed to parse swagger document JSON."); - JsonObject rootSpec = parsedNode.AsObject(); + (JsonObject rootSpec, string swaggerSource, bool requiresLegacyNormalization) = + await LoadRootSpecAsync(options, projectDirectory, cancellationToken).ConfigureAwait(false); JsonSerializerOptions writeIndented = new() { WriteIndented = true }; string normalizedRootJson = rootSpec.ToJsonString(writeIndented); @@ -73,8 +69,13 @@ await File.ReadAllTextAsync(hashPath, cancellationToken).ConfigureAwait(false), return; } - JsonObject userSpec = NormalizeSpec(FilterPaths(rootSpec, UserPathPrefix)); - JsonObject publicSpec = NormalizeSpec(FilterPaths(rootSpec, PublicPathPrefix)); + JsonObject userSpec = FilterPaths(rootSpec, UserPathPrefix); + JsonObject publicSpec = FilterPaths(rootSpec, PublicPathPrefix); + if (requiresLegacyNormalization) + { + userSpec = NormalizeSpec(userSpec); + publicSpec = NormalizeSpec(publicSpec); + } string userSpecJson = userSpec.ToJsonString(writeIndented); string publicSpecJson = publicSpec.ToJsonString(writeIndented); @@ -137,7 +138,7 @@ private static async Task AcquireGeneratorLockAsync(string lockFileP } } - private static async Task<(string Contents, string SourceReference)> LoadSwaggerUiInitContentsAsync( + private static async Task<(JsonObject RootSpec, string SourceReference, bool RequiresLegacyNormalization)> LoadRootSpecAsync( GeneratorOptions options, string projectDirectory, CancellationToken cancellationToken) @@ -147,19 +148,56 @@ private static async Task AcquireGeneratorLockAsync(string lockFileP string configuredPath = Path.GetFullPath(options.SwaggerInitPath); if (File.Exists(configuredPath)) { - return (await File.ReadAllTextAsync(configuredPath, cancellationToken).ConfigureAwait(false), configuredPath); + if (IsOpenApiSpecFile(configuredPath)) + { + JsonObject root = await LoadOpenApiSpecFileAsJsonObjectAsync(configuredPath, cancellationToken).ConfigureAwait(false); + return (root, configuredPath, false); + } + + string initContents = await File.ReadAllTextAsync(configuredPath, cancellationToken).ConfigureAwait(false); + return (ExtractRootSpecFromSwaggerUiInit(initContents), configuredPath, true); } } + string canonicalSpecPath = Path.GetFullPath(Path.Combine(projectDirectory, "..", "..", "openapi", CanonicalSpecFileName)); + if (File.Exists(canonicalSpecPath)) + { + JsonObject root = await LoadOpenApiSpecFileAsJsonObjectAsync(canonicalSpecPath, cancellationToken).ConfigureAwait(false); + return (root, canonicalSpecPath, false); + } + string defaultLocalPath = Path.GetFullPath(Path.Combine(projectDirectory, "..", "..", "openapi", "swagger-ui-init.js")); if (File.Exists(defaultLocalPath)) { - return (await File.ReadAllTextAsync(defaultLocalPath, cancellationToken).ConfigureAwait(false), defaultLocalPath); + string initContents = await File.ReadAllTextAsync(defaultLocalPath, cancellationToken).ConfigureAwait(false); + return (ExtractRootSpecFromSwaggerUiInit(initContents), defaultLocalPath, true); } using var client = new HttpClient(); string remoteContents = await client.GetStringAsync(options.SwaggerUrl, cancellationToken).ConfigureAwait(false); - return (remoteContents, options.SwaggerUrl.ToString()); + return (ExtractRootSpecFromSwaggerUiInit(remoteContents), options.SwaggerUrl.ToString(), true); + } + + private static bool IsOpenApiSpecFile(string path) + { + string extension = Path.GetExtension(path); + return extension.Equals(".json", StringComparison.OrdinalIgnoreCase); + } + + private static JsonObject ExtractRootSpecFromSwaggerUiInit(string initContents) + { + string swaggerDocumentJson = SpecExtractor.ExtractSwaggerDocumentJson(initContents); + JsonNode parsedNode = JsonNode.Parse(swaggerDocumentJson) + ?? throw new InvalidOperationException("Failed to parse swagger document JSON."); + return parsedNode.AsObject(); + } + + private static async Task LoadOpenApiSpecFileAsJsonObjectAsync(string specPath, CancellationToken cancellationToken) + { + OpenApiDocument document = await OpenApiDocument.FromFileAsync(specPath, cancellationToken).ConfigureAwait(false); + JsonNode parsedNode = JsonNode.Parse(document.ToJson()) + ?? throw new InvalidOperationException($"Failed to parse OpenAPI spec at '{specPath}'."); + return parsedNode.AsObject(); } private static JsonObject FilterPaths(JsonObject rootSpec, string pathPrefix) diff --git a/src/GoAffPro.Client.Generator/build/GoAffPro.Client.Generator.targets b/src/GoAffPro.Client.Generator/build/GoAffPro.Client.Generator.targets index 9c315a9..3cfc255 100644 --- a/src/GoAffPro.Client.Generator/build/GoAffPro.Client.Generator.targets +++ b/src/GoAffPro.Client.Generator/build/GoAffPro.Client.Generator.targets @@ -6,7 +6,7 @@ $([System.Guid]::NewGuid().ToString('N')) $(MSBuildProjectDirectory)\obj\$(Configuration)\$(TargetFramework)\GoAffProGeneratorTask\$(GoAffProGeneratorTaskNonce)\ $(GoAffProGeneratorTaskDirectory)GoAffPro.Client.Generator.dll - $(MSBuildProjectDirectory)\..\..\openapi\swagger-ui-init.js + $(MSBuildProjectDirectory)\..\..\openapi\goaffpro-canonical.json // This file was generated by GoAffPro.Client.Generator. -// Source: https://api.goaffpro.com/docs/admin/swagger-ui-init.js -// Generated: 2026-02-22T06:28:57.4664003+00:00 +// Source: C:\repos\GoAffPro.Client\openapi\goaffpro-canonical.json +// Generated: 2026-02-25T07:34:01.4747797+00:00 // Do not edit manually. // @@ -79,31 +79,23 @@ public string BaseUrl partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - /// - /// Public store/website/program data feed of the merchants enrolled in the marketplace program - /// - /// List of comma separated list of site_ids to restrict the data set to - /// List of comma separated currencies to restrict the data set to - /// Any search keyword to find stores in a particular niche - /// Limit number of results. Min:0, Max: 10000, Default: 10 - /// Offset from where to get the results + /// + /// Public marketplace sites + /// + /// Success /// A server side error occurred. - public virtual System.Threading.Tasks.Task PublicSitesAsync(string? site_ids, string? currency, string? keyword, int? limit, int? offset) + public virtual System.Threading.Tasks.Task PublicSitesAsync(string? site_ids, string? currency, string? keyword, int? limit, int? offset) { return PublicSitesAsync(site_ids, currency, keyword, limit, offset, System.Threading.CancellationToken.None); } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Public store/website/program data feed of the merchants enrolled in the marketplace program - /// - /// List of comma separated list of site_ids to restrict the data set to - /// List of comma separated currencies to restrict the data set to - /// Any search keyword to find stores in a particular niche - /// Limit number of results. Min:0, Max: 10000, Default: 10 - /// Offset from where to get the results + /// + /// Public marketplace sites + /// + /// Success /// A server side error occurred. - public virtual async System.Threading.Tasks.Task PublicSitesAsync(string? site_ids, string? currency, string? keyword, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task PublicSitesAsync(string? site_ids, string? currency, string? keyword, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) { var client_ = _httpClient; var disposeClient_ = false; @@ -166,7 +158,7 @@ public virtual async System.Threading.Tasks.Task PublicSitesAsync(stri var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new GoAffProPublicClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -174,6 +166,26 @@ public virtual async System.Threading.Tasks.Task PublicSitesAsync(stri return objectResponse_.Object; } else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GoAffProPublicClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new GoAffProPublicClientApiException("Upstream service error response in plain text.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 502) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GoAffProPublicClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new GoAffProPublicClientApiException("Upstream service error response in plain text.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new GoAffProPublicClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); @@ -193,27 +205,23 @@ public virtual async System.Threading.Tasks.Task PublicSitesAsync(stri } } - /// - /// Public product data feed of the merchants enrolled in the marketplace program - /// - /// Limit number of results. Min:0, Max: 10000, Default: 10 - /// Offset from where to get the results - /// List of comma separated list of site_ids to restrict the data set to + /// + /// Public marketplace products + /// + /// Success /// A server side error occurred. - public virtual System.Threading.Tasks.Task PublicProductsAsync(int? limit, int? offset, string? site_ids) + public virtual System.Threading.Tasks.Task PublicProductsAsync(int? limit, int? offset, string? site_ids) { return PublicProductsAsync(limit, offset, site_ids, System.Threading.CancellationToken.None); } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Public product data feed of the merchants enrolled in the marketplace program - /// - /// Limit number of results. Min:0, Max: 10000, Default: 10 - /// Offset from where to get the results - /// List of comma separated list of site_ids to restrict the data set to + /// + /// Public marketplace products + /// + /// Success /// A server side error occurred. - public virtual async System.Threading.Tasks.Task PublicProductsAsync(int? limit, int? offset, string? site_ids, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task PublicProductsAsync(int? limit, int? offset, string? site_ids, System.Threading.CancellationToken cancellationToken) { var client_ = _httpClient; var disposeClient_ = false; @@ -268,7 +276,7 @@ public virtual async System.Threading.Tasks.Task PublicProductsAsync( var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new GoAffProPublicClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -276,6 +284,26 @@ public virtual async System.Threading.Tasks.Task PublicProductsAsync( return objectResponse_.Object; } else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GoAffProPublicClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new GoAffProPublicClientApiException("Upstream service error response in plain text.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 502) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GoAffProPublicClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new GoAffProPublicClientApiException("Upstream service error response in plain text.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new GoAffProPublicClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); @@ -405,119 +433,49 @@ private string ConvertToString(object? value, System.Globalization.CultureInfo c } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Affiliate + public partial class LoginResponse { - /// - /// Affiliate id of the affiliate - /// - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int Id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("first_name")] - public string First_name { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("last_name")] - public string Last_name { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("facebook")] - public string Facebook { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("twitter")] - public string Twitter { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("instagram")] - public string Instagram { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("website")] - public string Website { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("access_token")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Access_token { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("ref_code")] - public string Ref_code { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("coupon")] - public string Coupon { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("phone")] - public string Phone { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("address_1")] - public string Address_1 { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("city")] - public string City { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("state")] - public string State { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("country")] - public string Country { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("zip_code")] - public string Zip_code { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("comments")] - public string Comments { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("personal_message")] - public string Personal_message { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("gender")] - public string Gender { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("honorific")] - public string Honorific { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("date_of_birth")] - public string Date_of_birth { get; set; } = default!; - - /// - /// The group the affiliate is part of. If the affiliate is not a part of any group, this field is empty - /// - - [System.Text.Json.Serialization.JsonPropertyName("group_id")] - public int Group_id { get; set; } = default!; - - /// - /// List of referral codes assigned to the affiliate - /// - - [System.Text.Json.Serialization.JsonPropertyName("ref_codes")] - public System.Collections.Generic.ICollection Ref_codes { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("coupons")] - public System.Collections.Generic.ICollection Coupons { get; set; } = default!; + private System.Collections.Generic.IDictionary? _additionalProperties; - /// - /// Tax Identification Number - /// + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } - [System.Text.Json.Serialization.JsonPropertyName("tin")] - public string Tin { get; set; } = default!; + } - [System.Text.Json.Serialization.JsonPropertyName("payment_method")] - public string Payment_method { get; set; } = default!; + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UserProfileEnvelope + { - [System.Text.Json.Serialization.JsonPropertyName("payment_details")] - public object Payment_details { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("user")] + [System.ComponentModel.DataAnnotations.Required] + public object User { get; set; } = new object(); - [System.Text.Json.Serialization.JsonPropertyName("extra_1")] - public string Extra_1 { get; set; } = default!; + private System.Collections.Generic.IDictionary? _additionalProperties; - [System.Text.Json.Serialization.JsonPropertyName("extra_2")] - public string Extra_2 { get; set; } = default!; + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } - [System.Text.Json.Serialization.JsonPropertyName("extra_3")] - public string Extra_3 { get; set; } = default!; + } - [System.Text.Json.Serialization.JsonPropertyName("registration_ip")] - public string Registration_ip { get; set; } = default!; + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UserProfileUpdateResponse + { - [System.Text.Json.Serialization.JsonPropertyName("commission")] - public Commission Commission { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("success")] + public int Success { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -531,27 +489,15 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Connections + public partial class UserSiteListResponse { - /// - /// Connection ID - /// - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int Id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("affiliate")] - public Affiliate2 Affiliate { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("customer")] - public Customer Customer { get; set; } = default!; - - /// - /// Date when this connection was created - /// + [System.Text.Json.Serialization.JsonPropertyName("sites")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Sites { get; set; } = new System.Collections.ObjectModel.Collection(); - [System.Text.Json.Serialization.JsonPropertyName("created_at")] - public string Created_at { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("count")] + public int Count { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -565,40 +511,38 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PaymentRequest + public partial class UserSite { - /// - /// Payment request ID - /// [System.Text.Json.Serialization.JsonPropertyName("id")] - public int Id { get; set; } = default!; + public string Id { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("affiliate_id")] - public int Affiliate_id { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } = default!; - /// - /// The amount requested by the affiliate - /// + [System.Text.Json.Serialization.JsonPropertyName("logo")] + public string Logo { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("amount")] - public int Amount { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("website")] + public string Website { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("note")] - public string Note { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("invoice")] - public Invoice Invoice { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("currency")] + public string Currency { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("status")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public PaymentRequestStatus Status { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("affiliate_portal")] + public string Affiliate_portal { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("created_at")] - public string Created_at { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("ref_code")] + public string Ref_code { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("referral_link")] + public string Referral_link { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("updated_at")] - public string Updated_at { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("coupon")] + public object Coupon { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -612,60 +556,44 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Order + public partial class UserStatsAggregateResponse { - /// - /// Order ID - /// - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int Id { get; set; } = default!; - /// - /// Order total as in order receipt - /// - - [System.Text.Json.Serialization.JsonPropertyName("total")] - public double Total { get; set; } = default!; - - /// - /// The amount on which commission is calculated - /// + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("subtotal")] - public double Subtotal { get; set; } = default!; + private System.Collections.Generic.IDictionary? _additionalProperties; - /// - /// ID of the affiliate who brought the order - /// + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } - [System.Text.Json.Serialization.JsonPropertyName("affiliate_id")] - public double Affiliate_id { get; set; } = default!; + } - /// - /// Commission given to affiliate for this order - /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UserStatsAggregateItem + { - [System.Text.Json.Serialization.JsonPropertyName("commission")] - public double Commission { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("site_id")] + public int Site_id { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("status")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public OrderStatus Status { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("total_sales")] + public double Total_sales { get; set; } = default!; - /// - /// RAW ORDER DATA. Only for advanced use cases - /// + [System.Text.Json.Serialization.JsonPropertyName("currency")] + public string Currency { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("data")] - public object Data { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("sale_commission_earned")] + public double Sale_commission_earned { get; set; } = default!; - /// - /// The date when order was created - /// + [System.Text.Json.Serialization.JsonPropertyName("revenue_generated")] + public double Revenue_generated { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("created")] - public string Created { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("commission_paid")] + public double Commission_paid { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -679,52 +607,41 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Rewards + public partial class CountLimitOffsetEnvelope { - /// - /// Order ID - /// - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int Id { get; set; } = default!; - - /// - /// ID of the affiliate who brought the order - /// - [System.Text.Json.Serialization.JsonPropertyName("affiliate_id")] - public double Affiliate_id { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("count")] + public int Count { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("type")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public RewardsType Type { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("limit")] + public int Limit { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("metadata")] - public string Metadata { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("offset")] + public int Offset { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("order_id")] - public double Order_id { get; set; } = default!; + private System.Collections.Generic.IDictionary? _additionalProperties; - [System.Text.Json.Serialization.JsonPropertyName("level")] - public double Level { get; set; } = default!; + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } - /// - /// Reward amount - /// + } - [System.Text.Json.Serialization.JsonPropertyName("amount")] - public int Amount { get; set; } = default!; + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class CountLimitOffsetEnvelopeFlexibleOffset + { - [System.Text.Json.Serialization.JsonPropertyName("status")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public RewardsStatus Status { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("count")] + public int Count { get; set; } = default!; - /// - /// The date when order was created - /// + [System.Text.Json.Serialization.JsonPropertyName("limit")] + public int Limit { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("created")] - public string Created { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("offset")] + public int Offset { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -738,110 +655,96 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class OrderInput + public partial class SinceIdEcho { - /// - /// Affiliate id of the affiliate - /// - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int Id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("first_name")] - public string First_name { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("last_name")] - public string Last_name { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("facebook")] - public string Facebook { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("since_id")] + public int Since_id { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("twitter")] - public string Twitter { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("instagram")] - public string Instagram { get; set; } = default!; + private System.Collections.Generic.IDictionary? _additionalProperties; - [System.Text.Json.Serialization.JsonPropertyName("website")] - public string Website { get; set; } = default!; + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } - [System.Text.Json.Serialization.JsonPropertyName("ref_code")] - public string Ref_code { get; set; } = default!; + } - [System.Text.Json.Serialization.JsonPropertyName("coupon")] - public string Coupon { get; set; } = default!; + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UserOrderFeedResponse : CountLimitOffsetEnvelope + { - [System.Text.Json.Serialization.JsonPropertyName("phone")] - public string Phone { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("orders")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Orders { get; set; } = new System.Collections.ObjectModel.Collection(); - [System.Text.Json.Serialization.JsonPropertyName("address_1")] - public string Address_1 { get; set; } = default!; + } - [System.Text.Json.Serialization.JsonPropertyName("city")] - public string City { get; set; } = default!; + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UserPayoutFeedResponse : CountLimitOffsetEnvelope + { - [System.Text.Json.Serialization.JsonPropertyName("state")] - public string State { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("since_id")] + public int Since_id { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("country")] - public string Country { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("payouts")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Payouts { get; set; } = new System.Collections.ObjectModel.Collection(); - [System.Text.Json.Serialization.JsonPropertyName("zip_code")] - public string Zip_code { get; set; } = default!; + } - [System.Text.Json.Serialization.JsonPropertyName("comments")] - public string Comments { get; set; } = default!; + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UserProductFeedResponse : CountLimitOffsetEnvelopeFlexibleOffset + { - [System.Text.Json.Serialization.JsonPropertyName("personal_message")] - public string Personal_message { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("products")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Products { get; set; } = new System.Collections.ObjectModel.Collection(); - /// - /// The group the affiliate is part of. If the affiliate is not a part of any group, this field is empty - /// + } - [System.Text.Json.Serialization.JsonPropertyName("group_id")] - public int Group_id { get; set; } = default!; + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UserRewardFeedResponse : CountLimitOffsetEnvelope + { - /// - /// List of referral codes assigned to the affiliate - /// + [System.Text.Json.Serialization.JsonPropertyName("rewards")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Rewards { get; set; } = new System.Collections.ObjectModel.Collection(); - [System.Text.Json.Serialization.JsonPropertyName("ref_codes")] - public System.Collections.Generic.ICollection Ref_codes { get; set; } = default!; + } - [System.Text.Json.Serialization.JsonPropertyName("coupons")] - public System.Collections.Generic.ICollection Coupons { get; set; } = default!; + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UserRewardFeedItem + { - /// - /// Tax Identification Number - /// + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string Id { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("tin")] - public string Tin { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("affiliate_id")] + public string Affiliate_id { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("payment_method")] - public string Payment_method { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("type")] + public string Type { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("payment_details")] - public object Payment_details { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("metadata")] + public string Metadata { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("extra_1")] - public string Extra_1 { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("order_id")] + public string Order_id { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("extra_2")] - public string Extra_2 { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("level")] + public int Level { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("extra_3")] - public string Extra_3 { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("amount")] + public double Amount { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("registration_ip")] - public string Registration_ip { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("commission")] - public Commission2 Commission { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("created")] + public string Created { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -855,20 +758,36 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Response + public partial class UserTrafficFeedResponse : CountLimitOffsetEnvelope { - [System.Text.Json.Serialization.JsonPropertyName("sites")] - public object Sites { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("since_id")] + public int Since_id { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("count")] - public int Count { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("traffic")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Traffic { get; set; } = new System.Collections.ObjectModel.Collection(); - [System.Text.Json.Serialization.JsonPropertyName("limit")] - public int Limit { get; set; } = default!; + } - [System.Text.Json.Serialization.JsonPropertyName("offset")] - public int Offset { get; set; } = default!; + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UserCommissionsResponse + { + + [System.Text.Json.Serialization.JsonPropertyName("standard")] + public object Standard { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("special")] + public System.Collections.Generic.ICollection Special { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("royalties")] + public System.Collections.Generic.ICollection Royalties { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("mlm")] + public object Mlm { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("commissions")] + public System.Collections.Generic.ICollection Commissions { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -882,11 +801,12 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Response2 + public partial class UserTransactionFeedResponse { - [System.Text.Json.Serialization.JsonPropertyName("products")] - public object Products { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("transactions")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Transactions { get; set; } = new System.Collections.ObjectModel.Collection(); [System.Text.Json.Serialization.JsonPropertyName("count")] public int Count { get; set; } = default!; @@ -909,59 +829,49 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Coupons + public partial class UserTransactionItem { - /// - /// Coupon code assigned to the affiliate - /// - [System.Text.Json.Serialization.JsonPropertyName("code")] - public string Code { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string Id { get; set; } = default!; - /// - /// Type of discount given by this coupon code - /// + [System.Text.Json.Serialization.JsonPropertyName("tx_id")] + public int Tx_id { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("discount_type")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public CouponsDiscount_type Discount_type { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("affiliate_id")] + public int Affiliate_id { get; set; } = default!; - /// - /// The amount of discount given - /// + [System.Text.Json.Serialization.JsonPropertyName("amount")] + public double Amount { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("discount_value")] - public double Discount_value { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("currency")] + public string Currency { get; set; } = default!; - private System.Collections.Generic.IDictionary? _additionalProperties; + [System.Text.Json.Serialization.JsonPropertyName("startingBalance")] + public double StartingBalance { get; set; } = default!; - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } + [System.Text.Json.Serialization.JsonPropertyName("endingBalance")] + public double EndingBalance { get; set; } = default!; - } + [System.Text.Json.Serialization.JsonPropertyName("created_at")] + public string Created_at { get; set; } = default!; - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Commission - { + [System.Text.Json.Serialization.JsonPropertyName("entity_type")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public UserTransactionItemEntity_type Entity_type { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("type")] + [System.Text.Json.Serialization.JsonPropertyName("event_type")] [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public CommissionType Type { get; set; } = default!; + public UserTransactionItemEvent_type Event_type { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("amount")] - public int Amount { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("entity_id")] + public string Entity_id { get; set; } = default!; - /// - /// The commission to be given on. Useful if you wish to give flat rate commission on the entire order instead of giving commission on a per product basis - /// + [System.Text.Json.Serialization.JsonPropertyName("is_paid")] + public bool Is_paid { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("on")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public CommissionOn On { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("metadata")] + public object Metadata { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -975,11 +885,12 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Affiliate2 + public partial class UserPendingPayoutsResponse { - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int Id { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("pending")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Pending { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -993,14 +904,20 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Customer + public partial class PendingPayoutItem { - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("affiliate_id")] + public int Affiliate_id { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("email")] - public string Email { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("amount")] + public double Amount { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("total_earned")] + public double Total_earned { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("total_paid")] + public double Total_paid { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -1014,14 +931,20 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Invoice + public partial class PendingPayoutBreakdown { - /// - /// URL to download the invoice - /// - [System.Text.Json.Serialization.JsonPropertyName("url")] - public string Url { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("sale_earnings")] + public double Sale_earnings { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("other_earnings")] + public double Other_earnings { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("paid_earnings")] + public double Paid_earnings { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("amount_pending")] + public double Amount_pending { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -1035,89 +958,91 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum PaymentRequestStatus + public partial class PublicSitesResponse : CountLimitOffsetEnvelopeFlexibleOffset { - [System.Runtime.Serialization.EnumMember(Value = @"in_progress")] - In_progress = 0, + [System.Text.Json.Serialization.JsonPropertyName("stores")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Stores { get; set; } = new System.Collections.ObjectModel.Collection(); - [System.Runtime.Serialization.EnumMember(Value = @"paid")] - Paid = 1, + [System.Text.Json.Serialization.JsonPropertyName("currency")] + public string Currency { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"rejected")] - Rejected = 2, + [System.Text.Json.Serialization.JsonPropertyName("keyword")] + public string Keyword { get; set; } = default!; } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum OrderStatus + public partial class PublicStore { - [System.Runtime.Serialization.EnumMember(Value = @"approved")] - Approved = 0, + [System.Text.Json.Serialization.JsonPropertyName("id")] + public int Id { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"rejected")] - Rejected = 1, + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } = default!; - } + [System.Text.Json.Serialization.JsonPropertyName("website")] + public string Website { get; set; } = default!; - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum RewardsType - { + [System.Text.Json.Serialization.JsonPropertyName("logo")] + public string Logo { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("currency")] + public string Currency { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("affiliatePortal")] + public string AffiliatePortal { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"signup_bonus")] - Signup_bonus = 0, + [System.Text.Json.Serialization.JsonPropertyName("cookieDuration")] + public int CookieDuration { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"sale_commission")] - Sale_commission = 1, + [System.Text.Json.Serialization.JsonPropertyName("areRegistrationsOpen")] + public int AreRegistrationsOpen { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"target_bonus")] - Target_bonus = 2, + [System.Text.Json.Serialization.JsonPropertyName("isApprovedAutomatically")] + public int IsApprovedAutomatically { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"wallet_adjustment")] - Wallet_adjustment = 3, + [System.Text.Json.Serialization.JsonPropertyName("commission")] + public CommissionLike Commission { get; set; } = default!; + + private System.Collections.Generic.IDictionary? _additionalProperties; - [System.Runtime.Serialization.EnumMember(Value = @"recruitment_bonus")] - Recruitment_bonus = 4, + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum RewardsStatus + public partial class PublicProductsResponse : CountLimitOffsetEnvelopeFlexibleOffset { - [System.Runtime.Serialization.EnumMember(Value = @"approved")] - Approved = 0, + [System.Text.Json.Serialization.JsonPropertyName("products")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Products { get; set; } = new System.Collections.ObjectModel.Collection(); - [System.Runtime.Serialization.EnumMember(Value = @"rejected")] - Rejected = 1, + [System.Text.Json.Serialization.JsonPropertyName("site_ids")] + public string Site_ids { get; set; } = default!; } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class coupons + public partial class CommissionLike { - /// - /// Coupon code assigned to the affiliate - /// - [System.Text.Json.Serialization.JsonPropertyName("code")] - public string Code { get; set; } = default!; - - /// - /// Type of discount given by this coupon code - /// - - [System.Text.Json.Serialization.JsonPropertyName("discount_type")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public couponsDiscount_type Discount_type { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("type")] + public string Type { get; set; } = default!; - /// - /// The amount of discount given - /// + [System.Text.Json.Serialization.JsonPropertyName("amount")] + public double Amount { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("discount_value")] - public double Discount_value { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("true")] + public string True { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -1131,23 +1056,15 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Commission2 + public partial class ErrorResponse { - [System.Text.Json.Serialization.JsonPropertyName("type")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public Commission2Type Type { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("amount")] - public int Amount { get; set; } = default!; - - /// - /// The commission to be given on. Useful if you wish to give flat rate commission on the entire order instead of giving commission on a per product basis - /// + [System.Text.Json.Serialization.JsonPropertyName("error")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Error { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("on")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public Commission2On On { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("code")] + public int Code { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -1161,80 +1078,41 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum CouponsDiscount_type + public enum UserTransactionItemEntity_type { - [System.Runtime.Serialization.EnumMember(Value = @"percentage")] - Percentage = 0, + [System.Runtime.Serialization.EnumMember(Value = @"orders")] + Orders = 0, - [System.Runtime.Serialization.EnumMember(Value = @"fixed_amount")] - Fixed_amount = 1, + [System.Runtime.Serialization.EnumMember(Value = @"rewards")] + Rewards = 1, - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum CommissionType - { + [System.Runtime.Serialization.EnumMember(Value = @"payouts")] + Payouts = 2, - [System.Runtime.Serialization.EnumMember(Value = @"percentage")] - Percentage = 0, + [System.Runtime.Serialization.EnumMember(Value = @"ORDERS")] + ORDERS = 3, - [System.Runtime.Serialization.EnumMember(Value = @"fixed_amount")] - Fixed_amount = 1, + [System.Runtime.Serialization.EnumMember(Value = @"REWARDS")] + REWARDS = 4, - [System.Runtime.Serialization.EnumMember(Value = @"fixed_amount_on_order")] - Fixed_amount_on_order = 2, + [System.Runtime.Serialization.EnumMember(Value = @"PAYOUTS")] + PAYOUTS = 5, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum CommissionOn + public enum UserTransactionItemEvent_type { - [System.Runtime.Serialization.EnumMember(Value = @"product")] - Product = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"order")] - Order = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum couponsDiscount_type - { - - [System.Runtime.Serialization.EnumMember(Value = @"percentage")] - Percentage = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"fixed_amount")] - Fixed_amount = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum Commission2Type - { - - [System.Runtime.Serialization.EnumMember(Value = @"percentage")] - Percentage = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"fixed_amount")] - Fixed_amount = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"fixed_amount_on_order")] - Fixed_amount_on_order = 2, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum Commission2On - { + [System.Runtime.Serialization.EnumMember(Value = @"insert")] + Insert = 0, - [System.Runtime.Serialization.EnumMember(Value = @"product")] - Product = 0, + [System.Runtime.Serialization.EnumMember(Value = @"update")] + Update = 1, - [System.Runtime.Serialization.EnumMember(Value = @"order")] - Order = 1, + [System.Runtime.Serialization.EnumMember(Value = @"delete")] + Delete = 2, } diff --git a/src/GoAffPro.Client/Generated/GoAffProUserClient.g.cs b/src/GoAffPro.Client/Generated/GoAffProUserClient.g.cs index ad2ff0e..e909fb4 100644 --- a/src/GoAffPro.Client/Generated/GoAffProUserClient.g.cs +++ b/src/GoAffPro.Client/Generated/GoAffProUserClient.g.cs @@ -1,7 +1,7 @@ // // This file was generated by GoAffPro.Client.Generator. -// Source: https://api.goaffpro.com/docs/admin/swagger-ui-init.js -// Generated: 2026-02-22T06:28:57.4652898+00:00 +// Source: C:\repos\GoAffPro.Client\openapi\goaffpro-canonical.json +// Generated: 2026-02-25T07:34:01.4737048+00:00 // Do not edit manually. // @@ -82,11 +82,9 @@ public string BaseUrl /// /// Log in to get the access token /// - /// - /// Login to your affiliate account with your email address and password to retrieve your access token. You can use this access token to query data regarding your affiliate account - /// + /// Success /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserLoginAsync(Body? body) + public virtual System.Threading.Tasks.Task UserLoginAsync(Body body) { return UserLoginAsync(body, System.Threading.CancellationToken.None); } @@ -95,12 +93,13 @@ public virtual System.Threading.Tasks.Task UserLoginAsync(Body? body) /// /// Log in to get the access token /// - /// - /// Login to your affiliate account with your email address and password to retrieve your access token. You can use this access token to query data regarding your affiliate account - /// + /// Success /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserLoginAsync(Body? body, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task UserLoginAsync(Body body, System.Threading.CancellationToken cancellationToken) { + if (body == null) + throw new System.ArgumentNullException("body"); + var client_ = _httpClient; var disposeClient_ = false; try @@ -145,7 +144,7 @@ public virtual async System.Threading.Tasks.Task UserLoginAsync(Body? var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -175,12 +174,9 @@ public virtual async System.Threading.Tasks.Task UserLoginAsync(Body? /// /// List of stores the user is enrolled in /// - /// Limit number of results - /// Offset from where to get the results - /// Filters stores by status - /// Comma separated list of fields to return + /// Success /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserSitesAsync(int? limit, int? offset, Status? status, System.Collections.Generic.IEnumerable fields) + public virtual System.Threading.Tasks.Task UserSitesAsync(int? limit, int? offset, Status? status, System.Collections.Generic.IEnumerable fields) { return UserSitesAsync(limit, offset, status, fields, System.Threading.CancellationToken.None); } @@ -189,12 +185,9 @@ public virtual System.Threading.Tasks.Task UserSitesAsync(int? limit, /// /// List of stores the user is enrolled in /// - /// Limit number of results - /// Offset from where to get the results - /// Filters stores by status - /// Comma separated list of fields to return + /// Success /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserSitesAsync(int? limit, int? offset, Status? status, System.Collections.Generic.IEnumerable fields, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task UserSitesAsync(int? limit, int? offset, Status? status, System.Collections.Generic.IEnumerable fields, System.Threading.CancellationToken cancellationToken) { if (fields == null) throw new System.ArgumentNullException("fields"); @@ -253,7 +246,7 @@ public virtual async System.Threading.Tasks.Task UserSitesAsync(int? var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -261,6 +254,16 @@ public virtual async System.Threading.Tasks.Task UserSitesAsync(int? return objectResponse_.Object; } else + if (status_ == 403) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); @@ -285,7 +288,7 @@ public virtual async System.Threading.Tasks.Task UserSitesAsync(int? /// /// Success /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserGetAsync() + public virtual System.Threading.Tasks.Task UserGetAsync() { return UserGetAsync(System.Threading.CancellationToken.None); } @@ -296,7 +299,7 @@ public virtual System.Threading.Tasks.Task UserGetAsync() /// /// Success /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserGetAsync(System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task UserGetAsync(System.Threading.CancellationToken cancellationToken) { var client_ = _httpClient; var disposeClient_ = false; @@ -337,7 +340,7 @@ public virtual async System.Threading.Tasks.Task UserGetAsync(System.Thr var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -345,6 +348,16 @@ public virtual async System.Threading.Tasks.Task UserGetAsync(System.Thr return objectResponse_.Object; } else + if (status_ == 403) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); @@ -367,8 +380,9 @@ public virtual async System.Threading.Tasks.Task UserGetAsync(System.Thr /// /// Update your profile /// + /// Success /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserPostAsync() + public virtual System.Threading.Tasks.Task UserPostAsync() { return UserPostAsync(System.Threading.CancellationToken.None); } @@ -377,8 +391,9 @@ public virtual System.Threading.Tasks.Task UserPostAsync() /// /// Update your profile /// + /// Success /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserPostAsync(System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task UserPostAsync(System.Threading.CancellationToken cancellationToken) { var client_ = _httpClient; var disposeClient_ = false; @@ -420,7 +435,7 @@ public virtual async System.Threading.Tasks.Task UserPostAsync(System var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -430,12 +445,12 @@ public virtual async System.Threading.Tasks.Task UserPostAsync(System else if (status_ == 403) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } - throw new GoAffProUserClientApiException("Not authenticated", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { @@ -460,12 +475,9 @@ public virtual async System.Threading.Tasks.Task UserPostAsync(System /// /// Aggregates of user stats /// - /// Comma separated list of sites for which to return result for - /// Start date from where to aggregate results - /// End date up until where to aggregate results - /// Comma separated list of fields to return + /// Success /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserStatsAggregateAsync(object? site_ids, object? start_time, object? end_time, System.Collections.Generic.IEnumerable fields) + public virtual System.Threading.Tasks.Task UserStatsAggregateAsync(string? site_ids, string? start_time, string? end_time, System.Collections.Generic.IEnumerable fields) { return UserStatsAggregateAsync(site_ids, start_time, end_time, fields, System.Threading.CancellationToken.None); } @@ -474,12 +486,9 @@ public virtual System.Threading.Tasks.Task UserStatsAggregateAsync(ob /// /// Aggregates of user stats /// - /// Comma separated list of sites for which to return result for - /// Start date from where to aggregate results - /// End date up until where to aggregate results - /// Comma separated list of fields to return + /// Success /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserStatsAggregateAsync(object? site_ids, object? start_time, object? end_time, System.Collections.Generic.IEnumerable fields, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task UserStatsAggregateAsync(string? site_ids, string? start_time, string? end_time, System.Collections.Generic.IEnumerable fields, System.Threading.CancellationToken cancellationToken) { if (fields == null) throw new System.ArgumentNullException("fields"); @@ -538,7 +547,7 @@ public virtual async System.Threading.Tasks.Task UserStatsAggregateAs var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -546,6 +555,16 @@ public virtual async System.Threading.Tasks.Task UserStatsAggregateAs return objectResponse_.Object; } else + if (status_ == 403) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); @@ -568,16 +587,9 @@ public virtual async System.Threading.Tasks.Task UserStatsAggregateAs /// /// Feed of user orders /// - /// Comma separated list of sites for which to return result for - /// Show orders after this order id - /// Show orders before this order id - /// Show orders older than this date - /// Show orders newer than this date - /// Comma separated list of fields to return. - /// Limit number of results - /// Offset from where to get the results + /// Success /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserFeedOrdersAsync(object? site_ids, object? since_id, object? max_id, object? created_at_max, object? created_at_min, System.Collections.Generic.IEnumerable fields, int? limit, int? offset) + public virtual System.Threading.Tasks.Task UserFeedOrdersAsync(string? site_ids, string? since_id, string? max_id, string? created_at_max, string? created_at_min, System.Collections.Generic.IEnumerable fields, int? limit, int? offset) { return UserFeedOrdersAsync(site_ids, since_id, max_id, created_at_max, created_at_min, fields, limit, offset, System.Threading.CancellationToken.None); } @@ -586,16 +598,9 @@ public virtual System.Threading.Tasks.Task UserFeedOrdersAsync(object /// /// Feed of user orders /// - /// Comma separated list of sites for which to return result for - /// Show orders after this order id - /// Show orders before this order id - /// Show orders older than this date - /// Show orders newer than this date - /// Comma separated list of fields to return. - /// Limit number of results - /// Offset from where to get the results + /// Success /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserFeedOrdersAsync(object? site_ids, object? since_id, object? max_id, object? created_at_max, object? created_at_min, System.Collections.Generic.IEnumerable fields, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task UserFeedOrdersAsync(string? site_ids, string? since_id, string? max_id, string? created_at_max, string? created_at_min, System.Collections.Generic.IEnumerable fields, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) { if (fields == null) throw new System.ArgumentNullException("fields"); @@ -670,7 +675,7 @@ public virtual async System.Threading.Tasks.Task UserFeedOrdersAsync( var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -678,6 +683,16 @@ public virtual async System.Threading.Tasks.Task UserFeedOrdersAsync( return objectResponse_.Object; } else + if (status_ == 403) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); @@ -700,15 +715,9 @@ public virtual async System.Threading.Tasks.Task UserFeedOrdersAsync( /// /// Feed of user payouts /// - /// Comma separated list of sites for which to return result for - /// Start date from where to aggregate results - /// End date up until where to aggregate results - /// Returns result after this ID - /// Limit number of results - /// Offset from where to get the results /// Success /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserFeedPayoutsAsync(object? site_ids, object? start_time, object? end_time, int? since_id, int? limit, int? offset) + public virtual System.Threading.Tasks.Task UserFeedPayoutsAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset) { return UserFeedPayoutsAsync(site_ids, start_time, end_time, since_id, limit, offset, System.Threading.CancellationToken.None); } @@ -717,15 +726,9 @@ public virtual System.Threading.Tasks.Task UserFeedPayoutsAsync(object? /// /// Feed of user payouts /// - /// Comma separated list of sites for which to return result for - /// Start date from where to aggregate results - /// End date up until where to aggregate results - /// Returns result after this ID - /// Limit number of results - /// Offset from where to get the results /// Success /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserFeedPayoutsAsync(object? site_ids, object? start_time, object? end_time, int? since_id, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task UserFeedPayoutsAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) { var client_ = _httpClient; var disposeClient_ = false; @@ -792,7 +795,7 @@ public virtual async System.Threading.Tasks.Task UserFeedPayoutsAsync(ob var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -800,6 +803,16 @@ public virtual async System.Threading.Tasks.Task UserFeedPayoutsAsync(ob return objectResponse_.Object; } else + if (status_ == 403) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); @@ -820,26 +833,22 @@ public virtual async System.Threading.Tasks.Task UserFeedPayoutsAsync(ob } /// - /// Feed of products available for promotion. It can take upto 24 hours for the feed of newly enrolled stores to become available to the affiliate + /// Feed of products available for promotion /// - /// Limit number of results - /// Offset from where to get the results /// Success /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserFeedProductsAsync(int? limit, int? offset) + public virtual System.Threading.Tasks.Task UserFeedProductsAsync(int? limit, int? offset) { return UserFeedProductsAsync(limit, offset, System.Threading.CancellationToken.None); } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// - /// Feed of products available for promotion. It can take upto 24 hours for the feed of newly enrolled stores to become available to the affiliate + /// Feed of products available for promotion /// - /// Limit number of results - /// Offset from where to get the results /// Success /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserFeedProductsAsync(int? limit, int? offset, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task UserFeedProductsAsync(int? limit, int? offset, System.Threading.CancellationToken cancellationToken) { var client_ = _httpClient; var disposeClient_ = false; @@ -890,7 +899,7 @@ public virtual async System.Threading.Tasks.Task UserFeedProductsAsync(i var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -898,6 +907,26 @@ public virtual async System.Threading.Tasks.Task UserFeedProductsAsync(i return objectResponse_.Object; } else + if (status_ == 403) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 502) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new GoAffProUserClientApiException("Upstream service error response in plain text.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); @@ -920,15 +949,9 @@ public virtual async System.Threading.Tasks.Task UserFeedProductsAsync(i /// /// Feed of user rewards /// - /// Comma separated list of sites for which to return result for - /// Start date from where to aggregate results - /// End date up until where to aggregate results - /// Returns result after this ID - /// Limit number of results - /// Offset from where to get the results /// Success /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserFeedRewardsAsync(object? site_ids, object? start_time, object? end_time, int? since_id, int? limit, int? offset) + public virtual System.Threading.Tasks.Task UserFeedRewardsAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset) { return UserFeedRewardsAsync(site_ids, start_time, end_time, since_id, limit, offset, System.Threading.CancellationToken.None); } @@ -937,15 +960,9 @@ public virtual System.Threading.Tasks.Task UserFeedRewardsAsync(objec /// /// Feed of user rewards /// - /// Comma separated list of sites for which to return result for - /// Start date from where to aggregate results - /// End date up until where to aggregate results - /// Returns result after this ID - /// Limit number of results - /// Offset from where to get the results /// Success /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserFeedRewardsAsync(object? site_ids, object? start_time, object? end_time, int? since_id, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task UserFeedRewardsAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) { var client_ = _httpClient; var disposeClient_ = false; @@ -1012,7 +1029,7 @@ public virtual async System.Threading.Tasks.Task UserFeedRewardsAsync var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -1020,6 +1037,16 @@ public virtual async System.Threading.Tasks.Task UserFeedRewardsAsync return objectResponse_.Object; } else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new GoAffProUserClientApiException("Upstream service error response in plain text.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); @@ -1042,14 +1069,9 @@ public virtual async System.Threading.Tasks.Task UserFeedRewardsAsync /// /// Feed of user traffic /// - /// Comma separated list of sites for which to return result for - /// Start date from where to aggregate results - /// End date up until where to aggregate results - /// Returns result after this ID - /// Limit number of results - /// Offset from where to get the results + /// Success /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserFeedTrafficAsync(object? site_ids, object? start_time, object? end_time, int? since_id, int? limit, int? offset) + public virtual System.Threading.Tasks.Task UserFeedTrafficAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset) { return UserFeedTrafficAsync(site_ids, start_time, end_time, since_id, limit, offset, System.Threading.CancellationToken.None); } @@ -1058,14 +1080,9 @@ public virtual System.Threading.Tasks.Task UserFeedTrafficAsync(objec /// /// Feed of user traffic /// - /// Comma separated list of sites for which to return result for - /// Start date from where to aggregate results - /// End date up until where to aggregate results - /// Returns result after this ID - /// Limit number of results - /// Offset from where to get the results + /// Success /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserFeedTrafficAsync(object? site_ids, object? start_time, object? end_time, int? since_id, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task UserFeedTrafficAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) { var client_ = _httpClient; var disposeClient_ = false; @@ -1132,7 +1149,7 @@ public virtual async System.Threading.Tasks.Task UserFeedTrafficAsync var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -1140,6 +1157,16 @@ public virtual async System.Threading.Tasks.Task UserFeedTrafficAsync return objectResponse_.Object; } else + if (status_ == 403) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); @@ -1160,22 +1187,22 @@ public virtual async System.Threading.Tasks.Task UserFeedTrafficAsync } /// - /// Get commission structure + /// Feed of user transactions /// - /// Comma separated list of sites for which to return result for + /// Success /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserCommissionsAsync(object? site_ids) + public virtual System.Threading.Tasks.Task UserFeedTransactionsAsync(int? limit, int? offset) { - return UserCommissionsAsync(site_ids, System.Threading.CancellationToken.None); + return UserFeedTransactionsAsync(limit, offset, System.Threading.CancellationToken.None); } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// - /// Get commission structure + /// Feed of user transactions /// - /// Comma separated list of sites for which to return result for + /// Success /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserCommissionsAsync(object? site_ids, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task UserFeedTransactionsAsync(int? limit, int? offset, System.Threading.CancellationToken cancellationToken) { var client_ = _httpClient; var disposeClient_ = false; @@ -1188,12 +1215,16 @@ public virtual async System.Threading.Tasks.Task UserCommissionsAsync var urlBuilder_ = new System.Text.StringBuilder(); if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); - // Operation Path: "user/commissions" - urlBuilder_.Append("user/commissions"); + // Operation Path: "user/feed/transactions" + urlBuilder_.Append("user/feed/transactions"); urlBuilder_.Append('?'); - if (site_ids != null) + if (limit != null) { - urlBuilder_.Append(System.Uri.EscapeDataString("site_ids")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(site_ids, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (offset != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); } urlBuilder_.Length--; @@ -1222,7 +1253,7 @@ public virtual async System.Threading.Tasks.Task UserCommissionsAsync var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -1230,6 +1261,26 @@ public virtual async System.Threading.Tasks.Task UserCommissionsAsync return objectResponse_.Object; } else + if (status_ == 403) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new GoAffProUserClientApiException("Upstream service error response in plain text.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); @@ -1249,553 +1300,316 @@ public virtual async System.Threading.Tasks.Task UserCommissionsAsync } } - protected struct ObjectResponseResult + /// + /// Get commission structure + /// + /// Success + /// A server side error occurred. + public virtual System.Threading.Tasks.Task UserCommissionsAsync(string? site_ids) { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } + return UserCommissionsAsync(site_ids, System.Threading.CancellationToken.None); } - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get commission structure + /// + /// Success + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task UserCommissionsAsync(string? site_ids, System.Threading.CancellationToken cancellationToken) { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T)!, string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody!, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new GoAffProUserClientApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else + var client_ = _httpClient; + var disposeClient_ = false; + try { - try + using (var request_ = new System.Net.Http.HttpRequestMessage()) { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "user/commissions" + urlBuilder_.Append("user/commissions"); + urlBuilder_.Append('?'); + if (site_ids != null) { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody!, string.Empty); + urlBuilder_.Append(System.Uri.EscapeDataString("site_ids")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(site_ids, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new GoAffProUserClientApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } + urlBuilder_.Length--; - private string ConvertToString(object? value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } + PrepareRequest(client_, request_, urlBuilder_); - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) { - return attribute.Value != null ? attribute.Value : name; + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; } - } - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 403) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } } } - else if (value is bool) + finally { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + if (disposeClient_) + client_.Dispose(); } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; } - } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Affiliate - { /// - /// Affiliate id of the affiliate + /// Get pending payout amount (and its breakdown) /// - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int Id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("first_name")] - public string First_name { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("last_name")] - public string Last_name { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("facebook")] - public string Facebook { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("twitter")] - public string Twitter { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("instagram")] - public string Instagram { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("website")] - public string Website { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("ref_code")] - public string Ref_code { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("coupon")] - public string Coupon { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("phone")] - public string Phone { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("address_1")] - public string Address_1 { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("city")] - public string City { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("state")] - public string State { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("country")] - public string Country { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("zip_code")] - public string Zip_code { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("comments")] - public string Comments { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("personal_message")] - public string Personal_message { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("gender")] - public string Gender { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("honorific")] - public string Honorific { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("date_of_birth")] - public string Date_of_birth { get; set; } = default!; - - /// - /// The group the affiliate is part of. If the affiliate is not a part of any group, this field is empty - /// - - [System.Text.Json.Serialization.JsonPropertyName("group_id")] - public int Group_id { get; set; } = default!; - - /// - /// List of referral codes assigned to the affiliate - /// - - [System.Text.Json.Serialization.JsonPropertyName("ref_codes")] - public System.Collections.Generic.ICollection Ref_codes { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("coupons")] - public System.Collections.Generic.ICollection Coupons { get; set; } = default!; - - /// - /// Tax Identification Number - /// - - [System.Text.Json.Serialization.JsonPropertyName("tin")] - public string Tin { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("payment_method")] - public string Payment_method { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("payment_details")] - public object Payment_details { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("extra_1")] - public string Extra_1 { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("extra_2")] - public string Extra_2 { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("extra_3")] - public string Extra_3 { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("registration_ip")] - public string Registration_ip { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("commission")] - public Commission Commission { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties + /// Success + /// A server side error occurred. + public virtual System.Threading.Tasks.Task UserPayoutsPendingAsync() { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } + return UserPayoutsPendingAsync(System.Threading.CancellationToken.None); } - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Connections - { - /// - /// Connection ID - /// - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int Id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("affiliate")] - public Affiliate2 Affiliate { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("customer")] - public Customer Customer { get; set; } = default!; - + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// - /// Date when this connection was created + /// Get pending payout amount (and its breakdown) /// - - [System.Text.Json.Serialization.JsonPropertyName("created_at")] - public string Created_at { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties + /// Success + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task UserPayoutsPendingAsync(System.Threading.CancellationToken cancellationToken) { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PaymentRequest - { - /// - /// Payment request ID - /// - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int Id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("affiliate_id")] - public int Affiliate_id { get; set; } = default!; - - /// - /// The amount requested by the affiliate - /// - - [System.Text.Json.Serialization.JsonPropertyName("amount")] - public int Amount { get; set; } = default!; + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - [System.Text.Json.Serialization.JsonPropertyName("note")] - public string Note { get; set; } = default!; + var urlBuilder_ = new System.Text.StringBuilder(); + if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); + // Operation Path: "user/payouts/pending" + urlBuilder_.Append("user/payouts/pending"); - [System.Text.Json.Serialization.JsonPropertyName("invoice")] - public Invoice Invoice { get; set; } = default!; + PrepareRequest(client_, request_, urlBuilder_); - [System.Text.Json.Serialization.JsonPropertyName("status")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public PaymentRequestStatus Status { get; set; } = default!; + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - [System.Text.Json.Serialization.JsonPropertyName("created_at")] - public string Created_at { get; set; } = default!; + PrepareRequest(client_, request_, url_); - [System.Text.Json.Serialization.JsonPropertyName("updated_at")] - public string Updated_at { get; set; } = default!; + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } - private System.Collections.Generic.IDictionary? _additionalProperties; + ProcessResponse(client_, response_); - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 403) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } } - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Order - { - /// - /// Order ID - /// - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int Id { get; set; } = default!; - - /// - /// Order total as in order receipt - /// - - [System.Text.Json.Serialization.JsonPropertyName("total")] - public double Total { get; set; } = default!; - - /// - /// The amount on which commission is calculated - /// - - [System.Text.Json.Serialization.JsonPropertyName("subtotal")] - public double Subtotal { get; set; } = default!; - - /// - /// ID of the affiliate who brought the order - /// - - [System.Text.Json.Serialization.JsonPropertyName("affiliate_id")] - public double Affiliate_id { get; set; } = default!; - - /// - /// Commission given to affiliate for this order - /// - - [System.Text.Json.Serialization.JsonPropertyName("commission")] - public double Commission { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("status")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public OrderStatus Status { get; set; } = default!; - - /// - /// RAW ORDER DATA. Only for advanced use cases - /// - - [System.Text.Json.Serialization.JsonPropertyName("data")] - public object Data { get; set; } = default!; - - /// - /// The date when order was created - /// - - [System.Text.Json.Serialization.JsonPropertyName("created")] - public string Created { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties + protected struct ObjectResponseResult { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Rewards - { - /// - /// Order ID - /// - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int Id { get; set; } = default!; - - /// - /// ID of the affiliate who brought the order - /// - - [System.Text.Json.Serialization.JsonPropertyName("affiliate_id")] - public double Affiliate_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("type")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public RewardsType Type { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("metadata")] - public string Metadata { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("order_id")] - public double Order_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("level")] - public double Level { get; set; } = default!; - - /// - /// Reward amount - /// - - [System.Text.Json.Serialization.JsonPropertyName("amount")] - public int Amount { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("status")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public RewardsStatus Status { get; set; } = default!; - - /// - /// The date when order was created - /// - - [System.Text.Json.Serialization.JsonPropertyName("created")] - public string Created { get; set; } = default!; + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } - private System.Collections.Generic.IDictionary? _additionalProperties; + public T Object { get; } - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } + public string Text { get; } } - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class OrderInput - { - /// - /// Affiliate id of the affiliate - /// - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int Id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("first_name")] - public string First_name { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("last_name")] - public string Last_name { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("facebook")] - public string Facebook { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("twitter")] - public string Twitter { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("instagram")] - public string Instagram { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("website")] - public string Website { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("ref_code")] - public string Ref_code { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("coupon")] - public string Coupon { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("phone")] - public string Phone { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("address_1")] - public string Address_1 { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("city")] - public string City { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("state")] - public string State { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("country")] - public string Country { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("zip_code")] - public string Zip_code { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("comments")] - public string Comments { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("personal_message")] - public string Personal_message { get; set; } = default!; - - /// - /// The group the affiliate is part of. If the affiliate is not a part of any group, this field is empty - /// - - [System.Text.Json.Serialization.JsonPropertyName("group_id")] - public int Group_id { get; set; } = default!; - - /// - /// List of referral codes assigned to the affiliate - /// - - [System.Text.Json.Serialization.JsonPropertyName("ref_codes")] - public System.Collections.Generic.ICollection Ref_codes { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("coupons")] - public System.Collections.Generic.ICollection Coupons { get; set; } = default!; - - /// - /// Tax Identification Number - /// + public bool ReadResponseAsString { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("tin")] - public string Tin { get; set; } = default!; + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T)!, string.Empty); + } - [System.Text.Json.Serialization.JsonPropertyName("payment_method")] - public string Payment_method { get; set; } = default!; + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody!, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new GoAffProUserClientApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody!, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new GoAffProUserClientApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } - [System.Text.Json.Serialization.JsonPropertyName("payment_details")] - public object Payment_details { get; set; } = default!; + private string ConvertToString(object? value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } - [System.Text.Json.Serialization.JsonPropertyName("extra_1")] - public string Extra_1 { get; set; } = default!; + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } - [System.Text.Json.Serialization.JsonPropertyName("extra_2")] - public string Extra_2 { get; set; } = default!; + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } - [System.Text.Json.Serialization.JsonPropertyName("extra_3")] - public string Extra_3 { get; set; } = default!; + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } - [System.Text.Json.Serialization.JsonPropertyName("registration_ip")] - public string Registration_ip { get; set; } = default!; + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class LoginResponse + { - [System.Text.Json.Serialization.JsonPropertyName("commission")] - public Commission2 Commission { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("access_token")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Access_token { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -1809,16 +1623,12 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Body + public partial class UserProfileEnvelope { - [System.Text.Json.Serialization.JsonPropertyName("email")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Email { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("password")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Password { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("user")] + [System.ComponentModel.DataAnnotations.Required] + public object User { get; set; } = new object(); private System.Collections.Generic.IDictionary? _additionalProperties; @@ -1832,125 +1642,96 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum Status + public partial class UserProfileUpdateResponse { - [System.Runtime.Serialization.EnumMember(Value = @"approved")] - Approved = 0, + [System.Text.Json.Serialization.JsonPropertyName("success")] + public int Success { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"pending")] - Pending = 1, + private System.Collections.Generic.IDictionary? _additionalProperties; - [System.Runtime.Serialization.EnumMember(Value = @"blocked")] - Blocked = 2, + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum Anonymous + public partial class UserSiteListResponse { - [System.Runtime.Serialization.EnumMember(Value = @"id")] - Id = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"name")] - Name = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"logo")] - Logo = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"website")] - Website = 3, - - [System.Runtime.Serialization.EnumMember(Value = @"status")] - Status = 4, - - [System.Runtime.Serialization.EnumMember(Value = @"currency")] - Currency = 5, - - [System.Runtime.Serialization.EnumMember(Value = @"affiliate_portal")] - Affiliate_portal = 6, + [System.Text.Json.Serialization.JsonPropertyName("sites")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Sites { get; set; } = new System.Collections.ObjectModel.Collection(); - [System.Runtime.Serialization.EnumMember(Value = @"ref_code")] - Ref_code = 7, + [System.Text.Json.Serialization.JsonPropertyName("count")] + public int Count { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"referral_link")] - Referral_link = 8, + private System.Collections.Generic.IDictionary? _additionalProperties; - [System.Runtime.Serialization.EnumMember(Value = @"coupon")] - Coupon = 9, + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum Anonymous2 + public partial class UserSite { - [System.Runtime.Serialization.EnumMember(Value = @"total_sales")] - Total_sales = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"other_commission_earned")] - Other_commission_earned = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"revenue_generated")] - Revenue_generated = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"sale_commission_earned")] - Sale_commission_earned = 3, - - [System.Runtime.Serialization.EnumMember(Value = @"commission_paid")] - Commission_paid = 4, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum Anonymous3 - { + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string Id { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"id")] - Id = 0, + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"number")] - Number = 1, + [System.Text.Json.Serialization.JsonPropertyName("logo")] + public string Logo { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"total")] - Total = 2, + [System.Text.Json.Serialization.JsonPropertyName("website")] + public string Website { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"subtotal")] - Subtotal = 3, + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"line_items")] - Line_items = 4, + [System.Text.Json.Serialization.JsonPropertyName("currency")] + public string Currency { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"commission")] - Commission = 5, + [System.Text.Json.Serialization.JsonPropertyName("affiliate_portal")] + public string Affiliate_portal { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"created_at")] - Created_at = 6, + [System.Text.Json.Serialization.JsonPropertyName("ref_code")] + public string Ref_code { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"currency")] - Currency = 7, + [System.Text.Json.Serialization.JsonPropertyName("referral_link")] + public string Referral_link { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"site_id")] - Site_id = 8, + [System.Text.Json.Serialization.JsonPropertyName("coupon")] + public object Coupon { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"sub_id")] - Sub_id = 9, + private System.Collections.Generic.IDictionary? _additionalProperties; - [System.Runtime.Serialization.EnumMember(Value = @"conversion_details")] - Conversion_details = 10, + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Response + public partial class UserStatsAggregateResponse { - /// - /// Access token to query other /user/ endpoints - /// - [System.Text.Json.Serialization.JsonPropertyName("access_token")] - public string Access_token { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -1964,28 +1745,26 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Response2 + public partial class UserStatsAggregateItem { - /// - /// ID of the site - /// - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("site_id")] + public int Site_id { get; set; } = default!; - /// - /// Name of the store - /// + [System.Text.Json.Serialization.JsonPropertyName("total_sales")] + public double Total_sales { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("currency")] + public string Currency { get; set; } = default!; - /// - /// URL Of the store logo - /// + [System.Text.Json.Serialization.JsonPropertyName("sale_commission_earned")] + public double Sale_commission_earned { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("logo")] - public string Logo { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("revenue_generated")] + public double Revenue_generated { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("commission_paid")] + public double Commission_paid { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -1999,11 +1778,17 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Response3 + public partial class CountLimitOffsetEnvelope { - [System.Text.Json.Serialization.JsonPropertyName("id")] - public double Id { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("count")] + public int Count { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("limit")] + public int Limit { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("offset")] + public int Offset { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -2017,11 +1802,17 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Response4 + public partial class CountLimitOffsetEnvelopeFlexibleOffset { - [System.Text.Json.Serialization.JsonPropertyName("error")] - public string Error { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("count")] + public int Count { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("limit")] + public int Limit { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("offset")] + public int Offset { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -2035,11 +1826,11 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Response5 + public partial class SinceIdEcho { - [System.Text.Json.Serialization.JsonPropertyName("data")] - public Data Data { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("since_id")] + public int Since_id { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -2053,47 +1844,78 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Response6 + public partial class UserOrderFeedResponse : CountLimitOffsetEnvelope { [System.Text.Json.Serialization.JsonPropertyName("orders")] - public System.Collections.Generic.ICollection Orders { get; set; } = default!; + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Orders { get; set; } = new System.Collections.ObjectModel.Collection(); - [System.Text.Json.Serialization.JsonPropertyName("limit")] - public int Limit { get; set; } = default!; + } - [System.Text.Json.Serialization.JsonPropertyName("offset")] - public int Offset { get; set; } = default!; + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UserPayoutFeedResponse : CountLimitOffsetEnvelope + { - [System.Text.Json.Serialization.JsonPropertyName("count")] - public int Count { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("since_id")] + public int Since_id { get; set; } = default!; - private System.Collections.Generic.IDictionary? _additionalProperties; + [System.Text.Json.Serialization.JsonPropertyName("payouts")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Payouts { get; set; } = new System.Collections.ObjectModel.Collection(); - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UserProductFeedResponse : CountLimitOffsetEnvelopeFlexibleOffset + { + + [System.Text.Json.Serialization.JsonPropertyName("products")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Products { get; set; } = new System.Collections.ObjectModel.Collection(); + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UserRewardFeedResponse : CountLimitOffsetEnvelope + { + + [System.Text.Json.Serialization.JsonPropertyName("rewards")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Rewards { get; set; } = new System.Collections.ObjectModel.Collection(); + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UserRewardFeedItem + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string Id { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("affiliate_id")] + public string Affiliate_id { get; set; } = default!; - } + [System.Text.Json.Serialization.JsonPropertyName("type")] + public string Type { get; set; } = default!; - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Response7 - { + [System.Text.Json.Serialization.JsonPropertyName("metadata")] + public string Metadata { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("rewards")] - public System.Collections.Generic.ICollection Rewards { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("order_id")] + public string Order_id { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("limit")] - public int Limit { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("level")] + public int Level { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("offset")] - public int Offset { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("amount")] + public double Amount { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("count")] - public int Count { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("created")] + public string Created { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -2107,34 +1929,20 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Response8 + public partial class UserTrafficFeedResponse : CountLimitOffsetEnvelope { - [System.Text.Json.Serialization.JsonPropertyName("traffic")] - public System.Collections.Generic.ICollection Traffic { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("limit")] - public int Limit { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("offset")] - public int Offset { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("count")] - public int Count { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; + [System.Text.Json.Serialization.JsonPropertyName("since_id")] + public int Since_id { get; set; } = default!; - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } + [System.Text.Json.Serialization.JsonPropertyName("traffic")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Traffic { get; set; } = new System.Collections.ObjectModel.Collection(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Response9 + public partial class UserCommissionsResponse { [System.Text.Json.Serialization.JsonPropertyName("standard")] @@ -2149,6 +1957,9 @@ public partial class Response9 [System.Text.Json.Serialization.JsonPropertyName("mlm")] public object Mlm { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("commissions")] + public System.Collections.Generic.ICollection Commissions { get; set; } = default!; + private System.Collections.Generic.IDictionary? _additionalProperties; [System.Text.Json.Serialization.JsonExtensionData] @@ -2161,29 +1972,21 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Coupons + public partial class UserTransactionFeedResponse { - /// - /// Coupon code assigned to the affiliate - /// - - [System.Text.Json.Serialization.JsonPropertyName("code")] - public string Code { get; set; } = default!; - /// - /// Type of discount given by this coupon code - /// + [System.Text.Json.Serialization.JsonPropertyName("transactions")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Transactions { get; set; } = new System.Collections.ObjectModel.Collection(); - [System.Text.Json.Serialization.JsonPropertyName("discount_type")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public CouponsDiscount_type Discount_type { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("count")] + public int Count { get; set; } = default!; - /// - /// The amount of discount given - /// + [System.Text.Json.Serialization.JsonPropertyName("limit")] + public int Limit { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("discount_value")] - public double Discount_value { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("offset")] + public int Offset { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -2197,23 +2000,49 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Commission + public partial class UserTransactionItem { - [System.Text.Json.Serialization.JsonPropertyName("type")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public CommissionType Type { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string Id { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("tx_id")] + public int Tx_id { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("affiliate_id")] + public int Affiliate_id { get; set; } = default!; [System.Text.Json.Serialization.JsonPropertyName("amount")] - public int Amount { get; set; } = default!; + public double Amount { get; set; } = default!; - /// - /// The commission to be given on. Useful if you wish to give flat rate commission on the entire order instead of giving commission on a per product basis - /// + [System.Text.Json.Serialization.JsonPropertyName("currency")] + public string Currency { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("startingBalance")] + public double StartingBalance { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("endingBalance")] + public double EndingBalance { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("created_at")] + public string Created_at { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("on")] + [System.Text.Json.Serialization.JsonPropertyName("entity_type")] [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public CommissionOn On { get; set; } = default!; + public UserTransactionItemEntity_type Entity_type { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("event_type")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public UserTransactionItemEvent_type Event_type { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("entity_id")] + public string Entity_id { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("is_paid")] + public bool Is_paid { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("metadata")] + public object Metadata { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -2227,11 +2056,12 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Affiliate2 + public partial class UserPendingPayoutsResponse { - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int Id { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("pending")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Pending { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -2245,14 +2075,20 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Customer + public partial class PendingPayoutItem { - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("affiliate_id")] + public int Affiliate_id { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("email")] - public string Email { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("amount")] + public double Amount { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("total_earned")] + public double Total_earned { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("total_paid")] + public double Total_paid { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -2266,14 +2102,20 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Invoice + public partial class PendingPayoutBreakdown { - /// - /// URL to download the invoice - /// - [System.Text.Json.Serialization.JsonPropertyName("url")] - public string Url { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("sale_earnings")] + public double Sale_earnings { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("other_earnings")] + public double Other_earnings { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("paid_earnings")] + public double Paid_earnings { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("amount_pending")] + public double Amount_pending { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -2287,89 +2129,91 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum PaymentRequestStatus + public partial class PublicSitesResponse : CountLimitOffsetEnvelopeFlexibleOffset { - [System.Runtime.Serialization.EnumMember(Value = @"in_progress")] - In_progress = 0, + [System.Text.Json.Serialization.JsonPropertyName("stores")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Stores { get; set; } = new System.Collections.ObjectModel.Collection(); - [System.Runtime.Serialization.EnumMember(Value = @"paid")] - Paid = 1, + [System.Text.Json.Serialization.JsonPropertyName("currency")] + public string Currency { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"rejected")] - Rejected = 2, + [System.Text.Json.Serialization.JsonPropertyName("keyword")] + public string Keyword { get; set; } = default!; } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum OrderStatus + public partial class PublicStore { - [System.Runtime.Serialization.EnumMember(Value = @"approved")] - Approved = 0, + [System.Text.Json.Serialization.JsonPropertyName("id")] + public int Id { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"rejected")] - Rejected = 1, + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } = default!; - } + [System.Text.Json.Serialization.JsonPropertyName("website")] + public string Website { get; set; } = default!; - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum RewardsType - { + [System.Text.Json.Serialization.JsonPropertyName("logo")] + public string Logo { get; set; } = default!; + + [System.Text.Json.Serialization.JsonPropertyName("currency")] + public string Currency { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"signup_bonus")] - Signup_bonus = 0, + [System.Text.Json.Serialization.JsonPropertyName("affiliatePortal")] + public string AffiliatePortal { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"sale_commission")] - Sale_commission = 1, + [System.Text.Json.Serialization.JsonPropertyName("cookieDuration")] + public int CookieDuration { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"target_bonus")] - Target_bonus = 2, + [System.Text.Json.Serialization.JsonPropertyName("areRegistrationsOpen")] + public int AreRegistrationsOpen { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"wallet_adjustment")] - Wallet_adjustment = 3, + [System.Text.Json.Serialization.JsonPropertyName("isApprovedAutomatically")] + public int IsApprovedAutomatically { get; set; } = default!; - [System.Runtime.Serialization.EnumMember(Value = @"recruitment_bonus")] - Recruitment_bonus = 4, + [System.Text.Json.Serialization.JsonPropertyName("commission")] + public CommissionLike Commission { get; set; } = default!; + + private System.Collections.Generic.IDictionary? _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum RewardsStatus + public partial class PublicProductsResponse : CountLimitOffsetEnvelopeFlexibleOffset { - [System.Runtime.Serialization.EnumMember(Value = @"approved")] - Approved = 0, + [System.Text.Json.Serialization.JsonPropertyName("products")] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Products { get; set; } = new System.Collections.ObjectModel.Collection(); - [System.Runtime.Serialization.EnumMember(Value = @"rejected")] - Rejected = 1, + [System.Text.Json.Serialization.JsonPropertyName("site_ids")] + public string Site_ids { get; set; } = default!; } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class coupons + public partial class CommissionLike { - /// - /// Coupon code assigned to the affiliate - /// - - [System.Text.Json.Serialization.JsonPropertyName("code")] - public string Code { get; set; } = default!; - /// - /// Type of discount given by this coupon code - /// - - [System.Text.Json.Serialization.JsonPropertyName("discount_type")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public couponsDiscount_type Discount_type { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("type")] + public string Type { get; set; } = default!; - /// - /// The amount of discount given - /// + [System.Text.Json.Serialization.JsonPropertyName("amount")] + public double Amount { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("discount_value")] - public double Discount_value { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("true")] + public string True { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -2383,23 +2227,15 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Commission2 + public partial class ErrorResponse { - [System.Text.Json.Serialization.JsonPropertyName("type")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public Commission2Type Type { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("amount")] - public int Amount { get; set; } = default!; - - /// - /// The commission to be given on. Useful if you wish to give flat rate commission on the entire order instead of giving commission on a per product basis - /// + [System.Text.Json.Serialization.JsonPropertyName("error")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Error { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("on")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public Commission2On On { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("code")] + public int Code { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -2413,26 +2249,16 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Data + public partial class Body { - [System.Text.Json.Serialization.JsonPropertyName("site_id")] - public double Site_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("total_sales")] - public double Total_sales { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("currency")] - public string Currency { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("sale_commission_earned")] - public double Sale_commission_earned { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("revenue_generated")] - public double Revenue_generated { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("email")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Email { get; set; } = default!; - [System.Text.Json.Serialization.JsonPropertyName("commission_paid")] - public double Commission_paid { get; set; } = default!; + [System.Text.Json.Serialization.JsonPropertyName("password")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Password { get; set; } = default!; private System.Collections.Generic.IDictionary? _additionalProperties; @@ -2446,80 +2272,152 @@ public System.Collections.Generic.IDictionary AdditionalProperti } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum CouponsDiscount_type + public enum Status { - [System.Runtime.Serialization.EnumMember(Value = @"percentage")] - Percentage = 0, + [System.Runtime.Serialization.EnumMember(Value = @"approved")] + Approved = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"pending")] + Pending = 1, - [System.Runtime.Serialization.EnumMember(Value = @"fixed_amount")] - Fixed_amount = 1, + [System.Runtime.Serialization.EnumMember(Value = @"blocked")] + Blocked = 2, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum CommissionType + public enum Anonymous { - [System.Runtime.Serialization.EnumMember(Value = @"percentage")] - Percentage = 0, + [System.Runtime.Serialization.EnumMember(Value = @"id")] + Id = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"name")] + Name = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"logo")] + Logo = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"website")] + Website = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"status")] + Status = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"currency")] + Currency = 5, + + [System.Runtime.Serialization.EnumMember(Value = @"affiliate_portal")] + Affiliate_portal = 6, + + [System.Runtime.Serialization.EnumMember(Value = @"ref_code")] + Ref_code = 7, - [System.Runtime.Serialization.EnumMember(Value = @"fixed_amount")] - Fixed_amount = 1, + [System.Runtime.Serialization.EnumMember(Value = @"referral_link")] + Referral_link = 8, - [System.Runtime.Serialization.EnumMember(Value = @"fixed_amount_on_order")] - Fixed_amount_on_order = 2, + [System.Runtime.Serialization.EnumMember(Value = @"coupon")] + Coupon = 9, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum CommissionOn + public enum Anonymous2 { - [System.Runtime.Serialization.EnumMember(Value = @"product")] - Product = 0, + [System.Runtime.Serialization.EnumMember(Value = @"total_sales")] + Total_sales = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"other_commission_earned")] + Other_commission_earned = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"revenue_generated")] + Revenue_generated = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"sale_commission_earned")] + Sale_commission_earned = 3, - [System.Runtime.Serialization.EnumMember(Value = @"order")] - Order = 1, + [System.Runtime.Serialization.EnumMember(Value = @"commission_paid")] + Commission_paid = 4, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum couponsDiscount_type + public enum Anonymous3 { - [System.Runtime.Serialization.EnumMember(Value = @"percentage")] - Percentage = 0, + [System.Runtime.Serialization.EnumMember(Value = @"id")] + Id = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"number")] + Number = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"total")] + Total = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"subtotal")] + Subtotal = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"line_items")] + Line_items = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"commission")] + Commission = 5, + + [System.Runtime.Serialization.EnumMember(Value = @"created_at")] + Created_at = 6, + + [System.Runtime.Serialization.EnumMember(Value = @"currency")] + Currency = 7, + + [System.Runtime.Serialization.EnumMember(Value = @"site_id")] + Site_id = 8, + + [System.Runtime.Serialization.EnumMember(Value = @"sub_id")] + Sub_id = 9, - [System.Runtime.Serialization.EnumMember(Value = @"fixed_amount")] - Fixed_amount = 1, + [System.Runtime.Serialization.EnumMember(Value = @"conversion_details")] + Conversion_details = 10, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum Commission2Type + public enum UserTransactionItemEntity_type { - [System.Runtime.Serialization.EnumMember(Value = @"percentage")] - Percentage = 0, + [System.Runtime.Serialization.EnumMember(Value = @"orders")] + Orders = 0, - [System.Runtime.Serialization.EnumMember(Value = @"fixed_amount")] - Fixed_amount = 1, + [System.Runtime.Serialization.EnumMember(Value = @"rewards")] + Rewards = 1, - [System.Runtime.Serialization.EnumMember(Value = @"fixed_amount_on_order")] - Fixed_amount_on_order = 2, + [System.Runtime.Serialization.EnumMember(Value = @"payouts")] + Payouts = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"ORDERS")] + ORDERS = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"REWARDS")] + REWARDS = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"PAYOUTS")] + PAYOUTS = 5, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum Commission2On + public enum UserTransactionItemEvent_type { - [System.Runtime.Serialization.EnumMember(Value = @"product")] - Product = 0, + [System.Runtime.Serialization.EnumMember(Value = @"insert")] + Insert = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"update")] + Update = 1, - [System.Runtime.Serialization.EnumMember(Value = @"order")] - Order = 1, + [System.Runtime.Serialization.EnumMember(Value = @"delete")] + Delete = 2, } diff --git a/src/GoAffPro.Client/GoAffPro.Client.csproj b/src/GoAffPro.Client/GoAffPro.Client.csproj index 43f5589..808b735 100644 --- a/src/GoAffPro.Client/GoAffPro.Client.csproj +++ b/src/GoAffPro.Client/GoAffPro.Client.csproj @@ -14,7 +14,7 @@ goaffpro;affiliate;marketing;api;client;dotnet $(NoWarn);CS8981;CA1708 net10.0 - $(MSBuildProjectDirectory)\..\..\openapi\swagger-ui-init.js + $(MSBuildProjectDirectory)\..\..\openapi\goaffpro-canonical.json diff --git a/src/GoAffPro.Client/GoAffProClient.cs b/src/GoAffPro.Client/GoAffProClient.cs index 2298192..5970733 100644 --- a/src/GoAffPro.Client/GoAffProClient.cs +++ b/src/GoAffPro.Client/GoAffProClient.cs @@ -104,7 +104,7 @@ public async Task LoginAsync(string email, string password, Cancellation Password = password, }; - global::GoAffPro.Client.Generated.User.Response response = await ExecuteUserAsync( + var response = await ExecuteUserAsync( () => User.UserLoginAsync(request, cancellationToken)) .ConfigureAwait(false); @@ -136,7 +136,7 @@ public async Task> GetOrdersAsync( int offset = 0, CancellationToken cancellationToken = default) { - global::GoAffPro.Client.Generated.User.Response6 response = await ExecuteUserAsync( + var response = await ExecuteUserAsync( () => User.UserFeedOrdersAsync( site_ids: null, since_id: null, @@ -149,8 +149,12 @@ public async Task> GetOrdersAsync( cancellationToken)) .ConfigureAwait(false); + IEnumerable orderItems = response.Orders is null + ? Array.Empty() + : response.Orders.Select(static item => (object)item); + return MapFeedItems( - response.Orders ?? Array.Empty(), + orderItems, TryMapOrder); } @@ -162,7 +166,7 @@ public async Task> GetAffiliatesAsync( int offset = 0, CancellationToken cancellationToken = default) { - global::GoAffPro.Client.Generated.User.Response8 response = await ExecuteUserAsync( + var response = await ExecuteUserAsync( () => User.UserFeedTrafficAsync( site_ids: null, start_time: from?.ToString("o"), @@ -173,8 +177,12 @@ public async Task> GetAffiliatesAsync( cancellationToken)) .ConfigureAwait(false); + IEnumerable trafficItems = response.Traffic is null + ? Array.Empty() + : response.Traffic.Select(static item => (object)item); + return MapFeedItems( - response.Traffic ?? Array.Empty(), + trafficItems, TryMapAffiliate); } @@ -203,7 +211,7 @@ public async Task> GetPayoutsAsync( int offset = 0, CancellationToken cancellationToken = default) { - object response = await ExecuteUserAsync( + var response = await ExecuteUserAsync( () => User.UserFeedPayoutsAsync( site_ids: null, start_time: from?.ToString("o"), @@ -214,9 +222,11 @@ public async Task> GetPayoutsAsync( cancellationToken)) .ConfigureAwait(false); - return MapFeedItems( - ExtractPayoutItems(response), - TryMapPayout); + IEnumerable payoutItems = response.Payouts is null + ? Array.Empty() + : response.Payouts; + + return MapFeedItems(payoutItems, TryMapPayout); } /// @@ -225,16 +235,18 @@ public async Task> GetProductsAsync( int offset = 0, CancellationToken cancellationToken = default) { - object response = await ExecuteUserAsync( + var response = await ExecuteUserAsync( () => User.UserFeedProductsAsync( limit: limit, offset: offset, cancellationToken: cancellationToken)) .ConfigureAwait(false); - return MapFeedItems( - ExtractProductItems(response), - TryMapProduct); + IEnumerable productItems = response.Products is null + ? Array.Empty() + : response.Products; + + return MapFeedItems(productItems, TryMapProduct); } /// @@ -346,24 +358,6 @@ private static List MapFeedItems( return results; } - private static object[] ExtractPayoutItems(object response) - { - return response is JsonElement jsonElement && jsonElement.ValueKind == JsonValueKind.Object - ? jsonElement.TryGetProperty("payouts", out JsonElement payouts) - ? JsonSerializer.Deserialize(payouts.GetRawText()) ?? [] - : [] - : []; - } - - private static object[] ExtractProductItems(object response) - { - return response is JsonElement jsonElement && jsonElement.ValueKind == JsonValueKind.Object - ? jsonElement.TryGetProperty("products", out JsonElement products) - ? JsonSerializer.Deserialize(products.GetRawText()) ?? [] - : [] - : []; - } - private static GoAffProOrder? TryMapOrder(JsonElement payload) { string? id = TryExtractId(payload, ["id", "order_id"]); diff --git a/tests/GoAffPro.Client.Tests/Snapshots/GeneratedClientSignatures.snapshot b/tests/GoAffPro.Client.Tests/Snapshots/GeneratedClientSignatures.snapshot index 56da3a1..132aac7 100644 --- a/tests/GoAffPro.Client.Tests/Snapshots/GeneratedClientSignatures.snapshot +++ b/tests/GoAffPro.Client.Tests/Snapshots/GeneratedClientSignatures.snapshot @@ -1,29 +1,33 @@ [GoAffProUserClient] -public virtual System.Threading.Tasks.Task UserLoginAsync(Body? body) -public virtual async System.Threading.Tasks.Task UserLoginAsync(Body? body, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserSitesAsync(int? limit, int? offset, Status? status, System.Collections.Generic.IEnumerable fields) -public virtual async System.Threading.Tasks.Task UserSitesAsync(int? limit, int? offset, Status? status, System.Collections.Generic.IEnumerable fields, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserGetAsync() -public virtual async System.Threading.Tasks.Task UserGetAsync(System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserPostAsync() -public virtual async System.Threading.Tasks.Task UserPostAsync(System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserStatsAggregateAsync(object? site_ids, object? start_time, object? end_time, System.Collections.Generic.IEnumerable fields) -public virtual async System.Threading.Tasks.Task UserStatsAggregateAsync(object? site_ids, object? start_time, object? end_time, System.Collections.Generic.IEnumerable fields, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserFeedOrdersAsync(object? site_ids, object? since_id, object? max_id, object? created_at_max, object? created_at_min, System.Collections.Generic.IEnumerable fields, int? limit, int? offset) -public virtual async System.Threading.Tasks.Task UserFeedOrdersAsync(object? site_ids, object? since_id, object? max_id, object? created_at_max, object? created_at_min, System.Collections.Generic.IEnumerable fields, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserFeedPayoutsAsync(object? site_ids, object? start_time, object? end_time, int? since_id, int? limit, int? offset) -public virtual async System.Threading.Tasks.Task UserFeedPayoutsAsync(object? site_ids, object? start_time, object? end_time, int? since_id, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserFeedProductsAsync(int? limit, int? offset) -public virtual async System.Threading.Tasks.Task UserFeedProductsAsync(int? limit, int? offset, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserFeedRewardsAsync(object? site_ids, object? start_time, object? end_time, int? since_id, int? limit, int? offset) -public virtual async System.Threading.Tasks.Task UserFeedRewardsAsync(object? site_ids, object? start_time, object? end_time, int? since_id, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserFeedTrafficAsync(object? site_ids, object? start_time, object? end_time, int? since_id, int? limit, int? offset) -public virtual async System.Threading.Tasks.Task UserFeedTrafficAsync(object? site_ids, object? start_time, object? end_time, int? since_id, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserCommissionsAsync(object? site_ids) -public virtual async System.Threading.Tasks.Task UserCommissionsAsync(object? site_ids, System.Threading.CancellationToken cancellationToken) +public virtual System.Threading.Tasks.Task UserLoginAsync(Body body) +public virtual async System.Threading.Tasks.Task UserLoginAsync(Body body, System.Threading.CancellationToken cancellationToken) +public virtual System.Threading.Tasks.Task UserSitesAsync(int? limit, int? offset, Status? status, System.Collections.Generic.IEnumerable fields) +public virtual async System.Threading.Tasks.Task UserSitesAsync(int? limit, int? offset, Status? status, System.Collections.Generic.IEnumerable fields, System.Threading.CancellationToken cancellationToken) +public virtual System.Threading.Tasks.Task UserGetAsync() +public virtual async System.Threading.Tasks.Task UserGetAsync(System.Threading.CancellationToken cancellationToken) +public virtual System.Threading.Tasks.Task UserPostAsync() +public virtual async System.Threading.Tasks.Task UserPostAsync(System.Threading.CancellationToken cancellationToken) +public virtual System.Threading.Tasks.Task UserStatsAggregateAsync(string? site_ids, string? start_time, string? end_time, System.Collections.Generic.IEnumerable fields) +public virtual async System.Threading.Tasks.Task UserStatsAggregateAsync(string? site_ids, string? start_time, string? end_time, System.Collections.Generic.IEnumerable fields, System.Threading.CancellationToken cancellationToken) +public virtual System.Threading.Tasks.Task UserFeedOrdersAsync(string? site_ids, string? since_id, string? max_id, string? created_at_max, string? created_at_min, System.Collections.Generic.IEnumerable fields, int? limit, int? offset) +public virtual async System.Threading.Tasks.Task UserFeedOrdersAsync(string? site_ids, string? since_id, string? max_id, string? created_at_max, string? created_at_min, System.Collections.Generic.IEnumerable fields, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) +public virtual System.Threading.Tasks.Task UserFeedPayoutsAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset) +public virtual async System.Threading.Tasks.Task UserFeedPayoutsAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) +public virtual System.Threading.Tasks.Task UserFeedProductsAsync(int? limit, int? offset) +public virtual async System.Threading.Tasks.Task UserFeedProductsAsync(int? limit, int? offset, System.Threading.CancellationToken cancellationToken) +public virtual System.Threading.Tasks.Task UserFeedRewardsAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset) +public virtual async System.Threading.Tasks.Task UserFeedRewardsAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) +public virtual System.Threading.Tasks.Task UserFeedTrafficAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset) +public virtual async System.Threading.Tasks.Task UserFeedTrafficAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) +public virtual System.Threading.Tasks.Task UserFeedTransactionsAsync(int? limit, int? offset) +public virtual async System.Threading.Tasks.Task UserFeedTransactionsAsync(int? limit, int? offset, System.Threading.CancellationToken cancellationToken) +public virtual System.Threading.Tasks.Task UserCommissionsAsync(string? site_ids) +public virtual async System.Threading.Tasks.Task UserCommissionsAsync(string? site_ids, System.Threading.CancellationToken cancellationToken) +public virtual System.Threading.Tasks.Task UserPayoutsPendingAsync() +public virtual async System.Threading.Tasks.Task UserPayoutsPendingAsync(System.Threading.CancellationToken cancellationToken) [GoAffProPublicClient] -public virtual System.Threading.Tasks.Task PublicSitesAsync(string? site_ids, string? currency, string? keyword, int? limit, int? offset) -public virtual async System.Threading.Tasks.Task PublicSitesAsync(string? site_ids, string? currency, string? keyword, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task PublicProductsAsync(int? limit, int? offset, string? site_ids) -public virtual async System.Threading.Tasks.Task PublicProductsAsync(int? limit, int? offset, string? site_ids, System.Threading.CancellationToken cancellationToken) +public virtual System.Threading.Tasks.Task PublicSitesAsync(string? site_ids, string? currency, string? keyword, int? limit, int? offset) +public virtual async System.Threading.Tasks.Task PublicSitesAsync(string? site_ids, string? currency, string? keyword, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) +public virtual System.Threading.Tasks.Task PublicProductsAsync(int? limit, int? offset, string? site_ids) +public virtual async System.Threading.Tasks.Task PublicProductsAsync(int? limit, int? offset, string? site_ids, System.Threading.CancellationToken cancellationToken) From 75dfdcaf31854b95115c350eeaabf933a24d077c Mon Sep 17 00:00:00 2001 From: Agash Date: Wed, 25 Feb 2026 10:12:53 +0100 Subject: [PATCH 3/8] feat(events): emit generated feed models and expand observer streams --- .../Events/AffiliateDetectedEventArgs.cs | 8 +- src/GoAffPro.Client/Events/AffiliateEvent.cs | 28 - .../Events/GoAffProEventDetector.cs | 188 ----- .../Events/OrderDetectedEventArgs.cs | 8 +- src/GoAffPro.Client/Events/OrderEvent.cs | 28 - .../Events/PayoutDetectedEventArgs.cs | 23 + .../Events/ProductDetectedEventArgs.cs | 23 + .../Events/RewardDetectedEventArgs.cs | 8 +- src/GoAffPro.Client/Events/RewardEvent.cs | 32 - .../Events/TransactionDetectedEventArgs.cs | 23 + src/GoAffPro.Client/GoAffProClient.cs | 741 ++++++++++-------- src/GoAffPro.Client/IGoAffProClient.cs | 158 ++-- .../GoAffProEventDetectorTests.cs | 212 ++++- 13 files changed, 742 insertions(+), 738 deletions(-) delete mode 100644 src/GoAffPro.Client/Events/AffiliateEvent.cs delete mode 100644 src/GoAffPro.Client/Events/GoAffProEventDetector.cs delete mode 100644 src/GoAffPro.Client/Events/OrderEvent.cs create mode 100644 src/GoAffPro.Client/Events/PayoutDetectedEventArgs.cs create mode 100644 src/GoAffPro.Client/Events/ProductDetectedEventArgs.cs delete mode 100644 src/GoAffPro.Client/Events/RewardEvent.cs create mode 100644 src/GoAffPro.Client/Events/TransactionDetectedEventArgs.cs diff --git a/src/GoAffPro.Client/Events/AffiliateDetectedEventArgs.cs b/src/GoAffPro.Client/Events/AffiliateDetectedEventArgs.cs index 036218b..ba6aba3 100644 --- a/src/GoAffPro.Client/Events/AffiliateDetectedEventArgs.cs +++ b/src/GoAffPro.Client/Events/AffiliateDetectedEventArgs.cs @@ -1,9 +1,9 @@ -using GoAffPro.Client.Models; +using GoAffPro.Client.Generated.Models; namespace GoAffPro.Client.Events; /// -/// Event arguments for . +/// Event arguments for . /// public sealed class AffiliateDetectedEventArgs : EventArgs { @@ -11,7 +11,7 @@ public sealed class AffiliateDetectedEventArgs : EventArgs /// Initializes a new instance of the class. /// /// Detected affiliate payload. - public AffiliateDetectedEventArgs(GoAffProAffiliate affiliate) + public AffiliateDetectedEventArgs(UserTrafficFeedItem affiliate) { Affiliate = affiliate; } @@ -19,5 +19,5 @@ public AffiliateDetectedEventArgs(GoAffProAffiliate affiliate) /// /// Gets the detected affiliate payload. /// - public GoAffProAffiliate Affiliate { get; } + public UserTrafficFeedItem Affiliate { get; } } diff --git a/src/GoAffPro.Client/Events/AffiliateEvent.cs b/src/GoAffPro.Client/Events/AffiliateEvent.cs deleted file mode 100644 index 36951a0..0000000 --- a/src/GoAffPro.Client/Events/AffiliateEvent.cs +++ /dev/null @@ -1,28 +0,0 @@ -using GoAffPro.Client.Models; - -namespace GoAffPro.Client.Events; - -/// -/// Represents a detected affiliate/traffic feed event. -/// -public sealed record AffiliateEvent -{ - /// - /// Initializes a new instance of the record. - /// - /// The detected affiliate payload. - public AffiliateEvent(GoAffProAffiliate affiliate) - { - Affiliate = affiliate; - } - - /// - /// Gets the strongly typed affiliate payload. - /// - public GoAffProAffiliate Affiliate { get; init; } - - /// - /// Gets the unique event identifier. - /// - public string Id => Affiliate.Id; -} diff --git a/src/GoAffPro.Client/Events/GoAffProEventDetector.cs b/src/GoAffPro.Client/Events/GoAffProEventDetector.cs deleted file mode 100644 index 915bc27..0000000 --- a/src/GoAffPro.Client/Events/GoAffProEventDetector.cs +++ /dev/null @@ -1,188 +0,0 @@ -using System.Runtime.CompilerServices; -using GoAffPro.Client.Models; - -namespace GoAffPro.Client.Events; - -/// -/// Polling-based event detector for GoAffPro feed endpoints. -/// -/// -/// Uses time-based filtering to fetch only new items since the last poll. -/// The caller is responsible for any persistence of timestamps if needed across application restarts. -/// -public sealed class GoAffProEventDetector -{ - private readonly IGoAffProClient _client; - private readonly TimeSpan _pollingInterval; - private readonly int _pageSize; - private DateTimeOffset _lastOrderPoll = DateTimeOffset.UtcNow; - private DateTimeOffset _lastAffiliatePoll = DateTimeOffset.UtcNow; - - /// - /// Initializes a new instance of the class. - /// - /// Client used for feed polling operations. - /// Polling interval. Defaults to 30 seconds. - /// Number of feed records requested per poll. Must be greater than zero. - public GoAffProEventDetector( - IGoAffProClient client, - TimeSpan? pollingInterval = null, - int pageSize = 100) - { - ArgumentNullException.ThrowIfNull(client); - if (pageSize <= 0) - { - throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "Page size must be greater than zero."); - } - - _client = client; - _pollingInterval = pollingInterval ?? TimeSpan.FromSeconds(30); - _pageSize = pageSize; - } - - /// - /// Gets or sets the starting timestamp for order polling. - /// - /// - /// Set this before starting to backfill historical orders. - /// - public DateTimeOffset? OrderStartTime { get; set; } - - /// - /// Gets or sets the starting timestamp for affiliate polling. - /// - /// - /// Set this before starting to backfill historical affiliates. - /// - public DateTimeOffset? AffiliateStartTime { get; set; } - - /// - /// Raised when a new order item is detected. - /// - public event EventHandler? OrderDetected; - - /// - /// Raised when a new affiliate/traffic item is detected. - /// - public event EventHandler? AffiliateDetected; - - /// - /// Raised when a new reward item is detected. - /// - /// - /// Currently disabled because /user/feed/rewards is returning HTTP 404 - /// as observed on 2026-02-18. - /// - [Obsolete("Disabled because /user/feed/rewards currently returns HTTP 404 (observed on 2026-02-18).")] - public event EventHandler? RewardDetected; - - /// - /// Starts continuous polling and raises events when new items are found. - /// - /// Cancellation token used to stop polling. - public async Task StartAsync(CancellationToken cancellationToken = default) - { - // Referenced intentionally so the temporarily-disabled event remains part of the public surface. - _ = RewardDetected; - - while (!cancellationToken.IsCancellationRequested) - { - IReadOnlyList orders = await PollOrdersAsync(cancellationToken).ConfigureAwait(false); - foreach (OrderEvent order in orders) - { - OrderDetected?.Invoke(this, new OrderDetectedEventArgs(order.Order)); - } - - IReadOnlyList affiliates = await PollAffiliatesAsync(cancellationToken).ConfigureAwait(false); - foreach (AffiliateEvent affiliate in affiliates) - { - AffiliateDetected?.Invoke(this, new AffiliateDetectedEventArgs(affiliate.Affiliate)); - } - - await Task.Delay(_pollingInterval, cancellationToken).ConfigureAwait(false); - } - } - - /// - /// Streams newly detected order events. - /// - /// Cancellation token used to stop polling. - /// An async stream of new order events. - public async IAsyncEnumerable NewOrdersAsync([EnumeratorCancellation] CancellationToken cancellationToken = default) - { - while (!cancellationToken.IsCancellationRequested) - { - IReadOnlyList events = await PollOrdersAsync(cancellationToken).ConfigureAwait(false); - foreach (OrderEvent detectedEvent in events) - { - yield return detectedEvent; - } - - await Task.Delay(_pollingInterval, cancellationToken).ConfigureAwait(false); - } - } - - /// - /// Streams newly detected affiliate events. - /// - /// Cancellation token used to stop polling. - /// An async stream of new affiliate events. - public async IAsyncEnumerable NewAffiliatesAsync([EnumeratorCancellation] CancellationToken cancellationToken = default) - { - while (!cancellationToken.IsCancellationRequested) - { - IReadOnlyList events = await PollAffiliatesAsync(cancellationToken).ConfigureAwait(false); - foreach (AffiliateEvent detectedEvent in events) - { - yield return detectedEvent; - } - - await Task.Delay(_pollingInterval, cancellationToken).ConfigureAwait(false); - } - } - - /// - /// Streams newly detected reward events. - /// - /// Cancellation token used to stop polling. - /// An async stream of reward events. - /// - /// Currently disabled because /user/feed/rewards is returning HTTP 404 - /// as observed on 2026-02-18. - /// - [Obsolete("Disabled because /user/feed/rewards currently returns HTTP 404 (observed on 2026-02-18).")] - public async IAsyncEnumerable NewRewardsAsync([EnumeratorCancellation] CancellationToken cancellationToken = default) - { - _ = cancellationToken; - await Task.CompletedTask.ConfigureAwait(false); - yield break; - } - - private async Task> PollOrdersAsync(CancellationToken cancellationToken) - { - DateTimeOffset from = OrderStartTime ?? _lastOrderPoll; - DateTimeOffset to = DateTimeOffset.UtcNow; - - IReadOnlyList orders = await _client - .GetOrdersAsync(from: from, toDate: to, limit: _pageSize, cancellationToken: cancellationToken) - .ConfigureAwait(false); - - _lastOrderPoll = to; - - return orders.Select(order => new OrderEvent(order)).ToList(); - } - - private async Task> PollAffiliatesAsync(CancellationToken cancellationToken) - { - DateTimeOffset from = AffiliateStartTime ?? _lastAffiliatePoll; - DateTimeOffset to = DateTimeOffset.UtcNow; - - IReadOnlyList affiliates = await _client - .GetAffiliatesAsync(from: from, toDate: to, limit: _pageSize, cancellationToken: cancellationToken) - .ConfigureAwait(false); - - _lastAffiliatePoll = to; - - return affiliates.Select(affiliate => new AffiliateEvent(affiliate)).ToList(); - } -} diff --git a/src/GoAffPro.Client/Events/OrderDetectedEventArgs.cs b/src/GoAffPro.Client/Events/OrderDetectedEventArgs.cs index 2f6882f..02071b5 100644 --- a/src/GoAffPro.Client/Events/OrderDetectedEventArgs.cs +++ b/src/GoAffPro.Client/Events/OrderDetectedEventArgs.cs @@ -1,9 +1,9 @@ -using GoAffPro.Client.Models; +using GoAffPro.Client.Generated.Models; namespace GoAffPro.Client.Events; /// -/// Event arguments for . +/// Event arguments for . /// public sealed class OrderDetectedEventArgs : EventArgs { @@ -11,7 +11,7 @@ public sealed class OrderDetectedEventArgs : EventArgs /// Initializes a new instance of the class. /// /// Detected order payload. - public OrderDetectedEventArgs(GoAffProOrder order) + public OrderDetectedEventArgs(UserOrderFeedItem order) { Order = order; } @@ -19,5 +19,5 @@ public OrderDetectedEventArgs(GoAffProOrder order) /// /// Gets the detected order payload. /// - public GoAffProOrder Order { get; } + public UserOrderFeedItem Order { get; } } diff --git a/src/GoAffPro.Client/Events/OrderEvent.cs b/src/GoAffPro.Client/Events/OrderEvent.cs deleted file mode 100644 index c21f1d6..0000000 --- a/src/GoAffPro.Client/Events/OrderEvent.cs +++ /dev/null @@ -1,28 +0,0 @@ -using GoAffPro.Client.Models; - -namespace GoAffPro.Client.Events; - -/// -/// Represents a detected order feed event. -/// -public sealed record OrderEvent -{ - /// - /// Initializes a new instance of the record. - /// - /// The detected order payload. - public OrderEvent(GoAffProOrder order) - { - Order = order; - } - - /// - /// Gets the strongly typed order payload. - /// - public GoAffProOrder Order { get; init; } - - /// - /// Gets the unique event identifier. - /// - public string Id => Order.Id; -} diff --git a/src/GoAffPro.Client/Events/PayoutDetectedEventArgs.cs b/src/GoAffPro.Client/Events/PayoutDetectedEventArgs.cs new file mode 100644 index 0000000..86b4d03 --- /dev/null +++ b/src/GoAffPro.Client/Events/PayoutDetectedEventArgs.cs @@ -0,0 +1,23 @@ +using GoAffPro.Client.Generated.Models; + +namespace GoAffPro.Client.Events; + +/// +/// Event arguments for . +/// +public sealed class PayoutDetectedEventArgs : EventArgs +{ + /// + /// Initializes a new instance of the class. + /// + /// Detected payout payload. + public PayoutDetectedEventArgs(UserPayoutFeedItem payout) + { + Payout = payout; + } + + /// + /// Gets the detected payout payload. + /// + public UserPayoutFeedItem Payout { get; } +} diff --git a/src/GoAffPro.Client/Events/ProductDetectedEventArgs.cs b/src/GoAffPro.Client/Events/ProductDetectedEventArgs.cs new file mode 100644 index 0000000..11a0324 --- /dev/null +++ b/src/GoAffPro.Client/Events/ProductDetectedEventArgs.cs @@ -0,0 +1,23 @@ +using GoAffPro.Client.Generated.Models; + +namespace GoAffPro.Client.Events; + +/// +/// Event arguments for . +/// +public sealed class ProductDetectedEventArgs : EventArgs +{ + /// + /// Initializes a new instance of the class. + /// + /// Detected product payload. + public ProductDetectedEventArgs(UserProductFeedItem product) + { + Product = product; + } + + /// + /// Gets the detected product payload. + /// + public UserProductFeedItem Product { get; } +} diff --git a/src/GoAffPro.Client/Events/RewardDetectedEventArgs.cs b/src/GoAffPro.Client/Events/RewardDetectedEventArgs.cs index 0c0d475..decc5c5 100644 --- a/src/GoAffPro.Client/Events/RewardDetectedEventArgs.cs +++ b/src/GoAffPro.Client/Events/RewardDetectedEventArgs.cs @@ -1,9 +1,9 @@ -using GoAffPro.Client.Models; +using GoAffPro.Client.Generated.Models; namespace GoAffPro.Client.Events; /// -/// Event arguments for . +/// Event arguments for . /// /// /// Reward feed detection is currently disabled because /user/feed/rewards @@ -15,7 +15,7 @@ public sealed class RewardDetectedEventArgs : EventArgs /// Initializes a new instance of the class. /// /// Detected reward payload. - public RewardDetectedEventArgs(GoAffProReward reward) + public RewardDetectedEventArgs(UserRewardFeedItem reward) { Reward = reward; } @@ -23,5 +23,5 @@ public RewardDetectedEventArgs(GoAffProReward reward) /// /// Gets the detected reward payload. /// - public GoAffProReward Reward { get; } + public UserRewardFeedItem Reward { get; } } diff --git a/src/GoAffPro.Client/Events/RewardEvent.cs b/src/GoAffPro.Client/Events/RewardEvent.cs deleted file mode 100644 index 6ab236a..0000000 --- a/src/GoAffPro.Client/Events/RewardEvent.cs +++ /dev/null @@ -1,32 +0,0 @@ -using GoAffPro.Client.Models; - -namespace GoAffPro.Client.Events; - -/// -/// Represents a detected reward feed event. -/// -/// -/// Reward feed detection is currently disabled because /user/feed/rewards -/// is returning HTTP 404 as observed on 2026-02-18. -/// -public sealed record RewardEvent -{ - /// - /// Initializes a new instance of the record. - /// - /// The detected reward payload. - public RewardEvent(GoAffProReward reward) - { - Reward = reward; - } - - /// - /// Gets the strongly typed reward payload. - /// - public GoAffProReward Reward { get; init; } - - /// - /// Gets the unique event identifier. - /// - public string Id => Reward.Id; -} diff --git a/src/GoAffPro.Client/Events/TransactionDetectedEventArgs.cs b/src/GoAffPro.Client/Events/TransactionDetectedEventArgs.cs new file mode 100644 index 0000000..e898025 --- /dev/null +++ b/src/GoAffPro.Client/Events/TransactionDetectedEventArgs.cs @@ -0,0 +1,23 @@ +using GoAffPro.Client.Generated.Models; + +namespace GoAffPro.Client.Events; + +/// +/// Event arguments for . +/// +public sealed class TransactionDetectedEventArgs : EventArgs +{ + /// + /// Initializes a new instance of the class. + /// + /// Detected transaction payload. + public TransactionDetectedEventArgs(UserTransactionItem transaction) + { + Transaction = transaction; + } + + /// + /// Gets the detected transaction payload. + /// + public UserTransactionItem Transaction { get; } +} diff --git a/src/GoAffPro.Client/GoAffProClient.cs b/src/GoAffPro.Client/GoAffProClient.cs index 5970733..39eaf08 100644 --- a/src/GoAffPro.Client/GoAffProClient.cs +++ b/src/GoAffPro.Client/GoAffProClient.cs @@ -1,22 +1,25 @@ using System.Globalization; using System.Net; using System.Net.Http.Headers; -using System.Text.Json; +using GoAffPro.Client.Events; using GoAffPro.Client.Exceptions; -using GoAffPro.Client.Models; +using GoAffPro.Client.Generated.Models; using GoAffPro.Client.Policies; using Microsoft.Extensions.Http; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Abstractions.Authentication; +using Microsoft.Kiota.Http.HttpClientLibrary; namespace GoAffPro.Client; /// -/// High-level GoAffPro API client that wraps generated NSwag clients and provides -/// typed feed helpers for common workflows. +/// High-level GoAffPro API client exposing generated Kiota API surface and observer loops. /// public sealed class GoAffProClient : IGoAffProClient { private readonly bool _disposeHttpClient; private readonly HttpClient _httpClient; + private readonly IRequestAdapter _requestAdapter; /// /// Initializes a new client instance with internally managed . @@ -51,15 +54,14 @@ private GoAffProClient(HttpClient httpClient, GoAffProClientOptions options, boo string baseUrl = _httpClient.BaseAddress?.ToString() ?? throw new InvalidOperationException("HttpClient.BaseAddress was not initialized."); - User = new global::GoAffPro.Client.Generated.User.GoAffProUserClient(_httpClient) + IAuthenticationProvider authenticationProvider = new AnonymousAuthenticationProvider(); + _requestAdapter = new HttpClientRequestAdapter(authenticationProvider, httpClient: _httpClient) { - BaseUrl = baseUrl, - }; - PublicApi = new global::GoAffPro.Client.Generated.Public.GoAffProPublicClient(_httpClient) - { - BaseUrl = baseUrl, + BaseUrl = baseUrl.TrimEnd('/'), }; + Api = new global::GoAffPro.Client.Generated.GoAffProApiClient(_requestAdapter); + if (!string.IsNullOrWhiteSpace(options.BearerToken)) { SetBearerToken(options.BearerToken); @@ -67,13 +69,38 @@ private GoAffProClient(HttpClient httpClient, GoAffProClientOptions options, boo } /// - public global::GoAffPro.Client.Generated.User.GoAffProUserClient User { get; } + public global::GoAffPro.Client.Generated.GoAffProApiClient Api { get; } /// - public global::GoAffPro.Client.Generated.Public.GoAffProPublicClient PublicApi { get; } + public string? BearerToken { get; private set; } /// - public string? BearerToken { get; private set; } + public DateTimeOffset? OrderObserverStartTime { get; set; } + + /// + public DateTimeOffset? AffiliateObserverStartTime { get; set; } + + /// + public DateTimeOffset? PayoutObserverStartTime { get; set; } + + /// + public event EventHandler? OrderDetected; + + /// + public event EventHandler? AffiliateDetected; + + /// + public event EventHandler? PayoutDetected; + + /// + public event EventHandler? ProductDetected; + + /// + public event EventHandler? TransactionDetected; + + /// + [Obsolete("Disabled because /user/feed/rewards currently returns HTTP 404 (observed on 2026-02-18).")] + public event EventHandler? RewardDetected; /// /// Creates a new client and logs in immediately using the provided credentials. @@ -98,25 +125,26 @@ public async Task LoginAsync(string email, string password, Cancellation ArgumentException.ThrowIfNullOrWhiteSpace(email); ArgumentException.ThrowIfNullOrWhiteSpace(password); - var request = new global::GoAffPro.Client.Generated.User.Body + var request = new global::GoAffPro.Client.Generated.User.Login.LoginPostRequestBody { Email = email, Password = password, }; - var response = await ExecuteUserAsync( - () => User.UserLoginAsync(request, cancellationToken)) + LoginResponse response = await ExecuteUserAsync( + async () => await Api.User.Login.PostAsync(request, cancellationToken: cancellationToken).ConfigureAwait(false) + ?? new LoginResponse()) .ConfigureAwait(false); - if (string.IsNullOrWhiteSpace(response.Access_token)) + if (string.IsNullOrWhiteSpace(response.AccessToken)) { throw new GoAffProApiException( message: "GoAffPro login response does not contain an access token.", statusCode: HttpStatusCode.OK); } - SetBearerToken(response.Access_token); - return response.Access_token; + SetBearerToken(response.AccessToken); + return response.AccessToken; } /// @@ -129,124 +157,215 @@ public void SetBearerToken(string bearerToken) } /// - public async Task> GetOrdersAsync( - DateTimeOffset? from = null, - DateTimeOffset? toDate = null, - int limit = 100, - int offset = 0, + public async Task StartEventObserverAsync( + TimeSpan? pollingInterval = null, + int pageSize = 100, CancellationToken cancellationToken = default) { - var response = await ExecuteUserAsync( - () => User.UserFeedOrdersAsync( - site_ids: null, - since_id: null, - max_id: null, - created_at_max: toDate?.ToString("o"), - created_at_min: from?.ToString("o"), - fields: [], - limit: limit, - offset: offset, - cancellationToken)) - .ConfigureAwait(false); + int validatedPageSize = ValidatePageSize(pageSize); + TimeSpan interval = pollingInterval ?? TimeSpan.FromSeconds(30); + + // Referenced intentionally so the temporarily-disabled event remains part of the public surface. + _ = RewardDetected; - IEnumerable orderItems = response.Orders is null - ? Array.Empty() - : response.Orders.Select(static item => (object)item); + DateTimeOffset lastOrderPoll = OrderObserverStartTime ?? DateTimeOffset.UtcNow; + DateTimeOffset lastAffiliatePoll = AffiliateObserverStartTime ?? DateTimeOffset.UtcNow; + DateTimeOffset lastPayoutPoll = PayoutObserverStartTime ?? DateTimeOffset.UtcNow; + int? lastProductId = null; + int? lastTransactionId = null; - return MapFeedItems( - orderItems, - TryMapOrder); + while (!cancellationToken.IsCancellationRequested) + { + DateTimeOffset orderTo = DateTimeOffset.UtcNow; + IReadOnlyList orders = await PollOrdersAsync(lastOrderPoll, orderTo, validatedPageSize, cancellationToken).ConfigureAwait(false); + lastOrderPoll = orderTo; + + foreach (UserOrderFeedItem order in orders) + { + OrderDetected?.Invoke(this, new OrderDetectedEventArgs(order)); + } + + DateTimeOffset affiliateTo = DateTimeOffset.UtcNow; + IReadOnlyList affiliates = await PollAffiliatesAsync(lastAffiliatePoll, affiliateTo, validatedPageSize, cancellationToken).ConfigureAwait(false); + lastAffiliatePoll = affiliateTo; + + foreach (UserTrafficFeedItem affiliate in affiliates) + { + AffiliateDetected?.Invoke(this, new AffiliateDetectedEventArgs(affiliate)); + } + + DateTimeOffset payoutTo = DateTimeOffset.UtcNow; + IReadOnlyList payouts = await PollPayoutsAsync(lastPayoutPoll, payoutTo, validatedPageSize, cancellationToken).ConfigureAwait(false); + lastPayoutPoll = payoutTo; + + foreach (UserPayoutFeedItem payout in payouts) + { + PayoutDetected?.Invoke(this, new PayoutDetectedEventArgs(payout)); + } + + (IReadOnlyList products, int? nextProductId) = await PollProductsAsync( + lastProductId, + validatedPageSize, + cancellationToken).ConfigureAwait(false); + lastProductId = nextProductId; + + foreach (UserProductFeedItem product in products) + { + ProductDetected?.Invoke(this, new ProductDetectedEventArgs(product)); + } + + (IReadOnlyList transactions, int? nextTransactionId) = await PollTransactionsAsync( + lastTransactionId, + validatedPageSize, + cancellationToken).ConfigureAwait(false); + lastTransactionId = nextTransactionId; + + foreach (UserTransactionItem transaction in transactions) + { + TransactionDetected?.Invoke(this, new TransactionDetectedEventArgs(transaction)); + } + + await Task.Delay(interval, cancellationToken).ConfigureAwait(false); + } } /// - public async Task> GetAffiliatesAsync( - DateTimeOffset? from = null, - DateTimeOffset? toDate = null, - int limit = 100, - int offset = 0, - CancellationToken cancellationToken = default) + public async IAsyncEnumerable NewOrdersAsync( + TimeSpan? pollingInterval = null, + int pageSize = 100, + [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken = default) { - var response = await ExecuteUserAsync( - () => User.UserFeedTrafficAsync( - site_ids: null, - start_time: from?.ToString("o"), - end_time: toDate?.ToString("o"), - since_id: null, - limit: limit, - offset: offset, - cancellationToken)) - .ConfigureAwait(false); + int validatedPageSize = ValidatePageSize(pageSize); + TimeSpan interval = pollingInterval ?? TimeSpan.FromSeconds(30); + + DateTimeOffset lastPoll = OrderObserverStartTime ?? DateTimeOffset.UtcNow; + while (!cancellationToken.IsCancellationRequested) + { + DateTimeOffset to = DateTimeOffset.UtcNow; + IReadOnlyList orders = await PollOrdersAsync(lastPoll, to, validatedPageSize, cancellationToken).ConfigureAwait(false); + lastPoll = to; - IEnumerable trafficItems = response.Traffic is null - ? Array.Empty() - : response.Traffic.Select(static item => (object)item); + foreach (UserOrderFeedItem order in orders) + { + yield return order; + } - return MapFeedItems( - trafficItems, - TryMapAffiliate); + await Task.Delay(interval, cancellationToken).ConfigureAwait(false); + } } /// - [Obsolete("Disabled because /user/feed/rewards currently returns HTTP 404 (observed on 2026-02-18).")] - public Task> GetRewardsAsync( - DateTimeOffset? from = null, - DateTimeOffset? toDate = null, - int limit = 100, - int offset = 0, - CancellationToken cancellationToken = default) + public async IAsyncEnumerable NewAffiliatesAsync( + TimeSpan? pollingInterval = null, + int pageSize = 100, + [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken = default) { - _ = from; - _ = toDate; - _ = limit; - _ = offset; - _ = cancellationToken; - return Task.FromResult>(Array.Empty()); + int validatedPageSize = ValidatePageSize(pageSize); + TimeSpan interval = pollingInterval ?? TimeSpan.FromSeconds(30); + + DateTimeOffset lastPoll = AffiliateObserverStartTime ?? DateTimeOffset.UtcNow; + while (!cancellationToken.IsCancellationRequested) + { + DateTimeOffset to = DateTimeOffset.UtcNow; + IReadOnlyList affiliates = await PollAffiliatesAsync(lastPoll, to, validatedPageSize, cancellationToken).ConfigureAwait(false); + lastPoll = to; + + foreach (UserTrafficFeedItem affiliate in affiliates) + { + yield return affiliate; + } + + await Task.Delay(interval, cancellationToken).ConfigureAwait(false); + } } /// - public async Task> GetPayoutsAsync( - DateTimeOffset? from = null, - DateTimeOffset? toDate = null, - int limit = 100, - int offset = 0, - CancellationToken cancellationToken = default) + public async IAsyncEnumerable NewPayoutsAsync( + TimeSpan? pollingInterval = null, + int pageSize = 100, + [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken = default) { - var response = await ExecuteUserAsync( - () => User.UserFeedPayoutsAsync( - site_ids: null, - start_time: from?.ToString("o"), - end_time: toDate?.ToString("o"), - since_id: null, - limit: limit, - offset: offset, - cancellationToken)) - .ConfigureAwait(false); + int validatedPageSize = ValidatePageSize(pageSize); + TimeSpan interval = pollingInterval ?? TimeSpan.FromSeconds(30); + + DateTimeOffset lastPoll = PayoutObserverStartTime ?? DateTimeOffset.UtcNow; + while (!cancellationToken.IsCancellationRequested) + { + DateTimeOffset to = DateTimeOffset.UtcNow; + IReadOnlyList payouts = await PollPayoutsAsync(lastPoll, to, validatedPageSize, cancellationToken).ConfigureAwait(false); + lastPoll = to; - IEnumerable payoutItems = response.Payouts is null - ? Array.Empty() - : response.Payouts; + foreach (UserPayoutFeedItem payout in payouts) + { + yield return payout; + } - return MapFeedItems(payoutItems, TryMapPayout); + await Task.Delay(interval, cancellationToken).ConfigureAwait(false); + } } /// - public async Task> GetProductsAsync( - int limit = 100, - int offset = 0, - CancellationToken cancellationToken = default) + public async IAsyncEnumerable NewProductsAsync( + TimeSpan? pollingInterval = null, + int pageSize = 100, + [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken = default) { - var response = await ExecuteUserAsync( - () => User.UserFeedProductsAsync( - limit: limit, - offset: offset, - cancellationToken: cancellationToken)) - .ConfigureAwait(false); + int validatedPageSize = ValidatePageSize(pageSize); + TimeSpan interval = pollingInterval ?? TimeSpan.FromSeconds(30); + int? lastProductId = null; + + while (!cancellationToken.IsCancellationRequested) + { + (IReadOnlyList products, int? nextProductId) = await PollProductsAsync( + lastProductId, + validatedPageSize, + cancellationToken).ConfigureAwait(false); + lastProductId = nextProductId; + + foreach (UserProductFeedItem product in products) + { + yield return product; + } + + await Task.Delay(interval, cancellationToken).ConfigureAwait(false); + } + } - IEnumerable productItems = response.Products is null - ? Array.Empty() - : response.Products; + /// + public async IAsyncEnumerable NewTransactionsAsync( + TimeSpan? pollingInterval = null, + int pageSize = 100, + [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken = default) + { + int validatedPageSize = ValidatePageSize(pageSize); + TimeSpan interval = pollingInterval ?? TimeSpan.FromSeconds(30); + int? lastTransactionId = null; - return MapFeedItems(productItems, TryMapProduct); + while (!cancellationToken.IsCancellationRequested) + { + (IReadOnlyList transactions, int? nextTransactionId) = await PollTransactionsAsync( + lastTransactionId, + validatedPageSize, + cancellationToken).ConfigureAwait(false); + lastTransactionId = nextTransactionId; + + foreach (UserTransactionItem transaction in transactions) + { + yield return transaction; + } + + await Task.Delay(interval, cancellationToken).ConfigureAwait(false); + } + } + + /// + [Obsolete("Disabled because /user/feed/rewards currently returns HTTP 404 (observed on 2026-02-18).")] + public async IAsyncEnumerable NewRewardsAsync( + [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken = default) + { + _ = cancellationToken; + await Task.CompletedTask.ConfigureAwait(false); + yield break; } /// @@ -256,6 +375,11 @@ public void Dispose() { if (_disposeHttpClient) { + if (_requestAdapter is IDisposable disposableAdapter) + { + disposableAdapter.Dispose(); + } + _httpClient.Dispose(); } } @@ -268,6 +392,11 @@ public ValueTask DisposeAsync() { if (_disposeHttpClient) { + if (_requestAdapter is IDisposable disposableAdapter) + { + disposableAdapter.Dispose(); + } + _httpClient.Dispose(); } @@ -285,287 +414,213 @@ internal static Uri BuildBaseUri(Uri? baseUrl) return new Uri(normalized, UriKind.Absolute); } - private static HttpClient CreateHttpClient(GoAffProClientOptions options) + private async Task> PollOrdersAsync( + DateTimeOffset from, + DateTimeOffset to, + int pageSize, + CancellationToken cancellationToken) { - // Ownership is transferred to HttpClient through the constructor. -#pragma warning disable CA2000 - PolicyHttpMessageHandler policyHandler = new(RetryPolicies.CreateCompositePolicy()) - { - InnerHandler = new HttpClientHandler(), - }; -#pragma warning restore CA2000 + UserOrderFeedResponse response = await ExecuteUserAsync(async () => + await Api.User.Feed.Orders.GetAsync(config => + { + config.QueryParameters.CreatedAtMin = from.ToString("o"); + config.QueryParameters.CreatedAtMax = to.ToString("o"); + config.QueryParameters.Limit = pageSize; + config.QueryParameters.Offset = 0; + }, cancellationToken).ConfigureAwait(false) + ?? new UserOrderFeedResponse()).ConfigureAwait(false); + + return response.Orders is null || response.Orders.Count == 0 ? [] : (IReadOnlyList)response.Orders; + } - HttpClient client = new(policyHandler, disposeHandler: true) - { - BaseAddress = BuildBaseUri(options.BaseUrl), - Timeout = options.Timeout - }; - return client; + private async Task> PollAffiliatesAsync( + DateTimeOffset from, + DateTimeOffset to, + int pageSize, + CancellationToken cancellationToken) + { + UserTrafficFeedResponse response = await ExecuteUserAsync(async () => + await Api.User.Feed.Traffic.GetAsync(config => + { + config.QueryParameters.StartTime = from.ToString("o"); + config.QueryParameters.EndTime = to.ToString("o"); + config.QueryParameters.Limit = pageSize; + config.QueryParameters.Offset = 0; + }, cancellationToken).ConfigureAwait(false) + ?? new UserTrafficFeedResponse()).ConfigureAwait(false); + + return response.Traffic is null || response.Traffic.Count == 0 ? [] : (IReadOnlyList)response.Traffic; } - private static GoAffProClientOptions ValidateOptions(GoAffProClientOptions options) + private async Task> PollPayoutsAsync( + DateTimeOffset from, + DateTimeOffset to, + int pageSize, + CancellationToken cancellationToken) { - ArgumentNullException.ThrowIfNull(options); - return options; + UserPayoutFeedResponse response = await ExecuteUserAsync(async () => + await Api.User.Feed.Payouts.GetAsync(config => + { + config.QueryParameters.StartTime = from.ToString("o"); + config.QueryParameters.EndTime = to.ToString("o"); + config.QueryParameters.Limit = pageSize; + config.QueryParameters.Offset = 0; + }, cancellationToken).ConfigureAwait(false) + ?? new UserPayoutFeedResponse()).ConfigureAwait(false); + + return response.Payouts is null || response.Payouts.Count == 0 ? [] : (IReadOnlyList)response.Payouts; } - private static async Task ExecuteUserAsync(Func> action) + private async Task<(IReadOnlyList Products, int? NextProductId)> PollProductsAsync( + int? lastProductId, + int pageSize, + CancellationToken cancellationToken) { - try + UserProductFeedResponse response = await ExecuteUserAsync(async () => + await Api.User.Feed.Products.GetAsync(config => + { + config.QueryParameters.Limit = pageSize; + config.QueryParameters.Offset = 0; + }, cancellationToken).ConfigureAwait(false) + ?? new UserProductFeedResponse()).ConfigureAwait(false); + + if (response.Products is null || response.Products.Count == 0) { - return await action().ConfigureAwait(false); + return ([], lastProductId); } - catch (global::GoAffPro.Client.Generated.User.GoAffProUserClientApiException exception) + + int? maxProductId = response.Products + .Select(item => ToInt(item.ProductId) ?? ToInt(item.Id)) + .Where(static value => value.HasValue) + .Select(static value => value!.Value) + .DefaultIfEmpty(lastProductId ?? int.MinValue) + .Max(); + + if (!lastProductId.HasValue) { - throw ConvertUserException(exception); + return ([], maxProductId == int.MinValue ? null : maxProductId); } - } - private static GoAffProApiException ConvertUserException(global::GoAffPro.Client.Generated.User.GoAffProUserClientApiException exception) - { - HttpStatusCode statusCode = Enum.IsDefined(typeof(HttpStatusCode), exception.StatusCode) - ? (HttpStatusCode)exception.StatusCode - : HttpStatusCode.InternalServerError; - - return new GoAffProApiException( - message: exception.Message, - statusCode: statusCode, - responseBody: exception.Response, - innerException: exception); + var products = response.Products + .Where(item => + { + int? id = ToInt(item.ProductId) ?? ToInt(item.Id); + return id.HasValue && id.Value > lastProductId.Value; + }) + .OrderBy(item => (ToInt(item.ProductId) ?? ToInt(item.Id)) ?? int.MinValue) + .ToList(); + + int? next = maxProductId == int.MinValue ? lastProductId : maxProductId; + return (products, next); } - private static List MapFeedItems( - IEnumerable items, - Func map) - where TModel : class + private async Task<(IReadOnlyList Transactions, int? NextTransactionId)> PollTransactionsAsync( + int? lastTransactionId, + int pageSize, + CancellationToken cancellationToken) { - var results = new List(); - foreach (object item in items) - { - JsonElement payload = item is JsonElement jsonElement - ? jsonElement.Clone() - : JsonSerializer.SerializeToElement(item); - - TModel? mapped = map(payload); - if (mapped is null) + UserTransactionFeedResponse response = await ExecuteUserAsync(async () => + await Api.User.Feed.Transactions.GetAsync(config => { - continue; - } + config.QueryParameters.Limit = pageSize; + config.QueryParameters.Offset = 0; + }, cancellationToken).ConfigureAwait(false) + ?? new UserTransactionFeedResponse()).ConfigureAwait(false); - results.Add(mapped); + if (response.Transactions is null || response.Transactions.Count == 0) + { + return ([], lastTransactionId); } - return results; - } + int? maxTransactionId = response.Transactions + .Select(item => item.TxId) + .Where(static value => value.HasValue) + .Select(static value => value!.Value) + .DefaultIfEmpty(lastTransactionId ?? int.MinValue) + .Max(); - private static GoAffProOrder? TryMapOrder(JsonElement payload) - { - string? id = TryExtractId(payload, ["id", "order_id"]); - return string.IsNullOrWhiteSpace(id) - ? null - : new GoAffProOrder( - id: id, - number: TryGetString(payload, "number"), - total: TryGetDecimal(payload, "total"), - subtotal: TryGetDecimal(payload, "subtotal"), - affiliateId: TryGetString(payload, "affiliate_id"), - commission: TryGetDecimal(payload, "commission"), - status: TryGetString(payload, "status"), - currency: TryGetString(payload, "currency"), - createdAt: TryGetDateTimeOffset(payload, "created_at", "created"), - rawPayload: payload); - } + if (!lastTransactionId.HasValue) + { + return ([], maxTransactionId == int.MinValue ? null : maxTransactionId); + } - private static GoAffProAffiliate? TryMapAffiliate(JsonElement payload) - { - string? id = TryExtractId(payload, ["affiliate_id", "id", "customer_id"]); - return string.IsNullOrWhiteSpace(id) - ? null - : new GoAffProAffiliate( - id: id, - name: TryGetString(payload, "name"), - firstName: TryGetString(payload, "first_name"), - lastName: TryGetString(payload, "last_name"), - email: TryGetString(payload, "email"), - customerId: TryGetString(payload, "customer_id"), - refCode: TryGetString(payload, "ref_code"), - phone: TryGetString(payload, "phone"), - country: TryGetString(payload, "country"), - groupId: TryGetInt32(payload, "group_id"), - createdAt: TryGetDateTimeOffset(payload, "created_at", "created"), - rawPayload: payload); - } + var transactions = response.Transactions + .Where(item => item.TxId.HasValue && item.TxId.Value > lastTransactionId.Value) + .OrderBy(item => item.TxId ?? int.MinValue) + .ToList(); - private static GoAffProReward? TryMapReward(JsonElement payload) - { - string? id = TryExtractId(payload, ["id", "reward_id"]); - return string.IsNullOrWhiteSpace(id) - ? null - : new GoAffProReward( - id: id, - affiliateId: TryGetString(payload, "affiliate_id"), - orderId: TryGetString(payload, "order_id"), - type: TryGetString(payload, "type"), - metadata: TryGetString(payload, "metadata"), - level: TryGetInt32(payload, "level"), - amount: TryGetDecimal(payload, "amount"), - status: TryGetString(payload, "status"), - currency: TryGetString(payload, "currency"), - createdAt: TryGetDateTimeOffset(payload, "created_at", "created"), - rawPayload: payload); + int? next = maxTransactionId == int.MinValue ? lastTransactionId : maxTransactionId; + return (transactions, next); } - private static GoAffProPayout? TryMapPayout(JsonElement payload) + private static int? ToInt(UserProductFeedItem.UserProductFeedItem_product_id? value) { - string? id = TryExtractId(payload, ["id", "payout_id"]); - return string.IsNullOrWhiteSpace(id) - ? null - : new GoAffProPayout( - id: id, - affiliateId: TryGetString(payload, "affiliate_id"), - amount: TryGetDecimal(payload, "amount"), - status: TryGetString(payload, "status"), - paymentMethod: TryGetString(payload, "payment_method"), - transactionId: TryGetString(payload, "transaction_id"), - currency: TryGetString(payload, "currency"), - createdAt: TryGetDateTimeOffset(payload, "created_at", "created"), - rawPayload: payload); + return value?.Integer.HasValue == true + ? value.Integer.Value + : int.TryParse(value?.String, NumberStyles.Integer, CultureInfo.InvariantCulture, out int parsed) ? parsed : null; } - private static GoAffProProduct? TryMapProduct(JsonElement payload) + private static int? ToInt(UserProductFeedItem.UserProductFeedItem_id? value) { - string? id = TryExtractId(payload, ["id", "product_id"]); - return string.IsNullOrWhiteSpace(id) - ? null - : new GoAffProProduct( - id: id, - name: TryGetString(payload, "name"), - description: TryGetString(payload, "description"), - price: TryGetDecimal(payload, "price"), - salePrice: TryGetDecimal(payload, "sale_price"), - imageUrl: TryGetString(payload, "image_url"), - productUrl: TryGetString(payload, "product_url"), - category: TryGetString(payload, "category"), - sku: TryGetString(payload, "sku"), - currency: TryGetString(payload, "currency"), - rawPayload: payload); + return value?.Integer.HasValue == true + ? value.Integer.Value + : int.TryParse(value?.String, NumberStyles.Integer, CultureInfo.InvariantCulture, out int parsed) ? parsed : null; } - private static string? TryExtractId(JsonElement item, IReadOnlyCollection candidates) + private static HttpClient CreateHttpClient(GoAffProClientOptions options) { - if (item.ValueKind != JsonValueKind.Object) + // Ownership is transferred to HttpClient through the constructor. +#pragma warning disable CA2000 + PolicyHttpMessageHandler policyHandler = new(RetryPolicies.CreateCompositePolicy()) { - return null; - } + InnerHandler = new HttpClientHandler(), + }; +#pragma warning restore CA2000 - foreach (string candidate in candidates) + HttpClient client = new(policyHandler, disposeHandler: true) { - if (!TryGetProperty(item, candidate, out JsonElement value)) - { - continue; - } - - if (value.ValueKind == JsonValueKind.String) - { - string? stringValue = value.GetString(); - if (!string.IsNullOrWhiteSpace(stringValue)) - { - return stringValue; - } - } - else if (value.ValueKind is JsonValueKind.Number or JsonValueKind.True or JsonValueKind.False) - { - return value.ToString(); - } - } - - return null; - } - - private static string? TryGetString(JsonElement item, string propertyName) - { - return !TryGetProperty(item, propertyName, out JsonElement value) - ? null - : value.ValueKind switch - { - JsonValueKind.String => value.GetString(), - JsonValueKind.Number or JsonValueKind.True or JsonValueKind.False => value.ToString(), - _ => null, - }; - } - - private static decimal? TryGetDecimal(JsonElement item, string propertyName) - { - return !TryGetProperty(item, propertyName, out JsonElement value) - ? null - : value.ValueKind == JsonValueKind.Number && value.TryGetDecimal(out decimal decimalValue) - ? decimalValue - : value.ValueKind == JsonValueKind.String - && decimal.TryParse(value.GetString(), NumberStyles.Float, CultureInfo.InvariantCulture, out decimal parsed) - ? parsed - : null; + BaseAddress = BuildBaseUri(options.BaseUrl), + Timeout = options.Timeout + }; + return client; } - private static int? TryGetInt32(JsonElement item, string propertyName) + private static GoAffProClientOptions ValidateOptions(GoAffProClientOptions options) { - return !TryGetProperty(item, propertyName, out JsonElement value) - ? null - : value.ValueKind == JsonValueKind.Number && value.TryGetInt32(out int intValue) - ? intValue - : value.ValueKind == JsonValueKind.String - && int.TryParse(value.GetString(), NumberStyles.Integer, CultureInfo.InvariantCulture, out int parsed) - ? parsed - : null; + ArgumentNullException.ThrowIfNull(options); + return options; } - private static DateTimeOffset? TryGetDateTimeOffset(JsonElement item, params string[] propertyNames) + private static int ValidatePageSize(int pageSize) { - foreach (string propertyName in propertyNames) - { - if (!TryGetProperty(item, propertyName, out JsonElement value)) - { - continue; - } - - if (value.ValueKind == JsonValueKind.String - && DateTimeOffset.TryParse(value.GetString(), CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out DateTimeOffset parsed)) - { - return parsed; - } - - if (value.ValueKind == JsonValueKind.Number && value.TryGetInt64(out long unix)) - { - // GoAffPro can return unix timestamp values in seconds. - return DateTimeOffset.FromUnixTimeSeconds(unix); - } - } - - return null; + return pageSize <= 0 + ? throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "Page size must be greater than zero.") + : pageSize; } - private static bool TryGetProperty(JsonElement item, string propertyName, out JsonElement value) + private static async Task ExecuteUserAsync(Func> action) { - if (item.ValueKind != JsonValueKind.Object) + try { - value = default; - return false; + return await action().ConfigureAwait(false); } - - if (item.TryGetProperty(propertyName, out value)) + catch (ApiException exception) { - return true; + throw ConvertUserException(exception); } + } - foreach (JsonProperty property in item.EnumerateObject()) - { - if (string.Equals(property.Name, propertyName, StringComparison.OrdinalIgnoreCase)) - { - value = property.Value; - return true; - } - } + private static GoAffProApiException ConvertUserException(ApiException exception) + { + int statusCodeValue = exception.ResponseStatusCode; + HttpStatusCode statusCode = Enum.IsDefined(typeof(HttpStatusCode), statusCodeValue) + ? (HttpStatusCode)statusCodeValue + : HttpStatusCode.InternalServerError; - value = default; - return false; + return new GoAffProApiException( + message: exception.Message, + statusCode: statusCode, + responseBody: null, + innerException: exception); } } diff --git a/src/GoAffPro.Client/IGoAffProClient.cs b/src/GoAffPro.Client/IGoAffProClient.cs index 55100ce..2840727 100644 --- a/src/GoAffPro.Client/IGoAffProClient.cs +++ b/src/GoAffPro.Client/IGoAffProClient.cs @@ -1,7 +1,10 @@ +using GoAffPro.Client.Events; +using GoAffPro.Client.Generated.Models; + namespace GoAffPro.Client; /// -/// Defines the high-level GoAffPro client API used by the library wrapper and event detector. +/// Defines the high-level GoAffPro client API used by the wrapper and event observer loops. /// public interface IGoAffProClient : IDisposable, IAsyncDisposable { @@ -11,14 +14,58 @@ public interface IGoAffProClient : IDisposable, IAsyncDisposable string? BearerToken { get; } /// - /// Gets the generated NSwag client for /user/* endpoints. + /// Gets the generated Kiota API client root for all GoAffPro endpoints. + /// + global::GoAffPro.Client.Generated.GoAffProApiClient Api { get; } + + /// + /// Gets or sets the starting timestamp for order observer polling. + /// + DateTimeOffset? OrderObserverStartTime { get; set; } + + /// + /// Gets or sets the starting timestamp for affiliate observer polling. + /// + DateTimeOffset? AffiliateObserverStartTime { get; set; } + + /// + /// Gets or sets the starting timestamp for payout observer polling. + /// + DateTimeOffset? PayoutObserverStartTime { get; set; } + + /// + /// Raised when a new order item is detected in observer mode. + /// + event EventHandler? OrderDetected; + + /// + /// Raised when a new affiliate/traffic item is detected in observer mode. + /// + event EventHandler? AffiliateDetected; + + /// + /// Raised when a new payout item is detected in observer mode. + /// + event EventHandler? PayoutDetected; + + /// + /// Raised when a new product item is detected in observer mode. + /// + event EventHandler? ProductDetected; + + /// + /// Raised when a new transaction item is detected in observer mode. /// - global::GoAffPro.Client.Generated.User.GoAffProUserClient User { get; } + event EventHandler? TransactionDetected; /// - /// Gets the generated NSwag client for /public/* endpoints. + /// Raised when a new reward item is detected. /// - global::GoAffPro.Client.Generated.Public.GoAffProPublicClient PublicApi { get; } + /// + /// Currently disabled because /user/feed/rewards returns 404. + /// + [Obsolete("Disabled because /user/feed/rewards currently returns HTTP 404 (observed on 2026-02-18).")] + event EventHandler? RewardDetected; /// /// Authenticates with email/password and stores the returned bearer token for subsequent requests. @@ -36,83 +83,62 @@ public interface IGoAffProClient : IDisposable, IAsyncDisposable void SetBearerToken(string bearerToken); /// - /// Fetches order feed items from /user/feed/orders. + /// Starts continuous polling and raises observer events for new feed items. /// - /// Filter orders created on or after this timestamp. - /// Filter orders created on or before this timestamp. - /// Maximum number of records to request. - /// Offset into the feed result set. - /// Cancellation token for the HTTP request. - /// Mapped order feed records. - Task> GetOrdersAsync( - DateTimeOffset? from = null, - DateTimeOffset? toDate = null, - int limit = 100, - int offset = 0, + /// Polling interval. Defaults to 30 seconds. + /// Number of records requested per poll. + /// Cancellation token used to stop polling. + Task StartEventObserverAsync( + TimeSpan? pollingInterval = null, + int pageSize = 100, CancellationToken cancellationToken = default); /// - /// Fetches traffic/affiliate feed items from /user/feed/traffic. + /// Streams newly detected order feed events using time-window polling. /// - /// Filter traffic created on or after this timestamp. - /// Filter traffic created on or before this timestamp. - /// Maximum number of records to request. - /// Offset into the feed result set. - /// Cancellation token for the HTTP request. - /// Mapped affiliate feed records. - Task> GetAffiliatesAsync( - DateTimeOffset? from = null, - DateTimeOffset? toDate = null, - int limit = 100, - int offset = 0, + IAsyncEnumerable NewOrdersAsync( + TimeSpan? pollingInterval = null, + int pageSize = 100, CancellationToken cancellationToken = default); /// - /// Fetches reward feed items from /user/feed/rewards. + /// Streams newly detected affiliate feed events using time-window polling. /// - /// Filter rewards created on or after this timestamp. - /// Filter rewards created on or before this timestamp. - /// Maximum number of records to request. - /// Offset into the feed result set. - /// Cancellation token for the HTTP request. - /// Mapped reward feed records. - /// - /// This method is currently disabled because the endpoint is returning HTTP 404 - /// as observed on 2026-02-18. - /// - [Obsolete("Disabled because /user/feed/rewards currently returns HTTP 404 (observed on 2026-02-18).")] - Task> GetRewardsAsync( - DateTimeOffset? from = null, - DateTimeOffset? toDate = null, - int limit = 100, - int offset = 0, + IAsyncEnumerable NewAffiliatesAsync( + TimeSpan? pollingInterval = null, + int pageSize = 100, CancellationToken cancellationToken = default); /// - /// Fetches payout feed items from /user/feed/payouts. + /// Streams newly detected payout feed events using time-window polling. /// - /// Filter payouts created on or after this timestamp. - /// Filter payouts created on or before this timestamp. - /// Maximum number of records to request. - /// Offset into the feed result set. - /// Cancellation token for the HTTP request. - /// Mapped payout feed records. - Task> GetPayoutsAsync( - DateTimeOffset? from = null, - DateTimeOffset? toDate = null, - int limit = 100, - int offset = 0, + IAsyncEnumerable NewPayoutsAsync( + TimeSpan? pollingInterval = null, + int pageSize = 100, CancellationToken cancellationToken = default); /// - /// Fetches product feed items from /user/feed/products. + /// Streams newly detected products by polling the first page and comparing incremental IDs. /// - /// Maximum number of records to request. - /// Offset into the feed result set. - /// Cancellation token for the HTTP request. - /// Mapped product feed records. - Task> GetProductsAsync( - int limit = 100, - int offset = 0, + IAsyncEnumerable NewProductsAsync( + TimeSpan? pollingInterval = null, + int pageSize = 100, + CancellationToken cancellationToken = default); + + /// + /// Streams newly detected transactions by polling the first page and comparing incremental transaction IDs. + /// + IAsyncEnumerable NewTransactionsAsync( + TimeSpan? pollingInterval = null, + int pageSize = 100, CancellationToken cancellationToken = default); + + /// + /// Streams newly detected reward feed events. + /// + /// + /// Currently disabled because /user/feed/rewards returns 404. + /// + [Obsolete("Disabled because /user/feed/rewards currently returns HTTP 404 (observed on 2026-02-18).")] + IAsyncEnumerable NewRewardsAsync(CancellationToken cancellationToken = default); } diff --git a/tests/GoAffPro.Client.Tests/GoAffProEventDetectorTests.cs b/tests/GoAffPro.Client.Tests/GoAffProEventDetectorTests.cs index 7118539..dc02256 100644 --- a/tests/GoAffPro.Client.Tests/GoAffProEventDetectorTests.cs +++ b/tests/GoAffPro.Client.Tests/GoAffProEventDetectorTests.cs @@ -1,5 +1,5 @@ using FluentAssertions; -using GoAffPro.Client.Events; +using GoAffPro.Client.Generated.Models; namespace GoAffPro.Client.Tests; @@ -8,8 +8,6 @@ public sealed class GoAffProEventDetectorTests [Fact] public async Task NewOrdersAsync_TracksLastPollTime() { - DateTimeOffset? firstCallTime = null; - DateTimeOffset? secondCallTime = null; int ordersCallCount = 0; using var handler = new TestHttpMessageHandler((request, _) => @@ -17,32 +15,23 @@ public async Task NewOrdersAsync_TracksLastPollTime() if (request.RequestUri!.AbsolutePath.EndsWith("/user/feed/orders", StringComparison.OrdinalIgnoreCase)) { ordersCallCount++; - if (ordersCallCount == 1) - { - firstCallTime = DateTimeOffset.UtcNow; - return TestHttpMessageHandler.JsonResponse("""{"orders":[{"id":"o-1"}]}"""); - } - else - { - secondCallTime = DateTimeOffset.UtcNow; - Uri uri = request.RequestUri; - return TestHttpMessageHandler.JsonResponse("""{"orders":[]}"""); - } + return ordersCallCount == 1 + ? TestHttpMessageHandler.JsonResponse("""{"orders":[{"id":"o-1"}],"count":1,"limit":100,"offset":0}""") + : TestHttpMessageHandler.JsonResponse("""{"orders":[],"count":0,"limit":100,"offset":0}"""); } - return TestHttpMessageHandler.JsonResponse("""{"orders":[]}"""); + return TestHttpMessageHandler.JsonResponse("""{"orders":[],"count":0,"limit":100,"offset":0}"""); }); using var httpClient = new HttpClient(handler); using var client = new GoAffProClient(httpClient, new GoAffProClientOptions { BaseUrl = new Uri("https://example.test/v1/", UriKind.Absolute) }); - var detector = new GoAffProEventDetector(client, pollingInterval: TimeSpan.FromMilliseconds(5), pageSize: 100); - IReadOnlyList firstBatch = await TakeAsync(detector.NewOrdersAsync(), expectedCount: 1); + IReadOnlyList firstBatch = await TakeAsync(client.NewOrdersAsync(pollingInterval: TimeSpan.FromMilliseconds(5), pageSize: 100), expectedCount: 1); await Task.Delay(10); - IReadOnlyList secondBatch = await TakeAsync(detector.NewOrdersAsync(), expectedCount: 1); + IReadOnlyList secondBatch = await TakeAsync(client.NewOrdersAsync(pollingInterval: TimeSpan.FromMilliseconds(5), pageSize: 100), expectedCount: 1); _ = firstBatch.Count.Should().Be(1); - _ = firstBatch[0].Id.Should().Be("o-1"); + _ = firstBatch[0].Id?.String.Should().Be("o-1"); _ = secondBatch.Count.Should().Be(0); } @@ -57,21 +46,20 @@ public async Task NewAffiliatesAsync_TracksLastPollTime() { trafficCallCount++; return trafficCallCount == 1 - ? TestHttpMessageHandler.JsonResponse("""{"traffic":[{"affiliate_id":"a-1"}]}""") - : TestHttpMessageHandler.JsonResponse("""{"traffic":[]}"""); + ? TestHttpMessageHandler.JsonResponse("""{"traffic":[{"affiliate_id":"a-1"}],"count":1,"limit":100,"offset":0}""") + : TestHttpMessageHandler.JsonResponse("""{"traffic":[],"count":0,"limit":100,"offset":0}"""); } - return TestHttpMessageHandler.JsonResponse("""{"traffic":[]}"""); + return TestHttpMessageHandler.JsonResponse("""{"traffic":[],"count":0,"limit":100,"offset":0}"""); }); using var httpClient = new HttpClient(handler); using var client = new GoAffProClient(httpClient, new GoAffProClientOptions { BaseUrl = new Uri("https://example.test/v1/", UriKind.Absolute) }); - var detector = new GoAffProEventDetector(client, pollingInterval: TimeSpan.FromMilliseconds(5), pageSize: 100); - IReadOnlyList events = await TakeAsync(detector.NewAffiliatesAsync(), expectedCount: 1); + IReadOnlyList events = await TakeAsync(client.NewAffiliatesAsync(pollingInterval: TimeSpan.FromMilliseconds(5), pageSize: 100), expectedCount: 1); _ = events.Count.Should().Be(1); - _ = events[0].Id.Should().Be("a-1"); + _ = events[0].AffiliateId?.String.Should().Be("a-1"); } [Fact] @@ -85,27 +73,117 @@ public async Task NewOrdersAsync_WithStartTime_UsesStartTimeForFirstPoll() if (request.RequestUri!.AbsolutePath.EndsWith("/user/feed/orders", StringComparison.OrdinalIgnoreCase)) { startTimeUsed = request.RequestUri.Query.Contains("created_at_min=", StringComparison.Ordinal); - return TestHttpMessageHandler.JsonResponse("""{"orders":[]}"""); + return TestHttpMessageHandler.JsonResponse("""{"orders":[],"count":0,"limit":100,"offset":0}"""); } - return TestHttpMessageHandler.JsonResponse("""{"orders":[]}"""); + return TestHttpMessageHandler.JsonResponse("""{"orders":[],"count":0,"limit":100,"offset":0}"""); }); using var httpClient = new HttpClient(handler); using var client = new GoAffProClient(httpClient, new GoAffProClientOptions { BaseUrl = new Uri("https://example.test/v1/", UriKind.Absolute) }); - var detector = new GoAffProEventDetector(client, pollingInterval: TimeSpan.FromMilliseconds(5), pageSize: 100); - detector.OrderStartTime = startTime; + client.OrderObserverStartTime = startTime; - _ = await TakeAsync(detector.NewOrdersAsync(), expectedCount: 0); + _ = await TakeAsync(client.NewOrdersAsync(pollingInterval: TimeSpan.FromMilliseconds(5), pageSize: 100), expectedCount: 0); _ = startTimeUsed.Should().BeTrue(); } [Fact] - public async Task StartAsync_WhenNewEventsAreDetected_RaisesEventHandlers() + public async Task NewPayoutsAsync_TracksLastPollTime() + { + int payoutsCallCount = 0; + + using var handler = new TestHttpMessageHandler((request, _) => + { + if (request.RequestUri!.AbsolutePath.EndsWith("/user/feed/payouts", StringComparison.OrdinalIgnoreCase)) + { + payoutsCallCount++; + return payoutsCallCount == 1 + ? TestHttpMessageHandler.JsonResponse("""{"payouts":[{"id":"p-1","created_at":"2026-01-01T00:00:00Z"}],"count":1,"limit":100,"offset":0}""") + : TestHttpMessageHandler.JsonResponse("""{"payouts":[],"count":0,"limit":100,"offset":0}"""); + } + + return TestHttpMessageHandler.JsonResponse("""{}"""); + }); + + using var httpClient = new HttpClient(handler); + using var client = new GoAffProClient(httpClient, new GoAffProClientOptions { BaseUrl = new Uri("https://example.test/v1/", UriKind.Absolute) }); + + IReadOnlyList firstBatch = await TakeAsync(client.NewPayoutsAsync(pollingInterval: TimeSpan.FromMilliseconds(5), pageSize: 100), expectedCount: 1); + await Task.Delay(10); + IReadOnlyList secondBatch = await TakeAsync(client.NewPayoutsAsync(pollingInterval: TimeSpan.FromMilliseconds(5), pageSize: 100), expectedCount: 1); + + _ = firstBatch.Count.Should().Be(1); + _ = firstBatch[0].Id?.String.Should().Be("p-1"); + _ = secondBatch.Count.Should().Be(0); + } + + [Fact] + public async Task NewProductsAsync_DetectsIdsAboveInitialBaseline() + { + int productsCallCount = 0; + + using var handler = new TestHttpMessageHandler((request, _) => + { + if (request.RequestUri!.AbsolutePath.EndsWith("/user/feed/products", StringComparison.OrdinalIgnoreCase)) + { + productsCallCount++; + return productsCallCount == 1 + ? TestHttpMessageHandler.JsonResponse("""{"products":[{"id":1},{"id":2}],"count":2,"limit":100,"offset":0}""") + : TestHttpMessageHandler.JsonResponse("""{"products":[{"id":2},{"id":3}],"count":2,"limit":100,"offset":0}"""); + } + + return TestHttpMessageHandler.JsonResponse("""{}"""); + }); + + using var httpClient = new HttpClient(handler); + using var client = new GoAffProClient(httpClient, new GoAffProClientOptions { BaseUrl = new Uri("https://example.test/v1/", UriKind.Absolute) }); + + IReadOnlyList products = await TakeAsync( + client.NewProductsAsync(pollingInterval: TimeSpan.FromMilliseconds(5), pageSize: 100), + expectedCount: 1); + + _ = products.Count.Should().Be(1); + _ = products[0].Id?.Integer.Should().Be(3); + } + + [Fact] + public async Task NewTransactionsAsync_DetectsIdsAboveInitialBaseline() + { + int transactionsCallCount = 0; + + using var handler = new TestHttpMessageHandler((request, _) => + { + if (request.RequestUri!.AbsolutePath.EndsWith("/user/feed/transactions", StringComparison.OrdinalIgnoreCase)) + { + transactionsCallCount++; + return transactionsCallCount == 1 + ? TestHttpMessageHandler.JsonResponse("""{"transactions":[{"tx_id":10}],"count":1,"limit":100,"offset":0}""") + : TestHttpMessageHandler.JsonResponse("""{"transactions":[{"tx_id":11}],"count":1,"limit":100,"offset":0}"""); + } + + return TestHttpMessageHandler.JsonResponse("""{}"""); + }); + + using var httpClient = new HttpClient(handler); + using var client = new GoAffProClient(httpClient, new GoAffProClientOptions { BaseUrl = new Uri("https://example.test/v1/", UriKind.Absolute) }); + + IReadOnlyList transactions = await TakeAsync( + client.NewTransactionsAsync(pollingInterval: TimeSpan.FromMilliseconds(5), pageSize: 100), + expectedCount: 1); + + _ = transactions.Count.Should().Be(1); + _ = transactions[0].TxId.Should().Be(11); + } + + [Fact] + public async Task StartEventObserverAsync_WhenNewEventsAreDetected_RaisesEventHandlers() { int ordersCallCount = 0; int trafficCallCount = 0; + int payoutsCallCount = 0; + int productsCallCount = 0; + int transactionsCallCount = 0; using var handler = new TestHttpMessageHandler((request, _) => { @@ -113,16 +191,40 @@ public async Task StartAsync_WhenNewEventsAreDetected_RaisesEventHandlers() { ordersCallCount++; return ordersCallCount == 1 - ? TestHttpMessageHandler.JsonResponse("""{"orders":[{"id":"o-1"}]}""") - : TestHttpMessageHandler.JsonResponse("""{"orders":[]}"""); + ? TestHttpMessageHandler.JsonResponse("""{"orders":[{"id":"o-1"}],"count":1,"limit":100,"offset":0}""") + : TestHttpMessageHandler.JsonResponse("""{"orders":[],"count":0,"limit":100,"offset":0}"""); } if (request.RequestUri.AbsolutePath.EndsWith("/user/feed/traffic", StringComparison.OrdinalIgnoreCase)) { trafficCallCount++; return trafficCallCount == 1 - ? TestHttpMessageHandler.JsonResponse("""{"traffic":[{"affiliate_id":"a-1"}]}""") - : TestHttpMessageHandler.JsonResponse("""{"traffic":[]}"""); + ? TestHttpMessageHandler.JsonResponse("""{"traffic":[{"affiliate_id":"a-1"}],"count":1,"limit":100,"offset":0}""") + : TestHttpMessageHandler.JsonResponse("""{"traffic":[],"count":0,"limit":100,"offset":0}"""); + } + + if (request.RequestUri.AbsolutePath.EndsWith("/user/feed/payouts", StringComparison.OrdinalIgnoreCase)) + { + payoutsCallCount++; + return payoutsCallCount == 1 + ? TestHttpMessageHandler.JsonResponse("""{"payouts":[{"id":"p-1","created_at":"2026-01-01T00:00:00Z"}],"count":1,"limit":100,"offset":0}""") + : TestHttpMessageHandler.JsonResponse("""{"payouts":[],"count":0,"limit":100,"offset":0}"""); + } + + if (request.RequestUri.AbsolutePath.EndsWith("/user/feed/products", StringComparison.OrdinalIgnoreCase)) + { + productsCallCount++; + return productsCallCount == 1 + ? TestHttpMessageHandler.JsonResponse("""{"products":[{"id":1},{"id":2}],"count":2,"limit":100,"offset":0}""") + : TestHttpMessageHandler.JsonResponse("""{"products":[{"id":2},{"id":3}],"count":2,"limit":100,"offset":0}"""); + } + + if (request.RequestUri.AbsolutePath.EndsWith("/user/feed/transactions", StringComparison.OrdinalIgnoreCase)) + { + transactionsCallCount++; + return transactionsCallCount == 1 + ? TestHttpMessageHandler.JsonResponse("""{"transactions":[{"tx_id":10}],"count":1,"limit":100,"offset":0}""") + : TestHttpMessageHandler.JsonResponse("""{"transactions":[{"tx_id":11}],"count":1,"limit":100,"offset":0}"""); } return TestHttpMessageHandler.JsonResponse("""{}"""); @@ -130,17 +232,42 @@ public async Task StartAsync_WhenNewEventsAreDetected_RaisesEventHandlers() using var httpClient = new HttpClient(handler); using var client = new GoAffProClient(httpClient, new GoAffProClientOptions { BaseUrl = new Uri("https://example.test/v1/", UriKind.Absolute) }); - var detector = new GoAffProEventDetector(client, pollingInterval: TimeSpan.FromMilliseconds(5), pageSize: 100); var orderIds = new List(); var affiliateIds = new List(); + var payoutIds = new List(); + var productIds = new List(); + var transactionIds = new List(); using CancellationTokenSource cancellationTokenSource = new(TimeSpan.FromSeconds(1)); - detector.OrderDetected += (_, args) => orderIds.Add(args.Order.Id); - detector.AffiliateDetected += (_, args) => affiliateIds.Add(args.Affiliate.Id); - - Task runTask = detector.StartAsync(cancellationTokenSource.Token); - while (orderIds.Count == 0 || affiliateIds.Count == 0) + client.OrderDetected += (_, args) => orderIds.Add(args.Order.Id?.String ?? args.Order.OrderId?.String ?? string.Empty); + client.AffiliateDetected += (_, args) => affiliateIds.Add(args.Affiliate.AffiliateId?.String ?? args.Affiliate.Id?.String ?? string.Empty); + client.PayoutDetected += (_, args) => payoutIds.Add(args.Payout.Id?.String ?? args.Payout.PayoutId?.String ?? string.Empty); + client.ProductDetected += (_, args) => + { + if (args.Product.Id?.Integer is int productId) + { + productIds.Add(productId); + } + }; + client.TransactionDetected += (_, args) => + { + if (args.Transaction.TxId is int txId) + { + transactionIds.Add(txId); + } + }; + + Task runTask = client.StartEventObserverAsync( + pollingInterval: TimeSpan.FromMilliseconds(5), + pageSize: 100, + cancellationToken: cancellationTokenSource.Token); + + while (orderIds.Count == 0 || + affiliateIds.Count == 0 || + payoutIds.Count == 0 || + productIds.Count == 0 || + transactionIds.Count == 0) { await Task.Delay(10); if (cancellationTokenSource.IsCancellationRequested) @@ -161,6 +288,9 @@ public async Task StartAsync_WhenNewEventsAreDetected_RaisesEventHandlers() _ = orderIds.Should().Contain("o-1"); _ = affiliateIds.Should().Contain("a-1"); + _ = payoutIds.Should().Contain("p-1"); + _ = productIds.Should().Contain(3); + _ = transactionIds.Should().Contain(11); } private static async Task> TakeAsync(IAsyncEnumerable source, int expectedCount) From 17d1d3a9dc30dba82137057f89275d8b8b857006 Mon Sep 17 00:00:00 2001 From: Agash Date: Wed, 25 Feb 2026 10:13:20 +0100 Subject: [PATCH 4/8] refactor(generator): migrate client generation to Kiota project --- Directory.Packages.props | 14 +- GoAffPro.Client.slnx | 2 +- dotnet-tools.json | 13 + openapi/goaffpro-canonical.json | 502 ++-- openapi/goaffpro-canonical.yaml | 582 ++-- .../Generated/.kiota.log | 2 + .../Generated/GoAffProApiClient.cs | 54 + .../Generated/Models/CommissionLike.cs | 79 + .../Models/CountLimitOffsetEnvelope.cs | 67 + .../CountLimitOffsetEnvelopeFlexibleOffset.cs | 134 + .../Generated/Models/ErrorResponse.cs | 139 + .../Generated/Models/LoginResponse.cs | 65 + .../Models/PendingPayoutBreakdown.cs | 71 + .../Generated/Models/PendingPayoutItem.cs | 55 + .../Models/PublicProductsResponse.cs | 66 + .../Models/PublicProductsResponse_products.cs | 55 + .../Generated/Models/PublicSitesResponse.cs | 76 + .../Generated/Models/PublicStore.cs | 131 + .../Models/UserCommissionsResponse.cs | 105 + .../Models/UserCommissionsResponse_mlm.cs | 55 + .../UserCommissionsResponse_royalties.cs | 55 + .../Models/UserCommissionsResponse_special.cs | 55 + .../UserCommissionsResponse_standard.cs | 55 + .../Generated/Models/UserOrderFeedItem.cs | 559 ++++ .../UserOrderFeedItem_conversion_details.cs | 55 + .../Models/UserOrderFeedItem_line_items.cs | 55 + .../Generated/Models/UserOrderFeedResponse.cs | 56 + .../Generated/Models/UserPayoutFeedItem.cs | 460 +++ .../Models/UserPayoutFeedResponse.cs | 148 + .../Models/UserPendingPayoutsResponse.cs | 136 + .../Generated/Models/UserProductFeedItem.cs | 409 +++ .../Models/UserProductFeedResponse.cs | 56 + .../Generated/Models/UserProfileEnvelope.cs | 65 + .../Models/UserProfileEnvelope_user.cs | 55 + .../Models/UserProfileUpdateResponse.cs | 59 + .../Generated/Models/UserRewardFeedItem.cs | 133 + .../Models/UserRewardFeedResponse.cs | 56 + .../Generated/Models/UserSite.cs | 155 ++ .../Generated/Models/UserSiteListResponse.cs | 69 + .../Generated/Models/UserSite_coupon.cs | 55 + .../Models/UserStatsAggregateItem.cs | 85 + .../Models/UserStatsAggregateResponse.cs | 65 + .../Generated/Models/UserTrafficFeedItem.cs | 571 ++++ .../Models/UserTrafficFeedResponse.cs | 148 + .../Models/UserTransactionFeedResponse.cs | 144 + .../Generated/Models/UserTransactionItem.cs | 137 + .../Models/UserTransactionItem_entity_type.cs | 24 + .../Models/UserTransactionItem_event_type.cs | 24 + .../Models/UserTransactionItem_metadata.cs | 55 + .../Public/Products/ProductsRequestBuilder.cs | 119 + .../Generated/Public/PublicRequestBuilder.cs | 47 + .../Public/Sites/SitesRequestBuilder.cs | 137 + .../Commissions/CommissionsRequestBuilder.cs | 117 + .../Generated/User/Feed/FeedRequestBuilder.cs | 71 + .../Orders/GetFieldsQueryParameterType.cs | 56 + .../User/Feed/Orders/OrdersRequestBuilder.cs | 176 ++ .../Feed/Payouts/PayoutsRequestBuilder.cs | 141 + .../Feed/Products/ProductsRequestBuilder.cs | 114 + .../Feed/Rewards/RewardsRequestBuilder.cs | 143 + .../Feed/Traffic/TrafficRequestBuilder.cs | 141 + .../TransactionsRequestBuilder.cs | 112 + .../User/Login/LoginPostRequestBody.cs | 75 + .../User/Login/LoginRequestBuilder.cs | 97 + .../User/Payouts/PayoutsRequestBuilder.cs | 41 + .../Payouts/Pending/PendingRequestBuilder.cs | 101 + .../User/Sites/GetFieldsQueryParameterType.cs | 52 + .../User/Sites/GetStatusQueryParameterType.cs | 24 + .../User/Sites/SitesRequestBuilder.cs | 143 + .../Aggregate/AggregateRequestBuilder.cs | 154 + .../Aggregate/GetFieldsQueryParameterType.cs | 32 + .../User/Stats/StatsRequestBuilder.cs | 41 + .../Generated/User/UserRequestBuilder.cs | 191 ++ .../Generated/kiota-lock.json | 34 + .../GoAffPro.Client.Generated.csproj | 38 + .../GeneratorOptions.cs | 3 - .../GeneratorRunner.cs | 477 ---- .../GoAffPro.Client.Generator.csproj | 21 - .../GoAffProClientGeneratorTask.cs | 20 - .../Properties/AssemblyInfo.cs | 3 - .../SpecExtractor.cs | 90 - .../build/GoAffPro.Client.Generator.targets | 38 - src/GoAffPro.Client/Generated/.gitkeep | 1 - .../Generated/GoAffProPublicClient.g.cs | 1168 -------- .../Generated/GoAffProUserClient.g.cs | 2473 ----------------- src/GoAffPro.Client/GoAffPro.Client.csproj | 19 +- .../GeneratedClientContractTests.cs | 83 +- .../GoAffProClientTests.cs | 137 +- .../GeneratedClientSignatures.snapshot | 60 +- 88 files changed, 8192 insertions(+), 5064 deletions(-) create mode 100644 dotnet-tools.json create mode 100644 src/GoAffPro.Client.Generated/Generated/.kiota.log create mode 100644 src/GoAffPro.Client.Generated/Generated/GoAffProApiClient.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/CommissionLike.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/CountLimitOffsetEnvelope.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/CountLimitOffsetEnvelopeFlexibleOffset.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/ErrorResponse.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/LoginResponse.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/PendingPayoutBreakdown.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/PendingPayoutItem.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/PublicProductsResponse.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/PublicProductsResponse_products.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/PublicSitesResponse.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/PublicStore.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse_mlm.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse_royalties.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse_special.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse_standard.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserOrderFeedItem.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserOrderFeedItem_conversion_details.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserOrderFeedItem_line_items.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserOrderFeedResponse.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserPayoutFeedItem.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserPayoutFeedResponse.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserPendingPayoutsResponse.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserProductFeedItem.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserProductFeedResponse.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserProfileEnvelope.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserProfileEnvelope_user.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserProfileUpdateResponse.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserRewardFeedItem.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserRewardFeedResponse.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserSite.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserSiteListResponse.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserSite_coupon.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserStatsAggregateItem.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserStatsAggregateResponse.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserTrafficFeedItem.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserTrafficFeedResponse.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserTransactionFeedResponse.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserTransactionItem.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserTransactionItem_entity_type.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserTransactionItem_event_type.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Models/UserTransactionItem_metadata.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Public/Products/ProductsRequestBuilder.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Public/PublicRequestBuilder.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/Public/Sites/SitesRequestBuilder.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/Commissions/CommissionsRequestBuilder.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/Feed/FeedRequestBuilder.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/Feed/Orders/GetFieldsQueryParameterType.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/Feed/Orders/OrdersRequestBuilder.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/Feed/Payouts/PayoutsRequestBuilder.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/Feed/Products/ProductsRequestBuilder.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/Feed/Rewards/RewardsRequestBuilder.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/Feed/Traffic/TrafficRequestBuilder.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/Feed/Transactions/TransactionsRequestBuilder.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/Login/LoginPostRequestBody.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/Login/LoginRequestBuilder.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/Payouts/PayoutsRequestBuilder.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/Payouts/Pending/PendingRequestBuilder.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/Sites/GetFieldsQueryParameterType.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/Sites/GetStatusQueryParameterType.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/Sites/SitesRequestBuilder.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/Stats/Aggregate/AggregateRequestBuilder.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/Stats/Aggregate/GetFieldsQueryParameterType.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/Stats/StatsRequestBuilder.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/User/UserRequestBuilder.cs create mode 100644 src/GoAffPro.Client.Generated/Generated/kiota-lock.json create mode 100644 src/GoAffPro.Client.Generated/GoAffPro.Client.Generated.csproj delete mode 100644 src/GoAffPro.Client.Generator/GeneratorOptions.cs delete mode 100644 src/GoAffPro.Client.Generator/GeneratorRunner.cs delete mode 100644 src/GoAffPro.Client.Generator/GoAffPro.Client.Generator.csproj delete mode 100644 src/GoAffPro.Client.Generator/GoAffProClientGeneratorTask.cs delete mode 100644 src/GoAffPro.Client.Generator/Properties/AssemblyInfo.cs delete mode 100644 src/GoAffPro.Client.Generator/SpecExtractor.cs delete mode 100644 src/GoAffPro.Client.Generator/build/GoAffPro.Client.Generator.targets delete mode 100644 src/GoAffPro.Client/Generated/.gitkeep delete mode 100644 src/GoAffPro.Client/Generated/GoAffProPublicClient.g.cs delete mode 100644 src/GoAffPro.Client/Generated/GoAffProUserClient.g.cs diff --git a/Directory.Packages.props b/Directory.Packages.props index 5204ebd..245c18a 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -10,13 +10,15 @@ + - - - - - - + + + + + + + diff --git a/GoAffPro.Client.slnx b/GoAffPro.Client.slnx index cafc98d..d95be48 100644 --- a/GoAffPro.Client.slnx +++ b/GoAffPro.Client.slnx @@ -7,8 +7,8 @@ + - diff --git a/dotnet-tools.json b/dotnet-tools.json new file mode 100644 index 0000000..5b4d81b --- /dev/null +++ b/dotnet-tools.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "microsoft.openapi.kiota": { + "version": "1.30.0", + "commands": [ + "kiota" + ], + "rollForward": false + } + } +} \ No newline at end of file diff --git a/openapi/goaffpro-canonical.json b/openapi/goaffpro-canonical.json index ff3a8f3..b136ea5 100644 --- a/openapi/goaffpro-canonical.json +++ b/openapi/goaffpro-canonical.json @@ -42,14 +42,7 @@ "content": { "application/json": { "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/LoginResponse" - }, - { - "$ref": "#/components/schemas/ErrorResponse" - } - ] + "$ref": "#/components/schemas/LoginResponse" } } } @@ -62,30 +55,13 @@ "summary": "List of stores the user is enrolled in", "parameters": [ { - "in": "query", - "name": "limit", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/LimitQuery" }, { - "in": "query", - "name": "offset", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/OffsetQuery" }, { - "in": "query", - "name": "status", - "schema": { - "type": "string", - "enum": [ - "approved", - "pending", - "blocked" - ] - } + "$ref": "#/components/parameters/UserStatusQuery" }, { "in": "query", @@ -118,14 +94,7 @@ "content": { "application/json": { "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserSiteListResponse" - }, - { - "$ref": "#/components/schemas/ErrorResponse" - } - ] + "$ref": "#/components/schemas/UserSiteListResponse" } } } @@ -145,14 +114,7 @@ "content": { "application/json": { "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserProfileEnvelope" - }, - { - "$ref": "#/components/schemas/ErrorResponse" - } - ] + "$ref": "#/components/schemas/UserProfileEnvelope" } } } @@ -170,14 +132,7 @@ "content": { "application/json": { "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserProfileUpdateResponse" - }, - { - "$ref": "#/components/schemas/ErrorResponse" - } - ] + "$ref": "#/components/schemas/UserProfileUpdateResponse" } } } @@ -193,25 +148,13 @@ "summary": "Aggregates of user stats", "parameters": [ { - "in": "query", - "name": "site_ids", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/SiteIdsQuery" }, { - "in": "query", - "name": "start_time", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/StartTimeQuery" }, { - "in": "query", - "name": "end_time", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/EndTimeQuery" }, { "in": "query", @@ -239,14 +182,7 @@ "content": { "application/json": { "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserStatsAggregateResponse" - }, - { - "$ref": "#/components/schemas/ErrorResponse" - } - ] + "$ref": "#/components/schemas/UserStatsAggregateResponse" } } } @@ -262,39 +198,19 @@ "summary": "Feed of user orders", "parameters": [ { - "in": "query", - "name": "site_ids", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/SiteIdsQuery" }, { - "in": "query", - "name": "since_id", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/SinceIdStringQuery" }, { - "in": "query", - "name": "max_id", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/MaxIdQuery" }, { - "in": "query", - "name": "created_at_max", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/CreatedAtMaxQuery" }, { - "in": "query", - "name": "created_at_min", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/CreatedAtMinQuery" }, { "in": "query", @@ -322,18 +238,10 @@ } }, { - "in": "query", - "name": "limit", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/LimitQuery" }, { - "in": "query", - "name": "offset", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/OffsetQuery" } ], "responses": { @@ -342,14 +250,7 @@ "content": { "application/json": { "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserOrderFeedResponse" - }, - { - "$ref": "#/components/schemas/ErrorResponse" - } - ] + "$ref": "#/components/schemas/UserOrderFeedResponse" } } } @@ -365,46 +266,22 @@ "summary": "Feed of user payouts", "parameters": [ { - "in": "query", - "name": "site_ids", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/SiteIdsQuery" }, { - "in": "query", - "name": "start_time", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/StartTimeQuery" }, { - "in": "query", - "name": "end_time", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/EndTimeQuery" }, { - "in": "query", - "name": "since_id", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/SinceIdIntegerQuery" }, { - "in": "query", - "name": "limit", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/LimitQuery" }, { - "in": "query", - "name": "offset", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/OffsetQuery" } ], "responses": { @@ -413,14 +290,7 @@ "content": { "application/json": { "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserPayoutFeedResponse" - }, - { - "$ref": "#/components/schemas/ErrorResponse" - } - ] + "$ref": "#/components/schemas/UserPayoutFeedResponse" } } } @@ -436,18 +306,10 @@ "summary": "Feed of products available for promotion", "parameters": [ { - "in": "query", - "name": "limit", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/LimitQuery" }, { - "in": "query", - "name": "offset", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/OffsetQuery" } ], "responses": { @@ -456,14 +318,7 @@ "content": { "application/json": { "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserProductFeedResponse" - }, - { - "$ref": "#/components/schemas/ErrorResponse" - } - ] + "$ref": "#/components/schemas/UserProductFeedResponse" } } } @@ -482,46 +337,22 @@ "summary": "Feed of user rewards", "parameters": [ { - "in": "query", - "name": "site_ids", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/SiteIdsQuery" }, { - "in": "query", - "name": "start_time", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/StartTimeQuery" }, { - "in": "query", - "name": "end_time", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/EndTimeQuery" }, { - "in": "query", - "name": "since_id", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/SinceIdIntegerQuery" }, { - "in": "query", - "name": "limit", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/LimitQuery" }, { - "in": "query", - "name": "offset", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/OffsetQuery" } ], "responses": { @@ -530,14 +361,7 @@ "content": { "application/json": { "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserRewardFeedResponse" - }, - { - "$ref": "#/components/schemas/ErrorResponse" - } - ] + "$ref": "#/components/schemas/UserRewardFeedResponse" } } } @@ -553,46 +377,22 @@ "summary": "Feed of user traffic", "parameters": [ { - "in": "query", - "name": "site_ids", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/SiteIdsQuery" }, { - "in": "query", - "name": "start_time", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/StartTimeQuery" }, { - "in": "query", - "name": "end_time", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/EndTimeQuery" }, { - "in": "query", - "name": "since_id", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/SinceIdIntegerQuery" }, { - "in": "query", - "name": "limit", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/LimitQuery" }, { - "in": "query", - "name": "offset", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/OffsetQuery" } ], "responses": { @@ -601,14 +401,7 @@ "content": { "application/json": { "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserTrafficFeedResponse" - }, - { - "$ref": "#/components/schemas/ErrorResponse" - } - ] + "$ref": "#/components/schemas/UserTrafficFeedResponse" } } } @@ -624,18 +417,10 @@ "summary": "Feed of user transactions", "parameters": [ { - "in": "query", - "name": "limit", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/LimitQuery" }, { - "in": "query", - "name": "offset", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/OffsetQuery" } ], "responses": { @@ -644,14 +429,7 @@ "content": { "application/json": { "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserTransactionFeedResponse" - }, - { - "$ref": "#/components/schemas/ErrorResponse" - } - ] + "$ref": "#/components/schemas/UserTransactionFeedResponse" } } } @@ -670,11 +448,7 @@ "summary": "Get commission structure", "parameters": [ { - "in": "query", - "name": "site_ids", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/SiteIdsQuery" } ], "responses": { @@ -683,14 +457,7 @@ "content": { "application/json": { "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserCommissionsResponse" - }, - { - "$ref": "#/components/schemas/ErrorResponse" - } - ] + "$ref": "#/components/schemas/UserCommissionsResponse" } } } @@ -710,14 +477,7 @@ "content": { "application/json": { "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserPendingPayoutsResponse" - }, - { - "$ref": "#/components/schemas/ErrorResponse" - } - ] + "$ref": "#/components/schemas/UserPendingPayoutsResponse" } } } @@ -733,39 +493,19 @@ "summary": "Public marketplace sites", "parameters": [ { - "in": "query", - "name": "site_ids", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/SiteIdsQuery" }, { - "in": "query", - "name": "currency", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/PublicCurrencyQuery" }, { - "in": "query", - "name": "keyword", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/PublicKeywordQuery" }, { - "in": "query", - "name": "limit", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/LimitQuery" }, { - "in": "query", - "name": "offset", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/OffsetQuery" } ], "responses": { @@ -774,14 +514,7 @@ "content": { "application/json": { "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/PublicSitesResponse" - }, - { - "$ref": "#/components/schemas/ErrorResponse" - } - ] + "$ref": "#/components/schemas/PublicSitesResponse" } } } @@ -800,25 +533,13 @@ "summary": "Public marketplace products", "parameters": [ { - "in": "query", - "name": "limit", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/LimitQuery" }, { - "in": "query", - "name": "offset", - "schema": { - "type": "integer" - } + "$ref": "#/components/parameters/OffsetQuery" }, { - "in": "query", - "name": "site_ids", - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/SiteIdsQuery" } ], "responses": { @@ -827,14 +548,7 @@ "content": { "application/json": { "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/PublicProductsResponse" - }, - { - "$ref": "#/components/schemas/ErrorResponse" - } - ] + "$ref": "#/components/schemas/PublicProductsResponse" } } } @@ -850,6 +564,104 @@ } }, "components": { + "parameters": { + "LimitQuery": { + "in": "query", + "name": "limit", + "schema": { + "type": "integer" + } + }, + "OffsetQuery": { + "in": "query", + "name": "offset", + "schema": { + "type": "integer" + } + }, + "SiteIdsQuery": { + "in": "query", + "name": "site_ids", + "schema": { + "type": "string" + } + }, + "StartTimeQuery": { + "in": "query", + "name": "start_time", + "schema": { + "type": "string" + } + }, + "EndTimeQuery": { + "in": "query", + "name": "end_time", + "schema": { + "type": "string" + } + }, + "SinceIdIntegerQuery": { + "in": "query", + "name": "since_id", + "schema": { + "type": "integer" + } + }, + "SinceIdStringQuery": { + "in": "query", + "name": "since_id", + "schema": { + "type": "string" + } + }, + "MaxIdQuery": { + "in": "query", + "name": "max_id", + "schema": { + "type": "string" + } + }, + "CreatedAtMaxQuery": { + "in": "query", + "name": "created_at_max", + "schema": { + "type": "string" + } + }, + "CreatedAtMinQuery": { + "in": "query", + "name": "created_at_min", + "schema": { + "type": "string" + } + }, + "PublicCurrencyQuery": { + "in": "query", + "name": "currency", + "schema": { + "type": "string" + } + }, + "PublicKeywordQuery": { + "in": "query", + "name": "keyword", + "schema": { + "type": "string" + } + }, + "UserStatusQuery": { + "in": "query", + "name": "status", + "schema": { + "type": "string", + "enum": [ + "approved", + "pending", + "blocked" + ] + } + } + }, "responses": { "AuthErrorResponse": { "description": "Authentication or authorization failure.", diff --git a/openapi/goaffpro-canonical.yaml b/openapi/goaffpro-canonical.yaml index 6e3fa8d..3dd7084 100644 --- a/openapi/goaffpro-canonical.yaml +++ b/openapi/goaffpro-canonical.yaml @@ -32,27 +32,15 @@ paths: content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/LoginResponse' - - $ref: '#/components/schemas/ErrorResponse' + $ref: '#/components/schemas/LoginResponse' /user/sites: get: summary: List of stores the user is enrolled in parameters: - - in: query - name: limit - schema: - type: integer - - in: query - name: offset - schema: - type: integer - - in: query - name: status - schema: - type: string - enum: [approved, pending, blocked] + - $ref: '#/components/parameters/LimitQuery' + - $ref: '#/components/parameters/OffsetQuery' + - $ref: '#/components/parameters/UserStatusQuery' - in: query name: fields required: true @@ -68,11 +56,13 @@ paths: content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/UserSiteListResponse' - - $ref: '#/components/schemas/ErrorResponse' + $ref: '#/components/schemas/UserSiteListResponse' + '401': + $ref: '#/components/responses/AuthErrorResponse' '403': $ref: '#/components/responses/AuthErrorResponse' + '500': + $ref: '#/components/responses/PlainTextErrorResponse' /user: get: @@ -83,11 +73,13 @@ paths: content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/UserProfileEnvelope' - - $ref: '#/components/schemas/ErrorResponse' + $ref: '#/components/schemas/UserProfileEnvelope' + '401': + $ref: '#/components/responses/AuthErrorResponse' '403': $ref: '#/components/responses/AuthErrorResponse' + '500': + $ref: '#/components/responses/PlainTextErrorResponse' post: summary: Update your profile responses: @@ -96,28 +88,21 @@ paths: content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/UserProfileUpdateResponse' - - $ref: '#/components/schemas/ErrorResponse' + $ref: '#/components/schemas/UserProfileUpdateResponse' + '401': + $ref: '#/components/responses/AuthErrorResponse' '403': $ref: '#/components/responses/AuthErrorResponse' + '500': + $ref: '#/components/responses/PlainTextErrorResponse' /user/stats/aggregate: get: summary: Aggregates of user stats parameters: - - in: query - name: site_ids - schema: - type: string - - in: query - name: start_time - schema: - type: string - - in: query - name: end_time - schema: - type: string + - $ref: '#/components/parameters/SiteIdsQuery' + - $ref: '#/components/parameters/StartTimeQuery' + - $ref: '#/components/parameters/EndTimeQuery' - in: query name: fields required: true @@ -133,36 +118,23 @@ paths: content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/UserStatsAggregateResponse' - - $ref: '#/components/schemas/ErrorResponse' + $ref: '#/components/schemas/UserStatsAggregateResponse' + '401': + $ref: '#/components/responses/AuthErrorResponse' '403': $ref: '#/components/responses/AuthErrorResponse' + '500': + $ref: '#/components/responses/PlainTextErrorResponse' /user/feed/orders: get: summary: Feed of user orders parameters: - - in: query - name: site_ids - schema: - type: string - - in: query - name: since_id - schema: - type: string - - in: query - name: max_id - schema: - type: string - - in: query - name: created_at_max - schema: - type: string - - in: query - name: created_at_min - schema: - type: string + - $ref: '#/components/parameters/SiteIdsQuery' + - $ref: '#/components/parameters/SinceIdStringQuery' + - $ref: '#/components/parameters/MaxIdQuery' + - $ref: '#/components/parameters/CreatedAtMaxQuery' + - $ref: '#/components/parameters/CreatedAtMinQuery' - in: query name: fields required: true @@ -172,89 +144,65 @@ paths: items: type: string enum: [id, number, total, subtotal, line_items, commission, created_at, currency, site_id, sub_id, conversion_details] - - in: query - name: limit - schema: - type: integer - - in: query - name: offset - schema: - type: integer + - $ref: '#/components/parameters/LimitQuery' + - $ref: '#/components/parameters/OffsetQuery' responses: '200': description: Success content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/UserOrderFeedResponse' - - $ref: '#/components/schemas/ErrorResponse' + $ref: '#/components/schemas/UserOrderFeedResponse' + '401': + $ref: '#/components/responses/AuthErrorResponse' '403': $ref: '#/components/responses/AuthErrorResponse' + '500': + $ref: '#/components/responses/PlainTextErrorResponse' /user/feed/payouts: get: summary: Feed of user payouts parameters: - - in: query - name: site_ids - schema: - type: string - - in: query - name: start_time - schema: - type: string - - in: query - name: end_time - schema: - type: string - - in: query - name: since_id - schema: - type: integer - - in: query - name: limit - schema: - type: integer - - in: query - name: offset - schema: - type: integer + - $ref: '#/components/parameters/SiteIdsQuery' + - $ref: '#/components/parameters/StartTimeQuery' + - $ref: '#/components/parameters/EndTimeQuery' + - $ref: '#/components/parameters/SinceIdIntegerQuery' + - $ref: '#/components/parameters/LimitQuery' + - $ref: '#/components/parameters/OffsetQuery' responses: '200': description: Success content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/UserPayoutFeedResponse' - - $ref: '#/components/schemas/ErrorResponse' + $ref: '#/components/schemas/UserPayoutFeedResponse' + '401': + $ref: '#/components/responses/AuthErrorResponse' '403': $ref: '#/components/responses/AuthErrorResponse' + '500': + $ref: '#/components/responses/PlainTextErrorResponse' /user/feed/products: get: summary: Feed of products available for promotion parameters: - - in: query - name: limit - schema: - type: integer - - in: query - name: offset - schema: - type: integer + - $ref: '#/components/parameters/LimitQuery' + - $ref: '#/components/parameters/OffsetQuery' responses: '200': description: Success content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/UserProductFeedResponse' - - $ref: '#/components/schemas/ErrorResponse' + $ref: '#/components/schemas/UserProductFeedResponse' + '401': + $ref: '#/components/responses/AuthErrorResponse' '403': $ref: '#/components/responses/AuthErrorResponse' + '500': + $ref: '#/components/responses/PlainTextErrorResponse' '502': $ref: '#/components/responses/PlainTextErrorResponse' @@ -262,103 +210,67 @@ paths: get: summary: Feed of user rewards parameters: - - in: query - name: site_ids - schema: - type: string - - in: query - name: start_time - schema: - type: string - - in: query - name: end_time - schema: - type: string - - in: query - name: since_id - schema: - type: integer - - in: query - name: limit - schema: - type: integer - - in: query - name: offset - schema: - type: integer + - $ref: '#/components/parameters/SiteIdsQuery' + - $ref: '#/components/parameters/StartTimeQuery' + - $ref: '#/components/parameters/EndTimeQuery' + - $ref: '#/components/parameters/SinceIdIntegerQuery' + - $ref: '#/components/parameters/LimitQuery' + - $ref: '#/components/parameters/OffsetQuery' responses: '200': description: Success content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/UserRewardFeedResponse' - - $ref: '#/components/schemas/ErrorResponse' + $ref: '#/components/schemas/UserRewardFeedResponse' + '401': + $ref: '#/components/responses/AuthErrorResponse' + '403': + $ref: '#/components/responses/AuthErrorResponse' '404': $ref: '#/components/responses/PlainTextErrorResponse' + '500': + $ref: '#/components/responses/PlainTextErrorResponse' /user/feed/traffic: get: summary: Feed of user traffic parameters: - - in: query - name: site_ids - schema: - type: string - - in: query - name: start_time - schema: - type: string - - in: query - name: end_time - schema: - type: string - - in: query - name: since_id - schema: - type: integer - - in: query - name: limit - schema: - type: integer - - in: query - name: offset - schema: - type: integer + - $ref: '#/components/parameters/SiteIdsQuery' + - $ref: '#/components/parameters/StartTimeQuery' + - $ref: '#/components/parameters/EndTimeQuery' + - $ref: '#/components/parameters/SinceIdIntegerQuery' + - $ref: '#/components/parameters/LimitQuery' + - $ref: '#/components/parameters/OffsetQuery' responses: '200': description: Success content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/UserTrafficFeedResponse' - - $ref: '#/components/schemas/ErrorResponse' + $ref: '#/components/schemas/UserTrafficFeedResponse' + '401': + $ref: '#/components/responses/AuthErrorResponse' '403': $ref: '#/components/responses/AuthErrorResponse' + '500': + $ref: '#/components/responses/PlainTextErrorResponse' /user/feed/transactions: get: summary: Feed of user transactions parameters: - - in: query - name: limit - schema: - type: integer - - in: query - name: offset - schema: - type: integer + - $ref: '#/components/parameters/LimitQuery' + - $ref: '#/components/parameters/OffsetQuery' responses: '200': description: Success content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/UserTransactionFeedResponse' - - $ref: '#/components/schemas/ErrorResponse' + $ref: '#/components/schemas/UserTransactionFeedResponse' + '401': + $ref: '#/components/responses/AuthErrorResponse' '403': $ref: '#/components/responses/AuthErrorResponse' '500': @@ -368,21 +280,20 @@ paths: get: summary: Get commission structure parameters: - - in: query - name: site_ids - schema: - type: string + - $ref: '#/components/parameters/SiteIdsQuery' responses: '200': description: Success content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/UserCommissionsResponse' - - $ref: '#/components/schemas/ErrorResponse' + $ref: '#/components/schemas/UserCommissionsResponse' + '401': + $ref: '#/components/responses/AuthErrorResponse' '403': $ref: '#/components/responses/AuthErrorResponse' + '500': + $ref: '#/components/responses/PlainTextErrorResponse' /user/payouts/pending: get: @@ -393,45 +304,30 @@ paths: content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/UserPendingPayoutsResponse' - - $ref: '#/components/schemas/ErrorResponse' + $ref: '#/components/schemas/UserPendingPayoutsResponse' + '401': + $ref: '#/components/responses/AuthErrorResponse' '403': $ref: '#/components/responses/AuthErrorResponse' + '500': + $ref: '#/components/responses/PlainTextErrorResponse' /public/sites: get: summary: Public marketplace sites parameters: - - in: query - name: site_ids - schema: - type: string - - in: query - name: currency - schema: - type: string - - in: query - name: keyword - schema: - type: string - - in: query - name: limit - schema: - type: integer - - in: query - name: offset - schema: - type: integer + - $ref: '#/components/parameters/SiteIdsQuery' + - $ref: '#/components/parameters/PublicCurrencyQuery' + - $ref: '#/components/parameters/PublicKeywordQuery' + - $ref: '#/components/parameters/LimitQuery' + - $ref: '#/components/parameters/OffsetQuery' responses: '200': description: Success content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/PublicSitesResponse' - - $ref: '#/components/schemas/ErrorResponse' + $ref: '#/components/schemas/PublicSitesResponse' '500': $ref: '#/components/responses/PlainTextErrorResponse' '502': @@ -441,33 +337,89 @@ paths: get: summary: Public marketplace products parameters: - - in: query - name: limit - schema: - type: integer - - in: query - name: offset - schema: - type: integer - - in: query - name: site_ids - schema: - type: string + - $ref: '#/components/parameters/LimitQuery' + - $ref: '#/components/parameters/OffsetQuery' + - $ref: '#/components/parameters/SiteIdsQuery' responses: '200': description: Success content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/PublicProductsResponse' - - $ref: '#/components/schemas/ErrorResponse' + $ref: '#/components/schemas/PublicProductsResponse' '500': $ref: '#/components/responses/PlainTextErrorResponse' '502': $ref: '#/components/responses/PlainTextErrorResponse' components: + parameters: + LimitQuery: + in: query + name: limit + schema: + type: integer + OffsetQuery: + in: query + name: offset + schema: + type: integer + SiteIdsQuery: + in: query + name: site_ids + schema: + type: string + StartTimeQuery: + in: query + name: start_time + schema: + type: string + EndTimeQuery: + in: query + name: end_time + schema: + type: string + SinceIdIntegerQuery: + in: query + name: since_id + schema: + type: integer + SinceIdStringQuery: + in: query + name: since_id + schema: + type: string + MaxIdQuery: + in: query + name: max_id + schema: + type: string + CreatedAtMaxQuery: + in: query + name: created_at_max + schema: + type: string + CreatedAtMinQuery: + in: query + name: created_at_min + schema: + type: string + PublicCurrencyQuery: + in: query + name: currency + schema: + type: string + PublicKeywordQuery: + in: query + name: keyword + schema: + type: string + UserStatusQuery: + in: query + name: status + schema: + type: string + enum: [approved, pending, blocked] responses: AuthErrorResponse: description: Authentication or authorization failure. @@ -481,12 +433,12 @@ components: PlainTextErrorResponse: description: Upstream service error response in plain text. content: - text/plain: - schema: - type: string application/json: schema: $ref: '#/components/schemas/ErrorResponse' + text/plain: + schema: + type: string schemas: LoginResponse: type: object @@ -620,10 +572,60 @@ components: orders: type: array items: - type: object - additionalProperties: true + $ref: '#/components/schemas/UserOrderFeedItem' additionalProperties: true + UserOrderFeedItem: + type: object + properties: + id: + oneOf: + - type: string + - type: integer + order_id: + oneOf: + - type: string + - type: integer + number: + type: string + total: + type: number + subtotal: + type: number + line_items: + type: array + items: + type: object + additionalProperties: true + commission: + oneOf: + - type: number + - type: string + created_at: + type: string + created: + oneOf: + - type: string + - type: integer + currency: + type: string + site_id: + oneOf: + - type: string + - type: integer + sub_id: + type: string + status: + type: string + affiliate_id: + oneOf: + - type: string + - type: integer + conversion_details: + type: object + additionalProperties: true + additionalProperties: true + UserPayoutFeedResponse: allOf: - $ref: '#/components/schemas/CountLimitOffsetEnvelope' @@ -634,10 +636,44 @@ components: payouts: type: array items: - type: object - additionalProperties: true + $ref: '#/components/schemas/UserPayoutFeedItem' additionalProperties: true + UserPayoutFeedItem: + type: object + properties: + id: + oneOf: + - type: string + - type: integer + payout_id: + oneOf: + - type: string + - type: integer + affiliate_id: + oneOf: + - type: string + - type: integer + amount: + oneOf: + - type: number + - type: string + status: + type: string + payment_method: + type: string + transaction_id: + type: string + currency: + type: string + created_at: + type: string + created: + oneOf: + - type: string + - type: integer + additionalProperties: true + UserProductFeedResponse: allOf: - $ref: '#/components/schemas/CountLimitOffsetEnvelopeFlexibleOffset' @@ -647,10 +683,44 @@ components: products: type: array items: - type: object - additionalProperties: true + $ref: '#/components/schemas/UserProductFeedItem' additionalProperties: true + UserProductFeedItem: + type: object + properties: + id: + oneOf: + - type: string + - type: integer + product_id: + oneOf: + - type: string + - type: integer + name: + type: string + description: + type: string + price: + oneOf: + - type: number + - type: string + sale_price: + oneOf: + - type: number + - type: string + image_url: + type: string + product_url: + type: string + category: + type: string + sku: + type: string + currency: + type: string + additionalProperties: true + UserRewardFeedResponse: allOf: - $ref: '#/components/schemas/CountLimitOffsetEnvelope' @@ -696,10 +766,56 @@ components: traffic: type: array items: - type: object - additionalProperties: true + $ref: '#/components/schemas/UserTrafficFeedItem' additionalProperties: true + UserTrafficFeedItem: + type: object + properties: + id: + oneOf: + - type: string + - type: integer + affiliate_id: + oneOf: + - type: string + - type: integer + customer_id: + oneOf: + - type: string + - type: integer + name: + type: string + first_name: + type: string + last_name: + type: string + email: + type: string + ref_code: + type: string + phone: + type: string + country: + type: string + group_id: + oneOf: + - type: integer + - type: string + site_id: + oneOf: + - type: string + - type: integer + sub_id: + type: string + created_at: + type: string + created: + oneOf: + - type: string + - type: integer + additionalProperties: true + UserCommissionsResponse: type: object properties: diff --git a/src/GoAffPro.Client.Generated/Generated/.kiota.log b/src/GoAffPro.Client.Generated/Generated/.kiota.log new file mode 100644 index 0000000..542a0f0 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/.kiota.log @@ -0,0 +1,2 @@ +Warning: KiotaBuilder Discriminator UserTrafficFeedResponse is not inherited from CountLimitOffsetEnvelope. +Warning: KiotaBuilder Discriminator UserPayoutFeedResponse is not inherited from CountLimitOffsetEnvelope. diff --git a/src/GoAffPro.Client.Generated/Generated/GoAffProApiClient.cs b/src/GoAffPro.Client.Generated/Generated/GoAffProApiClient.cs new file mode 100644 index 0000000..ac00bc1 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/GoAffProApiClient.cs @@ -0,0 +1,54 @@ +// +#pragma warning disable CS0618 +using GoAffPro.Client.Generated.Public; +using GoAffPro.Client.Generated.User; +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Serialization.Form; +using Microsoft.Kiota.Serialization.Json; +using Microsoft.Kiota.Serialization.Multipart; +using Microsoft.Kiota.Serialization.Text; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace GoAffPro.Client.Generated +{ + /// + /// The main entry point of the SDK, exposes the configuration and the fluent API. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class GoAffProApiClient : BaseRequestBuilder + { + /// The public property + public global::GoAffPro.Client.Generated.Public.PublicRequestBuilder Public + { + get => new global::GoAffPro.Client.Generated.Public.PublicRequestBuilder(PathParameters, RequestAdapter); + } + /// The user property + public global::GoAffPro.Client.Generated.User.UserRequestBuilder User + { + get => new global::GoAffPro.Client.Generated.User.UserRequestBuilder(PathParameters, RequestAdapter); + } + /// + /// Instantiates a new and sets the default values. + /// + /// The request adapter to use to execute the requests. + public GoAffProApiClient(IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}", new Dictionary()) + { + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) + { + RequestAdapter.BaseUrl = "https://api.goaffpro.com/v1"; + } + PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/CommissionLike.cs b/src/GoAffPro.Client.Generated/Generated/Models/CommissionLike.cs new file mode 100644 index 0000000..6d0e027 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/CommissionLike.cs @@ -0,0 +1,79 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CommissionLike : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The amount property + public double? Amount { get; set; } + /// The on property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? On { get; set; } +#nullable restore +#else + public string On { get; set; } +#endif + /// The type property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Type { get; set; } +#nullable restore +#else + public string Type { get; set; } +#endif + /// + /// Instantiates a new and sets the default values. + /// + public CommissionLike() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.CommissionLike CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.CommissionLike(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "amount", n => { Amount = n.GetDoubleValue(); } }, + { "on", n => { On = n.GetStringValue(); } }, + { "type", n => { Type = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteDoubleValue("amount", Amount); + writer.WriteStringValue("on", On); + writer.WriteStringValue("type", Type); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/CountLimitOffsetEnvelope.cs b/src/GoAffPro.Client.Generated/Generated/Models/CountLimitOffsetEnvelope.cs new file mode 100644 index 0000000..de5b739 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/CountLimitOffsetEnvelope.cs @@ -0,0 +1,67 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CountLimitOffsetEnvelope : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The count property + public int? Count { get; set; } + /// The limit property + public int? Limit { get; set; } + /// The offset property + public int? Offset { get; set; } + /// + /// Instantiates a new and sets the default values. + /// + public CountLimitOffsetEnvelope() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.CountLimitOffsetEnvelope CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.CountLimitOffsetEnvelope(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "count", n => { Count = n.GetIntValue(); } }, + { "limit", n => { Limit = n.GetIntValue(); } }, + { "offset", n => { Offset = n.GetIntValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteIntValue("count", Count); + writer.WriteIntValue("limit", Limit); + writer.WriteIntValue("offset", Offset); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/CountLimitOffsetEnvelopeFlexibleOffset.cs b/src/GoAffPro.Client.Generated/Generated/Models/CountLimitOffsetEnvelopeFlexibleOffset.cs new file mode 100644 index 0000000..05e8f12 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/CountLimitOffsetEnvelopeFlexibleOffset.cs @@ -0,0 +1,134 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CountLimitOffsetEnvelopeFlexibleOffset : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The count property + public int? Count { get; set; } + /// The limit property + public int? Limit { get; set; } + /// The offset property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.CountLimitOffsetEnvelopeFlexibleOffset.CountLimitOffsetEnvelopeFlexibleOffset_offset? Offset { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.CountLimitOffsetEnvelopeFlexibleOffset.CountLimitOffsetEnvelopeFlexibleOffset_offset Offset { get; set; } +#endif + /// + /// Instantiates a new and sets the default values. + /// + public CountLimitOffsetEnvelopeFlexibleOffset() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.CountLimitOffsetEnvelopeFlexibleOffset CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.CountLimitOffsetEnvelopeFlexibleOffset(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "count", n => { Count = n.GetIntValue(); } }, + { "limit", n => { Limit = n.GetIntValue(); } }, + { "offset", n => { Offset = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.CountLimitOffsetEnvelopeFlexibleOffset.CountLimitOffsetEnvelopeFlexibleOffset_offset.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteIntValue("count", Count); + writer.WriteIntValue("limit", Limit); + writer.WriteObjectValue("offset", Offset); + writer.WriteAdditionalData(AdditionalData); + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CountLimitOffsetEnvelopeFlexibleOffset_offset : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.CountLimitOffsetEnvelopeFlexibleOffset.CountLimitOffsetEnvelopeFlexibleOffset_offset CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.CountLimitOffsetEnvelopeFlexibleOffset.CountLimitOffsetEnvelopeFlexibleOffset_offset(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/ErrorResponse.cs b/src/GoAffPro.Client.Generated/Generated/Models/ErrorResponse.cs new file mode 100644 index 0000000..a453ad8 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/ErrorResponse.cs @@ -0,0 +1,139 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorResponse : ApiException, IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The code property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.ErrorResponse.ErrorResponse_code? Code { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.ErrorResponse.ErrorResponse_code Code { get; set; } +#endif + /// The error property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Error { get; set; } +#nullable restore +#else + public string Error { get; set; } +#endif + /// The primary error message. + public override string Message { get => base.Message; } + /// + /// Instantiates a new and sets the default values. + /// + public ErrorResponse() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.ErrorResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.ErrorResponse(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "code", n => { Code = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.ErrorResponse.ErrorResponse_code.CreateFromDiscriminatorValue); } }, + { "error", n => { Error = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("code", Code); + writer.WriteStringValue("error", Error); + writer.WriteAdditionalData(AdditionalData); + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ErrorResponse_code : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.ErrorResponse.ErrorResponse_code CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.ErrorResponse.ErrorResponse_code(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/LoginResponse.cs b/src/GoAffPro.Client.Generated/Generated/Models/LoginResponse.cs new file mode 100644 index 0000000..ddbf540 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/LoginResponse.cs @@ -0,0 +1,65 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LoginResponse : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// The access_token property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? AccessToken { get; set; } +#nullable restore +#else + public string AccessToken { get; set; } +#endif + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// + /// Instantiates a new and sets the default values. + /// + public LoginResponse() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.LoginResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.LoginResponse(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "access_token", n => { AccessToken = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("access_token", AccessToken); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/PendingPayoutBreakdown.cs b/src/GoAffPro.Client.Generated/Generated/Models/PendingPayoutBreakdown.cs new file mode 100644 index 0000000..f82d907 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/PendingPayoutBreakdown.cs @@ -0,0 +1,71 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PendingPayoutBreakdown : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The amount_pending property + public double? AmountPending { get; set; } + /// The other_earnings property + public double? OtherEarnings { get; set; } + /// The paid_earnings property + public double? PaidEarnings { get; set; } + /// The sale_earnings property + public double? SaleEarnings { get; set; } + /// + /// Instantiates a new and sets the default values. + /// + public PendingPayoutBreakdown() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.PendingPayoutBreakdown CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.PendingPayoutBreakdown(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "amount_pending", n => { AmountPending = n.GetDoubleValue(); } }, + { "other_earnings", n => { OtherEarnings = n.GetDoubleValue(); } }, + { "paid_earnings", n => { PaidEarnings = n.GetDoubleValue(); } }, + { "sale_earnings", n => { SaleEarnings = n.GetDoubleValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteDoubleValue("amount_pending", AmountPending); + writer.WriteDoubleValue("other_earnings", OtherEarnings); + writer.WriteDoubleValue("paid_earnings", PaidEarnings); + writer.WriteDoubleValue("sale_earnings", SaleEarnings); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/PendingPayoutItem.cs b/src/GoAffPro.Client.Generated/Generated/Models/PendingPayoutItem.cs new file mode 100644 index 0000000..c06630e --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/PendingPayoutItem.cs @@ -0,0 +1,55 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PendingPayoutItem : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// + /// Instantiates a new and sets the default values. + /// + public PendingPayoutItem() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.PendingPayoutItem CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.PendingPayoutItem(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/PublicProductsResponse.cs b/src/GoAffPro.Client.Generated/Generated/Models/PublicProductsResponse.cs new file mode 100644 index 0000000..e63c409 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/PublicProductsResponse.cs @@ -0,0 +1,66 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PublicProductsResponse : global::GoAffPro.Client.Generated.Models.CountLimitOffsetEnvelopeFlexibleOffset, IParsable + #pragma warning restore CS1591 + { + /// The products property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Products { get; set; } +#nullable restore +#else + public List Products { get; set; } +#endif + /// The site_ids property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? SiteIds { get; set; } +#nullable restore +#else + public string SiteIds { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::GoAffPro.Client.Generated.Models.PublicProductsResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.PublicProductsResponse(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "products", n => { Products = n.GetCollectionOfObjectValues(global::GoAffPro.Client.Generated.Models.PublicProductsResponse_products.CreateFromDiscriminatorValue)?.AsList(); } }, + { "site_ids", n => { SiteIds = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("products", Products); + writer.WriteStringValue("site_ids", SiteIds); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/PublicProductsResponse_products.cs b/src/GoAffPro.Client.Generated/Generated/Models/PublicProductsResponse_products.cs new file mode 100644 index 0000000..397f41c --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/PublicProductsResponse_products.cs @@ -0,0 +1,55 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PublicProductsResponse_products : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// + /// Instantiates a new and sets the default values. + /// + public PublicProductsResponse_products() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.PublicProductsResponse_products CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.PublicProductsResponse_products(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/PublicSitesResponse.cs b/src/GoAffPro.Client.Generated/Generated/Models/PublicSitesResponse.cs new file mode 100644 index 0000000..6dbe4c5 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/PublicSitesResponse.cs @@ -0,0 +1,76 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PublicSitesResponse : global::GoAffPro.Client.Generated.Models.CountLimitOffsetEnvelopeFlexibleOffset, IParsable + #pragma warning restore CS1591 + { + /// The currency property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Currency { get; set; } +#nullable restore +#else + public string Currency { get; set; } +#endif + /// The keyword property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Keyword { get; set; } +#nullable restore +#else + public string Keyword { get; set; } +#endif + /// The stores property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Stores { get; set; } +#nullable restore +#else + public List Stores { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::GoAffPro.Client.Generated.Models.PublicSitesResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.PublicSitesResponse(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "currency", n => { Currency = n.GetStringValue(); } }, + { "keyword", n => { Keyword = n.GetStringValue(); } }, + { "stores", n => { Stores = n.GetCollectionOfObjectValues(global::GoAffPro.Client.Generated.Models.PublicStore.CreateFromDiscriminatorValue)?.AsList(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("currency", Currency); + writer.WriteStringValue("keyword", Keyword); + writer.WriteCollectionOfObjectValues("stores", Stores); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/PublicStore.cs b/src/GoAffPro.Client.Generated/Generated/Models/PublicStore.cs new file mode 100644 index 0000000..d9271cd --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/PublicStore.cs @@ -0,0 +1,131 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PublicStore : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The affiliatePortal property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? AffiliatePortal { get; set; } +#nullable restore +#else + public string AffiliatePortal { get; set; } +#endif + /// The areRegistrationsOpen property + public int? AreRegistrationsOpen { get; set; } + /// The commission property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.CommissionLike? Commission { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.CommissionLike Commission { get; set; } +#endif + /// The cookieDuration property + public int? CookieDuration { get; set; } + /// The currency property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Currency { get; set; } +#nullable restore +#else + public string Currency { get; set; } +#endif + /// The id property + public int? Id { get; set; } + /// The isApprovedAutomatically property + public int? IsApprovedAutomatically { get; set; } + /// The logo property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Logo { get; set; } +#nullable restore +#else + public string Logo { get; set; } +#endif + /// The name property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Name { get; set; } +#nullable restore +#else + public string Name { get; set; } +#endif + /// The website property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Website { get; set; } +#nullable restore +#else + public string Website { get; set; } +#endif + /// + /// Instantiates a new and sets the default values. + /// + public PublicStore() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.PublicStore CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.PublicStore(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "affiliatePortal", n => { AffiliatePortal = n.GetStringValue(); } }, + { "areRegistrationsOpen", n => { AreRegistrationsOpen = n.GetIntValue(); } }, + { "commission", n => { Commission = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.CommissionLike.CreateFromDiscriminatorValue); } }, + { "cookieDuration", n => { CookieDuration = n.GetIntValue(); } }, + { "currency", n => { Currency = n.GetStringValue(); } }, + { "id", n => { Id = n.GetIntValue(); } }, + { "isApprovedAutomatically", n => { IsApprovedAutomatically = n.GetIntValue(); } }, + { "logo", n => { Logo = n.GetStringValue(); } }, + { "name", n => { Name = n.GetStringValue(); } }, + { "website", n => { Website = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("affiliatePortal", AffiliatePortal); + writer.WriteIntValue("areRegistrationsOpen", AreRegistrationsOpen); + writer.WriteObjectValue("commission", Commission); + writer.WriteIntValue("cookieDuration", CookieDuration); + writer.WriteStringValue("currency", Currency); + writer.WriteIntValue("id", Id); + writer.WriteIntValue("isApprovedAutomatically", IsApprovedAutomatically); + writer.WriteStringValue("logo", Logo); + writer.WriteStringValue("name", Name); + writer.WriteStringValue("website", Website); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse.cs new file mode 100644 index 0000000..fb905eb --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse.cs @@ -0,0 +1,105 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserCommissionsResponse : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The commissions property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Commissions { get; set; } +#nullable restore +#else + public List Commissions { get; set; } +#endif + /// The mlm property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserCommissionsResponse_mlm? Mlm { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserCommissionsResponse_mlm Mlm { get; set; } +#endif + /// The royalties property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Royalties { get; set; } +#nullable restore +#else + public List Royalties { get; set; } +#endif + /// The special property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Special { get; set; } +#nullable restore +#else + public List Special { get; set; } +#endif + /// The standard property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserCommissionsResponse_standard? Standard { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserCommissionsResponse_standard Standard { get; set; } +#endif + /// + /// Instantiates a new and sets the default values. + /// + public UserCommissionsResponse() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserCommissionsResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserCommissionsResponse(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "commissions", n => { Commissions = n.GetCollectionOfPrimitiveValues()?.AsList(); } }, + { "mlm", n => { Mlm = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserCommissionsResponse_mlm.CreateFromDiscriminatorValue); } }, + { "royalties", n => { Royalties = n.GetCollectionOfObjectValues(global::GoAffPro.Client.Generated.Models.UserCommissionsResponse_royalties.CreateFromDiscriminatorValue)?.AsList(); } }, + { "special", n => { Special = n.GetCollectionOfObjectValues(global::GoAffPro.Client.Generated.Models.UserCommissionsResponse_special.CreateFromDiscriminatorValue)?.AsList(); } }, + { "standard", n => { Standard = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserCommissionsResponse_standard.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfPrimitiveValues("commissions", Commissions); + writer.WriteObjectValue("mlm", Mlm); + writer.WriteCollectionOfObjectValues("royalties", Royalties); + writer.WriteCollectionOfObjectValues("special", Special); + writer.WriteObjectValue("standard", Standard); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse_mlm.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse_mlm.cs new file mode 100644 index 0000000..a45b2f9 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse_mlm.cs @@ -0,0 +1,55 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserCommissionsResponse_mlm : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// + /// Instantiates a new and sets the default values. + /// + public UserCommissionsResponse_mlm() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserCommissionsResponse_mlm CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserCommissionsResponse_mlm(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse_royalties.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse_royalties.cs new file mode 100644 index 0000000..f205aa8 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse_royalties.cs @@ -0,0 +1,55 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserCommissionsResponse_royalties : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// + /// Instantiates a new and sets the default values. + /// + public UserCommissionsResponse_royalties() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserCommissionsResponse_royalties CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserCommissionsResponse_royalties(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse_special.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse_special.cs new file mode 100644 index 0000000..6d08c62 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse_special.cs @@ -0,0 +1,55 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserCommissionsResponse_special : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// + /// Instantiates a new and sets the default values. + /// + public UserCommissionsResponse_special() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserCommissionsResponse_special CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserCommissionsResponse_special(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse_standard.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse_standard.cs new file mode 100644 index 0000000..9fb5c78 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserCommissionsResponse_standard.cs @@ -0,0 +1,55 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserCommissionsResponse_standard : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// + /// Instantiates a new and sets the default values. + /// + public UserCommissionsResponse_standard() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserCommissionsResponse_standard CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserCommissionsResponse_standard(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserOrderFeedItem.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserOrderFeedItem.cs new file mode 100644 index 0000000..0be307d --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserOrderFeedItem.cs @@ -0,0 +1,559 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserOrderFeedItem : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The affiliate_id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_affiliate_id? AffiliateId { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_affiliate_id AffiliateId { get; set; } +#endif + /// The commission property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_commission? Commission { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_commission Commission { get; set; } +#endif + /// The conversion_details property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserOrderFeedItem_conversion_details? ConversionDetails { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserOrderFeedItem_conversion_details ConversionDetails { get; set; } +#endif + /// The created property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_created? Created { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_created Created { get; set; } +#endif + /// The created_at property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? CreatedAt { get; set; } +#nullable restore +#else + public string CreatedAt { get; set; } +#endif + /// The currency property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Currency { get; set; } +#nullable restore +#else + public string Currency { get; set; } +#endif + /// The id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_id? Id { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_id Id { get; set; } +#endif + /// The line_items property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? LineItems { get; set; } +#nullable restore +#else + public List LineItems { get; set; } +#endif + /// The number property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Number { get; set; } +#nullable restore +#else + public string Number { get; set; } +#endif + /// The order_id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_order_id? OrderId { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_order_id OrderId { get; set; } +#endif + /// The site_id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_site_id? SiteId { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_site_id SiteId { get; set; } +#endif + /// The status property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Status { get; set; } +#nullable restore +#else + public string Status { get; set; } +#endif + /// The sub_id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? SubId { get; set; } +#nullable restore +#else + public string SubId { get; set; } +#endif + /// The subtotal property + public double? Subtotal { get; set; } + /// The total property + public double? Total { get; set; } + /// + /// Instantiates a new and sets the default values. + /// + public UserOrderFeedItem() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserOrderFeedItem CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserOrderFeedItem(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "affiliate_id", n => { AffiliateId = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_affiliate_id.CreateFromDiscriminatorValue); } }, + { "commission", n => { Commission = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_commission.CreateFromDiscriminatorValue); } }, + { "conversion_details", n => { ConversionDetails = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserOrderFeedItem_conversion_details.CreateFromDiscriminatorValue); } }, + { "created", n => { Created = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_created.CreateFromDiscriminatorValue); } }, + { "created_at", n => { CreatedAt = n.GetStringValue(); } }, + { "currency", n => { Currency = n.GetStringValue(); } }, + { "id", n => { Id = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_id.CreateFromDiscriminatorValue); } }, + { "line_items", n => { LineItems = n.GetCollectionOfObjectValues(global::GoAffPro.Client.Generated.Models.UserOrderFeedItem_line_items.CreateFromDiscriminatorValue)?.AsList(); } }, + { "number", n => { Number = n.GetStringValue(); } }, + { "order_id", n => { OrderId = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_order_id.CreateFromDiscriminatorValue); } }, + { "site_id", n => { SiteId = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_site_id.CreateFromDiscriminatorValue); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "sub_id", n => { SubId = n.GetStringValue(); } }, + { "subtotal", n => { Subtotal = n.GetDoubleValue(); } }, + { "total", n => { Total = n.GetDoubleValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("affiliate_id", AffiliateId); + writer.WriteObjectValue("commission", Commission); + writer.WriteObjectValue("conversion_details", ConversionDetails); + writer.WriteObjectValue("created", Created); + writer.WriteStringValue("created_at", CreatedAt); + writer.WriteStringValue("currency", Currency); + writer.WriteObjectValue("id", Id); + writer.WriteCollectionOfObjectValues("line_items", LineItems); + writer.WriteStringValue("number", Number); + writer.WriteObjectValue("order_id", OrderId); + writer.WriteObjectValue("site_id", SiteId); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("sub_id", SubId); + writer.WriteDoubleValue("subtotal", Subtotal); + writer.WriteDoubleValue("total", Total); + writer.WriteAdditionalData(AdditionalData); + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserOrderFeedItem_affiliate_id : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_affiliate_id CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_affiliate_id(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserOrderFeedItem_commission : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public double? Double { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_commission CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_commission(); + if(parseNode.GetDoubleValue() is double doubleValue) + { + result.Double = doubleValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Double != null) + { + writer.WriteDoubleValue(null, Double); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserOrderFeedItem_created : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_created CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_created(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserOrderFeedItem_id : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_id CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_id(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserOrderFeedItem_order_id : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_order_id CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_order_id(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserOrderFeedItem_site_id : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_site_id CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.UserOrderFeedItem_site_id(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserOrderFeedItem_conversion_details.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserOrderFeedItem_conversion_details.cs new file mode 100644 index 0000000..76fe3c9 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserOrderFeedItem_conversion_details.cs @@ -0,0 +1,55 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserOrderFeedItem_conversion_details : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// + /// Instantiates a new and sets the default values. + /// + public UserOrderFeedItem_conversion_details() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserOrderFeedItem_conversion_details CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserOrderFeedItem_conversion_details(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserOrderFeedItem_line_items.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserOrderFeedItem_line_items.cs new file mode 100644 index 0000000..42a7c79 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserOrderFeedItem_line_items.cs @@ -0,0 +1,55 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserOrderFeedItem_line_items : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// + /// Instantiates a new and sets the default values. + /// + public UserOrderFeedItem_line_items() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserOrderFeedItem_line_items CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserOrderFeedItem_line_items(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserOrderFeedResponse.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserOrderFeedResponse.cs new file mode 100644 index 0000000..ae26897 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserOrderFeedResponse.cs @@ -0,0 +1,56 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserOrderFeedResponse : global::GoAffPro.Client.Generated.Models.CountLimitOffsetEnvelope, IParsable + #pragma warning restore CS1591 + { + /// The orders property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Orders { get; set; } +#nullable restore +#else + public List Orders { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::GoAffPro.Client.Generated.Models.UserOrderFeedResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserOrderFeedResponse(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "orders", n => { Orders = n.GetCollectionOfObjectValues(global::GoAffPro.Client.Generated.Models.UserOrderFeedItem.CreateFromDiscriminatorValue)?.AsList(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("orders", Orders); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserPayoutFeedItem.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserPayoutFeedItem.cs new file mode 100644 index 0000000..099f9f0 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserPayoutFeedItem.cs @@ -0,0 +1,460 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserPayoutFeedItem : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The affiliate_id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_affiliate_id? AffiliateId { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_affiliate_id AffiliateId { get; set; } +#endif + /// The amount property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_amount? Amount { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_amount Amount { get; set; } +#endif + /// The created property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_created? Created { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_created Created { get; set; } +#endif + /// The created_at property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? CreatedAt { get; set; } +#nullable restore +#else + public string CreatedAt { get; set; } +#endif + /// The currency property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Currency { get; set; } +#nullable restore +#else + public string Currency { get; set; } +#endif + /// The id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_id? Id { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_id Id { get; set; } +#endif + /// The payment_method property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? PaymentMethod { get; set; } +#nullable restore +#else + public string PaymentMethod { get; set; } +#endif + /// The payout_id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_payout_id? PayoutId { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_payout_id PayoutId { get; set; } +#endif + /// The status property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Status { get; set; } +#nullable restore +#else + public string Status { get; set; } +#endif + /// The transaction_id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? TransactionId { get; set; } +#nullable restore +#else + public string TransactionId { get; set; } +#endif + /// + /// Instantiates a new and sets the default values. + /// + public UserPayoutFeedItem() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "affiliate_id", n => { AffiliateId = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_affiliate_id.CreateFromDiscriminatorValue); } }, + { "amount", n => { Amount = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_amount.CreateFromDiscriminatorValue); } }, + { "created", n => { Created = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_created.CreateFromDiscriminatorValue); } }, + { "created_at", n => { CreatedAt = n.GetStringValue(); } }, + { "currency", n => { Currency = n.GetStringValue(); } }, + { "id", n => { Id = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_id.CreateFromDiscriminatorValue); } }, + { "payment_method", n => { PaymentMethod = n.GetStringValue(); } }, + { "payout_id", n => { PayoutId = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_payout_id.CreateFromDiscriminatorValue); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "transaction_id", n => { TransactionId = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("affiliate_id", AffiliateId); + writer.WriteObjectValue("amount", Amount); + writer.WriteObjectValue("created", Created); + writer.WriteStringValue("created_at", CreatedAt); + writer.WriteStringValue("currency", Currency); + writer.WriteObjectValue("id", Id); + writer.WriteStringValue("payment_method", PaymentMethod); + writer.WriteObjectValue("payout_id", PayoutId); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("transaction_id", TransactionId); + writer.WriteAdditionalData(AdditionalData); + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserPayoutFeedItem_affiliate_id : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_affiliate_id CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_affiliate_id(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserPayoutFeedItem_amount : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public double? Double { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_amount CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_amount(); + if(parseNode.GetDoubleValue() is double doubleValue) + { + result.Double = doubleValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Double != null) + { + writer.WriteDoubleValue(null, Double); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserPayoutFeedItem_created : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_created CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_created(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserPayoutFeedItem_id : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_id CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_id(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserPayoutFeedItem_payout_id : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_payout_id CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.UserPayoutFeedItem_payout_id(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserPayoutFeedResponse.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserPayoutFeedResponse.cs new file mode 100644 index 0000000..62f1723 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserPayoutFeedResponse.cs @@ -0,0 +1,148 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserPayoutFeedResponse : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The count property + public int? Count { get; set; } + /// The limit property + public int? Limit { get; set; } + /// The offset property + public int? Offset { get; set; } + /// The payouts property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Payouts { get; set; } +#nullable restore +#else + public List Payouts { get; set; } +#endif + /// The since_id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserPayoutFeedResponse.UserPayoutFeedResponse_since_id? SinceId { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserPayoutFeedResponse.UserPayoutFeedResponse_since_id SinceId { get; set; } +#endif + /// + /// Instantiates a new and sets the default values. + /// + public UserPayoutFeedResponse() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserPayoutFeedResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserPayoutFeedResponse(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "count", n => { Count = n.GetIntValue(); } }, + { "limit", n => { Limit = n.GetIntValue(); } }, + { "offset", n => { Offset = n.GetIntValue(); } }, + { "payouts", n => { Payouts = n.GetCollectionOfObjectValues(global::GoAffPro.Client.Generated.Models.UserPayoutFeedItem.CreateFromDiscriminatorValue)?.AsList(); } }, + { "since_id", n => { SinceId = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserPayoutFeedResponse.UserPayoutFeedResponse_since_id.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteIntValue("count", Count); + writer.WriteIntValue("limit", Limit); + writer.WriteIntValue("offset", Offset); + writer.WriteCollectionOfObjectValues("payouts", Payouts); + writer.WriteObjectValue("since_id", SinceId); + writer.WriteAdditionalData(AdditionalData); + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserPayoutFeedResponse_since_id : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserPayoutFeedResponse.UserPayoutFeedResponse_since_id CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserPayoutFeedResponse.UserPayoutFeedResponse_since_id(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserPendingPayoutsResponse.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserPendingPayoutsResponse.cs new file mode 100644 index 0000000..2049e2c --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserPendingPayoutsResponse.cs @@ -0,0 +1,136 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserPendingPayoutsResponse : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The pending property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserPendingPayoutsResponse.UserPendingPayoutsResponse_pending? Pending { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserPendingPayoutsResponse.UserPendingPayoutsResponse_pending Pending { get; set; } +#endif + /// + /// Instantiates a new and sets the default values. + /// + public UserPendingPayoutsResponse() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserPendingPayoutsResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserPendingPayoutsResponse(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "pending", n => { Pending = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserPendingPayoutsResponse.UserPendingPayoutsResponse_pending.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("pending", Pending); + writer.WriteAdditionalData(AdditionalData); + } + /// + /// Composed type wrapper for classes , List<global::GoAffPro.Client.Generated.Models.PendingPayoutItem> + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserPendingPayoutsResponse_pending : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.PendingPayoutBreakdown? PendingPayoutBreakdown { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.PendingPayoutBreakdown PendingPayoutBreakdown { get; set; } +#endif + /// Composed type representation for type List<global::GoAffPro.Client.Generated.Models.PendingPayoutItem> +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? PendingPayoutItem { get; set; } +#nullable restore +#else + public List PendingPayoutItem { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserPendingPayoutsResponse.UserPendingPayoutsResponse_pending CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserPendingPayoutsResponse.UserPendingPayoutsResponse_pending(); + if("PendingPayoutBreakdown".Equals(mappingValue, StringComparison.OrdinalIgnoreCase)) + { + result.PendingPayoutBreakdown = new global::GoAffPro.Client.Generated.Models.PendingPayoutBreakdown(); + } + else if(parseNode.GetCollectionOfObjectValues(global::GoAffPro.Client.Generated.Models.PendingPayoutItem.CreateFromDiscriminatorValue)?.AsList() is List pendingPayoutItemValue) + { + result.PendingPayoutItem = pendingPayoutItemValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + if(PendingPayoutBreakdown != null) + { + return PendingPayoutBreakdown.GetFieldDeserializers(); + } + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(PendingPayoutBreakdown != null) + { + writer.WriteObjectValue(null, PendingPayoutBreakdown); + } + else if(PendingPayoutItem != null) + { + writer.WriteCollectionOfObjectValues(null, PendingPayoutItem); + } + } + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserProductFeedItem.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserProductFeedItem.cs new file mode 100644 index 0000000..63b0780 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserProductFeedItem.cs @@ -0,0 +1,409 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserProductFeedItem : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The category property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Category { get; set; } +#nullable restore +#else + public string Category { get; set; } +#endif + /// The currency property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Currency { get; set; } +#nullable restore +#else + public string Currency { get; set; } +#endif + /// The description property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Description { get; set; } +#nullable restore +#else + public string Description { get; set; } +#endif + /// The id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_id? Id { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_id Id { get; set; } +#endif + /// The image_url property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? ImageUrl { get; set; } +#nullable restore +#else + public string ImageUrl { get; set; } +#endif + /// The name property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Name { get; set; } +#nullable restore +#else + public string Name { get; set; } +#endif + /// The price property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_price? Price { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_price Price { get; set; } +#endif + /// The product_id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_product_id? ProductId { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_product_id ProductId { get; set; } +#endif + /// The product_url property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? ProductUrl { get; set; } +#nullable restore +#else + public string ProductUrl { get; set; } +#endif + /// The sale_price property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_sale_price? SalePrice { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_sale_price SalePrice { get; set; } +#endif + /// The sku property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Sku { get; set; } +#nullable restore +#else + public string Sku { get; set; } +#endif + /// + /// Instantiates a new and sets the default values. + /// + public UserProductFeedItem() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserProductFeedItem CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserProductFeedItem(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "category", n => { Category = n.GetStringValue(); } }, + { "currency", n => { Currency = n.GetStringValue(); } }, + { "description", n => { Description = n.GetStringValue(); } }, + { "id", n => { Id = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_id.CreateFromDiscriminatorValue); } }, + { "image_url", n => { ImageUrl = n.GetStringValue(); } }, + { "name", n => { Name = n.GetStringValue(); } }, + { "price", n => { Price = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_price.CreateFromDiscriminatorValue); } }, + { "product_id", n => { ProductId = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_product_id.CreateFromDiscriminatorValue); } }, + { "product_url", n => { ProductUrl = n.GetStringValue(); } }, + { "sale_price", n => { SalePrice = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_sale_price.CreateFromDiscriminatorValue); } }, + { "sku", n => { Sku = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("category", Category); + writer.WriteStringValue("currency", Currency); + writer.WriteStringValue("description", Description); + writer.WriteObjectValue("id", Id); + writer.WriteStringValue("image_url", ImageUrl); + writer.WriteStringValue("name", Name); + writer.WriteObjectValue("price", Price); + writer.WriteObjectValue("product_id", ProductId); + writer.WriteStringValue("product_url", ProductUrl); + writer.WriteObjectValue("sale_price", SalePrice); + writer.WriteStringValue("sku", Sku); + writer.WriteAdditionalData(AdditionalData); + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserProductFeedItem_id : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_id CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_id(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserProductFeedItem_price : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public double? Double { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_price CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_price(); + if(parseNode.GetDoubleValue() is double doubleValue) + { + result.Double = doubleValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Double != null) + { + writer.WriteDoubleValue(null, Double); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserProductFeedItem_product_id : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_product_id CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_product_id(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserProductFeedItem_sale_price : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public double? Double { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_sale_price CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserProductFeedItem.UserProductFeedItem_sale_price(); + if(parseNode.GetDoubleValue() is double doubleValue) + { + result.Double = doubleValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Double != null) + { + writer.WriteDoubleValue(null, Double); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserProductFeedResponse.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserProductFeedResponse.cs new file mode 100644 index 0000000..647c452 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserProductFeedResponse.cs @@ -0,0 +1,56 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserProductFeedResponse : global::GoAffPro.Client.Generated.Models.CountLimitOffsetEnvelopeFlexibleOffset, IParsable + #pragma warning restore CS1591 + { + /// The products property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Products { get; set; } +#nullable restore +#else + public List Products { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::GoAffPro.Client.Generated.Models.UserProductFeedResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserProductFeedResponse(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "products", n => { Products = n.GetCollectionOfObjectValues(global::GoAffPro.Client.Generated.Models.UserProductFeedItem.CreateFromDiscriminatorValue)?.AsList(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("products", Products); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserProfileEnvelope.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserProfileEnvelope.cs new file mode 100644 index 0000000..68f84d0 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserProfileEnvelope.cs @@ -0,0 +1,65 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserProfileEnvelope : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The user property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserProfileEnvelope_user? User { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserProfileEnvelope_user User { get; set; } +#endif + /// + /// Instantiates a new and sets the default values. + /// + public UserProfileEnvelope() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserProfileEnvelope CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserProfileEnvelope(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "user", n => { User = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserProfileEnvelope_user.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("user", User); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserProfileEnvelope_user.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserProfileEnvelope_user.cs new file mode 100644 index 0000000..2840e0d --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserProfileEnvelope_user.cs @@ -0,0 +1,55 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserProfileEnvelope_user : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// + /// Instantiates a new and sets the default values. + /// + public UserProfileEnvelope_user() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserProfileEnvelope_user CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserProfileEnvelope_user(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserProfileUpdateResponse.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserProfileUpdateResponse.cs new file mode 100644 index 0000000..3ab1ce7 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserProfileUpdateResponse.cs @@ -0,0 +1,59 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserProfileUpdateResponse : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The success property + public int? Success { get; set; } + /// + /// Instantiates a new and sets the default values. + /// + public UserProfileUpdateResponse() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserProfileUpdateResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserProfileUpdateResponse(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "success", n => { Success = n.GetIntValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteIntValue("success", Success); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserRewardFeedItem.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserRewardFeedItem.cs new file mode 100644 index 0000000..288d8f5 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserRewardFeedItem.cs @@ -0,0 +1,133 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserRewardFeedItem : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The affiliate_id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? AffiliateId { get; set; } +#nullable restore +#else + public string AffiliateId { get; set; } +#endif + /// The amount property + public double? Amount { get; set; } + /// The created property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Created { get; set; } +#nullable restore +#else + public string Created { get; set; } +#endif + /// The id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Id { get; set; } +#nullable restore +#else + public string Id { get; set; } +#endif + /// The level property + public int? Level { get; set; } + /// The metadata property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Metadata { get; set; } +#nullable restore +#else + public string Metadata { get; set; } +#endif + /// The order_id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? OrderId { get; set; } +#nullable restore +#else + public string OrderId { get; set; } +#endif + /// The status property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Status { get; set; } +#nullable restore +#else + public string Status { get; set; } +#endif + /// The type property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Type { get; set; } +#nullable restore +#else + public string Type { get; set; } +#endif + /// + /// Instantiates a new and sets the default values. + /// + public UserRewardFeedItem() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserRewardFeedItem CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserRewardFeedItem(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "affiliate_id", n => { AffiliateId = n.GetStringValue(); } }, + { "amount", n => { Amount = n.GetDoubleValue(); } }, + { "created", n => { Created = n.GetStringValue(); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "level", n => { Level = n.GetIntValue(); } }, + { "metadata", n => { Metadata = n.GetStringValue(); } }, + { "order_id", n => { OrderId = n.GetStringValue(); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "type", n => { Type = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("affiliate_id", AffiliateId); + writer.WriteDoubleValue("amount", Amount); + writer.WriteStringValue("created", Created); + writer.WriteStringValue("id", Id); + writer.WriteIntValue("level", Level); + writer.WriteStringValue("metadata", Metadata); + writer.WriteStringValue("order_id", OrderId); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("type", Type); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserRewardFeedResponse.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserRewardFeedResponse.cs new file mode 100644 index 0000000..f6a5688 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserRewardFeedResponse.cs @@ -0,0 +1,56 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserRewardFeedResponse : global::GoAffPro.Client.Generated.Models.CountLimitOffsetEnvelope, IParsable + #pragma warning restore CS1591 + { + /// The rewards property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Rewards { get; set; } +#nullable restore +#else + public List Rewards { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::GoAffPro.Client.Generated.Models.UserRewardFeedResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserRewardFeedResponse(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "rewards", n => { Rewards = n.GetCollectionOfObjectValues(global::GoAffPro.Client.Generated.Models.UserRewardFeedItem.CreateFromDiscriminatorValue)?.AsList(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("rewards", Rewards); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserSite.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserSite.cs new file mode 100644 index 0000000..52b0d5a --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserSite.cs @@ -0,0 +1,155 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserSite : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The affiliate_portal property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? AffiliatePortal { get; set; } +#nullable restore +#else + public string AffiliatePortal { get; set; } +#endif + /// The coupon property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserSite_coupon? Coupon { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserSite_coupon Coupon { get; set; } +#endif + /// The currency property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Currency { get; set; } +#nullable restore +#else + public string Currency { get; set; } +#endif + /// The id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Id { get; set; } +#nullable restore +#else + public string Id { get; set; } +#endif + /// The logo property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Logo { get; set; } +#nullable restore +#else + public string Logo { get; set; } +#endif + /// The name property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Name { get; set; } +#nullable restore +#else + public string Name { get; set; } +#endif + /// The ref_code property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? RefCode { get; set; } +#nullable restore +#else + public string RefCode { get; set; } +#endif + /// The referral_link property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? ReferralLink { get; set; } +#nullable restore +#else + public string ReferralLink { get; set; } +#endif + /// The status property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Status { get; set; } +#nullable restore +#else + public string Status { get; set; } +#endif + /// The website property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Website { get; set; } +#nullable restore +#else + public string Website { get; set; } +#endif + /// + /// Instantiates a new and sets the default values. + /// + public UserSite() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserSite CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserSite(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "affiliate_portal", n => { AffiliatePortal = n.GetStringValue(); } }, + { "coupon", n => { Coupon = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserSite_coupon.CreateFromDiscriminatorValue); } }, + { "currency", n => { Currency = n.GetStringValue(); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "logo", n => { Logo = n.GetStringValue(); } }, + { "name", n => { Name = n.GetStringValue(); } }, + { "ref_code", n => { RefCode = n.GetStringValue(); } }, + { "referral_link", n => { ReferralLink = n.GetStringValue(); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "website", n => { Website = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("affiliate_portal", AffiliatePortal); + writer.WriteObjectValue("coupon", Coupon); + writer.WriteStringValue("currency", Currency); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("logo", Logo); + writer.WriteStringValue("name", Name); + writer.WriteStringValue("ref_code", RefCode); + writer.WriteStringValue("referral_link", ReferralLink); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("website", Website); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserSiteListResponse.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserSiteListResponse.cs new file mode 100644 index 0000000..b1673ab --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserSiteListResponse.cs @@ -0,0 +1,69 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserSiteListResponse : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The count property + public int? Count { get; set; } + /// The sites property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Sites { get; set; } +#nullable restore +#else + public List Sites { get; set; } +#endif + /// + /// Instantiates a new and sets the default values. + /// + public UserSiteListResponse() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserSiteListResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserSiteListResponse(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "count", n => { Count = n.GetIntValue(); } }, + { "sites", n => { Sites = n.GetCollectionOfObjectValues(global::GoAffPro.Client.Generated.Models.UserSite.CreateFromDiscriminatorValue)?.AsList(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteIntValue("count", Count); + writer.WriteCollectionOfObjectValues("sites", Sites); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserSite_coupon.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserSite_coupon.cs new file mode 100644 index 0000000..f3d389d --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserSite_coupon.cs @@ -0,0 +1,55 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserSite_coupon : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// + /// Instantiates a new and sets the default values. + /// + public UserSite_coupon() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserSite_coupon CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserSite_coupon(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserStatsAggregateItem.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserStatsAggregateItem.cs new file mode 100644 index 0000000..adc7338 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserStatsAggregateItem.cs @@ -0,0 +1,85 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserStatsAggregateItem : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The commission_paid property + public double? CommissionPaid { get; set; } + /// The currency property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Currency { get; set; } +#nullable restore +#else + public string Currency { get; set; } +#endif + /// The revenue_generated property + public double? RevenueGenerated { get; set; } + /// The sale_commission_earned property + public double? SaleCommissionEarned { get; set; } + /// The site_id property + public int? SiteId { get; set; } + /// The total_sales property + public double? TotalSales { get; set; } + /// + /// Instantiates a new and sets the default values. + /// + public UserStatsAggregateItem() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserStatsAggregateItem CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserStatsAggregateItem(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "commission_paid", n => { CommissionPaid = n.GetDoubleValue(); } }, + { "currency", n => { Currency = n.GetStringValue(); } }, + { "revenue_generated", n => { RevenueGenerated = n.GetDoubleValue(); } }, + { "sale_commission_earned", n => { SaleCommissionEarned = n.GetDoubleValue(); } }, + { "site_id", n => { SiteId = n.GetIntValue(); } }, + { "total_sales", n => { TotalSales = n.GetDoubleValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteDoubleValue("commission_paid", CommissionPaid); + writer.WriteStringValue("currency", Currency); + writer.WriteDoubleValue("revenue_generated", RevenueGenerated); + writer.WriteDoubleValue("sale_commission_earned", SaleCommissionEarned); + writer.WriteIntValue("site_id", SiteId); + writer.WriteDoubleValue("total_sales", TotalSales); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserStatsAggregateResponse.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserStatsAggregateResponse.cs new file mode 100644 index 0000000..eccfb37 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserStatsAggregateResponse.cs @@ -0,0 +1,65 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserStatsAggregateResponse : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Data { get; set; } +#nullable restore +#else + public List Data { get; set; } +#endif + /// + /// Instantiates a new and sets the default values. + /// + public UserStatsAggregateResponse() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserStatsAggregateResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserStatsAggregateResponse(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::GoAffPro.Client.Generated.Models.UserStatsAggregateItem.CreateFromDiscriminatorValue)?.AsList(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserTrafficFeedItem.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserTrafficFeedItem.cs new file mode 100644 index 0000000..586a3e8 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserTrafficFeedItem.cs @@ -0,0 +1,571 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserTrafficFeedItem : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The affiliate_id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_affiliate_id? AffiliateId { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_affiliate_id AffiliateId { get; set; } +#endif + /// The country property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Country { get; set; } +#nullable restore +#else + public string Country { get; set; } +#endif + /// The created property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_created? Created { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_created Created { get; set; } +#endif + /// The created_at property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? CreatedAt { get; set; } +#nullable restore +#else + public string CreatedAt { get; set; } +#endif + /// The customer_id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_customer_id? CustomerId { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_customer_id CustomerId { get; set; } +#endif + /// The email property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Email { get; set; } +#nullable restore +#else + public string Email { get; set; } +#endif + /// The first_name property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? FirstName { get; set; } +#nullable restore +#else + public string FirstName { get; set; } +#endif + /// The group_id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_group_id? GroupId { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_group_id GroupId { get; set; } +#endif + /// The id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_id? Id { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_id Id { get; set; } +#endif + /// The last_name property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? LastName { get; set; } +#nullable restore +#else + public string LastName { get; set; } +#endif + /// The name property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Name { get; set; } +#nullable restore +#else + public string Name { get; set; } +#endif + /// The phone property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Phone { get; set; } +#nullable restore +#else + public string Phone { get; set; } +#endif + /// The ref_code property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? RefCode { get; set; } +#nullable restore +#else + public string RefCode { get; set; } +#endif + /// The site_id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_site_id? SiteId { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_site_id SiteId { get; set; } +#endif + /// The sub_id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? SubId { get; set; } +#nullable restore +#else + public string SubId { get; set; } +#endif + /// + /// Instantiates a new and sets the default values. + /// + public UserTrafficFeedItem() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "affiliate_id", n => { AffiliateId = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_affiliate_id.CreateFromDiscriminatorValue); } }, + { "country", n => { Country = n.GetStringValue(); } }, + { "created", n => { Created = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_created.CreateFromDiscriminatorValue); } }, + { "created_at", n => { CreatedAt = n.GetStringValue(); } }, + { "customer_id", n => { CustomerId = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_customer_id.CreateFromDiscriminatorValue); } }, + { "email", n => { Email = n.GetStringValue(); } }, + { "first_name", n => { FirstName = n.GetStringValue(); } }, + { "group_id", n => { GroupId = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_group_id.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_id.CreateFromDiscriminatorValue); } }, + { "last_name", n => { LastName = n.GetStringValue(); } }, + { "name", n => { Name = n.GetStringValue(); } }, + { "phone", n => { Phone = n.GetStringValue(); } }, + { "ref_code", n => { RefCode = n.GetStringValue(); } }, + { "site_id", n => { SiteId = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_site_id.CreateFromDiscriminatorValue); } }, + { "sub_id", n => { SubId = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("affiliate_id", AffiliateId); + writer.WriteStringValue("country", Country); + writer.WriteObjectValue("created", Created); + writer.WriteStringValue("created_at", CreatedAt); + writer.WriteObjectValue("customer_id", CustomerId); + writer.WriteStringValue("email", Email); + writer.WriteStringValue("first_name", FirstName); + writer.WriteObjectValue("group_id", GroupId); + writer.WriteObjectValue("id", Id); + writer.WriteStringValue("last_name", LastName); + writer.WriteStringValue("name", Name); + writer.WriteStringValue("phone", Phone); + writer.WriteStringValue("ref_code", RefCode); + writer.WriteObjectValue("site_id", SiteId); + writer.WriteStringValue("sub_id", SubId); + writer.WriteAdditionalData(AdditionalData); + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserTrafficFeedItem_affiliate_id : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_affiliate_id CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_affiliate_id(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserTrafficFeedItem_created : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_created CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_created(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserTrafficFeedItem_customer_id : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_customer_id CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_customer_id(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserTrafficFeedItem_group_id : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_group_id CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_group_id(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserTrafficFeedItem_id : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_id CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_id(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserTrafficFeedItem_site_id : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_site_id CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.UserTrafficFeedItem_site_id(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserTrafficFeedResponse.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserTrafficFeedResponse.cs new file mode 100644 index 0000000..860fb6e --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserTrafficFeedResponse.cs @@ -0,0 +1,148 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserTrafficFeedResponse : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The count property + public int? Count { get; set; } + /// The limit property + public int? Limit { get; set; } + /// The offset property + public int? Offset { get; set; } + /// The since_id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserTrafficFeedResponse.UserTrafficFeedResponse_since_id? SinceId { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserTrafficFeedResponse.UserTrafficFeedResponse_since_id SinceId { get; set; } +#endif + /// The traffic property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Traffic { get; set; } +#nullable restore +#else + public List Traffic { get; set; } +#endif + /// + /// Instantiates a new and sets the default values. + /// + public UserTrafficFeedResponse() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserTrafficFeedResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserTrafficFeedResponse(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "count", n => { Count = n.GetIntValue(); } }, + { "limit", n => { Limit = n.GetIntValue(); } }, + { "offset", n => { Offset = n.GetIntValue(); } }, + { "since_id", n => { SinceId = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserTrafficFeedResponse.UserTrafficFeedResponse_since_id.CreateFromDiscriminatorValue); } }, + { "traffic", n => { Traffic = n.GetCollectionOfObjectValues(global::GoAffPro.Client.Generated.Models.UserTrafficFeedItem.CreateFromDiscriminatorValue)?.AsList(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteIntValue("count", Count); + writer.WriteIntValue("limit", Limit); + writer.WriteIntValue("offset", Offset); + writer.WriteObjectValue("since_id", SinceId); + writer.WriteCollectionOfObjectValues("traffic", Traffic); + writer.WriteAdditionalData(AdditionalData); + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserTrafficFeedResponse_since_id : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserTrafficFeedResponse.UserTrafficFeedResponse_since_id CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserTrafficFeedResponse.UserTrafficFeedResponse_since_id(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserTransactionFeedResponse.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserTransactionFeedResponse.cs new file mode 100644 index 0000000..777168d --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserTransactionFeedResponse.cs @@ -0,0 +1,144 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserTransactionFeedResponse : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The count property + public int? Count { get; set; } + /// The limit property + public int? Limit { get; set; } + /// The offset property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserTransactionFeedResponse.UserTransactionFeedResponse_offset? Offset { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserTransactionFeedResponse.UserTransactionFeedResponse_offset Offset { get; set; } +#endif + /// The transactions property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Transactions { get; set; } +#nullable restore +#else + public List Transactions { get; set; } +#endif + /// + /// Instantiates a new and sets the default values. + /// + public UserTransactionFeedResponse() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserTransactionFeedResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserTransactionFeedResponse(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "count", n => { Count = n.GetIntValue(); } }, + { "limit", n => { Limit = n.GetIntValue(); } }, + { "offset", n => { Offset = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserTransactionFeedResponse.UserTransactionFeedResponse_offset.CreateFromDiscriminatorValue); } }, + { "transactions", n => { Transactions = n.GetCollectionOfObjectValues(global::GoAffPro.Client.Generated.Models.UserTransactionItem.CreateFromDiscriminatorValue)?.AsList(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteIntValue("count", Count); + writer.WriteIntValue("limit", Limit); + writer.WriteObjectValue("offset", Offset); + writer.WriteCollectionOfObjectValues("transactions", Transactions); + writer.WriteAdditionalData(AdditionalData); + } + /// + /// Composed type wrapper for classes , + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserTransactionFeedResponse_offset : IComposedTypeWrapper, IParsable + { + /// Composed type representation for type + public int? Integer { get; set; } + /// Composed type representation for type +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? String { get; set; } +#nullable restore +#else + public string String { get; set; } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserTransactionFeedResponse.UserTransactionFeedResponse_offset CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("")?.GetStringValue(); + var result = new global::GoAffPro.Client.Generated.Models.UserTransactionFeedResponse.UserTransactionFeedResponse_offset(); + if(parseNode.GetIntValue() is int integerValue) + { + result.Integer = integerValue; + } + else if(parseNode.GetStringValue() is string stringValue) + { + result.String = stringValue; + } + return result; + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary>(); + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + if(Integer != null) + { + writer.WriteIntValue(null, Integer); + } + else if(String != null) + { + writer.WriteStringValue(null, String); + } + } + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserTransactionItem.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserTransactionItem.cs new file mode 100644 index 0000000..d347b04 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserTransactionItem.cs @@ -0,0 +1,137 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserTransactionItem : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The affiliate_id property + public int? AffiliateId { get; set; } + /// The amount property + public double? Amount { get; set; } + /// The created_at property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? CreatedAt { get; set; } +#nullable restore +#else + public string CreatedAt { get; set; } +#endif + /// The currency property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Currency { get; set; } +#nullable restore +#else + public string Currency { get; set; } +#endif + /// The endingBalance property + public double? EndingBalance { get; set; } + /// The entity_id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? EntityId { get; set; } +#nullable restore +#else + public string EntityId { get; set; } +#endif + /// The entity_type property + public global::GoAffPro.Client.Generated.Models.UserTransactionItem_entity_type? EntityType { get; set; } + /// The event_type property + public global::GoAffPro.Client.Generated.Models.UserTransactionItem_event_type? EventType { get; set; } + /// The id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Id { get; set; } +#nullable restore +#else + public string Id { get; set; } +#endif + /// The is_paid property + public bool? IsPaid { get; set; } + /// The metadata property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::GoAffPro.Client.Generated.Models.UserTransactionItem_metadata? Metadata { get; set; } +#nullable restore +#else + public global::GoAffPro.Client.Generated.Models.UserTransactionItem_metadata Metadata { get; set; } +#endif + /// The startingBalance property + public double? StartingBalance { get; set; } + /// The tx_id property + public int? TxId { get; set; } + /// + /// Instantiates a new and sets the default values. + /// + public UserTransactionItem() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserTransactionItem CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserTransactionItem(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "affiliate_id", n => { AffiliateId = n.GetIntValue(); } }, + { "amount", n => { Amount = n.GetDoubleValue(); } }, + { "created_at", n => { CreatedAt = n.GetStringValue(); } }, + { "currency", n => { Currency = n.GetStringValue(); } }, + { "endingBalance", n => { EndingBalance = n.GetDoubleValue(); } }, + { "entity_id", n => { EntityId = n.GetStringValue(); } }, + { "entity_type", n => { EntityType = n.GetEnumValue(); } }, + { "event_type", n => { EventType = n.GetEnumValue(); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "is_paid", n => { IsPaid = n.GetBoolValue(); } }, + { "metadata", n => { Metadata = n.GetObjectValue(global::GoAffPro.Client.Generated.Models.UserTransactionItem_metadata.CreateFromDiscriminatorValue); } }, + { "startingBalance", n => { StartingBalance = n.GetDoubleValue(); } }, + { "tx_id", n => { TxId = n.GetIntValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteIntValue("affiliate_id", AffiliateId); + writer.WriteDoubleValue("amount", Amount); + writer.WriteStringValue("created_at", CreatedAt); + writer.WriteStringValue("currency", Currency); + writer.WriteDoubleValue("endingBalance", EndingBalance); + writer.WriteStringValue("entity_id", EntityId); + writer.WriteEnumValue("entity_type", EntityType); + writer.WriteEnumValue("event_type", EventType); + writer.WriteStringValue("id", Id); + writer.WriteBoolValue("is_paid", IsPaid); + writer.WriteObjectValue("metadata", Metadata); + writer.WriteDoubleValue("startingBalance", StartingBalance); + writer.WriteIntValue("tx_id", TxId); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserTransactionItem_entity_type.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserTransactionItem_entity_type.cs new file mode 100644 index 0000000..b1ba35a --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserTransactionItem_entity_type.cs @@ -0,0 +1,24 @@ +// +using System.Runtime.Serialization; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum UserTransactionItem_entity_type + #pragma warning restore CS1591 + { + [EnumMember(Value = "orders")] + #pragma warning disable CS1591 + Orders, + #pragma warning restore CS1591 + [EnumMember(Value = "rewards")] + #pragma warning disable CS1591 + Rewards, + #pragma warning restore CS1591 + [EnumMember(Value = "payouts")] + #pragma warning disable CS1591 + Payouts, + #pragma warning restore CS1591 + } +} diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserTransactionItem_event_type.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserTransactionItem_event_type.cs new file mode 100644 index 0000000..3500b78 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserTransactionItem_event_type.cs @@ -0,0 +1,24 @@ +// +using System.Runtime.Serialization; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum UserTransactionItem_event_type + #pragma warning restore CS1591 + { + [EnumMember(Value = "insert")] + #pragma warning disable CS1591 + Insert, + #pragma warning restore CS1591 + [EnumMember(Value = "update")] + #pragma warning disable CS1591 + Update, + #pragma warning restore CS1591 + [EnumMember(Value = "delete")] + #pragma warning disable CS1591 + Delete, + #pragma warning restore CS1591 + } +} diff --git a/src/GoAffPro.Client.Generated/Generated/Models/UserTransactionItem_metadata.cs b/src/GoAffPro.Client.Generated/Generated/Models/UserTransactionItem_metadata.cs new file mode 100644 index 0000000..0f7f119 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Models/UserTransactionItem_metadata.cs @@ -0,0 +1,55 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UserTransactionItem_metadata : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// + /// Instantiates a new and sets the default values. + /// + public UserTransactionItem_metadata() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.Models.UserTransactionItem_metadata CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.Models.UserTransactionItem_metadata(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Public/Products/ProductsRequestBuilder.cs b/src/GoAffPro.Client.Generated/Generated/Public/Products/ProductsRequestBuilder.cs new file mode 100644 index 0000000..3c21caf --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Public/Products/ProductsRequestBuilder.cs @@ -0,0 +1,119 @@ +// +#pragma warning disable CS0618 +using GoAffPro.Client.Generated.Models; +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace GoAffPro.Client.Generated.Public.Products +{ + /// + /// Builds and executes requests for operations under \public\products + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ProductsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ProductsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/public/products{?limit*,offset*,site_ids*}", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ProductsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/public/products{?limit*,offset*,site_ids*}", rawUrl) + { + } + /// + /// Public marketplace products + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 500 status code + /// When receiving a 502 status code +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) + { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "500", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "502", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::GoAffPro.Client.Generated.Models.PublicProductsResponse.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Public marketplace products + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) + { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/json"); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::GoAffPro.Client.Generated.Public.Products.ProductsRequestBuilder WithUrl(string rawUrl) + { + return new global::GoAffPro.Client.Generated.Public.Products.ProductsRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Public marketplace products + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ProductsRequestBuilderGetQueryParameters + { + [QueryParameter("limit")] + public int? Limit { get; set; } + [QueryParameter("offset")] + public int? Offset { get; set; } +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("site_ids")] + public string? SiteIds { get; set; } +#nullable restore +#else + [QueryParameter("site_ids")] + public string SiteIds { get; set; } +#endif + } + /// + /// Configuration for the request such as headers, query parameters, and middleware options. + /// + [Obsolete("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")] + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ProductsRequestBuilderGetRequestConfiguration : RequestConfiguration + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Public/PublicRequestBuilder.cs b/src/GoAffPro.Client.Generated/Generated/Public/PublicRequestBuilder.cs new file mode 100644 index 0000000..39f134e --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Public/PublicRequestBuilder.cs @@ -0,0 +1,47 @@ +// +#pragma warning disable CS0618 +using GoAffPro.Client.Generated.Public.Products; +using GoAffPro.Client.Generated.Public.Sites; +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace GoAffPro.Client.Generated.Public +{ + /// + /// Builds and executes requests for operations under \public + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class PublicRequestBuilder : BaseRequestBuilder + { + /// The products property + public global::GoAffPro.Client.Generated.Public.Products.ProductsRequestBuilder Products + { + get => new global::GoAffPro.Client.Generated.Public.Products.ProductsRequestBuilder(PathParameters, RequestAdapter); + } + /// The sites property + public global::GoAffPro.Client.Generated.Public.Sites.SitesRequestBuilder Sites + { + get => new global::GoAffPro.Client.Generated.Public.Sites.SitesRequestBuilder(PathParameters, RequestAdapter); + } + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public PublicRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/public", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public PublicRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/public", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/Public/Sites/SitesRequestBuilder.cs b/src/GoAffPro.Client.Generated/Generated/Public/Sites/SitesRequestBuilder.cs new file mode 100644 index 0000000..13f6a00 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/Public/Sites/SitesRequestBuilder.cs @@ -0,0 +1,137 @@ +// +#pragma warning disable CS0618 +using GoAffPro.Client.Generated.Models; +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace GoAffPro.Client.Generated.Public.Sites +{ + /// + /// Builds and executes requests for operations under \public\sites + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class SitesRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public SitesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/public/sites{?currency*,keyword*,limit*,offset*,site_ids*}", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public SitesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/public/sites{?currency*,keyword*,limit*,offset*,site_ids*}", rawUrl) + { + } + /// + /// Public marketplace sites + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 500 status code + /// When receiving a 502 status code +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) + { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "500", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "502", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::GoAffPro.Client.Generated.Models.PublicSitesResponse.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Public marketplace sites + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) + { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/json"); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::GoAffPro.Client.Generated.Public.Sites.SitesRequestBuilder WithUrl(string rawUrl) + { + return new global::GoAffPro.Client.Generated.Public.Sites.SitesRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Public marketplace sites + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class SitesRequestBuilderGetQueryParameters + { +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("currency")] + public string? Currency { get; set; } +#nullable restore +#else + [QueryParameter("currency")] + public string Currency { get; set; } +#endif +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("keyword")] + public string? Keyword { get; set; } +#nullable restore +#else + [QueryParameter("keyword")] + public string Keyword { get; set; } +#endif + [QueryParameter("limit")] + public int? Limit { get; set; } + [QueryParameter("offset")] + public int? Offset { get; set; } +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("site_ids")] + public string? SiteIds { get; set; } +#nullable restore +#else + [QueryParameter("site_ids")] + public string SiteIds { get; set; } +#endif + } + /// + /// Configuration for the request such as headers, query parameters, and middleware options. + /// + [Obsolete("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")] + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class SitesRequestBuilderGetRequestConfiguration : RequestConfiguration + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/User/Commissions/CommissionsRequestBuilder.cs b/src/GoAffPro.Client.Generated/Generated/User/Commissions/CommissionsRequestBuilder.cs new file mode 100644 index 0000000..f60e4a6 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/Commissions/CommissionsRequestBuilder.cs @@ -0,0 +1,117 @@ +// +#pragma warning disable CS0618 +using GoAffPro.Client.Generated.Models; +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace GoAffPro.Client.Generated.User.Commissions +{ + /// + /// Builds and executes requests for operations under \user\commissions + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CommissionsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public CommissionsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/commissions{?site_ids*}", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public CommissionsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/commissions{?site_ids*}", rawUrl) + { + } + /// + /// Get commission structure + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 401 status code + /// When receiving a 403 status code + /// When receiving a 500 status code +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) + { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "401", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "403", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "500", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::GoAffPro.Client.Generated.Models.UserCommissionsResponse.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Get commission structure + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) + { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/json"); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::GoAffPro.Client.Generated.User.Commissions.CommissionsRequestBuilder WithUrl(string rawUrl) + { + return new global::GoAffPro.Client.Generated.User.Commissions.CommissionsRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Get commission structure + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CommissionsRequestBuilderGetQueryParameters + { +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("site_ids")] + public string? SiteIds { get; set; } +#nullable restore +#else + [QueryParameter("site_ids")] + public string SiteIds { get; set; } +#endif + } + /// + /// Configuration for the request such as headers, query parameters, and middleware options. + /// + [Obsolete("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")] + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CommissionsRequestBuilderGetRequestConfiguration : RequestConfiguration + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/User/Feed/FeedRequestBuilder.cs b/src/GoAffPro.Client.Generated/Generated/User/Feed/FeedRequestBuilder.cs new file mode 100644 index 0000000..27ed60d --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/Feed/FeedRequestBuilder.cs @@ -0,0 +1,71 @@ +// +#pragma warning disable CS0618 +using GoAffPro.Client.Generated.User.Feed.Orders; +using GoAffPro.Client.Generated.User.Feed.Payouts; +using GoAffPro.Client.Generated.User.Feed.Products; +using GoAffPro.Client.Generated.User.Feed.Rewards; +using GoAffPro.Client.Generated.User.Feed.Traffic; +using GoAffPro.Client.Generated.User.Feed.Transactions; +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace GoAffPro.Client.Generated.User.Feed +{ + /// + /// Builds and executes requests for operations under \user\feed + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FeedRequestBuilder : BaseRequestBuilder + { + /// The orders property + public global::GoAffPro.Client.Generated.User.Feed.Orders.OrdersRequestBuilder Orders + { + get => new global::GoAffPro.Client.Generated.User.Feed.Orders.OrdersRequestBuilder(PathParameters, RequestAdapter); + } + /// The payouts property + public global::GoAffPro.Client.Generated.User.Feed.Payouts.PayoutsRequestBuilder Payouts + { + get => new global::GoAffPro.Client.Generated.User.Feed.Payouts.PayoutsRequestBuilder(PathParameters, RequestAdapter); + } + /// The products property + public global::GoAffPro.Client.Generated.User.Feed.Products.ProductsRequestBuilder Products + { + get => new global::GoAffPro.Client.Generated.User.Feed.Products.ProductsRequestBuilder(PathParameters, RequestAdapter); + } + /// The rewards property + public global::GoAffPro.Client.Generated.User.Feed.Rewards.RewardsRequestBuilder Rewards + { + get => new global::GoAffPro.Client.Generated.User.Feed.Rewards.RewardsRequestBuilder(PathParameters, RequestAdapter); + } + /// The traffic property + public global::GoAffPro.Client.Generated.User.Feed.Traffic.TrafficRequestBuilder Traffic + { + get => new global::GoAffPro.Client.Generated.User.Feed.Traffic.TrafficRequestBuilder(PathParameters, RequestAdapter); + } + /// The transactions property + public global::GoAffPro.Client.Generated.User.Feed.Transactions.TransactionsRequestBuilder Transactions + { + get => new global::GoAffPro.Client.Generated.User.Feed.Transactions.TransactionsRequestBuilder(PathParameters, RequestAdapter); + } + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public FeedRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/feed", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public FeedRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/feed", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/User/Feed/Orders/GetFieldsQueryParameterType.cs b/src/GoAffPro.Client.Generated/Generated/User/Feed/Orders/GetFieldsQueryParameterType.cs new file mode 100644 index 0000000..74f7e56 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/Feed/Orders/GetFieldsQueryParameterType.cs @@ -0,0 +1,56 @@ +// +using System.Runtime.Serialization; +using System; +namespace GoAffPro.Client.Generated.User.Feed.Orders +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum GetFieldsQueryParameterType + #pragma warning restore CS1591 + { + [EnumMember(Value = "id")] + #pragma warning disable CS1591 + Id, + #pragma warning restore CS1591 + [EnumMember(Value = "number")] + #pragma warning disable CS1591 + Number, + #pragma warning restore CS1591 + [EnumMember(Value = "total")] + #pragma warning disable CS1591 + Total, + #pragma warning restore CS1591 + [EnumMember(Value = "subtotal")] + #pragma warning disable CS1591 + Subtotal, + #pragma warning restore CS1591 + [EnumMember(Value = "line_items")] + #pragma warning disable CS1591 + Line_items, + #pragma warning restore CS1591 + [EnumMember(Value = "commission")] + #pragma warning disable CS1591 + Commission, + #pragma warning restore CS1591 + [EnumMember(Value = "created_at")] + #pragma warning disable CS1591 + Created_at, + #pragma warning restore CS1591 + [EnumMember(Value = "currency")] + #pragma warning disable CS1591 + Currency, + #pragma warning restore CS1591 + [EnumMember(Value = "site_id")] + #pragma warning disable CS1591 + Site_id, + #pragma warning restore CS1591 + [EnumMember(Value = "sub_id")] + #pragma warning disable CS1591 + Sub_id, + #pragma warning restore CS1591 + [EnumMember(Value = "conversion_details")] + #pragma warning disable CS1591 + Conversion_details, + #pragma warning restore CS1591 + } +} diff --git a/src/GoAffPro.Client.Generated/Generated/User/Feed/Orders/OrdersRequestBuilder.cs b/src/GoAffPro.Client.Generated/Generated/User/Feed/Orders/OrdersRequestBuilder.cs new file mode 100644 index 0000000..e7cd29b --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/Feed/Orders/OrdersRequestBuilder.cs @@ -0,0 +1,176 @@ +// +#pragma warning disable CS0618 +using GoAffPro.Client.Generated.Models; +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace GoAffPro.Client.Generated.User.Feed.Orders +{ + /// + /// Builds and executes requests for operations under \user\feed\orders + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OrdersRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public OrdersRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/feed/orders?fields={fields}{&created_at_max*,created_at_min*,limit*,max_id*,offset*,since_id*,site_ids*}", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public OrdersRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/feed/orders?fields={fields}{&created_at_max*,created_at_min*,limit*,max_id*,offset*,since_id*,site_ids*}", rawUrl) + { + } + /// + /// Feed of user orders + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 401 status code + /// When receiving a 403 status code + /// When receiving a 500 status code +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) + { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "401", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "403", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "500", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::GoAffPro.Client.Generated.Models.UserOrderFeedResponse.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Feed of user orders + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) + { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/json"); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::GoAffPro.Client.Generated.User.Feed.Orders.OrdersRequestBuilder WithUrl(string rawUrl) + { + return new global::GoAffPro.Client.Generated.User.Feed.Orders.OrdersRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Feed of user orders + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OrdersRequestBuilderGetQueryParameters + { +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("created_at_max")] + public string? CreatedAtMax { get; set; } +#nullable restore +#else + [QueryParameter("created_at_max")] + public string CreatedAtMax { get; set; } +#endif +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("created_at_min")] + public string? CreatedAtMin { get; set; } +#nullable restore +#else + [QueryParameter("created_at_min")] + public string CreatedAtMin { get; set; } +#endif + [Obsolete("This property is deprecated, use FieldsAsGetFieldsQueryParameterType instead")] +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("fields")] + public string[]? Fields { get; set; } +#nullable restore +#else + [QueryParameter("fields")] + public string[] Fields { get; set; } +#endif +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("fields")] + public global::GoAffPro.Client.Generated.User.Feed.Orders.GetFieldsQueryParameterType[]? FieldsAsGetFieldsQueryParameterType { get; set; } +#nullable restore +#else + [QueryParameter("fields")] + public global::GoAffPro.Client.Generated.User.Feed.Orders.GetFieldsQueryParameterType[] FieldsAsGetFieldsQueryParameterType { get; set; } +#endif + [QueryParameter("limit")] + public int? Limit { get; set; } +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("max_id")] + public string? MaxId { get; set; } +#nullable restore +#else + [QueryParameter("max_id")] + public string MaxId { get; set; } +#endif + [QueryParameter("offset")] + public int? Offset { get; set; } +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("since_id")] + public string? SinceId { get; set; } +#nullable restore +#else + [QueryParameter("since_id")] + public string SinceId { get; set; } +#endif +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("site_ids")] + public string? SiteIds { get; set; } +#nullable restore +#else + [QueryParameter("site_ids")] + public string SiteIds { get; set; } +#endif + } + /// + /// Configuration for the request such as headers, query parameters, and middleware options. + /// + [Obsolete("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")] + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OrdersRequestBuilderGetRequestConfiguration : RequestConfiguration + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/User/Feed/Payouts/PayoutsRequestBuilder.cs b/src/GoAffPro.Client.Generated/Generated/User/Feed/Payouts/PayoutsRequestBuilder.cs new file mode 100644 index 0000000..c2843e8 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/Feed/Payouts/PayoutsRequestBuilder.cs @@ -0,0 +1,141 @@ +// +#pragma warning disable CS0618 +using GoAffPro.Client.Generated.Models; +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace GoAffPro.Client.Generated.User.Feed.Payouts +{ + /// + /// Builds and executes requests for operations under \user\feed\payouts + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class PayoutsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public PayoutsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/feed/payouts{?end_time*,limit*,offset*,since_id*,site_ids*,start_time*}", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public PayoutsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/feed/payouts{?end_time*,limit*,offset*,since_id*,site_ids*,start_time*}", rawUrl) + { + } + /// + /// Feed of user payouts + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 401 status code + /// When receiving a 403 status code + /// When receiving a 500 status code +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) + { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "401", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "403", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "500", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::GoAffPro.Client.Generated.Models.UserPayoutFeedResponse.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Feed of user payouts + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) + { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/json"); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::GoAffPro.Client.Generated.User.Feed.Payouts.PayoutsRequestBuilder WithUrl(string rawUrl) + { + return new global::GoAffPro.Client.Generated.User.Feed.Payouts.PayoutsRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Feed of user payouts + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class PayoutsRequestBuilderGetQueryParameters + { +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("end_time")] + public string? EndTime { get; set; } +#nullable restore +#else + [QueryParameter("end_time")] + public string EndTime { get; set; } +#endif + [QueryParameter("limit")] + public int? Limit { get; set; } + [QueryParameter("offset")] + public int? Offset { get; set; } + [QueryParameter("since_id")] + public int? SinceId { get; set; } +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("site_ids")] + public string? SiteIds { get; set; } +#nullable restore +#else + [QueryParameter("site_ids")] + public string SiteIds { get; set; } +#endif +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("start_time")] + public string? StartTime { get; set; } +#nullable restore +#else + [QueryParameter("start_time")] + public string StartTime { get; set; } +#endif + } + /// + /// Configuration for the request such as headers, query parameters, and middleware options. + /// + [Obsolete("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")] + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class PayoutsRequestBuilderGetRequestConfiguration : RequestConfiguration + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/User/Feed/Products/ProductsRequestBuilder.cs b/src/GoAffPro.Client.Generated/Generated/User/Feed/Products/ProductsRequestBuilder.cs new file mode 100644 index 0000000..7a5b7fb --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/Feed/Products/ProductsRequestBuilder.cs @@ -0,0 +1,114 @@ +// +#pragma warning disable CS0618 +using GoAffPro.Client.Generated.Models; +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace GoAffPro.Client.Generated.User.Feed.Products +{ + /// + /// Builds and executes requests for operations under \user\feed\products + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ProductsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ProductsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/feed/products{?limit*,offset*}", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ProductsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/feed/products{?limit*,offset*}", rawUrl) + { + } + /// + /// Feed of products available for promotion + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 401 status code + /// When receiving a 403 status code + /// When receiving a 500 status code + /// When receiving a 502 status code +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) + { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "401", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "403", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "500", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "502", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::GoAffPro.Client.Generated.Models.UserProductFeedResponse.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Feed of products available for promotion + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) + { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/json"); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::GoAffPro.Client.Generated.User.Feed.Products.ProductsRequestBuilder WithUrl(string rawUrl) + { + return new global::GoAffPro.Client.Generated.User.Feed.Products.ProductsRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Feed of products available for promotion + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ProductsRequestBuilderGetQueryParameters + { + [QueryParameter("limit")] + public int? Limit { get; set; } + [QueryParameter("offset")] + public int? Offset { get; set; } + } + /// + /// Configuration for the request such as headers, query parameters, and middleware options. + /// + [Obsolete("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")] + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ProductsRequestBuilderGetRequestConfiguration : RequestConfiguration + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/User/Feed/Rewards/RewardsRequestBuilder.cs b/src/GoAffPro.Client.Generated/Generated/User/Feed/Rewards/RewardsRequestBuilder.cs new file mode 100644 index 0000000..1ac6ea4 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/Feed/Rewards/RewardsRequestBuilder.cs @@ -0,0 +1,143 @@ +// +#pragma warning disable CS0618 +using GoAffPro.Client.Generated.Models; +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace GoAffPro.Client.Generated.User.Feed.Rewards +{ + /// + /// Builds and executes requests for operations under \user\feed\rewards + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RewardsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RewardsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/feed/rewards{?end_time*,limit*,offset*,since_id*,site_ids*,start_time*}", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RewardsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/feed/rewards{?end_time*,limit*,offset*,since_id*,site_ids*,start_time*}", rawUrl) + { + } + /// + /// Feed of user rewards + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 401 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 500 status code +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) + { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "401", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "403", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "404", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "500", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::GoAffPro.Client.Generated.Models.UserRewardFeedResponse.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Feed of user rewards + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) + { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/json"); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::GoAffPro.Client.Generated.User.Feed.Rewards.RewardsRequestBuilder WithUrl(string rawUrl) + { + return new global::GoAffPro.Client.Generated.User.Feed.Rewards.RewardsRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Feed of user rewards + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RewardsRequestBuilderGetQueryParameters + { +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("end_time")] + public string? EndTime { get; set; } +#nullable restore +#else + [QueryParameter("end_time")] + public string EndTime { get; set; } +#endif + [QueryParameter("limit")] + public int? Limit { get; set; } + [QueryParameter("offset")] + public int? Offset { get; set; } + [QueryParameter("since_id")] + public int? SinceId { get; set; } +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("site_ids")] + public string? SiteIds { get; set; } +#nullable restore +#else + [QueryParameter("site_ids")] + public string SiteIds { get; set; } +#endif +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("start_time")] + public string? StartTime { get; set; } +#nullable restore +#else + [QueryParameter("start_time")] + public string StartTime { get; set; } +#endif + } + /// + /// Configuration for the request such as headers, query parameters, and middleware options. + /// + [Obsolete("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")] + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RewardsRequestBuilderGetRequestConfiguration : RequestConfiguration + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/User/Feed/Traffic/TrafficRequestBuilder.cs b/src/GoAffPro.Client.Generated/Generated/User/Feed/Traffic/TrafficRequestBuilder.cs new file mode 100644 index 0000000..67d1ff7 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/Feed/Traffic/TrafficRequestBuilder.cs @@ -0,0 +1,141 @@ +// +#pragma warning disable CS0618 +using GoAffPro.Client.Generated.Models; +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace GoAffPro.Client.Generated.User.Feed.Traffic +{ + /// + /// Builds and executes requests for operations under \user\feed\traffic + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TrafficRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public TrafficRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/feed/traffic{?end_time*,limit*,offset*,since_id*,site_ids*,start_time*}", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public TrafficRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/feed/traffic{?end_time*,limit*,offset*,since_id*,site_ids*,start_time*}", rawUrl) + { + } + /// + /// Feed of user traffic + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 401 status code + /// When receiving a 403 status code + /// When receiving a 500 status code +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) + { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "401", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "403", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "500", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::GoAffPro.Client.Generated.Models.UserTrafficFeedResponse.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Feed of user traffic + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) + { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/json"); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::GoAffPro.Client.Generated.User.Feed.Traffic.TrafficRequestBuilder WithUrl(string rawUrl) + { + return new global::GoAffPro.Client.Generated.User.Feed.Traffic.TrafficRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Feed of user traffic + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TrafficRequestBuilderGetQueryParameters + { +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("end_time")] + public string? EndTime { get; set; } +#nullable restore +#else + [QueryParameter("end_time")] + public string EndTime { get; set; } +#endif + [QueryParameter("limit")] + public int? Limit { get; set; } + [QueryParameter("offset")] + public int? Offset { get; set; } + [QueryParameter("since_id")] + public int? SinceId { get; set; } +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("site_ids")] + public string? SiteIds { get; set; } +#nullable restore +#else + [QueryParameter("site_ids")] + public string SiteIds { get; set; } +#endif +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("start_time")] + public string? StartTime { get; set; } +#nullable restore +#else + [QueryParameter("start_time")] + public string StartTime { get; set; } +#endif + } + /// + /// Configuration for the request such as headers, query parameters, and middleware options. + /// + [Obsolete("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")] + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TrafficRequestBuilderGetRequestConfiguration : RequestConfiguration + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/User/Feed/Transactions/TransactionsRequestBuilder.cs b/src/GoAffPro.Client.Generated/Generated/User/Feed/Transactions/TransactionsRequestBuilder.cs new file mode 100644 index 0000000..0e7e17a --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/Feed/Transactions/TransactionsRequestBuilder.cs @@ -0,0 +1,112 @@ +// +#pragma warning disable CS0618 +using GoAffPro.Client.Generated.Models; +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace GoAffPro.Client.Generated.User.Feed.Transactions +{ + /// + /// Builds and executes requests for operations under \user\feed\transactions + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TransactionsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public TransactionsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/feed/transactions{?limit*,offset*}", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public TransactionsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/feed/transactions{?limit*,offset*}", rawUrl) + { + } + /// + /// Feed of user transactions + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 401 status code + /// When receiving a 403 status code + /// When receiving a 500 status code +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) + { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "401", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "403", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "500", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::GoAffPro.Client.Generated.Models.UserTransactionFeedResponse.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Feed of user transactions + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) + { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/json"); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::GoAffPro.Client.Generated.User.Feed.Transactions.TransactionsRequestBuilder WithUrl(string rawUrl) + { + return new global::GoAffPro.Client.Generated.User.Feed.Transactions.TransactionsRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Feed of user transactions + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TransactionsRequestBuilderGetQueryParameters + { + [QueryParameter("limit")] + public int? Limit { get; set; } + [QueryParameter("offset")] + public int? Offset { get; set; } + } + /// + /// Configuration for the request such as headers, query parameters, and middleware options. + /// + [Obsolete("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")] + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TransactionsRequestBuilderGetRequestConfiguration : RequestConfiguration + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/User/Login/LoginPostRequestBody.cs b/src/GoAffPro.Client.Generated/Generated/User/Login/LoginPostRequestBody.cs new file mode 100644 index 0000000..ea24ff6 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/Login/LoginPostRequestBody.cs @@ -0,0 +1,75 @@ +// +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace GoAffPro.Client.Generated.User.Login +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LoginPostRequestBody : IAdditionalDataHolder, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { get; set; } + /// The email property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Email { get; set; } +#nullable restore +#else + public string Email { get; set; } +#endif + /// The password property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Password { get; set; } +#nullable restore +#else + public string Password { get; set; } +#endif + /// + /// Instantiates a new and sets the default values. + /// + public LoginPostRequestBody() + { + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::GoAffPro.Client.Generated.User.Login.LoginPostRequestBody CreateFromDiscriminatorValue(IParseNode parseNode) + { + if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode)); + return new global::GoAffPro.Client.Generated.User.Login.LoginPostRequestBody(); + } + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "email", n => { Email = n.GetStringValue(); } }, + { "password", n => { Password = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("email", Email); + writer.WriteStringValue("password", Password); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/User/Login/LoginRequestBuilder.cs b/src/GoAffPro.Client.Generated/Generated/User/Login/LoginRequestBuilder.cs new file mode 100644 index 0000000..978ad00 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/Login/LoginRequestBuilder.cs @@ -0,0 +1,97 @@ +// +#pragma warning disable CS0618 +using GoAffPro.Client.Generated.Models; +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace GoAffPro.Client.Generated.User.Login +{ + /// + /// Builds and executes requests for operations under \user\login + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LoginRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public LoginRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/login", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public LoginRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/login", rawUrl) + { + } + /// + /// Log in to get the access token + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task PostAsync(global::GoAffPro.Client.Generated.User.Login.LoginPostRequestBody body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { +#nullable restore +#else + public async Task PostAsync(global::GoAffPro.Client.Generated.User.Login.LoginPostRequestBody body, Action> requestConfiguration = default, CancellationToken cancellationToken = default) + { +#endif + if(ReferenceEquals(body, null)) throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + return await RequestAdapter.SendAsync(requestInfo, global::GoAffPro.Client.Generated.Models.LoginResponse.CreateFromDiscriminatorValue, default, cancellationToken).ConfigureAwait(false); + } + /// + /// Log in to get the access token + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToPostRequestInformation(global::GoAffPro.Client.Generated.User.Login.LoginPostRequestBody body, Action>? requestConfiguration = default) + { +#nullable restore +#else + public RequestInformation ToPostRequestInformation(global::GoAffPro.Client.Generated.User.Login.LoginPostRequestBody body, Action> requestConfiguration = default) + { +#endif + if(ReferenceEquals(body, null)) throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/json"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/x-www-form-urlencoded", body); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::GoAffPro.Client.Generated.User.Login.LoginRequestBuilder WithUrl(string rawUrl) + { + return new global::GoAffPro.Client.Generated.User.Login.LoginRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Configuration for the request such as headers, query parameters, and middleware options. + /// + [Obsolete("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")] + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LoginRequestBuilderPostRequestConfiguration : RequestConfiguration + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/User/Payouts/PayoutsRequestBuilder.cs b/src/GoAffPro.Client.Generated/Generated/User/Payouts/PayoutsRequestBuilder.cs new file mode 100644 index 0000000..89f3c2a --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/Payouts/PayoutsRequestBuilder.cs @@ -0,0 +1,41 @@ +// +#pragma warning disable CS0618 +using GoAffPro.Client.Generated.User.Payouts.Pending; +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace GoAffPro.Client.Generated.User.Payouts +{ + /// + /// Builds and executes requests for operations under \user\payouts + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class PayoutsRequestBuilder : BaseRequestBuilder + { + /// The pending property + public global::GoAffPro.Client.Generated.User.Payouts.Pending.PendingRequestBuilder Pending + { + get => new global::GoAffPro.Client.Generated.User.Payouts.Pending.PendingRequestBuilder(PathParameters, RequestAdapter); + } + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public PayoutsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/payouts", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public PayoutsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/payouts", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/User/Payouts/Pending/PendingRequestBuilder.cs b/src/GoAffPro.Client.Generated/Generated/User/Payouts/Pending/PendingRequestBuilder.cs new file mode 100644 index 0000000..d6a2274 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/Payouts/Pending/PendingRequestBuilder.cs @@ -0,0 +1,101 @@ +// +#pragma warning disable CS0618 +using GoAffPro.Client.Generated.Models; +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace GoAffPro.Client.Generated.User.Payouts.Pending +{ + /// + /// Builds and executes requests for operations under \user\payouts\pending + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class PendingRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public PendingRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/payouts/pending", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public PendingRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/payouts/pending", rawUrl) + { + } + /// + /// Get pending payout amount (and its breakdown) + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 401 status code + /// When receiving a 403 status code + /// When receiving a 500 status code +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) + { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "401", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "403", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "500", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::GoAffPro.Client.Generated.Models.UserPendingPayoutsResponse.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Get pending payout amount (and its breakdown) + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) + { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/json"); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::GoAffPro.Client.Generated.User.Payouts.Pending.PendingRequestBuilder WithUrl(string rawUrl) + { + return new global::GoAffPro.Client.Generated.User.Payouts.Pending.PendingRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Configuration for the request such as headers, query parameters, and middleware options. + /// + [Obsolete("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")] + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class PendingRequestBuilderGetRequestConfiguration : RequestConfiguration + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/User/Sites/GetFieldsQueryParameterType.cs b/src/GoAffPro.Client.Generated/Generated/User/Sites/GetFieldsQueryParameterType.cs new file mode 100644 index 0000000..f962eff --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/Sites/GetFieldsQueryParameterType.cs @@ -0,0 +1,52 @@ +// +using System.Runtime.Serialization; +using System; +namespace GoAffPro.Client.Generated.User.Sites +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum GetFieldsQueryParameterType + #pragma warning restore CS1591 + { + [EnumMember(Value = "id")] + #pragma warning disable CS1591 + Id, + #pragma warning restore CS1591 + [EnumMember(Value = "name")] + #pragma warning disable CS1591 + Name, + #pragma warning restore CS1591 + [EnumMember(Value = "logo")] + #pragma warning disable CS1591 + Logo, + #pragma warning restore CS1591 + [EnumMember(Value = "website")] + #pragma warning disable CS1591 + Website, + #pragma warning restore CS1591 + [EnumMember(Value = "status")] + #pragma warning disable CS1591 + Status, + #pragma warning restore CS1591 + [EnumMember(Value = "currency")] + #pragma warning disable CS1591 + Currency, + #pragma warning restore CS1591 + [EnumMember(Value = "affiliate_portal")] + #pragma warning disable CS1591 + Affiliate_portal, + #pragma warning restore CS1591 + [EnumMember(Value = "ref_code")] + #pragma warning disable CS1591 + Ref_code, + #pragma warning restore CS1591 + [EnumMember(Value = "referral_link")] + #pragma warning disable CS1591 + Referral_link, + #pragma warning restore CS1591 + [EnumMember(Value = "coupon")] + #pragma warning disable CS1591 + Coupon, + #pragma warning restore CS1591 + } +} diff --git a/src/GoAffPro.Client.Generated/Generated/User/Sites/GetStatusQueryParameterType.cs b/src/GoAffPro.Client.Generated/Generated/User/Sites/GetStatusQueryParameterType.cs new file mode 100644 index 0000000..ed8f784 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/Sites/GetStatusQueryParameterType.cs @@ -0,0 +1,24 @@ +// +using System.Runtime.Serialization; +using System; +namespace GoAffPro.Client.Generated.User.Sites +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum GetStatusQueryParameterType + #pragma warning restore CS1591 + { + [EnumMember(Value = "approved")] + #pragma warning disable CS1591 + Approved, + #pragma warning restore CS1591 + [EnumMember(Value = "pending")] + #pragma warning disable CS1591 + Pending, + #pragma warning restore CS1591 + [EnumMember(Value = "blocked")] + #pragma warning disable CS1591 + Blocked, + #pragma warning restore CS1591 + } +} diff --git a/src/GoAffPro.Client.Generated/Generated/User/Sites/SitesRequestBuilder.cs b/src/GoAffPro.Client.Generated/Generated/User/Sites/SitesRequestBuilder.cs new file mode 100644 index 0000000..39150af --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/Sites/SitesRequestBuilder.cs @@ -0,0 +1,143 @@ +// +#pragma warning disable CS0618 +using GoAffPro.Client.Generated.Models; +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace GoAffPro.Client.Generated.User.Sites +{ + /// + /// Builds and executes requests for operations under \user\sites + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class SitesRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public SitesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/sites?fields={fields}{&limit*,offset*,status*}", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public SitesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/sites?fields={fields}{&limit*,offset*,status*}", rawUrl) + { + } + /// + /// List of stores the user is enrolled in + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 401 status code + /// When receiving a 403 status code + /// When receiving a 500 status code +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) + { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "401", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "403", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "500", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::GoAffPro.Client.Generated.Models.UserSiteListResponse.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// List of stores the user is enrolled in + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) + { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/json"); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::GoAffPro.Client.Generated.User.Sites.SitesRequestBuilder WithUrl(string rawUrl) + { + return new global::GoAffPro.Client.Generated.User.Sites.SitesRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// List of stores the user is enrolled in + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class SitesRequestBuilderGetQueryParameters + { + [Obsolete("This property is deprecated, use FieldsAsGetFieldsQueryParameterType instead")] +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("fields")] + public string[]? Fields { get; set; } +#nullable restore +#else + [QueryParameter("fields")] + public string[] Fields { get; set; } +#endif +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("fields")] + public global::GoAffPro.Client.Generated.User.Sites.GetFieldsQueryParameterType[]? FieldsAsGetFieldsQueryParameterType { get; set; } +#nullable restore +#else + [QueryParameter("fields")] + public global::GoAffPro.Client.Generated.User.Sites.GetFieldsQueryParameterType[] FieldsAsGetFieldsQueryParameterType { get; set; } +#endif + [QueryParameter("limit")] + public int? Limit { get; set; } + [QueryParameter("offset")] + public int? Offset { get; set; } + [Obsolete("This property is deprecated, use StatusAsGetStatusQueryParameterType instead")] +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("status")] + public string? Status { get; set; } +#nullable restore +#else + [QueryParameter("status")] + public string Status { get; set; } +#endif + [QueryParameter("status")] + public global::GoAffPro.Client.Generated.User.Sites.GetStatusQueryParameterType? StatusAsGetStatusQueryParameterType { get; set; } + } + /// + /// Configuration for the request such as headers, query parameters, and middleware options. + /// + [Obsolete("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")] + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class SitesRequestBuilderGetRequestConfiguration : RequestConfiguration + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/User/Stats/Aggregate/AggregateRequestBuilder.cs b/src/GoAffPro.Client.Generated/Generated/User/Stats/Aggregate/AggregateRequestBuilder.cs new file mode 100644 index 0000000..6c89955 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/Stats/Aggregate/AggregateRequestBuilder.cs @@ -0,0 +1,154 @@ +// +#pragma warning disable CS0618 +using GoAffPro.Client.Generated.Models; +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace GoAffPro.Client.Generated.User.Stats.Aggregate +{ + /// + /// Builds and executes requests for operations under \user\stats\aggregate + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AggregateRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public AggregateRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/stats/aggregate?fields={fields}{&end_time*,site_ids*,start_time*}", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public AggregateRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/stats/aggregate?fields={fields}{&end_time*,site_ids*,start_time*}", rawUrl) + { + } + /// + /// Aggregates of user stats + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 401 status code + /// When receiving a 403 status code + /// When receiving a 500 status code +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) + { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "401", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "403", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "500", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::GoAffPro.Client.Generated.Models.UserStatsAggregateResponse.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Aggregates of user stats + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) + { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/json"); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::GoAffPro.Client.Generated.User.Stats.Aggregate.AggregateRequestBuilder WithUrl(string rawUrl) + { + return new global::GoAffPro.Client.Generated.User.Stats.Aggregate.AggregateRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Aggregates of user stats + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AggregateRequestBuilderGetQueryParameters + { +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("end_time")] + public string? EndTime { get; set; } +#nullable restore +#else + [QueryParameter("end_time")] + public string EndTime { get; set; } +#endif + [Obsolete("This property is deprecated, use FieldsAsGetFieldsQueryParameterType instead")] +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("fields")] + public string[]? Fields { get; set; } +#nullable restore +#else + [QueryParameter("fields")] + public string[] Fields { get; set; } +#endif +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("fields")] + public global::GoAffPro.Client.Generated.User.Stats.Aggregate.GetFieldsQueryParameterType[]? FieldsAsGetFieldsQueryParameterType { get; set; } +#nullable restore +#else + [QueryParameter("fields")] + public global::GoAffPro.Client.Generated.User.Stats.Aggregate.GetFieldsQueryParameterType[] FieldsAsGetFieldsQueryParameterType { get; set; } +#endif +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("site_ids")] + public string? SiteIds { get; set; } +#nullable restore +#else + [QueryParameter("site_ids")] + public string SiteIds { get; set; } +#endif +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("start_time")] + public string? StartTime { get; set; } +#nullable restore +#else + [QueryParameter("start_time")] + public string StartTime { get; set; } +#endif + } + /// + /// Configuration for the request such as headers, query parameters, and middleware options. + /// + [Obsolete("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")] + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AggregateRequestBuilderGetRequestConfiguration : RequestConfiguration + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/User/Stats/Aggregate/GetFieldsQueryParameterType.cs b/src/GoAffPro.Client.Generated/Generated/User/Stats/Aggregate/GetFieldsQueryParameterType.cs new file mode 100644 index 0000000..e12cda7 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/Stats/Aggregate/GetFieldsQueryParameterType.cs @@ -0,0 +1,32 @@ +// +using System.Runtime.Serialization; +using System; +namespace GoAffPro.Client.Generated.User.Stats.Aggregate +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum GetFieldsQueryParameterType + #pragma warning restore CS1591 + { + [EnumMember(Value = "total_sales")] + #pragma warning disable CS1591 + Total_sales, + #pragma warning restore CS1591 + [EnumMember(Value = "other_commission_earned")] + #pragma warning disable CS1591 + Other_commission_earned, + #pragma warning restore CS1591 + [EnumMember(Value = "revenue_generated")] + #pragma warning disable CS1591 + Revenue_generated, + #pragma warning restore CS1591 + [EnumMember(Value = "sale_commission_earned")] + #pragma warning disable CS1591 + Sale_commission_earned, + #pragma warning restore CS1591 + [EnumMember(Value = "commission_paid")] + #pragma warning disable CS1591 + Commission_paid, + #pragma warning restore CS1591 + } +} diff --git a/src/GoAffPro.Client.Generated/Generated/User/Stats/StatsRequestBuilder.cs b/src/GoAffPro.Client.Generated/Generated/User/Stats/StatsRequestBuilder.cs new file mode 100644 index 0000000..da2711f --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/Stats/StatsRequestBuilder.cs @@ -0,0 +1,41 @@ +// +#pragma warning disable CS0618 +using GoAffPro.Client.Generated.User.Stats.Aggregate; +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace GoAffPro.Client.Generated.User.Stats +{ + /// + /// Builds and executes requests for operations under \user\stats + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StatsRequestBuilder : BaseRequestBuilder + { + /// The aggregate property + public global::GoAffPro.Client.Generated.User.Stats.Aggregate.AggregateRequestBuilder Aggregate + { + get => new global::GoAffPro.Client.Generated.User.Stats.Aggregate.AggregateRequestBuilder(PathParameters, RequestAdapter); + } + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public StatsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/stats", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public StatsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/stats", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/User/UserRequestBuilder.cs b/src/GoAffPro.Client.Generated/Generated/User/UserRequestBuilder.cs new file mode 100644 index 0000000..bcbe9e4 --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/User/UserRequestBuilder.cs @@ -0,0 +1,191 @@ +// +#pragma warning disable CS0618 +using GoAffPro.Client.Generated.Models; +using GoAffPro.Client.Generated.User.Commissions; +using GoAffPro.Client.Generated.User.Feed; +using GoAffPro.Client.Generated.User.Login; +using GoAffPro.Client.Generated.User.Payouts; +using GoAffPro.Client.Generated.User.Sites; +using GoAffPro.Client.Generated.User.Stats; +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace GoAffPro.Client.Generated.User +{ + /// + /// Builds and executes requests for operations under \user + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserRequestBuilder : BaseRequestBuilder + { + /// The commissions property + public global::GoAffPro.Client.Generated.User.Commissions.CommissionsRequestBuilder Commissions + { + get => new global::GoAffPro.Client.Generated.User.Commissions.CommissionsRequestBuilder(PathParameters, RequestAdapter); + } + /// The feed property + public global::GoAffPro.Client.Generated.User.Feed.FeedRequestBuilder Feed + { + get => new global::GoAffPro.Client.Generated.User.Feed.FeedRequestBuilder(PathParameters, RequestAdapter); + } + /// The login property + public global::GoAffPro.Client.Generated.User.Login.LoginRequestBuilder Login + { + get => new global::GoAffPro.Client.Generated.User.Login.LoginRequestBuilder(PathParameters, RequestAdapter); + } + /// The payouts property + public global::GoAffPro.Client.Generated.User.Payouts.PayoutsRequestBuilder Payouts + { + get => new global::GoAffPro.Client.Generated.User.Payouts.PayoutsRequestBuilder(PathParameters, RequestAdapter); + } + /// The sites property + public global::GoAffPro.Client.Generated.User.Sites.SitesRequestBuilder Sites + { + get => new global::GoAffPro.Client.Generated.User.Sites.SitesRequestBuilder(PathParameters, RequestAdapter); + } + /// The stats property + public global::GoAffPro.Client.Generated.User.Stats.StatsRequestBuilder Stats + { + get => new global::GoAffPro.Client.Generated.User.Stats.StatsRequestBuilder(PathParameters, RequestAdapter); + } + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public UserRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public UserRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user", rawUrl) + { + } + /// + /// Get information about logged in user profile + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 401 status code + /// When receiving a 403 status code + /// When receiving a 500 status code +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) + { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "401", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "403", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "500", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::GoAffPro.Client.Generated.Models.UserProfileEnvelope.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Update your profile + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 401 status code + /// When receiving a 403 status code + /// When receiving a 500 status code +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task PostAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { +#nullable restore +#else + public async Task PostAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) + { +#endif + var requestInfo = ToPostRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "401", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "403", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + { "500", global::GoAffPro.Client.Generated.Models.ErrorResponse.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::GoAffPro.Client.Generated.Models.UserProfileUpdateResponse.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Get information about logged in user profile + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) + { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/json"); + return requestInfo; + } + /// + /// Update your profile + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToPostRequestInformation(Action>? requestConfiguration = default) + { +#nullable restore +#else + public RequestInformation ToPostRequestInformation(Action> requestConfiguration = default) + { +#endif + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/json"); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::GoAffPro.Client.Generated.User.UserRequestBuilder WithUrl(string rawUrl) + { + return new global::GoAffPro.Client.Generated.User.UserRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Configuration for the request such as headers, query parameters, and middleware options. + /// + [Obsolete("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")] + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserRequestBuilderGetRequestConfiguration : RequestConfiguration + { + } + /// + /// Configuration for the request such as headers, query parameters, and middleware options. + /// + [Obsolete("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")] + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UserRequestBuilderPostRequestConfiguration : RequestConfiguration + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/GoAffPro.Client.Generated/Generated/kiota-lock.json b/src/GoAffPro.Client.Generated/Generated/kiota-lock.json new file mode 100644 index 0000000..0f7dd0d --- /dev/null +++ b/src/GoAffPro.Client.Generated/Generated/kiota-lock.json @@ -0,0 +1,34 @@ +{ + "descriptionHash": "71F3DA4BE3CEAF79C68AA4ADEBC9577466D01C9FC115487050305F02444A818EAA1D8012158873FA35696C6547EFE889DD00772742EE7B89AA024A18AD990E3C", + "descriptionLocation": "../../../openapi/goaffpro-canonical.yaml", + "lockFileVersion": "1.0.0", + "kiotaVersion": "1.30.0", + "clientClassName": "GoAffProApiClient", + "typeAccessModifier": "Public", + "clientNamespaceName": "GoAffPro.Client.Generated", + "language": "CSharp", + "usesBackingStore": false, + "excludeBackwardCompatible": false, + "includeAdditionalData": true, + "disableSSLValidation": false, + "serializers": [ + "Microsoft.Kiota.Serialization.Json.JsonSerializationWriterFactory", + "Microsoft.Kiota.Serialization.Text.TextSerializationWriterFactory", + "Microsoft.Kiota.Serialization.Form.FormSerializationWriterFactory", + "Microsoft.Kiota.Serialization.Multipart.MultipartSerializationWriterFactory" + ], + "deserializers": [ + "Microsoft.Kiota.Serialization.Json.JsonParseNodeFactory", + "Microsoft.Kiota.Serialization.Text.TextParseNodeFactory", + "Microsoft.Kiota.Serialization.Form.FormParseNodeFactory" + ], + "structuredMimeTypes": [ + "application/json", + "text/plain;q=0.9", + "application/x-www-form-urlencoded;q=0.2", + "multipart/form-data;q=0.1" + ], + "includePatterns": [], + "excludePatterns": [], + "disabledValidationRules": [] +} \ No newline at end of file diff --git a/src/GoAffPro.Client.Generated/GoAffPro.Client.Generated.csproj b/src/GoAffPro.Client.Generated/GoAffPro.Client.Generated.csproj new file mode 100644 index 0000000..bb9a55f --- /dev/null +++ b/src/GoAffPro.Client.Generated/GoAffPro.Client.Generated.csproj @@ -0,0 +1,38 @@ + + + + net9.0;net10.0 + enable + enable + true + $(MSBuildProjectDirectory)\..\..\openapi\goaffpro-canonical.yaml + $(MSBuildProjectDirectory)\..\..\ + $(MSBuildProjectDirectory)\Generated + + + + + + + + + + + + + + + + + + + + diff --git a/src/GoAffPro.Client.Generator/GeneratorOptions.cs b/src/GoAffPro.Client.Generator/GeneratorOptions.cs deleted file mode 100644 index 9de8191..0000000 --- a/src/GoAffPro.Client.Generator/GeneratorOptions.cs +++ /dev/null @@ -1,3 +0,0 @@ -namespace GoAffPro.Client.Generator; - -internal sealed record GeneratorOptions(string ProjectDirectory, string? SwaggerInitPath, Uri SwaggerUrl); diff --git a/src/GoAffPro.Client.Generator/GeneratorRunner.cs b/src/GoAffPro.Client.Generator/GeneratorRunner.cs deleted file mode 100644 index 3e5129a..0000000 --- a/src/GoAffPro.Client.Generator/GeneratorRunner.cs +++ /dev/null @@ -1,477 +0,0 @@ -using System.Diagnostics; -using System.Security.Cryptography; -using System.Text; -using System.Text.Json; -using System.Text.Json.Nodes; -using NJsonSchema.CodeGeneration.CSharp; -using NSwag; -using NSwag.CodeGeneration.CSharp; -using NSwag.CodeGeneration.OperationNameGenerators; - -namespace GoAffPro.Client.Generator; - -internal static class GeneratorRunner -{ - public const string DefaultSwaggerInitUrl = "https://api.goaffpro.com/docs/admin/swagger-ui-init.js"; - - private const string UserPathPrefix = "/user"; - private const string PublicPathPrefix = "/public"; - private const string RootSpecFileName = "goaffpro.openapi.json"; - private const string UserSpecFileName = "goaffpro-user.openapi.json"; - private const string PublicSpecFileName = "goaffpro-public.openapi.json"; - private const string UserClientFileName = "GoAffProUserClient.g.cs"; - private const string PublicClientFileName = "GoAffProPublicClient.g.cs"; - private const string HashFileName = "GoAffPro.Client.Generator.hash"; - private const string LockFileName = "GoAffPro.Client.Generator.lock"; - private const string GeneratorCacheVersion = "4"; - private const string CanonicalSpecFileName = "goaffpro-canonical.json"; - - public static async Task RunAsync(GeneratorOptions options, CancellationToken cancellationToken) - { - string projectDirectory = Path.GetFullPath(options.ProjectDirectory); - string repositoryRoot = Path.GetFullPath(Path.Combine(projectDirectory, "..", "..")); - string openApiDirectory = Path.Combine(repositoryRoot, "openapi"); - string generatedDirectory = Path.Combine(projectDirectory, "Generated"); - string intermediateDirectory = Path.Combine(projectDirectory, "obj"); - - _ = Directory.CreateDirectory(openApiDirectory); - _ = Directory.CreateDirectory(generatedDirectory); - _ = Directory.CreateDirectory(intermediateDirectory); - - string lockFilePath = Path.Combine(intermediateDirectory, LockFileName); - using FileStream generatorLock = await AcquireGeneratorLockAsync(lockFilePath, TimeSpan.FromMinutes(2), cancellationToken) - .ConfigureAwait(false); - - try - { - (JsonObject rootSpec, string swaggerSource, bool requiresLegacyNormalization) = - await LoadRootSpecAsync(options, projectDirectory, cancellationToken).ConfigureAwait(false); - - JsonSerializerOptions writeIndented = new() { WriteIndented = true }; - string normalizedRootJson = rootSpec.ToJsonString(writeIndented); - string canonicalRootJson = rootSpec.ToJsonString(); - - string rootSpecPath = Path.Combine(openApiDirectory, RootSpecFileName); - await File.WriteAllTextAsync(rootSpecPath, normalizedRootJson, Encoding.UTF8, cancellationToken).ConfigureAwait(false); - - string hashPath = Path.Combine(intermediateDirectory, HashFileName); - string currentHash = ComputeSha256($"{GeneratorCacheVersion}\n{canonicalRootJson}"); - bool isSpecUnchanged = File.Exists(hashPath) && - string.Equals( - await File.ReadAllTextAsync(hashPath, cancellationToken).ConfigureAwait(false), - currentHash, - StringComparison.Ordinal); - - string userClientOutputPath = Path.Combine(generatedDirectory, UserClientFileName); - string publicClientOutputPath = Path.Combine(generatedDirectory, PublicClientFileName); - if (isSpecUnchanged && File.Exists(userClientOutputPath) && File.Exists(publicClientOutputPath)) - { - return; - } - - JsonObject userSpec = FilterPaths(rootSpec, UserPathPrefix); - JsonObject publicSpec = FilterPaths(rootSpec, PublicPathPrefix); - if (requiresLegacyNormalization) - { - userSpec = NormalizeSpec(userSpec); - publicSpec = NormalizeSpec(publicSpec); - } - - string userSpecJson = userSpec.ToJsonString(writeIndented); - string publicSpecJson = publicSpec.ToJsonString(writeIndented); - - string userSpecPath = Path.Combine(openApiDirectory, UserSpecFileName); - string publicSpecPath = Path.Combine(openApiDirectory, PublicSpecFileName); - await File.WriteAllTextAsync(userSpecPath, userSpecJson, Encoding.UTF8, cancellationToken).ConfigureAwait(false); - await File.WriteAllTextAsync(publicSpecPath, publicSpecJson, Encoding.UTF8, cancellationToken).ConfigureAwait(false); - - string userClientCode = await GenerateClientAsync( - userSpecJson, - @namespace: "GoAffPro.Client.Generated.User", - className: "GoAffProUserClient", - cancellationToken) - .ConfigureAwait(false); - string publicClientCode = await GenerateClientAsync( - publicSpecJson, - @namespace: "GoAffPro.Client.Generated.Public", - className: "GoAffProPublicClient", - cancellationToken) - .ConfigureAwait(false); - - await File.WriteAllTextAsync( - userClientOutputPath, - AddAutoGeneratedHeader(userClientCode, swaggerSource), - Encoding.UTF8, - cancellationToken) - .ConfigureAwait(false); - await File.WriteAllTextAsync( - publicClientOutputPath, - AddAutoGeneratedHeader(publicClientCode, swaggerSource), - Encoding.UTF8, - cancellationToken) - .ConfigureAwait(false); - - await File.WriteAllTextAsync(hashPath, currentHash, Encoding.UTF8, cancellationToken).ConfigureAwait(false); - } - finally - { - // Lock is released by disposing generatorLock. - } - } - - private static async Task AcquireGeneratorLockAsync(string lockFilePath, TimeSpan timeout, CancellationToken cancellationToken) - { - var stopwatch = Stopwatch.StartNew(); - - while (true) - { - cancellationToken.ThrowIfCancellationRequested(); - - try - { - return new FileStream(lockFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); - } - catch (IOException) when (stopwatch.Elapsed < timeout) - { - await Task.Delay(150, cancellationToken).ConfigureAwait(false); - } - } - } - - private static async Task<(JsonObject RootSpec, string SourceReference, bool RequiresLegacyNormalization)> LoadRootSpecAsync( - GeneratorOptions options, - string projectDirectory, - CancellationToken cancellationToken) - { - if (!string.IsNullOrWhiteSpace(options.SwaggerInitPath)) - { - string configuredPath = Path.GetFullPath(options.SwaggerInitPath); - if (File.Exists(configuredPath)) - { - if (IsOpenApiSpecFile(configuredPath)) - { - JsonObject root = await LoadOpenApiSpecFileAsJsonObjectAsync(configuredPath, cancellationToken).ConfigureAwait(false); - return (root, configuredPath, false); - } - - string initContents = await File.ReadAllTextAsync(configuredPath, cancellationToken).ConfigureAwait(false); - return (ExtractRootSpecFromSwaggerUiInit(initContents), configuredPath, true); - } - } - - string canonicalSpecPath = Path.GetFullPath(Path.Combine(projectDirectory, "..", "..", "openapi", CanonicalSpecFileName)); - if (File.Exists(canonicalSpecPath)) - { - JsonObject root = await LoadOpenApiSpecFileAsJsonObjectAsync(canonicalSpecPath, cancellationToken).ConfigureAwait(false); - return (root, canonicalSpecPath, false); - } - - string defaultLocalPath = Path.GetFullPath(Path.Combine(projectDirectory, "..", "..", "openapi", "swagger-ui-init.js")); - if (File.Exists(defaultLocalPath)) - { - string initContents = await File.ReadAllTextAsync(defaultLocalPath, cancellationToken).ConfigureAwait(false); - return (ExtractRootSpecFromSwaggerUiInit(initContents), defaultLocalPath, true); - } - - using var client = new HttpClient(); - string remoteContents = await client.GetStringAsync(options.SwaggerUrl, cancellationToken).ConfigureAwait(false); - return (ExtractRootSpecFromSwaggerUiInit(remoteContents), options.SwaggerUrl.ToString(), true); - } - - private static bool IsOpenApiSpecFile(string path) - { - string extension = Path.GetExtension(path); - return extension.Equals(".json", StringComparison.OrdinalIgnoreCase); - } - - private static JsonObject ExtractRootSpecFromSwaggerUiInit(string initContents) - { - string swaggerDocumentJson = SpecExtractor.ExtractSwaggerDocumentJson(initContents); - JsonNode parsedNode = JsonNode.Parse(swaggerDocumentJson) - ?? throw new InvalidOperationException("Failed to parse swagger document JSON."); - return parsedNode.AsObject(); - } - - private static async Task LoadOpenApiSpecFileAsJsonObjectAsync(string specPath, CancellationToken cancellationToken) - { - OpenApiDocument document = await OpenApiDocument.FromFileAsync(specPath, cancellationToken).ConfigureAwait(false); - JsonNode parsedNode = JsonNode.Parse(document.ToJson()) - ?? throw new InvalidOperationException($"Failed to parse OpenAPI spec at '{specPath}'."); - return parsedNode.AsObject(); - } - - private static JsonObject FilterPaths(JsonObject rootSpec, string pathPrefix) - { - var clone = (JsonObject)rootSpec.DeepClone(); - JsonObject originalPaths = clone["paths"]?.AsObject() - ?? throw new InvalidOperationException("OpenAPI document does not contain a 'paths' object."); - - JsonObject filteredPaths = []; - foreach ((string path, JsonNode? pathDefinition) in originalPaths) - { - if (path.Equals(pathPrefix, StringComparison.OrdinalIgnoreCase) || - path.StartsWith(pathPrefix + "/", StringComparison.OrdinalIgnoreCase)) - { - filteredPaths[path] = pathDefinition?.DeepClone(); - } - } - - clone["paths"] = filteredPaths; - return clone; - } - - private static JsonObject NormalizeSpec(JsonObject spec) - { - if (spec["paths"] is not JsonObject paths) - { - return spec; - } - - foreach ((string path, JsonNode? pathNode) in paths) - { - if (pathNode is not JsonObject pathItem) - { - continue; - } - - foreach (string methodName in new[] { "get", "put", "post", "delete", "patch", "options", "head", "trace" }) - { - if (pathItem[methodName] is not JsonObject operation) - { - continue; - } - - EnsureOperationResponses(path, operation); - NormalizeParameters(operation); - } - } - - return spec; - } - - private static void EnsureOperationResponses(string path, JsonObject operation) - { - if (operation["responses"] is not JsonObject responses || responses.Count == 0) - { - operation["responses"] = CreateSuccessResponse(path); - return; - } - - foreach ((string statusCode, JsonNode? responseNode) in responses.ToList()) - { - if (responseNode is null) - { - responses[statusCode] = CreateSuccessResponseNode(path); - } - } - - if (responses.TryGetPropertyValue("200", out JsonNode? successNode) && successNode is JsonObject successResponse) - { - EnsureSuccessResponseHasJsonSchema(path, successResponse); - } - } - - private static void NormalizeParameters(JsonObject operation) - { - if (operation["parameters"] is not JsonArray parameters) - { - return; - } - - foreach (JsonNode? parameterNode in parameters) - { - if (parameterNode is not JsonObject parameter) - { - continue; - } - - if (parameter["schema"] is not null || !parameter.TryGetPropertyValue("type", out JsonNode? typeNode)) - { - continue; - } - - JsonObject schema = []; - if (typeNode is not null) - { - schema["type"] = typeNode.DeepClone(); - _ = parameter.Remove("type"); - } - - if (parameter.TryGetPropertyValue("enum", out JsonNode? enumNode) && enumNode is not null) - { - schema["enum"] = enumNode.DeepClone(); - _ = parameter.Remove("enum"); - } - - if (parameter.TryGetPropertyValue("items", out JsonNode? itemsNode) && itemsNode is not null) - { - schema["items"] = itemsNode.DeepClone(); - _ = parameter.Remove("items"); - } - - parameter["schema"] = schema; - } - } - - private static JsonObject CreateSuccessResponse(string path) - { - return new JsonObject - { - ["200"] = CreateSuccessResponseNode(path), - }; - } - - private static JsonObject CreateSuccessResponseNode(string path) - { - return new JsonObject - { - ["description"] = "Success", - ["content"] = CreateJsonContentNode(path), - }; - } - - private static void EnsureSuccessResponseHasJsonSchema(string path, JsonObject response) - { - if (RequiresFeedSchemaOverride(path)) - { - response["content"] = CreateJsonContentNode(path); - return; - } - - if (response["content"] is not JsonObject content) - { - response["content"] = CreateJsonContentNode(path); - return; - } - - if (content.TryGetPropertyValue("application/json", out JsonNode? mediaTypeNode) && - mediaTypeNode is JsonObject mediaTypeObject && - mediaTypeObject["schema"] is not null) - { - return; - } - - content["application/json"] = new JsonObject - { - ["schema"] = CreateResponseSchema(path), - }; - } - - private static bool RequiresFeedSchemaOverride(string path) - { - return path is "/user/feed/orders" or "/user/feed/traffic" or "/user/feed/rewards"; - } - - private static JsonObject CreateJsonContentNode(string path) - { - return new JsonObject - { - ["application/json"] = new JsonObject - { - ["schema"] = CreateResponseSchema(path), - }, - }; - } - - private static JsonObject CreateResponseSchema(string path) - { - string? feedProperty = path switch - { - "/user/feed/orders" => "orders", - "/user/feed/traffic" => "traffic", - "/user/feed/rewards" => "rewards", - _ => null, - }; - - return feedProperty is null - ? new JsonObject - { - ["type"] = "object", - ["additionalProperties"] = true, - } - : new JsonObject - { - ["type"] = "object", - ["properties"] = new JsonObject - { - [feedProperty] = new JsonObject - { - ["type"] = "array", - ["items"] = new JsonObject - { - ["type"] = "object", - ["additionalProperties"] = true, - }, - }, - ["limit"] = new JsonObject - { - ["type"] = "integer", - }, - ["offset"] = new JsonObject - { - ["type"] = "integer", - }, - ["count"] = new JsonObject - { - ["type"] = "integer", - }, - }, - ["additionalProperties"] = true, - }; - } - - private static async Task GenerateClientAsync( - string openApiJson, - string @namespace, - string className, - CancellationToken cancellationToken) - { - OpenApiDocument document = await OpenApiDocument.FromJsonAsync(openApiJson, cancellationToken).ConfigureAwait(false); - CSharpClientGeneratorSettings settings = new() - { - ClassName = className, - GenerateClientClasses = true, - GenerateClientInterfaces = false, - InjectHttpClient = true, - DisposeHttpClient = false, - GenerateBaseUrlProperty = true, - UseBaseUrl = true, - OperationNameGenerator = new SingleClientFromPathSegmentsOperationNameGenerator(), - GenerateExceptionClasses = true, - ExceptionClass = className + "ApiException", - GenerateResponseClasses = true, - ResponseClass = className + "SwaggerResponse", - CSharpGeneratorSettings = - { - Namespace = @namespace, - JsonLibrary = CSharpJsonLibrary.SystemTextJson, - GenerateNullableReferenceTypes = true, - ClassStyle = CSharpClassStyle.Poco, - }, - }; - - CSharpClientGenerator generator = new(document, settings); - return generator.GenerateFile(); - } - - private static string AddAutoGeneratedHeader(string generatedCode, string source) - { - StringBuilder builder = new(); - _ = builder.AppendLine("// "); - _ = builder.AppendLine("// This file was generated by GoAffPro.Client.Generator."); - _ = builder.Append("// Source: ").AppendLine(source); - _ = builder.Append("// Generated: ").AppendLine(DateTimeOffset.UtcNow.ToString("O")); - _ = builder.AppendLine("// Do not edit manually."); - _ = builder.AppendLine("// "); - _ = builder.AppendLine(); - _ = builder.Append(generatedCode); - return builder.ToString(); - } - - private static string ComputeSha256(string input) - { - byte[] bytes = Encoding.UTF8.GetBytes(input); - byte[] hash = SHA256.HashData(bytes); - return Convert.ToHexString(hash); - } -} diff --git a/src/GoAffPro.Client.Generator/GoAffPro.Client.Generator.csproj b/src/GoAffPro.Client.Generator/GoAffPro.Client.Generator.csproj deleted file mode 100644 index 120745e..0000000 --- a/src/GoAffPro.Client.Generator/GoAffPro.Client.Generator.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - net8.0;net10.0 - enable - enable - true - - - - - - - - - - - - - - diff --git a/src/GoAffPro.Client.Generator/GoAffProClientGeneratorTask.cs b/src/GoAffPro.Client.Generator/GoAffProClientGeneratorTask.cs deleted file mode 100644 index 702c13b..0000000 --- a/src/GoAffPro.Client.Generator/GoAffProClientGeneratorTask.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Microsoft.Build.Framework; - -namespace GoAffPro.Client.Generator; - -public sealed class GoAffProClientGeneratorTask : Microsoft.Build.Utilities.Task -{ - [Required] - public string ProjectDirectory { get; set; } = string.Empty; - - public string? SwaggerInitPath { get; set; } - - public Uri SwaggerUrl { get; set; } = new(GeneratorRunner.DefaultSwaggerInitUrl, UriKind.Absolute); - - public override bool Execute() - { - var options = new GeneratorOptions(ProjectDirectory, SwaggerInitPath, SwaggerUrl); - GeneratorRunner.RunAsync(options, CancellationToken.None).GetAwaiter().GetResult(); - return true; - } -} diff --git a/src/GoAffPro.Client.Generator/Properties/AssemblyInfo.cs b/src/GoAffPro.Client.Generator/Properties/AssemblyInfo.cs deleted file mode 100644 index ff48388..0000000 --- a/src/GoAffPro.Client.Generator/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,3 +0,0 @@ -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("GoAffPro.Client.Tests")] diff --git a/src/GoAffPro.Client.Generator/SpecExtractor.cs b/src/GoAffPro.Client.Generator/SpecExtractor.cs deleted file mode 100644 index 73328cb..0000000 --- a/src/GoAffPro.Client.Generator/SpecExtractor.cs +++ /dev/null @@ -1,90 +0,0 @@ -namespace GoAffPro.Client.Generator; - -internal static class SpecExtractor -{ - public static string ExtractSwaggerDocumentJson(string swaggerUiInitContents) - { - ArgumentException.ThrowIfNullOrWhiteSpace(swaggerUiInitContents); - - const string marker = "\"swaggerDoc\""; - int markerIndex = swaggerUiInitContents.IndexOf(marker, StringComparison.Ordinal); - if (markerIndex < 0) - { - throw new InvalidOperationException("Could not find 'swaggerDoc' in swagger-ui-init.js."); - } - - int colonIndex = swaggerUiInitContents.IndexOf(':', markerIndex + marker.Length); - if (colonIndex < 0) - { - throw new InvalidOperationException("Could not find the ':' token after 'swaggerDoc'."); - } - - int objectStartIndex = swaggerUiInitContents.IndexOf('{', colonIndex); - if (objectStartIndex < 0) - { - throw new InvalidOperationException("Could not find the start of the swagger document JSON object."); - } - - int objectEndIndex = FindObjectEndIndex(swaggerUiInitContents, objectStartIndex); - return swaggerUiInitContents[objectStartIndex..(objectEndIndex + 1)]; - } - - private static int FindObjectEndIndex(string contents, int objectStartIndex) - { - bool insideString = false; - bool isEscaped = false; - int depth = 0; - - for (int index = objectStartIndex; index < contents.Length; index++) - { - char current = contents[index]; - - if (insideString) - { - if (isEscaped) - { - isEscaped = false; - continue; - } - - if (current == '\\') - { - isEscaped = true; - continue; - } - - if (current == '"') - { - insideString = false; - } - - continue; - } - - if (current == '"') - { - insideString = true; - continue; - } - - if (current == '{') - { - depth++; - continue; - } - - if (current != '}') - { - continue; - } - - depth--; - if (depth == 0) - { - return index; - } - } - - throw new InvalidOperationException("Could not parse swagger document JSON object boundaries."); - } -} diff --git a/src/GoAffPro.Client.Generator/build/GoAffPro.Client.Generator.targets b/src/GoAffPro.Client.Generator/build/GoAffPro.Client.Generator.targets deleted file mode 100644 index 3cfc255..0000000 --- a/src/GoAffPro.Client.Generator/build/GoAffPro.Client.Generator.targets +++ /dev/null @@ -1,38 +0,0 @@ - - - - net8.0 - $(MSBuildThisFileDirectory)..\bin\$(Configuration)\$(GoAffProGeneratorTargetFramework)\ - $([System.Guid]::NewGuid().ToString('N')) - $(MSBuildProjectDirectory)\obj\$(Configuration)\$(TargetFramework)\GoAffProGeneratorTask\$(GoAffProGeneratorTaskNonce)\ - $(GoAffProGeneratorTaskDirectory)GoAffPro.Client.Generator.dll - $(MSBuildProjectDirectory)\..\..\openapi\goaffpro-canonical.json - - - - - - - - - - - - - - - - - diff --git a/src/GoAffPro.Client/Generated/.gitkeep b/src/GoAffPro.Client/Generated/.gitkeep deleted file mode 100644 index 8b13789..0000000 --- a/src/GoAffPro.Client/Generated/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/GoAffPro.Client/Generated/GoAffProPublicClient.g.cs b/src/GoAffPro.Client/Generated/GoAffProPublicClient.g.cs deleted file mode 100644 index 1a06064..0000000 --- a/src/GoAffPro.Client/Generated/GoAffProPublicClient.g.cs +++ /dev/null @@ -1,1168 +0,0 @@ -// -// This file was generated by GoAffPro.Client.Generator. -// Source: C:\repos\GoAffPro.Client\openapi\goaffpro-canonical.json -// Generated: 2026-02-25T07:34:01.4747797+00:00 -// Do not edit manually. -// - -//---------------------- -// -// Generated using the NSwag toolchain v14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) -// -//---------------------- - -#nullable enable - -#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." -#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." -#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' -#pragma warning disable 612 // Disable "CS0612 '...' is obsolete" -#pragma warning disable 649 // Disable "CS0649 Field is never assigned to, and will always have its default value null" -#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... -#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." -#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" -#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" -#pragma warning disable 8603 // Disable "CS8603 Possible null reference return" -#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter" -#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type" -#pragma warning disable 8765 // Disable "CS8765 Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes)." - -namespace GoAffPro.Client.Generated.Public -{ - using System = global::System; - - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class GoAffProPublicClient - { - #pragma warning disable 8618 - private string _baseUrl; - #pragma warning restore 8618 - - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public GoAffProPublicClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - BaseUrl = "https://api.goaffpro.com/v1/"; - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - public string BaseUrl - { - get { return _baseUrl; } - set - { - _baseUrl = value; - if (!string.IsNullOrEmpty(_baseUrl) && !_baseUrl.EndsWith("/")) - _baseUrl += '/'; - } - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// - /// Public marketplace sites - /// - /// Success - /// A server side error occurred. - public virtual System.Threading.Tasks.Task PublicSitesAsync(string? site_ids, string? currency, string? keyword, int? limit, int? offset) - { - return PublicSitesAsync(site_ids, currency, keyword, limit, offset, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Public marketplace sites - /// - /// Success - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task PublicSitesAsync(string? site_ids, string? currency, string? keyword, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); - // Operation Path: "public/sites" - urlBuilder_.Append("public/sites"); - urlBuilder_.Append('?'); - if (site_ids != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("site_ids")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(site_ids, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (currency != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("currency")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(currency, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (keyword != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("keyword")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(keyword, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (offset != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProPublicClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 500) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProPublicClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new GoAffProPublicClientApiException("Upstream service error response in plain text.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 502) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProPublicClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new GoAffProPublicClientApiException("Upstream service error response in plain text.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GoAffProPublicClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// - /// Public marketplace products - /// - /// Success - /// A server side error occurred. - public virtual System.Threading.Tasks.Task PublicProductsAsync(int? limit, int? offset, string? site_ids) - { - return PublicProductsAsync(limit, offset, site_ids, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Public marketplace products - /// - /// Success - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task PublicProductsAsync(int? limit, int? offset, string? site_ids, System.Threading.CancellationToken cancellationToken) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); - // Operation Path: "public/products" - urlBuilder_.Append("public/products"); - urlBuilder_.Append('?'); - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (offset != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (site_ids != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("site_ids")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(site_ids, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProPublicClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 500) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProPublicClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new GoAffProPublicClientApiException("Upstream service error response in plain text.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 502) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProPublicClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new GoAffProPublicClientApiException("Upstream service error response in plain text.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GoAffProPublicClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T)!, string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody!, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new GoAffProPublicClientApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody!, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new GoAffProPublicClientApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object? value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class LoginResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("access_token")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Access_token { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserProfileEnvelope - { - - [System.Text.Json.Serialization.JsonPropertyName("user")] - [System.ComponentModel.DataAnnotations.Required] - public object User { get; set; } = new object(); - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserProfileUpdateResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("success")] - public int Success { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserSiteListResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("sites")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Sites { get; set; } = new System.Collections.ObjectModel.Collection(); - - [System.Text.Json.Serialization.JsonPropertyName("count")] - public int Count { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserSite - { - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("logo")] - public string Logo { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("website")] - public string Website { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("status")] - public string Status { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("currency")] - public string Currency { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("affiliate_portal")] - public string Affiliate_portal { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("ref_code")] - public string Ref_code { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("referral_link")] - public string Referral_link { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("coupon")] - public object Coupon { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserStatsAggregateResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("data")] - public System.Collections.Generic.ICollection Data { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserStatsAggregateItem - { - - [System.Text.Json.Serialization.JsonPropertyName("site_id")] - public int Site_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("total_sales")] - public double Total_sales { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("currency")] - public string Currency { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("sale_commission_earned")] - public double Sale_commission_earned { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("revenue_generated")] - public double Revenue_generated { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("commission_paid")] - public double Commission_paid { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class CountLimitOffsetEnvelope - { - - [System.Text.Json.Serialization.JsonPropertyName("count")] - public int Count { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("limit")] - public int Limit { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("offset")] - public int Offset { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class CountLimitOffsetEnvelopeFlexibleOffset - { - - [System.Text.Json.Serialization.JsonPropertyName("count")] - public int Count { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("limit")] - public int Limit { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("offset")] - public int Offset { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class SinceIdEcho - { - - [System.Text.Json.Serialization.JsonPropertyName("since_id")] - public int Since_id { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserOrderFeedResponse : CountLimitOffsetEnvelope - { - - [System.Text.Json.Serialization.JsonPropertyName("orders")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Orders { get; set; } = new System.Collections.ObjectModel.Collection(); - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserPayoutFeedResponse : CountLimitOffsetEnvelope - { - - [System.Text.Json.Serialization.JsonPropertyName("since_id")] - public int Since_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("payouts")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Payouts { get; set; } = new System.Collections.ObjectModel.Collection(); - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserProductFeedResponse : CountLimitOffsetEnvelopeFlexibleOffset - { - - [System.Text.Json.Serialization.JsonPropertyName("products")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Products { get; set; } = new System.Collections.ObjectModel.Collection(); - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserRewardFeedResponse : CountLimitOffsetEnvelope - { - - [System.Text.Json.Serialization.JsonPropertyName("rewards")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Rewards { get; set; } = new System.Collections.ObjectModel.Collection(); - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserRewardFeedItem - { - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("affiliate_id")] - public string Affiliate_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("type")] - public string Type { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("metadata")] - public string Metadata { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("order_id")] - public string Order_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("level")] - public int Level { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("amount")] - public double Amount { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("status")] - public string Status { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("created")] - public string Created { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserTrafficFeedResponse : CountLimitOffsetEnvelope - { - - [System.Text.Json.Serialization.JsonPropertyName("since_id")] - public int Since_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("traffic")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Traffic { get; set; } = new System.Collections.ObjectModel.Collection(); - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserCommissionsResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("standard")] - public object Standard { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("special")] - public System.Collections.Generic.ICollection Special { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("royalties")] - public System.Collections.Generic.ICollection Royalties { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("mlm")] - public object Mlm { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("commissions")] - public System.Collections.Generic.ICollection Commissions { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserTransactionFeedResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("transactions")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Transactions { get; set; } = new System.Collections.ObjectModel.Collection(); - - [System.Text.Json.Serialization.JsonPropertyName("count")] - public int Count { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("limit")] - public int Limit { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("offset")] - public int Offset { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserTransactionItem - { - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("tx_id")] - public int Tx_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("affiliate_id")] - public int Affiliate_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("amount")] - public double Amount { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("currency")] - public string Currency { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("startingBalance")] - public double StartingBalance { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("endingBalance")] - public double EndingBalance { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("created_at")] - public string Created_at { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("entity_type")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public UserTransactionItemEntity_type Entity_type { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("event_type")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public UserTransactionItemEvent_type Event_type { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("entity_id")] - public string Entity_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("is_paid")] - public bool Is_paid { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("metadata")] - public object Metadata { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserPendingPayoutsResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("pending")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Pending { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PendingPayoutItem - { - - [System.Text.Json.Serialization.JsonPropertyName("affiliate_id")] - public int Affiliate_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("amount")] - public double Amount { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("total_earned")] - public double Total_earned { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("total_paid")] - public double Total_paid { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PendingPayoutBreakdown - { - - [System.Text.Json.Serialization.JsonPropertyName("sale_earnings")] - public double Sale_earnings { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("other_earnings")] - public double Other_earnings { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("paid_earnings")] - public double Paid_earnings { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("amount_pending")] - public double Amount_pending { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PublicSitesResponse : CountLimitOffsetEnvelopeFlexibleOffset - { - - [System.Text.Json.Serialization.JsonPropertyName("stores")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Stores { get; set; } = new System.Collections.ObjectModel.Collection(); - - [System.Text.Json.Serialization.JsonPropertyName("currency")] - public string Currency { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("keyword")] - public string Keyword { get; set; } = default!; - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PublicStore - { - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int Id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("website")] - public string Website { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("logo")] - public string Logo { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("currency")] - public string Currency { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("affiliatePortal")] - public string AffiliatePortal { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("cookieDuration")] - public int CookieDuration { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("areRegistrationsOpen")] - public int AreRegistrationsOpen { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("isApprovedAutomatically")] - public int IsApprovedAutomatically { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("commission")] - public CommissionLike Commission { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PublicProductsResponse : CountLimitOffsetEnvelopeFlexibleOffset - { - - [System.Text.Json.Serialization.JsonPropertyName("products")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Products { get; set; } = new System.Collections.ObjectModel.Collection(); - - [System.Text.Json.Serialization.JsonPropertyName("site_ids")] - public string Site_ids { get; set; } = default!; - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class CommissionLike - { - - [System.Text.Json.Serialization.JsonPropertyName("type")] - public string Type { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("amount")] - public double Amount { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("true")] - public string True { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ErrorResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("error")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Error { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("code")] - public int Code { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum UserTransactionItemEntity_type - { - - [System.Runtime.Serialization.EnumMember(Value = @"orders")] - Orders = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"rewards")] - Rewards = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"payouts")] - Payouts = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"ORDERS")] - ORDERS = 3, - - [System.Runtime.Serialization.EnumMember(Value = @"REWARDS")] - REWARDS = 4, - - [System.Runtime.Serialization.EnumMember(Value = @"PAYOUTS")] - PAYOUTS = 5, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum UserTransactionItemEvent_type - { - - [System.Runtime.Serialization.EnumMember(Value = @"insert")] - Insert = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"update")] - Update = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"delete")] - Delete = 2, - - } - - - - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class GoAffProPublicClientApiException : System.Exception - { - public int StatusCode { get; private set; } - - public string? Response { get; private set; } - - public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } - - public GoAffProPublicClientApiException(string message, int statusCode, string? response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Exception? innerException) - : base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : response.Substring(0, response.Length >= 512 ? 512 : response.Length)), innerException) - { - StatusCode = statusCode; - Response = response; - Headers = headers; - } - - public override string ToString() - { - return string.Format("HTTP Response: \n\n{0}\n\n{1}", Response, base.ToString()); - } - } - - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class GoAffProPublicClientApiException : GoAffProPublicClientApiException - { - public TResult Result { get; private set; } - - public GoAffProPublicClientApiException(string message, int statusCode, string? response, System.Collections.Generic.IReadOnlyDictionary> headers, TResult result, System.Exception? innerException) - : base(message, statusCode, response, headers, innerException) - { - Result = result; - } - } - -} - -#pragma warning restore 108 -#pragma warning restore 114 -#pragma warning restore 472 -#pragma warning restore 612 -#pragma warning restore 1573 -#pragma warning restore 1591 -#pragma warning restore 8073 -#pragma warning restore 3016 -#pragma warning restore 8603 -#pragma warning restore 8604 -#pragma warning restore 8625 \ No newline at end of file diff --git a/src/GoAffPro.Client/Generated/GoAffProUserClient.g.cs b/src/GoAffPro.Client/Generated/GoAffProUserClient.g.cs deleted file mode 100644 index e909fb4..0000000 --- a/src/GoAffPro.Client/Generated/GoAffProUserClient.g.cs +++ /dev/null @@ -1,2473 +0,0 @@ -// -// This file was generated by GoAffPro.Client.Generator. -// Source: C:\repos\GoAffPro.Client\openapi\goaffpro-canonical.json -// Generated: 2026-02-25T07:34:01.4737048+00:00 -// Do not edit manually. -// - -//---------------------- -// -// Generated using the NSwag toolchain v14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) -// -//---------------------- - -#nullable enable - -#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." -#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." -#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' -#pragma warning disable 612 // Disable "CS0612 '...' is obsolete" -#pragma warning disable 649 // Disable "CS0649 Field is never assigned to, and will always have its default value null" -#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... -#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." -#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" -#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" -#pragma warning disable 8603 // Disable "CS8603 Possible null reference return" -#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter" -#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type" -#pragma warning disable 8765 // Disable "CS8765 Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes)." - -namespace GoAffPro.Client.Generated.User -{ - using System = global::System; - - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class GoAffProUserClient - { - #pragma warning disable 8618 - private string _baseUrl; - #pragma warning restore 8618 - - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public GoAffProUserClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - BaseUrl = "https://api.goaffpro.com/v1/"; - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - public string BaseUrl - { - get { return _baseUrl; } - set - { - _baseUrl = value; - if (!string.IsNullOrEmpty(_baseUrl) && !_baseUrl.EndsWith("/")) - _baseUrl += '/'; - } - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// - /// Log in to get the access token - /// - /// Success - /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserLoginAsync(Body body) - { - return UserLoginAsync(body, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Log in to get the access token - /// - /// Success - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserLoginAsync(Body body, System.Threading.CancellationToken cancellationToken) - { - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var dictionary_ = System.Text.Json.JsonSerializer.Deserialize>(json_, JsonSerializerSettings); - var content_ = new System.Net.Http.FormUrlEncodedContent(dictionary_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/x-www-form-urlencoded"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); - // Operation Path: "user/login" - urlBuilder_.Append("user/login"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// - /// List of stores the user is enrolled in - /// - /// Success - /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserSitesAsync(int? limit, int? offset, Status? status, System.Collections.Generic.IEnumerable fields) - { - return UserSitesAsync(limit, offset, status, fields, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// List of stores the user is enrolled in - /// - /// Success - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserSitesAsync(int? limit, int? offset, Status? status, System.Collections.Generic.IEnumerable fields, System.Threading.CancellationToken cancellationToken) - { - if (fields == null) - throw new System.ArgumentNullException("fields"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); - // Operation Path: "user/sites" - urlBuilder_.Append("user/sites"); - urlBuilder_.Append('?'); - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (offset != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (status != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("status")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(status, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - foreach (var item_ in fields) { urlBuilder_.Append(System.Uri.EscapeDataString("fields")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 403) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// - /// Get information about logged in user profile - /// - /// Success - /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserGetAsync() - { - return UserGetAsync(System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Get information about logged in user profile - /// - /// Success - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserGetAsync(System.Threading.CancellationToken cancellationToken) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); - // Operation Path: "user" - urlBuilder_.Append("user"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 403) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// - /// Update your profile - /// - /// Success - /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserPostAsync() - { - return UserPostAsync(System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Update your profile - /// - /// Success - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserPostAsync(System.Threading.CancellationToken cancellationToken) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); - // Operation Path: "user" - urlBuilder_.Append("user"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 403) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// - /// Aggregates of user stats - /// - /// Success - /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserStatsAggregateAsync(string? site_ids, string? start_time, string? end_time, System.Collections.Generic.IEnumerable fields) - { - return UserStatsAggregateAsync(site_ids, start_time, end_time, fields, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Aggregates of user stats - /// - /// Success - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserStatsAggregateAsync(string? site_ids, string? start_time, string? end_time, System.Collections.Generic.IEnumerable fields, System.Threading.CancellationToken cancellationToken) - { - if (fields == null) - throw new System.ArgumentNullException("fields"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); - // Operation Path: "user/stats/aggregate" - urlBuilder_.Append("user/stats/aggregate"); - urlBuilder_.Append('?'); - if (site_ids != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("site_ids")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(site_ids, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (start_time != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("start_time")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(start_time, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (end_time != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("end_time")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(end_time, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - foreach (var item_ in fields) { urlBuilder_.Append(System.Uri.EscapeDataString("fields")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 403) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// - /// Feed of user orders - /// - /// Success - /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserFeedOrdersAsync(string? site_ids, string? since_id, string? max_id, string? created_at_max, string? created_at_min, System.Collections.Generic.IEnumerable fields, int? limit, int? offset) - { - return UserFeedOrdersAsync(site_ids, since_id, max_id, created_at_max, created_at_min, fields, limit, offset, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Feed of user orders - /// - /// Success - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserFeedOrdersAsync(string? site_ids, string? since_id, string? max_id, string? created_at_max, string? created_at_min, System.Collections.Generic.IEnumerable fields, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) - { - if (fields == null) - throw new System.ArgumentNullException("fields"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); - // Operation Path: "user/feed/orders" - urlBuilder_.Append("user/feed/orders"); - urlBuilder_.Append('?'); - if (site_ids != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("site_ids")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(site_ids, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (since_id != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("since_id")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(since_id, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (max_id != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("max_id")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(max_id, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (created_at_max != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("created_at_max")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(created_at_max, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (created_at_min != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("created_at_min")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(created_at_min, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - foreach (var item_ in fields) { urlBuilder_.Append(System.Uri.EscapeDataString("fields")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); } - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (offset != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 403) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// - /// Feed of user payouts - /// - /// Success - /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserFeedPayoutsAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset) - { - return UserFeedPayoutsAsync(site_ids, start_time, end_time, since_id, limit, offset, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Feed of user payouts - /// - /// Success - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserFeedPayoutsAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); - // Operation Path: "user/feed/payouts" - urlBuilder_.Append("user/feed/payouts"); - urlBuilder_.Append('?'); - if (site_ids != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("site_ids")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(site_ids, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (start_time != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("start_time")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(start_time, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (end_time != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("end_time")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(end_time, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (since_id != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("since_id")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(since_id, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (offset != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 403) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// - /// Feed of products available for promotion - /// - /// Success - /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserFeedProductsAsync(int? limit, int? offset) - { - return UserFeedProductsAsync(limit, offset, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Feed of products available for promotion - /// - /// Success - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserFeedProductsAsync(int? limit, int? offset, System.Threading.CancellationToken cancellationToken) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); - // Operation Path: "user/feed/products" - urlBuilder_.Append("user/feed/products"); - urlBuilder_.Append('?'); - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (offset != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 403) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 502) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new GoAffProUserClientApiException("Upstream service error response in plain text.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// - /// Feed of user rewards - /// - /// Success - /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserFeedRewardsAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset) - { - return UserFeedRewardsAsync(site_ids, start_time, end_time, since_id, limit, offset, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Feed of user rewards - /// - /// Success - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserFeedRewardsAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); - // Operation Path: "user/feed/rewards" - urlBuilder_.Append("user/feed/rewards"); - urlBuilder_.Append('?'); - if (site_ids != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("site_ids")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(site_ids, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (start_time != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("start_time")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(start_time, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (end_time != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("end_time")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(end_time, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (since_id != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("since_id")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(since_id, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (offset != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 404) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new GoAffProUserClientApiException("Upstream service error response in plain text.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// - /// Feed of user traffic - /// - /// Success - /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserFeedTrafficAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset) - { - return UserFeedTrafficAsync(site_ids, start_time, end_time, since_id, limit, offset, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Feed of user traffic - /// - /// Success - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserFeedTrafficAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); - // Operation Path: "user/feed/traffic" - urlBuilder_.Append("user/feed/traffic"); - urlBuilder_.Append('?'); - if (site_ids != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("site_ids")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(site_ids, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (start_time != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("start_time")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(start_time, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (end_time != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("end_time")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(end_time, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (since_id != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("since_id")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(since_id, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (offset != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 403) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// - /// Feed of user transactions - /// - /// Success - /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserFeedTransactionsAsync(int? limit, int? offset) - { - return UserFeedTransactionsAsync(limit, offset, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Feed of user transactions - /// - /// Success - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserFeedTransactionsAsync(int? limit, int? offset, System.Threading.CancellationToken cancellationToken) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); - // Operation Path: "user/feed/transactions" - urlBuilder_.Append("user/feed/transactions"); - urlBuilder_.Append('?'); - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (offset != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 403) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 500) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new GoAffProUserClientApiException("Upstream service error response in plain text.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// - /// Get commission structure - /// - /// Success - /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserCommissionsAsync(string? site_ids) - { - return UserCommissionsAsync(site_ids, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Get commission structure - /// - /// Success - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserCommissionsAsync(string? site_ids, System.Threading.CancellationToken cancellationToken) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); - // Operation Path: "user/commissions" - urlBuilder_.Append("user/commissions"); - urlBuilder_.Append('?'); - if (site_ids != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("site_ids")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(site_ids, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 403) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// - /// Get pending payout amount (and its breakdown) - /// - /// Success - /// A server side error occurred. - public virtual System.Threading.Tasks.Task UserPayoutsPendingAsync() - { - return UserPayoutsPendingAsync(System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Get pending payout amount (and its breakdown) - /// - /// Success - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserPayoutsPendingAsync(System.Threading.CancellationToken cancellationToken) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); - // Operation Path: "user/payouts/pending" - urlBuilder_.Append("user/payouts/pending"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 403) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new GoAffProUserClientApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new GoAffProUserClientApiException("Authentication or authorization failure.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GoAffProUserClientApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T)!, string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody!, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new GoAffProUserClientApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody!, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new GoAffProUserClientApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object? value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class LoginResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("access_token")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Access_token { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserProfileEnvelope - { - - [System.Text.Json.Serialization.JsonPropertyName("user")] - [System.ComponentModel.DataAnnotations.Required] - public object User { get; set; } = new object(); - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserProfileUpdateResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("success")] - public int Success { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserSiteListResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("sites")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Sites { get; set; } = new System.Collections.ObjectModel.Collection(); - - [System.Text.Json.Serialization.JsonPropertyName("count")] - public int Count { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserSite - { - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("logo")] - public string Logo { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("website")] - public string Website { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("status")] - public string Status { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("currency")] - public string Currency { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("affiliate_portal")] - public string Affiliate_portal { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("ref_code")] - public string Ref_code { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("referral_link")] - public string Referral_link { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("coupon")] - public object Coupon { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserStatsAggregateResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("data")] - public System.Collections.Generic.ICollection Data { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserStatsAggregateItem - { - - [System.Text.Json.Serialization.JsonPropertyName("site_id")] - public int Site_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("total_sales")] - public double Total_sales { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("currency")] - public string Currency { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("sale_commission_earned")] - public double Sale_commission_earned { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("revenue_generated")] - public double Revenue_generated { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("commission_paid")] - public double Commission_paid { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class CountLimitOffsetEnvelope - { - - [System.Text.Json.Serialization.JsonPropertyName("count")] - public int Count { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("limit")] - public int Limit { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("offset")] - public int Offset { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class CountLimitOffsetEnvelopeFlexibleOffset - { - - [System.Text.Json.Serialization.JsonPropertyName("count")] - public int Count { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("limit")] - public int Limit { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("offset")] - public int Offset { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class SinceIdEcho - { - - [System.Text.Json.Serialization.JsonPropertyName("since_id")] - public int Since_id { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserOrderFeedResponse : CountLimitOffsetEnvelope - { - - [System.Text.Json.Serialization.JsonPropertyName("orders")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Orders { get; set; } = new System.Collections.ObjectModel.Collection(); - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserPayoutFeedResponse : CountLimitOffsetEnvelope - { - - [System.Text.Json.Serialization.JsonPropertyName("since_id")] - public int Since_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("payouts")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Payouts { get; set; } = new System.Collections.ObjectModel.Collection(); - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserProductFeedResponse : CountLimitOffsetEnvelopeFlexibleOffset - { - - [System.Text.Json.Serialization.JsonPropertyName("products")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Products { get; set; } = new System.Collections.ObjectModel.Collection(); - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserRewardFeedResponse : CountLimitOffsetEnvelope - { - - [System.Text.Json.Serialization.JsonPropertyName("rewards")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Rewards { get; set; } = new System.Collections.ObjectModel.Collection(); - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserRewardFeedItem - { - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("affiliate_id")] - public string Affiliate_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("type")] - public string Type { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("metadata")] - public string Metadata { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("order_id")] - public string Order_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("level")] - public int Level { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("amount")] - public double Amount { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("status")] - public string Status { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("created")] - public string Created { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserTrafficFeedResponse : CountLimitOffsetEnvelope - { - - [System.Text.Json.Serialization.JsonPropertyName("since_id")] - public int Since_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("traffic")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Traffic { get; set; } = new System.Collections.ObjectModel.Collection(); - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserCommissionsResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("standard")] - public object Standard { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("special")] - public System.Collections.Generic.ICollection Special { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("royalties")] - public System.Collections.Generic.ICollection Royalties { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("mlm")] - public object Mlm { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("commissions")] - public System.Collections.Generic.ICollection Commissions { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserTransactionFeedResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("transactions")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Transactions { get; set; } = new System.Collections.ObjectModel.Collection(); - - [System.Text.Json.Serialization.JsonPropertyName("count")] - public int Count { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("limit")] - public int Limit { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("offset")] - public int Offset { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserTransactionItem - { - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("tx_id")] - public int Tx_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("affiliate_id")] - public int Affiliate_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("amount")] - public double Amount { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("currency")] - public string Currency { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("startingBalance")] - public double StartingBalance { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("endingBalance")] - public double EndingBalance { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("created_at")] - public string Created_at { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("entity_type")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public UserTransactionItemEntity_type Entity_type { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("event_type")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public UserTransactionItemEvent_type Event_type { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("entity_id")] - public string Entity_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("is_paid")] - public bool Is_paid { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("metadata")] - public object Metadata { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UserPendingPayoutsResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("pending")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Pending { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PendingPayoutItem - { - - [System.Text.Json.Serialization.JsonPropertyName("affiliate_id")] - public int Affiliate_id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("amount")] - public double Amount { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("total_earned")] - public double Total_earned { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("total_paid")] - public double Total_paid { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PendingPayoutBreakdown - { - - [System.Text.Json.Serialization.JsonPropertyName("sale_earnings")] - public double Sale_earnings { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("other_earnings")] - public double Other_earnings { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("paid_earnings")] - public double Paid_earnings { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("amount_pending")] - public double Amount_pending { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PublicSitesResponse : CountLimitOffsetEnvelopeFlexibleOffset - { - - [System.Text.Json.Serialization.JsonPropertyName("stores")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Stores { get; set; } = new System.Collections.ObjectModel.Collection(); - - [System.Text.Json.Serialization.JsonPropertyName("currency")] - public string Currency { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("keyword")] - public string Keyword { get; set; } = default!; - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PublicStore - { - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int Id { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("website")] - public string Website { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("logo")] - public string Logo { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("currency")] - public string Currency { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("affiliatePortal")] - public string AffiliatePortal { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("cookieDuration")] - public int CookieDuration { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("areRegistrationsOpen")] - public int AreRegistrationsOpen { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("isApprovedAutomatically")] - public int IsApprovedAutomatically { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("commission")] - public CommissionLike Commission { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PublicProductsResponse : CountLimitOffsetEnvelopeFlexibleOffset - { - - [System.Text.Json.Serialization.JsonPropertyName("products")] - [System.ComponentModel.DataAnnotations.Required] - public System.Collections.Generic.ICollection Products { get; set; } = new System.Collections.ObjectModel.Collection(); - - [System.Text.Json.Serialization.JsonPropertyName("site_ids")] - public string Site_ids { get; set; } = default!; - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class CommissionLike - { - - [System.Text.Json.Serialization.JsonPropertyName("type")] - public string Type { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("amount")] - public double Amount { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("true")] - public string True { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ErrorResponse - { - - [System.Text.Json.Serialization.JsonPropertyName("error")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Error { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("code")] - public int Code { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Body - { - - [System.Text.Json.Serialization.JsonPropertyName("email")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Email { get; set; } = default!; - - [System.Text.Json.Serialization.JsonPropertyName("password")] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Password { get; set; } = default!; - - private System.Collections.Generic.IDictionary? _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum Status - { - - [System.Runtime.Serialization.EnumMember(Value = @"approved")] - Approved = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"pending")] - Pending = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"blocked")] - Blocked = 2, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum Anonymous - { - - [System.Runtime.Serialization.EnumMember(Value = @"id")] - Id = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"name")] - Name = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"logo")] - Logo = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"website")] - Website = 3, - - [System.Runtime.Serialization.EnumMember(Value = @"status")] - Status = 4, - - [System.Runtime.Serialization.EnumMember(Value = @"currency")] - Currency = 5, - - [System.Runtime.Serialization.EnumMember(Value = @"affiliate_portal")] - Affiliate_portal = 6, - - [System.Runtime.Serialization.EnumMember(Value = @"ref_code")] - Ref_code = 7, - - [System.Runtime.Serialization.EnumMember(Value = @"referral_link")] - Referral_link = 8, - - [System.Runtime.Serialization.EnumMember(Value = @"coupon")] - Coupon = 9, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum Anonymous2 - { - - [System.Runtime.Serialization.EnumMember(Value = @"total_sales")] - Total_sales = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"other_commission_earned")] - Other_commission_earned = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"revenue_generated")] - Revenue_generated = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"sale_commission_earned")] - Sale_commission_earned = 3, - - [System.Runtime.Serialization.EnumMember(Value = @"commission_paid")] - Commission_paid = 4, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum Anonymous3 - { - - [System.Runtime.Serialization.EnumMember(Value = @"id")] - Id = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"number")] - Number = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"total")] - Total = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"subtotal")] - Subtotal = 3, - - [System.Runtime.Serialization.EnumMember(Value = @"line_items")] - Line_items = 4, - - [System.Runtime.Serialization.EnumMember(Value = @"commission")] - Commission = 5, - - [System.Runtime.Serialization.EnumMember(Value = @"created_at")] - Created_at = 6, - - [System.Runtime.Serialization.EnumMember(Value = @"currency")] - Currency = 7, - - [System.Runtime.Serialization.EnumMember(Value = @"site_id")] - Site_id = 8, - - [System.Runtime.Serialization.EnumMember(Value = @"sub_id")] - Sub_id = 9, - - [System.Runtime.Serialization.EnumMember(Value = @"conversion_details")] - Conversion_details = 10, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum UserTransactionItemEntity_type - { - - [System.Runtime.Serialization.EnumMember(Value = @"orders")] - Orders = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"rewards")] - Rewards = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"payouts")] - Payouts = 2, - - [System.Runtime.Serialization.EnumMember(Value = @"ORDERS")] - ORDERS = 3, - - [System.Runtime.Serialization.EnumMember(Value = @"REWARDS")] - REWARDS = 4, - - [System.Runtime.Serialization.EnumMember(Value = @"PAYOUTS")] - PAYOUTS = 5, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public enum UserTransactionItemEvent_type - { - - [System.Runtime.Serialization.EnumMember(Value = @"insert")] - Insert = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"update")] - Update = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"delete")] - Delete = 2, - - } - - - - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class GoAffProUserClientApiException : System.Exception - { - public int StatusCode { get; private set; } - - public string? Response { get; private set; } - - public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } - - public GoAffProUserClientApiException(string message, int statusCode, string? response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Exception? innerException) - : base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : response.Substring(0, response.Length >= 512 ? 512 : response.Length)), innerException) - { - StatusCode = statusCode; - Response = response; - Headers = headers; - } - - public override string ToString() - { - return string.Format("HTTP Response: \n\n{0}\n\n{1}", Response, base.ToString()); - } - } - - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class GoAffProUserClientApiException : GoAffProUserClientApiException - { - public TResult Result { get; private set; } - - public GoAffProUserClientApiException(string message, int statusCode, string? response, System.Collections.Generic.IReadOnlyDictionary> headers, TResult result, System.Exception? innerException) - : base(message, statusCode, response, headers, innerException) - { - Result = result; - } - } - -} - -#pragma warning restore 108 -#pragma warning restore 114 -#pragma warning restore 472 -#pragma warning restore 612 -#pragma warning restore 1573 -#pragma warning restore 1591 -#pragma warning restore 8073 -#pragma warning restore 3016 -#pragma warning restore 8603 -#pragma warning restore 8604 -#pragma warning restore 8625 \ No newline at end of file diff --git a/src/GoAffPro.Client/GoAffPro.Client.csproj b/src/GoAffPro.Client/GoAffPro.Client.csproj index 808b735..f04b34e 100644 --- a/src/GoAffPro.Client/GoAffPro.Client.csproj +++ b/src/GoAffPro.Client/GoAffPro.Client.csproj @@ -1,24 +1,24 @@ - net8.0;net10.0 + net9.0;net10.0 enable enable true true GoAffPro.Client v - A modern .NET client for the GoAffPro Affiliate Marketing API with automatic code generation and event detection. + A modern .NET client for the GoAffPro Affiliate Marketing API with Kiota-generated clients and event detection. https://github.com/Agash/GoAffPro.Client README.md goaffpro;affiliate;marketing;api;client;dotnet $(NoWarn);CS8981;CA1708 - net10.0 - $(MSBuildProjectDirectory)\..\..\openapi\goaffpro-canonical.json + + @@ -26,20 +26,11 @@ - + - - - false - - - false - - - diff --git a/tests/GoAffPro.Client.Tests/GeneratedClientContractTests.cs b/tests/GoAffPro.Client.Tests/GeneratedClientContractTests.cs index 4bc049d..67ca750 100644 --- a/tests/GoAffPro.Client.Tests/GeneratedClientContractTests.cs +++ b/tests/GoAffPro.Client.Tests/GeneratedClientContractTests.cs @@ -10,40 +10,57 @@ public sealed class GeneratedClientContractTests public void GeneratedClientSignatures_WhenComparedToSnapshot_MatchCommittedSnapshot() { string repositoryRoot = FindRepositoryRoot(); - string userClientPath = Path.Combine(repositoryRoot, "src", "GoAffPro.Client", "Generated", "GoAffProUserClient.g.cs"); - string publicClientPath = Path.Combine(repositoryRoot, "src", "GoAffPro.Client", "Generated", "GoAffProPublicClient.g.cs"); + string generatedDirectory = Path.Combine(repositoryRoot, "src", "GoAffPro.Client.Generated", "Generated"); string snapshotPath = Path.Combine(repositoryRoot, "tests", "GoAffPro.Client.Tests", "Snapshots", "GeneratedClientSignatures.snapshot"); - string actualSnapshot = BuildSnapshot(userClientPath, publicClientPath); + string actualSnapshot = BuildSnapshot(generatedDirectory); string expectedSnapshot = File.ReadAllText(snapshotPath, Encoding.UTF8).Replace("\r\n", "\n", StringComparison.Ordinal); - _ = actualSnapshot.Should().Be(expectedSnapshot); + _ = NormalizeSnapshot(actualSnapshot).Should().Be(NormalizeSnapshot(expectedSnapshot)); } - private static string BuildSnapshot(string userClientPath, string publicClientPath) + private static string BuildSnapshot(string generatedDirectory) { + string[] files = Directory.GetFiles(generatedDirectory, "*.cs", SearchOption.AllDirectories); + string userPathSegment = $"{Path.DirectorySeparatorChar}Generated{Path.DirectorySeparatorChar}User{Path.DirectorySeparatorChar}"; + string publicPathSegment = $"{Path.DirectorySeparatorChar}Generated{Path.DirectorySeparatorChar}Public{Path.DirectorySeparatorChar}"; + + string[] userFiles = files + .Where(path => path.Contains(userPathSegment, StringComparison.OrdinalIgnoreCase)) + .ToArray(); + string[] publicFiles = files + .Where(path => path.Contains(publicPathSegment, StringComparison.OrdinalIgnoreCase)) + .ToArray(); + var builder = new StringBuilder(); - AppendSignatureBlock(builder, "GoAffProUserClient", userClientPath); + AppendSignatureBlock(builder, "GoAffProUserClient", userFiles); _ = builder.AppendLine(); - AppendSignatureBlock(builder, "GoAffProPublicClient", publicClientPath); + AppendSignatureBlock(builder, "GoAffProPublicClient", publicFiles); return builder.ToString().Replace("\r\n", "\n", StringComparison.Ordinal); } - private static void AppendSignatureBlock(StringBuilder builder, string name, string filePath) + private static void AppendSignatureBlock(StringBuilder builder, string name, IReadOnlyCollection filePaths) { _ = builder.Append('[').Append(name).AppendLine("]"); - foreach (string signature in ExtractAsyncMethodSignatures(filePath)) + foreach (string signature in ExtractAsyncMethodSignatures(filePaths)) { _ = builder.AppendLine(signature); } } - private static string[] ExtractAsyncMethodSignatures(string filePath) + private static string[] ExtractAsyncMethodSignatures(IReadOnlyCollection filePaths) { - string content = File.ReadAllText(filePath, Encoding.UTF8); - MatchCollection matches = Regex.Matches(content, @"public virtual[^\r\n]*Async\([^\r\n]*\)"); - return matches - .Select(static match => Regex.Replace(match.Value, @"\s+", " ").Trim()) + var signatures = new List(); + foreach (string filePath in filePaths.OrderBy(static path => path, StringComparer.OrdinalIgnoreCase)) + { + string content = File.ReadAllText(filePath, Encoding.UTF8); + MatchCollection matches = Regex.Matches(content, @"public(?:\s+virtual)?[^\r\n]*Async\([^\r\n]*\)"); + signatures.AddRange(matches.Select(static match => Regex.Replace(match.Value, @"\s+", " ").Trim())); + } + + return signatures + .Distinct(StringComparer.Ordinal) + .OrderBy(static signature => signature, StringComparer.Ordinal) .ToArray(); } @@ -62,4 +79,42 @@ private static string FindRepositoryRoot() throw new DirectoryNotFoundException("Unable to locate repository root from test output directory."); } + + private static string NormalizeSnapshot(string snapshot) + { + string[] lines = snapshot.Replace("\r\n", "\n", StringComparison.Ordinal).Split('\n'); + var normalized = new StringBuilder(); + var currentSignatures = new List(); + + foreach (string rawLine in lines) + { + string line = rawLine.TrimEnd(); + if (string.IsNullOrWhiteSpace(line)) + { + continue; + } + + if (line.Length >= 2 && line[0] == '[' && line[^1] == ']') + { + AppendSortedBlock(normalized, currentSignatures); + currentSignatures.Clear(); + + _ = normalized.AppendLine(line); + continue; + } + + currentSignatures.Add(line); + } + + AppendSortedBlock(normalized, currentSignatures); + return normalized.ToString(); + } + + private static void AppendSortedBlock(StringBuilder builder, List signatures) + { + foreach (string signature in signatures.OrderBy(static value => value, StringComparer.Ordinal)) + { + _ = builder.AppendLine(signature); + } + } } diff --git a/tests/GoAffPro.Client.Tests/GoAffProClientTests.cs b/tests/GoAffPro.Client.Tests/GoAffProClientTests.cs index f7fc80c..d7a5ac6 100644 --- a/tests/GoAffPro.Client.Tests/GoAffProClientTests.cs +++ b/tests/GoAffPro.Client.Tests/GoAffProClientTests.cs @@ -47,141 +47,24 @@ public async Task LoginAsync_WhenApiReturnsError_ThrowsGoAffProApiException() } [Fact] - public async Task GetOrdersAsync_WhenFeedContainsOrders_ReturnsMappedOrders() - { - using var handler = new TestHttpMessageHandler((request, _) => - { - return request.RequestUri!.AbsolutePath.EndsWith("/user/feed/orders", StringComparison.OrdinalIgnoreCase) - ? TestHttpMessageHandler.JsonResponse("""{"orders":[{"id":"o-1","total":101.25,"commission":"10.5"},{"order_id":"o-2","subtotal":90,"affiliate_id":"5","status":"approved"}],"limit":2,"offset":0,"count":2}""") - : TestHttpMessageHandler.JsonResponse("""{}"""); - }); - - using var httpClient = new HttpClient(handler); - using var client = new GoAffProClient(httpClient, new GoAffProClientOptions { BaseUrl = new Uri("https://example.test/v1/", UriKind.Absolute) }); - - IReadOnlyList orders = await client.GetOrdersAsync(limit: 10, offset: 0); - - _ = orders.Select(static order => order.Id).Should().Equal("o-1", "o-2"); - _ = orders[0].Total.Should().Be(101.25m); - _ = orders[0].Commission.Should().Be(10.5m); - _ = orders[1].Subtotal.Should().Be(90m); - _ = orders[1].AffiliateId.Should().Be("5"); - _ = orders[1].Status.Should().Be("approved"); - } - - [Fact] - public async Task GetRewardsAsync_WhenCalled_DoesNotHitEndpointAndReturnsEmpty() - { - bool rewardsEndpointCalled = false; - using var handler = new TestHttpMessageHandler((request, _) => - { - if (request.RequestUri!.AbsolutePath.EndsWith("/user/feed/rewards", StringComparison.OrdinalIgnoreCase)) - { - rewardsEndpointCalled = true; - return TestHttpMessageHandler.JsonResponse("""{"error":"not found"}""", HttpStatusCode.NotFound); - } - - return TestHttpMessageHandler.JsonResponse("""{}"""); - }); - - using var httpClient = new HttpClient(handler); - using var client = new GoAffProClient(httpClient, new GoAffProClientOptions { BaseUrl = new Uri("https://example.test/v1/", UriKind.Absolute) }); - - // Intentionally calling obsolete API to verify temporary disable behavior. -#pragma warning disable CS0618 - IReadOnlyList rewards = await client.GetRewardsAsync(limit: 10, offset: 0); -#pragma warning restore CS0618 - - _ = rewards.Should().BeEmpty(); - _ = rewardsEndpointCalled.Should().BeFalse(); - } - - [Fact] - public async Task GetOrdersAsync_WithTimeFilters_PassesParametersToRequest() - { - Uri? observedUri = null; - using var handler = new TestHttpMessageHandler((request, _) => - { - observedUri = request.RequestUri; - return TestHttpMessageHandler.JsonResponse("""{"orders":[]}"""); - }); - - using var httpClient = new HttpClient(handler); - using var client = new GoAffProClient(httpClient, new GoAffProClientOptions { BaseUrl = new Uri("https://example.test/v1/", UriKind.Absolute) }); - - var from = new DateTimeOffset(2026, 1, 1, 0, 0, 0, TimeSpan.Zero); - var to = new DateTimeOffset(2026, 1, 31, 23, 59, 59, TimeSpan.Zero); - _ = await client.GetOrdersAsync(from: from, toDate: to, limit: 50); - - _ = observedUri.Should().NotBeNull(); - _ = observedUri!.Query.Should().Contain("created_at_min="); - _ = observedUri.Query.Should().Contain("created_at_max="); - } - - [Fact] - public async Task GetAffiliatesAsync_WithTimeFilters_PassesParametersToRequest() - { - Uri? observedUri = null; - using var handler = new TestHttpMessageHandler((request, _) => - { - observedUri = request.RequestUri; - return TestHttpMessageHandler.JsonResponse("""{"traffic":[]}"""); - }); - - using var httpClient = new HttpClient(handler); - using var client = new GoAffProClient(httpClient, new GoAffProClientOptions { BaseUrl = new Uri("https://example.test/v1/", UriKind.Absolute) }); - - var from = new DateTimeOffset(2026, 1, 1, 0, 0, 0, TimeSpan.Zero); - var to = new DateTimeOffset(2026, 1, 31, 23, 59, 59, TimeSpan.Zero); - _ = await client.GetAffiliatesAsync(from: from, toDate: to, limit: 50); - - _ = observedUri.Should().NotBeNull(); - _ = observedUri!.Query.Should().Contain("start_time="); - _ = observedUri.Query.Should().Contain("end_time="); - } - - [Fact] - public async Task GetPayoutsAsync_WhenCalled_ReturnsMappedPayouts() - { - using var handler = new TestHttpMessageHandler((request, _) => - { - return request.RequestUri!.AbsolutePath.EndsWith("/user/feed/payouts", StringComparison.OrdinalIgnoreCase) - ? TestHttpMessageHandler.JsonResponse("""{"payouts":[{"id":"p-1","amount":100,"status":"paid"},{"id":"p-2","affiliate_id":"5","amount":50.50,"status":"pending"}]}""") - : TestHttpMessageHandler.JsonResponse("""{}"""); - }); - - using var httpClient = new HttpClient(handler); - using var client = new GoAffProClient(httpClient, new GoAffProClientOptions { BaseUrl = new Uri("https://example.test/v1/", UriKind.Absolute) }); - - IReadOnlyList payouts = await client.GetPayoutsAsync(limit: 10, offset: 0); - - _ = payouts.Count.Should().Be(2); - _ = payouts[0].Id.Should().Be("p-1"); - _ = payouts[0].Amount.Should().Be(100m); - _ = payouts[0].Status.Should().Be("paid"); - _ = payouts[1].AffiliateId.Should().Be("5"); - _ = payouts[1].Amount.Should().Be(50.50m); - } - - [Fact] - public async Task GetProductsAsync_WhenCalled_ReturnsMappedProducts() + public async Task SetBearerToken_WhenCalled_SendsAuthorizationHeaderOnGeneratedRequests() { + HttpRequestMessage? observedRequest = null; using var handler = new TestHttpMessageHandler((request, _) => { - return request.RequestUri!.AbsolutePath.EndsWith("/user/feed/products", StringComparison.OrdinalIgnoreCase) - ? TestHttpMessageHandler.JsonResponse("""{"products":[{"id":"prod-1","name":"Widget","price":29.99},{"id":"prod-2","name":"Gadget","price":49.99,"sale_price":39.99}]}""") - : TestHttpMessageHandler.JsonResponse("""{}"""); + observedRequest = request; + return TestHttpMessageHandler.JsonResponse("""{"stores":[],"count":0,"limit":10}"""); }); using var httpClient = new HttpClient(handler); using var client = new GoAffProClient(httpClient, new GoAffProClientOptions { BaseUrl = new Uri("https://example.test/v1/", UriKind.Absolute) }); + client.SetBearerToken("token-123"); - IReadOnlyList products = await client.GetProductsAsync(limit: 10, offset: 0); + _ = await client.Api.Public.Sites.GetAsync(); - _ = products.Count.Should().Be(2); - _ = products[0].Id.Should().Be("prod-1"); - _ = products[0].Name.Should().Be("Widget"); - _ = products[0].Price.Should().Be(29.99m); - _ = products[1].SalePrice.Should().Be(39.99m); + _ = observedRequest.Should().NotBeNull(); + _ = observedRequest!.Headers.Authorization.Should().NotBeNull(); + _ = observedRequest.Headers.Authorization!.Scheme.Should().Be("Bearer"); + _ = observedRequest.Headers.Authorization.Parameter.Should().Be("token-123"); } } diff --git a/tests/GoAffPro.Client.Tests/Snapshots/GeneratedClientSignatures.snapshot b/tests/GoAffPro.Client.Tests/Snapshots/GeneratedClientSignatures.snapshot index 132aac7..13e486d 100644 --- a/tests/GoAffPro.Client.Tests/Snapshots/GeneratedClientSignatures.snapshot +++ b/tests/GoAffPro.Client.Tests/Snapshots/GeneratedClientSignatures.snapshot @@ -1,33 +1,33 @@ [GoAffProUserClient] -public virtual System.Threading.Tasks.Task UserLoginAsync(Body body) -public virtual async System.Threading.Tasks.Task UserLoginAsync(Body body, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserSitesAsync(int? limit, int? offset, Status? status, System.Collections.Generic.IEnumerable fields) -public virtual async System.Threading.Tasks.Task UserSitesAsync(int? limit, int? offset, Status? status, System.Collections.Generic.IEnumerable fields, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserGetAsync() -public virtual async System.Threading.Tasks.Task UserGetAsync(System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserPostAsync() -public virtual async System.Threading.Tasks.Task UserPostAsync(System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserStatsAggregateAsync(string? site_ids, string? start_time, string? end_time, System.Collections.Generic.IEnumerable fields) -public virtual async System.Threading.Tasks.Task UserStatsAggregateAsync(string? site_ids, string? start_time, string? end_time, System.Collections.Generic.IEnumerable fields, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserFeedOrdersAsync(string? site_ids, string? since_id, string? max_id, string? created_at_max, string? created_at_min, System.Collections.Generic.IEnumerable fields, int? limit, int? offset) -public virtual async System.Threading.Tasks.Task UserFeedOrdersAsync(string? site_ids, string? since_id, string? max_id, string? created_at_max, string? created_at_min, System.Collections.Generic.IEnumerable fields, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserFeedPayoutsAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset) -public virtual async System.Threading.Tasks.Task UserFeedPayoutsAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserFeedProductsAsync(int? limit, int? offset) -public virtual async System.Threading.Tasks.Task UserFeedProductsAsync(int? limit, int? offset, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserFeedRewardsAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset) -public virtual async System.Threading.Tasks.Task UserFeedRewardsAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserFeedTrafficAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset) -public virtual async System.Threading.Tasks.Task UserFeedTrafficAsync(string? site_ids, string? start_time, string? end_time, int? since_id, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserFeedTransactionsAsync(int? limit, int? offset) -public virtual async System.Threading.Tasks.Task UserFeedTransactionsAsync(int? limit, int? offset, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserCommissionsAsync(string? site_ids) -public virtual async System.Threading.Tasks.Task UserCommissionsAsync(string? site_ids, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task UserPayoutsPendingAsync() -public virtual async System.Threading.Tasks.Task UserPayoutsPendingAsync(System.Threading.CancellationToken cancellationToken) +public async Task PostAsync(global::GoAffPro.Client.Generated.User.Login.LoginPostRequestBody body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task PostAsync(global::GoAffPro.Client.Generated.User.Login.LoginPostRequestBody body, Action> requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task PostAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task PostAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) [GoAffProPublicClient] -public virtual System.Threading.Tasks.Task PublicSitesAsync(string? site_ids, string? currency, string? keyword, int? limit, int? offset) -public virtual async System.Threading.Tasks.Task PublicSitesAsync(string? site_ids, string? currency, string? keyword, int? limit, int? offset, System.Threading.CancellationToken cancellationToken) -public virtual System.Threading.Tasks.Task PublicProductsAsync(int? limit, int? offset, string? site_ids) -public virtual async System.Threading.Tasks.Task PublicProductsAsync(int? limit, int? offset, string? site_ids, System.Threading.CancellationToken cancellationToken) +public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) +public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) From 88582192ddfc9c4ee714bab40016ce84d9e7a4c0 Mon Sep 17 00:00:00 2001 From: Agash Date: Wed, 25 Feb 2026 10:13:54 +0100 Subject: [PATCH 5/8] feat(example): add interactive and CLI endpoint sweep tooling --- .editorconfig | 7 + README.md | 61 +- .../GoAffPro.Client.Example/ExampleOptions.cs | 16 - .../GoAffPro.Client.Example.csproj | 3 +- examples/GoAffPro.Client.Example/Program.cs | 883 +++++++++++++++++- examples/GoAffPro.Client.Example/Worker.cs | 85 -- 6 files changed, 895 insertions(+), 160 deletions(-) delete mode 100644 examples/GoAffPro.Client.Example/ExampleOptions.cs delete mode 100644 examples/GoAffPro.Client.Example/Worker.cs diff --git a/.editorconfig b/.editorconfig index 1bf78ed..4f106fa 100644 --- a/.editorconfig +++ b/.editorconfig @@ -44,6 +44,13 @@ dotnet_naming_style.end_in_async.capitalization = pascal_case generated_code = true dotnet_analyzer_diagnostic.severity = none +[src/GoAffPro.Client.Generated/Generated/**/*.cs] +generated_code = true +dotnet_analyzer_diagnostic.severity = none +dotnet_diagnostic.CS1591.severity = none +dotnet_diagnostic.CA1707.severity = none +dotnet_diagnostic.CA1716.severity = none + [*.json] indent_size = 2 diff --git a/README.md b/README.md index ad15536..0683666 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # GoAffPro.Client -Async-first .NET client for the GoAffPro API with build-time NSwag generation and polling/event-based change detection. +Async-first .NET client for the GoAffPro API with build-time Kiota generation and polling/event-based change detection. ## Targets @@ -30,54 +30,34 @@ await using var loggedInClient = await GoAffProClient.CreateLoggedInAsync( password: "password123"); ``` -### Wrapper Methods (DX Layer) +### Wrapper Surface -The wrapper methods are built on top of generated clients: +`GoAffProClient` intentionally keeps a minimal wrapper surface: -```csharp -// Fetch orders with optional time filtering -var orders = await client.GetOrdersAsync(from: DateTimeOffset.UtcNow.AddDays(-1), limit: 50); - -// Fetch affiliates with time range -var affiliates = await client.GetAffiliatesAsync(from: startDate, toDate: endDate, limit: 50); - -// Fetch payouts and products -var payouts = await client.GetPayoutsAsync(limit: 50); -var products = await client.GetProductsAsync(limit: 50); -``` - -Wrapper methods return typed models: - -- `GoAffProOrder` (includes Subtotal, AffiliateId, Status) -- `GoAffProAffiliate` (includes FirstName, LastName, Phone, Country, GroupId) -- `GoAffProReward` (includes AffiliateId, Type, Metadata, Level, Status) - currently disabled -- `GoAffProPayout` -- `GoAffProProduct` - -Each model includes strongly typed fields and `RawPayload` (`JsonElement`) for advanced scenarios. - -`GetRewardsAsync` is currently disabled because `/user/feed/rewards` is returning `404` (observed on 2026-02-18). The method is marked `[Obsolete]` and returns an empty collection. +- auth helpers: `LoginAsync`, `SetBearerToken` +- generated client access: `User` and `PublicApi` +- polling detector: `GoAffProEventDetector` ### Access Generated Clients Directly ```csharp -var loginResponse = await client.User.UserLoginAsync(new GoAffPro.Client.Generated.User.Body +var loginResponse = await client.User.User.Login.PostAsync(new GoAffPro.Client.Generated.User.User.Login.LoginPostRequestBody { Email = "affiliate@example.com", Password = "password123", }); -var publicSites = await client.PublicApi.PublicSitesAsync( - site_ids: null, - currency: null, - keyword: null, - limit: 20, - offset: 0); +var publicSites = await client.PublicApi.Public.Sites.GetAsync(config => +{ + config.QueryParameters.Limit = 20; + config.QueryParameters.Offset = 0; +}); ``` ## Event Detection `GoAffProEventDetector` supports both async streams and classic `.NET` events. It uses time-based filtering to fetch only new items since the last poll. +Detected payloads are propagated as generated Kiota feed item types. ### Async Streams @@ -135,16 +115,15 @@ dotnet run --project examples/GoAffPro.Client.Example ## Build-Time Generation -On build, `GoAffPro.Client.Generator`: +On build, `GoAffPro.Client.Generated`: -1. Loads local canonical spec `openapi/goaffpro-canonical.json` by default - (or uses a configured `GoAffProSwaggerInitPath`; supports both full OpenAPI `.json` and `swagger-ui-init.js`) -2. If `swagger-ui-init.js` is used, extracts embedded OpenAPI JSON and applies legacy normalization -3. Generates: - - `src/GoAffPro.Client/Generated/GoAffProUserClient.g.cs` - - `src/GoAffPro.Client/Generated/GoAffProPublicClient.g.cs` +1. Loads the local canonical spec `openapi/goaffpro-canonical.yaml` +2. Runs Kiota generation for `/user/*` and `/public/*` +3. Writes generated files under: + - `src/GoAffPro.Client.Generated/Generated/User` + - `src/GoAffPro.Client.Generated/Generated/Public` -Do not edit `*.g.cs` manually. +Generated output is implementation detail for the wrapper package. Do not manually edit files under `Generated/`. ## Testing diff --git a/examples/GoAffPro.Client.Example/ExampleOptions.cs b/examples/GoAffPro.Client.Example/ExampleOptions.cs deleted file mode 100644 index 7389a8a..0000000 --- a/examples/GoAffPro.Client.Example/ExampleOptions.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace GoAffPro.Client.Example; - -[System.Diagnostics.CodeAnalysis.SuppressMessage( - "Performance", - "CA1812:Avoid uninstantiated internal classes", - Justification = "Instantiated via options binding.")] -internal sealed class ExampleOptions -{ - public string? Email { get; set; } - - public string? Password { get; set; } - - public int PollingIntervalSeconds { get; set; } = 30; - - public int PageSize { get; set; } = 50; -} diff --git a/examples/GoAffPro.Client.Example/GoAffPro.Client.Example.csproj b/examples/GoAffPro.Client.Example/GoAffPro.Client.Example.csproj index 495a47d..fb9a828 100644 --- a/examples/GoAffPro.Client.Example/GoAffPro.Client.Example.csproj +++ b/examples/GoAffPro.Client.Example/GoAffPro.Client.Example.csproj @@ -19,8 +19,7 @@ - - + diff --git a/examples/GoAffPro.Client.Example/Program.cs b/examples/GoAffPro.Client.Example/Program.cs index 1441324..ac5499d 100644 --- a/examples/GoAffPro.Client.Example/Program.cs +++ b/examples/GoAffPro.Client.Example/Program.cs @@ -1,22 +1,873 @@ +using System.Diagnostics; +using System.Globalization; +using System.Text.Json; using GoAffPro.Client; -using GoAffPro.Client.Example; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; +using GoAffPro.Client.Exceptions; +using Microsoft.Kiota.Abstractions; +using Spectre.Console; +using AggregateField = GoAffPro.Client.Generated.User.Stats.Aggregate.GetFieldsQueryParameterType; +using SiteField = GoAffPro.Client.Generated.User.Sites.GetFieldsQueryParameterType; +using SiteStatus = GoAffPro.Client.Generated.User.Sites.GetStatusQueryParameterType; -HostApplicationBuilder builder = Host.CreateApplicationBuilder(args); +ExampleSettings settings = LoadSettings(); +var options = CommandLineOptions.Parse(args); -builder.Configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true); +using var client = new GoAffProClient(new GoAffProClientOptions +{ + BaseUrl = settings.BaseUrl, + BearerToken = settings.BearerToken, + Timeout = settings.Timeout, +}); -builder.Logging.ClearProviders(); -builder.Logging.AddConfiguration(builder.Configuration.GetSection("Logging")); -builder.Logging.AddConsole(); +if (options.RunTests) +{ + int code = await RunCliSweepAsync(client, settings, options).ConfigureAwait(false); + Environment.ExitCode = code; + return; +} -builder.Services.Configure(builder.Configuration.GetSection("GoAffPro")); -builder.Services.Configure(builder.Configuration.GetSection("Example")); -builder.Services.AddGoAffProClient(); -builder.Services.AddHostedService(); +await RunInteractiveAsync(client).ConfigureAwait(false); -using IHost host = builder.Build(); -await host.RunAsync().ConfigureAwait(false); +static async Task RunCliSweepAsync(GoAffProClient client, ExampleSettings settings, CommandLineOptions options) +{ + string? token = ResolveToken(options.AccessToken) ?? client.BearerToken; + if (string.IsNullOrWhiteSpace(token) && + !string.IsNullOrWhiteSpace(options.Email) && + !string.IsNullOrWhiteSpace(options.Password)) + { + token = await client.LoginAsync(options.Email, options.Password, CancellationToken.None).ConfigureAwait(false); + } + + if (string.IsNullOrWhiteSpace(token)) + { + await Console.Error.WriteLineAsync("No access token is available. Use --access_token=... or --email/--password.").ConfigureAwait(false); + return 2; + } + + client.SetBearerToken(token); + string outputPath = string.IsNullOrWhiteSpace(options.OutputPath) + ? Path.Combine(Environment.CurrentDirectory, $"api-sweep-{DateTimeOffset.UtcNow:yyyyMMdd-HHmmss}.json") + : options.OutputPath; + + TimeSpan productTimeout = options.ProductsTimeoutSeconds > 0 + ? TimeSpan.FromSeconds(options.ProductsTimeoutSeconds) + : TimeSpan.FromSeconds(90); + + ApiSweepReport report = await ApiSweepRunner.RunAllAsync(client, settings, productTimeout, CancellationToken.None).ConfigureAwait(false); + string reportJson = JsonSerializer.Serialize(report, JsonOptions.Value); + await File.WriteAllTextAsync(outputPath, reportJson, CancellationToken.None).ConfigureAwait(false); + + int failures = report.Results.Count(static x => !x.Success); + await Console.Out.WriteLineAsync($"Sweep completed. Total: {report.Results.Count}, failed: {failures}").ConfigureAwait(false); + await Console.Out.WriteLineAsync($"Report: {outputPath}").ConfigureAwait(false); + return failures == 0 ? 0 : 1; +} + +static async Task RunInteractiveAsync(GoAffProClient client) +{ + var observer = new ObserverController(client); + try + { + AnsiConsole.MarkupLine("[bold green]GoAffPro Interactive Playground[/]"); + if (!string.IsNullOrWhiteSpace(client.BearerToken)) + { + AnsiConsole.MarkupLine("[green]Bearer token loaded from appsettings.[/]"); + } + + bool exitRequested = false; + while (!exitRequested) + { + AnsiConsole.WriteLine(); + AnsiConsole.MarkupLine($"Auth: {(string.IsNullOrWhiteSpace(client.BearerToken) ? "[yellow]not authenticated[/]" : "[green]authenticated[/]")}"); + AnsiConsole.MarkupLine($"Observer: {(observer.IsRunning ? "[green]running[/]" : "[grey]stopped[/]")}"); + + string action = AnsiConsole.Prompt( + new SelectionPrompt() + .Title("Select an action") + .AddChoices( + [ + "Set bearer token", + "Login with email/password", + "Call endpoint", + "Run full endpoint sweep", + "Start observer", + "Stop observer", + "Exit" + ])); + + try + { + switch (action) + { + case "Set bearer token": + SetBearerToken(client); + break; + case "Login with email/password": + await LoginAsync(client).ConfigureAwait(false); + break; + case "Call endpoint": + await CallEndpointAsync(client).ConfigureAwait(false); + break; + case "Run full endpoint sweep": + await RunSweepFromInteractiveAsync(client).ConfigureAwait(false); + break; + case "Start observer": + await observer.StartAsync().ConfigureAwait(false); + break; + case "Stop observer": + await observer.StopAsync().ConfigureAwait(false); + break; + case "Exit": + exitRequested = true; + break; + } + } + catch (GoAffProApiException ex) + { + AnsiConsole.MarkupLine($"[red]API error:[/] {Markup.Escape(ex.Message)}"); + } + catch (ApiException ex) + { + AnsiConsole.MarkupLine($"[red]Request failed:[/] {Markup.Escape(ex.Message)}"); + } + catch (HttpRequestException ex) + { + AnsiConsole.MarkupLine($"[red]HTTP error:[/] {Markup.Escape(ex.Message)}"); + } + catch (TaskCanceledException ex) + { + AnsiConsole.MarkupLine($"[red]Timeout/cancelled:[/] {Markup.Escape(ex.Message)}"); + } + catch (InvalidOperationException ex) + { + AnsiConsole.MarkupLine($"[red]Invalid operation:[/] {Markup.Escape(ex.Message)}"); + } + } + } + finally + { + await observer.DisposeAsync().ConfigureAwait(false); + } +} + +static async Task RunSweepFromInteractiveAsync(GoAffProClient client) +{ + if (string.IsNullOrWhiteSpace(client.BearerToken)) + { + AnsiConsole.MarkupLine("[yellow]Set a bearer token or login first.[/]"); + return; + } + + string defaultPath = Path.Combine(Environment.CurrentDirectory, $"api-sweep-{DateTimeOffset.UtcNow:yyyyMMdd-HHmmss}.json"); + string outputPath = AnsiConsole.Prompt(new TextPrompt("Output path").DefaultValue(defaultPath)); + + int timeoutSeconds = AnsiConsole.Prompt(new TextPrompt("Product endpoint timeout (seconds)").DefaultValue(90)); + var productTimeout = TimeSpan.FromSeconds(Math.Max(1, timeoutSeconds)); + + ApiSweepReport report = await ApiSweepRunner.RunAllAsync( + client, + ExampleSettings.Default, + productTimeout, + CancellationToken.None).ConfigureAwait(false); + string reportJson = JsonSerializer.Serialize(report, JsonOptions.Value); + await File.WriteAllTextAsync(outputPath, reportJson, CancellationToken.None).ConfigureAwait(false); + + int failures = report.Results.Count(static x => !x.Success); + AnsiConsole.MarkupLine($"[green]Sweep complete.[/] total={report.Results.Count}, failed={failures}"); + AnsiConsole.MarkupLine($"Saved: [grey]{Markup.Escape(outputPath)}[/]"); +} + +static void SetBearerToken(GoAffProClient client) +{ + string token = AnsiConsole.Prompt(new TextPrompt("Bearer token").Secret()); + client.SetBearerToken(token); + AnsiConsole.MarkupLine("[green]Bearer token updated.[/]"); +} + +static async Task LoginAsync(GoAffProClient client) +{ + string email = AnsiConsole.Ask("Email"); + string password = AnsiConsole.Prompt(new TextPrompt("Password").Secret()); + + string token = await client.LoginAsync(email, password).ConfigureAwait(false); + AnsiConsole.MarkupLine($"[green]Login successful.[/] Token: [grey]{Markup.Escape(ShortToken(token))}[/]"); +} + +static async Task CallEndpointAsync(GoAffProClient client) +{ + string endpoint = AnsiConsole.Prompt( + new SelectionPrompt() + .Title("Select endpoint") + .AddChoices( + [ + "GET /user", + "POST /user", + "GET /user/sites", + "GET /user/stats/aggregate", + "GET /user/feed/orders", + "GET /user/feed/traffic", + "GET /user/feed/payouts", + "GET /user/feed/products", + "GET /user/feed/rewards", + "GET /user/feed/transactions", + "GET /user/commissions", + "GET /user/payouts/pending", + "GET /public/sites", + "GET /public/products", + "Back" + ])); + + if (endpoint == "Back") + { + return; + } + + int limit = AskInt("Limit", 10); + int offset = AskInt("Offset", 0); + string? siteIds = AskOptional("site_ids (optional)"); + string startTime = DateTimeOffset.UtcNow.AddDays(-1).ToString("o", CultureInfo.InvariantCulture); + string endTime = DateTimeOffset.UtcNow.ToString("o", CultureInfo.InvariantCulture); + + object? result = endpoint switch + { + "GET /user" => await client.Api.User.GetAsync().ConfigureAwait(false), + "POST /user" => await client.Api.User.PostAsync().ConfigureAwait(false), + "GET /user/sites" => await client.Api.User.Sites.GetAsync(config => + { + config.QueryParameters.Limit = limit; + config.QueryParameters.Offset = offset; + config.QueryParameters.StatusAsGetStatusQueryParameterType = AskSiteStatus(); + config.QueryParameters.FieldsAsGetFieldsQueryParameterType = [SiteField.Id, SiteField.Name, SiteField.Logo]; + }).ConfigureAwait(false), + "GET /user/stats/aggregate" => await client.Api.User.Stats.Aggregate.GetAsync(config => + { + config.QueryParameters.SiteIds = siteIds; + config.QueryParameters.StartTime = AskOptional("start_time (ISO8601, optional)") ?? startTime; + config.QueryParameters.EndTime = AskOptional("end_time (ISO8601, optional)") ?? endTime; + config.QueryParameters.FieldsAsGetFieldsQueryParameterType = + [ + AggregateField.Total_sales, + AggregateField.Other_commission_earned, + AggregateField.Revenue_generated, + AggregateField.Sale_commission_earned, + AggregateField.Commission_paid, + ]; + }).ConfigureAwait(false), + "GET /user/feed/orders" => await client.Api.User.Feed.Orders.GetAsync(config => + { + config.QueryParameters.Limit = limit; + config.QueryParameters.Offset = offset; + config.QueryParameters.SiteIds = siteIds; + config.QueryParameters.CreatedAtMin = AskOptional("created_at_min (ISO8601, optional)") ?? startTime; + config.QueryParameters.CreatedAtMax = AskOptional("created_at_max (ISO8601, optional)") ?? endTime; + }).ConfigureAwait(false), + "GET /user/feed/traffic" => await client.Api.User.Feed.Traffic.GetAsync(config => + { + config.QueryParameters.Limit = limit; + config.QueryParameters.Offset = offset; + config.QueryParameters.SiteIds = siteIds; + config.QueryParameters.StartTime = AskOptional("start_time (ISO8601, optional)") ?? startTime; + config.QueryParameters.EndTime = AskOptional("end_time (ISO8601, optional)") ?? endTime; + }).ConfigureAwait(false), + "GET /user/feed/payouts" => await client.Api.User.Feed.Payouts.GetAsync(config => + { + config.QueryParameters.Limit = limit; + config.QueryParameters.Offset = offset; + config.QueryParameters.SiteIds = siteIds; + config.QueryParameters.StartTime = AskOptional("start_time (ISO8601, optional)") ?? startTime; + config.QueryParameters.EndTime = AskOptional("end_time (ISO8601, optional)") ?? endTime; + }).ConfigureAwait(false), + "GET /user/feed/products" => await client.Api.User.Feed.Products.GetAsync(config => + { + config.QueryParameters.Limit = limit; + config.QueryParameters.Offset = offset; + }).ConfigureAwait(false), + "GET /user/feed/rewards" => await client.Api.User.Feed.Rewards.GetAsync(config => + { + config.QueryParameters.Limit = limit; + config.QueryParameters.Offset = offset; + config.QueryParameters.SiteIds = siteIds; + config.QueryParameters.StartTime = AskOptional("start_time (ISO8601, optional)") ?? startTime; + config.QueryParameters.EndTime = AskOptional("end_time (ISO8601, optional)") ?? endTime; + }).ConfigureAwait(false), + "GET /user/feed/transactions" => await client.Api.User.Feed.Transactions.GetAsync(config => + { + config.QueryParameters.Limit = limit; + config.QueryParameters.Offset = offset; + }).ConfigureAwait(false), + "GET /user/commissions" => await client.Api.User.Commissions.GetAsync(config => + { + config.QueryParameters.SiteIds = siteIds; + }).ConfigureAwait(false), + "GET /user/payouts/pending" => await client.Api.User.Payouts.Pending.GetAsync().ConfigureAwait(false), + "GET /public/sites" => await client.Api.Public.Sites.GetAsync(config => + { + config.QueryParameters.Limit = limit; + config.QueryParameters.Offset = offset; + config.QueryParameters.SiteIds = siteIds; + config.QueryParameters.Currency = AskOptional("currency (optional)"); + config.QueryParameters.Keyword = AskOptional("keyword (optional)"); + }).ConfigureAwait(false), + "GET /public/products" => await client.Api.Public.Products.GetAsync(config => + { + config.QueryParameters.Limit = limit; + config.QueryParameters.Offset = offset; + config.QueryParameters.SiteIds = siteIds; + }).ConfigureAwait(false), + _ => null, + }; + + RenderJson(endpoint, result); +} + +static SiteStatus? AskSiteStatus() +{ + string status = AnsiConsole.Prompt( + new SelectionPrompt() + .Title("status") + .AddChoices(["(none)", "approved", "pending", "blocked"])); + + return status switch + { + "approved" => SiteStatus.Approved, + "pending" => SiteStatus.Pending, + "blocked" => SiteStatus.Blocked, + _ => null, + }; +} + +static int AskInt(string label, int defaultValue) +{ + return AnsiConsole.Prompt(new TextPrompt(label).DefaultValue(defaultValue)); +} + +static string? AskOptional(string label) +{ + string value = AnsiConsole.Prompt(new TextPrompt(label).AllowEmpty()); + return string.IsNullOrWhiteSpace(value) ? null : value; +} + +static void RenderJson(string title, object? value) +{ + string json = Serialize(value); + + var panel = new Panel(new Markup(Markup.Escape(json))) + { + Header = new PanelHeader(title), + Expand = true, + }; + + AnsiConsole.Write(panel); +} + +static string Serialize(object? value) +{ + if (value is null) + { + return "null"; + } + + try + { + return JsonSerializer.Serialize(value, JsonOptions.Value); + } + catch (JsonException) + { + return value.ToString() ?? ""; + } + catch (NotSupportedException) + { + return value.ToString() ?? ""; + } +} + +static string ShortToken(string token) +{ + return token.Length <= 10 ? token : $"{token[..6]}...{token[^4..]}"; +} + +static string? ResolveToken(string? value) +{ + if (string.IsNullOrWhiteSpace(value)) + { + return null; + } + + const string envPrefix = "env:"; + if (value.StartsWith(envPrefix, StringComparison.OrdinalIgnoreCase)) + { + string envName = value[envPrefix.Length..]; + return Environment.GetEnvironmentVariable(envName); + } + + return value; +} + +static ExampleSettings LoadSettings() +{ + string path = Path.Combine(AppContext.BaseDirectory, "appsettings.json"); + if (!File.Exists(path)) + { + return ExampleSettings.Default; + } + + try + { + string json = File.ReadAllText(path); + using var document = JsonDocument.Parse(json); + + if (!document.RootElement.TryGetProperty("GoAffPro", out JsonElement goAffPro)) + { + return ExampleSettings.Default; + } + + string baseUrlText = goAffPro.TryGetProperty("BaseUrl", out JsonElement baseUrlElement) + ? baseUrlElement.GetString() ?? ExampleSettings.Default.BaseUrl.ToString() + : ExampleSettings.Default.BaseUrl.ToString(); + + string? bearerToken = goAffPro.TryGetProperty("BearerToken", out JsonElement tokenElement) + ? tokenElement.GetString() + : null; + + string timeoutText = goAffPro.TryGetProperty("Timeout", out JsonElement timeoutElement) + ? timeoutElement.GetString() ?? "00:00:30" + : "00:00:30"; + + Uri baseUrl = Uri.TryCreate(baseUrlText, UriKind.Absolute, out Uri? parsedBaseUrl) + ? parsedBaseUrl + : ExampleSettings.Default.BaseUrl; + + TimeSpan timeout = TimeSpan.TryParse(timeoutText, out TimeSpan parsedTimeout) + ? parsedTimeout + : ExampleSettings.Default.Timeout; + + return new ExampleSettings(baseUrl, bearerToken, timeout); + } + catch (IOException) + { + return ExampleSettings.Default; + } + catch (JsonException) + { + return ExampleSettings.Default; + } +} + +internal sealed class ObserverController(IGoAffProClient client) : IAsyncDisposable +{ + private readonly Lock _consoleLock = new(); + private CancellationTokenSource? _cts; + private Task? _task; + + public bool IsRunning => _task is { IsCompleted: false }; + + public Task StartAsync() + { + if (IsRunning) + { + AnsiConsole.MarkupLine("[yellow]Observer already running.[/]"); + return Task.CompletedTask; + } + + int pollingSeconds = AnsiConsole.Prompt(new TextPrompt("Polling interval (seconds)").DefaultValue(30)); + int pageSize = AnsiConsole.Prompt(new TextPrompt("Page size").DefaultValue(50)); + + client.OrderDetected += (_, args) => + WriteLiveEvent("order", args.Order.Id?.String ?? args.Order.OrderId?.String ?? ""); + client.AffiliateDetected += (_, args) => + WriteLiveEvent("affiliate", args.Affiliate.AffiliateId?.String ?? args.Affiliate.Id?.String ?? args.Affiliate.CustomerId?.String ?? ""); + client.PayoutDetected += (_, args) => + WriteLiveEvent("payout", args.Payout.Id?.String ?? args.Payout.PayoutId?.String ?? ""); + client.ProductDetected += (_, args) => + WriteLiveEvent("product", args.Product.ProductId?.String ?? args.Product.Id?.String ?? ""); + client.TransactionDetected += (_, args) => + WriteLiveEvent("transaction", args.Transaction.TxId?.ToString(CultureInfo.InvariantCulture) ?? args.Transaction.Id ?? ""); + + _cts = new CancellationTokenSource(); + _task = Task.Run(async () => + { + try + { + await client.StartEventObserverAsync( + pollingInterval: TimeSpan.FromSeconds(Math.Max(1, pollingSeconds)), + pageSize: Math.Max(1, pageSize), + cancellationToken: _cts.Token).ConfigureAwait(false); + } + catch (OperationCanceledException) + { + // Expected when stop is requested. + } + catch (GoAffProApiException ex) + { + WriteObserverError(ex.Message); + } + catch (ApiException ex) + { + WriteObserverError(ex.Message); + } + catch (HttpRequestException ex) + { + WriteObserverError(ex.Message); + } + catch (InvalidOperationException ex) + { + WriteObserverError(ex.Message); + } + }); + + AnsiConsole.MarkupLine("[green]Observer started.[/]"); + return Task.CompletedTask; + } + + public async Task StopAsync() + { + if (_cts is null) + { + return; + } + + await _cts.CancelAsync().ConfigureAwait(false); + + if (_task is not null) + { + await _task.ConfigureAwait(false); + } + + _cts.Dispose(); + _cts = null; + _task = null; + + AnsiConsole.MarkupLine("[grey]Observer stopped.[/]"); + } + + public async ValueTask DisposeAsync() + { + await StopAsync().ConfigureAwait(false); + } + + private void WriteLiveEvent(string type, string id) + { + lock (_consoleLock) + { + string timestamp = DateTimeOffset.UtcNow.ToString("O", CultureInfo.InvariantCulture); + AnsiConsole.MarkupLine($"[blue]{Markup.Escape(timestamp)}[/] [green]{Markup.Escape(type)}[/] -> {Markup.Escape(id)}"); + } + } + + private void WriteObserverError(string message) + { + lock (_consoleLock) + { + AnsiConsole.MarkupLine($"[red]Observer failed:[/] {Markup.Escape(message)}"); + } + } +} + +internal static class ApiSweepRunner +{ + public static async Task RunAllAsync( + GoAffProClient client, + ExampleSettings settings, + TimeSpan productTimeout, + CancellationToken cancellationToken) + { + string startTime = DateTimeOffset.UtcNow.AddDays(-1).ToString("o", CultureInfo.InvariantCulture); + string endTime = DateTimeOffset.UtcNow.ToString("o", CultureInfo.InvariantCulture); + var results = new List(); + + await RunEndpointAsync(results, "GET /user", () => client.Api.User.GetAsync(cancellationToken: cancellationToken)).ConfigureAwait(false); + await RunEndpointAsync(results, "POST /user", () => client.Api.User.PostAsync(cancellationToken: cancellationToken)).ConfigureAwait(false); + await RunEndpointAsync(results, "GET /user/sites", () => client.Api.User.Sites.GetAsync(config => + { + config.QueryParameters.Limit = 1; + config.QueryParameters.Offset = 0; + config.QueryParameters.StatusAsGetStatusQueryParameterType = SiteStatus.Approved; + config.QueryParameters.FieldsAsGetFieldsQueryParameterType = [SiteField.Id, SiteField.Name, SiteField.Logo]; + }, cancellationToken)).ConfigureAwait(false); + await RunEndpointAsync(results, "GET /user/stats/aggregate", () => client.Api.User.Stats.Aggregate.GetAsync(config => + { + config.QueryParameters.StartTime = startTime; + config.QueryParameters.EndTime = endTime; + config.QueryParameters.FieldsAsGetFieldsQueryParameterType = + [ + AggregateField.Total_sales, + AggregateField.Other_commission_earned, + AggregateField.Revenue_generated, + AggregateField.Sale_commission_earned, + AggregateField.Commission_paid, + ]; + }, cancellationToken)).ConfigureAwait(false); + await RunEndpointAsync(results, "GET /user/feed/orders", () => client.Api.User.Feed.Orders.GetAsync(config => + { + config.QueryParameters.Limit = 1; + config.QueryParameters.Offset = 0; + config.QueryParameters.CreatedAtMin = startTime; + config.QueryParameters.CreatedAtMax = endTime; + }, cancellationToken)).ConfigureAwait(false); + await RunEndpointAsync(results, "GET /user/feed/traffic", () => client.Api.User.Feed.Traffic.GetAsync(config => + { + config.QueryParameters.Limit = 1; + config.QueryParameters.Offset = 0; + config.QueryParameters.StartTime = startTime; + config.QueryParameters.EndTime = endTime; + }, cancellationToken)).ConfigureAwait(false); + await RunEndpointAsync(results, "GET /user/feed/payouts", () => client.Api.User.Feed.Payouts.GetAsync(config => + { + config.QueryParameters.Limit = 1; + config.QueryParameters.Offset = 0; + config.QueryParameters.StartTime = startTime; + config.QueryParameters.EndTime = endTime; + }, cancellationToken)).ConfigureAwait(false); + await RunEndpointAsync( + results, + "GET /user/feed/products", + () => ExecuteProductsCallAsync(client, settings, productTimeout, cancellationToken)).ConfigureAwait(false); + await RunEndpointAsync(results, "GET /user/feed/rewards", () => client.Api.User.Feed.Rewards.GetAsync(config => + { + config.QueryParameters.Limit = 1; + config.QueryParameters.Offset = 0; + config.QueryParameters.StartTime = startTime; + config.QueryParameters.EndTime = endTime; + }, cancellationToken)).ConfigureAwait(false); + await RunEndpointAsync(results, "GET /user/feed/transactions", () => client.Api.User.Feed.Transactions.GetAsync(config => + { + config.QueryParameters.Limit = 1; + config.QueryParameters.Offset = 0; + }, cancellationToken)).ConfigureAwait(false); + await RunEndpointAsync(results, "GET /user/commissions", () => client.Api.User.Commissions.GetAsync(cancellationToken: cancellationToken)).ConfigureAwait(false); + await RunEndpointAsync(results, "GET /user/payouts/pending", () => client.Api.User.Payouts.Pending.GetAsync(cancellationToken: cancellationToken)).ConfigureAwait(false); + await RunEndpointAsync(results, "GET /public/sites", () => client.Api.Public.Sites.GetAsync(config => + { + config.QueryParameters.Limit = 1; + config.QueryParameters.Offset = 0; + }, cancellationToken)).ConfigureAwait(false); + await RunEndpointAsync(results, "GET /public/products", () => client.Api.Public.Products.GetAsync(config => + { + config.QueryParameters.Limit = 1; + config.QueryParameters.Offset = 0; + }, cancellationToken)).ConfigureAwait(false); + + return new ApiSweepReport( + TimestampUtc: DateTimeOffset.UtcNow, + BaseUrl: settings.BaseUrl.ToString(), + Total: results.Count, + Failed: results.Count(static r => !r.Success), + Results: results); + } + + private static async Task RunEndpointAsync( + List sink, + string endpoint, + Func> call) + { + var sw = Stopwatch.StartNew(); + try + { + TResponse? result = await call().ConfigureAwait(false); + sw.Stop(); + sink.Add(new ApiEndpointResult( + Endpoint: endpoint, + Success: true, + DurationMs: sw.ElapsedMilliseconds, + StatusCode: null, + ErrorType: null, + ErrorMessage: null, + ResponseJson: SerializeResponse(result))); + } + catch (ApiException ex) + { + sw.Stop(); + sink.Add(new ApiEndpointResult( + Endpoint: endpoint, + Success: false, + DurationMs: sw.ElapsedMilliseconds, + StatusCode: ex.ResponseStatusCode, + ErrorType: ex.GetType().FullName, + ErrorMessage: ex.Message, + ResponseJson: null)); + } + catch (HttpRequestException ex) + { + sw.Stop(); + sink.Add(new ApiEndpointResult( + Endpoint: endpoint, + Success: false, + DurationMs: sw.ElapsedMilliseconds, + StatusCode: null, + ErrorType: ex.GetType().FullName, + ErrorMessage: ex.Message, + ResponseJson: null)); + } + catch (TaskCanceledException ex) + { + sw.Stop(); + sink.Add(new ApiEndpointResult( + Endpoint: endpoint, + Success: false, + DurationMs: sw.ElapsedMilliseconds, + StatusCode: null, + ErrorType: ex.GetType().FullName, + ErrorMessage: ex.Message, + ResponseJson: null)); + } + catch (InvalidOperationException ex) + { + sw.Stop(); + sink.Add(new ApiEndpointResult( + Endpoint: endpoint, + Success: false, + DurationMs: sw.ElapsedMilliseconds, + StatusCode: null, + ErrorType: ex.GetType().FullName, + ErrorMessage: ex.Message, + ResponseJson: null)); + } + catch (GoAffProApiException ex) + { + sw.Stop(); + sink.Add(new ApiEndpointResult( + Endpoint: endpoint, + Success: false, + DurationMs: sw.ElapsedMilliseconds, + StatusCode: (int)ex.StatusCode, + ErrorType: ex.GetType().FullName, + ErrorMessage: ex.Message, + ResponseJson: null)); + } + } + + private static string SerializeResponse(TResponse? value) + { + if (value is null) + { + return "null"; + } + + try + { + return JsonSerializer.Serialize(value, JsonOptions.Value); + } + catch (JsonException) + { + return value.ToString() ?? ""; + } + catch (NotSupportedException) + { + return value.ToString() ?? ""; + } + } + + private static async Task ExecuteProductsCallAsync( + GoAffProClient client, + ExampleSettings settings, + TimeSpan productTimeout, + CancellationToken cancellationToken) + { + if (productTimeout <= TimeSpan.Zero || productTimeout == settings.Timeout) + { + return await client.Api.User.Feed.Products.GetAsync(config => + { + config.QueryParameters.Limit = 1; + config.QueryParameters.Offset = 0; + }, cancellationToken).ConfigureAwait(false); + } + + using var timeoutClient = new GoAffProClient(new GoAffProClientOptions + { + BaseUrl = settings.BaseUrl, + BearerToken = client.BearerToken, + Timeout = productTimeout + }); + + return await timeoutClient.Api.User.Feed.Products.GetAsync(config => + { + config.QueryParameters.Limit = 1; + config.QueryParameters.Offset = 0; + }, cancellationToken).ConfigureAwait(false); + } +} + +internal sealed record CommandLineOptions +{ + public bool RunTests { get; init; } + public string? AccessToken { get; init; } + public string? OutputPath { get; init; } + public string? Email { get; init; } + public string? Password { get; init; } + public int ProductsTimeoutSeconds { get; init; } + + public static CommandLineOptions Parse(string[] args) + { + var options = new CommandLineOptions(); + foreach (string arg in args) + { + if (arg.Equals("--run-tests", StringComparison.OrdinalIgnoreCase)) + { + options = options with { RunTests = true }; + continue; + } + + if (arg.StartsWith("--access_token=", StringComparison.OrdinalIgnoreCase)) + { + options = options with { AccessToken = arg["--access_token=".Length..] }; + continue; + } + + if (arg.StartsWith("--output=", StringComparison.OrdinalIgnoreCase)) + { + options = options with { OutputPath = arg["--output=".Length..] }; + continue; + } + + if (arg.StartsWith("--email=", StringComparison.OrdinalIgnoreCase)) + { + options = options with { Email = arg["--email=".Length..] }; + continue; + } + + if (arg.StartsWith("--password=", StringComparison.OrdinalIgnoreCase)) + { + options = options with { Password = arg["--password=".Length..] }; + continue; + } + + if (arg.StartsWith("--products-timeout-seconds=", StringComparison.OrdinalIgnoreCase) && + int.TryParse(arg["--products-timeout-seconds=".Length..], NumberStyles.Integer, CultureInfo.InvariantCulture, out int timeoutSeconds)) + { + options = options with { ProductsTimeoutSeconds = timeoutSeconds }; + } + } + + return options; + } +} + +internal sealed record ExampleSettings(Uri BaseUrl, string? BearerToken, TimeSpan Timeout) +{ + public static ExampleSettings Default { get; } = + new(new Uri("https://api.goaffpro.com/v1/", UriKind.Absolute), null, TimeSpan.FromSeconds(30)); +} + +internal sealed record ApiSweepReport( + DateTimeOffset TimestampUtc, + string BaseUrl, + int Total, + int Failed, + IReadOnlyList Results); + +internal sealed record ApiEndpointResult( + string Endpoint, + bool Success, + long DurationMs, + int? StatusCode, + string? ErrorType, + string? ErrorMessage, + string? ResponseJson); + +file static class JsonOptions +{ + public static JsonSerializerOptions Value { get; } = new() + { + WriteIndented = true, + }; +} diff --git a/examples/GoAffPro.Client.Example/Worker.cs b/examples/GoAffPro.Client.Example/Worker.cs deleted file mode 100644 index fff449b..0000000 --- a/examples/GoAffPro.Client.Example/Worker.cs +++ /dev/null @@ -1,85 +0,0 @@ -using GoAffPro.Client.Events; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; - -namespace GoAffPro.Client.Example; - -[System.Diagnostics.CodeAnalysis.SuppressMessage( - "Performance", - "CA1812:Avoid uninstantiated internal classes", - Justification = "Instantiated by host via AddHostedService().")] -internal sealed partial class Worker( - ILogger logger, - IGoAffProClient client, - IOptions exampleOptions, - IHostApplicationLifetime lifetime) : BackgroundService -{ - private readonly ExampleOptions _options = exampleOptions.Value; - - protected override async Task ExecuteAsync(CancellationToken stoppingToken) - { - try - { - if (string.IsNullOrWhiteSpace(client.BearerToken)) - { - if (string.IsNullOrWhiteSpace(_options.Email) || string.IsNullOrWhiteSpace(_options.Password)) - { - LogMissingCredentials(logger); - lifetime.StopApplication(); - return; - } - - _ = await client.LoginAsync(_options.Email, _options.Password, stoppingToken).ConfigureAwait(false); - LogAuthenticated(logger); - } - - IReadOnlyList orders = await client - .GetOrdersAsync(limit: _options.PageSize, offset: 0, cancellationToken: stoppingToken) - .ConfigureAwait(false); - - LogFetchedOrders(logger, orders.Count); - - var detector = new GoAffProEventDetector( - client, - pollingInterval: TimeSpan.FromSeconds(Math.Max(1, _options.PollingIntervalSeconds)), - pageSize: Math.Max(1, _options.PageSize)); - - detector.OrderDetected += (_, args) => - LogOrderDetected(logger, args.Order.Id); - detector.AffiliateDetected += (_, args) => - LogAffiliateDetected(logger, args.Affiliate.Id); - - LogStartingDetector(logger); - await detector.StartAsync(stoppingToken).ConfigureAwait(false); - } - catch (OperationCanceledException) when (stoppingToken.IsCancellationRequested) - { - LogStopping(logger); - } - } - - [LoggerMessage( - EventId = 1, - Level = LogLevel.Warning, - Message = "No bearer token is configured. Set GoAffPro:BearerToken or Example:Email/Example:Password in appsettings.json.")] - private static partial void LogMissingCredentials(ILogger logger); - - [LoggerMessage(EventId = 2, Level = LogLevel.Information, Message = "Authenticated with login flow.")] - private static partial void LogAuthenticated(ILogger logger); - - [LoggerMessage(EventId = 3, Level = LogLevel.Information, Message = "Fetched {Count} order(s) from GoAffPro feed.")] - private static partial void LogFetchedOrders(ILogger logger, int count); - - [LoggerMessage(EventId = 4, Level = LogLevel.Information, Message = "Order detected: {Id}")] - private static partial void LogOrderDetected(ILogger logger, string id); - - [LoggerMessage(EventId = 5, Level = LogLevel.Information, Message = "Affiliate detected: {Id}")] - private static partial void LogAffiliateDetected(ILogger logger, string id); - - [LoggerMessage(EventId = 7, Level = LogLevel.Information, Message = "Starting detector loop. Press Ctrl+C to stop.")] - private static partial void LogStartingDetector(ILogger logger); - - [LoggerMessage(EventId = 8, Level = LogLevel.Information, Message = "Example is stopping.")] - private static partial void LogStopping(ILogger logger); -} From 5f660d3f12117406ca0eacd39ad28a0df2b4cf41 Mon Sep 17 00:00:00 2001 From: Agash Date: Wed, 25 Feb 2026 10:14:14 +0100 Subject: [PATCH 6/8] test(tests): retarget to net9/net10 and add local integration auth config --- .gitignore | 8 +- api-spec-summary.md | 4 +- .../GoAffPro.Client.IntegrationTests.csproj | 2 +- .../GoAffProClientIntegrationTests.cs | 149 +++++++++++++++++- .../appsettings.Test.local.example.json | 8 + .../GoAffPro.Client.Tests.csproj | 2 +- 6 files changed, 158 insertions(+), 15 deletions(-) create mode 100644 tests/GoAffPro.Client.IntegrationTests/appsettings.Test.local.example.json diff --git a/.gitignore b/.gitignore index cd89e01..73a1c84 100644 --- a/.gitignore +++ b/.gitignore @@ -19,12 +19,6 @@ packages/ openapi/goaffpro.openapi.json openapi/goaffpro-user.openapi.json openapi/goaffpro-public.openapi.json -openapi/swagger-ui-init.js -obj/GoAffPro.Client.Generator.hash - -# Generated code (tracked, but can be regenerated) -# Uncomment to gitignore if you prefer not to commit generated code: -# src/GoAffPro.Client/Generated/*.g.cs # Test results TestResults/ @@ -36,8 +30,10 @@ Thumbs.db # Local development overrides examples/GoAffPro.Client.Example/appsettings.development.json +tests/GoAffPro.Client.IntegrationTests/appsettings.Test.local.json # Local LLM/notes docs (not published to GitHub) AGENTS.md ARCHITECTURE.md docs/ +.tools/ diff --git a/api-spec-summary.md b/api-spec-summary.md index bad3b27..7c28072 100644 --- a/api-spec-summary.md +++ b/api-spec-summary.md @@ -6,10 +6,10 @@ This repo now has a maintained canonical spec for GoAffPro user/public APIs: ## Key decisions -- Canonical source is YAML and is decoupled from upstream `swagger-ui-init.js` schema drift. +- Canonical source is local YAML maintained in this repo and used directly for client generation. - Response envelopes are normalized with shared wrappers (`allOf`) for recurring pagination-like shapes. - Drift-prone payloads keep `additionalProperties: true`. -- Known logical failures that still return HTTP `200` are modeled via `oneOf` success/error responses. +- Known logical failures are captured with explicit error schemas/codes where the runtime behavior is stable. - Known plain-text failure cases are modeled (`/user/feed/rewards` -> `404`, `/user/feed/products` -> `502`). ## Added/normalized user endpoints diff --git a/tests/GoAffPro.Client.IntegrationTests/GoAffPro.Client.IntegrationTests.csproj b/tests/GoAffPro.Client.IntegrationTests/GoAffPro.Client.IntegrationTests.csproj index 906bf5e..0f4e4f0 100644 --- a/tests/GoAffPro.Client.IntegrationTests/GoAffPro.Client.IntegrationTests.csproj +++ b/tests/GoAffPro.Client.IntegrationTests/GoAffPro.Client.IntegrationTests.csproj @@ -1,7 +1,7 @@  - net8.0;net10.0 + net9.0;net10.0 enable enable false diff --git a/tests/GoAffPro.Client.IntegrationTests/GoAffProClientIntegrationTests.cs b/tests/GoAffPro.Client.IntegrationTests/GoAffProClientIntegrationTests.cs index 2461d76..bb4e33e 100644 --- a/tests/GoAffPro.Client.IntegrationTests/GoAffProClientIntegrationTests.cs +++ b/tests/GoAffPro.Client.IntegrationTests/GoAffProClientIntegrationTests.cs @@ -1,12 +1,17 @@ +using System.Text.Json; +using GoAffPro.Client.Generated.User.Sites; +using AggregateField = GoAffPro.Client.Generated.User.Stats.Aggregate.GetFieldsQueryParameterType; + namespace GoAffPro.Client.IntegrationTests; public sealed class GoAffProClientIntegrationTests { [Fact] [Trait("Category", "Integration")] - public async Task GetOrdersAsync_WhenTokenIsConfigured_ReturnsFeedWithoutThrowing() + public async Task CoreEndpoints_WhenAuthIsConfigured_ReturnWithoutThrowing() { - string? token = Environment.GetEnvironmentVariable("GOAFFPRO_TEST_TOKEN"); + var settings = IntegrationTestSettings.Load(); + string? token = await ResolveTokenAsync(settings); if (string.IsNullOrWhiteSpace(token)) { return; @@ -14,12 +19,146 @@ public async Task GetOrdersAsync_WhenTokenIsConfigured_ReturnsFeedWithoutThrowin await using var client = new GoAffProClient(new GoAffProClientOptions { + BaseUrl = settings.BaseUrl, BearerToken = token, }); - IReadOnlyList orders = - await client.GetOrdersAsync(limit: 5, cancellationToken: CancellationToken.None); + _ = await client.Api.User.GetAsync(cancellationToken: CancellationToken.None); + _ = await client.Api.User.Sites.GetAsync(config => + { + config.QueryParameters.Limit = 1; + config.QueryParameters.Offset = 0; + config.QueryParameters.StatusAsGetStatusQueryParameterType = GetStatusQueryParameterType.Approved; + config.QueryParameters.FieldsAsGetFieldsQueryParameterType = + [ + GetFieldsQueryParameterType.Id, + GetFieldsQueryParameterType.Name, + GetFieldsQueryParameterType.Logo, + ]; + }, CancellationToken.None); + _ = await client.Api.User.Stats.Aggregate.GetAsync(config => + { + config.QueryParameters.FieldsAsGetFieldsQueryParameterType = + [ + AggregateField.Total_sales, + AggregateField.Revenue_generated, + ]; + }, CancellationToken.None); + _ = await client.Api.User.Feed.Orders.GetAsync(config => + { + config.QueryParameters.Limit = 1; + config.QueryParameters.Offset = 0; + }, CancellationToken.None); + _ = await client.Api.User.Feed.Traffic.GetAsync(config => + { + config.QueryParameters.Limit = 1; + config.QueryParameters.Offset = 0; + }, CancellationToken.None); + _ = await client.Api.User.Commissions.GetAsync(cancellationToken: CancellationToken.None); + _ = await client.Api.Public.Sites.GetAsync(config => + { + config.QueryParameters.Limit = 1; + config.QueryParameters.Offset = 0; + }, CancellationToken.None); + } + + private static async Task ResolveTokenAsync(IntegrationTestSettings settings) + { + string? token = Environment.GetEnvironmentVariable("GOAFFPRO_TEST_TOKEN"); + if (!string.IsNullOrWhiteSpace(token)) + { + return token; + } + + if (!string.IsNullOrWhiteSpace(settings.Token)) + { + return settings.Token; + } + + string? email = Environment.GetEnvironmentVariable("GOAFFPRO_TEST_EMAIL") ?? settings.Email; + string? password = Environment.GetEnvironmentVariable("GOAFFPRO_TEST_PASSWORD") ?? settings.Password; + if (string.IsNullOrWhiteSpace(email) || string.IsNullOrWhiteSpace(password)) + { + return null; + } + + await using var authClient = new GoAffProClient(new GoAffProClientOptions + { + BaseUrl = settings.BaseUrl, + }); + + return await authClient.LoginAsync(email, password, CancellationToken.None); + } +} + +internal sealed record IntegrationTestSettings(Uri BaseUrl, string? Token, string? Email, string? Password) +{ + public static IntegrationTestSettings Default { get; } = new( + new Uri("https://api.goaffpro.com/v1/", UriKind.Absolute), + null, + null, + null); + + public static IntegrationTestSettings Load() + { + string path = FindSettingsPath(); + if (!File.Exists(path)) + { + return Default; + } + + try + { + string json = File.ReadAllText(path); + using var document = JsonDocument.Parse(json); + if (!document.RootElement.TryGetProperty("GoAffPro", out JsonElement root)) + { + return Default; + } + + string baseUrlRaw = root.TryGetProperty(nameof(BaseUrl), out JsonElement baseUrlNode) + ? baseUrlNode.GetString() ?? Default.BaseUrl.ToString() + : Default.BaseUrl.ToString(); + Uri baseUrl = Uri.TryCreate(baseUrlRaw, UriKind.Absolute, out Uri? parsed) + ? parsed + : Default.BaseUrl; + + string? token = root.TryGetProperty(nameof(Token), out JsonElement tokenNode) ? tokenNode.GetString() : null; + string? email = root.TryGetProperty(nameof(Email), out JsonElement emailNode) ? emailNode.GetString() : null; + string? password = root.TryGetProperty(nameof(Password), out JsonElement passwordNode) ? passwordNode.GetString() : null; + return new IntegrationTestSettings(baseUrl, token, email, password); + } + catch (IOException) + { + return Default; + } + catch (JsonException) + { + return Default; + } + } + + private static string FindSettingsPath() + { + const string fileName = "appsettings.Test.local.json"; + string? current = AppContext.BaseDirectory; + while (!string.IsNullOrWhiteSpace(current)) + { + string candidate = Path.Combine(current, fileName); + if (File.Exists(candidate)) + { + return candidate; + } + + string repoCandidate = Path.Combine(current, "tests", "GoAffPro.Client.IntegrationTests", fileName); + if (File.Exists(repoCandidate)) + { + return repoCandidate; + } + + current = Directory.GetParent(current)?.FullName; + } - Assert.NotNull(orders); + return fileName; } } diff --git a/tests/GoAffPro.Client.IntegrationTests/appsettings.Test.local.example.json b/tests/GoAffPro.Client.IntegrationTests/appsettings.Test.local.example.json new file mode 100644 index 0000000..6256ccc --- /dev/null +++ b/tests/GoAffPro.Client.IntegrationTests/appsettings.Test.local.example.json @@ -0,0 +1,8 @@ +{ + "GoAffPro": { + "BaseUrl": "https://api.goaffpro.com/v1/", + "Token": "do all", + "Email": "", + "Password": "" + } +} diff --git a/tests/GoAffPro.Client.Tests/GoAffPro.Client.Tests.csproj b/tests/GoAffPro.Client.Tests/GoAffPro.Client.Tests.csproj index 04f040e..5995aa1 100644 --- a/tests/GoAffPro.Client.Tests/GoAffPro.Client.Tests.csproj +++ b/tests/GoAffPro.Client.Tests/GoAffPro.Client.Tests.csproj @@ -1,7 +1,7 @@  - net8.0;net10.0 + net9.0;net10.0 enable enable false From 7627ad210a7eebd7633e71abb9a36ea351b092e5 Mon Sep 17 00:00:00 2001 From: Agash Date: Wed, 25 Feb 2026 10:24:09 +0100 Subject: [PATCH 7/8] chore(ci): remove obsolete generated spec artifacts --- api-spec-summary.md | 34 - openapi/goaffpro-canonical.json | 1381 ------------------------------- 2 files changed, 1415 deletions(-) delete mode 100644 api-spec-summary.md delete mode 100644 openapi/goaffpro-canonical.json diff --git a/api-spec-summary.md b/api-spec-summary.md deleted file mode 100644 index 7c28072..0000000 --- a/api-spec-summary.md +++ /dev/null @@ -1,34 +0,0 @@ -# API Spec Summary - -This repo now has a maintained canonical spec for GoAffPro user/public APIs: - -- `openapi/goaffpro-canonical.yaml` - -## Key decisions - -- Canonical source is local YAML maintained in this repo and used directly for client generation. -- Response envelopes are normalized with shared wrappers (`allOf`) for recurring pagination-like shapes. -- Drift-prone payloads keep `additionalProperties: true`. -- Known logical failures are captured with explicit error schemas/codes where the runtime behavior is stable. -- Known plain-text failure cases are modeled (`/user/feed/rewards` -> `404`, `/user/feed/products` -> `502`). - -## Added/normalized user endpoints - -- `/user/sites` -> `{ sites: [], count }` (fixed from upstream singular-object mismatch) -- `/user/stats/aggregate` -> `{ data: [] }` -- `/user/feed/orders|payouts|products|rewards|traffic` envelopes normalized -- `/user/commissions` supports observed variant payloads -- `/user/payouts/pending` added (observed working with bearer token) -- `/user/feed/transactions` added (currently returns `500` with bearer token but endpoint appears present) - -## Probe scripts retained - -- `scripts/analyze-api.ps1` - Scenario-based probe (auth/no-auth, body-aware, logical `200` error detection). -- `scripts/probe-openapi-spec.ps1` - Spec-driven probe for JSON/YAML OpenAPI files, nested shape summaries, optional no-auth user probes. - -## Notes - -- No access token is stored in repo files. -- Probe outputs are intentionally not kept as committed artifacts. diff --git a/openapi/goaffpro-canonical.json b/openapi/goaffpro-canonical.json deleted file mode 100644 index b136ea5..0000000 --- a/openapi/goaffpro-canonical.json +++ /dev/null @@ -1,1381 +0,0 @@ -{ - "openapi": "3.0.3", - "info": { - "title": "GOAFFPRO Canonical API (User/Public)", - "version": "2026.2.25", - "description": "Maintained canonical contract for GoAffPro user/public endpoints. This spec intentionally corrects known response-shape drift from upstream docs.\n" - }, - "servers": [ - { - "url": "https://api.goaffpro.com/v1/" - } - ], - "paths": { - "/user/login": { - "post": { - "summary": "Log in to get the access token", - "requestBody": { - "required": true, - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "type": "object", - "required": [ - "email", - "password" - ], - "properties": { - "email": { - "type": "string" - }, - "password": { - "type": "string" - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoginResponse" - } - } - } - } - } - } - }, - "/user/sites": { - "get": { - "summary": "List of stores the user is enrolled in", - "parameters": [ - { - "$ref": "#/components/parameters/LimitQuery" - }, - { - "$ref": "#/components/parameters/OffsetQuery" - }, - { - "$ref": "#/components/parameters/UserStatusQuery" - }, - { - "in": "query", - "name": "fields", - "required": true, - "explode": false, - "schema": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "id", - "name", - "logo", - "website", - "status", - "currency", - "affiliate_portal", - "ref_code", - "referral_link", - "coupon" - ] - } - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserSiteListResponse" - } - } - } - }, - "403": { - "$ref": "#/components/responses/AuthErrorResponse" - } - } - } - }, - "/user": { - "get": { - "summary": "Get information about logged in user profile", - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserProfileEnvelope" - } - } - } - }, - "403": { - "$ref": "#/components/responses/AuthErrorResponse" - } - } - }, - "post": { - "summary": "Update your profile", - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserProfileUpdateResponse" - } - } - } - }, - "403": { - "$ref": "#/components/responses/AuthErrorResponse" - } - } - } - }, - "/user/stats/aggregate": { - "get": { - "summary": "Aggregates of user stats", - "parameters": [ - { - "$ref": "#/components/parameters/SiteIdsQuery" - }, - { - "$ref": "#/components/parameters/StartTimeQuery" - }, - { - "$ref": "#/components/parameters/EndTimeQuery" - }, - { - "in": "query", - "name": "fields", - "required": true, - "explode": false, - "schema": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "total_sales", - "other_commission_earned", - "revenue_generated", - "sale_commission_earned", - "commission_paid" - ] - } - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserStatsAggregateResponse" - } - } - } - }, - "403": { - "$ref": "#/components/responses/AuthErrorResponse" - } - } - } - }, - "/user/feed/orders": { - "get": { - "summary": "Feed of user orders", - "parameters": [ - { - "$ref": "#/components/parameters/SiteIdsQuery" - }, - { - "$ref": "#/components/parameters/SinceIdStringQuery" - }, - { - "$ref": "#/components/parameters/MaxIdQuery" - }, - { - "$ref": "#/components/parameters/CreatedAtMaxQuery" - }, - { - "$ref": "#/components/parameters/CreatedAtMinQuery" - }, - { - "in": "query", - "name": "fields", - "required": true, - "explode": false, - "schema": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "id", - "number", - "total", - "subtotal", - "line_items", - "commission", - "created_at", - "currency", - "site_id", - "sub_id", - "conversion_details" - ] - } - } - }, - { - "$ref": "#/components/parameters/LimitQuery" - }, - { - "$ref": "#/components/parameters/OffsetQuery" - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserOrderFeedResponse" - } - } - } - }, - "403": { - "$ref": "#/components/responses/AuthErrorResponse" - } - } - } - }, - "/user/feed/payouts": { - "get": { - "summary": "Feed of user payouts", - "parameters": [ - { - "$ref": "#/components/parameters/SiteIdsQuery" - }, - { - "$ref": "#/components/parameters/StartTimeQuery" - }, - { - "$ref": "#/components/parameters/EndTimeQuery" - }, - { - "$ref": "#/components/parameters/SinceIdIntegerQuery" - }, - { - "$ref": "#/components/parameters/LimitQuery" - }, - { - "$ref": "#/components/parameters/OffsetQuery" - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserPayoutFeedResponse" - } - } - } - }, - "403": { - "$ref": "#/components/responses/AuthErrorResponse" - } - } - } - }, - "/user/feed/products": { - "get": { - "summary": "Feed of products available for promotion", - "parameters": [ - { - "$ref": "#/components/parameters/LimitQuery" - }, - { - "$ref": "#/components/parameters/OffsetQuery" - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserProductFeedResponse" - } - } - } - }, - "403": { - "$ref": "#/components/responses/AuthErrorResponse" - }, - "502": { - "$ref": "#/components/responses/PlainTextErrorResponse" - } - } - } - }, - "/user/feed/rewards": { - "get": { - "summary": "Feed of user rewards", - "parameters": [ - { - "$ref": "#/components/parameters/SiteIdsQuery" - }, - { - "$ref": "#/components/parameters/StartTimeQuery" - }, - { - "$ref": "#/components/parameters/EndTimeQuery" - }, - { - "$ref": "#/components/parameters/SinceIdIntegerQuery" - }, - { - "$ref": "#/components/parameters/LimitQuery" - }, - { - "$ref": "#/components/parameters/OffsetQuery" - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserRewardFeedResponse" - } - } - } - }, - "404": { - "$ref": "#/components/responses/PlainTextErrorResponse" - } - } - } - }, - "/user/feed/traffic": { - "get": { - "summary": "Feed of user traffic", - "parameters": [ - { - "$ref": "#/components/parameters/SiteIdsQuery" - }, - { - "$ref": "#/components/parameters/StartTimeQuery" - }, - { - "$ref": "#/components/parameters/EndTimeQuery" - }, - { - "$ref": "#/components/parameters/SinceIdIntegerQuery" - }, - { - "$ref": "#/components/parameters/LimitQuery" - }, - { - "$ref": "#/components/parameters/OffsetQuery" - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserTrafficFeedResponse" - } - } - } - }, - "403": { - "$ref": "#/components/responses/AuthErrorResponse" - } - } - } - }, - "/user/feed/transactions": { - "get": { - "summary": "Feed of user transactions", - "parameters": [ - { - "$ref": "#/components/parameters/LimitQuery" - }, - { - "$ref": "#/components/parameters/OffsetQuery" - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserTransactionFeedResponse" - } - } - } - }, - "403": { - "$ref": "#/components/responses/AuthErrorResponse" - }, - "500": { - "$ref": "#/components/responses/PlainTextErrorResponse" - } - } - } - }, - "/user/commissions": { - "get": { - "summary": "Get commission structure", - "parameters": [ - { - "$ref": "#/components/parameters/SiteIdsQuery" - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserCommissionsResponse" - } - } - } - }, - "403": { - "$ref": "#/components/responses/AuthErrorResponse" - } - } - } - }, - "/user/payouts/pending": { - "get": { - "summary": "Get pending payout amount (and its breakdown)", - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserPendingPayoutsResponse" - } - } - } - }, - "403": { - "$ref": "#/components/responses/AuthErrorResponse" - } - } - } - }, - "/public/sites": { - "get": { - "summary": "Public marketplace sites", - "parameters": [ - { - "$ref": "#/components/parameters/SiteIdsQuery" - }, - { - "$ref": "#/components/parameters/PublicCurrencyQuery" - }, - { - "$ref": "#/components/parameters/PublicKeywordQuery" - }, - { - "$ref": "#/components/parameters/LimitQuery" - }, - { - "$ref": "#/components/parameters/OffsetQuery" - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PublicSitesResponse" - } - } - } - }, - "500": { - "$ref": "#/components/responses/PlainTextErrorResponse" - }, - "502": { - "$ref": "#/components/responses/PlainTextErrorResponse" - } - } - } - }, - "/public/products": { - "get": { - "summary": "Public marketplace products", - "parameters": [ - { - "$ref": "#/components/parameters/LimitQuery" - }, - { - "$ref": "#/components/parameters/OffsetQuery" - }, - { - "$ref": "#/components/parameters/SiteIdsQuery" - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PublicProductsResponse" - } - } - } - }, - "500": { - "$ref": "#/components/responses/PlainTextErrorResponse" - }, - "502": { - "$ref": "#/components/responses/PlainTextErrorResponse" - } - } - } - } - }, - "components": { - "parameters": { - "LimitQuery": { - "in": "query", - "name": "limit", - "schema": { - "type": "integer" - } - }, - "OffsetQuery": { - "in": "query", - "name": "offset", - "schema": { - "type": "integer" - } - }, - "SiteIdsQuery": { - "in": "query", - "name": "site_ids", - "schema": { - "type": "string" - } - }, - "StartTimeQuery": { - "in": "query", - "name": "start_time", - "schema": { - "type": "string" - } - }, - "EndTimeQuery": { - "in": "query", - "name": "end_time", - "schema": { - "type": "string" - } - }, - "SinceIdIntegerQuery": { - "in": "query", - "name": "since_id", - "schema": { - "type": "integer" - } - }, - "SinceIdStringQuery": { - "in": "query", - "name": "since_id", - "schema": { - "type": "string" - } - }, - "MaxIdQuery": { - "in": "query", - "name": "max_id", - "schema": { - "type": "string" - } - }, - "CreatedAtMaxQuery": { - "in": "query", - "name": "created_at_max", - "schema": { - "type": "string" - } - }, - "CreatedAtMinQuery": { - "in": "query", - "name": "created_at_min", - "schema": { - "type": "string" - } - }, - "PublicCurrencyQuery": { - "in": "query", - "name": "currency", - "schema": { - "type": "string" - } - }, - "PublicKeywordQuery": { - "in": "query", - "name": "keyword", - "schema": { - "type": "string" - } - }, - "UserStatusQuery": { - "in": "query", - "name": "status", - "schema": { - "type": "string", - "enum": [ - "approved", - "pending", - "blocked" - ] - } - } - }, - "responses": { - "AuthErrorResponse": { - "description": "Authentication or authorization failure.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/plain": { - "schema": { - "type": "string" - } - } - } - }, - "PlainTextErrorResponse": { - "description": "Upstream service error response in plain text.", - "content": { - "text/plain": { - "schema": { - "type": "string" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - }, - "schemas": { - "LoginResponse": { - "type": "object", - "required": [ - "access_token" - ], - "properties": { - "access_token": { - "type": "string" - } - } - }, - "UserProfileEnvelope": { - "type": "object", - "required": [ - "user" - ], - "properties": { - "user": { - "type": "object", - "additionalProperties": true - } - }, - "additionalProperties": true - }, - "UserProfileUpdateResponse": { - "type": "object", - "required": [ - "success" - ], - "properties": { - "success": { - "type": "integer" - } - }, - "additionalProperties": true - }, - "UserSiteListResponse": { - "type": "object", - "required": [ - "sites", - "count" - ], - "properties": { - "sites": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserSite" - } - }, - "count": { - "type": "integer" - } - }, - "additionalProperties": true - }, - "UserSite": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "logo": { - "type": "string" - }, - "website": { - "type": "string" - }, - "status": { - "type": "string" - }, - "currency": { - "type": "string" - }, - "affiliate_portal": { - "type": "string" - }, - "ref_code": { - "type": "string" - }, - "referral_link": { - "type": "string" - }, - "coupon": { - "type": "object", - "additionalProperties": true - } - }, - "additionalProperties": true - }, - "UserStatsAggregateResponse": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserStatsAggregateItem" - } - } - }, - "additionalProperties": true - }, - "UserStatsAggregateItem": { - "type": "object", - "properties": { - "site_id": { - "type": "integer" - }, - "total_sales": { - "type": "number" - }, - "currency": { - "type": "string" - }, - "sale_commission_earned": { - "type": "number" - }, - "revenue_generated": { - "type": "number" - }, - "commission_paid": { - "type": "number" - } - }, - "additionalProperties": true - }, - "CountLimitOffsetEnvelope": { - "type": "object", - "required": [ - "count", - "limit", - "offset" - ], - "properties": { - "count": { - "type": "integer" - }, - "limit": { - "type": "integer" - }, - "offset": { - "type": "integer" - } - }, - "additionalProperties": true - }, - "CountLimitOffsetEnvelopeFlexibleOffset": { - "type": "object", - "required": [ - "count", - "limit", - "offset" - ], - "properties": { - "count": { - "type": "integer" - }, - "limit": { - "type": "integer" - }, - "offset": { - "oneOf": [ - { - "type": "integer" - }, - { - "type": "string" - } - ] - } - }, - "additionalProperties": true - }, - "SinceIdEcho": { - "type": "object", - "properties": { - "since_id": { - "oneOf": [ - { - "type": "integer" - }, - { - "type": "string" - } - ] - } - }, - "additionalProperties": true - }, - "UserOrderFeedResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/CountLimitOffsetEnvelope" - }, - { - "type": "object", - "required": [ - "orders" - ], - "properties": { - "orders": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": true - } - } - }, - "additionalProperties": true - } - ] - }, - "UserPayoutFeedResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/CountLimitOffsetEnvelope" - }, - { - "$ref": "#/components/schemas/SinceIdEcho" - }, - { - "type": "object", - "required": [ - "payouts" - ], - "properties": { - "payouts": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": true - } - } - }, - "additionalProperties": true - } - ] - }, - "UserProductFeedResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/CountLimitOffsetEnvelopeFlexibleOffset" - }, - { - "type": "object", - "required": [ - "products" - ], - "properties": { - "products": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": true - } - } - }, - "additionalProperties": true - } - ] - }, - "UserRewardFeedResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/CountLimitOffsetEnvelope" - }, - { - "type": "object", - "required": [ - "rewards" - ], - "properties": { - "rewards": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserRewardFeedItem" - } - } - }, - "additionalProperties": true - } - ] - }, - "UserRewardFeedItem": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "affiliate_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "metadata": { - "type": "string" - }, - "order_id": { - "type": "string" - }, - "level": { - "type": "integer" - }, - "amount": { - "type": "number" - }, - "status": { - "type": "string" - }, - "created": { - "type": "string" - } - }, - "additionalProperties": true - }, - "UserTrafficFeedResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/CountLimitOffsetEnvelope" - }, - { - "$ref": "#/components/schemas/SinceIdEcho" - }, - { - "type": "object", - "required": [ - "traffic" - ], - "properties": { - "traffic": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": true - } - } - }, - "additionalProperties": true - } - ] - }, - "UserCommissionsResponse": { - "type": "object", - "properties": { - "standard": { - "type": "object", - "additionalProperties": true - }, - "special": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": true - } - }, - "royalties": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": true - } - }, - "mlm": { - "type": "object", - "additionalProperties": true - }, - "commissions": { - "type": "array", - "items": { - "nullable": true - } - } - }, - "additionalProperties": true - }, - "UserTransactionFeedResponse": { - "type": "object", - "required": [ - "transactions" - ], - "properties": { - "transactions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserTransactionItem" - } - }, - "count": { - "type": "integer" - }, - "limit": { - "type": "integer" - }, - "offset": { - "oneOf": [ - { - "type": "integer" - }, - { - "type": "string" - } - ] - } - }, - "additionalProperties": true - }, - "UserTransactionItem": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "tx_id": { - "type": "integer" - }, - "affiliate_id": { - "type": "integer" - }, - "amount": { - "type": "number" - }, - "currency": { - "type": "string" - }, - "startingBalance": { - "type": "number" - }, - "endingBalance": { - "type": "number" - }, - "created_at": { - "type": "string" - }, - "entity_type": { - "type": "string", - "enum": [ - "orders", - "rewards", - "payouts", - "ORDERS", - "REWARDS", - "PAYOUTS" - ] - }, - "event_type": { - "type": "string", - "enum": [ - "insert", - "update", - "delete" - ] - }, - "entity_id": { - "type": "string" - }, - "is_paid": { - "type": "boolean" - }, - "metadata": { - "type": "object", - "additionalProperties": true - } - }, - "additionalProperties": true - }, - "UserPendingPayoutsResponse": { - "type": "object", - "required": [ - "pending" - ], - "properties": { - "pending": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/components/schemas/PendingPayoutItem" - } - }, - { - "$ref": "#/components/schemas/PendingPayoutBreakdown" - } - ] - } - }, - "additionalProperties": true - }, - "PendingPayoutItem": { - "type": "object", - "properties": { - "affiliate_id": { - "oneOf": [ - { - "type": "integer" - }, - { - "type": "string" - } - ] - }, - "amount": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "string" - } - ] - }, - "total_earned": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "string" - } - ] - }, - "total_paid": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "string" - } - ] - } - }, - "additionalProperties": true - }, - "PendingPayoutBreakdown": { - "type": "object", - "properties": { - "sale_earnings": { - "type": "number" - }, - "other_earnings": { - "type": "number" - }, - "paid_earnings": { - "type": "number" - }, - "amount_pending": { - "type": "number" - } - }, - "additionalProperties": true - }, - "PublicSitesResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/CountLimitOffsetEnvelopeFlexibleOffset" - }, - { - "type": "object", - "required": [ - "stores" - ], - "properties": { - "stores": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PublicStore" - } - }, - "currency": { - "type": "string" - }, - "keyword": { - "type": "string" - } - }, - "additionalProperties": true - } - ] - }, - "PublicStore": { - "type": "object", - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "website": { - "type": "string" - }, - "logo": { - "type": "string" - }, - "currency": { - "type": "string" - }, - "affiliatePortal": { - "type": "string" - }, - "cookieDuration": { - "type": "integer" - }, - "areRegistrationsOpen": { - "type": "integer" - }, - "isApprovedAutomatically": { - "type": "integer" - }, - "commission": { - "$ref": "#/components/schemas/CommissionLike" - } - }, - "additionalProperties": true - }, - "PublicProductsResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/CountLimitOffsetEnvelopeFlexibleOffset" - }, - { - "type": "object", - "required": [ - "products" - ], - "properties": { - "products": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": true - } - }, - "site_ids": { - "type": "string" - } - }, - "additionalProperties": true - } - ] - }, - "CommissionLike": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "amount": { - "type": "number" - }, - "true": { - "type": "string" - } - }, - "additionalProperties": true - }, - "ErrorResponse": { - "type": "object", - "required": [ - "error" - ], - "properties": { - "error": { - "type": "string" - }, - "code": { - "oneOf": [ - { - "type": "integer" - }, - { - "type": "string" - } - ] - } - }, - "additionalProperties": true - } - } - } -} From 57e737bd72c07905e8dfa6a302d583af87035440 Mon Sep 17 00:00:00 2001 From: Agash Date: Wed, 25 Feb 2026 10:27:14 +0100 Subject: [PATCH 8/8] docs(spec): annotate unstable and parity user endpoints --- openapi/goaffpro-canonical.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/openapi/goaffpro-canonical.yaml b/openapi/goaffpro-canonical.yaml index 3dd7084..c449ee3 100644 --- a/openapi/goaffpro-canonical.yaml +++ b/openapi/goaffpro-canonical.yaml @@ -185,6 +185,9 @@ paths: $ref: '#/components/responses/PlainTextErrorResponse' /user/feed/products: + # Known runtime issue (observed on 2026-02-25): + # endpoint can hang/timeout for valid authenticated requests. + # Keep error mappings broad and preserve this note until behavior stabilizes. get: summary: Feed of products available for promotion parameters: @@ -207,6 +210,9 @@ paths: $ref: '#/components/responses/PlainTextErrorResponse' /user/feed/rewards: + # Known runtime issue (observed on 2026-02-25): + # endpoint responds as not found / non-JSON error payload for authenticated requests. + # Leave modeled but treat as unstable until upstream fixes behavior. get: summary: Feed of user rewards parameters: @@ -257,6 +263,9 @@ paths: $ref: '#/components/responses/PlainTextErrorResponse' /user/feed/transactions: + # Known runtime issue (observed on 2026-02-25): + # endpoint can return HTTP 500 with HTML/plain-text error payloads. + # Error content may not match structured JSON schema. get: summary: Feed of user transactions parameters: @@ -296,6 +305,9 @@ paths: $ref: '#/components/responses/PlainTextErrorResponse' /user/payouts/pending: + # Undocumented/parity endpoint: + # observed to exist on /user while also exposed under /sdk/user paths. + # Keep tracked here even if upstream /user docs omit or mis-document it. get: summary: Get pending payout amount (and its breakdown) responses: