Skip to content

Commit b5f2c1a

Browse files
authored
Adding Revenue (#9)
1 parent b179985 commit b5f2c1a

File tree

4 files changed

+100
-1
lines changed

4 files changed

+100
-1
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "swift" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"

.github/workflows/codeql.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "main", "v1.0.0" ]
17+
pull_request:
18+
branches: [ "main" ]
19+
schedule:
20+
- cron: '16 9 * * 1'
21+
22+
jobs:
23+
analyze:
24+
name: Analyze
25+
# Runner size impacts CodeQL analysis time. To learn more, please see:
26+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
27+
# - https://gh.io/supported-runners-and-hardware-resources
28+
# - https://gh.io/using-larger-runners
29+
# Consider using larger runners for possible analysis time improvements.
30+
runs-on: ${{ (matrix.language == 'swift' && 'macos-13') || 'ubuntu-latest' }}
31+
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
32+
permissions:
33+
actions: read
34+
contents: read
35+
security-events: write
36+
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
language: [ 'swift' ]
41+
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
42+
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
43+
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
44+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
45+
46+
steps:
47+
- name: Checkout repository
48+
uses: actions/checkout@v4
49+
50+
- name: Setup Xcode
51+
run: sudo xcode-select -s /Applications/Xcode_15.1.app/Contents/Developer
52+
53+
# Initializes the CodeQL tools for scanning.
54+
- name: Initialize CodeQL
55+
uses: github/codeql-action/init@v3
56+
with:
57+
languages: ${{ matrix.language }}
58+
# If you wish to specify custom queries, you can do so here or in a config file.
59+
# By default, queries listed here will override any specified in a config file.
60+
# Prefix the list here with "+" to use these queries and those in the config file.
61+
62+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
63+
# queries: security-extended,security-and-quality
64+
65+
66+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
67+
# If this step fails, then you should remove it and run the build manually (see below)
68+
- run: |
69+
echo "Run, Build Application using script"
70+
swift build
71+
72+
- name: Perform CodeQL Analysis
73+
uses: github/codeql-action/analyze@v3
74+
with:
75+
category: "/language:${{matrix.language}}"

Sources/AviaryInsights/Operations.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ extension Operations.post_sol_event.Input.Body.jsonPayload {
4949
domain: event.domain ?? defaultDomain,
5050
url: event.url,
5151
referrer: event.referrer,
52-
props: propsContainer
52+
props: propsContainer,
53+
revenue: .init(revenue: event.revenue)
5354
)
5455
}
5556
}

Sources/AviaryInsights/Revenue.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,15 @@ public struct Revenue: Sendable {
4444
self.amount = amount
4545
}
4646
}
47+
48+
extension Operations.post_sol_event.Input.Body.jsonPayload.revenuePayload {
49+
internal init?(revenue: Revenue?) {
50+
guard let revenue else {
51+
return nil
52+
}
53+
self.init(
54+
currency: revenue.currency,
55+
amount: revenue.amount
56+
)
57+
}
58+
}

0 commit comments

Comments
 (0)